* eet: Correctly detect GNUTLS hability.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 18 Dec 2009 17:41:43 +0000 (17:41 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 18 Dec 2009 17:41:43 +0000 (17:41 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@44548 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/eet_cipher.c

index f91e2fc..591954c 100644 (file)
@@ -95,11 +95,11 @@ AC_MSG_RESULT([${want_gnutls}])
 
 # Specific GNUTLS improvement
 
-new_gnutls_api="no"
+new_gnutls_api="yes"
 AC_ARG_ENABLE(new-gnutls-api,
    [AC_HELP_STRING(
-      [--enable-new-gnutls-api],
-      [enable use of gnutls_x509_crt_verify_hash. [[default=disable]]]
+      [--disable-new-gnutls-api],
+      [enable use of gnutls_x509_crt_verify_hash. [[default=enable]]]
     )],
    [new_gnutls_api=$enableval]
 )
@@ -107,9 +107,14 @@ AC_MSG_CHECKING([whether to use gnutls_x509_crt_verify_hash])
 AC_MSG_RESULT([${new_gnutls_api}])
 
 if test "x${new_gnutls_api}" = "xyes" ; then
-   AC_DEFINE(EET_USE_NEW_GNUTLS_API, 1, [use gnutls_x509_crt_verify_hash])
-else
-   AC_DEFINE(EET_USE_NEW_GNUTLS_API, 0, [don't use gnutls_x509_crt_verify_hash])
+   AC_CHECK_LIB(gnutls, gnutls_x509_crt_verify_hash,
+                [ new_gnutls_api="yes" ],
+               [ new_gnutls_api="no" ]
+               )
+
+   if test "x${new_gnutls_api}" = "xyes"; then
+      AC_DEFINE(EET_USE_NEW_GNUTLS_API, 1, [use gnutls_x509_crt_verify_hash])
+   fi
 fi
 
 # Openssl support
index 52ba09b..903e4b6 100644 (file)
@@ -558,11 +558,13 @@ eet_identity_check(const void *data_base, unsigned int data_length,
 
 # ifdef HAVE_GNUTLS
    gnutls_x509_crt_t cert;
-   gcry_md_hd_t md;
    gnutls_datum_t datum;
    gnutls_datum_t signature;
+#  if EET_USE_NEW_GNUTLS_API
    unsigned char *hash;
+   gcry_md_hd_t md;
    int err;
+#  endif
 
    /* Create an understanding certificate structure for gnutls */
    datum.data = (void *)cert_der;