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 KRB5_SECURITY, and sets AM_CONDITIONAL WANT_KRB5_SECURITY,
11 # if the user has selected this mechanism. Also, the following parameters
12 # are taken from options and defined:
14 # - SERVER_HOST_PRINCIPAL
15 # - SERVER_HOST_INSTANCE
16 # - SERVER_HOST_KEY_FILE
17 # - CLIENT_HOST_PRINCIPAL
18 # - CLIENT_HOST_INSTANCE
19 # - CLIENT_HOST_KEY_FILE
22 AC_DEFUN([AMANDA_KRB5_SECURITY],
24 # Specify --with-krb5-security if Kerberos software is in somewhere
25 # other than the listed KRB5_SPOTS. We only compile kerberos support in
26 # if the right files are there.
29 : ${KRB5_SPOTS="/usr/kerberos /usr/cygnus /usr /opt/kerberos"}
31 AC_ARG_WITH(krb5-security,
32 AS_HELP_STRING([--with-krb5-security=DIR],
33 [Location of Kerberos V software @<:@/usr/kerberos /usr/cygnus /usr /opt/kerberos@:>@]),
36 n | no) KRB5_SECURITY=no ;;
37 y | ye | yes) KRB5_SECURITY=yes ;;
38 *) KRB5_SPOTS="$KRB5_SECURITY"
45 if test "x$KRB5_SECURITY" = "xyes"; then
46 # if found, force the static versions of these libs (.a) by linking directly
47 # with the .a files. I don't know how to get -R dependancies checked
48 # in autoconf at this time. -kashmir
49 AC_MSG_CHECKING(for Kerberos V libraries)
51 for dir in $KRB5_SPOTS; do
52 for lib in lib lib64; do
53 k5libdir=${dir}/${lib}
54 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
55 if test -f ${k5libdir}/libk5crypto.a -o -f ${k5libdir}/libk5crypto.so; then
57 elif test -f ${k5libdir}/libcrypto.a -o -f ${k5libdir}/libcrypto.so; then
62 if test -f ${k5libdir}/libkrb5support.a -o -f ${k5libdir}/libkrb5support.so; then
63 K5SUPPORT=-lkrb5support
68 KRB5_LIBDIR_FOUND=$k5libdir
69 AMANDA_ADD_LIBS([-lgssapi_krb5 -lkrb5 $K5CRYPTO $K5SUPPORT -lcom_err])
71 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
72 AMANDA_ADD_LIBS([-lgssapi -lkrb5 -lasn1])
73 AMANDA_ADD_CPPFLAGS([-DKRB5_HEIMDAL_INCLUDES])
79 if test "$KRB5_DIR_FOUND"; then
80 AC_MSG_RESULT(found in $KRB5_DIR_FOUND)
82 # some OS's, such as NetBSD, stick krb5 includes out of the way...
83 # should probably just use autoconf to look for various include
84 # options and set them, but don't quite want to do that until I've
85 # dug into it a bit more.
87 if test -d "$KRB5_DIR_FOUND/krb5" ; then
88 AMANDA_ADD_CPPFLAGS([-I$KRB5_DIR_FOUND/include/krb5])
90 AMANDA_ADD_CPPFLAGS([-I$KRB5_DIR_FOUND/include])
92 AC_CHECK_LIB(krb5support,main)
93 AMANDA_ADD_LDFLAGS([-L$KRB5_LIBDIR_FOUND])
95 AC_DEFINE(KRB5_SECURITY,1,
96 [Define if Kerberos 5 security is to be enabled. ])
98 AC_MSG_RESULT(no krb5 system libraries found)
99 AC_MSG_ERROR([No Kerberos V libraries were found on your system; krb5-security cannot be enabled])
104 AM_CONDITIONAL(WANT_KRB5_SECURITY, test x"$KRB5_SECURITY" = x"yes")