7 # Handle configuration for KRB5 security, implementing the --with-krb5-security
8 # option. If libraries are found, they are added to the relevant compiler flags.
10 # Defines and substitutes KRB5_SECURITY, and sets AM_CONDITIONAL
11 # WANT_KRB5_SECURITY, if the user has selected this mechanism. Also, the
12 # following parameters are taken from options, defined, and substituted:
14 AC_DEFUN([AMANDA_KRB5_SECURITY],
16 # Specify --with-krb5-security if Kerberos software is in somewhere
17 # other than the listed KRB5_SPOTS. We only compile kerberos support in
18 # if the right files are there.
21 : ${KRB5_SPOTS="/usr/kerberos /usr/cygnus /usr /opt/kerberos"}
23 AC_ARG_WITH(krb5-security,
24 AS_HELP_STRING([--with-krb5-security=DIR],
25 [Location of Kerberos V software @<:@/usr/kerberos /usr/cygnus /usr /opt/kerberos@:>@]),
28 n | no) KRB5_SECURITY=no ;;
29 y | ye | yes) KRB5_SECURITY=yes ;;
30 *) KRB5_SPOTS="$KRB5_SECURITY"
37 if test "x$KRB5_SECURITY" = "xyes"; then
38 # if found, force the static versions of these libs (.a) by linking directly
39 # with the .a files. I don't know how to get -R dependancies checked
40 # in autoconf at this time. -kashmir
41 AC_MSG_CHECKING(for Kerberos V libraries)
43 for dir in $KRB5_SPOTS; do
44 for lib in lib lib64; do
45 k5libdir=${dir}/${lib}
46 if test \( -f ${k5libdir}/libkrb5.a -o -f ${k5libdir}/libkrb5.so \) -a \( -f ${k5libdir}/libgssapi_krb5.so -o -f ${k5libdir}/libgssapi_krb5.a \) -a \( -f ${k5libdir}/libcom_err.a -o -f ${k5libdir}/libcom_err.so \); then
47 if test -f ${k5libdir}/libk5crypto.a -o -f ${k5libdir}/libk5crypto.so; then
49 elif test -f ${k5libdir}/libcrypto.a -o -f ${k5libdir}/libcrypto.so; then
54 if test -f ${k5libdir}/libkrb5support.a -o -f ${k5libdir}/libkrb5support.so; then
55 K5SUPPORT=-lkrb5support
60 KRB5_LIBDIR_FOUND=$k5libdir
61 AMANDA_ADD_LIBS([-lgssapi_krb5 -lkrb5 $K5CRYPTO $K5SUPPORT -lcom_err])
63 elif test \( -f ${k5libdir}/libkrb5.a -o -f ${k5libdir}/libkrb5.so \) -a \( -f ${k5libdir}/libasn1.a -o -f ${k5libdir}/libasn1.so \) -a \( -f ${k5libdir}/libgssapi.a -o -f ${k5libdir}/libgssapi.so \); then
64 AMANDA_ADD_LIBS([-lgssapi -lkrb5 -lasn1])
65 AMANDA_ADD_CPPFLAGS([-DKRB5_HEIMDAL_INCLUDES])
71 if test "$KRB5_DIR_FOUND"; then
72 AC_MSG_RESULT(found in $KRB5_DIR_FOUND)
74 # some OS's, such as NetBSD, stick krb5 includes out of the way...
75 # should probably just use autoconf to look for various include
76 # options and set them, but don't quite want to do that until I've
77 # dug into it a bit more.
79 if test -d "$KRB5_DIR_FOUND/krb5" ; then
80 AMANDA_ADD_CPPFLAGS([-I$KRB5_DIR_FOUND/include/krb5])
82 AMANDA_ADD_CPPFLAGS([-I$KRB5_DIR_FOUND/include])
84 AC_CHECK_LIB(krb5support,main)
85 AMANDA_ADD_LDFLAGS([-L$KRB5_LIBDIR_FOUND])
87 AC_DEFINE(KRB5_SECURITY,1,
88 [Define if Kerberos 5 security is to be enabled. ])
90 AC_MSG_RESULT(no krb5 system libraries found)
91 AC_MSG_ERROR([No Kerberos V libraries were found on your system; krb5-security cannot be enabled])
96 AM_CONDITIONAL(WANT_KRB5_SECURITY, test x"$KRB5_SECURITY" = x"yes")
97 AC_SUBST(KRB5_SECURITY)