corrected copyright notices
[gnutls.git] / m4 / hooks.m4
blob5812205f99d75f6d30fd89a44cff87a31f8fbba8
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, 43)
43   AC_SUBST(LT_REVISION, 0)
44   AC_SUBST(LT_AGE, 15)
46   AC_SUBST(LT_SSL_CURRENT, 27)
47   AC_SUBST(LT_SSL_REVISION, 2)
48   AC_SUBST(LT_SSL_AGE, 0)
50   AC_SUBST(LT_DANE_CURRENT, 1)
51   AC_SUBST(LT_DANE_REVISION, 0)
52   AC_SUBST(LT_DANE_AGE, 1)
54   AC_SUBST(CXX_LT_CURRENT, 29)
55   AC_SUBST(CXX_LT_REVISION, 0)
56   AC_SUBST(CXX_LT_AGE, 1)
58   AC_SUBST(CRYWRAP_PATCHLEVEL, 3)
60   # Used when creating the Windows libgnutls-XX.def files.
61   DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
62   AC_SUBST(DLL_VERSION)
64   cryptolib="nettle"
66 dnl  AC_ARG_WITH(libgcrypt,
67 dnl    AS_HELP_STRING([--with-libgcrypt], [use libgcrypt as crypto library]),
68 dnl      libgcrypt=$withval,
69 dnl      libgcrypt=no)
70 dnl    if test "$libgcrypt" = "yes"; then
71 dnl        cryptolib=libgcrypt
72 dnl        AC_DEFINE([HAVE_GCRYPT], 1, [whether the gcrypt library is in use])
73 dnl     AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>],
74 dnl                      [enum gcry_cipher_algos i = GCRY_CIPHER_CAMELLIA128])
75 dnl      if test "$ac_cv_libgcrypt" != yes; then
76 dnl        AC_MSG_ERROR([[
77 dnl***  
78 dnl*** Libgcrypt v1.4.0 or later was not found. You may want to get it from
79 dnl*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
80 dnl***
81 dnl    ]])
82 dnl      fi
83 dnl    fi
85   AC_MSG_CHECKING([whether to use nettle])
86 if test "$cryptolib" = "nettle";then
87   AC_MSG_RESULT(yes)
88     AC_LIB_HAVE_LINKFLAGS([nettle], [hogweed gmp], [#include <nettle/rsa.h>],
89                           [rsa_decrypt_tr (0,0,0,0,0,0,0)])
90     if test "$ac_cv_libnettle" != yes; then
91       AC_MSG_ERROR([[
92   *** 
93   *** Libnettle 2.5 was not found. Note that you must compile nettle with gmp support.
94   ]])
95     fi
96 else
97   AC_MSG_RESULT(no)
99   AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
101   AC_ARG_WITH(included-libtasn1,
102     AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
103       included_libtasn1=$withval,
104       included_libtasn1=no)
105   if test "$included_libtasn1" = "no"; then
106     PKG_CHECK_MODULES(LIBTASN1, [libtasn1 >= 3.1], [], [included_libtasn1=yes])
107     if test "$included_libtasn1" = yes; then
108       AC_MSG_WARN([[
109   *** 
110   *** Libtasn1 was not found. Will use the included one.
111   ]])
112     fi
113   fi
114   AC_MSG_CHECKING([whether to use the included minitasn1])
115   AC_MSG_RESULT($included_libtasn1)
116   AM_CONDITIONAL(ENABLE_MINITASN1, test "$included_libtasn1" = "yes")
118   if test "$included_libtasn1" = "no"; then
119     GNUTLS_REQUIRES_PRIVATE="Requires.private: libtasn1"
120   fi
122   AC_MSG_CHECKING([whether C99 macros are supported])
123   AC_TRY_COMPILE(,
124   [
125     #define test_mac(...) 
126     int z,y,x;
127     test_mac(x,y,z);
128     return 0;
129   ], [
130     AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])
131     AC_MSG_RESULT(yes)
132   ], [
133     AC_MSG_RESULT(no)
134     AC_MSG_WARN([C99 macros not supported. This may affect compiling.])
135   ])
137   ac_enable_srtp=yes
138   AC_MSG_CHECKING([whether to disable DTLS-SRTP extension])
139   AC_ARG_ENABLE(dtls-srtp-support,
140     AS_HELP_STRING([--disable-dtls-srtp-support],
141                    [disable support for the DTLS-SRTP extension]),
142     ac_enable_srtp=no)
143   if test x$ac_enable_srtp != xno; then
144    AC_MSG_RESULT(no)
145    AC_DEFINE([ENABLE_DTLS_SRTP], 1, [enable DTLS-SRTP support])
146   else
147    ac_full=0
148    AC_MSG_RESULT(yes)
149   fi
150   AM_CONDITIONAL(ENABLE_DTLS_SRTP, test "$ac_enable_srtp" != "no")
152   ac_enable_srp=yes
153   AC_MSG_CHECKING([whether to disable SRP authentication support])
154   AC_ARG_ENABLE(srp-authentication,
155     AS_HELP_STRING([--disable-srp-authentication],
156                    [disable the SRP authentication support]),
157     ac_enable_srp=no)
158   if test x$ac_enable_srp != xno; then
159    AC_MSG_RESULT(no)
160    AC_DEFINE([ENABLE_SRP], 1, [enable SRP authentication])
161   else
162    ac_full=0
163    AC_MSG_RESULT(yes)
164   fi
165   AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
166   
167   ac_enable_psk=yes
168   AC_MSG_CHECKING([whether to disable PSK authentication support])
169   AC_ARG_ENABLE(psk-authentication,
170     AS_HELP_STRING([--disable-psk-authentication],
171                    [disable the PSK authentication support]),
172     ac_enable_psk=no)
173   if test x$ac_enable_psk != xno; then
174    AC_MSG_RESULT(no)
175    AC_DEFINE([ENABLE_PSK], 1, [enable PSK authentication])
176   else
177    ac_full=0
178    AC_MSG_RESULT(yes)
179   fi
180   AM_CONDITIONAL(ENABLE_PSK, test "$ac_enable_psk" != "no")
181   
182   ac_enable_anon=yes
183   AC_MSG_CHECKING([whether to disable anonymous authentication support])
184   AC_ARG_ENABLE(anon-authentication,
185     AS_HELP_STRING([--disable-anon-authentication],
186                    [disable the anonymous authentication support]),
187     ac_enable_anon=no)
188   if test x$ac_enable_anon != xno; then
189    AC_MSG_RESULT(no)
190    AC_DEFINE([ENABLE_ANON], 1, [enable anonymous authentication])
191   else
192    ac_full=0
193    AC_MSG_RESULT(yes)
194   fi
195   AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
196   
197   ac_enable_openpgp=yes
198   AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
199   AC_ARG_ENABLE(openpgp-authentication,
200     AS_HELP_STRING([--disable-openpgp-authentication],
201                    [disable the OpenPGP authentication support]),
202     ac_enable_openpgp=no)
203   if test x$ac_enable_openpgp = xno; then
204    AC_MSG_RESULT(yes)
205    ac_full=0
206   else
207    AC_DEFINE([ENABLE_OPENPGP], 1, [use openpgp authentication])
208    AC_MSG_RESULT(no)
209   fi
210   AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
212   # For cryptodev
213   AC_MSG_CHECKING([whether to add cryptodev support])
214   AC_ARG_ENABLE(cryptodev,
215     AS_HELP_STRING([--enable-cryptodev], [enable cryptodev support]),
216   enable_cryptodev=yes,enable_cryptodev=no)
217   AC_MSG_RESULT($enable_cryptodev)
219   if test "$enable_cryptodev" = "yes"; then
220     AC_DEFINE([ENABLE_CRYPTODEV], 1, [Enable cryptodev support])
221   fi
223   AC_MSG_CHECKING([whether to disable OCSP support])
224   AC_ARG_ENABLE(ocsp,
225     AS_HELP_STRING([--disable-ocsp],
226                    [disable OCSP support]),
227     ac_enable_ocsp=no)
228   if test x$ac_enable_ocsp != xno; then
229    ac_enable_ocsp=yes
230    AC_MSG_RESULT(no)
231    AC_DEFINE([ENABLE_OCSP], 1, [enable OCSP support])
232   else
233    ac_full=0
234    AC_MSG_RESULT(yes)
235   fi
236   AM_CONDITIONAL(ENABLE_OCSP, test "$ac_enable_ocsp" != "no")
238   # For storing integers in pointers without warnings
239   # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
240   AC_CHECK_SIZEOF(void *)
241   AC_CHECK_SIZEOF(long long)
242   AC_CHECK_SIZEOF(long)
243   AC_CHECK_SIZEOF(int)
244   if test x$ac_cv_sizeof_void_p = x$ac_cv_sizeof_long;then
245       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long)],
246                 [Additional cast to bring void* to a type castable to int.])
247   elif test x$ac_cv_sizeof_void_p = x$ac_cv_sizeof_long_long;then
248       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [(long long)],
249                 [Additional cast to bring void* to a type castable to int.])
250    else
251       AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST], [])
252    fi
254 dnl this is called from somewhere else
255 dnl #AM_ICONV
256 dnl m4_ifdef([gl_ICONV_MODULE_INDICATOR],
257 dnl  [gl_ICONV_MODULE_INDICATOR([iconv])])