]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/cvs/acinclude.m4
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / cvs / acinclude.m4
1 /* This program is free software; you can redistribute it and/or modify
2    it under the terms of the GNU General Public License as published by
3    the Free Software Foundation; either version 2, or (at your option)
4    any later version.
5
6    This program is distributed in the hope that it will be useful,
7    but WITHOUT ANY WARRANTY; without even the implied warranty of
8    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9    GNU General Public License for more details.  */
10
11 AC_DEFUN([ACX_WITH_GSSAPI],[
12 #
13 # Use --with-gssapi[=DIR] to enable GSSAPI support.
14 #
15 # defaults to enabled with DIR in default list below
16 #
17 # Search for /SUNHEA/ and read the comments about this default below.
18 #
19 AC_ARG_WITH(
20   [gssapi],
21   AC_HELP_STRING(
22     [--with-gssapi],
23     [GSSAPI directory (default autoselects)]), ,
24   [with_gssapi=yes])dnl
25
26 dnl
27 dnl FIXME - cache withval and obliterate later cache values when options change
28 dnl
29 #
30 # Try to locate a GSSAPI installation if no location was specified, assuming
31 # GSSAPI was enabled (the default).
32
33 if test -n "$acx_gssapi_cv_gssapi"; then
34   # Granted, this is a slightly ugly way to print this info, but the
35   # AC_CHECK_HEADER used in the search for a GSSAPI installation makes using
36   # AC_CACHE_CHECK worse
37   AC_MSG_CHECKING([for GSSAPI])
38 else :; fi
39 AC_CACHE_VAL([acx_gssapi_cv_gssapi], [
40 if test x$with_gssapi = xyes; then
41   # --with but no location specified
42   # assume a gssapi.h or gssapi/gssapi.h locates our install.
43   #
44   # This isn't always strictly true.  For instance Solaris 7's SUNHEA (header)
45   # package installs gssapi.h whether or not the necessary libraries are
46   # installed.  I'm still not sure whether to consider this a bug.  The long
47   # way around is to not consider GSSPAI installed unless gss_import_name is
48   # found, but that brings up a lot of other hassles, like continuing to let
49   # gcc & ld generate the error messages when the user uses --with-gssapi=dir
50   # as a debugging aid.  The short way around is to disable GSSAPI by default,
51   # but I think Sun users have been faced with this for awhile and I haven't
52   # heard many complaints.
53   acx_gssapi_save_CPPFLAGS=$CPPFLAGS
54   for acx_gssapi_cv_gssapi in yes /usr/kerberos /usr/cygnus/kerbnet no; do
55     if test x$acx_gssapi_cv_gssapi = xno; then
56       break
57     fi
58     if test x$acx_gssapi_cv_gssapi = xyes; then
59       AC_MSG_CHECKING([for GSSAPI])
60       AC_MSG_RESULT([])
61     else
62       CPPFLAGS="$acx_gssapi_save_CPPFLAGS -I$acx_gssapi_cv_gssapi/include"
63       AC_MSG_CHECKING([for GSSAPI in $acx_gssapi_cv_gssapi])
64       AC_MSG_RESULT([])
65     fi
66     unset ac_cv_header_gssapi_h
67     unset ac_cv_header_gssapi_gssapi_h
68     unset ac_cv_header_krb5_h
69     AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h krb5.h])
70     if (test "$ac_cv_header_gssapi_h" = yes ||
71           test "$ac_cv_header_gssapi_gssapi_h" = yes) &&
72         test "$ac_cv_header_krb5_h" = yes; then
73       break
74     fi
75   done
76   CPPFLAGS=$acx_gssapi_save_CPPFLAGS
77 else
78   acx_gssapi_cv_gssapi=$with_gssapi
79 fi
80 AC_MSG_CHECKING([for GSSAPI])
81 ])dnl
82 AC_MSG_RESULT([$acx_gssapi_cv_gssapi])
83
84 #
85 # Set up GSSAPI includes for later use.  We don't bother to check for
86 # $acx_gssapi_cv_gssapi=no here since that will be caught later.
87 #
88 if test x$acx_gssapi_cv_gssapi = xyes; then
89   # no special includes necessary
90   GSSAPI_INCLUDES=""
91 else
92   # GSSAPI at $acx_gssapi_cv_gssapi (could be 'no')
93   GSSAPI_INCLUDES=" -I$acx_gssapi_cv_gssapi/include"
94 fi
95
96 #
97 # Get the rest of the information CVS needs to compile with GSSAPI support
98 #
99 if test x$acx_gssapi_cv_gssapi != xno; then
100   # define HAVE_GSSAPI and set up the includes
101   AC_DEFINE([HAVE_GSSAPI], ,
102 [Define if you have GSSAPI with Kerberos version 5 available.])
103   includeopt=$includeopt$GSSAPI_INCLUDES
104
105   # locate any other headers
106   acx_gssapi_save_CPPFLAGS=$CPPFLAGS
107   CPPFLAGS=$CPPFLAGS$GSSAPI_INCLUDES
108   dnl We don't use HAVE_KRB5_H anywhere, but including it here might make it
109   dnl easier to spot errors by reading configure output
110   AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h krb5.h])
111   # And look through them for GSS_C_NT_HOSTBASED_SERVICE or its alternatives
112   AC_CACHE_CHECK(
113     [for GSS_C_NT_HOSTBASED_SERVICE],
114     [acx_gssapi_cv_gss_c_nt_hostbased_service],
115   [
116     acx_gssapi_cv_gss_c_nt_hostbased_service=no
117     if test "$ac_cv_header_gssapi_h" = "yes"; then
118       AC_EGREP_HEADER(
119         [GSS_C_NT_HOSTBASED_SERVICE], [gssapi.h],
120         [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
121       [
122         AC_EGREP_HEADER(
123           [gss_nt_service_name], [gssapi.h],
124           [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
125       ])
126     fi
127     if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
128        test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
129       AC_EGREP_HEADER(
130         [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi.h],
131         [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
132       [
133         AC_EGREP_HEADER([gss_nt_service_name], [gssapi/gssapi.h],
134           [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
135       ])
136     else :; fi
137     if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
138        test "$ac_cv_header_gssapi_gssapi_generic_h" = "yes"; then
139       AC_EGREP_HEADER(
140         [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi_generic.h],
141         [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
142       [
143         AC_EGREP_HEADER(
144           [gss_nt_service_name], [gssapi/gssapi_generic.h],
145           [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
146       ])
147     else :; fi
148   ])
149   if test $acx_gssapi_cv_gss_c_nt_hostbased_service != yes &&
150      test $acx_gssapi_cv_gss_c_nt_hostbased_service != no; then
151     # don't define for yes since that means it already means something and
152     # don't define for no since we'd rather the compiler catch the error
153     # It's debatable whether we'd prefer that the compiler catch the error
154     #  - it seems our estranged developer is more likely to be familiar with
155     #    the intricacies of the compiler than with those of autoconf, but by
156     #    the same token, maybe we'd rather alert them to the fact that most
157     #    of the support they need to fix the problem is installed if they can
158     #    simply locate the appropriate symbol.
159     AC_DEFINE_UNQUOTED(
160       [GSS_C_NT_HOSTBASED_SERVICE],
161       [$acx_gssapi_cv_gss_c_nt_hostbased_service],
162 [Define to an alternative value if GSS_C_NT_HOSTBASED_SERVICE isn't defined
163 in the gssapi.h header file.  MIT Kerberos 1.2.1 requires this.  Only relevant
164 when using GSSAPI.])
165   else :; fi
166
167   CPPFLAGS=$acx_gssapi_save_CPPFLAGS
168
169   # Expect the libs to be installed parallel to the headers
170   #
171   # We could try once with and once without, but I'm not sure it's worth the
172   # trouble.
173   if test x$acx_gssapi_cv_gssapi != xyes; then
174     if test -z "$LIBS"; then
175       LIBS="-L$acx_gssapi_cv_gssapi/lib"
176     else
177       LIBS="-L$acx_gssapi_cv_gssapi/lib $LIBS"
178     fi
179   else :; fi
180
181   dnl What happens if we want to enable, say, krb5 and some other GSSAPI
182   dnl authentication method at the same time?
183   #
184   # Some of the order below is particular due to library dependencies
185   #
186
187   #
188   # des                 Heimdal K 0.3d, but Heimdal seems to be set up such
189   #                     that it could have been installed from elsewhere.
190   #
191   AC_SEARCH_LIBS([des_set_odd_parity], [des])
192
193   #
194   # com_err             Heimdal K 0.3d
195   #
196   # com_err             MIT K5 v1.2.2-beta1
197   #
198   AC_SEARCH_LIBS([com_err], [com_err])
199
200   #
201   # asn1                Heimdal K 0.3d          -lcom_err
202   #
203   AC_SEARCH_LIBS([initialize_asn1_error_table_r], [asn1])
204
205   #
206   # resolv              required, but not installed by Heimdal K 0.3d
207   #
208   # resolv              MIT K5 1.2.2-beta1
209   #                     Linux 2.2.17
210   #
211   AC_SEARCH_LIBS([__dn_expand], [resolv])
212
213   #
214   # crypto             Need by gssapi under FreeBSD 5.4
215   #
216   AC_SEARCH_LIBS([RC4], [crypto])
217
218   #
219   # crypt              Needed by roken under FreeBSD 4.6.
220   #
221   AC_SEARCH_LIBS([crypt], [crypt])
222
223   #
224   # roken               Heimdal K 0.3d          -lresolv
225   # roken               FreeBSD 4.6             -lcrypt
226   #
227   AC_SEARCH_LIBS([roken_gethostbyaddr], [roken])
228
229   #
230   # k5crypto            MIT K5 v1.2.2-beta1
231   #
232   AC_SEARCH_LIBS([valid_enctype], [k5crypto])
233
234   #
235   # gen                 ? ? ?                   Needed on Irix 5.3 with some
236   #                     Irix 5.3                version of Kerberos.  I'm not
237   #                                             sure which since Irix didn't
238   #                                             get any testing this time
239   #                                             around.  Original comment:
240   #
241   # This is necessary on Irix 5.3, in order to link against libkrb5 --
242   # there, an_to_ln.o refers to things defined only in -lgen.
243   #
244   AC_SEARCH_LIBS([compile], [gen])
245
246   #
247   # krb5                ? ? ?                   -lgen -l???
248   #                     Irix 5.3
249   #
250   # krb5                MIT K5 v1.1.1
251   #
252   # krb5                MIT K5 v1.2.2-beta1     -lcrypto -lcom_err
253   #                     Linux 2.2.17
254   #
255   # krb5                MIT K5 v1.2.2-beta1     -lcrypto -lcom_err -lresolv
256   #
257   # krb5                Heimdal K 0.3d          -lasn1 -lroken -ldes
258   #
259   AC_SEARCH_LIBS([krb5_free_context], [krb5])
260
261   #
262   # gss                 This may be the only lib needed under HP-UX, so find it
263   #                     first.
264   #
265   # gssapi_krb5         Only lib needed with MIT K5 v1.2.1, so find it first in
266   #                     order to prefer MIT Kerberos.  If both MIT & Heimdal
267   #                     Kerberos are installed and in the path, this will leave
268   #                     some of the libraries above in LIBS unnecessarily, but
269   #                     noone would ever do that, right?
270   #
271   # gss                 HP-UX                   ???
272   #
273   # gssapi_krb5         MIT K5 v1.2.2-beta1     -lkrb5
274   #
275   # gssapi              Heimdal K 0.3d          -lkrb5
276   #
277   AC_SEARCH_LIBS([gss_import_name], [gss gssapi_krb5 gssapi])
278 fi
279 ])dnl
280
281
282
283 # size_max.m4 serial 2
284 dnl Copyright (C) 2003 Free Software Foundation, Inc.
285 dnl This file is free software, distributed under the terms of the GNU
286 dnl General Public License.  As a special exception to the GNU General
287 dnl Public License, this file may be distributed as part of a program
288 dnl that contains a configuration script generated by Autoconf, under
289 dnl the same distribution terms as the rest of that program.
290
291 dnl From Bruno Haible.
292
293 AC_DEFUN([gl_SIZE_MAX],
294 [
295   AC_CHECK_HEADERS(stdint.h)
296   dnl First test whether the system already has SIZE_MAX.
297   AC_MSG_CHECKING([for SIZE_MAX])
298   result=
299   AC_EGREP_CPP([Found it], [
300 #include <limits.h>
301 #if HAVE_STDINT_H
302 #include <stdint.h>
303 #endif
304 #ifdef SIZE_MAX
305 Found it
306 #endif
307 ], result=yes)
308   if test -z "$result"; then
309     dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
310     dnl than the type 'unsigned long'.
311     dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
312     dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
313     _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
314       [#include <stddef.h>], result=?)
315     _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
316       [#include <stddef.h>], result=?)
317     _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
318       [#include <stddef.h>], result=?)
319     if test "$fits_in_uint" = 1; then
320       dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
321       dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
322       AC_TRY_COMPILE([#include <stddef.h>
323         extern size_t foo;
324         extern unsigned long foo;
325         ], [], fits_in_uint=0)
326     fi
327     if test -z "$result"; then
328       if test "$fits_in_uint" = 1; then
329         result="$res_hi$res_lo"U
330       else
331         result="$res_hi$res_lo"UL
332       fi
333     else
334       dnl Shouldn't happen, but who knows...
335       result='~(size_t)0'
336     fi
337   fi
338   AC_MSG_RESULT([$result])
339   if test "$result" != yes; then
340     AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
341       [Define as the maximum value of type 'size_t', if the system doesn't define it.])
342   fi
343 ])
344
345
346
347 # xsize.m4 serial 3
348 dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
349 dnl This file is free software, distributed under the terms of the GNU
350 dnl General Public License.  As a special exception to the GNU General
351 dnl Public License, this file may be distributed as part of a program
352 dnl that contains a configuration script generated by Autoconf, under
353 dnl the same distribution terms as the rest of that program.
354
355 AC_DEFUN([gl_XSIZE],
356 [
357   dnl Prerequisites of lib/xsize.h.
358   AC_REQUIRE([gl_SIZE_MAX])
359   AC_REQUIRE([AC_C_INLINE])
360   AC_CHECK_HEADERS(stdint.h)
361 ])