source: trunk/debathena/debathena/aclocal/aclocal/athena_krb4.m4 @ 24361

Revision 24361, 2.7 KB checked in by broder, 15 years ago (diff)
Create new debathena-aclocal package for common autoconf macros.
Line 
1dnl Copyright 1996 by the Massachusetts Institute of Technology.
2dnl
3dnl Permission to use, copy, modify, and distribute this
4dnl software and its documentation for any purpose and without
5dnl fee is hereby granted, provided that the above copyright
6dnl notice appear in all copies and that both that copyright
7dnl notice and this permission notice appear in supporting
8dnl documentation, and that the name of M.I.T. not be used in
9dnl advertising or publicity pertaining to distribution of the
10dnl software without specific, written prior permission.
11dnl M.I.T. makes no representations about the suitability of
12dnl this software for any purpose.  It is provided "as is"
13dnl without express or implied warranty.
14
15dnl This file provides local macros for packages which use Kerberos
16dnl version 4. The public macros are:
17dnl     ATHENA_KRB4
18dnl             Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
19dnl     ATHENA_KRB4_REQUIRED
20dnl             Generates error if krb4 not found.  Sets KRB4_LIBS
21dnl             otherwise.  (Special behavior because krb4 libraries
22dnl             may be different if using krb4 compatibility libraries
23dnl             from krb5.)
24dnl
25dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
26dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
27dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
28dnl is a com_err library in the AFS libraries which requires -lutil.
29
30dnl ----- Kerberos 4 -----
31
32AC_DEFUN([ATHENA_KRB4_CHECK],
33[AC_REQUIRE([AC_CANONICAL_TARGET])
34AC_SEARCH_LIBS(gethostbyname, nsl)
35AC_SEARCH_LIBS(socket, socket)
36AC_SEARCH_LIBS(compile, gen)
37if test "$krb4" != yes; then
38        CPPFLAGS="$CPPFLAGS -I$krb4/include"
39        if test -d "$krb4/include/kerberosIV"; then
40                CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
41        fi
42        LDFLAGS="$LDFLAGS -L$krb4/lib"
43fi
44AC_CHECK_LIB(krb4, krb_rd_req,
45             [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
46             [AC_CHECK_LIB(krb, krb_rd_req,
47                           [KRB4_LIBS="-lkrb -ldes"],
48                           [AC_MSG_WARN(--with-krb4 specified but Kerberos 4 libraries not found)],
49                           -ldes)],
50             -ldes425 -lkrb5 -lk5crypto -lcom_err)
51if test "$KRB4_LIBS" != "" ; then
52        case "$target_os" in
53        darwin*) KRB4_LIBS="$KRB4_LIBS -framework Kerberos"
54        esac
55fi])
56
57AC_DEFUN([ATHENA_KRB4],
58[AC_ARG_WITH(krb4,
59        [  --with-krb4=PREFIX      Use Kerberos 4],
60        [krb4="$withval"], [krb4=no])
61if test "$krb4" != no; then
62        ATHENA_KRB4_CHECK
63        if test "$KRB4_LIBS" != ""; then
64                AC_DEFINE(HAVE_KRB4)
65        fi
66fi
67AC_SUBST(KRB4_LIBS)])
68
69AC_DEFUN([ATHENA_KRB4_REQUIRED],
70[AC_ARG_WITH(krb4,
71        [  --with-krb4=PREFIX      Specify location of Kerberos 4],
72        [krb4="$withval"], [krb4=yes])
73if test "$krb4" != no; then
74        ATHENA_KRB4_CHECK
75        if test "$KRB4_LIBS" = ""; then
76                AC_MSG_ERROR(This package requires Kerberos 4.)
77        fi
78        AC_SUBST(KRB4_LIBS)
79else
80        AC_MSG_ERROR(This package requires Kerberos 4.)
81fi])
Note: See TracBrowser for help on using the repository browser.