]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - acinclude.m4
1a87fd0bbc5ebe4e05e383ba9961cad2565ff327
[1ts-debian.git] / acinclude.m4
1 dnl $Id$
2
3 dnl Copyright 1996 by the Massachusetts Institute of Technology.
4 dnl
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.
16
17 dnl This file provides local macros for packages which use specific
18 dnl external libraries.  The public macros are:
19 dnl
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
23 dnl             on Linux).
24 dnl     ATHENA_UTIL_COM_ERR
25 dnl             Generates error if com_err not found.
26 dnl     ATHENA_UTIL_SS
27 dnl             Generates error if ss not found.
28 dnl     ATHENA_REGEXP
29 dnl             Sets REGEX_LIBS if rx library used; ensures POSIX
30 dnl             regexp support.
31 dnl     ATHENA_MOTIF
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.
35 dnl     ATHENA_AFS
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.
43 dnl     ATHENA_KRB4
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
49 dnl             from krb5.)
50 dnl     ATHENA_KRB5
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.
54 dnl     ATHENA_HESIOD
55 dnl             Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
56 dnl             used.
57 dnl     ATHENA_HESIOD_REQUIRED
58 dnl             Generates error if Hesiod not found.
59 dnl     ATHENA_ARES
60 dnl             Sets ARES_LIBS and defines HAVE_ARES if libares
61 dnl             used.
62 dnl     ATHENA_ARES_REQUIRED
63 dnl             Generates error if libares not found.
64 dnl     ATHENA_ZEPHYR
65 dnl             Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
66 dnl             used.
67 dnl     ATHENA_ZEPHYR_REQUIRED
68 dnl             Generates error if zephyr not found.
69 dnl
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.
74
75 dnl ----- resolv -----
76
77 AC_DEFUN(ATHENA_RESOLV_CHECK,
78 r=false
79 AC_CHECK_FUNC(res_send, :,
80         AC_CHECK_LIB(resolv, res_send, r=true,
81                         AC_CHECK_LIB(resolv, __res_send, r=true)))
82 if $r ; then
83   AC_DEFINE(HAVE_LIB_RESOLV)
84   LIBS="-lresolv $LIBS"
85 fi)
86
87 dnl ----- com_err -----
88
89 AC_DEFUN(ATHENA_UTIL_COM_ERR,
90 [AC_ARG_WITH(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"
97                 else
98                         CPPFLAGS="$CPPFLAGS -I$com_err/include"
99                 fi
100                 LDFLAGS="$LDFLAGS -L$com_err/lib"
101         else
102                 if test -f /usr/include/krb5/com_right.h; then
103                         CPPFLAGS="$CPPFLAGS -I/usr/include/krb5"
104                 fi
105         fi
106         AC_CHECK_LIB(com_err, com_err, :,
107                      [AC_MSG_ERROR(com_err library not found)])
108 else
109         AC_MSG_ERROR(This package requires com_err.)
110 fi])
111
112 dnl ----- ss -----
113
114 AC_DEFUN(ATHENA_UTIL_SS,
115 [AC_ARG_WITH(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.)
120 fi
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"
125         fi
126         LDFLAGS="$LDFLAGS -L$ss/lib"
127 else
128         if test -f /usr/include/krb5/sl.h; then
129                 CPPFLAGS="$CPPFLAGS -I/usr/include/krb5"
130         fi
131 fi
132 AC_CHECK_HEADERS(ss/ss.h krb5/ss.h)
133
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,
138                            [SS_LIBS="-lss $S"],
139                            [AC_MSG_ERROR(ss library not found)],
140                            $S)],
141              -lcom_err)
142 AC_SUBST(SS_LIBS)])
143
144 dnl ----- Regular expressions -----
145
146 AC_DEFUN(ATHENA_REGEXP,
147 [AC_ARG_WITH(regex,
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"
154         fi
155         AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
156                      [AC_MSG_ERROR(regex library not found)])
157 else
158         AC_CHECK_FUNC(regcomp, :,
159                       [AC_MSG_ERROR(can't find POSIX regexp support)])
160 fi
161 AC_SUBST(REGEX_LIBS)])
162
163 dnl ----- Motif -----
164
165 AC_DEFUN(ATHENA_MOTIF_CHECK,
166 [if test "$motif" != yes; then
167         CPPFLAGS="$CPPFLAGS -I$motif/include"
168         LDFLAGS="$LDFLAGS -L$motif/lib"
169 fi
170 AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
171
172 AC_DEFUN(ATHENA_MOTIF,
173 [AC_ARG_WITH(motif,
174         [  --with-motif=PREFIX     Use Motif],
175         [motif="$withval"], [motif=no])
176 if test "$motif" != no; then
177         ATHENA_MOTIF_CHECK
178         MOTIF_LIBS=-lXm
179         AC_DEFINE(HAVE_MOTIF)
180 fi
181 AC_SUBST(MOTIF_LIBS)])
182
183 AC_DEFUN(ATHENA_MOTIF_REQUIRED,
184 [AC_ARG_WITH(motif,
185         [  --with-motif=PREFIX     Specify location of Motif],
186         [motif="$withval"], [motif=yes])
187 if test "$motif" != no; then
188         ATHENA_MOTIF_CHECK
189 else
190         AC_MSG_ERROR(This package requires Motif.)
191 fi])
192
193 dnl ----- AFS -----
194
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"
202 fi
203 AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
204              -lrx -llwp -lsys)
205 AFS_DIR=$afs
206 AC_SUBST(AFS_DIR)])
207
208 dnl Specify desired AFS libraries as a parameter.
209 AC_DEFUN(ATHENA_AFS,
210 [AC_ARG_WITH(afs,
211         [  --with-afs=PREFIX       Use AFS libraries],
212         [afs="$withval"], [afs=no])
213 if test "$afs" != no; then
214         ATHENA_AFS_CHECK
215         AFS_LIBS=$1
216         AC_DEFINE(HAVE_AFS)
217 fi
218 AC_SUBST(AFS_LIBS)])
219
220 AC_DEFUN(ATHENA_AFS_REQUIRED,
221 [AC_ARG_WITH(afs,
222         [  --with-afs=PREFIX       Specify location of AFS libraries],
223         [afs="$withval"], [afs=/usr/afsws])
224 if test "$afs" != no; then
225         ATHENA_AFS_CHECK
226 else
227         AC_MSG_ERROR(This package requires AFS libraries.)
228 fi])
229
230 dnl ----- Kerberos 4 -----
231
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"
241         fi
242         LDFLAGS="$LDFLAGS -L$krb4/lib"
243 else
244         if test -d "/usr/include/kerberosIV"; then
245                 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
246         fi
247 fi
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)])
255
256 AC_DEFUN(ATHENA_KRB4,
257 [AC_ARG_WITH(krb4,
258         [  --with-krb4=PREFIX      Use Kerberos 4],
259         [krb4="$withval"], [krb4=no])
260 if test "$krb4" != no; then
261         ATHENA_KRB4_CHECK
262         AC_DEFINE(HAVE_KRB4)
263 fi
264 AC_SUBST(KRB4_LIBS)])
265
266 AC_DEFUN(ATHENA_KRB4_REQUIRED,
267 [AC_ARG_WITH(krb4,
268         [  --with-krb4=PREFIX      Specify location of Kerberos 4],
269         [krb4="$withval"], [krb4=yes])
270 if test "$krb4" != no; then
271         ATHENA_KRB4_CHECK
272         AC_SUBST(KRB4_LIBS)
273 else
274         AC_MSG_ERROR(This package requires Kerberos 4.)
275 fi])
276
277 dnl ----- Kerberos 5 -----
278
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"
287 fi
288 AC_CHECK_LIB(krb5, krb5_init_context, :,
289              [AC_MSG_ERROR(Kerberos 5 libraries not found)],
290              -lk5crypto -lcom_err)])
291
292 AC_DEFUN(ATHENA_KRB5,
293 [AC_ARG_WITH(krb5,
294         [  --with-krb5=PREFIX      Use Kerberos 5],
295         [krb5="$withval"], [krb5=no])
296 if test "$krb5" != no; then
297         ATHENA_KRB5_CHECK
298         KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
299         AC_DEFINE(HAVE_KRB5)
300 fi
301 AC_SUBST(KRB5_LIBS)])
302
303 AC_DEFUN(ATHENA_KRB5_REQUIRED,
304 [AC_ARG_WITH(krb5,
305         [  --with-krb5=PREFIX      Specify location of Kerberos 5],
306         [krb5="$withval"], [krb5=yes])
307 if test "$krb5" != no; then
308         ATHENA_KRB5_CHECK
309 else
310         AC_MSG_ERROR(This package requires Kerberos 5.)
311 fi])
312
313 dnl ----- Hesiod -----
314
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"
320 fi
321 AC_CHECK_FUNC(hes_resolve, :,
322               AC_CHECK_LIB(hesiod, hes_resolve, HESIOD_LIBS="-lhesiod",
323                            [AC_MSG_ERROR(Hesiod library not found)]))])
324
325 AC_DEFUN(ATHENA_HESIOD,
326 [AC_ARG_WITH(hesiod,
327         [  --with-hesiod=PREFIX    Use Hesiod],
328         [hesiod="$withval"], [hesiod=no])
329 if test "$hesiod" != no; then
330         ATHENA_HESIOD_CHECK
331         AC_DEFINE(HAVE_HESIOD)
332 fi
333 AC_SUBST(HESIOD_LIBS)])
334
335 AC_DEFUN(ATHENA_HESIOD_REQUIRED,
336 [AC_ARG_WITH(hesiod,
337         [  --with-hesiod=PREFIX    Specify location of Hesiod],
338         [hesiod="$withval"], [hesiod=yes])
339 if test "$hesiod" != no; then
340         ATHENA_HESIOD_CHECK
341 else
342         AC_MSG_ERROR(This package requires Hesiod.)
343 fi])
344
345 dnl ----- libares -----
346
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"
352 fi
353 AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
354
355 AC_DEFUN(ATHENA_ARES,
356 [AC_ARG_WITH(ares,
357         [  --with-ares=PREFIX      Use libares],
358         [ares="$withval"], [ares=no])
359 if test "$ares" != no; then
360         ATHENA_ARES_CHECK
361         ARES_LIBS="-lares"
362         AC_DEFINE(HAVE_ARES)
363 fi
364 AC_SUBST(ARES_LIBS)])
365
366 AC_DEFUN(ATHENA_ARES_REQUIRED,
367 [AC_ARG_WITH(ares,
368         [  --with-ares=PREFIX      Specify location of libares],
369         [ares="$withval"], [ares=yes])
370 if test "$ares" != no; then
371         ATHENA_ARES_CHECK
372 else
373         AC_MSG_ERROR(This package requires libares.)
374 fi])
375 dnl ----- zephyr -----
376
377 AC_DEFUN(ATHENA_ZEPHYR_CHECK,
378 [if test "$zephyr" != yes; then
379         CPPFLAGS="$CPPFLAGS -I$zephyr/include"
380         LDFLAGS="$LDFLAGS -L$zephyr/lib"
381 fi
382 AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
383
384 AC_DEFUN(ATHENA_ZEPHYR,
385 [AC_ARG_WITH(zephyr,
386         [  --with-zephyr=PREFIX      Use zephyr],
387         [zephyr="$withval"], [zephyr=no])
388 if test "$zephyr" != no; then
389         ATHENA_ZEPHYR_CHECK
390         ZEPHYR_LIBS="-lzephyr"
391         AC_DEFINE(HAVE_ZEPHYR)
392 fi
393 AC_SUBST(ZEPHYR_LIBS)])
394
395 AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
396 [AC_ARG_WITH(zephyr,
397         [  --with-zephyr=PREFIX      Specify location of zephyr],
398         [zephyr="$withval"], [zephyr=yes])
399 if test "$zephyr" != no; then
400         ATHENA_ZEPHYR_CHECK
401 else
402         AC_MSG_ERROR(This package requires zephyr.)
403 fi])