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