changeset 25133:309f6dca369a

Use _set_default_priority on gnutls versions lacking _priority_set_direct. Versions of gnutls prior to 2.2.0 do not have gnutls_priority_set_direct. This fixes a compilation issue in c84a41f40179331c218ac05005ce7805129049e5 on such systems. This should not represent a regression from 2.5.4 on systems without gnutls 2.2.0 or newer. Fixes #8526
author Ethan Blanton <elb@pidgin.im>
date Sun, 01 Mar 2009 20:56:20 +0000
parents 6eff00e729ac
children c1e166da7e46
files configure.ac libpurple/plugins/ssl/ssl-gnutls.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat Feb 21 23:26:22 2009 +0000
+++ b/configure.ac	Sun Mar 01 20:56:20 2009 +0000
@@ -1702,6 +1702,22 @@
 AC_SUBST(GNUTLS_CFLAGS)
 AC_SUBST(GNUTLS_LIBS)
 
+if test "x$enable_gnutls" = "xyes"; then
+	AC_MSG_CHECKING(for gnutls_priority_set_direct)
+	LIBS_save="$LIBS"
+	LIBS="$LIBS $GNUTLS_LIBS"
+	CPPFLAGS_save="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
+	AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <gnutls/gnutls.h>],
+                                        [gnutls_session s; gnutls_priority_set_direct(s, NULL, NULL);])],
+	               [AC_DEFINE([HAVE_GNUTLS_PRIORITY_FUNCS], 1,
+                                  [Define if your gnutls has gnutls_priority_set_direct and friends])
+	                AC_MSG_RESULT(yes)],
+	               [AC_MSG_RESULT(no)])
+	CPPFLAGS="$CPPFLAGS_save"
+        LIBS="$LIBS_save"
+fi
+
 AM_CONDITIONAL(USE_GNUTLS, test "x$enable_gnutls" = "xyes")
 
 
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Sat Feb 21 23:26:22 2009 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Sun Mar 01 20:56:20 2009 +0000
@@ -256,9 +256,13 @@
 	gsc->private_data = gnutls_data;
 
 	gnutls_init(&gnutls_data->session, GNUTLS_CLIENT);
+#ifdef HAVE_GNUTLS_PRIORITY_FUNCS
 	if (gnutls_priority_set_direct(gnutls_data->session,
 		                             "NORMAL:%SSL3_RECORD_VERSION", NULL))
 		gnutls_priority_set_direct(gnutls_data->session, "NORMAL", NULL);
+#else
+	gnutls_set_default_priority(gnutls_data->session);
+#endif
 
 	gnutls_certificate_type_set_priority(gnutls_data->session,
 		cert_type_priority);