diff --git a/cmulocal/sasl2.m4 b/cmulocal/sasl2.m4
index 3c2841a..b086b8f 100644
--- a/cmulocal/sasl2.m4
+++ b/cmulocal/sasl2.m4
@@ -269,6 +269,18 @@ if test "$gssapi" != no; then
cmu_save_LIBS="$LIBS"
LIBS="$LIBS $GSSAPIBASE_LIBS"
AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity)
+ if test "$ac_cv_func_gsskrb5_register_acceptor_identity" = no ; then
+ AC_CHECK_HEADERS(gssapi/gssapi_krb5.h)
+ if test "$ac_cv_header_gssapi_gssapi_krb5_h" = "yes"; then
+ AC_CHECK_DECL(gsskrb5_register_acceptor_identity,
+ [AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY,1,
+ [Define if your GSSAPI implementation defines gsskrb5_register_acceptor_identity])],,
+ [
+ AC_INCLUDES_DEFAULT
+ #include <gssapi/gssapi_krb5.h>
+ ])
+ fi
+ fi
AC_CHECK_FUNCS(gss_decapsulate_token)
AC_CHECK_FUNCS(gss_encapsulate_token)
AC_CHECK_FUNCS(gss_oid_equal)
diff --git a/plugins/gssapi.c b/plugins/gssapi.c
index 6be9d23..e6fcf46 100644
--- a/plugins/gssapi.c
+++ b/plugins/gssapi.c
@@ -51,6 +51,10 @@
#include <gssapi/gssapi.h>
#endif
+#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
+#include <gssapi/gssapi_krb5.h>
+#endif
+
#ifdef WIN32
# include <winsock2.h>