1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
 
AC_INIT(gssapi.cmod) 
AC_CONFIG_HEADER(gssapi_config.h) 
 
AC_MODULE_INIT() 
 
PIKE_FEATURE_WITHOUT(GSSAPI) 
 
AC_ARG_WITH(gssapi, 
        [  --with(out)-gssapi                 GSS-API support], 
        [],[with_gssapi=yes]) 
 
if test x$with_gssapi = xyes; then 
 
PIKE_FEATURE(GSSAPI, [no (gssapi.h not found)]) 
AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssglue/gssapi/gssapi.h, break) 
AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h gssglue/gssapi/gssapi_krb5.h, break) 
 
if test x$ac_cv_header_gssapi_h = xyes -o \ 
        x$ac_cv_header_gssapi_gssapi_h = xyes -o \ 
        x$ac_cv_header_gssglue_gssapi_gssapi_h = xyes; then 
  PIKE_FEATURE(GSSAPI, [no (GSS-API v2 library not found)]) 
 
  # Check for gss_wrap since it only exists in GSS-API version 2. 
  # Must use PIKE_SEARCH_LIBS since the lib in the Windows dist 
  # (KfW) uses __stdcall. 
  PIKE_SEARCH_LIBS(gss_wrap, [ 
    gss_wrap (NULL, GSS_C_NO_CONTEXT, 0, GSS_C_QOP_DEFAULT, 
              GSS_C_NO_BUFFER, NULL, GSS_C_NO_BUFFER); 
  ], gssapi gssapiv2 gssapi_krb5 gssapi32 gssglue gss, [ 
    AC_DEFINE(HAVE_GSSAPI,, [Defined if GSSAPI works.]) 
    PIKE_FEATURE(GSSAPI, [yes ($pike_cv_search_gss_wrap)]) 
  ]) 
 
  AC_CHECK_FUNCS(gss_inquire_mechs_for_name) 
 
  dnl PIKE_CHECK_GSS_OID(OID) 
  AC_DEFUN([PIKE_CHECK_GSS_OID], [ 
    AC_MSG_CHECKING([for OID $1]) 
    AC_CACHE_VAL(pike_cv_have_oid_$1, [ 
      AC_TRY_LINK([ 
#ifdef HAVE_GSSAPI_GSSAPI_H 
#include <gssapi/gssapi.h> 
#elif defined(HAVE_GSSAPI_H) 
#include <gssapi.h> 
#elif defined(HAVE_GSSGLUE_GSSAPI_GSSAPI_H) 
#include <gssglue/gssapi/gssapi.h> 
#endif 
#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H 
#include <gssapi/gssapi_krb5.h> 
#elif defined(HAVE_GSSAPI_KRB5_H) 
#include <gssapi_krb5.h> 
#elif defined(HAVE_GSSGLUE_GSSAPI_GSSAPI_KRB5_H) 
#include <gssglue/gssapi/gssapi_krb5.h> 
#endif 
      ], [ 
        const gss_OID_desc *desc = $1; 
        return 0; 
      ], [ 
        pike_cv_have_oid_$1=yes 
      ], [ 
        pike_cv_have_oid_$1=no 
      ]) 
    ]) 
    if test "$pike_cv_have_oid_$1" = "yes"; then 
      AC_MSG_RESULT(yes) 
      AC_DEFINE(HAVE_$1,, [Define if you have the OID $1.]) 
    else 
      AC_MSG_RESULT(no) 
    fi 
  ]) 
 
  if test "$ac_cv_header_gssapi_krb5_h:$ac_cv_header_gssapi_gssapi_krb5_h:$ac_cv_header_gssglue_gssapi_gssapi_krb5_h" = "no:no:no"; then 
    PIKE_CHECK_GSS_OID(GSS_KRB5_NT_PRINCIPAL_NAME) 
  else 
    # NB: On FreeBSD 10.3 -lgssapi contains gss_wrap(), but 
    #     the definitions for GSS_KRB5_NT_PRINCIPAL_NAME are 
    #     in -lgssapi_krb5 (which doesn't contain gss_wrap()). 
    AC_CHECK_LIB(gssapi_krb5, main) 
  fi 
  PIKE_CHECK_GSS_OID(GSS_C_NT_USER_NAME) 
  PIKE_CHECK_GSS_OID(GSS_C_NT_MACHINE_UID_NAME) 
  PIKE_CHECK_GSS_OID(GSS_C_NT_STRING_UID_NAME) 
  PIKE_CHECK_GSS_OID(GSS_C_NT_HOSTBASED_SERVICE) 
  PIKE_CHECK_GSS_OID(GSS_C_NT_ANONYMOUS) 
  PIKE_CHECK_GSS_OID(GSS_C_NT_EXPORT_NAME) 
fi 
 
fi 
 
AC_OUTPUT(Makefile, test -z "$CONFIG_HEADERS" || echo FOO >stamp-h)