]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-ssl.m4
Merge pull request #5297 from FedericoYundt/patch-1
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
1 dnl
2 dnl TLS stuff for CUPS.
3 dnl
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
6 dnl
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8 dnl
9
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])
13
14 SSLFLAGS=""
15 SSLLIBS=""
16 have_ssl=0
17 CUPS_SERVERKEYCHAIN=""
18
19 if test x$enable_ssl != xno; then
20 dnl Look for CDSA...
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, [
24 have_ssl=1
25 AC_DEFINE(HAVE_SSL)
26 AC_DEFINE(HAVE_CDSASSL)
27 CUPS_SERVERKEYCHAIN="/Library/Keychains/System.keychain"
28
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))
47
48 AC_DEFINE(HAVE_CSSMERRORSTRING)
49 AC_DEFINE(HAVE_SECKEYCHAINOPEN)])
50
51 if test $host_os_version -ge 150; then
52 AC_DEFINE(HAVE_SSLSETENABLEDCIPHERS)
53 fi
54 fi
55 fi
56
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
61 have_ssl=1
62 SSLLIBS=`$PKGCONFIG --libs gnutls`
63 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
64 AC_DEFINE(HAVE_SSL)
65 AC_DEFINE(HAVE_GNUTLS)
66 elif test "x$LIBGNUTLSCONFIG" != x; then
67 have_ssl=1
68 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
69 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
70 AC_DEFINE(HAVE_SSL)
71 AC_DEFINE(HAVE_GNUTLS)
72 fi
73
74 if test $have_ssl = 1; then
75 CUPS_SERVERKEYCHAIN="ssl"
76
77 SAVELIBS="$LIBS"
78 LIBS="$LIBS $SSLLIBS"
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))
81 LIBS="$SAVELIBS"
82 fi
83 fi
84 fi
85
86 IPPALIASES="http"
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.])
93 fi
94
95 AC_SUBST(CUPS_SERVERKEYCHAIN)
96 AC_SUBST(IPPALIASES)
97 AC_SUBST(SSLFLAGS)
98 AC_SUBST(SSLLIBS)
99
100 EXPORT_SSLLIBS="$SSLLIBS"
101 AC_SUBST(EXPORT_SSLLIBS)