]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-ssl.m4
949a3e4f50485e1f69feaf7ef21ee37a02d3f978
[thirdparty/cups.git] / config-scripts / cups-ssl.m4
1 dnl
2 dnl "$Id: cups-ssl.m4 181 2006-06-22 20:01:18Z jlovell $"
3 dnl
4 dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 1997-2006 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(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=first])
27 AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=second])
28 AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=third])
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 ENCRYPTION_REQUIRED=""
40
41 if test x$enable_ssl != xno; then
42 dnl Look for CDSA...
43 if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
44 if test $uname = Darwin; then
45 AC_CHECK_HEADER(Security/SecureTransport.h,
46 [SSLLIBS="-framework CoreFoundation -framework Security"
47 # MacOS X doesn't (yet) come with pre-installed encryption
48 # certificates for CUPS, so don't enable encryption on
49 # /admin just yet...
50 #ENCRYPTION_REQUIRED=" Encryption Required"
51 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
52 AC_DEFINE(HAVE_SSL)
53 AC_DEFINE(HAVE_CDSASSL)])
54 fi
55 fi
56
57 dnl Then look for GNU TLS...
58 if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then
59 AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
60 if test "x$LIBGNUTLSCONFIG" != x; then
61 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
62 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
63 ENCRYPTION_REQUIRED=" Encryption Required"
64 AC_DEFINE(HAVE_SSL)
65 AC_DEFINE(HAVE_GNUTLS)
66 fi
67 fi
68
69 dnl Check for the OpenSSL library last...
70 if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
71 AC_CHECK_HEADER(openssl/ssl.h,
72 dnl Save the current libraries so the crypto stuff isn't always
73 dnl included...
74 SAVELIBS="$LIBS"
75
76 dnl Some ELF systems can't resolve all the symbols in libcrypto
77 dnl if libcrypto was linked against RSAREF, and fail to link the
78 dnl test program correctly, even though a correct installation
79 dnl of OpenSSL exists. So we test the linking three times in
80 dnl case the RSAREF libraries are needed.
81
82 for libcrypto in \
83 "-lcrypto" \
84 "-lcrypto -lrsaref" \
85 "-lcrypto -lRSAglue -lrsaref"
86 do
87 AC_CHECK_LIB(ssl,SSL_new,
88 [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
89 SSLLIBS="-lssl $libcrypto"
90 ENCRYPTION_REQUIRED=" Encryption Required"
91 AC_DEFINE(HAVE_SSL)
92 AC_DEFINE(HAVE_LIBSSL)],,
93 $libcrypto)
94
95 if test "x${SSLLIBS}" != "x"; then
96 break
97 fi
98 done
99
100 LIBS="$SAVELIBS")
101 fi
102 fi
103
104 if test "x$SSLLIBS" != x; then
105 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
106 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
107 fi
108
109 AC_SUBST(SSLFLAGS)
110 AC_SUBST(SSLLIBS)
111 AC_SUBST(ENCRYPTION_REQUIRED)
112
113 EXPORT_SSLLIBS="$SSLLIBS"
114 AC_SUBST(EXPORT_SSLLIBS)
115
116
117 dnl
118 dnl End of "$Id: cups-ssl.m4 181 2006-06-22 20:01:18Z jlovell $".
119 dnl