2 dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
4 dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
6 dnl Copyright 2007-2008 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, [ --enable-ssl turn on SSL/TLS support, default=yes])
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",)
29 ENCRYPTION_REQUIRED=""
31 if test x$enable_ssl != xno; then
33 if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
34 if test $uname = Darwin; then
35 AC_CHECK_HEADER(Security/SecureTransport.h, [
36 SSLLIBS="-framework CoreFoundation -framework Security"
37 # MacOS X doesn't (yet) come with pre-installed encryption
38 # certificates for CUPS, so don't enable encryption on
40 #ENCRYPTION_REQUIRED=" Encryption Required"
42 AC_DEFINE(HAVE_CDSASSL)
44 dnl Check for the various security headers...
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))
54 dnl Check for SecIdentitySearchCreateWithPolicy...
55 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
56 if test $uversion -ge 80; then
57 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
65 dnl Then look for GNU TLS...
66 if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
67 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
68 if test "x$LIBGNUTLSCONFIG" != x; then
69 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
70 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
71 ENCRYPTION_REQUIRED=" Encryption Required"
73 AC_DEFINE(HAVE_GNUTLS)
77 dnl Check for the OpenSSL library last...
78 if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
79 AC_CHECK_HEADER(openssl/ssl.h,
80 dnl Save the current libraries so the crypto stuff isn't always
84 dnl Some ELF systems can't resolve all the symbols in libcrypto
85 dnl if libcrypto was linked against RSAREF, and fail to link the
86 dnl test program correctly, even though a correct installation
87 dnl of OpenSSL exists. So we test the linking three times in
88 dnl case the RSAREF libraries are needed.
93 "-lcrypto -lRSAglue -lrsaref"
95 AC_CHECK_LIB(ssl,SSL_new,
96 [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
97 SSLLIBS="-lssl $libcrypto"
98 ENCRYPTION_REQUIRED=" Encryption Required"
100 AC_DEFINE(HAVE_LIBSSL)],,
103 if test "x${SSLLIBS}" != "x"; then
112 if test "x$SSLLIBS" != x; then
113 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
114 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
119 AC_SUBST(ENCRYPTION_REQUIRED)
121 EXPORT_SSLLIBS="$SSLLIBS"
122 AC_SUBST(EXPORT_SSLLIBS)
126 dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".