1 ########################################################
2 # Compile with LDAP support?
7 AC_MSG_CHECKING([for LDAP support])
10 [ --with-ldap LDAP support (default yes)],
13 with_ldap_support=$withval
17 AC_MSG_RESULT($with_ldap_support)
19 if test x"$with_ldap_support" != x"no"; then
21 ##################################################################
22 # first test for ldap.h and lber.h
23 # (ldap.h is required for this test)
24 AC_CHECK_HEADERS(ldap.h lber.h)
26 if test x"$ac_cv_header_ldap_h" != x"yes"; then
27 if test x"$with_ldap_support" = x"yes"; then
28 AC_MSG_ERROR(ldap.h is needed for LDAP support)
30 AC_MSG_WARN(ldap.h is needed for LDAP support)
37 if test x"$with_ldap_support" != x"no"; then
40 ##################################################################
41 # we might need the lber lib on some systems. To avoid link errors
42 # this test must be before the libldap test
43 AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
45 ########################################################
46 # now see if we can find the ldap libs in standard paths
47 AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
49 AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
51 ########################################################
52 # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
53 # Check found in pam_ldap 145.
54 AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
56 LIBS="$LIBS $LDAP_LIBS"
57 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
61 [ldap_set_rebind_proc(0, 0, 0);],
62 [smb_ldap_cv_ldap_set_rebind_proc=3],
63 [smb_ldap_cv_ldap_set_rebind_proc=2]
67 AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
69 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
71 if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then
72 AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
74 AC_MSG_CHECKING(whether LDAP support is used)
77 if test x"$with_ldap_support" = x"yes"; then
78 AC_MSG_ERROR(libldap is needed for LDAP support)
80 AC_MSG_WARN(libldap is needed for LDAP support)
90 LIBS="$LIBS $LDAP_LIBS"
92 #################################################
93 # active directory support
98 AC_MSG_CHECKING([for Active Directory and krb5 support])
101 [ --with-ads Active Directory support (default auto)],
104 with_ads_support="$withval"
108 AC_MSG_RESULT($with_ads_support)
110 if test x"$with_ldap_support" != x"yes"; then
111 if test x"$with_ads_support" = x"yes"; then
112 AC_MSG_ERROR(Active Directory Support requires LDAP support)
113 elif test x"$with_ads_support" != x"no"; then
114 AC_MSG_WARN(Active Directory Support requires LDAP support)
119 if test x"$with_ads_support" != x"no"; then
121 # Do no harm to the values of CFLAGS and LIBS while testing for
124 #################################################
125 # check for krb5-config from recent MIT and Heimdal kerberos 5
126 AC_PATH_PROG(KRB5_CONFIG, krb5-config)
127 AC_MSG_CHECKING(for working krb5-config)
128 if test -x "$KRB5_CONFIG"; then
129 ac_save_CFLAGS=$CFLAGS
130 CFLAGS="";export CFLAGS
131 ac_save_LDFLAGS=$LDFLAGS
132 LDFLAGS="";export LDFLAGS
133 KRB5_LIBS="`$KRB5_CONFIG --libs gssapi`"
134 KRB5_CFLAGS="`$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
135 KRB5_CPPFLAGS="`$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
136 CFLAGS=$ac_save_CFLAGS;export CFLAGS
137 LDFLAGS=$ac_save_LDFLAGS;export LDFLAGS
141 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
144 if test x$FOUND_KRB5 = x"no"; then
145 #################################################
146 # check for location of Kerberos 5 install
147 AC_MSG_CHECKING(for kerberos 5 install path)
149 [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)],
152 AC_MSG_RESULT(no krb5-path given)
159 AC_MSG_RESULT($withval)
160 KRB5_CFLAGS="-I$withval/include"
161 KRB5_CPPFLAGS="-I$withval/include"
162 KRB5_LDFLAGS="-L$withval/lib"
166 AC_MSG_RESULT(no krb5-path given)
170 if test x$FOUND_KRB5 = x"no"; then
171 #################################################
172 # see if this box has the SuSE location for the heimdal krb implementation
173 AC_MSG_CHECKING(for /usr/include/heimdal)
174 if test -d /usr/include/heimdal; then
175 if test -f /usr/lib/heimdal/lib/libkrb5.a; then
176 KRB5_CFLAGS="-I/usr/include/heimdal"
177 KRB5_CPPFLAGS="-I/usr/include/heimdal"
178 KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
181 KRB5_CFLAGS="-I/usr/include/heimdal"
182 KRB5_CPPFLAGS="-I/usr/include/heimdal"
190 if test x$FOUND_KRB5 = x"no"; then
191 #################################################
192 # see if this box has the RedHat location for kerberos
193 AC_MSG_CHECKING(for /usr/kerberos)
194 if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
195 KRB5_LDFLAGS="-L/usr/kerberos/lib"
196 KRB5_CFLAGS="-I/usr/kerberos/include"
197 KRB5_CPPFLAGS="-I/usr/kerberos/include"
204 ac_save_CFLAGS=$CFLAGS
205 ac_save_CPPFLAGS=$CPPFLAGS
206 ac_save_LDFLAGS=$LDFLAGS
208 CFLAGS="$CFLAGS $KRB5_CFLAGS"
209 CPPFLAGS="$CPPFLAGS $KRB5_CPPFLAGS"
210 LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
212 KRB5_LIBS="$KRB5_LDFLAGS $KRB5_LIBS"
214 # now check for krb5.h. Some systems have the libraries without the headers!
215 # note that this check is done here to allow for different kerberos
217 AC_CHECK_HEADERS(krb5.h)
219 if test x"$ac_cv_header_krb5_h" = x"no"; then
221 # Give a warning if AD support was not explicitly requested,
222 # i.e with_ads_support = auto, otherwise die with an error.
224 if test x"$with_ads_support" = x"yes"; then
225 AC_MSG_ERROR([Active Directory cannot be supported without krb5.h])
227 AC_MSG_WARN([Active Directory cannot be supported without krb5.h])
230 # Turn off AD support and restore CFLAGS and LIBS variables
232 with_ads_support="no"
234 CFLAGS=$ac_save_CFLAGS
235 CPPFLAGS=$ac_save_CPPFLAGS
236 LDFLAGS=$ac_save_LDFLAGS
240 # Now we have determined whether we really want ADS support
242 if test x"$with_ads_support" != x"no"; then
245 # now check for gssapi headers. This is also done here to allow for
246 # different kerberos include paths
247 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
249 ##################################################################
250 # we might need the k5crypto and com_err libraries on some systems
251 AC_CHECK_LIB_EXT(com_err, KRB5_LIBS, _et_list)
252 AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
255 AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
256 AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
257 AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
259 # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
260 AC_CHECK_LIB_EXT(gssapi, KRB5_LIBS, gss_display_status,[],[],
261 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
263 ########################################################
264 # now see if we can find the krb5 libs in standard paths
265 # or as specified above
266 AC_CHECK_LIB_EXT(krb5, KRB5_LIBS, krb5_mk_req_extended)
268 ########################################################
269 # now see if we can find the gssapi libs in standard paths
270 AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS,gss_display_status,[],[],
271 AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available]))
273 AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
274 AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
275 AC_CHECK_FUNC_EXT(krb5_set_default_tgs_ktypes, $KRB5_LIBS)
276 AC_CHECK_FUNC_EXT(krb5_principal2salt, $KRB5_LIBS)
277 AC_CHECK_FUNC_EXT(krb5_use_enctype, $KRB5_LIBS)
278 AC_CHECK_FUNC_EXT(krb5_string_to_key, $KRB5_LIBS)
279 AC_CHECK_FUNC_EXT(krb5_get_pw_salt, $KRB5_LIBS)
280 AC_CHECK_FUNC_EXT(krb5_string_to_key_salt, $KRB5_LIBS)
281 AC_CHECK_FUNC_EXT(krb5_auth_con_setkey, $KRB5_LIBS)
282 AC_CHECK_FUNC_EXT(krb5_auth_con_setuseruserkey, $KRB5_LIBS)
283 AC_CHECK_FUNC_EXT(krb5_locate_kdc, $KRB5_LIBS)
284 AC_CHECK_FUNC_EXT(krb5_get_permitted_enctypes, $KRB5_LIBS)
285 AC_CHECK_FUNC_EXT(krb5_get_default_in_tkt_etypes, $KRB5_LIBS)
286 AC_CHECK_FUNC_EXT(krb5_free_ktypes, $KRB5_LIBS)
287 AC_CHECK_FUNC_EXT(krb5_free_data_contents, $KRB5_LIBS)
288 AC_CHECK_FUNC_EXT(krb5_principal_get_comp_string, $KRB5_LIBS)
290 LIBS="$LIBS $KRB5_LIBS"
292 AC_CACHE_CHECK([for addrtype in krb5_address],
293 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
294 AC_TRY_COMPILE([#include <krb5.h>],
295 [krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
296 samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,
297 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)])
311 if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
312 AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,
313 [Whether the krb5_address struct has a addr_type property])
316 AC_CACHE_CHECK([for enc_part2 in krb5_ticket],
317 samba_cv_HAVE_KRB5_TKT_ENC_PART2,
318 [AC_TRY_COMPILE([#include <krb5.h>],
319 [krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
320 samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
322 if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
323 AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,
324 [Whether the krb5_ticket struct has a enc_part2 property])
327 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
328 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
329 AC_TRY_COMPILE([#include <krb5.h>],
330 [krb5_keyblock key; key.keyvalue.data = NULL;],
331 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,
332 samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
334 if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
335 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
336 [Whether the krb5_keyblock struct has a keyvalue property])
339 AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],
340 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
341 AC_TRY_COMPILE([#include <krb5.h>],
342 [krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
343 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,
344 samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
345 AC_CACHE_CHECK([for KEYTYPE_ARCFOUR_56],
346 samba_cv_HAVE_KEYTYPE_ARCFOUR_56,[
347 AC_TRY_COMPILE([#include <krb5.h>],
348 [krb5_keytype keytype; keytype = KEYTYPE_ARCFOUR_56;],
349 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=yes,
350 samba_cv_HAVE_KEYTYPE_ARCFOUR_56=no)])
351 # Heimdals with KEYTYPE_ARCFOUR but not KEYTYPE_ARCFOUR_56 are broken
352 # w.r.t. arcfour and windows, so we must not enable it here
353 if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes" -a\
354 x"$samba_cv_HAVE_KEYTYPE_ARCFOUR_56" = x"yes"; then
355 AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,
356 [Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
359 AC_CACHE_CHECK([for AP_OPTS_USE_SUBKEY],
360 samba_cv_HAVE_AP_OPTS_USE_SUBKEY,[
361 AC_TRY_COMPILE([#include <krb5.h>],
362 [krb5_flags ap_options; ap_options = AP_OPTS_USE_SUBKEY;],
363 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=yes,
364 samba_cv_HAVE_AP_OPTS_USE_SUBKEY=no)])
366 if test x"$samba_cv_HAVE_AP_OPTS_USE_SUBKEY" = x"yes"; then
367 AC_DEFINE(HAVE_AP_OPTS_USE_SUBKEY,1,
368 [Whether the AP_OPTS_USE_SUBKEY ap option is available])
371 AC_CACHE_CHECK([for the krb5_princ_component macro],
372 samba_cv_HAVE_KRB5_PRINC_COMPONENT,[
373 AC_TRY_LINK([#include <krb5.h>],
374 [const krb5_data *pkdata; krb5_context context; krb5_principal principal; pkdata = krb5_princ_component(context, principal, 0);],
375 samba_cv_HAVE_KRB5_PRINC_COMPONENT=yes,
376 samba_cv_HAVE_KRB5_PRINC_COMPONENT=no)])
378 if test x"$samba_cv_HAVE_KRB5_PRINC_COMPONENT" = x"yes"; then
379 AC_DEFINE(HAVE_KRB5_PRINC_COMPONENT,1,
380 [Whether krb5_princ_component is available])
383 AC_CACHE_CHECK([for memory keytab support],
384 samba_cv_HAVE_MEMORY_KEYTAB,[
389 krb5_context context;
392 krb5_init_context(&context);
393 if (krb5_kt_resolve(context, "MEMORY:", &keytab))
397 samba_cv_HAVE_MEMORY_KEYTAB=yes,
398 samba_cv_HAVE_MEMORY_KEYTAB=no)])
400 if test x"$samba_cv_HAVE_MEMORY_KEYTAB" = x"yes"; then
401 AC_DEFINE(HAVE_MEMORY_KEYTAB,1,
402 [Whether in-memory keytabs are supported])
405 AC_CACHE_CHECK([for key in krb5_keytab_entry],
406 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY,[
407 AC_TRY_COMPILE([#include <krb5.h>],
408 [krb5_keytab_entry entry; krb5_keyblock e; entry.key = e;],
409 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=yes,
410 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY=no)])
412 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEY" = x"yes"; then
413 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEY,1,
414 [Whether krb5_keytab_entry has key member])
417 AC_CACHE_CHECK([for keyblock in krb5_keytab_entry],
418 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,[
419 AC_TRY_COMPILE([#include <krb5.h>],
420 [krb5_keytab_entry entry; entry.keyblock.keytype = 0;],
421 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=yes,
422 samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK=no)])
424 if test x"$samba_cv_HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK" = x"yes"; then
425 AC_DEFINE(HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK,1,
426 [Whether krb5_keytab_entry has keyblock member])
429 if test x"$ac_cv_lib_ext_krb5_krb5_mk_req_extended" = x"yes"; then
430 AC_DEFINE(HAVE_KRB5,1,[Whether to have KRB5 support])
431 AC_DEFINE(WITH_ADS,1,[Whether to include Active Directory support])
432 AC_MSG_CHECKING(whether Active Directory and KRB5 support is used)
435 if test x"$with_ads_support" = x"yes"; then
436 AC_MSG_ERROR(libkrb5 is needed for Active Directory support)
438 AC_MSG_WARN(libkrb5 is needed for Active Directory support)
447 LIBS="$LIBS $KRB5_LIBS"