source: trunk/packs/build/aclocal.m4 @ 11142

Revision 11142, 8.5 KB checked in by ghudson, 26 years ago (diff)
Do a better job at finding and using libucb.
Line 
1dnl $Id: aclocal.m4,v 1.7 1998-02-20 21:19:20 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 RX_LIBS if rx library used; ensures POSIX regexp
26dnl             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
56dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
57dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
58dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
59dnl is a com_err library in the AFS libraries which requires -lutil.
60
61dnl ----- com_err -----
62
63AC_DEFUN(ATHENA_UTIL_COM_ERR,
64[AC_ARG_WITH(com_err,
65        [  --with-com_err=PREFIX   Specify location of com_err],
66        [com_err="$withval"], [com_err=yes])
67if test "$com_err" != no; then
68        if test "$com_err" != yes; then
69                CPPFLAGS="$CPPFLAGS -I$com_err/include"
70                LDFLAGS="$LDFLAGS -L$com_err/lib"
71        fi
72        AC_CHECK_LIB(com_err, com_err, :,
73                     [AC_MSG_ERROR(com_err library not found)])
74else
75        AC_MSG_ERROR(This package requires com_err.)
76fi])
77
78dnl ----- ss -----
79
80AC_DEFUN(ATHENA_UTIL_SS,
81[AC_ARG_WITH(ss,
82        [  --with-ss=PREFIX        Specify location of ss (requires com_err)],
83        [ss="$withval"], [ss=yes])
84if test "$ss" != no; then
85        if test "$ss" != yes; then
86                CPPFLAGS="$CPPFLAGS -I$ss/include"
87                LDFLAGS="$LDFLAGS -L$ss/lib"
88        fi
89        AC_CHECK_LIB(ss, ss_perror, :,
90                     [AC_MSG_ERROR(ss library not found)], -lcom_err)
91else
92        AC_MSG_ERROR(This package requires ss.)
93fi])
94
95dnl ----- Regular expressions -----
96
97AC_DEFUN(ATHENA_REGEXP,
98[AC_ARG_WITH(regex,
99        [  --with-regex=PREFIX     Use installed regex library],
100        [regex="$withval"], [regex=no])
101if test "$regex" != no; then
102        if test "$regex" != yes; then
103                CPPFLAGS="$CPPFLAGS -I$regex/include"
104                LDFLAGS="$LDFLAGS -L$regex/lib"
105        fi
106        AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
107                     [AC_MSG_ERROR(regex library not found)])
108else
109        AC_CHECK_FUNC(regcomp, :,
110                      [AC_MSG_ERROR(can't find POSIX regexp support)])
111fi
112AC_SUBST(REGEX_LIBS)])
113
114dnl ----- Motif -----
115
116AC_DEFUN(ATHENA_MOTIF_CHECK,
117[if test "$motif" != yes; then
118        CPPFLAGS="$CPPFLAGS -I$motif/include"
119        LDFLAGS="$LDFLAGS -L$motif/lib"
120fi
121AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
122
123AC_DEFUN(ATHENA_MOTIF,
124[AC_ARG_WITH(motif,
125        [  --with-motif=PREFIX     Use Motif],
126        [motif="$withval"], [motif=no])
127if test "$motif" != no; then
128        ATHENA_MOTIF_CHECK
129        MOTIF_LIBS=-lXm
130        AC_DEFINE(HAVE_MOTIF)
131fi
132AC_SUBST(MOTIF_LIBS)])
133
134AC_DEFUN(ATHENA_MOTIF_REQUIRED,
135[AC_ARG_WITH(motif,
136        [  --with-motif=PREFIX     Specify location of Motif],
137        [motif="$withval"], [motif=yes])
138if test "$motif" != no; then
139        ATHENA_MOTIF_CHECK
140else
141        AC_MSG_ERROR(This package requires Motif.)
142fi])
143
144dnl ----- AFS -----
145
146AC_DEFUN(ATHENA_AFS_CHECK,
147[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
148AC_CHECK_FUNC(sigvec, :,
149              AC_CHECK_LIB(ucb, sigvec,
150                           LIBS="$LIBS -L/usr/ucblib -R/usr/ucblib -lc -lucb",
151                           :, -L/usr/ucblib))
152AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
153AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
154if test "$afs" != yes; then
155        CPPFLAGS="$CPPFLAGS -I$afs/include"
156        LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
157fi
158AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
159             -lrx -llwp -lsys)
160AFS_DIR=$afs
161AC_SUBST(AFS_DIR)])
162
163dnl Specify desired AFS libraries as a parameter.
164AC_DEFUN(ATHENA_AFS,
165[AC_ARG_WITH(afs,
166        [  --with-afs=PREFIX       Use AFS libraries],
167        [afs="$withval"], [afs=no])
168if test "$afs" != no; then
169        ATHENA_AFS_CHECK
170        AFS_LIBS=$1
171        AC_DEFINE(HAVE_AFS)
172fi
173AC_SUBST(AFS_LIBS)])
174
175AC_DEFUN(ATHENA_AFS_REQUIRED,
176[AC_ARG_WITH(afs,
177        [  --with-afs=PREFIX       Specify location of AFS libraries],
178        [afs="$withval"], [afs=/usr/afsws])
179if test "$afs" != no; then
180        ATHENA_AFS_CHECK
181else
182        AC_MSG_ERROR(This package requires AFS libraries.)
183fi])
184
185dnl ----- Kerberos 4 -----
186
187AC_DEFUN(ATHENA_KRB4_CHECK,
188[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
189AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
190AC_CHECK_LIB(gen, compile)
191if test "$krb4" != yes; then
192        CPPFLAGS="$CPPFLAGS -I$krb4/include"
193        if test -d "$krb4/include/kerberosIV"; then
194                CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
195        fi
196        LDFLAGS="$LDFLAGS -L$krb4/lib"
197elif test -d /usr/include/kerberosIV; then
198        CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
199fi
200AC_CHECK_LIB(krb4, krb_rd_req,
201             [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
202             [AC_CHECK_LIB(krb, krb_rd_req,
203                           [KRB4_LIBS="-lkrb -ldes"],
204                           [AC_MSG_ERROR(Kerberos 4 libraries not found)],
205                           -ldes)],
206             -ldes425 -lkrb5 -lcrypto -lcom_err)])
207
208AC_DEFUN(ATHENA_KRB4,
209[AC_ARG_WITH(krb4,
210        [  --with-krb4=PREFIX      Use Kerberos 4],
211        [krb4="$withval"], [krb4=no])
212if test "$krb4" != no; then
213        ATHENA_KRB4_CHECK
214        AC_DEFINE(HAVE_KRB4)
215fi
216AC_SUBST(KRB4_LIBS)])
217
218AC_DEFUN(ATHENA_KRB4_REQUIRED,
219[AC_ARG_WITH(krb4,
220        [  --with-krb4=PREFIX      Specify location of Kerberos 4],
221        [krb4="$withval"], [krb4=yes])
222if test "$afs" != no; then
223        ATHENA_KRB4_CHECK
224        AC_SUBST(KRB4_LIBS)
225else
226        AC_MSG_ERROR(This package requires Kerberos 4.)
227fi])
228
229dnl ----- Kerberos 5 -----
230
231AC_DEFUN(ATHENA_KRB5_CHECK,
232[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
233AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
234AC_CHECK_LIB(gen, compile)
235if test "$krb5" != yes; then
236        CPPFLAGS="$CPPFLAGS -I$krb5/include"
237        LDFLAGS="$LDFLAGS -L$krb5/lib"
238fi
239AC_CHECK_LIB(krb5, krb5_init_context, :,
240             [AC_MSG_ERROR(Kerberos 5 libraries not found)],
241             -lcrypto -lcom_err)])
242
243AC_DEFUN(ATHENA_KRB5,
244[AC_ARG_WITH(krb5,
245        [  --with-krb5=PREFIX      Use Kerberos 5],
246        [krb5="$withval"], [krb5=no])
247if test "$krb5" != no; then
248        ATHENA_KRB5_CHECK
249        KRB5_LIBS="-lkrb5 -lcrypto -lcom_err"
250        AC_DEFINE(HAVE_KRB5)
251fi
252AC_SUBST(KRB5_LIBS)])
253
254AC_DEFUN(ATHENA_KRB5_REQUIRED,
255[AC_ARG_WITH(krb5,
256        [  --with-krb5=PREFIX      Specify location of Kerberos 5],
257        [krb5="$withval"], [krb5=yes])
258if test "$krb5" != no; then
259        ATHENA_KRB5_CHECK
260else
261        AC_MSG_ERROR(This package requires Kerberos 5.)
262fi])
263
264dnl ----- Hesiod -----
265
266AC_DEFUN(ATHENA_HESIOD_CHECK,
267[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
268if test "$hesiod" != yes; then
269        CPPFLAGS="$CPPFLAGS -I$hesiod/include"
270        LDFLAGS="$LDFLAGS -L$hesiod/lib"
271fi
272AC_CHECK_LIB(hesiod, hes_resolve, :,
273             [AC_MSG_ERROR(Hesiod library not found)])])
274
275AC_DEFUN(ATHENA_HESIOD,
276[AC_ARG_WITH(hesiod,
277        [  --with-hesiod=PREFIX    Use Hesiod],
278        [hesiod="$withval"], [hesiod=no])
279if test "$hesiod" != no; then
280        ATHENA_HESIOD_CHECK
281        HESIOD_LIBS="-lhesiod"
282        AC_DEFINE(HAVE_HESIOD)
283fi
284AC_SUBST(HESIOD_LIBS)])
285
286AC_DEFUN(ATHENA_HESIOD_REQUIRED,
287[AC_ARG_WITH(hesiod,
288        [  --with-hesiod=PREFIX    Specify location of Hesiod],
289        [hesiod="$withval"], [hesiod=yes])
290if test "$hesiod" != no; then
291        ATHENA_HESIOD_CHECK
292else
293        AC_MSG_ERROR(This package requires Hesiod.)
294fi])
Note: See TracBrowser for help on using the repository browser.