]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-ssl.m4
Sync up IPP and HTTP conformance changes, IPP->PPD mapping changes.
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
CommitLineData
74456259 1dnl
c9d3f842 2dnl "$Id$"
74456259 3dnl
2256cc12 4dnl OpenSSL/GNUTLS stuff for CUPS.
74456259 5dnl
2256cc12 6dnl Copyright 2007-2010 by Apple Inc.
e12305dc 7dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
74456259 8dnl
9dnl These coded instructions, statements, and computer programs are the
4e8d321f 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/".
74456259 14dnl
15
275bcb9b 16AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
2c780061 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])
9aa1f763 20AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
74456259 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"
fb1d0a08 25 CPPFLAGS="-I$withval $CPPFLAGS",)
74456259 26
a603272c 27SSLFLAGS=""
74456259 28SSLLIBS=""
2256cc12 29have_ssl=0
74456259 30
31if test x$enable_ssl != xno; then
2c780061 32 dnl Look for CDSA...
2256cc12 33 if test $have_ssl = 0 -a "x${enable_cdsassl}" != "xno"; then
2c780061 34 if test $uname = Darwin; then
e12305dc 35 AC_CHECK_HEADER(Security/SecureTransport.h, [
2256cc12 36 have_ssl=1
e12305dc 37 AC_DEFINE(HAVE_SSL)
38 AC_DEFINE(HAVE_CDSASSL)
39
40 dnl Check for the various security headers...
b9738d7c 41 AC_CHECK_HEADER(Security/SecCertificate.h,
42 AC_DEFINE(HAVE_SECCERTIFICATE_H))
1e29004d 43 AC_CHECK_HEADER(Security/SecItemPriv.h,
44 AC_DEFINE(HAVE_SECITEMPRIV_H))
e12305dc 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 dnl Check for SecIdentitySearchCreateWithPolicy...
55 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
56 if test $uversion -ge 80; then
57 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
58 AC_MSG_RESULT(yes)
59 else
60 AC_MSG_RESULT(no)
1e29004d 61 fi
62
63 dnl Check for SecPolicyCreateSSL...
64 AC_MSG_CHECKING(for SecPolicyCreateSSL)
b9738d7c 65 if test $uversion -ge 110; then
1e29004d 66 AC_DEFINE(HAVE_SECPOLICYCREATESSL)
67 AC_MSG_RESULT(yes)
68 else
69 AC_MSG_RESULT(no)
e12305dc 70 fi])
b9738d7c 71
72 AC_DEFINE(HAVE_CSSMERRORSTRING)
2c780061 73 fi
74 fi
75
76 dnl Then look for GNU TLS...
2256cc12 77 if test $have_ssl = 0 -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
16568530 78 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
89813a30 79 AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
96f70a53 80 if $PKGCONFIG --exists gnutls; then
cd6de373 81 if test "x$have_pthread" = xyes; then
82 AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
83 else
84 have_ssl=1
85 SSLLIBS=`$PKGCONFIG --libs gnutls`
86 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
87 AC_DEFINE(HAVE_SSL)
88 AC_DEFINE(HAVE_GNUTLS)
89 fi
4c7343ab 90 elif test "x$LIBGNUTLSCONFIG" != x; then
cd6de373 91 if test "x$have_pthread" = xyes; then
92 AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
93 else
94 have_ssl=1
95 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
96 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
97 AC_DEFINE(HAVE_SSL)
98 AC_DEFINE(HAVE_GNUTLS)
99 fi
89813a30 100 fi
101
102 if test $have_ssl = 1; then
cd6de373 103 if $PKGCONFIG --exists gcrypt; then
89813a30 104 SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
105 SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
4c7343ab 106 elif test "x$LIBGCRYPTCONFIG" != x; then
89813a30 107 SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
108 SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
109 fi
16568530 110 fi
2c780061 111 fi
112
113 dnl Check for the OpenSSL library last...
2256cc12 114 if test $have_ssl = 0 -a "x${enable_openssl}" != "xno"; then
bcf61448 115 AC_CHECK_HEADER(openssl/ssl.h,
116 dnl Save the current libraries so the crypto stuff isn't always
117 dnl included...
118 SAVELIBS="$LIBS"
74456259 119
bcf61448 120 dnl Some ELF systems can't resolve all the symbols in libcrypto
121 dnl if libcrypto was linked against RSAREF, and fail to link the
122 dnl test program correctly, even though a correct installation
123 dnl of OpenSSL exists. So we test the linking three times in
124 dnl case the RSAREF libraries are needed.
74456259 125
bcf61448 126 for libcrypto in \
127 "-lcrypto" \
128 "-lcrypto -lrsaref" \
129 "-lcrypto -lRSAglue -lrsaref"
130 do
131 AC_CHECK_LIB(ssl,SSL_new,
2256cc12 132 [have_ssl=1
133 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
a603272c 134 SSLLIBS="-lssl $libcrypto"
bcf61448 135 AC_DEFINE(HAVE_SSL)
136 AC_DEFINE(HAVE_LIBSSL)],,
137 $libcrypto)
74456259 138
bcf61448 139 if test "x${SSLLIBS}" != "x"; then
140 break
141 fi
142 done
74456259 143
bcf61448 144 LIBS="$SAVELIBS")
145 fi
74456259 146fi
147
2256cc12 148if test $have_ssl = 1; then
16568530 149 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
150 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
151fi
152
a603272c 153AC_SUBST(SSLFLAGS)
74456259 154AC_SUBST(SSLLIBS)
155
487a6abf 156EXPORT_SSLLIBS="$SSLLIBS"
157AC_SUBST(EXPORT_SSLLIBS)
158
159
74456259 160dnl
c9d3f842 161dnl End of "$Id$".
74456259 162dnl