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_RESOLV_CHECK
21 dnl Checks to see if the resolver library is present and
22 dnl provides "res_send" or "__res_send" (the latter is used
24 dnl ATHENA_UTIL_COM_ERR
25 dnl Generates error if com_err not found.
27 dnl Generates error if ss not found.
29 dnl Sets REGEX_LIBS if rx library used; ensures POSIX
32 dnl Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
33 dnl ATHENA_MOTIF_REQUIRED
34 dnl Generates error if Motif not found.
36 dnl Sets AFS_LIBS and defines HAVE_AFS if AFS used. Pass
37 dnl in an argument giving the desired AFS libraries;
38 dnl AFS_LIBS will be set to that value if AFS is found.
39 dnl AFS_DIR will be set to the prefix given.
40 dnl ATHENA_AFS_REQUIRED
41 dnl Generates error if AFS libraries not found. AFS_DIR
42 dnl will be set to the prefix given.
44 dnl Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
45 dnl ATHENA_KRB4_REQUIRED
46 dnl Generates error if krb4 not found. Sets KRB4_LIBS
47 dnl otherwise. (Special behavior because krb4 libraries
48 dnl may be different if using krb4 compatibility libraries
51 dnl Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
52 dnl ATHENA_KRB5_REQUIRED
53 dnl Generates error if krb5 not found.
55 dnl Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
57 dnl ATHENA_HESIOD_REQUIRED
58 dnl Generates error if Hesiod not found.
60 dnl Sets ARES_LIBS and defines HAVE_ARES if libares
62 dnl ATHENA_ARES_REQUIRED
63 dnl Generates error if libares not found.
65 dnl Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
67 dnl ATHENA_ZEPHYR_REQUIRED
68 dnl Generates error if zephyr not found.
70 dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
71 dnl compiler find the requested libraries. Put ATHENA_UTIL_COM_ERR
72 dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
73 dnl is a com_err library in the AFS libraries which requires -lutil.
75 dnl ----- resolv -----
77 AC_DEFUN(ATHENA_RESOLV_CHECK,
79 AC_CHECK_FUNC(res_send, :,
80 AC_CHECK_LIB(resolv, res_send, r=true,
81 AC_CHECK_LIB(resolv, __res_send, r=true)))
83 AC_DEFINE(HAVE_LIB_RESOLV)
87 dnl ----- com_err -----
89 AC_DEFUN(ATHENA_UTIL_COM_ERR,
91 [ --with-com_err=PREFIX Specify location of com_err],
92 [com_err="$withval"], [com_err=yes])
93 if test "$com_err" != no; then
94 if test "$com_err" != yes; then
95 if test -f $com_err/include/krb5/com_right.h; then
96 CPPFLAGS="$CPPFLAGS -I$com_err/include/krb5"
98 CPPFLAGS="$CPPFLAGS -I$com_err/include"
100 LDFLAGS="$LDFLAGS -L$com_err/lib"
102 if test -f /usr/include/krb5/com_right.h; then
103 CPPFLAGS="$CPPFLAGS -I/usr/include/krb5"
106 AC_CHECK_LIB(com_err, com_err, :,
107 [AC_MSG_ERROR(com_err library not found)])
109 AC_MSG_ERROR(This package requires com_err.)
114 AC_DEFUN(ATHENA_UTIL_SS,
116 [ --with-ss=PREFIX Specify location of ss (requires com_err)],
117 [ss="$withval"], [ss=yes])
118 if test "$ss" = no; then
119 AC_MSG_ERROR(This package requires ss.)
121 if test "$ss" != yes; then
122 CPPFLAGS="$CPPFLAGS -I$ss/include"
123 if test -f $ss/include/krb5/sl.h; then
124 CPPFLAGS="$CPPFLAGS -I$ss/include/krb5"
126 LDFLAGS="$LDFLAGS -L$ss/lib"
128 if test -f /usr/include/krb5/sl.h; then
129 CPPFLAGS="$CPPFLAGS -I/usr/include/krb5"
132 AC_CHECK_HEADERS(ss/ss.h krb5/ss.h)
134 AC_CHECK_LIB(ss, ss_perror, [SS_LIBS="-lss"],
135 [unset ac_cv_lib_ss_ss_perror
136 S="-ledit -lroken -ltermcap -lcom_err -lcrypt"
137 AC_CHECK_LIB(ss, ss_perror,
139 [AC_MSG_ERROR(ss library not found)],
144 dnl ----- Regular expressions -----
146 AC_DEFUN(ATHENA_REGEXP,
148 [ --with-regex=PREFIX Use installed regex library],
149 [regex="$withval"], [regex=no])
150 if test "$regex" != no; then
151 if test "$regex" != yes; then
152 CPPFLAGS="$CPPFLAGS -I$regex/include"
153 LDFLAGS="$LDFLAGS -L$regex/lib"
155 AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
156 [AC_MSG_ERROR(regex library not found)])
158 AC_CHECK_FUNC(regcomp, :,
159 [AC_MSG_ERROR(can't find POSIX regexp support)])
161 AC_SUBST(REGEX_LIBS)])
163 dnl ----- Motif -----
165 AC_DEFUN(ATHENA_MOTIF_CHECK,
166 [if test "$motif" != yes; then
167 CPPFLAGS="$CPPFLAGS -I$motif/include"
168 LDFLAGS="$LDFLAGS -L$motif/lib"
170 AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
172 AC_DEFUN(ATHENA_MOTIF,
174 [ --with-motif=PREFIX Use Motif],
175 [motif="$withval"], [motif=no])
176 if test "$motif" != no; then
179 AC_DEFINE(HAVE_MOTIF)
181 AC_SUBST(MOTIF_LIBS)])
183 AC_DEFUN(ATHENA_MOTIF_REQUIRED,
185 [ --with-motif=PREFIX Specify location of Motif],
186 [motif="$withval"], [motif=yes])
187 if test "$motif" != no; then
190 AC_MSG_ERROR(This package requires Motif.)
195 AC_DEFUN(ATHENA_AFS_CHECK,
196 [AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
197 AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
198 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
199 if test "$afs" != yes; then
200 CPPFLAGS="$CPPFLAGS -I$afs/include"
201 LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
203 AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
208 dnl Specify desired AFS libraries as a parameter.
211 [ --with-afs=PREFIX Use AFS libraries],
212 [afs="$withval"], [afs=no])
213 if test "$afs" != no; then
220 AC_DEFUN(ATHENA_AFS_REQUIRED,
222 [ --with-afs=PREFIX Specify location of AFS libraries],
223 [afs="$withval"], [afs=/usr/afsws])
224 if test "$afs" != no; then
227 AC_MSG_ERROR(This package requires AFS libraries.)
230 dnl ----- Kerberos 4 -----
232 AC_DEFUN(ATHENA_KRB4_CHECK,
233 [AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
234 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
235 AC_CHECK_LIB(gen, compile)
236 AC_REQUIRE([ATHENA_RESOLV_CHECK])
237 if test "$krb4" != yes; then
238 CPPFLAGS="$CPPFLAGS -I$krb4/include"
239 if test -d "$krb4/include/kerberosIV"; then
240 CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
242 LDFLAGS="$LDFLAGS -L$krb4/lib"
244 if test -d "/usr/include/kerberosIV"; then
245 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
248 AC_CHECK_LIB(krb4, krb_rd_req,
249 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
250 [AC_CHECK_LIB(krb, krb_rd_req,
251 [KRB4_LIBS="-lkrb -ldes -lroken -lcom_err"],
252 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
253 -ldes -lroken -lcom_err)],
254 -ldes425 -lkrb5 -lk5crypto -lcom_err)])
256 AC_DEFUN(ATHENA_KRB4,
258 [ --with-krb4=PREFIX Use Kerberos 4],
259 [krb4="$withval"], [krb4=no])
260 if test "$krb4" != no; then
264 AC_SUBST(KRB4_LIBS)])
266 AC_DEFUN(ATHENA_KRB4_REQUIRED,
268 [ --with-krb4=PREFIX Specify location of Kerberos 4],
269 [krb4="$withval"], [krb4=yes])
270 if test "$krb4" != no; then
274 AC_MSG_ERROR(This package requires Kerberos 4.)
277 dnl ----- Kerberos 5 -----
279 AC_DEFUN(ATHENA_KRB5_CHECK,
280 [AC_SEARCH_LIBS(gethostbyname, nsl)
281 AC_SEARCH_LIBS(socket, socket)
282 AC_CHECK_LIB(gen, compile)
283 AC_REQUIRE([ATHENA_RESOLV_CHECK])
284 if test "$krb5" != yes; then
285 CPPFLAGS="$CPPFLAGS -I$krb5/include"
286 LDFLAGS="$LDFLAGS -L$krb5/lib"
288 AC_CHECK_LIB(krb5, krb5_init_context, :,
289 [AC_MSG_ERROR(Kerberos 5 libraries not found)],
290 -lk5crypto -lcom_err)])
292 AC_DEFUN(ATHENA_KRB5,
294 [ --with-krb5=PREFIX Use Kerberos 5],
295 [krb5="$withval"], [krb5=no])
296 if test "$krb5" != no; then
298 KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
301 AC_SUBST(KRB5_LIBS)])
303 AC_DEFUN(ATHENA_KRB5_REQUIRED,
305 [ --with-krb5=PREFIX Specify location of Kerberos 5],
306 [krb5="$withval"], [krb5=yes])
307 if test "$krb5" != no; then
310 AC_MSG_ERROR(This package requires Kerberos 5.)
313 dnl ----- Hesiod -----
315 AC_DEFUN(ATHENA_HESIOD_CHECK,
316 [AC_REQUIRE([ATHENA_RESOLV_CHECK])
317 if test "$hesiod" != yes; then
318 CPPFLAGS="$CPPFLAGS -I$hesiod/include"
319 LDFLAGS="$LDFLAGS -L$hesiod/lib"
321 AC_CHECK_FUNC(hes_resolve, :,
322 AC_CHECK_LIB(hesiod, hes_resolve, HESIOD_LIBS="-lhesiod",
323 [AC_MSG_ERROR(Hesiod library not found)]))])
325 AC_DEFUN(ATHENA_HESIOD,
327 [ --with-hesiod=PREFIX Use Hesiod],
328 [hesiod="$withval"], [hesiod=no])
329 if test "$hesiod" != no; then
331 AC_DEFINE(HAVE_HESIOD)
333 AC_SUBST(HESIOD_LIBS)])
335 AC_DEFUN(ATHENA_HESIOD_REQUIRED,
337 [ --with-hesiod=PREFIX Specify location of Hesiod],
338 [hesiod="$withval"], [hesiod=yes])
339 if test "$hesiod" != no; then
342 AC_MSG_ERROR(This package requires Hesiod.)
345 dnl ----- libares -----
347 AC_DEFUN(ATHENA_ARES_CHECK,
348 [AC_REQUIRE([ATHENA_RESOLV_CHECK])
349 if test "$ares" != yes; then
350 CPPFLAGS="$CPPFLAGS -I$ares/include"
351 LDFLAGS="$LDFLAGS -L$ares/lib"
353 AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
355 AC_DEFUN(ATHENA_ARES,
357 [ --with-ares=PREFIX Use libares],
358 [ares="$withval"], [ares=no])
359 if test "$ares" != no; then
364 AC_SUBST(ARES_LIBS)])
366 AC_DEFUN(ATHENA_ARES_REQUIRED,
368 [ --with-ares=PREFIX Specify location of libares],
369 [ares="$withval"], [ares=yes])
370 if test "$ares" != no; then
373 AC_MSG_ERROR(This package requires libares.)
375 dnl ----- zephyr -----
377 AC_DEFUN(ATHENA_ZEPHYR_CHECK,
378 [if test "$zephyr" != yes; then
379 CPPFLAGS="$CPPFLAGS -I$zephyr/include"
380 LDFLAGS="$LDFLAGS -L$zephyr/lib"
382 AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
384 AC_DEFUN(ATHENA_ZEPHYR,
386 [ --with-zephyr=PREFIX Use zephyr],
387 [zephyr="$withval"], [zephyr=no])
388 if test "$zephyr" != no; then
390 ZEPHYR_LIBS="-lzephyr"
391 AC_DEFINE(HAVE_ZEPHYR)
393 AC_SUBST(ZEPHYR_LIBS)])
395 AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
397 [ --with-zephyr=PREFIX Specify location of zephyr],
398 [zephyr="$withval"], [zephyr=yes])
399 if test "$zephyr" != no; then
402 AC_MSG_ERROR(This package requires zephyr.)