1 dnl $Id: aclocal.m4,v 1.14 2000/04/28 14:37:25 ghudson Exp $
3 dnl Copyright 1996 by the Massachusetts Institute of Technology.
5 dnl Permission to use, copy, modify, and distribute this
6 dnl software and its documentation for any purpose and without
7 dnl fee is hereby granted, provided that the above copyright
8 dnl notice appear in all copies and that both that copyright
9 dnl notice and this permission notice appear in supporting
10 dnl documentation, and that the name of M.I.T. not be used in
11 dnl advertising or publicity pertaining to distribution of the
12 dnl software without specific, written prior permission.
13 dnl M.I.T. makes no representations about the suitability of
14 dnl this software for any purpose. It is provided "as is"
15 dnl without express or implied warranty.
17 dnl This file provides local macros for packages which use specific
18 dnl external libraries. The public macros are:
20 dnl ATHENA_UTIL_COM_ERR
21 dnl Generates error if com_err not found.
23 dnl Generates error if ss not found.
25 dnl Sets REGEX_LIBS if rx library used; ensures POSIX
28 dnl Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
29 dnl ATHENA_MOTIF_REQUIRED
30 dnl Generates error if Motif not found.
32 dnl Sets AFS_LIBS and defines HAVE_AFS if AFS used. Pass
33 dnl in an argument giving the desired AFS libraries;
34 dnl AFS_LIBS will be set to that value if AFS is found.
35 dnl AFS_DIR will be set to the prefix given.
36 dnl ATHENA_AFS_REQUIRED
37 dnl Generates error if AFS libraries not found. AFS_DIR
38 dnl will be set to the prefix given.
40 dnl Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
41 dnl ATHENA_KRB4_REQUIRED
42 dnl Generates error if krb4 not found. Sets KRB4_LIBS
43 dnl otherwise. (Special behavior because krb4 libraries
44 dnl may be different if using krb4 compatibility libraries
47 dnl Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
48 dnl ATHENA_KRB5_REQUIRED
49 dnl Generates error if krb5 not found.
51 dnl Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
53 dnl ATHENA_HESIOD_REQUIRED
54 dnl Generates error if Hesiod not found.
56 dnl Sets ARES_LIBS and defines HAVE_ARES if libares
58 dnl ATHENA_ARES_REQUIRED
59 dnl Generates error if libares not found.
61 dnl Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
63 dnl ATHENA_ZEPHYR_REQUIRED
64 dnl Generates error if zephyr not found.
66 dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
67 dnl compiler find the requested libraries. Put ATHENA_UTIL_COM_ERR
68 dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
69 dnl is a com_err library in the AFS libraries which requires -lutil.
71 dnl ----- com_err -----
73 AC_DEFUN(ATHENA_UTIL_COM_ERR,
75 [ --with-com_err=PREFIX Specify location of com_err],
76 [com_err="$withval"], [com_err=yes])
77 if test "$com_err" != no; then
78 if test "$com_err" != yes; then
79 CPPFLAGS="$CPPFLAGS -I$com_err/include"
80 LDFLAGS="$LDFLAGS -L$com_err/lib"
82 AC_CHECK_LIB(com_err, com_err, :,
83 [AC_MSG_ERROR(com_err library not found)])
85 AC_MSG_ERROR(This package requires com_err.)
90 AC_DEFUN(ATHENA_UTIL_SS,
92 [ --with-ss=PREFIX Specify location of ss (requires com_err)],
93 [ss="$withval"], [ss=yes])
94 if test "$ss" != no; then
95 if test "$ss" != yes; then
96 CPPFLAGS="$CPPFLAGS -I$ss/include"
97 LDFLAGS="$LDFLAGS -L$ss/lib"
99 AC_CHECK_LIB(ss, ss_perror, :,
100 [AC_MSG_ERROR(ss library not found)], -lcom_err)
102 AC_MSG_ERROR(This package requires ss.)
105 dnl ----- Regular expressions -----
107 AC_DEFUN(ATHENA_REGEXP,
109 [ --with-regex=PREFIX Use installed regex library],
110 [regex="$withval"], [regex=no])
111 if test "$regex" != no; then
112 if test "$regex" != yes; then
113 CPPFLAGS="$CPPFLAGS -I$regex/include"
114 LDFLAGS="$LDFLAGS -L$regex/lib"
116 AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
117 [AC_MSG_ERROR(regex library not found)])
119 AC_CHECK_FUNC(regcomp, :,
120 [AC_MSG_ERROR(can't find POSIX regexp support)])
122 AC_SUBST(REGEX_LIBS)])
124 dnl ----- Motif -----
126 AC_DEFUN(ATHENA_MOTIF_CHECK,
127 [if test "$motif" != yes; then
128 CPPFLAGS="$CPPFLAGS -I$motif/include"
129 LDFLAGS="$LDFLAGS -L$motif/lib"
131 AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
133 AC_DEFUN(ATHENA_MOTIF,
135 [ --with-motif=PREFIX Use Motif],
136 [motif="$withval"], [motif=no])
137 if test "$motif" != no; then
140 AC_DEFINE(HAVE_MOTIF)
142 AC_SUBST(MOTIF_LIBS)])
144 AC_DEFUN(ATHENA_MOTIF_REQUIRED,
146 [ --with-motif=PREFIX Specify location of Motif],
147 [motif="$withval"], [motif=yes])
148 if test "$motif" != no; then
151 AC_MSG_ERROR(This package requires Motif.)
156 AC_DEFUN(ATHENA_AFS_CHECK,
157 [AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
158 AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
159 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
160 if test "$afs" != yes; then
161 CPPFLAGS="$CPPFLAGS -I$afs/include"
162 LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
164 AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
169 dnl Specify desired AFS libraries as a parameter.
172 [ --with-afs=PREFIX Use AFS libraries],
173 [afs="$withval"], [afs=no])
174 if test "$afs" != no; then
181 AC_DEFUN(ATHENA_AFS_REQUIRED,
183 [ --with-afs=PREFIX Specify location of AFS libraries],
184 [afs="$withval"], [afs=/usr/afsws])
185 if test "$afs" != no; then
188 AC_MSG_ERROR(This package requires AFS libraries.)
191 dnl ----- Kerberos 4 -----
193 AC_DEFUN(ATHENA_KRB4_CHECK,
194 [AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
195 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
196 AC_CHECK_LIB(gen, compile)
197 if test "$krb4" != yes; then
198 CPPFLAGS="$CPPFLAGS -I$krb4/include"
199 if test -d "$krb4/include/kerberosIV"; then
200 CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
202 LDFLAGS="$LDFLAGS -L$krb4/lib"
204 AC_CHECK_LIB(krb4, krb_rd_req,
205 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
206 [AC_CHECK_LIB(krb, krb_rd_req,
207 [KRB4_LIBS="-lkrb -ldes"],
208 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
210 -ldes425 -lkrb5 -lk5crypto -lcom_err)])
212 AC_DEFUN(ATHENA_KRB4,
214 [ --with-krb4=PREFIX Use Kerberos 4],
215 [krb4="$withval"], [krb4=no])
216 if test "$krb4" != no; then
220 AC_SUBST(KRB4_LIBS)])
222 AC_DEFUN(ATHENA_KRB4_REQUIRED,
224 [ --with-krb4=PREFIX Specify location of Kerberos 4],
225 [krb4="$withval"], [krb4=yes])
226 if test "$krb4" != no; then
230 AC_MSG_ERROR(This package requires Kerberos 4.)
233 dnl ----- Kerberos 5 -----
235 AC_DEFUN(ATHENA_KRB5_CHECK,
236 [AC_SEARCH_LIBS(gethostbyname, nsl)
237 AC_SEARCH_LIBS(socket, socket)
238 AC_CHECK_LIB(gen, compile)
239 if test "$krb5" != yes; then
240 CPPFLAGS="$CPPFLAGS -I$krb5/include"
241 LDFLAGS="$LDFLAGS -L$krb5/lib"
243 AC_CHECK_LIB(krb5, krb5_init_context, :,
244 [AC_MSG_ERROR(Kerberos 5 libraries not found)],
245 -lk5crypto -lcom_err)])
247 AC_DEFUN(ATHENA_KRB5,
249 [ --with-krb5=PREFIX Use Kerberos 5],
250 [krb5="$withval"], [krb5=no])
251 if test "$krb5" != no; then
253 KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
256 AC_SUBST(KRB5_LIBS)])
258 AC_DEFUN(ATHENA_KRB5_REQUIRED,
260 [ --with-krb5=PREFIX Specify location of Kerberos 5],
261 [krb5="$withval"], [krb5=yes])
262 if test "$krb5" != no; then
265 AC_MSG_ERROR(This package requires Kerberos 5.)
268 dnl ----- Hesiod -----
270 AC_DEFUN(ATHENA_HESIOD_CHECK,
271 [AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
272 if test "$hesiod" != yes; then
273 CPPFLAGS="$CPPFLAGS -I$hesiod/include"
274 LDFLAGS="$LDFLAGS -L$hesiod/lib"
276 AC_CHECK_LIB(hesiod, hes_resolve, :,
277 [AC_MSG_ERROR(Hesiod library not found)],$LIBS)])
279 AC_DEFUN(ATHENA_HESIOD,
281 [ --with-hesiod=PREFIX Use Hesiod],
282 [hesiod="$withval"], [hesiod=no])
283 if test "$hesiod" != no; then
285 HESIOD_LIBS="-lhesiod"
286 AC_DEFINE(HAVE_HESIOD)
288 AC_SUBST(HESIOD_LIBS)])
290 AC_DEFUN(ATHENA_HESIOD_REQUIRED,
292 [ --with-hesiod=PREFIX Specify location of Hesiod],
293 [hesiod="$withval"], [hesiod=yes])
294 if test "$hesiod" != no; then
297 AC_MSG_ERROR(This package requires Hesiod.)
300 dnl ----- libares -----
302 AC_DEFUN(ATHENA_ARES_CHECK,
303 [AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
304 if test "$ares" != yes; then
305 CPPFLAGS="$CPPFLAGS -I$ares/include"
306 LDFLAGS="$LDFLAGS -L$ares/lib"
308 AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
310 AC_DEFUN(ATHENA_ARES,
312 [ --with-ares=PREFIX Use libares],
313 [ares="$withval"], [ares=no])
314 if test "$ares" != no; then
319 AC_SUBST(ARES_LIBS)])
321 AC_DEFUN(ATHENA_ARES_REQUIRED,
323 [ --with-ares=PREFIX Specify location of libares],
324 [ares="$withval"], [ares=yes])
325 if test "$ares" != no; then
328 AC_MSG_ERROR(This package requires libares.)
330 dnl ----- zephyr -----
332 AC_DEFUN(ATHENA_ZEPHYR_CHECK,
333 [if test "$zephyr" != yes; then
334 CPPFLAGS="$CPPFLAGS -I$zephyr/include"
335 LDFLAGS="$LDFLAGS -L$zephyr/lib"
337 AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
339 AC_DEFUN(ATHENA_ZEPHYR,
341 [ --with-zephyr=PREFIX Use zephyr],
342 [zephyr="$withval"], [zephyr=no])
343 if test "$zephyr" != no; then
345 ZEPHYR_LIBS="-lzephyr"
346 AC_DEFINE(HAVE_ZEPHYR)
348 AC_SUBST(ZEPHYR_LIBS)])
350 AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
352 [ --with-zephyr=PREFIX Specify location of zephyr],
353 [zephyr="$withval"], [zephyr=yes])
354 if test "$zephyr" != no; then
357 AC_MSG_ERROR(This package requires zephyr.)