test-heimdal-20060217
[openafs.git] / src / cf / kerberos.m4
index 88dd2cf..8ec840d 100644 (file)
@@ -6,16 +6,14 @@ dnl
 
 AC_DEFUN([OPENAFS_KRB5CONF],[
 
-AC_ARG_VAR(KRB5CFLAGS, [C flags to compile Kerberos 5 programs])
-AC_ARG_VAR(KRB5LIBS, [Libraries and flags to compile Kerberos 5 programs])
-AC_ARG_VAR(KRB5_CONFIG, [Location of krb5-config script])
+dnl AC_ARG_VAR(KRB5CFLAGS, [C flags to compile Kerberos 5 programs])
+dnl AC_ARG_VAR(KRB5LIBS, [Libraries and flags to compile Kerberos 5 programs])
+dnl AC_ARG_VAR(KRB5_CONFIG, [Location of krb5-config script])
 
-AC_ARG_WITH([krb5-conf],
-       AC_HELP_STRING([--with-krb5-config[=krb5-config-location]],
-                      [Use a krb5-config script to configure Kerberos]),
-       [if test X$withval != Xno; then
+AC_ARG_WITH([krb5-conf],[--with-krb5-conf[=krb5-config-location]    Use a krb5-config script to configure Kerberos])
+if test X$with_krb5_conf != X; then
                conf_krb5=YES
-               if test X$withval = Xyes; then
+               if test X$with_krb5_conf = Xyes; then
                        AC_PATH_PROG(KRB5_CONFIG, krb5-config, not_found)
                        if test X$KRB5_CONFIG = Xnot_found; then
                                AC_MSG_ERROR([cannot find krb5-config script, you must configure Kerberos manually])
@@ -35,12 +33,12 @@ AC_ARG_WITH([krb5-conf],
                fi
                AC_MSG_RESULT([Adding $KRB5CFLAGS to KRB5CFLAGS])
                AC_MSG_RESULT([Adding $KRB5LIBS to KRB5LIBS])
-       fi])
+fi
+
+AC_ARG_WITH([krb5], [--with-krb5 Support for Kerberos 5 (manual configuration)])
 
-AC_ARG_WITH([krb5],
-       AC_HELP_STRING([--with-krb5],
-                      [Support for Kerberos 5 (manual configuration)]),
-       [if test X$conf_krb5 = XYES; then
+if test X$with_krb5 = Xyes; then
+        if test X$conf_krb5 = XYES; then
                AC_MSG_ERROR([--with-krb5-config and --with-krb5 are mutually exclusive, choose only one])
        fi
        if test "X$KRB5CFLAGS" = X; then
@@ -49,19 +47,64 @@ AC_ARG_WITH([krb5],
        if test "X$KRB5LIBS" = X; then
                AC_MSG_WARN([KRB5LIBS is not set])
        fi
-       conf_krb5=YES])
+       conf_krb5=YES
+fi
 
 BUILD_KRB5=no
 if test X$conf_krb5 = XYES; then
        AC_MSG_RESULT([Configuring support for Kerberos 5 utilities])
        BUILD_KRB5=yes
-       save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS KRB5CFLAGS"
+       save_CPPFLAGS="$CPPFLAGS"
+       CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
        save_LIBS="$LIBS"
        LIBS="$LIBS $KRB5LIBS"
-       AC_CHECK_FUNCS([add_to_error_table])
-       CFLAGS="$save_CFLAGS"
+       AC_CHECK_FUNCS([add_to_error_table add_error_table krb5_princ_size krb5_principal_get_comp_string krb5_524_convert_creds krb524_convert_creds_kdc])
+       AC_CHECK_HEADERS([kerberosIV/krb.h])
+       AC_CHECK_HEADERS([kerberosV/heim_err.h])
+
+AC_MSG_CHECKING(for krb5_creds.keyblock existence)
+AC_CACHE_VAL(ac_cv_krb5_creds_keyblock_exists,
+[
+AC_TRY_COMPILE(
+[#include <krb5.h>],
+[krb5_creds _c;
+printf("%x\n", _c.keyblock);], 
+ac_cv_krb5_creds_keyblock_exists=yes,
+ac_cv_krb5_creds_keyblock_exists=no)])
+AC_MSG_RESULT($ac_cv_krb5_creds_keyblock_exists)
+       
+AC_MSG_CHECKING(for krb5_creds.session existence)
+AC_CACHE_VAL(ac_cv_krb5_creds_session_exists,
+[
+AC_TRY_COMPILE(
+[#include <krb5.h>],
+[krb5_creds _c;
+printf("%x\n", _c.session);], 
+ac_cv_krb5_creds_session_exists=yes,
+ac_cv_krb5_creds_session_exists=no)])
+AC_MSG_RESULT($ac_cv_krb5_creds_session_exists)
+
+if test "x$ac_cv_krb5_creds_keyblock_exists" = "xyes"; then
+       AC_DEFINE(HAVE_KRB5_CREDS_KEYBLOCK, 1, [define if krb5_creds has keyblock])
+fi
+if test "x$ac_cv_krb5_creds_session_exists" = "xyes"; then
+       AC_DEFINE(HAVE_KRB5_CREDS_SESSION, 1, [define if krb5_creds has session])
+fi
+       
+dnl    AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.session],,, [#include <krb5.h>])
+       CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
 fi
+
+if test "$ac_cv_header_kerberosV_heim_err_h" = "yes"; then
+    ASETKEY=
+else
+    ASETKEY=asetkey
+fi
+
 AC_SUBST(BUILD_KRB5)
+AC_SUBST(KRB5CFLAGS)
+AC_SUBST(KRB5LIBS)
+AC_SUBST(ASETKEY)
+
 ])dnl