1 ## Copyright (C) 1996-2014 The Squid Software Foundation and contributors
3 ## Squid software is distributed under GPLv2+ license and includes
4 ## contributions from numerous individuals and organizations.
5 ## Please see the COPYING and CONTRIBUTORS files for details.
8 dnl these checks must be performed in the same order as here defined,
9 dnl and have mostly been lifted out of an inlined configure.ac.
11 dnl checks for a broken solaris header file, and sets squid_cv_broken_krb5_h
12 dnl to yes if that's the case
13 AC_DEFUN([SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H], [
14 AC_CACHE_CHECK([for broken Solaris krb5.h],squid_cv_broken_krb5_h, [
15 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
18 ]])], [ squid_cv_broken_krb5_h=no ], [
19 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
20 #if defined(__cplusplus)
21 #define KRB5INT_BEGIN_DECLS extern "C" {
22 #define KRB5INT_END_DECLS
27 ]])], [ squid_cv_broken_krb5_h=yes ], [ squid_cv_broken_krb5_h=no ])
30 ]) dnl SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
33 AC_DEFUN([SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H], [
34 AC_CACHE_CHECK([for broken Heimdal krb5.h],squid_cv_broken_heimdal_krb5_h, [
35 AC_RUN_IFELSE([AC_LANG_SOURCE([[
42 krb5_init_context(&context);
46 ]])], [ squid_cv_broken_heimdal_krb5_h=no ], [
47 AC_RUN_IFELSE([AC_LANG_SOURCE([[
48 #if defined(__cplusplus)
52 #if defined(__cplusplus)
60 krb5_init_context(&context);
64 ]])], [ squid_cv_broken_heimdal_krb5_h=yes ], [ squid_cv_broken_heimdal_krb5_h=no ])
67 ]) dnl SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
69 dnl check the max skew in the krb5 context, and sets squid_cv_max_skew_context
70 AC_DEFUN([SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT],[
71 AC_CACHE_CHECK([for max_skew in struct krb5_context],
72 squid_cv_max_skew_context, [
75 #if HAVE_BROKEN_SOLARIS_KRB5_H
76 #if defined(__cplusplus)
77 #define KRB5INT_BEGIN_DECLS extern "C" {
78 #define KRB5INT_END_DECLS
83 krb5_context kc; kc->max_skew = 1;
85 ],[ squid_cv_max_skew_context=yes ],
86 [ squid_cv_max_skew_context=no ])
90 dnl check whether the kerberos context has a memory cache. Sets
91 dnl squid_cv_memory_cache if that's the case.
92 AC_DEFUN([SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE],[
93 AC_CACHE_CHECK([for memory cache], squid_cv_memory_cache, [
96 #if HAVE_BROKEN_SOLARIS_KRB5_H
97 #if defined(__cplusplus)
98 #define KRB5INT_BEGIN_DECLS extern "C" {
99 #define KRB5INT_END_DECLS
104 int main(int argc, char *argv[])
106 krb5_context context;
109 krb5_init_context(&context);
110 return krb5_cc_resolve(context, "MEMORY:test_cache", &cc);
113 ], [ squid_cv_memory_cache=yes ], [ squid_cv_memory_cache=no ], [:])
118 dnl checks that gssapi is ok, and sets squid_cv_working_gssapi accordingly
119 AC_DEFUN([SQUID_CHECK_WORKING_GSSAPI], [
120 AC_CACHE_CHECK([for working gssapi], squid_cv_working_gssapi, [
121 AC_RUN_IFELSE([AC_LANG_SOURCE([[
123 #if HAVE_GSSAPI_GSSAPI_H
124 #include <gssapi/gssapi.h>
133 #if HAVE_GSSAPI_GSSAPI_H
134 #include <gssapi/gssapi.h>
138 #if HAVE_GSSAPI_GSSAPI_KRB5_H
139 #include <gssapi/gssapi_krb5.h>
141 #if HAVE_GSSAPI_GSSAPI_GENERIC_H
142 #include <gssapi/gssapi_generic.h>
151 gss_create_empty_oid_set(&val, &set);
155 ]])], [ squid_cv_working_gssapi=yes ], [ squid_cv_working_gssapi=no ], [:])])
156 if test "x$squid_cv_working_gssapi" = "xno" -a `echo $LIBS | grep -i -c "\-L"` -gt 0; then
157 AC_MSG_NOTICE([Check Runtime library path !])
161 dnl check for a working spnego, and set squid_cv_have_spnego
162 AC_DEFUN([SQUID_CHECK_SPNEGO_SUPPORT], [
163 AC_CACHE_CHECK([for spnego support], squid_cv_have_spnego, [
164 AC_RUN_IFELSE([AC_LANG_SOURCE([[
166 #if HAVE_GSSAPI_GSSAPI_H
167 #include <gssapi/gssapi.h>
176 #if HAVE_GSSAPI_GSSAPI_H
177 #include <gssapi/gssapi.h>
181 #if HAVE_GSSAPI_GSSAPI_KRB5_H
182 #include <gssapi/gssapi_krb5.h>
184 #if HAVE_GSSAPI_GSSAPI_GENERIC_H
185 #include <gssapi/gssapi_generic.h>
189 int main(int argc, char *argv[]) {
190 OM_uint32 major_status,minor_status;
191 gss_OID_set gss_mech_set;
194 static gss_OID_desc _gss_mech_spnego = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
195 gss_OID gss_mech_spnego = &_gss_mech_spnego;
197 major_status = gss_indicate_mechs( &minor_status, &gss_mech_set);
199 for (i=0;i<gss_mech_set->count;i++) {
200 if (!memcmp(gss_mech_set->elements[i].elements,gss_mech_spnego->elements,gss_mech_set->elements[i].length)) {
208 [ squid_cv_have_spnego=yes ], [ squid_cv_have_spnego=no ],[:])])
211 dnl checks that krb5 is functional. Sets squid_cv_working_krb5
212 AC_DEFUN([SQUID_CHECK_WORKING_KRB5],[
213 AC_CACHE_CHECK([for working krb5], squid_cv_working_krb5, [
214 AC_RUN_IFELSE([AC_LANG_SOURCE([[
216 #if HAVE_BROKEN_SOLARIS_KRB5_H
217 #if defined(__cplusplus)
218 #define KRB5INT_BEGIN_DECLS extern "C" {
219 #define KRB5INT_END_DECLS
223 #if HAVE_BROKEN_HEIMDAL_KRB5_H
235 krb5_context context;
237 krb5_init_context(&context);
241 ]])], [ squid_cv_working_krb5=yes ], [ squid_cv_working_krb5=no ],[:])])
242 if test "x$squid_cv_working_krb5" = "xno" -a `echo $LIBS | grep -i -c "\-L"` -gt 0; then
243 AC_MSG_NOTICE([Check Runtime library path !])
248 dnl checks for existence of krb5 functions
249 AC_DEFUN([SQUID_CHECK_KRB5_FUNCS],[
251 ac_com_error_message=no
252 if test "x$ac_cv_header_com_err_h" = "xyes" ; then
253 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
254 elif test "x$ac_cv_header_et_com_err_h" = "xyes" ; then
255 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
258 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" = "xyes" ; then
259 AC_CHECK_LIB(com_err,error_message,
260 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
261 [Define to 1 if you have error_message]),)
262 elif test "x$ac_com_error_message" = "xyes" ; then
263 AC_CHECK_LIB(krb5,error_message,
264 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
265 [Define to 1 if you have error_message]),)
268 AC_CHECK_LIB(krb5,krb5_get_err_text,
269 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,
270 [Define to 1 if you have krb5_get_err_text]),)
271 AC_CHECK_LIB(krb5,krb5_get_error_message,
272 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,
273 [Define to 1 if you have krb5_get_error_message]),)
274 AC_CHECK_LIB(krb5,krb5_free_error_message,
275 AC_DEFINE(HAVE_KRB5_FREE_ERROR_MESSAGE,1,
276 [Define to 1 if you have krb5_free_error_message]),)
277 AC_CHECK_LIB(krb5,krb5_free_error_string,
278 AC_DEFINE(HAVE_KRB5_FREE_ERROR_STRING,1,
279 [Define to 1 if you have krb5_free_error_string]),)
280 AC_CHECK_DECLS(krb5_kt_free_entry,,,[#include <krb5.h>])
281 AC_CHECK_TYPE(krb5_pac,
282 AC_DEFINE(HAVE_KRB5_PAC,1,
283 [Define to 1 if you have krb5_pac]),,
285 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
286 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,
287 [Define to 1 if you have krb5_kt_free_entry]),)
288 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
289 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,
290 [Define to 1 if you have krb5_get_init_creds_keytab]),)
291 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
292 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,
293 [Define to 1 if you have krb5_get_max_time_skew]),)
294 AC_CHECK_LIB(krb5,krb5_get_profile,
295 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,
296 [Define to 1 if you have krb5_get_profile]),)
297 AC_CHECK_LIB(krb5,profile_get_integer,
298 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,
299 [Define to 1 if you have profile_get_integer]),)
300 AC_CHECK_LIB(krb5,profile_release,
301 AC_DEFINE(HAVE_PROFILE_RELEASE,1,
302 [Define to 1 if you have profile_release]),)
303 AC_CHECK_LIB(krb5,krb5_get_renewed_creds,
304 AC_DEFINE(HAVE_KRB5_GET_RENEWED_CREDS,1,
305 [Define to 1 if you have krb5_get_renewed_creds]),)
306 AC_CHECK_LIB(krb5,krb5_principal_get_realm,
307 AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
308 [Define to 1 if you have krb5_principal_get_realm]),)
309 AC_CHECK_LIB(krb5, krb5_get_init_creds_opt_alloc,
310 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC,1,
311 [Define to 1 if you have krb5_get_init_creds_opt_alloc]),)
312 AC_MSG_CHECKING([for krb5_get_init_creds_free requires krb5_context])
313 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
315 ]],[[krb5_context context;
316 krb5_get_init_creds_opt *options;
317 krb5_get_init_creds_opt_free(context, options)]])],[
318 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_FREE_CONTEXT,1,
319 [Define to 1 if you krb5_get_init_creds_free requires krb5_context])
321 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
323 AC_CHECK_FUNCS(gss_map_name_to_any,
324 AC_DEFINE(HAVE_GSS_MAP_ANY_TO_ANY,1,
325 [Define to 1 if you have gss_map_name_to_any]),)
326 AC_CHECK_FUNCS(gsskrb5_extract_authz_data_from_sec_context,
327 AC_DEFINE(HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT,1,
328 [Define to 1 if you have gsskrb5_extract_authz_data_from_sec_context]),)
330 SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE
331 SQUID_DEFINE_BOOL(HAVE_KRB5_MEMORY_CACHE,$squid_cv_memory_cache,
332 [Define if kerberos has MEMORY: cache support])
334 SQUID_CHECK_WORKING_GSSAPI
335 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
337 SQUID_CHECK_SPNEGO_SUPPORT
338 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
340 SQUID_CHECK_WORKING_KRB5
341 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])