1dnl 2dnl GSSAPI/Kerberos library detection for CUPS. 3dnl 4dnl Copyright 2007-2017 by Apple Inc. 5dnl Copyright 2006-2007 by Easy Software Products. 6dnl 7dnl This file contains Kerberos support code, copyright 2006 by 8dnl Jelmer Vernooij. 9dnl 10dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information. 11dnl 12 13AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support]) 14 15LIBGSSAPI="" 16AC_SUBST(LIBGSSAPI) 17 18if test x$enable_gssapi != xno; then 19 AC_PATH_TOOL(KRB5CONFIG, krb5-config) 20 if test "x$KRB5CONFIG" != x; then 21 case "$host_os_name" in 22 darwin) 23 # macOS weak-links to the Kerberos framework... 24 LIBGSSAPI="-weak_framework Kerberos" 25 AC_MSG_CHECKING(for GSS framework) 26 if test -d /System/Library/Frameworks/GSS.framework; then 27 AC_MSG_RESULT(yes) 28 LIBGSSAPI="$LIBGSSAPI -weak_framework GSS" 29 else 30 AC_MSG_RESULT(no) 31 fi 32 ;; 33 sunos*) 34 # Solaris has a non-standard krb5-config, don't use it! 35 AC_CHECK_LIB(gss, gss_display_status, 36 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) 37 CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS" 38 CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS" 39 LIBGSSAPI="-lgss `$KRB5CONFIG --libs`") 40 ;; 41 *) 42 # Other platforms just ask for GSSAPI 43 CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS" 44 CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS" 45 LIBGSSAPI="`$KRB5CONFIG --libs gssapi`" 46 ;; 47 esac 48 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) 49 else 50 # Check for vendor-specific implementations... 51 case "$host_os_name" in 52 hp-ux*) 53 AC_CHECK_LIB(gss, gss_display_status, 54 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) 55 LIBGSSAPI="-lgss -lgssapi_krb5") 56 ;; 57 sunos*) 58 AC_CHECK_LIB(gss, gss_display_status, 59 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) 60 LIBGSSAPI="-lgss") 61 ;; 62 esac 63 fi 64 65 if test "x$LIBGSSAPI" != x; then 66 AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H)) 67 if test -d /System/Library/Frameworks/GSS.framework; then 68 AC_CHECK_HEADER(GSS/gssapi.h, AC_DEFINE(HAVE_GSS_GSSAPI_H)) 69 AC_CHECK_HEADER(GSS/gssapi_generic.h, AC_DEFINE(HAVE_GSS_GSSAPI_GENERIC_H)) 70 AC_CHECK_HEADER(GSS/gssapi_spi.h, AC_DEFINE(HAVE_GSS_GSSAPI_SPI_H)) 71 else 72 AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H)) 73 AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H)) 74 fi 75 76 SAVELIBS="$LIBS" 77 LIBS="$LIBS $LIBGSSAPI" 78 79 AC_CHECK_FUNC(__ApplePrivate_gss_acquire_cred_ex_f, 80 AC_DEFINE(HAVE_GSS_ACQUIRE_CRED_EX_F)) 81 82 AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE) 83 if test x$ac_cv_header_gssapi_gssapi_h = xyes; then 84 AC_TRY_COMPILE([ #include <gssapi/gssapi.h> ], 85 [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], 86 AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE) 87 AC_MSG_RESULT(yes), 88 AC_MSG_RESULT(no)) 89 elif test x$ac_cv_header_gss_gssapi_h = xyes; then 90 AC_TRY_COMPILE([ #include <GSS/gssapi.h> ], 91 [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], 92 AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE) 93 AC_MSG_RESULT(yes), 94 AC_MSG_RESULT(no)) 95 else 96 AC_TRY_COMPILE([ #include <gssapi.h> ], 97 [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], 98 AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE) 99 AC_MSG_RESULT(yes), 100 AC_MSG_RESULT(no)) 101 fi 102 103 LIBS="$SAVELIBS" 104 fi 105fi 106 107dnl Default GSS service name... 108AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service name], 109 default_gssservicename="$withval", 110 default_gssservicename="default") 111 112if test x$default_gssservicename != xno; then 113 if test "x$default_gssservicename" = "xdefault"; then 114 CUPS_DEFAULT_GSSSERVICENAME="host" 115 else 116 CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename" 117 fi 118else 119 CUPS_DEFAULT_GSSSERVICENAME="" 120fi 121 122AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME) 123AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME") 124