aboutsummaryrefslogtreecommitdiff
path: root/ares/aclocal.m4
blob: 96fcd435b4f890324bb3cf3390d453d0ef77ba01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
dnl $Id$

dnl Copyright 1996 by the Massachusetts Institute of Technology.
dnl
dnl Permission to use, copy, modify, and distribute this
dnl software and its documentation for any purpose and without
dnl fee is hereby granted, provided that the above copyright
dnl notice appear in all copies and that both that copyright
dnl notice and this permission notice appear in supporting
dnl documentation, and that the name of M.I.T. not be used in
dnl advertising or publicity pertaining to distribution of the
dnl software without specific, written prior permission.
dnl M.I.T. makes no representations about the suitability of
dnl this software for any purpose.  It is provided "as is"
dnl without express or implied warranty.

dnl This file provides local macros for packages which use specific
dnl external libraries.  The public macros are:
dnl
dnl	ATHENA_UTIL_COM_ERR
dnl		Generates error if com_err not found.
dnl	ATHENA_UTIL_SS
dnl		Generates error if ss not found.
dnl	ATHENA_REGEXP
dnl		Sets REGEX_LIBS if rx library used; ensures POSIX
dnl		regexp support.
dnl	ATHENA_MOTIF
dnl		Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
dnl	ATHENA_MOTIF_REQUIRED
dnl		Generates error if Motif not found.
dnl	ATHENA_AFS
dnl		Sets AFS_LIBS and defines HAVE_AFS if AFS used.  Pass
dnl		in an argument giving the desired AFS libraries;
dnl		AFS_LIBS will be set to that value if AFS is found.
dnl		AFS_DIR will be set to the prefix given.
dnl	ATHENA_AFS_REQUIRED
dnl		Generates error if AFS libraries not found.  AFS_DIR
dnl		will be set to the prefix given.
dnl	ATHENA_KRB4
dnl		Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
dnl	ATHENA_KRB4_REQUIRED
dnl		Generates error if krb4 not found.  Sets KRB4_LIBS
dnl		otherwise.  (Special behavior because krb4 libraries
dnl		may be different if using krb4 compatibility libraries
dnl		from krb5.)
dnl	ATHENA_KRB5
dnl		Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
dnl	ATHENA_KRB5_REQUIRED
dnl		Generates error if krb5 not found.
dnl	ATHENA_HESIOD
dnl		Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
dnl		used.
dnl	ATHENA_HESIOD_REQUIRED
dnl		Generates error if Hesiod not found.
dnl	ATHENA_ARES
dnl		Sets ARES_LIBS and defines HAVE_ARES if libares
dnl		used.
dnl	ATHENA_ARES_REQUIRED
dnl		Generates error if libares not found.
dnl	ATHENA_ZEPHYR
dnl		Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
dnl		used.
dnl	ATHENA_ZEPHYR_REQUIRED
dnl		Generates error if zephyr not found.
dnl
dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
dnl is a com_err library in the AFS libraries which requires -lutil.

dnl ----- com_err -----

AC_DEFUN(ATHENA_UTIL_COM_ERR,
[AC_ARG_WITH(com_err,
	[  --with-com_err=PREFIX   Specify location of com_err],
	[com_err="$withval"], [com_err=yes])
if test "$com_err" != no; then
	if test "$com_err" != yes; then
		CPPFLAGS="$CPPFLAGS -I$com_err/include"
		LDFLAGS="$LDFLAGS -L$com_err/lib"
	fi
	AC_CHECK_LIB(com_err, com_err, :,
		     [AC_MSG_ERROR(com_err library not found)])
else
	AC_MSG_ERROR(This package requires com_err.)
fi])

dnl ----- ss -----

AC_DEFUN(ATHENA_UTIL_SS,
[AC_ARG_WITH(ss,
	[  --with-ss=PREFIX        Specify location of ss (requires com_err)],
	[ss="$withval"], [ss=yes])
if test "$ss" != no; then
	if test "$ss" != yes; then
		CPPFLAGS="$CPPFLAGS -I$ss/include"
		LDFLAGS="$LDFLAGS -L$ss/lib"
	fi
	AC_CHECK_LIB(ss, ss_perror, :,
		     [AC_MSG_ERROR(ss library not found)], -lcom_err)
else
	AC_MSG_ERROR(This package requires ss.)
fi])

dnl ----- Regular expressions -----

AC_DEFUN(ATHENA_REGEXP,
[AC_ARG_WITH(regex,
	[  --with-regex=PREFIX     Use installed regex library],
	[regex="$withval"], [regex=no])
if test "$regex" != no; then
	if test "$regex" != yes; then
		CPPFLAGS="$CPPFLAGS -I$regex/include"
		LDFLAGS="$LDFLAGS -L$regex/lib"
	fi
	AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
		     [AC_MSG_ERROR(regex library not found)])
else
	AC_CHECK_FUNC(regcomp, :,
		      [AC_MSG_ERROR(can't find POSIX regexp support)])
fi
AC_SUBST(REGEX_LIBS)])

dnl ----- Motif -----

AC_DEFUN(ATHENA_MOTIF_CHECK,
[if test "$motif" != yes; then
	CPPFLAGS="$CPPFLAGS -I$motif/include"
	LDFLAGS="$LDFLAGS -L$motif/lib"
fi
AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])

AC_DEFUN(ATHENA_MOTIF,
[AC_ARG_WITH(motif,
	[  --with-motif=PREFIX     Use Motif],
	[motif="$withval"], [motif=no])
if test "$motif" != no; then
	ATHENA_MOTIF_CHECK
	MOTIF_LIBS=-lXm
	AC_DEFINE(HAVE_MOTIF)
fi
AC_SUBST(MOTIF_LIBS)])

AC_DEFUN(ATHENA_MOTIF_REQUIRED,
[AC_ARG_WITH(motif,
	[  --with-motif=PREFIX     Specify location of Motif],
	[motif="$withval"], [motif=yes])
if test "$motif" != no; then
	ATHENA_MOTIF_CHECK
else
	AC_MSG_ERROR(This package requires Motif.)
fi])

dnl ----- AFS -----

AC_DEFUN(ATHENA_AFS_CHECK,
[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
if test "$afs" != yes; then
	CPPFLAGS="$CPPFLAGS -I$afs/include"
	LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
fi
AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
	     -lrx -llwp -lsys)
AFS_DIR=$afs
AC_SUBST(AFS_DIR)])

dnl Specify desired AFS libraries as a parameter.
AC_DEFUN(ATHENA_AFS,
[AC_ARG_WITH(afs,
	[  --with-afs=PREFIX       Use AFS libraries],
	[afs="$withval"], [afs=no])
if test "$afs" != no; then
	ATHENA_AFS_CHECK
	AFS_LIBS=$1
	AC_DEFINE(HAVE_AFS)
fi
AC_SUBST(AFS_LIBS)])

AC_DEFUN(ATHENA_AFS_REQUIRED,
[AC_ARG_WITH(afs,
	[  --with-afs=PREFIX       Specify location of AFS libraries],
	[afs="$withval"], [afs=/usr/afsws])
if test "$afs" != no; then
	ATHENA_AFS_CHECK
else
	AC_MSG_ERROR(This package requires AFS libraries.)
fi])

dnl ----- Kerberos 4 -----

AC_DEFUN(ATHENA_KRB4_CHECK,
[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
AC_CHECK_LIB(gen, compile)
if test "$krb4" != yes; then
	CPPFLAGS="$CPPFLAGS -I$krb4/include"
	if test -d "$krb4/include/kerberosIV"; then
		CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
	fi
	LDFLAGS="$LDFLAGS -L$krb4/lib"
fi
AC_CHECK_LIB(krb4, krb_rd_req,
	     [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
	     [AC_CHECK_LIB(krb, krb_rd_req,
			   [KRB4_LIBS="-lkrb -ldes"],
			   [AC_MSG_ERROR(Kerberos 4 libraries not found)],
			   -ldes)],
	     -ldes425 -lkrb5 -lk5crypto -lcom_err)])

AC_DEFUN(ATHENA_KRB4,
[AC_ARG_WITH(krb4,
	[  --with-krb4=PREFIX      Use Kerberos 4],
	[krb4="$withval"], [krb4=no])
if test "$krb4" != no; then
	ATHENA_KRB4_CHECK
	AC_DEFINE(HAVE_KRB4)
fi
AC_SUBST(KRB4_LIBS)])

AC_DEFUN(ATHENA_KRB4_REQUIRED,
[AC_ARG_WITH(krb4,
	[  --with-krb4=PREFIX      Specify location of Kerberos 4],
	[krb4="$withval"], [krb4=yes])
if test "$krb4" != no; then
	ATHENA_KRB4_CHECK
	AC_SUBST(KRB4_LIBS)
else
	AC_MSG_ERROR(This package requires Kerberos 4.)
fi])

dnl ----- Kerberos 5 -----

AC_DEFUN(ATHENA_KRB5_CHECK,
[AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
AC_CHECK_LIB(gen, compile)
if test "$krb5" != yes; then
	CPPFLAGS="$CPPFLAGS -I$krb5/include"
	LDFLAGS="$LDFLAGS -L$krb5/lib"
fi
AC_CHECK_LIB(krb5, krb5_init_context, :,
	     [AC_MSG_ERROR(Kerberos 5 libraries not found)],
	     -lk5crypto -lcom_err)])

AC_DEFUN(ATHENA_KRB5,
[AC_ARG_WITH(krb5,
	[  --with-krb5=PREFIX      Use Kerberos 5],
	[krb5="$withval"], [krb5=no])
if test "$krb5" != no; then
	ATHENA_KRB5_CHECK
	KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
	AC_DEFINE(HAVE_KRB5)
fi
AC_SUBST(KRB5_LIBS)])

AC_DEFUN(ATHENA_KRB5_REQUIRED,
[AC_ARG_WITH(krb5,
	[  --with-krb5=PREFIX      Specify location of Kerberos 5],
	[krb5="$withval"], [krb5=yes])
if test "$krb5" != no; then
	ATHENA_KRB5_CHECK
else
	AC_MSG_ERROR(This package requires Kerberos 5.)
fi])

dnl ----- Hesiod -----

AC_DEFUN(ATHENA_HESIOD_CHECK,
[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
if test "$hesiod" != yes; then
	CPPFLAGS="$CPPFLAGS -I$hesiod/include"
	LDFLAGS="$LDFLAGS -L$hesiod/lib"
fi
AC_CHECK_LIB(hesiod, hes_resolve, :,
	     [AC_MSG_ERROR(Hesiod library not found)])])

AC_DEFUN(ATHENA_HESIOD,
[AC_ARG_WITH(hesiod,
	[  --with-hesiod=PREFIX    Use Hesiod],
	[hesiod="$withval"], [hesiod=no])
if test "$hesiod" != no; then
	ATHENA_HESIOD_CHECK
	HESIOD_LIBS="-lhesiod"
	AC_DEFINE(HAVE_HESIOD)
fi
AC_SUBST(HESIOD_LIBS)])

AC_DEFUN(ATHENA_HESIOD_REQUIRED,
[AC_ARG_WITH(hesiod,
	[  --with-hesiod=PREFIX    Specify location of Hesiod],
	[hesiod="$withval"], [hesiod=yes])
if test "$hesiod" != no; then
	ATHENA_HESIOD_CHECK
else
	AC_MSG_ERROR(This package requires Hesiod.)
fi])

dnl ----- libares -----

AC_DEFUN(ATHENA_ARES_CHECK,
[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
if test "$ares" != yes; then
	CPPFLAGS="$CPPFLAGS -I$ares/include"
	LDFLAGS="$LDFLAGS -L$ares/lib"
fi
AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])

AC_DEFUN(ATHENA_ARES,
[AC_ARG_WITH(ares,
	[  --with-ares=PREFIX      Use libares],
	[ares="$withval"], [ares=no])
if test "$ares" != no; then
	ATHENA_ARES_CHECK
	ARES_LIBS="-lares"
	AC_DEFINE(HAVE_ARES)
fi
AC_SUBST(ARES_LIBS)])

AC_DEFUN(ATHENA_ARES_REQUIRED,
[AC_ARG_WITH(ares,
	[  --with-ares=PREFIX      Specify location of libares],
	[ares="$withval"], [ares=yes])
if test "$ares" != no; then
	ATHENA_ARES_CHECK
else
	AC_MSG_ERROR(This package requires libares.)
fi])
dnl ----- zephyr -----

AC_DEFUN(ATHENA_ZEPHYR_CHECK,
[if test "$zephyr" != yes; then
	CPPFLAGS="$CPPFLAGS -I$zephyr/include"
	LDFLAGS="$LDFLAGS -L$zephyr/lib"
fi
AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])

AC_DEFUN(ATHENA_ZEPHYR,
[AC_ARG_WITH(zephyr,
	[  --with-zephyr=PREFIX      Use zephyr],
	[zephyr="$withval"], [zephyr=no])
if test "$zephyr" != no; then
	ATHENA_ZEPHYR_CHECK
	ZEPHYR_LIBS="-lzephyr"
	AC_DEFINE(HAVE_ZEPHYR)
fi
AC_SUBST(ZEPHYR_LIBS)])

AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
[AC_ARG_WITH(zephyr,
	[  --with-zephyr=PREFIX      Specify location of zephyr],
	[zephyr="$withval"], [zephyr=yes])
if test "$zephyr" != no; then
	ATHENA_ZEPHYR_CHECK
else
	AC_MSG_ERROR(This package requires zephyr.)
fi])