]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.5svn-r9000.
[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
f8b3a85b 4dnl OpenSSL/GNUTLS stuff for CUPS.
ef416fc2 5dnl
f8b3a85b 6dnl Copyright 2007-2010 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=""
f8b3a85b 29have_ssl=0
ef416fc2 30
31if test x$enable_ssl != xno; then
32 dnl Look for CDSA...
f8b3a85b 33 if test $have_ssl = 0 -a "x${enable_cdsassl}" != "xno"; then
ef416fc2 34 if test $uname = Darwin; then
b86bc4cf 35 AC_CHECK_HEADER(Security/SecureTransport.h, [
f8b3a85b 36 have_ssl=1
b86bc4cf 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])
ef416fc2 58 fi
59 fi
60
61 dnl Then look for GNU TLS...
f8b3a85b 62 if test $have_ssl = 0 -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
f301802f 63 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
f11a948a 64 if $PKGCONFIG --exists gnutls; then
f8b3a85b 65 have_ssl=1
f11a948a
MS
66 SSLLIBS=`$PKGCONFIG --libs gnutls`
67 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
f301802f 68 AC_DEFINE(HAVE_SSL)
69 AC_DEFINE(HAVE_GNUTLS)
70 fi
ef416fc2 71 fi
72
73 dnl Check for the OpenSSL library last...
f8b3a85b 74 if test $have_ssl = 0 -a "x${enable_openssl}" != "xno"; then
ef416fc2 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,
f8b3a85b
MS
92 [have_ssl=1
93 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
ef416fc2 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
106fi
107
f8b3a85b 108if test $have_ssl = 1; then
f301802f 109 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
110 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
111fi
112
ef416fc2 113AC_SUBST(SSLFLAGS)
114AC_SUBST(SSLLIBS)
115
116EXPORT_SSLLIBS="$SSLLIBS"
117AC_SUBST(EXPORT_SSLLIBS)
118
119
120dnl
75bd9771 121dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
ef416fc2 122dnl