guile: Rename to `libguile-gnutls-v-2'.
[gnutls.git] / m4 / hooks.m4
blobae63706316dedf06ed3aff4c16a84d5344bf7a25
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,
21 # MA 02110-1301, USA
23 AC_DEFUN([LIBGNUTLS_EXTRA_HOOKS],
25   AC_MSG_CHECKING([whether to build OpenSSL compatibility layer])
26   AC_ARG_ENABLE(openssl-compatibility,
27     AS_HELP_STRING([--disable-openssl-compatibility],
28                    [disable the OpenSSL compatibility support]),
29     enable_openssl=$enableval, enable_openssl=yes)
30   AC_MSG_RESULT($enable_openssl)
31   AM_CONDITIONAL(ENABLE_OPENSSL, test "$enable_openssl" = "yes")
33   # We link to ../lib's gnulib, which needs -lws2_32 via LIBSOCKET in Makefile.am.
34   gl_SOCKETS
37 AC_DEFUN([LIBGNUTLS_HOOKS],
39   # Library code modified:                              REVISION++
40   # Interfaces changed/added/removed:   CURRENT++       REVISION=0
41   # Interfaces added:                             AGE++
42   # Interfaces removed:                           AGE=0
43   AC_SUBST(LT_CURRENT, 30)
44   AC_SUBST(LT_REVISION, 1)
45   AC_SUBST(LT_AGE, 2)
47   AC_SUBST(LT_SSL_CURRENT, 27)
48   AC_SUBST(LT_SSL_REVISION, 1)
49   AC_SUBST(LT_SSL_AGE, 0)
51   AC_SUBST(CXX_LT_CURRENT, 28)
52   AC_SUBST(CXX_LT_REVISION, 0)
53   AC_SUBST(CXX_LT_AGE, 0)
55   AC_SUBST(CRYWRAP_PATCHLEVEL, 3)
57   # Used when creating the Windows libgnutls-XX.def files.
58   DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
59   AC_SUBST(DLL_VERSION)
61   cryptolib="nettle"
63 dnl  AC_ARG_WITH(libgcrypt,
64 dnl    AS_HELP_STRING([--with-libgcrypt], [use libgcrypt as crypto library]),
65 dnl      libgcrypt=$withval,
66 dnl      libgcrypt=no)
67 dnl    if test "$libgcrypt" = "yes"; then
68 dnl        cryptolib=libgcrypt
69 dnl        AC_DEFINE([HAVE_GCRYPT], 1, [whether the gcrypt library is in use])
70 dnl     AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>],
71 dnl                      [enum gcry_cipher_algos i = GCRY_CIPHER_CAMELLIA128])
72 dnl      if test "$ac_cv_libgcrypt" != yes; then
73 dnl        AC_MSG_ERROR([[
74 dnl***  
75 dnl*** Libgcrypt v1.4.0 or later was not found. You may want to get it from
76 dnl*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
77 dnl***
78 dnl    ]])
79 dnl      fi
80 dnl    fi
82   AC_MSG_CHECKING([whether to use nettle])
83 if test "$cryptolib" = "nettle";then
84   AC_MSG_RESULT(yes)
85     AC_LIB_HAVE_LINKFLAGS([nettle], [hogweed gmp], [#include <nettle/ripemd160.h>],
86                           [ripemd160_init (0)])
87     if test "$ac_cv_libnettle" != yes; then
88       AC_MSG_ERROR([[
89   *** 
90   *** Libnettle 2.4 was not found. 
91   ]])
92     fi
93 else
94   AC_MSG_RESULT(no)
96   AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
98   AC_ARG_WITH(included-libtasn1,
99     AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
100       included_libtasn1=$withval,
101       included_libtasn1=no)
102   if test "$included_libtasn1" = "no"; then
103     AC_LIB_HAVE_LINKFLAGS(tasn1,, [#include <libtasn1.h>],
104                           [asn1_check_version (NULL)])
105     if test "$ac_cv_libtasn1" != yes; then
106       included_libtasn1=yes
107       AC_MSG_WARN([[
108   *** 
109   *** Libtasn1 was not found. Will use the included one.
110   ]])
111     fi
112   fi
113   AC_MSG_CHECKING([whether to use the included minitasn1])
114   AC_MSG_RESULT($included_libtasn1)
115   AM_CONDITIONAL(ENABLE_MINITASN1, test "$included_libtasn1" = "yes")
117   if test "$included_libtasn1" = "no"; then
118     GNUTLS_REQUIRES_PRIVATE="Requires.private: libtasn1"
119   fi
121   AC_MSG_CHECKING([whether C99 macros are supported])
122   AC_TRY_COMPILE(,
123   [
124     #define test_mac(...) 
125     int z,y,x;
126     test_mac(x,y,z);
127     return 0;
128   ], [
129     AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])
130     AC_MSG_RESULT(yes)
131   ], [
132     AC_MSG_RESULT(no)
133     AC_MSG_WARN([C99 macros not supported. This may affect compiling.])
134   ])
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_MSG_CHECKING([whether to disable PSK authentication support])
151   AC_ARG_ENABLE(psk-authentication,
152     AS_HELP_STRING([--disable-psk-authentication],
153                    [disable the PSK authentication support]),
154     ac_enable_psk=no)
155   if test x$ac_enable_psk != xno; then
156    AC_MSG_RESULT(no)
157    AC_DEFINE([ENABLE_PSK], 1, [enable PSK authentication])
158   else
159    ac_full=0
160    AC_MSG_RESULT(yes)
161   fi
162   AM_CONDITIONAL(ENABLE_PSK, test "$ac_enable_psk" != "no")
163   
164   AC_MSG_CHECKING([whether to disable anonymous authentication support])
165   AC_ARG_ENABLE(anon-authentication,
166     AS_HELP_STRING([--disable-anon-authentication],
167                    [disable the anonymous authentication support]),
168     ac_enable_anon=no)
169   if test x$ac_enable_anon != xno; then
170    AC_MSG_RESULT(no)
171    AC_DEFINE([ENABLE_ANON], 1, [enable anonymous authentication])
172   else
173    ac_full=0
174    AC_MSG_RESULT(yes)
175   fi
176   AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
177   
178   AC_MSG_CHECKING([whether to disable extra PKI stuff])
179   AC_ARG_ENABLE(extra-pki,
180     AS_HELP_STRING([--disable-extra-pki],
181                    [only enable the basic PKI stuff]),
182     enable_pki=$enableval, enable_pki=yes)
183   if test "$enable_pki" != "yes"; then
184    ac_full=0
185    AC_MSG_RESULT(yes)
186   else
187    AC_MSG_RESULT(no)
188    AC_DEFINE([ENABLE_PKI], 1, [whether to include all the PKCS/PKI stuff])
189   fi
190   AM_CONDITIONAL(ENABLE_PKI, test "$enable_pki" = "yes")
191   
192   ac_enable_openpgp=yes
193   AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
194   AC_ARG_ENABLE(openpgp-authentication,
195     AS_HELP_STRING([--disable-openpgp-authentication],
196                    [disable the OpenPGP authentication support]),
197     ac_enable_openpgp=no)
198   if test x$ac_enable_openpgp = xno; then
199    AC_MSG_RESULT(yes)
200    ac_full=0
201   else
202    AC_DEFINE([ENABLE_OPENPGP], 1, [use openpgp authentication])
203    AC_MSG_RESULT(no)
204   fi
205   AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
207   # For cryptodev
208   AC_MSG_CHECKING([whether to add cryptodev support])
209   AC_ARG_ENABLE(cryptodev,
210     AS_HELP_STRING([--enable-cryptodev], [enable cryptodev support]),
211   enable_cryptodev=yes,enable_cryptodev=no)
212   AC_MSG_RESULT($enable_cryptodev)
214   if test "$enable_cryptodev" = "yes"; then
215     AC_DEFINE([ENABLE_CRYPTODEV], 1, [Enable cryptodev support])
216   fi
218   # For storing integers in pointers without warnings
219   # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
220   AC_CHECK_SIZEOF(void *)
221   AC_CHECK_SIZEOF(long)
222   AC_CHECK_SIZEOF(int)
223   case $ac_cv_sizeof_void_p in
224     $ac_cv_sizeof_long)
225       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long)],
226                 [Additional cast to bring void* to a type castable to int.])
227       ;;
228     *)
229       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [])
230       ;;
231   esac