]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-openssl.m4
Update copyright notices, addresses, etc.
[thirdparty/cups.git] / config-scripts / cups-openssl.m4
1 dnl
2 dnl "$Id$"
3 dnl
4 dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
7 dnl
8 dnl These coded instructions, statements, and computer programs are the
9 dnl property of Easy Software Products and are protected by Federal
10 dnl copyright law. Distribution and use rights are outlined in the file
11 dnl "LICENSE.txt" which should have been included with this file. If this
12 dnl file is missing or damaged please contact Easy Software Products
13 dnl at:
14 dnl
15 dnl Attn: CUPS Licensing Information
16 dnl Easy Software Products
17 dnl 44141 Airport View Drive, Suite 204
18 dnl Hollywood, Maryland 20636 USA
19 dnl
20 dnl Voice: (301) 373-9600
21 dnl EMail: cups-info@cups.org
22 dnl WWW: http://www.cups.org
23 dnl
24
25 AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes])
26 AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=yes])
27 AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=yes])
28 AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=yes])
29 AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library],
30 LDFLAGS="-L$withval $LDFLAGS"
31 DSOFLAGS="-L$withval $DSOFLAGS",)
32 AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes],
33 CFLAGS="-I$withval $CFLAGS"
34 CXXFLAGS="-I$withval $CXXFLAGS"
35 CPPFLAGS="-I$withval $CPPFLAGS",)
36
37 SSLFLAGS=""
38 SSLLIBS=""
39
40 if test x$enable_ssl != xno; then
41 dnl Check for the OpenSSL library first, which has precedence over
42 dnl CDSA and GNUTLS...
43 if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
44 AC_CHECK_HEADER(openssl/ssl.h,
45 dnl Save the current libraries so the crypto stuff isn't always
46 dnl included...
47 SAVELIBS="$LIBS"
48
49 dnl Some ELF systems can't resolve all the symbols in libcrypto
50 dnl if libcrypto was linked against RSAREF, and fail to link the
51 dnl test program correctly, even though a correct installation
52 dnl of OpenSSL exists. So we test the linking three times in
53 dnl case the RSAREF libraries are needed.
54
55 for libcrypto in \
56 "-lcrypto" \
57 "-lcrypto -lrsaref" \
58 "-lcrypto -lRSAglue -lrsaref"
59 do
60 AC_CHECK_LIB(ssl,SSL_new,
61 [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
62 SSLLIBS="-lssl $libcrypto"
63 AC_DEFINE(HAVE_SSL)
64 AC_DEFINE(HAVE_LIBSSL)],,
65 $libcrypto)
66
67 if test "x${SSLLIBS}" != "x"; then
68 break
69 fi
70 done
71
72 LIBS="$SAVELIBS")
73 fi
74
75 dnl If OpenSSL wasn't found, look for CDSA...
76 if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
77 if test $uname = Darwin; then
78 AC_CHECK_HEADER(Security/SecureTransport.h,
79 [SSLLIBS="-framework CoreFoundation -framework Security"
80 AC_DEFINE(HAVE_SSL)
81 AC_DEFINE(HAVE_CDSASSL)])
82 fi
83 fi
84
85 dnl Then look for GNU TLS...
86 if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
87 AC_CHECK_HEADER(gnutls/gnutls.h,
88 dnl Save the current libraries so the crypto stuff isn't always
89 dnl included...
90 SAVELIBS="$LIBS"
91
92 TEST_GNUTLS_LIBS=`libgnutls-config --libs`
93 AC_CHECK_LIB(gnutls, gnutls_init,
94 [SSLLIBS=$TEST_GNUTLS_LIBS
95 AC_DEFINE(HAVE_SSL)
96 AC_DEFINE(HAVE_GNUTLS)],,
97 $TEST_GNUTLS_LIBS)
98
99 LIBS="$SAVELIBS")
100 fi
101 fi
102
103 AC_SUBST(SSLFLAGS)
104 AC_SUBST(SSLLIBS)
105
106 EXPORT_SSLLIBS="$SSLLIBS"
107 AC_SUBST(EXPORT_SSLLIBS)
108
109
110 dnl
111 dnl End of "$Id$".
112 dnl