- AC_MSG_CHECKING([for Kerberos5 installation])
- if test "x$with_krb5" != "x"; then
- if test ! -x "$with_krb5/bin/krb5-config"; then
- AC_MSG_ERROR([failed to find krb5-config in $with_krb5/bin])
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ ac_save_LDFLAGS="$LDFLAGS"
+ ac_save_LIBS="$LIBS"
+
+ if test -n "$with_krb5"; then
+ if test -x "$with_krb5/bin/krb5-config"; then
+ krb5_config_command="$with_krb5/bin/krb5-config"
+ else
+ krb5_config_command=""
+ fi
+ fi
+
+ dnl
+ dnl find header files
+ dnl
+
+ if test -z "$KRB5_CPPFLAGS"; then
+ TMP_KRB5_CPPFLAGS=""
+ if test -n "$krb5_config_command"; then
+ TMP_KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
+ fi
+ if test -z "$TMP_KRB5_CPPFLAGS"; then
+ TMP_KRB5_CPPFLAGS="-I$with_krb5/include"
+ fi
+ CPPFLAGS="$CPPFLAGS $TMP_KRB5_CPPFLAGS"
+ AC_CHECK_HEADERS(gssapi.h,
+ [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
+ if test -z "$KRB5_CPPFLAGS"; then
+ AC_CHECK_HEADERS(gssapi/gssapi.h,
+ [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
+ fi
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ fi
+
+ dnl
+ dnl find libraries
+ dnl
+
+ if test -z "$KRB5_LDFLAGS" -a -n "$krb5_config_command"; then
+ TMP_KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
+ if test -n "$TMP_KRB5_LDFLAGS"; then
+ LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
+ AC_CHECK_LIB(krb5, krb5_init_context,
+ [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
+ LIBS="$ac_save_LIBS"