1 # NOTE! this whole m4 file is disabled in configure.in for now
3 #################################################
11 AC_MSG_CHECKING([for KRB5 support])
13 # Do no harm to the values of CFLAGS and LIBS while testing for
16 [ --with-krb5=base-dir Locate Kerberos 5 support (default=auto)],
29 with_krb5_support=auto
37 KRB5CONFIG="$krb5_withval/bin/krb5-config"
40 AC_MSG_RESULT($with_krb5_support)
43 if test x$with_krb5_support != x"no"; then
45 FOUND_KRB5_VIA_CONFIG=no
47 #################################################
48 # check for krb5-config from recent MIT and Heimdal kerberos 5
49 AC_MSG_CHECKING(for working specified location for krb5-config)
50 if test x$KRB5CONFIG != "x"; then
51 if test -x "$KRB5CONFIG"; then
52 ac_save_CFLAGS=$CFLAGS
53 CFLAGS="";export CFLAGS
54 ac_save_LDFLAGS=$LDFLAGS
55 LDFLAGS="";export LDFLAGS
56 KRB5_LIBS="`$KRB5CONFIG --libs gssapi`"
57 KRB5_CFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
58 KRB5_CPPFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
59 CFLAGS=$ac_save_CFLAGS;export CFLAGS
60 LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
62 FOUND_KRB5_VIA_CONFIG=yes
63 AC_MSG_RESULT(yes. Found $KRB5CONFIG)
65 AC_MSG_RESULT(no. Fallback to specified directory)
68 AC_MSG_RESULT(no. Fallback to finding krb5-config in path)
69 #################################################
70 # check for krb5-config from recent MIT and Heimdal kerberos 5
71 AC_PATH_PROG(KRB5CONFIG, krb5-config)
72 AC_MSG_CHECKING(for working krb5-config in path)
73 if test -x "$KRB5CONFIG"; then
74 ac_save_CFLAGS=$CFLAGS
75 CFLAGS="";export CFLAGS
76 ac_save_LDFLAGS=$LDFLAGS
77 LDFLAGS="";export LDFLAGS
78 KRB5_LIBS="`$KRB5CONFIG --libs gssapi`"
79 KRB5_CFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
80 KRB5_CPPFLAGS="`$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`"
81 CFLAGS=$ac_save_CFLAGS;export CFLAGS
82 LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
84 FOUND_KRB5_VIA_CONFIG=yes
85 AC_MSG_RESULT(yes. Found $KRB5CONFIG)
87 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
91 if test x$FOUND_KRB5 != x"yes"; then
92 #################################################
93 # check for location of Kerberos 5 install
94 AC_MSG_CHECKING(for kerberos 5 install path)
95 case "$krb5_withval" in
97 AC_MSG_RESULT(no krb5-path given)
104 AC_MSG_RESULT($krb5_withval)
105 KRB5_CFLAGS="-I$krb5_withval/include"
106 KRB5_CPPFLAGS="-I$krb5_withval/include"
107 KRB5_LDFLAGS="-L$krb5_withval/lib"
113 if test x$FOUND_KRB5 != x"yes"; then
114 #################################################
115 # see if this box has the SuSE location for the heimdal krb implementation
116 AC_MSG_CHECKING(for /usr/include/heimdal)
117 if test -d /usr/include/heimdal; then
118 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
119 KRB5_CFLAGS="-I/usr/include/heimdal"
120 KRB5_CPPFLAGS="-I/usr/include/heimdal"
121 KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
124 KRB5_CFLAGS="-I/usr/include/heimdal"
125 KRB5_CPPFLAGS="-I/usr/include/heimdal"
133 if test x$FOUND_KRB5 != x"yes"; then
134 #################################################
135 # see if this box has the RedHat location for kerberos
136 AC_MSG_CHECKING(for /usr/kerberos)
137 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
138 KRB5_LDFLAGS="-L/usr/kerberos/lib"
139 KRB5_CFLAGS="-I/usr/kerberos/include"
140 KRB5_CPPFLAGS="-I/usr/kerberos/include"
147 ac_save_CFLAGS=$CFLAGS
148 ac_save_CPPFLAGS=$CPPFLAGS
149 ac_save_LDFLAGS=$LDFLAGS
151 #MIT needs this, to let us see 'internal' parts of the headers we use
152 KRB5_CFLAGS="${KRB5_CFLAGS} -DKRB5_PRIVATE -DKRB5_DEPRECATED"
155 #TODO: we need to parse KRB5_LIBS for -L path
156 # and set -Wl,-rpath -Wl,path
158 CFLAGS="$CFLAGS $KRB5_CFLAGS"
159 CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
160 LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
162 KRB5_LIBS="$KRB5_LDFLAGS $KRB5_LIBS"
164 # now check for krb5.h. Some systems have the libraries without the headers!
165 # note that this check is done here to allow for different kerberos
167 AC_CHECK_HEADERS(krb5.h)
169 if test x"$ac_cv_header_krb5_h" = x"no"; then
170 # Give a warning if KRB5 support was not explicitly requested,
171 # i.e with_krb5_support = auto, otherwise die with an error.
172 if test x"$with_krb5_support" = x"yes"; then
173 AC_MSG_ERROR([KRB5 cannot be supported without krb5.h])
175 AC_MSG_WARN([KRB5 cannot be supported without krb5.h])
177 # Turn off AD support and restore CFLAGS and LIBS variables
178 with_krb5_support="no"
181 CFLAGS=$ac_save_CFLAGS
182 CPPFLAGS=$ac_save_CPPFLAGS
183 LDFLAGS=$ac_save_LDFLAGS
186 # Now we have determined whether we really want KRB5 support
188 if test x"$with_krb5_support" != x"no"; then
189 ac_save_CFLAGS=$CFLAGS
190 ac_save_CPPFLAGS=$CPPFLAGS
191 ac_save_LDFLAGS=$LDFLAGS
194 CFLAGS="$CFLAGS $KRB5_CFLAGS"
195 CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
196 LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
198 # now check for gssapi headers. This is also done here to allow for
199 # different kerberos include paths
200 AC_CHECK_HEADERS(gssapi.h gssapi_krb5.h gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h com_err.h)
204 # But only if we didn't have a krb5-config to tell us this already
205 if test x"$FOUND_KRB5_VIA_CONFIG" != x"yes"; then
206 ##################################################################
207 # we might need the k5crypto and com_err libraries on some systems
208 AC_CHECK_LIB_EXT(com_err, KRB5_LIBS, _et_list)
209 AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
211 AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
212 AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
213 AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
216 # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
217 AC_CHECK_LIB_EXT(gssapi, KRB5_LIBS, gss_display_status,[],[],
218 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
220 ########################################################
221 # now see if we can find the krb5 libs in standard paths
222 # or as specified above
223 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_mk_req_extended)
224 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_kt_compare)
226 ########################################################
227 # now see if we can find the gssapi libs in standard paths
228 if test x"$ac_cv_lib_ext_gssapi_gss_display_status" != x"yes"; then
229 AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS,gss_display_status,[],[],
230 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
233 AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
234 AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
235 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_ktypes, $KRB5_LIBS)
236 AC_CHECK_FUNC_EXT(krb5_principal2salt, $KRB5_LIBS)
237 AC_CHECK_FUNC_EXT(krb5_use_enctype, $KRB5_LIBS)
238 AC_CHECK_FUNC_EXT(krb5_string_to_key, $KRB5_LIBS)
239 AC_CHECK_FUNC_EXT(krb5_get_pw_salt, $KRB5_LIBS)
240 AC_CHECK_FUNC_EXT(krb5_string_to_key_salt, $KRB5_LIBS)
241 AC_CHECK_FUNC_EXT(krb5_auth_con_setkey, $KRB5_LIBS)
242 AC_CHECK_FUNC_EXT(krb5_auth_con_setuseruserkey, $KRB5_LIBS)
243 AC_CHECK_FUNC_EXT(krb5_locate_kdc, $KRB5_LIBS)
244 AC_CHECK_FUNC_EXT(krb5_get_permitted_enctypes, $KRB5_LIBS)
245 AC_CHECK_FUNC_EXT(krb5_get_default_in_tkt_etypes, $KRB5_LIBS)
246 AC_CHECK_FUNC_EXT(krb5_free_ktypes, $KRB5_LIBS)
247 AC_CHECK_FUNC_EXT(krb5_free_data_contents, $KRB5_LIBS)
248 AC_CHECK_FUNC_EXT(krb5_principal_get_comp_string, $KRB5_LIBS)
249 AC_CHECK_FUNC_EXT(krb5_free_unparsed_name, $KRB5_LIBS)
250 AC_CHECK_FUNC_EXT(krb5_free_keytab_entry_contents, $KRB5_LIBS)
251 AC_CHECK_FUNC_EXT(krb5_kt_free_entry, $KRB5_LIBS)
252 AC_CHECK_FUNC_EXT(krb5_krbhst_get_addrinfo, $KRB5_LIBS)
253 AC_CHECK_FUNC_EXT(krb5_verify_checksum, $KRB5_LIBS)
254 AC_CHECK_FUNC_EXT(krb5_c_verify_checksum, $KRB5_LIBS)
255 AC_CHECK_FUNC_EXT(krb5_ticket_get_authorization_data_type, $KRB5_LIBS)
256 AC_CHECK_FUNC_EXT(krb5_krbhst_get_addrinfo, $KRB5_LIBS)
257 AC_CHECK_FUNC_EXT(krb5_c_enctype_compare, $KRB5_LIBS)
258 AC_CHECK_FUNC_EXT(krb5_enctypes_compatible_keys, $KRB5_LIBS)
259 AC_CHECK_FUNC_EXT(krb5_get_error_string, $KRB5_LIBS)
260 AC_CHECK_FUNC_EXT(krb5_free_error_string, $KRB5_LIBS)
261 AC_CHECK_FUNC_EXT(krb5_get_error_message, $KRB5_LIBS)
262 AC_CHECK_FUNC_EXT(krb5_free_error_message, $KRB5_LIBS)
263 AC_CHECK_FUNC_EXT(krb5_initlog, $KRB5_LIBS)
264 AC_CHECK_FUNC_EXT(krb5_addlog_func, $KRB5_LIBS)
265 AC_CHECK_FUNC_EXT(krb5_set_warn_dest, $KRB5_LIBS)
267 LIBS="$LIBS $KRB5_LIBS"
269 AC_CACHE_CHECK([for krb5_log_facility type],
270 samba_cv_HAVE_KRB5_LOG_FACILITY,[
271 AC_TRY_COMPILE([#include <krb5.h>],
272 [krb5_log_facility block;],
273 samba_cv_HAVE_KRB5_LOG_FACILITY=yes,
274 samba_cv_HAVE_KRB5_LOG_FACILITY=no)])
276 if test x"$samba_cv_HAVE_KRB5_LOG_FACILITY" = x"yes"; then
277 AC_DEFINE(HAVE_KRB5_LOG_FACILITY,1,
278 [Whether the type krb5_log_facility exists])
281 AC_CACHE_CHECK([for krb5_encrypt_block type],
282 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK,[
283 AC_TRY_COMPILE([#include <krb5.h>],
284 [krb5_encrypt_block block;],
285 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=yes,
286 samba_cv_HAVE_KRB5_ENCRYPT_BLOCK=no)])
288 if test x"$samba_cv_HAVE_KRB5_ENCRYPT_BLOCK" = x"yes"; then
289 AC_DEFINE(HAVE_KRB5_ENCRYPT_BLOCK,1,
290 [Whether the type krb5_encrypt_block exists])
293 AC_CACHE_CHECK([for addrtype in krb5_address],
294 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
295 AC_TRY_COMPILE([#include <krb5.h>],
296 [krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
297 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,
298 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=no)])
299 if test x"$samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS" = x"yes"; then
300 AC_DEFINE(HAVE_ADDRTYPE_IN_KRB5_ADDRESS,1,
301 [Whether the krb5_address struct has a addrtype property])
304 AC_CACHE_CHECK([for addr_type in krb5_address],
305 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,[
306 AC_TRY_COMPILE([#include <krb5.h>],
307 [krb5_address kaddr; kaddr.addr_type = KRB5_ADDRESS_INET;],
308 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=yes,
309 samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=no)])
310 if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
311 AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,
312 [Whether the krb5_address struct has a addr_type property])
315 AC_CACHE_CHECK([for enc_part2 in krb5_ticket],
316 samba_cv_HAVE_KRB5_TKT_ENC_PART2,[
317 AC_TRY_COMPILE([#include <krb5.h>],
318 [krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
319 samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,
320 samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
321 if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
322 AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,
323 [Whether the krb5_ticket struct has a enc_part2 property])
326 AC_CACHE_CHECK([for keyblock in krb5_creds],
327 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS,[
328 AC_TRY_COMPILE([#include <krb5.h>],
329 [krb5_creds creds; krb5_keyblock kb; creds.keyblock = kb;],
330 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=yes,
331 samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS=no)])
333 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_IN_CREDS" = x"yes"; then
334 AC_DEFINE(HAVE_KRB5_KEYBLOCK_IN_CREDS,1,
335 [Whether the krb5_creds struct has a keyblock property])
338 AC_CACHE_CHECK([for session in krb5_creds],
339 samba_cv_HAVE_KRB5_SESSION_IN_CREDS,[
340 AC_TRY_COMPILE([#include <krb5.h>],
341 [krb5_creds creds; krb5_keyblock kb; creds.session = kb;],
342 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=yes,
343 samba_cv_HAVE_KRB5_SESSION_IN_CREDS=no)])
345 if test x"$samba_cv_HAVE_KRB5_SESSION_IN_CREDS" = x"yes"; then
346 AC_DEFINE(HAVE_KRB5_SESSION_IN_CREDS,1,
347 [Whether the krb5_creds struct has a session property])
350 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
351 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
352 AC_TRY_COMPILE([#include <krb5.h>],
353 [krb5_keyblock key; key.keyvalue.data = NULL;],
354 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,
355 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
356 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
357 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
358 [Whether the krb5_keyblock struct has a keyvalue property])
361 AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],
362 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
363 AC_TRY_COMPILE([#include <krb5.h>],
364 [krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
365 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,
366 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
367 AC_CACHE_CHECK([for KEYTYPE_ARCFOUR_56],
368 samba_cv_HAVE_KEYTYPE_ARCFOUR_56,[
369 AC_TRY_COMPILE([#include <krb5.h>],
370 [krb5_keytype keytype; keytype = KEYTYPE_ARCFOUR_56;],
371 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=yes,
372 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=no)])
373 # Heimdals with KEYTYPE_ARCFOUR but not KEYTYPE_ARCFOUR_56 are broken
374 # w.r.t. arcfour and windows, so we must not enable it here
375 if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes" -a\
376 x"$samba_cv_HAVE_KEYTYPE_ARCFOUR_56" = x"yes"; then
377 AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,
378 [Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
381 AC_CACHE_CHECK([for AP_OPTS_USE_SUBKEY],
382 samba_cv_HAVE_AP_OPTS_USE_SUBKEY,[
383 AC_TRY_COMPILE([#include <krb5.h>],
384 [krb5_flags ap_options; ap_options = AP_OPTS_USE_SUBKEY;],
385 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=yes,
386 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=no)])
387 if test x"$samba_cv_HAVE_AP_OPTS_USE_SUBKEY" = x"yes"; then
388 AC_DEFINE(HAVE_AP_OPTS_USE_SUBKEY,1,
389 [Whether the AP_OPTS_USE_SUBKEY ap option is available])
392 AC_CACHE_CHECK([for KV5M_KEYTAB],
393 samba_cv_HAVE_KV5M_KEYTAB,[
394 AC_TRY_COMPILE([#include <krb5.h>],
395 [krb5_keytab_entry entry; entry.magic = KV5M_KEYTAB;],
396 samba_cv_HAVE_KV5M_KEYTAB=yes,
397 samba_cv_HAVE_KV5M_KEYTAB=no)])
398 if test x"$samba_cv_HAVE_KV5M_KEYTAB" = x"yes"; then
399 AC_DEFINE(HAVE_KV5M_KEYTAB,1,
400 [Whether the KV5M_KEYTAB option is available])
403 AC_CACHE_CHECK([for the krb5_princ_component macro],
404 samba_cv_HAVE_KRB5_PRINC_COMPONENT,[
405 AC_TRY_LINK([#include <krb5.h>],
406 [const krb5_data *pkdata; krb5_context context; krb5_principal principal;
407 pkdata = krb5_princ_component(context, principal, 0);],
408 samba_cv_HAVE_KRB5_PRINC_COMPONENT=yes,
409 samba_cv_HAVE_KRB5_PRINC_COMPONENT=no)])
410 if test x"$samba_cv_HAVE_KRB5_PRINC_COMPONENT" = x"yes"; then
411 AC_DEFINE(HAVE_KRB5_PRINC_COMPONENT,1,
412 [Whether krb5_princ_component is available])
415 AC_CACHE_CHECK([for key in krb5_keytab_entry],
416 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY,[
417 AC_TRY_COMPILE([#include <krb5.h>],
418 [krb5_keytab_entry entry; krb5_keyblock e; entry.key = e;],
419 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=yes,
420 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=no)])
421 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY" = x"yes"; then
422 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEY,1,
423 [Whether krb5_keytab_entry has key member])
426 AC_CACHE_CHECK([for keyblock in krb5_keytab_entry],
427 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,[
428 AC_TRY_COMPILE([#include <krb5.h>],
429 [krb5_keytab_entry entry; entry.keyblock.keytype = 0;],
430 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=yes,
431 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=no)])
432 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK" = x"yes"; then
433 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,1,
434 [Whether krb5_keytab_entry has keyblock member])
437 AC_CACHE_CHECK([for WRFILE: keytab support],
438 samba_cv_HAVE_WRFILE_KEYTAB,[
443 krb5_context context;
445 krb5_init_context(&context);
446 return krb5_kt_resolve(context, "WRFILE:api", &keytab);
448 samba_cv_HAVE_WRFILE_KEYTAB=yes,
449 samba_cv_HAVE_WRFILE_KEYTAB=no)])
450 if test x"$samba_cv_HAVE_WRFILE_KEYTAB" = x"yes"; then
451 AC_DEFINE(HAVE_WRFILE_KEYTAB,1,
452 [Whether the WRFILE:-keytab is supported])
455 AC_CACHE_CHECK([for krb5_princ_realm returns krb5_realm or krb5_data],
456 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM,[
457 AC_TRY_COMPILE([#include <krb5.h>],
458 [krb5_context context;krb5_principal principal;krb5_realm realm;
459 realm = *krb5_princ_realm(context, principal);],
460 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=yes,
461 samba_cv_KRB5_PRINC_REALM_RETURNS_REALM=no)])
462 if test x"$samba_cv_KRB5_PRINC_REALM_RETURNS_REALM" = x"yes"; then
463 AC_DEFINE(KRB5_PRINC_REALM_RETURNS_REALM,1,
464 [Whether krb5_princ_realm returns krb5_realm or krb5_data])
467 # TODO: check all gssapi headers for this
468 AC_CACHE_CHECK([for GSS_C_DCE_STYLE in gssapi.h],
469 samba_cv_GSS_C_DCE_STYLE,[
470 AC_TRY_COMPILE([#include <gssapi.h>],
471 [int flags = GSS_C_DCE_STYLE;],
472 samba_cv_GSS_C_DCE_STYLE=yes,
473 samba_cv_GSS_C_DCE_STYLE=no)])
475 AC_CHECK_FUNC_EXT(gsskrb5_get_initiator_subkey, $KRB5_LIBS)
476 AC_CHECK_FUNC_EXT(gsskrb5_extract_authz_data_from_sec_context, $KRB5_LIBS)
477 AC_CHECK_FUNC_EXT(gsskrb5_register_acceptor_identity, $KRB5_LIBS)
478 AC_CHECK_FUNC_EXT(gss_krb5_ccache_name, $KRB5_LIBS)
479 if test x"$ac_cv_lib_ext_krb5_krb5_mk_req_extended" = x"yes"; then
480 AC_DEFINE(HAVE_KRB5,1,[Whether to have KRB5 support])
481 AC_MSG_CHECKING(whether KRB5 support is used)
484 echo "KRB5_CFLAGS: ${KRB5_CFLAGS}"
485 echo "KRB5_CPPFLAGS: ${KRB5_CPPFLAGS}"
486 echo "KRB5_LDFLAGS: ${KRB5_LDFLAGS}"
487 echo "KRB5_LIBS: ${KRB5_LIBS}"
489 if test x"$with_krb5_support" = x"yes"; then
490 AC_MSG_ERROR(a working krb5 library is needed for KRB5 support)
492 AC_MSG_WARN(a working krb5 library is needed for KRB5 support)
501 # checks if we have access to a libkdc
502 # and can use it for our builtin kdc server_service
507 AC_CHECK_HEADERS(kdc.h)
508 AC_CHECK_LIB_EXT(kdc, KDC_LIBS, krb5_kdc_default_config)
509 AC_CHECK_LIB_EXT(hdb, KDC_LIBS, hdb_generate_key_set_password)
511 AC_MSG_CHECKING(whether libkdc is used)
512 if test x"$ac_cv_header_kdc_h" = x"yes"; then
513 if test x"$ac_cv_lib_ext_kdc_krb5_kdc_default_config" = x"yes"; then
514 if test x"$ac_cv_lib_ext_hdb_hdb_generate_key_set_password" = x"yes"; then
517 echo "KDC_LIBS: ${KDC_LIBS}"
528 CFLAGS=$ac_save_CFLAGS
529 CPPFLAGS=$ac_save_CPPFLAGS
530 LDFLAGS=$ac_save_LDFLAGS
533 # as a nasty hack add the krb5 stuff to the global vars,
534 # at some point this should not be needed anymore when the build system
535 # can handle that alone
536 CFLAGS="$CFLAGS $KRB5_CFLAGS"
537 CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
538 LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
541 SMB_EXT_LIB(KRB5,[${KRB5_LIBS}],[${KRB5_CFLAGS}],[${KRB5_CPPFLAGS}],[${KRB5_LDFLAGS}])
542 SMB_EXT_LIB(KDC,[${KDC_LIBS}],[${KDC_CFLAGS}],[${KDC_CPPFLAGS}],[${KDC_LDFLAGS}])