source: trunk/athena/bin/discuss/aclocal.m4 @ 12439

Revision 12439, 10.4 KB checked in by kcr, 26 years ago (diff)
Autoconfiscation and cleanup.
Line 
1dnl $Id: aclocal.m4,v 1.1 1999-02-02 20:39:40 kcr 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 REGEX_LIBS if rx library used; ensures POSIX
26dnl             regexp 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     ATHENA_ARES
56dnl             Sets ARES_LIBS and defines HAVE_ARES if libares
57dnl             used.
58dnl     ATHENA_ARES_REQUIRED
59dnl             Generates error if libares not found.
60dnl     ATHENA_ZEPHYR
61dnl             Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
62dnl             used.
63dnl     ATHENA_ZEPHYR_REQUIRED
64dnl             Generates error if zephyr not found.
65dnl
66dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
67dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
68dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
69dnl is a com_err library in the AFS libraries which requires -lutil.
70
71dnl ----- com_err -----
72
73AC_DEFUN(ATHENA_UTIL_COM_ERR,
74[AC_ARG_WITH(com_err,
75        [  --with-com_err=PREFIX   Specify location of com_err],
76        [com_err="$withval"], [com_err=yes])
77if 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"
81        fi
82        AC_CHECK_LIB(com_err, com_err, :,
83                     [AC_MSG_ERROR(com_err library not found)])
84else
85        AC_MSG_ERROR(This package requires com_err.)
86fi])
87
88dnl ----- ss -----
89
90AC_DEFUN(ATHENA_UTIL_SS,
91[AC_ARG_WITH(ss,
92        [  --with-ss=PREFIX        Specify location of ss (requires com_err)],
93        [ss="$withval"], [ss=yes])
94if test "$ss" != no; then
95        if test "$ss" != yes; then
96                CPPFLAGS="$CPPFLAGS -I$ss/include"
97                LDFLAGS="$LDFLAGS -L$ss/lib"
98        fi
99        AC_CHECK_LIB(ss, ss_perror, :,
100                     [AC_MSG_ERROR(ss library not found)], -lcom_err)
101else
102        AC_MSG_ERROR(This package requires ss.)
103fi])
104
105dnl ----- Regular expressions -----
106
107AC_DEFUN(ATHENA_REGEXP,
108[AC_ARG_WITH(regex,
109        [  --with-regex=PREFIX     Use installed regex library],
110        [regex="$withval"], [regex=no])
111if test "$regex" != no; then
112        if test "$regex" != yes; then
113                CPPFLAGS="$CPPFLAGS -I$regex/include"
114                LDFLAGS="$LDFLAGS -L$regex/lib"
115        fi
116        AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
117                     [AC_MSG_ERROR(regex library not found)])
118else
119        AC_CHECK_FUNC(regcomp, :,
120                      [AC_MSG_ERROR(can't find POSIX regexp support)])
121fi
122AC_SUBST(REGEX_LIBS)])
123
124dnl ----- Motif -----
125
126AC_DEFUN(ATHENA_MOTIF_CHECK,
127[if test "$motif" != yes; then
128        CPPFLAGS="$CPPFLAGS -I$motif/include"
129        LDFLAGS="$LDFLAGS -L$motif/lib"
130fi
131AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
132
133AC_DEFUN(ATHENA_MOTIF,
134[AC_ARG_WITH(motif,
135        [  --with-motif=PREFIX     Use Motif],
136        [motif="$withval"], [motif=no])
137if test "$motif" != no; then
138        ATHENA_MOTIF_CHECK
139        MOTIF_LIBS=-lXm
140        AC_DEFINE(HAVE_MOTIF)
141fi
142AC_SUBST(MOTIF_LIBS)])
143
144AC_DEFUN(ATHENA_MOTIF_REQUIRED,
145[AC_ARG_WITH(motif,
146        [  --with-motif=PREFIX     Specify location of Motif],
147        [motif="$withval"], [motif=yes])
148if test "$motif" != no; then
149        ATHENA_MOTIF_CHECK
150else
151        AC_MSG_ERROR(This package requires Motif.)
152fi])
153
154dnl ----- AFS -----
155
156AC_DEFUN(ATHENA_AFS_CHECK,
157[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
158AC_CHECK_FUNC(sigvec, :,
159              AC_CHECK_LIB(ucb, sigvec,
160                           LIBS="$LIBS -L/usr/ucblib -R/usr/ucblib -lc -lucb",
161                           :, -L/usr/ucblib))
162AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
163AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
164if test "$afs" != yes; then
165        CPPFLAGS="$CPPFLAGS -I$afs/include"
166        LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
167fi
168AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
169             -lrx -llwp -lsys)
170AFS_DIR=$afs
171AC_SUBST(AFS_DIR)])
172
173dnl Specify desired AFS libraries as a parameter.
174AC_DEFUN(ATHENA_AFS,
175[AC_ARG_WITH(afs,
176        [  --with-afs=PREFIX       Use AFS libraries],
177        [afs="$withval"], [afs=no])
178if test "$afs" != no; then
179        ATHENA_AFS_CHECK
180        AFS_LIBS=$1
181        AC_DEFINE(HAVE_AFS)
182fi
183AC_SUBST(AFS_LIBS)])
184
185AC_DEFUN(ATHENA_AFS_REQUIRED,
186[AC_ARG_WITH(afs,
187        [  --with-afs=PREFIX       Specify location of AFS libraries],
188        [afs="$withval"], [afs=/usr/afsws])
189if test "$afs" != no; then
190        ATHENA_AFS_CHECK
191else
192        AC_MSG_ERROR(This package requires AFS libraries.)
193fi])
194
195dnl ----- Kerberos 4 -----
196
197AC_DEFUN(ATHENA_KRB4_CHECK,
198[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
199AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
200AC_CHECK_LIB(gen, compile)
201if test "$krb4" != yes; then
202        CPPFLAGS="$CPPFLAGS -I$krb4/include"
203        if test -d "$krb4/include/kerberosIV"; then
204                CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
205        fi
206        LDFLAGS="$LDFLAGS -L$krb4/lib"
207elif test -d /usr/include/kerberosIV; then
208        CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
209elif test -d ${prefix}/include/kerberosIV; then
210        CPPFLAGS="$CPPFLAGS -I${prefix}/include/kerberosIV"
211fi
212AC_CHECK_LIB(krb4, krb_rd_req,
213             [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
214             [AC_CHECK_LIB(krb, krb_rd_req,
215                           [KRB4_LIBS="-lkrb -ldes"],
216                           [AC_MSG_ERROR(Kerberos 4 libraries not found)],
217                           -ldes)],
218             -ldes425 -lkrb5 -lcrypto -lcom_err)])
219
220AC_DEFUN(ATHENA_KRB4,
221[AC_ARG_WITH(krb4,
222        [  --with-krb4=PREFIX      Use Kerberos 4],
223        [krb4="$withval"], [krb4=no])
224if test "$krb4" != no; then
225        ATHENA_KRB4_CHECK
226        AC_DEFINE(HAVE_KRB4)
227fi
228AC_SUBST(KRB4_LIBS)])
229
230AC_DEFUN(ATHENA_KRB4_REQUIRED,
231[AC_ARG_WITH(krb4,
232        [  --with-krb4=PREFIX      Specify location of Kerberos 4],
233        [krb4="$withval"], [krb4=yes])
234if test "$afs" != no; then
235        ATHENA_KRB4_CHECK
236        AC_SUBST(KRB4_LIBS)
237else
238        AC_MSG_ERROR(This package requires Kerberos 4.)
239fi])
240
241dnl ----- Kerberos 5 -----
242
243AC_DEFUN(ATHENA_KRB5_CHECK,
244[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
245AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
246AC_CHECK_LIB(gen, compile)
247if test "$krb5" != yes; then
248        CPPFLAGS="$CPPFLAGS -I$krb5/include"
249        LDFLAGS="$LDFLAGS -L$krb5/lib"
250fi
251AC_CHECK_LIB(krb5, krb5_init_context, :,
252             [AC_MSG_ERROR(Kerberos 5 libraries not found)],
253             -lcrypto -lcom_err)])
254
255AC_DEFUN(ATHENA_KRB5,
256[AC_ARG_WITH(krb5,
257        [  --with-krb5=PREFIX      Use Kerberos 5],
258        [krb5="$withval"], [krb5=no])
259if test "$krb5" != no; then
260        ATHENA_KRB5_CHECK
261        KRB5_LIBS="-lkrb5 -lcrypto -lcom_err"
262        AC_DEFINE(HAVE_KRB5)
263fi
264AC_SUBST(KRB5_LIBS)])
265
266AC_DEFUN(ATHENA_KRB5_REQUIRED,
267[AC_ARG_WITH(krb5,
268        [  --with-krb5=PREFIX      Specify location of Kerberos 5],
269        [krb5="$withval"], [krb5=yes])
270if test "$krb5" != no; then
271        ATHENA_KRB5_CHECK
272else
273        AC_MSG_ERROR(This package requires Kerberos 5.)
274fi])
275
276dnl ----- Hesiod -----
277
278AC_DEFUN(ATHENA_HESIOD_CHECK,
279[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
280if test "$hesiod" != yes; then
281        CPPFLAGS="$CPPFLAGS -I$hesiod/include"
282        LDFLAGS="$LDFLAGS -L$hesiod/lib"
283fi
284AC_CHECK_LIB(hesiod, hes_resolve, :,
285             [AC_MSG_ERROR(Hesiod library not found)])])
286
287AC_DEFUN(ATHENA_HESIOD,
288[AC_ARG_WITH(hesiod,
289        [  --with-hesiod=PREFIX    Use Hesiod],
290        [hesiod="$withval"], [hesiod=no])
291if test "$hesiod" != no; then
292        ATHENA_HESIOD_CHECK
293        HESIOD_LIBS="-lhesiod"
294        AC_DEFINE(HAVE_HESIOD)
295fi
296AC_SUBST(HESIOD_LIBS)])
297
298AC_DEFUN(ATHENA_HESIOD_REQUIRED,
299[AC_ARG_WITH(hesiod,
300        [  --with-hesiod=PREFIX    Specify location of Hesiod],
301        [hesiod="$withval"], [hesiod=yes])
302if test "$hesiod" != no; then
303        ATHENA_HESIOD_CHECK
304else
305        AC_MSG_ERROR(This package requires Hesiod.)
306fi])
307
308dnl ----- libares -----
309
310AC_DEFUN(ATHENA_ARES_CHECK,
311[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
312if test "$ares" != yes; then
313        CPPFLAGS="$CPPFLAGS -I$ares/include"
314        LDFLAGS="$LDFLAGS -L$ares/lib"
315fi
316AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
317
318AC_DEFUN(ATHENA_ARES,
319[AC_ARG_WITH(ares,
320        [  --with-ares=PREFIX      Use libares],
321        [ares="$withval"], [ares=no])
322if test "$ares" != no; then
323        ATHENA_ARES_CHECK
324        ARES_LIBS="-lares"
325        AC_DEFINE(HAVE_ARES)
326fi
327AC_SUBST(ARES_LIBS)])
328
329AC_DEFUN(ATHENA_ARES_REQUIRED,
330[AC_ARG_WITH(ares,
331        [  --with-ares=PREFIX      Specify location of libares],
332        [ares="$withval"], [ares=yes])
333if test "$ares" != no; then
334        ATHENA_ARES_CHECK
335else
336        AC_MSG_ERROR(This package requires libares.)
337fi])
338dnl ----- zephyr -----
339
340AC_DEFUN(ATHENA_ZEPHYR_CHECK,
341[if test "$zephyr" != yes; then
342        CPPFLAGS="$CPPFLAGS -I$zephyr/include"
343        LDFLAGS="$LDFLAGS -L$zephyr/lib"
344fi
345AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
346
347AC_DEFUN(ATHENA_ZEPHYR,
348[AC_ARG_WITH(zephyr,
349        [  --with-zephyr=PREFIX      Use zephyr],
350        [zephyr="$withval"], [zephyr=no])
351if test "$zephyr" != no; then
352        ATHENA_ZEPHYR_CHECK
353        ZEPHYR_LIBS="-lzephyr"
354        AC_DEFINE(HAVE_ZEPHYR)
355fi
356AC_SUBST(ZEPHYR_LIBS)])
357
358AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
359[AC_ARG_WITH(zephyr,
360        [  --with-zephyr=PREFIX      Specify location of zephyr],
361        [zephyr="$withval"], [zephyr=yes])
362if test "$zephyr" != no; then
363        ATHENA_ZEPHYR_CHECK
364else
365        AC_MSG_ERROR(This package requires zephyr.)
366fi])
Note: See TracBrowser for help on using the repository browser.