]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.5svn-r9000.
[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 CUPS.
5 dnl
6 dnl Copyright 2007-2010 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, [ --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",)
26
27 SSLFLAGS=""
28 SSLLIBS=""
29 have_ssl=0
30
31 if test x$enable_ssl != xno; then
32 dnl Look for CDSA...
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, [
36 have_ssl=1
37 AC_DEFINE(HAVE_SSL)
38 AC_DEFINE(HAVE_CDSASSL)
39
40 dnl Check for the various security headers...
41 AC_CHECK_HEADER(Security/SecPolicy.h,
42 AC_DEFINE(HAVE_SECPOLICY_H))
43 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
44 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
45 AC_CHECK_HEADER(Security/SecBasePriv.h,
46 AC_DEFINE(HAVE_SECBASEPRIV_H))
47 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
48 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
49
50 dnl Check for SecIdentitySearchCreateWithPolicy...
51 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
52 if test $uversion -ge 80; then
53 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
54 AC_MSG_RESULT(yes)
55 else
56 AC_MSG_RESULT(no)
57 fi])
58 fi
59 fi
60
61 dnl Then look for GNU TLS...
62 if test $have_ssl = 0 -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
63 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
64 if $PKGCONFIG --exists gnutls; then
65 have_ssl=1
66 SSLLIBS=`$PKGCONFIG --libs gnutls`
67 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
68 AC_DEFINE(HAVE_SSL)
69 AC_DEFINE(HAVE_GNUTLS)
70 fi
71 fi
72
73 dnl Check for the OpenSSL library last...
74 if test $have_ssl = 0 -a "x${enable_openssl}" != "xno"; then
75 AC_CHECK_HEADER(openssl/ssl.h,
76 dnl Save the current libraries so the crypto stuff isn't always
77 dnl included...
78 SAVELIBS="$LIBS"
79
80 dnl Some ELF systems can't resolve all the symbols in libcrypto
81 dnl if libcrypto was linked against RSAREF, and fail to link the
82 dnl test program correctly, even though a correct installation
83 dnl of OpenSSL exists. So we test the linking three times in
84 dnl case the RSAREF libraries are needed.
85
86 for libcrypto in \
87 "-lcrypto" \
88 "-lcrypto -lrsaref" \
89 "-lcrypto -lRSAglue -lrsaref"
90 do
91 AC_CHECK_LIB(ssl,SSL_new,
92 [have_ssl=1
93 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
94 SSLLIBS="-lssl $libcrypto"
95 AC_DEFINE(HAVE_SSL)
96 AC_DEFINE(HAVE_LIBSSL)],,
97 $libcrypto)
98
99 if test "x${SSLLIBS}" != "x"; then
100 break
101 fi
102 done
103
104 LIBS="$SAVELIBS")
105 fi
106 fi
107
108 if test $have_ssl = 1; then
109 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
110 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
111 fi
112
113 AC_SUBST(SSLFLAGS)
114 AC_SUBST(SSLLIBS)
115
116 EXPORT_SSLLIBS="$SSLLIBS"
117 AC_SUBST(EXPORT_SSLLIBS)
118
119
120 dnl
121 dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
122 dnl