*** empty log message ***
[arla.git] / cf / check-kerberos2.m4
blob9845a238cc63ccf0f5d55cf818ba05320be79cfe
1 dnl
2 dnl $Id$
3 dnl
4 dnl Check if the dog is alive
5 dnl
7 AC_DEFUN([AC_CHECK_KERBEROS2],[
9 AC_ARG_WITH(krb4,
10 [  --with-krb4=dir         use kerberos 4 in dir],
11 [],[with_krb4=yes])
13 AC_ARG_WITH(krb4-lib,
14 [  --with-krb4-lib=dir     use kerberos 4 libraries in dir],
15 [if test "$withval" = "yes" -o "$withval" = "no"; then
16   AC_MSG_ERROR([No argument for --with-krb4-lib])
17 fi])
19 AC_ARG_WITH(krb4-include,
20 [  --with-krb4-include=dir use kerberos 4 headers in dir],
21 [if test "$withval" = "yes" -o "$withval" = "no"; then
22   AC_MSG_ERROR([No argument for --with-krb4-include])
23 fi])
26 dnl
27 dnl Check for kerberos4
28 dnl
30 if test X"$with_krb4" != "Xno" -a X"$with_krb4" != "Xyes" ; then
31    if test X"$with_krb4_lib" = "X"; then
32       with_krb4_lib="$with_krb4/lib"
33    fi
34    if test X"$with_krb4_include" = "X"; then
35       with_krb4_include="$with_krb4/include"
36    fi
39 AC_MSG_CHECKING(probing for kerberos 4)
40 AC_CACHE_VAL(ac_cv_found_krb4,[
41 if test "X$with_krb4" = "Xyes"; then
42   for krblibs in "" /usr/heimdal /usr/athena /usr/kerberos /usr/local; do
43     AC_CHECK_KRB4_2($krblibs, $with_krb4_lib, $with_krb4_include)
44   done
45 elif test "X$with_krb4" != "Xno" -a "X$with_krb4" != "Xyes"; then
46   AC_CHECK_KRB4_2($with_krb4, $with_krb4_lib, $with_krb4_include)
47 fi])
49 if test $ac_cv_found_krb4 != no; then
50   AC_MSG_RESULT(yes)
52   KRB4_INC_DIR=$ac_cv_krb4_where_inc
53   KRB4_LIB_DIR=$ac_cv_krb4_where_lib
54   KRB4_INC_FLAGS=
55   if test "X$KRB4_INC_DIR" != "X" ; then
56     KRB4_INC_FLAGS="-I${KRB4_INC_DIR}"
57   fi
58   KRB4_LIB_LIBS="$ac_cv_krb4_extralib"
59   if test "X$KRB4_LIB_DIR" != "X" ; then
60     KRB4_LIB_DIR="-L${KRB4_LIB_DIR}"
61   fi
62   KRB4_LIB_FLAGS="$KRB4_LIB_DIR $KRB4_LIB_LIBS"
64 else
65   AC_MSG_RESULT(no)
68 AC_SUBST(KRB4_LIB_DIR)
69 AC_SUBST(KRB4_INC_DIR)
70 AC_SUBST(KRB4_INC_FLAGS)
71 AC_SUBST(KRB4_LIB_LIBS)
72 AC_SUBST(KRB4_LIB_FLAGS)
77 dnl base, lib, inc
78 AC_DEFUN([AC_CHECK_KRB4_2],[
79   AC_MSG_RESULT(started)
80   if test -n "$2"; then
81      klib=$2
82   else
83      klib=$1/lib;
84   fi
85   AC_MSG_CHECKING(for Kerberos 4 libs in $klib)
86   AC_KRB4_LIB_WHERE1($klib)
88   if test "$ac_cv_found_krb4_lib" != "no" ; then
90      AC_MSG_RESULT([found, looking for include files])
92      if test X$3 != "X"; then
93        AC_MSG_CHECKING(for Kerberos 4 headers in $3)
94        AC_KRB4_INC_WHERE1($3)
95        if test "$ac_cv_found_krb4_inc" = "yes"; then
96          AC_MSG_RESULT(found)
97        else
98          AC_MSG_RESULT(not found)
99        fi
100      else
101        for j in "" kerberos "kerberosIV"; do
102          if test -n "$1"; then
103            if test -n "$j"; then
104              d="$1/$j"
105            else
106              d="$1"
107            fi
108          else
109            if test -n "$j"; then
110              d="/usr/include/$j"
111            fi
112          fi
113          AC_MSG_CHECKING(for Kerberos 4 headers in $d)
114          AC_KRB4_INC_WHERE1($d)
115          if test "$ac_cv_found_krb4_inc" = "yes"; then
116            AC_MSG_RESULT(found)
117            break 3
118          else
119            AC_MSG_RESULT(not found)
120          fi
121        done
122      fi
124      if test "$ac_cv_found_krb4_inc" = "yes"; then
125        ac_cv_krb4_where_inc=$d
126        ac_cv_found_krb4=yes
128        AC_DEFINE(KERBEROS, 1, [define if you have kerberos])
129        AC_DEFINE(HAVE_KRB4, 1, [define if you have kerberos 4])
131      else
132        ac_cv_found_krb4=no
133        ac_cv_found_krb4_lib=no
134      fi
135        AC_MSG_CHECKING(will use Kerberos 4)
136   else
137     :
138   fi