documented fix
[gnutls.git] / m4 / hooks.m4
blob78d1e2f8cb2a7379d368c776bc7ed8c05c2b78f6
1 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
3 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
5 # This file is part of GnuTLS.
7 # The GnuTLS is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public License
9 # as published by the Free Software Foundation; either version 2.1 of
10 # the License, or (at your option) any later version.
12 # The GnuTLS is distributed in the hope that it will be
13 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with GnuTLS; if not, write to the Free
19 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 # MA 02110-1301, USA
22 AC_DEFUN([LIBGNUTLS_EXTRA_HOOKS],
24   AC_MSG_CHECKING([whether to build OpenSSL compatibility layer])
25   AC_ARG_ENABLE(openssl-compatibility,
26     AS_HELP_STRING([--disable-openssl-compatibility],
27                    [disable the OpenSSL compatibility support]),
28     enable_openssl=$enableval, enable_openssl=yes)
29   AC_MSG_RESULT($enable_openssl)
30   AM_CONDITIONAL(ENABLE_OPENSSL, test "$enable_openssl" = "yes")
32   # We link to ../lib's gnulib, which needs -lws2_32 via LIBSOCKET in Makefile.am.
33   gl_SOCKETS
36 AC_DEFUN([LIBGNUTLS_HOOKS],
38   # Library code modified:                              REVISION++
39   # Interfaces changed/added/removed:   CURRENT++       REVISION=0
40   # Interfaces added:                             AGE++
41   # Interfaces removed:                           AGE=0
42   AC_SUBST(LT_CURRENT, 37)
43   AC_SUBST(LT_REVISION, 0)
44   AC_SUBST(LT_AGE, 9)
46   AC_SUBST(LT_SSL_CURRENT, 27)
47   AC_SUBST(LT_SSL_REVISION, 2)
48   AC_SUBST(LT_SSL_AGE, 0)
50   AC_SUBST(CXX_LT_CURRENT, 28)
51   AC_SUBST(CXX_LT_REVISION, 0)
52   AC_SUBST(CXX_LT_AGE, 0)
54   AC_SUBST(CRYWRAP_PATCHLEVEL, 3)
56   # Used when creating the Windows libgnutls-XX.def files.
57   DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
58   AC_SUBST(DLL_VERSION)
60   cryptolib="nettle"
62 dnl  AC_ARG_WITH(libgcrypt,
63 dnl    AS_HELP_STRING([--with-libgcrypt], [use libgcrypt as crypto library]),
64 dnl      libgcrypt=$withval,
65 dnl      libgcrypt=no)
66 dnl    if test "$libgcrypt" = "yes"; then
67 dnl        cryptolib=libgcrypt
68 dnl        AC_DEFINE([HAVE_GCRYPT], 1, [whether the gcrypt library is in use])
69 dnl     AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>],
70 dnl                      [enum gcry_cipher_algos i = GCRY_CIPHER_CAMELLIA128])
71 dnl      if test "$ac_cv_libgcrypt" != yes; then
72 dnl        AC_MSG_ERROR([[
73 dnl***  
74 dnl*** Libgcrypt v1.4.0 or later was not found. You may want to get it from
75 dnl*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
76 dnl***
77 dnl    ]])
78 dnl      fi
79 dnl    fi
81   AC_MSG_CHECKING([whether to use nettle])
82 if test "$cryptolib" = "nettle";then
83   AC_MSG_RESULT(yes)
84     AC_LIB_HAVE_LINKFLAGS([nettle], [hogweed gmp], [#include <nettle/ripemd160.h>],
85                           [ripemd160_init (0)])
86     if test "$ac_cv_libnettle" != yes; then
87       AC_MSG_ERROR([[
88   *** 
89   *** Libnettle 2.4 was not found. You must compile nettle with gmp support.
90   ]])
91     fi
92 else
93   AC_MSG_RESULT(no)
95   AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
97   AC_ARG_WITH(included-libtasn1,
98     AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
99       included_libtasn1=$withval,
100       included_libtasn1=no)
101   if test "$included_libtasn1" = "no"; then
102     AC_LIB_HAVE_LINKFLAGS(tasn1,, [#include <libtasn1.h>],
103                           [asn1_check_version (NULL)])
104     if test "$ac_cv_libtasn1" != yes; then
105       included_libtasn1=yes
106       AC_MSG_WARN([[
107   *** 
108   *** Libtasn1 was not found. Will use the included one.
109   ]])
110     fi
111   fi
112   AC_MSG_CHECKING([whether to use the included minitasn1])
113   AC_MSG_RESULT($included_libtasn1)
114   AM_CONDITIONAL(ENABLE_MINITASN1, test "$included_libtasn1" = "yes")
116   if test "$included_libtasn1" = "no"; then
117     GNUTLS_REQUIRES_PRIVATE="Requires.private: libtasn1"
118   fi
120   AC_MSG_CHECKING([whether C99 macros are supported])
121   AC_TRY_COMPILE(,
122   [
123     #define test_mac(...) 
124     int z,y,x;
125     test_mac(x,y,z);
126     return 0;
127   ], [
128     AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])
129     AC_MSG_RESULT(yes)
130   ], [
131     AC_MSG_RESULT(no)
132     AC_MSG_WARN([C99 macros not supported. This may affect compiling.])
133   ])
135   ac_enable_srp=yes
136   AC_MSG_CHECKING([whether to disable SRP authentication support])
137   AC_ARG_ENABLE(srp-authentication,
138     AS_HELP_STRING([--disable-srp-authentication],
139                    [disable the SRP authentication support]),
140     ac_enable_srp=no)
141   if test x$ac_enable_srp != xno; then
142    AC_MSG_RESULT(no)
143    AC_DEFINE([ENABLE_SRP], 1, [enable SRP authentication])
144   else
145    ac_full=0
146    AC_MSG_RESULT(yes)
147   fi
148   AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
149   
150   ac_enable_psk=yes
151   AC_MSG_CHECKING([whether to disable PSK authentication support])
152   AC_ARG_ENABLE(psk-authentication,
153     AS_HELP_STRING([--disable-psk-authentication],
154                    [disable the PSK authentication support]),
155     ac_enable_psk=no)
156   if test x$ac_enable_psk != xno; then
157    AC_MSG_RESULT(no)
158    AC_DEFINE([ENABLE_PSK], 1, [enable PSK authentication])
159   else
160    ac_full=0
161    AC_MSG_RESULT(yes)
162   fi
163   AM_CONDITIONAL(ENABLE_PSK, test "$ac_enable_psk" != "no")
164   
165   ac_enable_anon=yes
166   AC_MSG_CHECKING([whether to disable anonymous authentication support])
167   AC_ARG_ENABLE(anon-authentication,
168     AS_HELP_STRING([--disable-anon-authentication],
169                    [disable the anonymous authentication support]),
170     ac_enable_anon=no)
171   if test x$ac_enable_anon != xno; then
172    AC_MSG_RESULT(no)
173    AC_DEFINE([ENABLE_ANON], 1, [enable anonymous authentication])
174   else
175    ac_full=0
176    AC_MSG_RESULT(yes)
177   fi
178   AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
179   
180   ac_enable_openpgp=yes
181   AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
182   AC_ARG_ENABLE(openpgp-authentication,
183     AS_HELP_STRING([--disable-openpgp-authentication],
184                    [disable the OpenPGP authentication support]),
185     ac_enable_openpgp=no)
186   if test x$ac_enable_openpgp = xno; then
187    AC_MSG_RESULT(yes)
188    ac_full=0
189   else
190    AC_DEFINE([ENABLE_OPENPGP], 1, [use openpgp authentication])
191    AC_MSG_RESULT(no)
192   fi
193   AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
195   # For cryptodev
196   AC_MSG_CHECKING([whether to add cryptodev support])
197   AC_ARG_ENABLE(cryptodev,
198     AS_HELP_STRING([--enable-cryptodev], [enable cryptodev support]),
199   enable_cryptodev=yes,enable_cryptodev=no)
200   AC_MSG_RESULT($enable_cryptodev)
202   if test "$enable_cryptodev" = "yes"; then
203     AC_DEFINE([ENABLE_CRYPTODEV], 1, [Enable cryptodev support])
204   fi
206   AC_MSG_CHECKING([whether to disable OCSP support])
207   AC_ARG_ENABLE(ocsp,
208     AS_HELP_STRING([--disable-ocsp],
209                    [disable OCSP support]),
210     ac_enable_ocsp=no)
211   if test x$ac_enable_ocsp != xno; then
212    ac_enable_ocsp=yes
213    AC_MSG_RESULT(no)
214    AC_DEFINE([ENABLE_OCSP], 1, [enable OCSP support])
215   else
216    ac_full=0
217    AC_MSG_RESULT(yes)
218   fi
219   AM_CONDITIONAL(ENABLE_OCSP, test "$ac_enable_ocsp" != "no")
221   # For storing integers in pointers without warnings
222   # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
223   AC_CHECK_SIZEOF(void *)
224   AC_CHECK_SIZEOF(long long)
225   AC_CHECK_SIZEOF(long)
226   AC_CHECK_SIZEOF(int)
227   if test x$ac_cv_sizeof_void_p = x$ac_cv_sizeof_long;then
228       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long)],
229                 [Additional cast to bring void* to a type castable to int.])
230   elif test x$ac_cv_sizeof_void_p = x$ac_cv_sizeof_long_long;then
231       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long long)],
232                 [Additional cast to bring void* to a type castable to int.])
233    else
234       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [])
235    fi