2af9192cca3a0cfb83df87eca8078a5b556412e0
[ira/wip.git] / source4 / lib / tls / config.m4
1 ###############################
2 # start SMB_EXT_LIB_GNUTLS
3 # check for gnutls/gnutls.h and -lgnutls
4
5 use_gnutls=yes
6 AC_ARG_ENABLE(gnutls,
7 [  --enable-gnutls          Turn on gnutls support (default=yes)],
8     [if test x$enable_gnutls = xno; then
9         use_gnutls=no
10     fi])
11
12
13 if test x$use_gnutls = xyes; then
14         SMB_EXT_LIB_FROM_PKGCONFIG(GNUTLS, gnutls, 
15                                                            [SMB_ENABLE_GNUTLS=YES], 
16                                                            [SMB_ENABLE_GNUTLS=NO])
17         
18         if test x$SMB_ENABLE_GNUTLS = xNO; then
19                 AC_CHECK_HEADERS(gnutls/gnutls.h)
20                 AC_CHECK_LIB_EXT(gnutls, GNUTLS_LIBS, gnutls_global_init)
21                 AC_CHECK_DECL(gnutls_x509_crt_set_version,  
22                               [AC_DEFINE(HAVE_GNUTLS_X509_CRT_SET_VERSION,1,gnutls set_version)], [], [
23                 #include <gnutls/gnutls.h>
24                 #include <gnutls/x509.h>
25                 ])
26                 if test x"$ac_cv_header_gnutls_gnutls_h" = x"yes" -a x"$ac_cv_lib_ext_gnutls_gnutls_global_init" = x"yes" -a x"$ac_cv_have_decl_gnutls_x509_crt_set_version" = x"yes";then
27                         SMB_ENABLE(GNUTLS,YES)
28                         AC_CHECK_DECL(gnutls_x509_crt_set_subject_key_id,  
29                                       [AC_DEFINE(HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID,1,gnutls subject_key)], [], [
30                 #include <gnutls/gnutls.h>
31                 #include <gnutls/x509.h>
32                 ])
33                 fi
34                 SMB_EXT_LIB(GNUTLS, $GNUTLS_LIBS)
35         fi
36         if test x$SMB_ENABLE_GNUTLS = xYES; then
37                 #Some older versions have a different type name
38                 AC_CHECK_TYPES([gnutls_datum],,,[#include "gnutls/gnutls.h"])
39                 AC_CHECK_TYPES([gnutls_datum_t],,,[#include "gnutls/gnutls.h"])
40                 AC_DEFINE(ENABLE_GNUTLS,1,[Whether we have gnutls support (SSL)])
41         fi
42 fi
43 # end SMB_EXT_LIB_GNUTLS
44 ###############################