summaryrefslogtreecommitdiff
path: root/aclocal.m4
blob: 04a84004bbf07fa3f3373dc0d325062241b121a7 (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
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_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	ATHENA_AFS_REQUIRED
dnl		Generates error if AFS libraries not found.
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
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 -I$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 -I$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 ----- 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(sigvec, :, AC_CHECK_LIB(ucb, sigvec))
AC_CHECK_FUNC(gethostname, :, 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)])

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,
[ocppflags="$CPPFLAGS"
if test "$krb4" != yes; then
	CPPFLAGS="$CPPFLAGS -I$krb4/include"
	LDFLAGS="$LDFLAGS -L$krb4/lib"
fi
AC_CHECK_LIB(krb, krb_rd_req, [KRB4_LIBS="-lkrb -ldes"],
	[if test "$krb4" != yes; then
		CPPFLAGS="$ocppflags -I$krb4/include/kerberosIV"
	else
		CPPFLAGS="$ocppflags -I/usr/include/kerberosIV"
	fi
	AC_CHECK_LIB(krb4, krb_rd_req,
		     [KRB4_LIBS="-lkrb4 -lkrb5 -ldes425 -lcrypto -lcom_err"],
		     [AC_MSG_ERROR(Kerberos 4 libraries not found)],
		     -ldes425 -lcom_err)], -ldes)])

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 "$afs" != 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,
[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)],
	     -lcrypto -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 -lcrypto -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])