]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | dnl |
75bd9771 | 2 | dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $" |
ef416fc2 | 3 | dnl |
f8b3a85b | 4 | dnl OpenSSL/GNUTLS stuff for CUPS. |
ef416fc2 | 5 | dnl |
0268488e | 6 | dnl Copyright 2007-2011 by Apple Inc. |
b86bc4cf | 7 | dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 8 | dnl |
9 | dnl These coded instructions, statements, and computer programs are the | |
bc44d920 | 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/". | |
ef416fc2 | 14 | dnl |
15 | ||
bf3816c7 | 16 | AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support]) |
ef416fc2 | 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 | AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third]) | |
20 | AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library], | |
21 | LDFLAGS="-L$withval $LDFLAGS" | |
22 | DSOFLAGS="-L$withval $DSOFLAGS",) | |
23 | AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes], | |
24 | CFLAGS="-I$withval $CFLAGS" | |
ef416fc2 | 25 | CPPFLAGS="-I$withval $CPPFLAGS",) |
26 | ||
27 | SSLFLAGS="" | |
28 | SSLLIBS="" | |
f8b3a85b | 29 | have_ssl=0 |
ef416fc2 | 30 | |
31 | if 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 | ||
82f97232 MS |
59 | dnl Check for SecCertificateCopyData.. |
60 | AC_MSG_CHECKING(for SecCertificateCopyData) | |
61 | if test $uversion -ge 100; then | |
62 | AC_DEFINE(HAVE_SECCERTIFICATECOPYDATA) | |
63 | AC_MSG_RESULT(yes) | |
64 | else | |
65 | AC_MSG_RESULT(no) | |
66 | fi | |
67 | ||
b86bc4cf | 68 | dnl Check for SecIdentitySearchCreateWithPolicy... |
69 | AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy) | |
70 | if test $uversion -ge 80; then | |
71 | AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY) | |
72 | AC_MSG_RESULT(yes) | |
73 | else | |
74 | AC_MSG_RESULT(no) | |
c7017ecc MS |
75 | fi |
76 | ||
77 | dnl Check for SecPolicyCreateSSL... | |
78 | AC_MSG_CHECKING(for SecPolicyCreateSSL) | |
7cf5915e | 79 | if test $uversion -ge 110; then |
c7017ecc MS |
80 | AC_DEFINE(HAVE_SECPOLICYCREATESSL) |
81 | AC_MSG_RESULT(yes) | |
82 | else | |
83 | AC_MSG_RESULT(no) | |
b86bc4cf | 84 | fi]) |
7cf5915e MS |
85 | |
86 | AC_DEFINE(HAVE_CSSMERRORSTRING) | |
ef416fc2 | 87 | fi |
88 | fi | |
89 | ||
90 | dnl Then look for GNU TLS... | |
0268488e | 91 | if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then |
f301802f | 92 | AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config) |
6d2f911b | 93 | AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config) |
f11a948a | 94 | if $PKGCONFIG --exists gnutls; then |
eac3a0a0 MS |
95 | have_ssl=1 |
96 | SSLLIBS=`$PKGCONFIG --libs gnutls` | |
97 | SSLFLAGS=`$PKGCONFIG --cflags gnutls` | |
98 | AC_DEFINE(HAVE_SSL) | |
99 | AC_DEFINE(HAVE_GNUTLS) | |
c7017ecc | 100 | elif test "x$LIBGNUTLSCONFIG" != x; then |
eac3a0a0 MS |
101 | have_ssl=1 |
102 | SSLLIBS=`$LIBGNUTLSCONFIG --libs` | |
103 | SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` | |
104 | AC_DEFINE(HAVE_SSL) | |
105 | AC_DEFINE(HAVE_GNUTLS) | |
6d2f911b MS |
106 | fi |
107 | ||
108 | if test $have_ssl = 1; then | |
109 | if $PKGCONFIG --exists gcrypt; then | |
110 | SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`" | |
111 | SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`" | |
c7017ecc | 112 | elif test "x$LIBGCRYPTCONFIG" != x; then |
6d2f911b MS |
113 | SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`" |
114 | SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`" | |
115 | fi | |
f301802f | 116 | fi |
ef416fc2 | 117 | fi |
118 | ||
119 | dnl Check for the OpenSSL library last... | |
0268488e | 120 | if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then |
ef416fc2 | 121 | AC_CHECK_HEADER(openssl/ssl.h, |
122 | dnl Save the current libraries so the crypto stuff isn't always | |
123 | dnl included... | |
124 | SAVELIBS="$LIBS" | |
125 | ||
126 | dnl Some ELF systems can't resolve all the symbols in libcrypto | |
127 | dnl if libcrypto was linked against RSAREF, and fail to link the | |
128 | dnl test program correctly, even though a correct installation | |
129 | dnl of OpenSSL exists. So we test the linking three times in | |
130 | dnl case the RSAREF libraries are needed. | |
131 | ||
132 | for libcrypto in \ | |
133 | "-lcrypto" \ | |
134 | "-lcrypto -lrsaref" \ | |
135 | "-lcrypto -lRSAglue -lrsaref" | |
136 | do | |
137 | AC_CHECK_LIB(ssl,SSL_new, | |
f8b3a85b MS |
138 | [have_ssl=1 |
139 | SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT" | |
ef416fc2 | 140 | SSLLIBS="-lssl $libcrypto" |
141 | AC_DEFINE(HAVE_SSL) | |
142 | AC_DEFINE(HAVE_LIBSSL)],, | |
143 | $libcrypto) | |
144 | ||
145 | if test "x${SSLLIBS}" != "x"; then | |
146 | break | |
147 | fi | |
148 | done | |
149 | ||
150 | LIBS="$SAVELIBS") | |
151 | fi | |
152 | fi | |
153 | ||
eac3a0a0 | 154 | IPPALIASES="http" |
f8b3a85b | 155 | if test $have_ssl = 1; then |
f301802f | 156 | AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"]) |
157 | AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"]) | |
eac3a0a0 | 158 | IPPALIASES="http https ipps" |
0268488e MS |
159 | elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = xyes; then |
160 | AC_MSG_ERROR([Unable to enable SSL support.]) | |
f301802f | 161 | fi |
162 | ||
eac3a0a0 | 163 | AC_SUBST(IPPALIASES) |
ef416fc2 | 164 | AC_SUBST(SSLFLAGS) |
165 | AC_SUBST(SSLLIBS) | |
166 | ||
167 | EXPORT_SSLLIBS="$SSLLIBS" | |
168 | AC_SUBST(EXPORT_SSLLIBS) | |
169 | ||
170 | ||
171 | dnl | |
75bd9771 | 172 | dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $". |
ef416fc2 | 173 | dnl |