1dnl Copyright (C) 2005 by the Massachusetts Institute of Technology.
2dnl All rights reserved.
3dnl
4dnl Export of this software from the United States of America may
5dnl   require a specific license from the United States Government.
6dnl   It is the responsibility of any person or organization contemplating
7dnl   export to obtain such a license before exporting.
8dnl
9dnl WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
10dnl distribute this software and its documentation for any purpose and
11dnl without fee is hereby granted, provided that the above copyright
12dnl notice appear in all copies and that both that copyright notice and
13dnl this permission notice appear in supporting documentation, and that
14dnl the name of M.I.T. not be used in advertising or publicity pertaining
15dnl to distribution of the software without specific, written prior
16dnl permission.  Furthermore if you modify this software you must label
17dnl your software as modified software and not distribute it in such a
18dnl fashion that it might be confused with the original M.I.T. software.
19dnl M.I.T. makes no representations about the suitability of
20dnl this software for any purpose.  It is provided "as is" without express
21dnl or implied warranty.
22
23dnl AC_CHECK_KRB5
24dnl
25dnl Check for krb5-config; update CPPFLAGS and LDFLAGS accordingly.
26dnl
27AC_DEFUN([AC_CHECK_KRB5],
28[AC_ARG_WITH([kerberos5],
29	[  --with-kerberos5=PATH   Enable Kerberos 5 support],
30	[if test "x$withval" != "xno"; then
31		if test "x$withval" = "xyes"; then
32			KRB5ROOT=/usr/local
33		else
34			KRB5ROOT=${withval}
35		fi
36		AC_MSG_CHECKING([for krb5-config])
37		if test -x "$KRB5ROOT/bin/krb5-config"; then
38			KRB5CONF=$KRB5ROOT/bin/krb5-config
39			AC_MSG_RESULT([$KRB5CONF])
40			AC_MSG_CHECKING([for gssapi support in krb5-config])
41			if "$KRB5CONF" | grep gssapi > /dev/null; then
42				AC_MSG_RESULT([yes])
43				k5confopts=gssapi
44			else
45				AC_MSG_RESULT([no])
46				k5confopts=
47			fi
48			K5CFLAGS=`"$KRB5CONF" --cflags $k5confopts`
49			CPPFLAGS="$CPPFLAGS $K5CFLAGS"
50
51			K5LIBS=`"$KRB5CONF" --libs $k5confopts`
52			LIBS="$LIBS $K5LIBS"
53		else
54			AC_MSG_RESULT([no])
55			AC_MSG_WARN([--with-kerberos5 specified but krb5-config not found])
56		fi
57	fi])
58])
59