| 1 |
dnl sasl2.m4--sasl2 libraries and includes |
| 2 |
dnl Rob Siemborski |
| 3 |
dnl $Id: sasl2.m4,v 1.30 2003/07/02 13:13:40 rjs3 Exp $ |
| 4 |
|
| 5 |
AC_DEFUN(SASL_GSSAPI_CHK,[ |
| 6 |
AC_ARG_ENABLE(gssapi, [ --enable-gssapi=<DIR> enable GSSAPI authentication [yes] ], |
| 7 |
gssapi=$enableval, |
| 8 |
gssapi=yes) |
| 9 |
AC_REQUIRE([SASL2_CRYPT_CHK]) |
| 10 |
|
| 11 |
if test "$gssapi" != no; then |
| 12 |
if test -d ${gssapi}; then |
| 13 |
CPPFLAGS="$CPPFLAGS -I$gssapi/include" |
| 14 |
LDFLAGS="$LDFLAGS -L$gssapi/lib" |
| 15 |
fi |
| 16 |
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H,,[Define if you have the gssapi.h header file]), [ |
| 17 |
AC_CHECK_HEADER(gssapi/gssapi.h,, AC_WARN(Disabling GSSAPI); gssapi=no)]) |
| 18 |
fi |
| 19 |
|
| 20 |
if test "$gssapi" != no; then |
| 21 |
dnl We need to find out which gssapi implementation we are |
| 22 |
dnl using. Supported alternatives are: MIT Kerberos 5, |
| 23 |
dnl Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal), |
| 24 |
dnl and Sun SEAM (http://wwws.sun.com/software/security/kerberos/) |
| 25 |
dnl |
| 26 |
dnl The choice is reflected in GSSAPIBASE_LIBS |
| 27 |
dnl we might need libdb |
| 28 |
AC_CHECK_LIB(db, db_open) |
| 29 |
|
| 30 |
gss_impl="mit"; |
| 31 |
AC_CHECK_LIB(resolv,res_search) |
| 32 |
if test -d ${gssapi}; then |
| 33 |
CPPFLAGS="$CPPFLAGS -I$gssapi/include" |
| 34 |
LDFLAGS="$LDFLAGS -L$gssapi/lib" |
| 35 |
fi |
| 36 |
|
| 37 |
if test -d ${gssapi}; then |
| 38 |
gssapi_dir="${gssapi}/lib" |
| 39 |
GSSAPIBASE_LIBS="-L$gssapi_dir" |
| 40 |
GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir" |
| 41 |
else |
| 42 |
dnl FIXME: This is only used for building cyrus, and then only as |
| 43 |
dnl a real hack. it needs to be fixed. |
| 44 |
gssapi_dir="/usr/local/lib" |
| 45 |
fi |
| 46 |
|
| 47 |
# Check a full link against the heimdal libraries. |
| 48 |
# If this fails, check a full link against the Solaris 8 and up libgss. |
| 49 |
# If this fails, assume MIT. |
| 50 |
AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",,$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} -lcom_err) |
| 51 |
|
| 52 |
if test "$gss_impl" = "mit"; then |
| 53 |
AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",,-lgss) |
| 54 |
fi |
| 55 |
|
| 56 |
if test "$gss_impl" = "mit"; then |
| 57 |
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" |
| 58 |
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a" |
| 59 |
elif test "$gss_impl" = "heimdal"; then |
| 60 |
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} -lcom_err" |
| 61 |
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}" |
| 62 |
elif test "$gss_impl" = "seam"; then |
| 63 |
GSSAPIBASE_LIBS=-lgss |
| 64 |
# there is no static libgss on Solaris 8 and up |
| 65 |
GSSAPIBASE_STATIC_LIBS=none |
| 66 |
else |
| 67 |
gssapi="no" |
| 68 |
AC_WARN(Disabling GSSAPI) |
| 69 |
fi |
| 70 |
fi |
| 71 |
|
| 72 |
if test "$ac_cv_header_gssapi_h" = "yes"; then |
| 73 |
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, |
| 74 |
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])) |
| 75 |
elif test "$ac_cv_header_gssapi_gssapi_h"; then |
| 76 |
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, |
| 77 |
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])) |
| 78 |
fi |
| 79 |
|
| 80 |
if test "$ac_cv_header_gssapi_h" = "yes"; then |
| 81 |
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h, |
| 82 |
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])) |
| 83 |
elif test "$ac_cv_header_gssapi_gssapi_h"; then |
| 84 |
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h, |
| 85 |
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])) |
| 86 |
fi |
| 87 |
|
| 88 |
GSSAPI_LIBS="" |
| 89 |
AC_MSG_CHECKING(GSSAPI) |
| 90 |
if test "$gssapi" != no; then |
| 91 |
AC_MSG_RESULT(with implementation ${gss_impl}) |
| 92 |
AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv") |
| 93 |
SASL_MECHS="$SASL_MECHS libgssapiv2.la" |
| 94 |
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/gssapi.o" |
| 95 |
|
| 96 |
cmu_save_LIBS="$LIBS" |
| 97 |
LIBS="$LIBS $GSSAPIBASE_LIBS" |
| 98 |
AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity) |
| 99 |
LIBS="$cmu_save_LIBS" |
| 100 |
else |
| 101 |
AC_MSG_RESULT(disabled) |
| 102 |
fi |
| 103 |
AC_SUBST(GSSAPI_LIBS) |
| 104 |
AC_SUBST(GSSAPIBASE_LIBS) |
| 105 |
]) |
| 106 |
|
| 107 |
dnl What we want to do here is setup LIB_SASL with what one would |
| 108 |
dnl generally want to have (e.g. if static is requested, make it that, |
| 109 |
dnl otherwise make it dynamic. |
| 110 |
|
| 111 |
dnl We also want to create LIB_DYN_SASL and DYNSASLFLAGS. |
| 112 |
|
| 113 |
dnl Also sets using_static_sasl to "no" "static" or "staticonly" |
| 114 |
|
| 115 |
AC_DEFUN(CMU_SASL2, [ |
| 116 |
AC_ARG_WITH(sasl, |
| 117 |
[ --with-sasl=DIR Compile with libsasl2 in <DIR>], |
| 118 |
with_sasl="$withval", |
| 119 |
with_sasl="yes") |
| 120 |
|
| 121 |
AC_ARG_WITH(staticsasl, |
| 122 |
[ --with-staticsasl=DIR Compile with staticly linked libsasl2 in <DIR>], |
| 123 |
with_staticsasl="$withval"; |
| 124 |
if test $with_staticsasl != "no"; then |
| 125 |
using_static_sasl="static" |
| 126 |
fi, |
| 127 |
with_staticsasl="no"; using_static_sasl="no") |
| 128 |
|
| 129 |
SASLFLAGS="" |
| 130 |
LIB_SASL="" |
| 131 |
|
| 132 |
cmu_saved_CPPFLAGS=$CPPFLAGS |
| 133 |
cmu_saved_LDFLAGS=$LDFLAGS |
| 134 |
cmu_saved_LIBS=$LIBS |
| 135 |
|
| 136 |
if test ${with_staticsasl} != "no"; then |
| 137 |
if test -d ${with_staticsasl}; then |
| 138 |
ac_cv_sasl_where_lib=${with_staticsasl}/lib |
| 139 |
ac_cv_sasl_where_inc=${with_staticsasl}/include |
| 140 |
|
| 141 |
SASLFLAGS="-I$ac_cv_sasl_where_inc" |
| 142 |
LIB_SASL="-L$ac_cv_sasl_where_lib" |
| 143 |
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" |
| 144 |
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" |
| 145 |
else |
| 146 |
with_staticsasl="/usr" |
| 147 |
fi |
| 148 |
|
| 149 |
AC_CHECK_HEADER(sasl/sasl.h, [ |
| 150 |
AC_CHECK_HEADER(sasl/saslutil.h, [ |
| 151 |
if test -r ${with_staticsasl}/lib/libsasl2.a; then |
| 152 |
ac_cv_found_sasl=yes |
| 153 |
AC_MSG_CHECKING(for static libsasl) |
| 154 |
LIB_SASL="$LIB_SASL ${with_staticsasl}/lib/libsasl2.a" |
| 155 |
else |
| 156 |
AC_MSG_CHECKING(for static libsasl) |
| 157 |
AC_ERROR([Could not find ${with_staticsasl}/lib/libsasl2.a]) |
| 158 |
fi |
| 159 |
])]) |
| 160 |
|
| 161 |
AC_MSG_RESULT(found) |
| 162 |
|
| 163 |
SASL_GSSAPI_CHK |
| 164 |
|
| 165 |
LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS" |
| 166 |
fi |
| 167 |
|
| 168 |
if test -d ${with_sasl}; then |
| 169 |
ac_cv_sasl_where_lib=${with_sasl}/lib |
| 170 |
ac_cv_sasl_where_inc=${with_sasl}/include |
| 171 |
|
| 172 |
DYNSASLFLAGS="-I$ac_cv_sasl_where_inc" |
| 173 |
if test "$ac_cv_sasl_where_lib" != ""; then |
| 174 |
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, LIB_DYN_SASL) |
| 175 |
fi |
| 176 |
LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2" |
| 177 |
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" |
| 178 |
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" |
| 179 |
fi |
| 180 |
|
| 181 |
dnl be sure to check for a SASLv2 specific function |
| 182 |
AC_CHECK_HEADER(sasl/sasl.h, [ |
| 183 |
AC_CHECK_HEADER(sasl/saslutil.h, [ |
| 184 |
AC_CHECK_LIB(sasl2, prop_get, |
| 185 |
ac_cv_found_sasl=yes, |
| 186 |
ac_cv_found_sasl=no)], |
| 187 |
ac_cv_found_sasl=no)], ac_cv_found_sasl=no) |
| 188 |
|
| 189 |
if test "$ac_cv_found_sasl" = "yes"; then |
| 190 |
if test "$ac_cv_sasl_where_lib" != ""; then |
| 191 |
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, DYNLIB_SASL) |
| 192 |
fi |
| 193 |
DYNLIB_SASL="$DYNLIB_SASL -lsasl2" |
| 194 |
if test "$using_static_sasl" != "static"; then |
| 195 |
LIB_SASL=$DYNLIB_SASL |
| 196 |
SASLFLAGS=$DYNSASLFLAGS |
| 197 |
fi |
| 198 |
else |
| 199 |
DYNLIB_SASL="" |
| 200 |
DYNSASLFLAGS="" |
| 201 |
using_static_sasl="staticonly" |
| 202 |
fi |
| 203 |
|
| 204 |
LIBS="$cmu_saved_LIBS" |
| 205 |
LDFLAGS="$cmu_saved_LDFLAGS" |
| 206 |
CPPFLAGS="$cmu_saved_CPPFLAGS" |
| 207 |
|
| 208 |
AC_SUBST(LIB_DYN_SASL) |
| 209 |
AC_SUBST(DYNSASLFLAGS) |
| 210 |
AC_SUBST(LIB_SASL) |
| 211 |
AC_SUBST(SASLFLAGS) |
| 212 |
]) |
| 213 |
|
| 214 |
AC_DEFUN(CMU_SASL2_REQUIRED, |
| 215 |
[AC_REQUIRE([CMU_SASL2]) |
| 216 |
if test "$ac_cv_found_sasl" != "yes"; then |
| 217 |
AC_ERROR([Cannot continue without libsasl2. |
| 218 |
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.]) |
| 219 |
fi]) |
| 220 |
|
| 221 |
AC_DEFUN(CMU_SASL2_CHECKAPOP_REQUIRED, [ |
| 222 |
AC_REQUIRE([CMU_SASL2_REQUIRED]) |
| 223 |
|
| 224 |
cmu_saved_LDFLAGS=$LDFLAGS |
| 225 |
|
| 226 |
LDFLAGS="$LDFLAGS $LIB_SASL" |
| 227 |
|
| 228 |
AC_CHECK_LIB(sasl2, sasl_checkapop, AC_DEFINE(HAVE_APOP), |
| 229 |
AC_MSG_ERROR([libsasl2 without working sasl_checkapop. Cannot continue.])) |
| 230 |
|
| 231 |
LDFLAGS=$cmu_saved_LDFLAGS |
| 232 |
]) |
| 233 |
|
| 234 |
AC_DEFUN(SASL2_CRYPT_CHK,[ |
| 235 |
AC_CHECK_FUNC(crypt, cmu_have_crypt=yes, [ |
| 236 |
AC_CHECK_LIB(crypt, crypt, |
| 237 |
LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes, |
| 238 |
cmu_have_crypt=no)]) |
| 239 |
AC_SUBST(LIB_CRYPT) |
| 240 |
]) |