]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.4svn-r8606.
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
CommitLineData
ef416fc2 1dnl
75bd9771 2dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
ef416fc2 3dnl
4dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
5dnl
bf3816c7 6dnl Copyright 2007-2009 by Apple Inc.
b86bc4cf 7dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8dnl
9dnl These coded instructions, statements, and computer programs are the
bc44d920 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/".
ef416fc2 14dnl
15
bf3816c7 16AC_ARG_ENABLE(ssl, [ --disable-ssl disable SSL/TLS support])
ef416fc2 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])
20AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
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"
ef416fc2 25 CPPFLAGS="-I$withval $CPPFLAGS",)
26
27SSLFLAGS=""
28SSLLIBS=""
29
30if test x$enable_ssl != xno; then
31 dnl Look for CDSA...
32 if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
33 if test $uname = Darwin; then
b86bc4cf 34 AC_CHECK_HEADER(Security/SecureTransport.h, [
35 SSLLIBS="-framework CoreFoundation -framework Security"
b86bc4cf 36 AC_DEFINE(HAVE_SSL)
37 AC_DEFINE(HAVE_CDSASSL)
38
39 dnl Check for the various security headers...
40 AC_CHECK_HEADER(Security/SecPolicy.h,
41 AC_DEFINE(HAVE_SECPOLICY_H))
42 AC_CHECK_HEADER(Security/SecPolicyPriv.h,
43 AC_DEFINE(HAVE_SECPOLICYPRIV_H))
44 AC_CHECK_HEADER(Security/SecBasePriv.h,
45 AC_DEFINE(HAVE_SECBASEPRIV_H))
46 AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
47 AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
48
49 dnl Check for SecIdentitySearchCreateWithPolicy...
50 AC_MSG_CHECKING(for SecIdentitySearchCreateWithPolicy)
51 if test $uversion -ge 80; then
52 AC_DEFINE(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
53 AC_MSG_RESULT(yes)
54 else
55 AC_MSG_RESULT(no)
56 fi])
ef416fc2 57 fi
58 fi
59
60 dnl Then look for GNU TLS...
f11a948a 61 if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
f301802f 62 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
f11a948a
MS
63 if $PKGCONFIG --exists gnutls; then
64 SSLLIBS=`$PKGCONFIG --libs gnutls`
65 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
f301802f 66 AC_DEFINE(HAVE_SSL)
67 AC_DEFINE(HAVE_GNUTLS)
68 fi
ef416fc2 69 fi
70
71 dnl Check for the OpenSSL library last...
72 if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
73 AC_CHECK_HEADER(openssl/ssl.h,
74 dnl Save the current libraries so the crypto stuff isn't always
75 dnl included...
76 SAVELIBS="$LIBS"
77
78 dnl Some ELF systems can't resolve all the symbols in libcrypto
79 dnl if libcrypto was linked against RSAREF, and fail to link the
80 dnl test program correctly, even though a correct installation
81 dnl of OpenSSL exists. So we test the linking three times in
82 dnl case the RSAREF libraries are needed.
83
84 for libcrypto in \
85 "-lcrypto" \
86 "-lcrypto -lrsaref" \
87 "-lcrypto -lRSAglue -lrsaref"
88 do
89 AC_CHECK_LIB(ssl,SSL_new,
90 [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
91 SSLLIBS="-lssl $libcrypto"
92 AC_DEFINE(HAVE_SSL)
93 AC_DEFINE(HAVE_LIBSSL)],,
94 $libcrypto)
95
96 if test "x${SSLLIBS}" != "x"; then
97 break
98 fi
99 done
100
101 LIBS="$SAVELIBS")
102 fi
103fi
104
f301802f 105if test "x$SSLLIBS" != x; then
106 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
107 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
108fi
109
ef416fc2 110AC_SUBST(SSLFLAGS)
111AC_SUBST(SSLLIBS)
112
113EXPORT_SSLLIBS="$SSLLIBS"
114AC_SUBST(EXPORT_SSLLIBS)
115
116
117dnl
75bd9771 118dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
ef416fc2 119dnl