1 dnl kerberos_v5.m4--Kerberos 5 libraries and includes
3 dnl from KTH krb and Arla
4 dnl $Id: kerberos_v5.m4,v 1.9 2005/04/26 19:14:08 shadow Exp $
6 AC_DEFUN([CMU_KRB5_INC_WHERE1], [
7 saved_CPPFLAGS=$CPPFLAGS
8 CPPFLAGS="$saved_CPPFLAGS -I$1"
9 AC_TRY_COMPILE([#include <krb5.h>],
11 ac_cv_found_krb5_inc=yes,
12 ac_cv_found_krb5_inc=no)
13 CPPFLAGS=$saved_CPPFLAGS
16 AC_DEFUN([CMU_KRB5_INC_WHERE], [
18 AC_MSG_CHECKING(for krb5 headers in $i)
19 CMU_KRB5_INC_WHERE1($i)
20 CMU_TEST_INCPATH($i, krb5)
21 if test "$ac_cv_found_krb5_inc" = "yes"; then
22 ac_cv_krb5_where_inc=$i
26 AC_MSG_RESULT(not found)
32 # Test for kerberos lib files
35 AC_DEFUN([CMU_KRB5_LIB_WHERE1], [
37 LIBS="$saved_LIBS -L$1 -lkrb5 -lk5crypto"
40 [ac_cv_found_krb5_lib=yes],
41 ac_cv_found_krb5_lib=no)
45 AC_DEFUN([CMU_KRB5_LIB_WHERE], [
47 AC_MSG_CHECKING(for krb5 libraries in $i)
48 CMU_KRB5_LIB_WHERE1($i)
49 CMU_TEST_LIBPATH($i, krb5)
50 if test "$ac_cv_found_krb5_lib" = "yes" ; then
51 ac_cv_krb5_where_lib=$i
55 AC_MSG_RESULT(not found)
60 AC_DEFUN([CMU_KRB5], [
61 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
62 AC_REQUIRE([CMU_SOCKETS])
63 AC_REQUIRE([CMU_USE_COMERR])
65 [ --with-krb5=PREFIX Compile with Kerberos 5 support],
66 [if test "X$with_krb5" = "X"; then
70 [ --with-krb5-lib=dir use kerberos 5 libraries in dir],
71 [if test "$withval" = "yes" -o "$withval" = "no"; then
72 AC_MSG_ERROR([No argument for --with-krb5-lib])
74 AC_ARG_WITH(krb5-include,
75 [ --with-krb5-include=dir use kerberos 5 headers in dir],
76 [if test "$withval" = "yes" -o "$withval" = "no"; then
77 AC_MSG_ERROR([No argument for --with-krb5-include])
79 AC_ARG_WITH(krb5-impl,
80 [ --with-krb5-impl=heimdal use heimdal kerberos 5 libraries
81 --with-krb5-impl=mit use MIT kerberos 5 libraries],
82 [if test "$withval" != "heimdal" -a "$withval" != "mit"; then
83 AC_MSG_ERROR([Invalid argument for --with-krb5-impl])
86 if test "X$with_krb5" != "X"; then
87 if test "$with_krb5" != "yes" -a "$with_krb5" != "no"; then
88 ac_cv_krb5_where_lib=$with_krb5/$CMU_LIB_SUBDIR
89 ac_cv_krb5_where_inc=$with_krb5/include
94 if test "$with_krb5" != "no"; then
95 if test "X$with_krb5_lib" != "X"; then
96 ac_cv_krb5_where_lib=$with_krb5_lib
99 if test "X$with_krb5_impl" != "X"; then
100 ac_cv_krb5_impl=$with_krb5_impl
102 if test "X$ac_cv_krb5_where_lib" = "X" -a "X$with_krb5_impl" != "Xheimdal"; then
103 CMU_KRB5_LIB_WHERE(/usr/athena/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR)
104 if test "X$ac_cv_krb5_where_lib" != "X"; then
108 if test "X$ac_cv_krb5_where_lib" = "X" -a "X$with_krb5_impl" != "Xmit"; then
109 CMU_LIBHEIMDAL_LIB_WHERE(/usr/athena/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR /usr/heimdal/$CMU_LIB_SUBDIR /usr/local/$CMU_LIB_SUBDIR)
110 if test "X$ac_cv_libheimdal_where_lib" != "X"; then
111 ac_cv_krb5_where_lib=$ac_cv_libheimdal_where_lib
112 ac_cv_krb5_impl=heimdal
116 if test "X$with_krb5_include" != "X"; then
117 ac_cv_krb5_where_inc=$with_krb5_include
119 if test "X$ac_cv_krb5_where_inc" = "X"; then
120 CMU_KRB5_INC_WHERE(/usr/athena/include /usr/include/kerberos /usr/local/include /usr/include)
124 AC_MSG_CHECKING(whether to include kerberos 5)
125 if test "X$ac_cv_krb5_where_lib" = "X" -o "X$ac_cv_krb5_where_inc" = "X"; then
131 KRB5_INC_DIR=$ac_cv_krb5_where_inc
132 KRB5_LIB_DIR=$ac_cv_krb5_where_lib
133 if test "X$ac_cv_krb5_impl" != "Xheimdal"; then
134 KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkrb5 -lk5crypto"
136 CMU_LIBHEIMDAL_LIBDES($KRB5_LIB_DIR)
137 KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkadm5clnt -lkrb5 -lasn1 ${HEIM_LIBDES} -lroken $LIB_SOCKET"
138 AC_DEFINE(HEIMDAL,,[we found heimdal krb5 and not MIT krb5])
140 KRB5_INC_FLAGS="-I${KRB5_INC_DIR}"
141 AC_SUBST(KRB5_INC_FLAGS)
142 AC_SUBST(KRB5_LIB_FLAGS)
143 AC_DEFINE(HAVE_KRB5,,[Kerberos V5 is present])dnl zephyr uses this
144 AC_DEFINE(KRB5,,[Use Kerberos 5. (maybe find what needs this and nuke it)])
145 if test "X$RPATH" = "X"; then
150 if test "X$RPATH" = "X"; then
151 RPATH="-Wl,-rpath,${KRB5_LIB_DIR}"
153 RPATH="${RPATH}:${KRB5_LIB_DIR}"
157 if test "X$RPATH" = "X"; then
158 RPATH="-Wl,+b${KRB5_LIB_DIR}"
160 RPATH="${RPATH}:${KRB5_LIB_DIR}"
164 if test "X$RPATH" = "X"; then
165 RPATH="-Wl,-rpath,${KRB5_LIB_DIR}"
167 RPATH="${RPATH}:${KRB5_LIB_DIR}"
171 if test "$ac_cv_prog_gcc" = yes; then
172 if test "X$RPATH" = "X"; then
173 RPATH="-Wl,-R${KRB5_LIB_DIR}"
175 RPATH="${RPATH}:${KRB5_LIB_DIR}"
178 RPATH="${RPATH} -R${KRB5_LIB_DIR}"