source: trunk/debathena/scripts/aclocal.m4 @ 23279

Revision 23279, 10.5 KB checked in by broder, 15 years ago (diff)
Use AC_REQUIRE to require AC_CANONICAL_TARGET instead of calling it directly.
Line 
1dnl $Id: aclocal.m4,v 1.19 2006-07-12 19:53:04 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 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(curses, initscr)
100        AC_CHECK_LIB(readline, readline)
101        AC_CHECK_LIB(ss, ss_perror, :,
102                     [AC_MSG_ERROR(ss library not found)], -lcom_err)
103else
104        AC_MSG_ERROR(This package requires ss.)
105fi])
106
107dnl ----- Regular expressions -----
108
109AC_DEFUN([ATHENA_REGEXP],
110[AC_ARG_WITH(regex,
111        [  --with-regex=PREFIX     Use installed regex library],
112        [regex="$withval"], [regex=no])
113if test "$regex" != no; then
114        if test "$regex" != yes; then
115                CPPFLAGS="$CPPFLAGS -I$regex/include"
116                LDFLAGS="$LDFLAGS -L$regex/lib"
117        fi
118        AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
119                     [AC_MSG_ERROR(regex library not found)])
120else
121        AC_CHECK_FUNC(regcomp, :,
122                      [AC_MSG_ERROR(can't find POSIX regexp support)])
123fi
124AC_SUBST(REGEX_LIBS)])
125
126dnl ----- Motif -----
127
128AC_DEFUN([ATHENA_MOTIF_CHECK],
129[if test "$motif" != yes; then
130        CPPFLAGS="$CPPFLAGS -I$motif/include"
131        LDFLAGS="$LDFLAGS -L$motif/lib"
132fi
133AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
134
135AC_DEFUN([ATHENA_MOTIF],
136[AC_ARG_WITH(motif,
137        [  --with-motif=PREFIX     Use Motif],
138        [motif="$withval"], [motif=no])
139if test "$motif" != no; then
140        ATHENA_MOTIF_CHECK
141        MOTIF_LIBS=-lXm
142        AC_DEFINE(HAVE_MOTIF)
143fi
144AC_SUBST(MOTIF_LIBS)])
145
146AC_DEFUN([ATHENA_MOTIF_REQUIRED],
147[AC_ARG_WITH(motif,
148        [  --with-motif=PREFIX     Specify location of Motif],
149        [motif="$withval"], [motif=yes])
150if test "$motif" != no; then
151        ATHENA_MOTIF_CHECK
152else
153        AC_MSG_ERROR(This package requires Motif.)
154fi])
155
156dnl ----- AFS -----
157
158AC_DEFUN([ATHENA_AFS_CHECK],
159[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
160AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
161AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
162AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
163if test "$afs" != yes; then
164        CPPFLAGS="$CPPFLAGS -I$afs/include"
165        LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
166fi
167AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
168             -lrx -llwp -lsys -lafsutil)
169AFS_DIR=$afs
170AC_SUBST(AFS_DIR)])
171
172dnl Specify desired AFS libraries as a parameter.
173AC_DEFUN([ATHENA_AFS],
174[AC_ARG_WITH(afs,
175        [  --with-afs=PREFIX       Use AFS libraries],
176        [afs="$withval"], [afs=no])
177if test "$afs" != no; then
178        ATHENA_AFS_CHECK
179        AFS_LIBS=$1
180        AC_DEFINE(HAVE_AFS)
181fi
182AC_SUBST(AFS_LIBS)])
183
184AC_DEFUN([ATHENA_AFS_REQUIRED],
185[AC_ARG_WITH(afs,
186        [  --with-afs=PREFIX       Specify location of AFS libraries],
187        [afs="$withval"], [afs=/usr/afsws])
188if test "$afs" != no; then
189        ATHENA_AFS_CHECK
190else
191        AC_MSG_ERROR(This package requires AFS libraries.)
192fi])
193
194dnl ----- Kerberos 4 -----
195
196AC_DEFUN([ATHENA_KRB4_CHECK],
197[AC_REQUIRE([AC_CANONICAL_TARGET])
198AC_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"
207fi
208AC_CHECK_LIB(krb4, krb_rd_req,
209             [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
210             [AC_CHECK_LIB(krb, krb_rd_req,
211                           [KRB4_LIBS="-lkrb -ldes"],
212                           [AC_MSG_ERROR(Kerberos 4 libraries not found)],
213                           -ldes)],
214             -ldes425 -lkrb5 -lk5crypto -lcom_err)
215if test "$KRB4_LIBS" != "" ; then
216        case "$target_os" in
217        darwin*) KRB4_LIBS="$KRB4_LIBS -framework Kerberos"
218        esac
219fi])
220
221AC_DEFUN([ATHENA_KRB4],
222[AC_ARG_WITH(krb4,
223        [  --with-krb4=PREFIX      Use Kerberos 4],
224        [krb4="$withval"], [krb4=no])
225if test "$krb4" != no; then
226        ATHENA_KRB4_CHECK
227        AC_DEFINE(HAVE_KRB4)
228fi
229AC_SUBST(KRB4_LIBS)])
230
231AC_DEFUN([ATHENA_KRB4_REQUIRED],
232[AC_ARG_WITH(krb4,
233        [  --with-krb4=PREFIX      Specify location of Kerberos 4],
234        [krb4="$withval"], [krb4=yes])
235if test "$krb4" != no; then
236        ATHENA_KRB4_CHECK
237        AC_SUBST(KRB4_LIBS)
238else
239        AC_MSG_ERROR(This package requires Kerberos 4.)
240fi])
241
242dnl ----- Kerberos 5 -----
243
244AC_DEFUN([ATHENA_KRB5_CHECK],
245[AC_REQUIRE([AC_CANONICAL_TARGET])
246AC_SEARCH_LIBS(gethostbyname, nsl)
247AC_SEARCH_LIBS(socket, socket)
248AC_CHECK_LIB(gen, compile)
249if test "$krb5" != yes; then
250        CPPFLAGS="$CPPFLAGS -I$krb5/include"
251        LDFLAGS="$LDFLAGS -L$krb5/lib"
252fi
253AC_CHECK_LIB(krb5, krb5_init_context, :,
254             [AC_MSG_ERROR(Kerberos 5 libraries not found)],
255             -lk5crypto -lcom_err)])
256
257AC_DEFUN([ATHENA_KRB5],
258[AC_ARG_WITH(krb5,
259        [  --with-krb5=PREFIX      Use Kerberos 5],
260        [krb5="$withval"], [krb5=no])
261if test "$krb5" != no; then
262        ATHENA_KRB5_CHECK
263        KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
264        if test "$KRB5_LIBS" != "" ; then
265                case "$target_os" in
266                darwin*) KRB5_LIBS="$KRB5_LIBS -framework Kerberos"
267                esac
268        fi
269        AC_DEFINE(HAVE_KRB5)
270fi
271AC_SUBST(KRB5_LIBS)])
272
273AC_DEFUN([ATHENA_KRB5_REQUIRED],
274[AC_ARG_WITH(krb5,
275        [  --with-krb5=PREFIX      Specify location of Kerberos 5],
276        [krb5="$withval"], [krb5=yes])
277if test "$krb5" != no; then
278        ATHENA_KRB5_CHECK
279else
280        AC_MSG_ERROR(This package requires Kerberos 5.)
281fi])
282
283dnl ----- Hesiod -----
284
285AC_DEFUN([ATHENA_HESIOD_CHECK],
286[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
287if test "$hesiod" != yes; then
288        CPPFLAGS="$CPPFLAGS -I$hesiod/include"
289        LDFLAGS="$LDFLAGS -L$hesiod/lib"
290fi
291AC_CHECK_LIB(hesiod, hes_resolve, :,
292             [AC_MSG_ERROR(Hesiod library not found)])])
293
294AC_DEFUN([ATHENA_HESIOD],
295[AC_ARG_WITH(hesiod,
296        [  --with-hesiod=PREFIX    Use Hesiod],
297        [hesiod="$withval"], [hesiod=no])
298if test "$hesiod" != no; then
299        ATHENA_HESIOD_CHECK
300        HESIOD_LIBS="-lhesiod"
301        AC_DEFINE(HAVE_HESIOD)
302fi
303AC_SUBST(HESIOD_LIBS)])
304
305AC_DEFUN([ATHENA_HESIOD_REQUIRED],
306[AC_ARG_WITH(hesiod,
307        [  --with-hesiod=PREFIX    Specify location of Hesiod],
308        [hesiod="$withval"], [hesiod=yes])
309if test "$hesiod" != no; then
310        ATHENA_HESIOD_CHECK
311else
312        AC_MSG_ERROR(This package requires Hesiod.)
313fi])
314
315dnl ----- libares -----
316
317AC_DEFUN([ATHENA_ARES_CHECK],
318[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
319if test "$ares" != yes; then
320        CPPFLAGS="$CPPFLAGS -I$ares/include"
321        LDFLAGS="$LDFLAGS -L$ares/lib"
322fi
323AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
324
325AC_DEFUN([ATHENA_ARES],
326[AC_ARG_WITH(ares,
327        [  --with-ares=PREFIX      Use libares],
328        [ares="$withval"], [ares=no])
329if test "$ares" != no; then
330        ATHENA_ARES_CHECK
331        ARES_LIBS="-lares"
332        AC_DEFINE(HAVE_ARES)
333fi
334AC_SUBST(ARES_LIBS)])
335
336AC_DEFUN([ATHENA_ARES_REQUIRED],
337[AC_ARG_WITH(ares,
338        [  --with-ares=PREFIX      Specify location of libares],
339        [ares="$withval"], [ares=yes])
340if test "$ares" != no; then
341        ATHENA_ARES_CHECK
342else
343        AC_MSG_ERROR(This package requires libares.)
344fi])
345dnl ----- zephyr -----
346
347AC_DEFUN([ATHENA_ZEPHYR_CHECK],
348[if test "$zephyr" != yes; then
349        CPPFLAGS="$CPPFLAGS -I$zephyr/include"
350        LDFLAGS="$LDFLAGS -L$zephyr/lib"
351fi
352AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
353
354AC_DEFUN([ATHENA_ZEPHYR],
355[AC_ARG_WITH(zephyr,
356        [  --with-zephyr=PREFIX      Use zephyr],
357        [zephyr="$withval"], [zephyr=no])
358if test "$zephyr" != no; then
359        ATHENA_ZEPHYR_CHECK
360        ZEPHYR_LIBS="-lzephyr"
361        AC_DEFINE(HAVE_ZEPHYR)
362fi
363AC_SUBST(ZEPHYR_LIBS)])
364
365AC_DEFUN([ATHENA_ZEPHYR_REQUIRED],
366[AC_ARG_WITH(zephyr,
367        [  --with-zephyr=PREFIX      Specify location of zephyr],
368        [zephyr="$withval"], [zephyr=yes])
369if test "$zephyr" != no; then
370        ATHENA_ZEPHYR_CHECK
371else
372        AC_MSG_ERROR(This package requires zephyr.)
373fi])
Note: See TracBrowser for help on using the repository browser.