]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.6svn-r10510.
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
CommitLineData
ef416fc2 1dnl
75bd9771 2dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
ef416fc2 3dnl
f8b3a85b 4dnl OpenSSL/GNUTLS stuff for CUPS.
ef416fc2 5dnl
82cc1f9a 6dnl Copyright 2007-2012 by Apple Inc.
b86bc4cf 7dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8dnl
9dnl These coded instructions, statements, and computer programs are the
bc44d920 10dnl property of Apple Inc. and are protected by Federal copyright
11dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
12dnl which should have been included with this file. If this file is
13dnl file is missing or damaged, see the license at "http://www.cups.org/".
ef416fc2 14dnl
15
bf3816c7 16AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
ef416fc2 17AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
18AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
19AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
20AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
21 LDFLAGS="-L$withval $LDFLAGS"
22 DSOFLAGS="-L$withval $DSOFLAGS",)
23AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes],
24 CFLAGS="-I$withval $CFLAGS"
ef416fc2 25 CPPFLAGS="-I$withval $CPPFLAGS",)
26
27SSLFLAGS=""
28SSLLIBS=""
f8b3a85b 29have_ssl=0
ef416fc2 30
31if test x$enable_ssl != xno; then
32 dnl Look for CDSA...
0268488e 33 if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
ef416fc2 34 if test $uname = Darwin; then
b86bc4cf 35 AC_CHECK_HEADER(Security/SecureTransport.h, [
f8b3a85b 36 have_ssl=1
b86bc4cf 37 AC_DEFINE(HAVE_SSL)
38 AC_DEFINE(HAVE_CDSASSL)
39
40 dnl Check for the various security headers...
eac3a0a0
MS
41 AC_CHECK_HEADER(Security/SecureTransportPriv.h,
42 AC_DEFINE(HAVE_SECURETRANSPORTPRIV_H))
7cf5915e
MS
43 AC_CHECK_HEADER(Security/SecCertificate.h,
44 AC_DEFINE(HAVE_SECCERTIFICATE_H))
0268488e
MS
45 AC_CHECK_HEADER(Security/SecItem.h,
46 AC_DEFINE(HAVE_SECITEM_H))
c7017ecc 47 AC_CHECK_HEADER(Security/SecItemPriv.h,
eac3a0a0
MS
48 AC_DEFINE(HAVE_SECITEMPRIV_H),,
49 [#include <Security/SecItem.h>])
b86bc4cf 50 AC_CHECK_HEADER(Security/SecPolicy.h,
51 AC_DEFINE(HAVE_SECPOLICY_H))
52 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
53 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
54 AC_CHECK_HEADER(Security/SecBasePriv.h,
55 AC_DEFINE(HAVE_SECBASEPRIV_H))
56 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
57 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
58
771bd8cb
MS
59 dnl Check for SSLSetProtocolVersionMax...
60 SAVELIBS="$LIBS"
61 LIBS="$LIBS -framework Security"
62 AC_CHECK_FUNC(SSLSetProtocolVersionMax)
63 LIBS="$SAVELIBS"
64
82f97232
MS
65 dnl Check for SecCertificateCopyData..
66 AC_MSG_CHECKING(for SecCertificateCopyData)
67 if test $uversion -ge 100; then
68 AC_DEFINE(HAVE_SECCERTIFICATECOPYDATA)
69 AC_MSG_RESULT(yes)
70 else
71 AC_MSG_RESULT(no)
72 fi
73
b86bc4cf 74 dnl Check for SecIdentitySearchCreateWithPolicy...
75 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
76 if test $uversion -ge 80; then
77 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
78 AC_MSG_RESULT(yes)
79 else
80 AC_MSG_RESULT(no)
c7017ecc
MS
81 fi
82
83 dnl Check for SecPolicyCreateSSL...
84 AC_MSG_CHECKING(for SecPolicyCreateSSL)
7cf5915e 85 if test $uversion -ge 110; then
c7017ecc
MS
86 AC_DEFINE(HAVE_SECPOLICYCREATESSL)
87 AC_MSG_RESULT(yes)
88 else
89 AC_MSG_RESULT(no)
b86bc4cf 90 fi])
7cf5915e
MS
91
92 AC_DEFINE(HAVE_CSSMERRORSTRING)
ef416fc2 93 fi
94 fi
95
96 dnl Then look for GNU TLS...
0268488e 97 if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
f301802f 98 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
6d2f911b 99 AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
f11a948a 100 if $PKGCONFIG --exists gnutls; then
eac3a0a0
MS
101 have_ssl=1
102 SSLLIBS=`$PKGCONFIG --libs gnutls`
103 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
104 AC_DEFINE(HAVE_SSL)
105 AC_DEFINE(HAVE_GNUTLS)
c7017ecc 106 elif test "x$LIBGNUTLSCONFIG" != x; then
eac3a0a0
MS
107 have_ssl=1
108 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
109 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
110 AC_DEFINE(HAVE_SSL)
111 AC_DEFINE(HAVE_GNUTLS)
6d2f911b
MS
112 fi
113
114 if test $have_ssl = 1; then
115 if $PKGCONFIG --exists gcrypt; then
116 SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
117 SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
c7017ecc 118 elif test "x$LIBGCRYPTCONFIG" != x; then
6d2f911b
MS
119 SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
120 SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
121 fi
f301802f 122 fi
ef416fc2 123 fi
124
125 dnl Check for the OpenSSL library last...
0268488e 126 if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then
a29fd7dd 127 AC_CHECK_HEADER(openssl/ssl.h,[
ef416fc2 128 dnl Save the current libraries so the crypto stuff isn't always
129 dnl included...
130 SAVELIBS="$LIBS"
131
132 dnl Some ELF systems can't resolve all the symbols in libcrypto
133 dnl if libcrypto was linked against RSAREF, and fail to link the
134 dnl test program correctly, even though a correct installation
135 dnl of OpenSSL exists. So we test the linking three times in
136 dnl case the RSAREF libraries are needed.
137
138 for libcrypto in \
82cc1f9a
MS
139 "-lcrypto" \
140 "-lcrypto -lrsaref" \
141 "-lcrypto -lRSAglue -lrsaref"
ef416fc2 142 do
143 AC_CHECK_LIB(ssl,SSL_new,
f8b3a85b
MS
144 [have_ssl=1
145 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
ef416fc2 146 SSLLIBS="-lssl $libcrypto"
147 AC_DEFINE(HAVE_SSL)
148 AC_DEFINE(HAVE_LIBSSL)],,
149 $libcrypto)
150
151 if test "x${SSLLIBS}" != "x"; then
152 break
153 fi
154 done
155
a29fd7dd
MS
156 if test "x${SSLLIBS}" != "x"; then
157 LIBS="$SAVELIBS $SSLLIBS"
158 AC_CHECK_FUNCS(SSL_set_tlsext_host_name)
159 fi
160
161 LIBS="$SAVELIBS"])
ef416fc2 162 fi
163fi
164
eac3a0a0 165IPPALIASES="http"
f8b3a85b 166if test $have_ssl = 1; then
f301802f 167 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
168 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
eac3a0a0 169 IPPALIASES="http https ipps"
0268488e
MS
170elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = xyes; then
171 AC_MSG_ERROR([Unable to enable SSL support.])
f301802f 172fi
173
eac3a0a0 174AC_SUBST(IPPALIASES)
ef416fc2 175AC_SUBST(SSLFLAGS)
176AC_SUBST(SSLLIBS)
177
178EXPORT_SSLLIBS="$SSLLIBS"
179AC_SUBST(EXPORT_SSLLIBS)
180
ef416fc2 181dnl
75bd9771 182dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
ef416fc2 183dnl