2 dnl GSSAPI/Kerberos library detection for CUPS.
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 2006-2007 by Easy Software Products.
7 dnl This file contains Kerberos support code, copyright 2006 by
10 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
13 AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
18 if 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
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
28 LIBGSSAPI="$LIBGSSAPI -weak_framework GSS"
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`")
42 # Other platforms just ask for GSSAPI
43 CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS"
44 CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS"
45 LIBGSSAPI="`$KRB5CONFIG --libs gssapi`"
48 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
50 # Check for vendor-specific implementations...
51 case "$host_os_name" in
53 AC_CHECK_LIB(gss, gss_display_status,
54 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
55 LIBGSSAPI="-lgss -lgssapi_krb5")
58 AC_CHECK_LIB(gss, gss_display_status,
59 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
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))
72 AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H))
73 AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H))
77 LIBS="$LIBS $LIBGSSAPI"
79 AC_CHECK_FUNC(__ApplePrivate_gss_acquire_cred_ex_f,
80 AC_DEFINE(HAVE_GSS_ACQUIRE_CRED_EX_F))
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)
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)
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)
107 dnl Default GSS service name...
108 AC_ARG_WITH(gssservicename, [ --with-gssservicename set default gss service name],
109 default_gssservicename="$withval",
110 default_gssservicename="default")
112 if test x$default_gssservicename != xno; then
113 if test "x$default_gssservicename" = "xdefault"; then
114 CUPS_DEFAULT_GSSSERVICENAME="host"
116 CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
119 CUPS_DEFAULT_GSSSERVICENAME=""
122 AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME)
123 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")