2 dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
4 dnl OpenSSL/GNUTLS stuff for CUPS.
6 dnl Copyright 2007-2010 by Apple Inc.
7 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
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 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"
25 CPPFLAGS="-I$withval $CPPFLAGS",)
31 if test x$enable_ssl != xno; then
33 if test $have_ssl = 0 -a "x${enable_cdsassl}" != "xno"; then
34 if test $uname = Darwin; then
35 AC_CHECK_HEADER(Security/SecureTransport.h, [
38 AC_DEFINE(HAVE_CDSASSL)
40 dnl Check for the various security headers...
41 AC_CHECK_HEADER(Security/SecItemPriv.h,
42 AC_DEFINE(HAVE_SECITEMPRIV_H))
43 AC_CHECK_HEADER(Security/SecPolicy.h,
44 AC_DEFINE(HAVE_SECPOLICY_H))
45 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
46 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
47 AC_CHECK_HEADER(Security/SecBasePriv.h,
48 AC_DEFINE(HAVE_SECBASEPRIV_H))
49 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
50 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
52 dnl Check for SecIdentitySearchCreateWithPolicy...
53 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
54 if test $uversion -ge 80; then
55 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
61 dnl Check for SecPolicyCreateSSL...
62 AC_MSG_CHECKING(for SecPolicyCreateSSL)
63 if test $uversion -ge 100; then
64 AC_DEFINE(HAVE_SECPOLICYCREATESSL)
72 dnl Then look for GNU TLS...
73 if test $have_ssl = 0 -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
74 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
75 AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
76 if $PKGCONFIG --exists gnutls; then
77 if test "x$have_pthread" = xyes; then
78 AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
81 SSLLIBS=`$PKGCONFIG --libs gnutls`
82 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
84 AC_DEFINE(HAVE_GNUTLS)
86 elif test "x$LIBGNUTLSCONFIG" != x; then
87 if test "x$have_pthread" = xyes; then
88 AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
91 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
92 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
94 AC_DEFINE(HAVE_GNUTLS)
98 if test $have_ssl = 1; then
99 if $PKGCONFIG --exists gcrypt; then
100 SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
101 SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
102 elif test "x$LIBGCRYPTCONFIG" != x; then
103 SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
104 SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
109 dnl Check for the OpenSSL library last...
110 if test $have_ssl = 0 -a "x${enable_openssl}" != "xno"; then
111 AC_CHECK_HEADER(openssl/ssl.h,
112 dnl Save the current libraries so the crypto stuff isn't always
116 dnl Some ELF systems can't resolve all the symbols in libcrypto
117 dnl if libcrypto was linked against RSAREF, and fail to link the
118 dnl test program correctly, even though a correct installation
119 dnl of OpenSSL exists. So we test the linking three times in
120 dnl case the RSAREF libraries are needed.
124 "-lcrypto -lrsaref" \
125 "-lcrypto -lRSAglue -lrsaref"
127 AC_CHECK_LIB(ssl,SSL_new,
129 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
130 SSLLIBS="-lssl $libcrypto"
132 AC_DEFINE(HAVE_LIBSSL)],,
135 if test "x${SSLLIBS}" != "x"; then
144 if test $have_ssl = 1; then
145 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
146 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
152 EXPORT_SSLLIBS="$SSLLIBS"
153 AC_SUBST(EXPORT_SSLLIBS)
157 dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".