1 dnl checking for kerberos 4 libraries (and DES)
3 AC_DEFUN([SASL_DES_CHK], [
4 AC_ARG_WITH(des, [ --with-des=DIR with DES (look in DIR) [yes] ],
9 if test "$with_des" != no; then
10 if test -d $with_des; then
11 CPPFLAGS="$CPPFLAGS -I${with_des}/include"
12 LDFLAGS="$LDFLAGS -L${with_des}/lib"
15 if test "$with_openssl" != no; then
16 dnl check for openssl installing -lcrypto, then make vanilla check
17 AC_CHECK_LIB(crypto, des_cbc_encrypt, [
18 AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
22 with_des=no, $LIB_RSAREF)
24 dnl same test again, different symbol name
25 if test "$with_des" = no; then
26 AC_CHECK_LIB(crypto, DES_cbc_encrypt, [
27 AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
31 with_des=no, $LIB_RSAREF)
35 if test "$with_des" = no; then
36 AC_CHECK_LIB(des, des_cbc_encrypt, [LIB_DES="-ldes";
37 with_des=yes], with_des=no)
40 if test "$with_des" = no; then
41 AC_CHECK_LIB(des425, des_cbc_encrypt, [LIB_DES="-ldes425";
42 with_des=yes], with_des=no)
45 if test "$with_des" = no; then
46 AC_CHECK_LIB(des524, des_cbc_encrypt, [LIB_DES="-ldes524";
47 with_des=yes], with_des=no)
50 if test "$with_des" = no; then
51 dnl if openssl is around, we might be able to use that for des
53 dnl if openssl has been compiled with the rsaref2 libraries,
54 dnl we need to include the rsaref libraries in the crypto check
56 AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
57 LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
60 AC_CHECK_LIB(crypto, des_cbc_encrypt, [
61 AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES,[],[Use OpenSSL DES Implementation])
65 with_des=no, $LIB_RSAREF)
69 if test "$with_des" != no; then
70 AC_DEFINE(WITH_DES,[],[Use DES])
76 AC_DEFUN([SASL_KERBEROS_V4_CHK], [
77 AC_REQUIRE([SASL_DES_CHK])
79 AC_ARG_ENABLE(krb4, [ --enable-krb4 enable KERBEROS_V4 authentication [[no]] ],
83 if test "$krb4" != no; then
84 dnl In order to compile kerberos4, we need libkrb and libdes.
85 dnl (We've already gotten libdes from SASL_DES_CHK)
86 dnl we might need -lresolv for kerberos
87 AC_CHECK_LIB(resolv,res_search)
89 dnl if we were ambitious, we would look more aggressively for the
91 if test -d ${krb4}; then
92 AC_CACHE_CHECK(for Kerberos includes, cyrus_krbinclude, [
93 for krbhloc in include/kerberosIV include/kerberos include
95 if test -f ${krb4}/${krbhloc}/krb.h ; then
96 cyrus_krbinclude=${krb4}/${krbhloc}
102 if test -n "${cyrus_krbinclude}"; then
103 CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}"
105 LDFLAGS="$LDFLAGS -L$krb4/lib"
108 if test "$with_des" != no; then
109 AC_CHECK_HEADER(krb.h, [
110 AC_CHECK_LIB(com_err, com_err, [
111 AC_CHECK_LIB(krb, krb_mk_priv,
112 [COM_ERR="-lcom_err"; SASL_KRB_LIB="-lkrb"; krb4lib="yes"],
113 krb4lib=no, $LIB_DES -lcom_err)], [
114 AC_CHECK_LIB(krb, krb_mk_priv,
115 [COM_ERR=""; SASL_KRB_LIB="-lkrb"; krb4lib="yes"],
116 krb4lib=no, $LIB_DES)])], krb4="no")
118 if test "$krb4" != "no" -a "$krb4lib" = "no"; then
119 AC_CHECK_LIB(krb4, krb_mk_priv,
120 [COM_ERR=""; SASL_KRB_LIB="-lkrb4"; krb4=yes],
123 if test "$krb4" = no; then
124 AC_WARN(No Kerberos V4 found)
127 AC_WARN(No DES library found for Kerberos V4 support)
132 if test "$krb4" != no; then
133 cmu_save_LIBS="$LIBS"
134 LIBS="$LIBS $SASL_KRB_LIB"
135 AC_CHECK_FUNCS(krb_get_err_text)
136 LIBS="$cmu_save_LIBS"
139 AC_MSG_CHECKING(KERBEROS_V4)
140 if test "$krb4" != no; then
141 AC_MSG_RESULT(enabled)
142 SASL_MECHS="$SASL_MECHS libkerberos4.la"
143 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/kerberos4.c"
144 SASL_STATIC_OBJS="$SASL_STATIC_OBJS kerberos4.o"
145 AC_DEFINE(STATIC_KERBEROS4,[],[User KERBEROS_V4 Staticly])
146 AC_DEFINE(HAVE_KRB,[],[Do we have Kerberos 4 Support?])
147 SASL_KRB_LIB="$SASL_KRB_LIB $LIB_DES $COM_ERR"
149 AC_MSG_RESULT(disabled)
151 AC_SUBST(SASL_KRB_LIB)