more-aklog-fixes-20050618
[openafs.git] / src / cf / kerberos.m4
1 dnl
2 dnl $Id$
3 dnl
4 dnl Kerberos autoconf glue
5 dnl
6
7 AC_DEFUN([OPENAFS_KRB5CONF],[
8
9 AC_ARG_VAR(KRB5CFLAGS, [C flags to compile Kerberos 5 programs])
10 AC_ARG_VAR(KRB5LIBS, [Libraries and flags to compile Kerberos 5 programs])
11 AC_ARG_VAR(KRB5_CONFIG, [Location of krb5-config script])
12
13 AC_ARG_WITH([krb5-conf],
14         AC_HELP_STRING([--with-krb5-config[=krb5-config-location]],
15                        [Use a krb5-config script to configure Kerberos]),
16         [if test X$withval != Xno; then
17                 conf_krb5=YES
18                 if test X$withval = Xyes; then
19                         AC_PATH_PROG(KRB5_CONFIG, krb5-config, not_found)
20                         if test X$KRB5_CONFIG = Xnot_found; then
21                                 AC_MSG_ERROR([cannot find krb5-config script, you must configure Kerberos manually])
22                         fi
23                 else
24                         KRB5_CONFIG=$withval
25                 fi
26                 KRB5CFLAGS=`$KRB5_CONFIG --cflags krb5`
27                 retval=$?
28                 if test $retval -ne 0; then
29                         AC_MSG_ERROR([$KRB5_CONFIG failed with an error code of $retval])
30                 fi
31                 KRB5LIBS=`$KRB5_CONFIG --libs krb5`
32                 retval=$?
33                 if test $retval -ne 0; then
34                         AC_MSG_ERROR([$KRB5_CONFIG failed with an error code of $retval])
35                 fi
36                 AC_MSG_RESULT([Adding $KRB5CFLAGS to KRB5CFLAGS])
37                 AC_MSG_RESULT([Adding $KRB5LIBS to KRB5LIBS])
38         fi])
39
40 AC_ARG_WITH([krb5],
41         AC_HELP_STRING([--with-krb5],
42                        [Support for Kerberos 5 (manual configuration)]),
43         [if test X$conf_krb5 = XYES; then
44                 AC_MSG_ERROR([--with-krb5-config and --with-krb5 are mutually exclusive, choose only one])
45         fi
46         if test "X$KRB5CFLAGS" = X; then
47                 AC_MSG_WARN([KRB5CFLAGS is not set])
48         fi
49         if test "X$KRB5LIBS" = X; then
50                 AC_MSG_WARN([KRB5LIBS is not set])
51         fi
52         conf_krb5=YES])
53
54 BUILD_KRB5=no
55 if test X$conf_krb5 = XYES; then
56         AC_MSG_RESULT([Configuring support for Kerberos 5 utilities])
57         BUILD_KRB5=yes
58         save_CFLAGS="$CFLAGS"
59         CFLAGS="$CFLAGS KRB5CFLAGS"
60         save_LIBS="$LIBS"
61         LIBS="$LIBS $KRB5LIBS"
62         AC_CHECK_FUNCS([add_to_error_table])
63         CFLAGS="$save_CFLAGS"
64         LIBS="$save_LIBS"
65 fi
66 AC_SUBST(BUILD_KRB5)
67 ])dnl