]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-ssl.m4
The cups-files.conf file contained the old ServerCertificate/Key directives
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
1 dnl
2 dnl "$Id$"
3 dnl
4 dnl TLS stuff for CUPS.
5 dnl
6 dnl Copyright 2007-2014 by Apple Inc.
7 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 dnl
9 dnl These coded instructions, statements, and computer programs are the
10 dnl property of Apple Inc. and are protected by Federal copyright
11 dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 dnl which should have been included with this file. If this file is
13 dnl file is missing or damaged, see the license at "http://www.cups.org/".
14 dnl
15
16 AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
17 AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
18 AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
19
20 SSLFLAGS=""
21 SSLLIBS=""
22 have_ssl=0
23 CUPS_SERVERKEYCHAIN=""
24
25 if test x$enable_ssl != xno; then
26 dnl Look for CDSA...
27 if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
28 if test $uname = Darwin; then
29 AC_CHECK_HEADER(Security/SecureTransport.h, [
30 have_ssl=1
31 AC_DEFINE(HAVE_SSL)
32 AC_DEFINE(HAVE_CDSASSL)
33 CUPS_SERVERKEYCHAIN="/Library/Keychains/System.keychain"
34
35 dnl Check for the various security headers...
36 AC_CHECK_HEADER(Security/SecureTransportPriv.h,
37 AC_DEFINE(HAVE_SECURETRANSPORTPRIV_H))
38 AC_CHECK_HEADER(Security/SecCertificate.h,
39 AC_DEFINE(HAVE_SECCERTIFICATE_H))
40 AC_CHECK_HEADER(Security/SecItem.h,
41 AC_DEFINE(HAVE_SECITEM_H))
42 AC_CHECK_HEADER(Security/SecItemPriv.h,
43 AC_DEFINE(HAVE_SECITEMPRIV_H),,
44 [#include <Security/SecItem.h>])
45 AC_CHECK_HEADER(Security/SecPolicy.h,
46 AC_DEFINE(HAVE_SECPOLICY_H))
47 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
48 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
49 AC_CHECK_HEADER(Security/SecBasePriv.h,
50 AC_DEFINE(HAVE_SECBASEPRIV_H))
51 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
52 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
53
54 AC_DEFINE(HAVE_CSSMERRORSTRING)
55 AC_DEFINE(HAVE_SECKEYCHAINOPEN)])
56 fi
57 fi
58
59 dnl Then look for GNU TLS...
60 if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
61 AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
62 AC_PATH_TOOL(LIBGCRYPTCONFIG,libgcrypt-config)
63 if $PKGCONFIG --exists gnutls; then
64 have_ssl=1
65 SSLLIBS=`$PKGCONFIG --libs gnutls`
66 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
67 AC_DEFINE(HAVE_SSL)
68 AC_DEFINE(HAVE_GNUTLS)
69 elif test "x$LIBGNUTLSCONFIG" != x; then
70 have_ssl=1
71 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
72 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
73 AC_DEFINE(HAVE_SSL)
74 AC_DEFINE(HAVE_GNUTLS)
75 fi
76
77 if test $have_ssl = 1; then
78 CUPS_SERVERKEYCHAIN="ssl"
79
80 SAVELIBS="$LIBS"
81 LIBS="$LIBS $SSLLIBS"
82 AC_CHECK_FUNC(gnutls_transport_set_pull_timeout_function, AC_DEFINE(HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION))
83 AC_CHECK_FUNC(gnutls_priority_set_direct, AC_DEFINE(HAVE_GNUTLS_PRIORITY_SET_DIRECT))
84 LIBS="$SAVELIBS"
85 fi
86 fi
87 fi
88
89 IPPALIASES="http"
90 if test $have_ssl = 1; then
91 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
92 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
93 IPPALIASES="http https ipps"
94 elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes; then
95 AC_MSG_ERROR([Unable to enable SSL support.])
96 fi
97
98 AC_SUBST(CUPS_SERVERKEYCHAIN)
99 AC_SUBST(IPPALIASES)
100 AC_SUBST(SSLFLAGS)
101 AC_SUBST(SSLLIBS)
102
103 EXPORT_SSLLIBS="$SSLLIBS"
104 AC_SUBST(EXPORT_SSLLIBS)
105
106 dnl
107 dnl End of "$Id$".
108 dnl