]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.4svn-r7696.
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
1 dnl
2 dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
3 dnl
4 dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 2007-2008 by Apple Inc.
7 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 dnl
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/".
14 dnl
15
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",)
26
27 SSLFLAGS=""
28 SSLLIBS=""
29 ENCRYPTION_REQUIRED=""
30
31 if test x$enable_ssl != xno; then
32 dnl Look for CDSA...
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
39 # /admin just yet...
40 #ENCRYPTION_REQUIRED=" Encryption Required"
41 AC_DEFINE(HAVE_SSL)
42 AC_DEFINE(HAVE_CDSASSL)
43
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))
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)
61 fi])
62 fi
63 fi
64
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"
72 AC_DEFINE(HAVE_SSL)
73 AC_DEFINE(HAVE_GNUTLS)
74 fi
75 fi
76
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
81 dnl included...
82 SAVELIBS="$LIBS"
83
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.
89
90 for libcrypto in \
91 "-lcrypto" \
92 "-lcrypto -lrsaref" \
93 "-lcrypto -lRSAglue -lrsaref"
94 do
95 AC_CHECK_LIB(ssl,SSL_new,
96 [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
97 SSLLIBS="-lssl $libcrypto"
98 ENCRYPTION_REQUIRED=" Encryption Required"
99 AC_DEFINE(HAVE_SSL)
100 AC_DEFINE(HAVE_LIBSSL)],,
101 $libcrypto)
102
103 if test "x${SSLLIBS}" != "x"; then
104 break
105 fi
106 done
107
108 LIBS="$SAVELIBS")
109 fi
110 fi
111
112 if test "x$SSLLIBS" != x; then
113 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
114 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
115 fi
116
117 AC_SUBST(SSLFLAGS)
118 AC_SUBST(SSLLIBS)
119 AC_SUBST(ENCRYPTION_REQUIRED)
120
121 EXPORT_SSLLIBS="$SSLLIBS"
122 AC_SUBST(EXPORT_SSLLIBS)
123
124
125 dnl
126 dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
127 dnl