1 # Determine whether this platform supports GSSAPI.
3 # Copyright (c) 2001, 2002, 2003
4 # Derek R. Price, Ximbiot <http://ximbiot.com>,
5 # and the Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 # Determine whether this platform supports GSSAPI.
25 AC_DEFUN([ACX_WITH_GSSAPI],[
27 # Use --with-gssapi[=DIR] to enable GSSAPI support.
29 # defaults to enabled with DIR in default list below
31 # Search for /SUNHEA/ and read the comments about this default below.
37 [GSSAPI directory (default autoselects)]), ,
41 dnl FIXME - cache withval and obliterate later cache values when options change
44 # Try to locate a GSSAPI installation if no location was specified, assuming
45 # GSSAPI was enabled (the default).
47 if test -n "$acx_gssapi_cv_gssapi"; then
48 # Granted, this is a slightly ugly way to print this info, but the
49 # AC_CHECK_HEADER used in the search for a GSSAPI installation makes using
50 # AC_CACHE_CHECK worse
51 AC_MSG_CHECKING([for GSSAPI])
53 AC_CACHE_VAL([acx_gssapi_cv_gssapi], [
54 if test x$with_gssapi = xyes; then
55 # --with but no location specified
56 # assume a gssapi.h or gssapi/gssapi.h locates our install.
58 # This isn't always strictly true. For instance Solaris 7's SUNHEA (header)
59 # package installs gssapi.h whether or not the necessary libraries are
60 # installed. I'm still not sure whether to consider this a bug. The long
61 # way around is to not consider GSSPAI installed unless gss_import_name is
62 # found, but that brings up a lot of other hassles, like continuing to let
63 # gcc & ld generate the error messages when the user uses --with-gssapi=dir
64 # as a debugging aid. The short way around is to disable GSSAPI by default,
65 # but I think Sun users have been faced with this for awhile and I haven't
66 # heard many complaints.
67 acx_gssapi_save_CPPFLAGS=$CPPFLAGS
68 for acx_gssapi_cv_gssapi in yes /usr/kerberos /usr/cygnus/kerbnet no; do
69 if test x$acx_gssapi_cv_gssapi = xno; then
72 if test x$acx_gssapi_cv_gssapi = xyes; then
73 AC_MSG_CHECKING([for GSSAPI])
76 CPPFLAGS="$acx_gssapi_save_CPPFLAGS -I$acx_gssapi_cv_gssapi/include"
77 AC_MSG_CHECKING([for GSSAPI in $acx_gssapi_cv_gssapi])
80 unset ac_cv_header_gssapi_h
81 unset ac_cv_header_gssapi_gssapi_h
82 unset ac_cv_header_krb5_h
83 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h krb5.h])
84 if (test "$ac_cv_header_gssapi_h" = yes ||
85 test "$ac_cv_header_gssapi_gssapi_h" = yes) &&
86 test "$ac_cv_header_krb5_h" = yes; then
90 CPPFLAGS=$acx_gssapi_save_CPPFLAGS
92 acx_gssapi_cv_gssapi=$with_gssapi
94 AC_MSG_CHECKING([for GSSAPI])
96 AC_MSG_RESULT([$acx_gssapi_cv_gssapi])
99 # Set up GSSAPI includes for later use. We don't bother to check for
100 # $acx_gssapi_cv_gssapi=no here since that will be caught later.
102 if test x$acx_gssapi_cv_gssapi = xyes; then
103 # no special includes necessary
106 # GSSAPI at $acx_gssapi_cv_gssapi (could be 'no')
107 GSSAPI_INCLUDES=" -I$acx_gssapi_cv_gssapi/include"
111 # Get the rest of the information CVS needs to compile with GSSAPI support
113 if test x$acx_gssapi_cv_gssapi != xno; then
114 # define HAVE_GSSAPI and set up the includes
115 AC_DEFINE([HAVE_GSSAPI], ,
116 [Define if you have GSSAPI with Kerberos version 5 available.])
117 CPPFLAGS=$CPPFLAGS$GSSAPI_INCLUDES
119 cvs_client_objects="$cvs_client_objects gssapi-client.o"
121 # locate any other headers
122 dnl We don't use HAVE_KRB5_H anywhere, but including it here might make it
123 dnl easier to spot errors by reading configure output
124 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h krb5.h])
125 # And look through them for GSS_C_NT_HOSTBASED_SERVICE or its alternatives
127 [for GSS_C_NT_HOSTBASED_SERVICE],
128 [acx_gssapi_cv_gss_c_nt_hostbased_service],
130 acx_gssapi_cv_gss_c_nt_hostbased_service=no
131 if test "$ac_cv_header_gssapi_h" = "yes"; then
133 [GSS_C_NT_HOSTBASED_SERVICE], [gssapi.h],
134 [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
137 [gss_nt_service_name], [gssapi.h],
138 [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
141 if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
142 test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
144 [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi.h],
145 [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
147 AC_EGREP_HEADER([gss_nt_service_name], [gssapi/gssapi.h],
148 [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
151 if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
152 test "$ac_cv_header_gssapi_gssapi_generic_h" = "yes"; then
154 [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi_generic.h],
155 [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
158 [gss_nt_service_name], [gssapi/gssapi_generic.h],
159 [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
163 if test $acx_gssapi_cv_gss_c_nt_hostbased_service != yes &&
164 test $acx_gssapi_cv_gss_c_nt_hostbased_service != no; then
165 # don't define for yes since that means it already means something and
166 # don't define for no since we'd rather the compiler catch the error
167 # It's debatable whether we'd prefer that the compiler catch the error
168 # - it seems our estranged developer is more likely to be familiar with
169 # the intricacies of the compiler than with those of autoconf, but by
170 # the same token, maybe we'd rather alert them to the fact that most
171 # of the support they need to fix the problem is installed if they can
172 # simply locate the appropriate symbol.
174 [GSS_C_NT_HOSTBASED_SERVICE],
175 [$acx_gssapi_cv_gss_c_nt_hostbased_service],
176 [Define to an alternative value if GSS_C_NT_HOSTBASED_SERVICE isn't defined
177 in the gssapi.h header file. MIT Kerberos 1.2.1 requires this. Only relevant
181 # Expect the libs to be installed parallel to the headers
183 # We could try once with and once without, but I'm not sure it's worth the
185 if test x$acx_gssapi_cv_gssapi != xyes; then
186 if test -z "$LIBS"; then
187 LIBS="-L$acx_gssapi_cv_gssapi/lib"
189 LIBS="-L$acx_gssapi_cv_gssapi/lib $LIBS"
193 dnl What happens if we want to enable, say, krb5 and some other GSSAPI
194 dnl authentication method at the same time?
196 # Some of the order below is particular due to library dependencies
200 # des Heimdal K 0.3d, but Heimdal seems to be set up such
201 # that it could have been installed from elsewhere.
203 AC_SEARCH_LIBS([des_set_odd_parity], [des])
206 # com_err Heimdal K 0.3d
208 # com_err MIT K5 v1.2.2-beta1
210 AC_SEARCH_LIBS([com_err], [com_err])
213 # asn1 Heimdal K 0.3d -lcom_err
215 AC_SEARCH_LIBS([initialize_asn1_error_table_r], [asn1])
218 # resolv required, but not installed by Heimdal K 0.3d
220 # resolv MIT K5 1.2.2-beta1
223 AC_SEARCH_LIBS([__dn_expand], [resolv])
226 # crypto Need by gssapi under FreeBSD 5.4
228 AC_SEARCH_LIBS([RC4], [crypto])
231 # crypt Needed by roken under FreeBSD 4.6.
233 AC_SEARCH_LIBS([crypt], [crypt])
236 # roken Heimdal K 0.3d -lresolv
237 # roken FreeBSD 4.6 -lcrypt
239 AC_SEARCH_LIBS([roken_gethostbyaddr], [roken])
242 # k5crypto MIT K5 v1.2.2-beta1
244 AC_SEARCH_LIBS([valid_enctype], [k5crypto])
247 # gen ? ? ? Needed on Irix 5.3 with some
248 # Irix 5.3 version of Kerberos. I'm not
249 # sure which since Irix didn't
250 # get any testing this time
251 # around. Original comment:
253 # This is necessary on Irix 5.3, in order to link against libkrb5 --
254 # there, an_to_ln.o refers to things defined only in -lgen.
256 AC_SEARCH_LIBS([compile], [gen])
259 # krb5 ? ? ? -lgen -l???
264 # krb5 MIT K5 v1.2.2-beta1 -lcrypto -lcom_err
267 # krb5 MIT K5 v1.2.2-beta1 -lcrypto -lcom_err -lresolv
269 # krb5 Heimdal K 0.3d -lasn1 -lroken -ldes
271 AC_SEARCH_LIBS([krb5_free_context], [krb5])
274 # gssapi_krb5 Only lib needed with MIT K5 v1.2.1, so find it first in
275 # order to prefer MIT Kerberos. If both MIT & Heimdal
276 # Kerberos are installed and in the path, this will leave
277 # some of the libraries above in LIBS unnecessarily, but
278 # noone would ever do that, right?
280 # gssapi_krb5 MIT K5 v1.2.2-beta1 -lkrb5
282 # gssapi Heimdal K 0.3d -lkrb5
284 AC_SEARCH_LIBS([gss_import_name], [gssapi_krb5 gssapi])