]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-ssl.m4
Merge changes from CUPS 1.5svn-r9105.
[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)
6d2f911b 64 AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
f11a948a 65 if $PKGCONFIG --exists gnutls; then
f8b3a85b 66 have_ssl=1
f11a948a
MS
67 SSLLIBS=`$PKGCONFIG --libs gnutls`
68 SSLFLAGS=`$PKGCONFIG --cflags gnutls`
f301802f 69 AC_DEFINE(HAVE_SSL)
70 AC_DEFINE(HAVE_GNUTLS)
6d2f911b
MS
71 elif "x$LIBGNUTLSCONFIG" != x; then
72 have_ssl=1
73 SSLLIBS=`$LIBGNUTLSCONFIG --libs`
74 SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
75 AC_DEFINE(HAVE_SSL)
76 AC_DEFINE(HAVE_GNUTLS)
77 fi
78
79 if test $have_ssl = 1; then
80 if $PKGCONFIG --exists gcrypt; then
81 SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
82 SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
83 elif "x$LIBGCRYPTCONFIG" != x; then
84 SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
85 SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
86 fi
f301802f 87 fi
ef416fc2 88 fi
89
90 dnl Check for the OpenSSL library last...
f8b3a85b 91 if test $have_ssl = 0 -a "x${enable_openssl}" != "xno"; then
ef416fc2 92 AC_CHECK_HEADER(openssl/ssl.h,
93 dnl Save the current libraries so the crypto stuff isn't always
94 dnl included...
95 SAVELIBS="$LIBS"
96
97 dnl Some ELF systems can't resolve all the symbols in libcrypto
98 dnl if libcrypto was linked against RSAREF, and fail to link the
99 dnl test program correctly, even though a correct installation
100 dnl of OpenSSL exists. So we test the linking three times in
101 dnl case the RSAREF libraries are needed.
102
103 for libcrypto in \
104 "-lcrypto" \
105 "-lcrypto -lrsaref" \
106 "-lcrypto -lRSAglue -lrsaref"
107 do
108 AC_CHECK_LIB(ssl,SSL_new,
f8b3a85b
MS
109 [have_ssl=1
110 SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
ef416fc2 111 SSLLIBS="-lssl $libcrypto"
112 AC_DEFINE(HAVE_SSL)
113 AC_DEFINE(HAVE_LIBSSL)],,
114 $libcrypto)
115
116 if test "x${SSLLIBS}" != "x"; then
117 break
118 fi
119 done
120
121 LIBS="$SAVELIBS")
122 fi
123fi
124
f8b3a85b 125if test $have_ssl = 1; then
f301802f 126 AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
127 AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
128fi
129
ef416fc2 130AC_SUBST(SSLFLAGS)
131AC_SUBST(SSLLIBS)
132
133EXPORT_SSLLIBS="$SSLLIBS"
134AC_SUBST(EXPORT_SSLLIBS)
135
136
137dnl
75bd9771 138dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
ef416fc2 139dnl