]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-gssapi.m4
Merge pull request #5297 from FedericoYundt/patch-1
[thirdparty/cups.git] / config-scripts / cups-gssapi.m4
CommitLineData
f7deaa1a 1dnl
503b54c9 2dnl GSSAPI/Kerberos library detection for CUPS.
f7deaa1a 3dnl
105922ec 4dnl Copyright 2007-2017 by Apple Inc.
503b54c9 5dnl Copyright 2006-2007 by Easy Software Products.
f7deaa1a 6dnl
503b54c9
MS
7dnl This file contains Kerberos support code, copyright 2006 by
8dnl Jelmer Vernooij.
f7deaa1a 9dnl
e3101897 10dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
f7deaa1a 11dnl
12
bf3816c7 13AC_ARG_ENABLE(gssapi, [ --disable-gssapi disable GSSAPI support])
f7deaa1a 14
15LIBGSSAPI=""
e07d4801 16AC_SUBST(LIBGSSAPI)
f7deaa1a 17
18if test x$enable_gssapi != xno; then
cffefbac 19 AC_PATH_TOOL(KRB5CONFIG, krb5-config)
f7deaa1a 20 if test "x$KRB5CONFIG" != x; then
105922ec
MS
21 case "$host_os_name" in
22 darwin)
8072030b 23 # macOS weak-links to the Kerberos framework...
0a682745 24 LIBGSSAPI="-weak_framework Kerberos"
eac3a0a0
MS
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
0a682745 32 ;;
105922ec 33 sunos*)
0a682745
MS
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])
eac3a0a0
MS
37 CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS"
38 CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS"
0a682745
MS
39 LIBGSSAPI="-lgss `$KRB5CONFIG --libs`")
40 ;;
41 *)
42 # Other platforms just ask for GSSAPI
eac3a0a0
MS
43 CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS"
44 CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS"
0a682745
MS
45 LIBGSSAPI="`$KRB5CONFIG --libs gssapi`"
46 ;;
47 esac
f7deaa1a 48 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
49 else
09a101d6 50 # Check for vendor-specific implementations...
105922ec
MS
51 case "$host_os_name" in
52 hp-ux*)
09a101d6 53 AC_CHECK_LIB(gss, gss_display_status,
54 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
55 LIBGSSAPI="-lgss -lgssapi_krb5")
56 ;;
105922ec 57 sunos*)
09a101d6 58 AC_CHECK_LIB(gss, gss_display_status,
59 AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available])
60 LIBGSSAPI="-lgss")
61 ;;
62 esac
f7deaa1a 63 fi
64
65 if test "x$LIBGSSAPI" != x; then
66 AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H))
eac3a0a0 67 if test -d /System/Library/Frameworks/GSS.framework; then
5ec1fd3d
MS
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))
eac3a0a0
MS
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))
eac3a0a0 74 fi
f7deaa1a 75
76 SAVELIBS="$LIBS"
77 LIBS="$LIBS $LIBGSSAPI"
78
eac3a0a0
MS
79 AC_CHECK_FUNC(__ApplePrivate_gss_acquire_cred_ex_f,
80 AC_DEFINE(HAVE_GSS_ACQUIRE_CRED_EX_F))
f7deaa1a 81
82 AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
eac3a0a0 83 if test x$ac_cv_header_gssapi_gssapi_h = xyes; then
f7deaa1a 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))
eac3a0a0
MS
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))
f7deaa1a 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"
f7deaa1a 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
68b10830 114 CUPS_DEFAULT_GSSSERVICENAME="host"
f7deaa1a 115 else
116 CUPS_DEFAULT_GSSSERVICENAME="$default_gssservicename"
117 fi
118else
119 CUPS_DEFAULT_GSSSERVICENAME=""
120fi
121
dcb445bc 122AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME)
f7deaa1a 123AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")