0116202008-07-22Martin Stjernholm  AC_INIT(gssapi.cmod) AC_CONFIG_HEADER(gssapi_config.h) AC_MODULE_INIT()
950df52008-08-18Stephen R. van den Berg PIKE_FEATURE_WITHOUT(GSSAPI) AC_ARG_WITH(gssapi, [ --with(out)-gssapi GSS-API support], [],[with_gssapi=yes]) if test x$with_gssapi = xyes; then
890ee52008-07-31Martin Stjernholm 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)
0116202008-07-22Martin Stjernholm 
890ee52008-07-31Martin Stjernholm 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)])
0116202008-07-22Martin Stjernholm 
890ee52008-07-31Martin Stjernholm  # 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);
417ac82011-07-13Marcus Comstedt  ], gssapi gssapiv2 gssapi_krb5 gssapi32 gssglue gss, [
890ee52008-07-31Martin Stjernholm  AC_DEFINE(HAVE_GSSAPI,, [Defined if GSSAPI works.]) PIKE_FEATURE(GSSAPI, [yes ($pike_cv_search_gss_wrap)]) ])
0116202008-07-22Martin Stjernholm 
890ee52008-07-31Martin Stjernholm  AC_CHECK_FUNCS(gss_inquire_mechs_for_name)
7617202008-07-23Henrik Grubbström (Grubba) 
890ee52008-07-31Martin Stjernholm  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([
3c665a2015-06-03Henrik Grubbström (Grubba) #ifdef HAVE_GSSAPI_GSSAPI_H
7617202008-07-23Henrik Grubbström (Grubba) #include <gssapi/gssapi.h>
3c665a2015-06-03Henrik Grubbström (Grubba) #elif defined(HAVE_GSSAPI_H) #include <gssapi.h>
7617202008-07-23Henrik Grubbström (Grubba) #elif defined(HAVE_GSSGLUE_GSSAPI_GSSAPI_H) #include <gssglue/gssapi/gssapi.h> #endif
3c665a2015-06-03Henrik Grubbström (Grubba) #ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
7617202008-07-23Henrik Grubbström (Grubba) #include <gssapi/gssapi_krb5.h>
3c665a2015-06-03Henrik Grubbström (Grubba) #elif defined(HAVE_GSSAPI_KRB5_H) #include <gssapi_krb5.h>
7617202008-07-23Henrik Grubbström (Grubba) #elif defined(HAVE_GSSGLUE_GSSAPI_GSSAPI_KRB5_H) #include <gssglue/gssapi/gssapi_krb5.h> #endif
890ee52008-07-31Martin Stjernholm  ], [ const gss_OID_desc *desc = $1; return 0; ], [ pike_cv_have_oid_$1=yes ], [ pike_cv_have_oid_$1=no
7617202008-07-23Henrik Grubbström (Grubba)  ]) ])
890ee52008-07-31Martin Stjernholm  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)
7617202008-07-23Henrik Grubbström (Grubba)  fi
890ee52008-07-31Martin Stjernholm  ]) 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)
12de4a2017-08-26Henrik Grubbström (Grubba)  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)
0116202008-07-22Martin Stjernholm  fi
890ee52008-07-31Martin Stjernholm  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)
0116202008-07-22Martin Stjernholm fi
950df52008-08-18Stephen R. van den Berg fi
7617202008-07-23Henrik Grubbström (Grubba) AC_OUTPUT(Makefile, test -z "$CONFIG_HEADERS" || echo FOO >stamp-h)