1 dnl Autoconf macro to check for kerberos
3 AC_DEFUN([NETATALK_GSSAPI_CHECK],
10 save_LDFLAGS="$LDFLAGS"
14 [ --with-gssapi[[=PATH]] path to GSSAPI for Kerberos V UAM [[auto]]],
15 [compilegssapi=$withval],
19 if test x"$compilegssapi" != x"no" ; then
20 if test "x$compilegssapi" != "xyes" -a "x$compilegssapi" != "xauto" ; then
21 export CFLAGS="-I$withval/include"
22 export LDFLAGS="-L$withval/${atalk_libname}"
23 AC_MSG_NOTICE([checking for GSSAPI support in $compilegssapi])
26 if test x"$compilegssapi" = x"yes" -o x"$compilegssapi" = x"auto" ; then
27 # check for krb5-config from recent MIT and Heimdal kerberos 5
28 AC_PATH_PROG(KRB5_CONFIG, krb5-config)
29 AC_MSG_CHECKING([for working krb5-config that takes --libs gssapi])
31 if test -x "$KRB5_CONFIG" ; then
32 TEMP="`$KRB5_CONFIG --libs gssapi`"
33 if test $? -eq 0 ; then
34 GSSAPI_CFLAGS="`$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`"
39 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
42 AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
47 if test x"$compilegssapi" != x"no" -a x"$FOUND_GSSAPI" = x"no" ; then
48 # check for gssapi headers
50 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h gssapi/gssapi_krb5.h,
51 [gss_headers_found=yes])
52 if test x"$gss_headers_found" = x"no" ; then
53 AC_MSG_ERROR([GSSAPI installation not found, headers missing])
56 AC_SEARCH_LIBS(gss_display_status, [gss gssapi gssapi_krb5])
57 if test x"$ac_cv_search_gss_display_status" = x"no" ; then
58 AC_MSG_ERROR([GSSAPI installation not found, library missing])
60 GSSAPI_CFLAGS="$CFLAGS"
65 if test x"$FOUND_GSSAPI" = x"yes" ; then
67 export CFLAGS="$GSSAPI_CFLAGS"
68 export LIBS="$GSSAPI_LIBS"
69 AC_CHECK_FUNC(gss_acquire_cred, [], [AC_MSG_ERROR([GSSAPI: required function gss_acquire_cred missing])])
71 # Heimdal/MIT compatibility fix
72 if test "$ac_cv_header_gssapi_h" = "yes" ; then
74 GSS_C_NT_HOSTBASED_SERVICE,
76 AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE, 1, [Wheter GSS_C_NT_HOSTBASED_SERVICE is in gssapi.h])
80 GSS_C_NT_HOSTBASED_SERVICE,
82 AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE, 1, [Wheter GSS_C_NT_HOSTBASED_SERVICE is in gssapi.h])
86 AC_DEFINE(HAVE_GSSAPI, 1, [Whether to enable GSSAPI support])
87 if test x"$ac_cv_func_gss_acquire_cred" = x"yes" ; then
88 ifelse([$1], , :, [$1])
90 ifelse([$2], , :, [$2])
95 AC_SUBST(GSSAPI_CFLAGS)
96 AC_SUBST(GSSAPI_LDFLAGS)
98 export LIBS="$save_LIBS"
99 export CFLAGS="$save_CFLAGS"
100 export LDFLAGS="$save_LDFLAGS"