source: trunk/packs/build/aclocal.m4 @ 10825

Revision 10825, 8.5 KB checked in by ghudson, 27 years ago (diff)
Check for possible Kerberos dependencies.
Line 
1dnl $Id: aclocal.m4,v 1.6 1997-11-30 15:14:39 ghudson Exp $
2
3dnl Copyright 1996 by the Massachusetts Institute of Technology.
4dnl
5dnl Permission to use, copy, modify, and distribute this
6dnl software and its documentation for any purpose and without
7dnl fee is hereby granted, provided that the above copyright
8dnl notice appear in all copies and that both that copyright
9dnl notice and this permission notice appear in supporting
10dnl documentation, and that the name of M.I.T. not be used in
11dnl advertising or publicity pertaining to distribution of the
12dnl software without specific, written prior permission.
13dnl M.I.T. makes no representations about the suitability of
14dnl this software for any purpose.  It is provided "as is"
15dnl without express or implied warranty.
16
17dnl This file provides local macros for packages which use specific
18dnl external libraries.  The public macros are:
19dnl
20dnl     ATHENA_UTIL_COM_ERR
21dnl             Generates error if com_err not found.
22dnl     ATHENA_UTIL_SS
23dnl             Generates error if ss not found.
24dnl     ATHENA_REGEXP
25dnl             Sets RX_LIBS if rx library used; ensures POSIX regexp
26dnl             support.
27dnl     ATHENA_MOTIF
28dnl             Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
29dnl     ATHENA_MOTIF_REQUIRED
30dnl             Generates error if Motif not found.
31dnl     ATHENA_AFS
32dnl             Sets AFS_LIBS and defines HAVE_AFS if AFS used.  Pass
33dnl             in an argument giving the desired AFS libraries;
34dnl             AFS_LIBS will be set to that value if AFS is found.
35dnl             AFS_DIR will be set to the prefix given.
36dnl     ATHENA_AFS_REQUIRED
37dnl             Generates error if AFS libraries not found.  AFS_DIR
38dnl             will be set to the prefix given.
39dnl     ATHENA_KRB4
40dnl             Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
41dnl     ATHENA_KRB4_REQUIRED
42dnl             Generates error if krb4 not found.  Sets KRB4_LIBS
43dnl             otherwise.  (Special behavior because krb4 libraries
44dnl             may be different if using krb4 compatibility libraries
45dnl             from krb5.)
46dnl     ATHENA_KRB5
47dnl             Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
48dnl     ATHENA_KRB5_REQUIRED
49dnl             Generates error if krb5 not found.
50dnl     ATHENA_HESIOD
51dnl             Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
52dnl             used.
53dnl     ATHENA_HESIOD_REQUIRED
54dnl             Generates error if Hesiod not found.
55dnl
56dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
57dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
58dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
59dnl is a com_err library in the AFS libraries which requires -lutil.
60
61dnl ----- com_err -----
62
63AC_DEFUN(ATHENA_UTIL_COM_ERR,
64[AC_ARG_WITH(com_err,
65        [  --with-com_err=PREFIX   Specify location of com_err],
66        [com_err="$withval"], [com_err=yes])
67if test "$com_err" != no; then
68        if test "$com_err" != yes; then
69                CPPFLAGS="$CPPFLAGS -I$com_err/include"
70                LDFLAGS="$LDFLAGS -L$com_err/lib"
71        fi
72        AC_CHECK_LIB(com_err, com_err, :,
73                     [AC_MSG_ERROR(com_err library not found)])
74else
75        AC_MSG_ERROR(This package requires com_err.)
76fi])
77
78dnl ----- ss -----
79
80AC_DEFUN(ATHENA_UTIL_SS,
81[AC_ARG_WITH(ss,
82        [  --with-ss=PREFIX        Specify location of ss (requires com_err)],
83        [ss="$withval"], [ss=yes])
84if test "$ss" != no; then
85        if test "$ss" != yes; then
86                CPPFLAGS="$CPPFLAGS -I$ss/include"
87                LDFLAGS="$LDFLAGS -L$ss/lib"
88        fi
89        AC_CHECK_LIB(ss, ss_perror, :,
90                     [AC_MSG_ERROR(ss library not found)], -lcom_err)
91else
92        AC_MSG_ERROR(This package requires ss.)
93fi])
94
95dnl ----- Regular expressions -----
96
97AC_DEFUN(ATHENA_REGEXP,
98[AC_ARG_WITH(regex,
99        [  --with-regex=PREFIX     Use installed regex library],
100        [regex="$withval"], [regex=no])
101if test "$regex" != no; then
102        if test "$regex" != yes; then
103                CPPFLAGS="$CPPFLAGS -I$regex/include"
104                LDFLAGS="$LDFLAGS -L$regex/lib"
105        fi
106        AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
107                     [AC_MSG_ERROR(regex library not found)])
108else
109        AC_CHECK_FUNC(regcomp, :,
110                      [AC_MSG_ERROR(can't find POSIX regexp support)])
111fi
112AC_SUBST(REGEX_LIBS)])
113
114dnl ----- Motif -----
115
116AC_DEFUN(ATHENA_MOTIF_CHECK,
117[if test "$motif" != yes; then
118        CPPFLAGS="$CPPFLAGS -I$motif/include"
119        LDFLAGS="$LDFLAGS -L$motif/lib"
120fi
121AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
122
123AC_DEFUN(ATHENA_MOTIF,
124[AC_ARG_WITH(motif,
125        [  --with-motif=PREFIX     Use Motif],
126        [motif="$withval"], [motif=no])
127if test "$motif" != no; then
128        ATHENA_MOTIF_CHECK
129        MOTIF_LIBS=-lXm
130        AC_DEFINE(HAVE_MOTIF)
131fi
132AC_SUBST(MOTIF_LIBS)])
133
134AC_DEFUN(ATHENA_MOTIF_REQUIRED,
135[AC_ARG_WITH(motif,
136        [  --with-motif=PREFIX     Specify location of Motif],
137        [motif="$withval"], [motif=yes])
138if test "$motif" != no; then
139        ATHENA_MOTIF_CHECK
140else
141        AC_MSG_ERROR(This package requires Motif.)
142fi])
143
144dnl ----- AFS -----
145
146AC_DEFUN(ATHENA_AFS_CHECK,
147[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
148AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec, LIBS="$LIBS -lc -lucb"))
149AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
150AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
151if test "$afs" != yes; then
152        CPPFLAGS="$CPPFLAGS -I$afs/include"
153        LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
154fi
155AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
156             -lrx -llwp -lsys)
157AFS_DIR=$afs
158AC_SUBST(AFS_DIR)])
159
160dnl Specify desired AFS libraries as a parameter.
161AC_DEFUN(ATHENA_AFS,
162[AC_ARG_WITH(afs,
163        [  --with-afs=PREFIX       Use AFS libraries],
164        [afs="$withval"], [afs=no])
165if test "$afs" != no; then
166        ATHENA_AFS_CHECK
167        AFS_LIBS=$1
168        AC_DEFINE(HAVE_AFS)
169fi
170AC_SUBST(AFS_LIBS)])
171
172AC_DEFUN(ATHENA_AFS_REQUIRED,
173[AC_ARG_WITH(afs,
174        [  --with-afs=PREFIX       Specify location of AFS libraries],
175        [afs="$withval"], [afs=/usr/afsws])
176if test "$afs" != no; then
177        ATHENA_AFS_CHECK
178else
179        AC_MSG_ERROR(This package requires AFS libraries.)
180fi])
181
182dnl ----- Kerberos 4 -----
183
184AC_DEFUN(ATHENA_KRB4_CHECK,
185[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
186AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
187AC_CHECK_LIB(gen, compile)
188if test "$krb4" != yes; then
189        CPPFLAGS="$CPPFLAGS -I$krb4/include"
190        if test -d "$krb4/include/kerberosIV"; then
191                CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
192        fi
193        LDFLAGS="$LDFLAGS -L$krb4/lib"
194elif test -d /usr/include/kerberosIV; then
195        CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
196fi
197AC_CHECK_LIB(krb4, krb_rd_req,
198             [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
199             [AC_CHECK_LIB(krb, krb_rd_req,
200                           [KRB4_LIBS="-lkrb -ldes"],
201                           [AC_MSG_ERROR(Kerberos 4 libraries not found)],
202                           -ldes)],
203             -ldes425 -lkrb5 -lcrypto -lcom_err)])
204
205AC_DEFUN(ATHENA_KRB4,
206[AC_ARG_WITH(krb4,
207        [  --with-krb4=PREFIX      Use Kerberos 4],
208        [krb4="$withval"], [krb4=no])
209if test "$krb4" != no; then
210        ATHENA_KRB4_CHECK
211        AC_DEFINE(HAVE_KRB4)
212fi
213AC_SUBST(KRB4_LIBS)])
214
215AC_DEFUN(ATHENA_KRB4_REQUIRED,
216[AC_ARG_WITH(krb4,
217        [  --with-krb4=PREFIX      Specify location of Kerberos 4],
218        [krb4="$withval"], [krb4=yes])
219if test "$afs" != no; then
220        ATHENA_KRB4_CHECK
221        AC_SUBST(KRB4_LIBS)
222else
223        AC_MSG_ERROR(This package requires Kerberos 4.)
224fi])
225
226dnl ----- Kerberos 5 -----
227
228AC_DEFUN(ATHENA_KRB5_CHECK,
229[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
230AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
231AC_CHECK_LIB(gen, compile)
232if test "$krb5" != yes; then
233        CPPFLAGS="$CPPFLAGS -I$krb5/include"
234        LDFLAGS="$LDFLAGS -L$krb5/lib"
235fi
236AC_CHECK_LIB(krb5, krb5_init_context, :,
237             [AC_MSG_ERROR(Kerberos 5 libraries not found)],
238             -lcrypto -lcom_err)])
239
240AC_DEFUN(ATHENA_KRB5,
241[AC_ARG_WITH(krb5,
242        [  --with-krb5=PREFIX      Use Kerberos 5],
243        [krb5="$withval"], [krb5=no])
244if test "$krb5" != no; then
245        ATHENA_KRB5_CHECK
246        KRB5_LIBS="-lkrb5 -lcrypto -lcom_err"
247        AC_DEFINE(HAVE_KRB5)
248fi
249AC_SUBST(KRB5_LIBS)])
250
251AC_DEFUN(ATHENA_KRB5_REQUIRED,
252[AC_ARG_WITH(krb5,
253        [  --with-krb5=PREFIX      Specify location of Kerberos 5],
254        [krb5="$withval"], [krb5=yes])
255if test "$krb5" != no; then
256        ATHENA_KRB5_CHECK
257else
258        AC_MSG_ERROR(This package requires Kerberos 5.)
259fi])
260
261dnl ----- Hesiod -----
262
263AC_DEFUN(ATHENA_HESIOD_CHECK,
264[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
265if test "$hesiod" != yes; then
266        CPPFLAGS="$CPPFLAGS -I$hesiod/include"
267        LDFLAGS="$LDFLAGS -L$hesiod/lib"
268fi
269AC_CHECK_LIB(hesiod, hes_resolve, :,
270             [AC_MSG_ERROR(Hesiod library not found)])])
271
272AC_DEFUN(ATHENA_HESIOD,
273[AC_ARG_WITH(hesiod,
274        [  --with-hesiod=PREFIX    Use Hesiod],
275        [hesiod="$withval"], [hesiod=no])
276if test "$hesiod" != no; then
277        ATHENA_HESIOD_CHECK
278        HESIOD_LIBS="-lhesiod"
279        AC_DEFINE(HAVE_HESIOD)
280fi
281AC_SUBST(HESIOD_LIBS)])
282
283AC_DEFUN(ATHENA_HESIOD_REQUIRED,
284[AC_ARG_WITH(hesiod,
285        [  --with-hesiod=PREFIX    Specify location of Hesiod],
286        [hesiod="$withval"], [hesiod=yes])
287if test "$hesiod" != no; then
288        ATHENA_HESIOD_CHECK
289else
290        AC_MSG_ERROR(This package requires Hesiod.)
291fi])
Note: See TracBrowser for help on using the repository browser.