1 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
2 # 2009, 2010, 2011 Free Software Foundation, Inc.
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 # This file is part of GnuTLS.
8 # The GnuTLS is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public License
10 # as published by the Free Software Foundation; either version 2.1 of
11 # the License, or (at your option) any later version.
13 # The GnuTLS is distributed in the hope that it will be
14 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with GnuTLS; if not, write to the Free
20 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 AC_DEFUN([LIBGNUTLS_HOOKS],
25 # Library code modified: REVISION++
26 # Interfaces changed/added/removed: CURRENT++ REVISION=0
27 # Interfaces added: AGE++
28 # Interfaces removed: AGE=0
29 AC_SUBST(LT_CURRENT, 48)
30 AC_SUBST(LT_REVISION, 4)
33 AC_SUBST(LT_SSL_CURRENT, 27)
34 AC_SUBST(LT_SSL_REVISION, 0)
35 AC_SUBST(LT_SSL_AGE, 0)
37 AC_SUBST(CXX_LT_CURRENT, 27)
38 AC_SUBST(CXX_LT_REVISION, 0)
39 AC_SUBST(CXX_LT_AGE, 0)
41 # Used when creating the Windows libgnutls-XX.def files.
42 DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
47 AC_ARG_WITH(libgcrypt,
48 AS_HELP_STRING([--with-libgcrypt], [use libgcrypt as crypto library]),
51 if test "$libgcrypt" = "yes"; then
53 AC_DEFINE([HAVE_GCRYPT], 1, [whether the gcrypt library is in use])
54 AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>],
55 [enum gcry_cipher_algos i = GCRY_CIPHER_CAMELLIA128])
56 if test "$ac_cv_libgcrypt" != yes; then
59 *** Libgcrypt v1.4.0 or later was not found. You may want to get it from
60 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
66 AC_MSG_CHECKING([whether to use nettle])
67 if test "$cryptolib" = "nettle";then
69 AC_LIB_HAVE_LINKFLAGS([nettle],, [#include <nettle/aes.h>],
70 [nettle_aes_invert_key (0, 0)])
71 if test "$ac_cv_libnettle" != yes; then
74 *** Libnettle 2.1 was not found.
77 NETTLE_LIBS="-lgmp -lhogweed"
82 AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
84 AC_ARG_WITH(included-libtasn1,
85 AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
86 included_libtasn1=$withval,
88 if test "$included_libtasn1" = "no"; then
89 AC_LIB_HAVE_LINKFLAGS(tasn1,, [#include <libtasn1.h>],
90 [asn1_check_version (NULL)])
91 if test "$ac_cv_libtasn1" != yes; then
95 *** Libtasn1 was not found. Will use the included one.
99 AC_MSG_CHECKING([whether to use the included minitasn1])
100 AC_MSG_RESULT($included_libtasn1)
101 AM_CONDITIONAL(ENABLE_MINITASN1, test "$included_libtasn1" = "yes")
103 if test "$included_libtasn1" = "no"; then
104 GNUTLS_REQUIRES_PRIVATE="Requires.private: libtasn1"
108 AS_HELP_STRING([--with-lzo], [use experimental LZO compression]),
109 use_lzo=$withval, use_lzo=no)
110 AC_MSG_CHECKING([whether to include LZO compression support])
111 AC_MSG_RESULT($use_lzo)
113 if test "$use_lzo" = "yes"; then
114 AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
115 if test "$LZO_LIBS" = ""; then
116 AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
120 *** Could not find liblzo or liblzo2. Disabling LZO compression.
126 if test "$use_lzo" = "yes"; then
127 AC_DEFINE([USE_LZO], 1, [whether to use the LZO compression])
128 if test "$LZO_LIBS" = "-llzo"; then
129 AC_CHECK_HEADERS(lzo1x.h)
130 elif test "$LZO_LIBS" = "-llzo2"; then
131 AC_CHECK_HEADERS(lzo/lzo1x.h)
134 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
136 AC_MSG_CHECKING([whether C99 macros are supported])
139 #define test_mac(...)
144 AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])
148 AC_MSG_WARN([C99 macros not supported. This may affect compiling.])
151 AC_MSG_CHECKING([whether to enable Opaque PRF input support])
152 AC_ARG_ENABLE(opaque-prf-input,
153 AS_HELP_STRING([--enable-opaque-prf-input=DD],
154 [enable Opaque PRF input using DD as extension type]),
155 ac_opaque_prf_input=$enableval, ac_opaque_prf_input=no)
156 if test "$ac_opaque_prf_input" != "no"; then
157 if ! echo $ac_opaque_prf_input | egrep -q '^[[0-9]]+$'; then
158 ac_opaque_prf_input=no
160 *** Could not parse Opaque PRF Input extension type.
161 *** Use --enable-opaque-prf-input=XX where XX is decimal, for example
162 *** to use extension value 42 use --enable-opqaue-prf-input=42]])
165 if test "$ac_opaque_prf_input" != "no"; then
166 AC_MSG_RESULT([yes (extension value $ac_opaque_prf_input)])
167 AC_DEFINE_UNQUOTED([ENABLE_OPRFI], $ac_opaque_prf_input,
168 [enable Opaque PRF Input])
172 AM_CONDITIONAL(ENABLE_OPRFI, test "$ac_opaque_prf_input" != "no")
174 AC_MSG_CHECKING([whether to disable SRP authentication support])
175 AC_ARG_ENABLE(srp-authentication,
176 AS_HELP_STRING([--disable-srp-authentication],
177 [disable the SRP authentication support]),
179 if test x$ac_enable_srp != xno; then
181 AC_DEFINE([ENABLE_SRP], 1, [enable SRP authentication])
186 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
188 AC_MSG_CHECKING([whether to disable PSK authentication support])
189 AC_ARG_ENABLE(psk-authentication,
190 AS_HELP_STRING([--disable-psk-authentication],
191 [disable the PSK authentication support]),
193 if test x$ac_enable_psk != xno; then
195 AC_DEFINE([ENABLE_PSK], 1, [enable PSK authentication])
200 AM_CONDITIONAL(ENABLE_PSK, test "$ac_enable_psk" != "no")
202 AC_MSG_CHECKING([whether to disable anonymous authentication support])
203 AC_ARG_ENABLE(anon-authentication,
204 AS_HELP_STRING([--disable-anon-authentication],
205 [disable the anonymous authentication support]),
207 if test x$ac_enable_anon != xno; then
209 AC_DEFINE([ENABLE_ANON], 1, [enable anonymous authentication])
214 AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
216 # Allow disabling Camellia
217 if test "$nettle" != "yes";then
218 AC_ARG_ENABLE(camellia,
219 AS_HELP_STRING([--disable-camellia], [disable Camellia cipher]),
220 enable_camellia=$enableval, enable_camellia=yes)
225 AC_MSG_CHECKING([whether to disable Camellia cipher])
226 if test "$enable_camellia" != "no"; then
228 AC_DEFINE([ENABLE_CAMELLIA], 1, [enable camellia block cipher])
233 AC_MSG_CHECKING([whether to disable extra PKI stuff])
234 AC_ARG_ENABLE(extra-pki,
235 AS_HELP_STRING([--disable-extra-pki],
236 [only enable the basic PKI stuff]),
237 enable_pki=$enableval, enable_pki=yes)
238 if test "$enable_pki" != "yes"; then
243 AC_DEFINE([ENABLE_PKI], 1, [whether to include all the PKCS/PKI stuff])
245 AM_CONDITIONAL(ENABLE_PKI, test "$enable_pki" = "yes")
247 ac_enable_openpgp=yes
248 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
249 AC_ARG_ENABLE(openpgp-authentication,
250 AS_HELP_STRING([--disable-openpgp-authentication],
251 [disable the OpenPGP authentication support]),
252 ac_enable_openpgp=no)
253 if test x$ac_enable_openpgp = xno; then
257 AC_DEFINE([ENABLE_OPENPGP], 1, [use openpgp authentication])
260 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
262 AC_MSG_CHECKING([whether to disable SessionTicket extension support])
263 AC_ARG_ENABLE(session-ticket,
264 AS_HELP_STRING([--disable-session-ticket],
265 [disable the SessionTicket extension support]),
266 ac_session_ticket=no)
267 if test x$ac_session_ticket != xno; then
269 AC_DEFINE([ENABLE_SESSION_TICKET], 1, [enable SessionTicket extension])
274 AM_CONDITIONAL(ENABLE_SESSION_TICKET, test "$ac_enable_session_ticket" != "no")
277 AC_MSG_CHECKING([whether to add cryptodev support])
278 AC_ARG_ENABLE(cryptodev,
279 AS_HELP_STRING([--enable-cryptodev], [enable cryptodev support]),
280 enable_cryptodev=yes,enable_cryptodev=no)
281 AC_MSG_RESULT($enable_cryptodev)
283 if test "$enable_cryptodev" = "yes"; then
284 AC_DEFINE([ENABLE_CRYPTODEV], 1, [Enable cryptodev support])
287 # For storing integers in pointers without warnings
288 # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
289 AC_CHECK_SIZEOF(void *)
290 AC_CHECK_SIZEOF(long)
292 case $ac_cv_sizeof_void_p in
294 AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long)],
295 [Additional cast to bring void* to a type castable to int.])
298 AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [])