2 dnl TLS stuff for CUPS.
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
10 AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
11 AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
12 AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
17 CUPS_SERVERKEYCHAIN=""
19 if test x$enable_ssl != xno; then
21 if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
22 if test $host_os_name = darwin; then
23 AC_CHECK_HEADER(Security/SecureTransport.h, [
26 AC_DEFINE(HAVE_CDSASSL)
27 CUPS_SERVERKEYCHAIN="/Library/Keychains/System.keychain"
29 dnl Check for the various security headers...
30 AC_CHECK_HEADER(Security/SecureTransportPriv.h,
31 AC_DEFINE(HAVE_SECURETRANSPORTPRIV_H))
32 AC_CHECK_HEADER(Security/SecCertificate.h,
33 AC_DEFINE(HAVE_SECCERTIFICATE_H))
34 AC_CHECK_HEADER(Security/SecItem.h,
35 AC_DEFINE(HAVE_SECITEM_H))
36 AC_CHECK_HEADER(Security/SecItemPriv.h,
37 AC_DEFINE(HAVE_SECITEMPRIV_H),,
38 [#include <Security/SecItem.h>])
39 AC_CHECK_HEADER(Security/SecPolicy.h,
40 AC_DEFINE(HAVE_SECPOLICY_H))
41 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
42 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
43 AC_CHECK_HEADER(Security/SecBasePriv.h,
44 AC_DEFINE(HAVE_SECBASEPRIV_H))
45 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
46 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
48 AC_DEFINE(HAVE_CSSMERRORSTRING)
49 AC_DEFINE(HAVE_SECKEYCHAINOPEN)])
51 if test $host_os_version -ge 150; then
52 AC_DEFINE(HAVE_SSLSETENABLEDCIPHERS)
57 dnl Then look for GNU TLS...
58 if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
59 AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
60 if $PKGCONFIG --exists gnutls; then
62 SSLLIBS=`$PKGCONFIG --libs gnutls`
63 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
65 AC_DEFINE(HAVE_GNUTLS)
66 elif test "x$LIBGNUTLSCONFIG" != x; then
68 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
69 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
71 AC_DEFINE(HAVE_GNUTLS)
74 if test $have_ssl = 1; then
75 CUPS_SERVERKEYCHAIN="ssl"
79 AC_CHECK_FUNC(gnutls_transport_set_pull_timeout_function, AC_DEFINE(HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION))
80 AC_CHECK_FUNC(gnutls_priority_set_direct, AC_DEFINE(HAVE_GNUTLS_PRIORITY_SET_DIRECT))
87 if test $have_ssl = 1; then
88 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
89 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
90 IPPALIASES="http https ipps"
91 elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes; then
92 AC_MSG_ERROR([Unable to enable SSL support.])
95 AC_SUBST(CUPS_SERVERKEYCHAIN)
100 EXPORT_SSLLIBS="$SSLLIBS"
101 AC_SUBST(EXPORT_SSLLIBS)