autoconf: Split out krb5/gss tests
[openafs.git] / src / cf / krb5.m4
1 AC_DEFUN([OPENAFS_KRB5],
2 dnl Probe for Kerberos.  We have a few platform-specific overrides due to
3 dnl weird Kerberos implementations and installation locations.
4   [AS_CASE([$AFS_SYSNAME],
5      [*_obsd*],
6      [KRB5_CPPFLAGS="-I/usr/include/kerberosV"],
7
8      [ppc_darwin_70],
9      [KRB5_CPPFLAGS="-I/usr/include"
10       KRB5_LDFLAGS="-L/usr/lib -Wl,-search_paths_first"])
11    RRA_LIB_KRB5_OPTIONAL
12    AS_CASE([$AFS_SYSNAME],
13      [hp_ux*|*_hpux*],
14      [KRB5_LIBS="-l:libkrb5.sl -l:libcom_err.sl"])
15
16 dnl Check for the characteristics of whatever Kerberos we found, if we found
17 dnl one.
18   BUILD_KRB5=no
19   MAKE_KRB5="#"
20   AS_IF([test x"$KRB5_LIBS" != x],
21     [BUILD_KRB5=yes
22      MAKE_KRB5=
23      RRA_LIB_KRB5_SWITCH
24      AC_CHECK_FUNCS([add_error_table \
25                      add_to_error_table \
26                      encode_krb5_enc_tkt_part \
27                      encode_krb5_ticket \
28                      krb5_524_conv_principal \
29                      krb5_allow_weak_crypto \
30                      krb5_c_encrypt \
31                      krb5_decode_ticket \
32                      krb5_enctype_enable \
33                      krb5_free_keytab_entry_contents \
34                      krb5_free_unparsed_name \
35                      krb5_get_init_creds_opt_alloc \
36                      krb5_get_prompt_types \
37                      krb5_princ_size \
38                      krb5_principal_get_comp_string])
39      AC_CHECK_FUNCS([krb5_524_convert_creds], [],
40        [AC_CHECK_FUNCS([krb524_convert_creds_kdc], [],
41           [AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
42              [LIBS="-lkrb524 $LIBS"
43               KRB5_LIBS="-lkrb524 $KRB5_LIBS"
44               AC_CHECK_LIB([krb524], [krb5_524_conv_principal],
45                 [AC_DEFINE([HAVE_KRB5_524_CONV_PRINCIPAL], [1],
46                            [Define to 1 if you have the `krb5_524_conv_principal' function.])])
47               AC_DEFINE([HAVE_KRB524_CONVERT_CREDS_KDC], [1],
48                         [Define to 1 if you have the `krb524_convert_creds_kdc' function.])])])])
49      AC_CHECK_HEADERS([kerberosIV/krb.h])
50      AC_CHECK_HEADERS([kerberosV/heim_err.h])
51      AC_CHECK_HEADERS([com_err.h et/com_err.h krb5/com_err.h])
52      AS_IF([test x"$ac_cv_header_com_err_h" != xyes \
53                && test x"$ac_cv_header_et_com_err_h" != xyes \
54                && test x"$ac_cv_header_krb5_com_err_h" != xyes],
55        [AC_MSG_ERROR([Cannot find a usable com_err.h])])
56      AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.keyblock.enctype, krb5_creds.session,
57                        krb5_prompt.type], [], [], [#include <krb5.h>])
58      AC_CHECK_MEMBERS([krb5_keytab_entry.key, krb5_keytab_entry.keyblock],
59                       [], [], [#include <krb5.h>])
60 dnl If we have krb5_creds.session, we are using heimdal
61 dnl If we're using heimdal, aklog needs libasn1 for encode_EncTicketPart and a
62 dnl few other functions. But just aklog; not any of the other stuff that uses
63 dnl krb5.
64      AS_IF([test x"$ac_cv_member_krb5_creds_session" = xyes],
65            [AC_CHECK_LIB([asn1], [encode_EncTicketPart],
66                          [AKLOG_KRB5_LIBS="-lasn1"])])
67      RRA_LIB_KRB5_RESTORE])
68   AC_SUBST([BUILD_KRB5])
69   AC_SUBST([MAKE_KRB5])
70   AC_SUBST([AKLOG_KRB5_LIBS])])