[evolution-mapi] Test whether Openchange provides windows_to_utf8 function



commit 50bdfee781e0e706bc8e139bb28b61ee336fd5f6
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 5 16:25:25 2010 +0100

    Test whether Openchange provides windows_to_utf8 function
    
    To be able to compile with its trunk without issues. This is until
    evolution-mapi will depend on 0.10+.

 configure.ac                              |   14 ++++++++++++++
 src/libexchangemapi/exchange-mapi-utils.c |    6 ++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d15f050..83b7fe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,20 @@ AC_SUBST(LIBMAPI_CFLAGS)
 AC_SUBST(LIBMAPI_LIBS)
 
 dnl ****************************
+dnl Check for windows_to_utf8 function
+dnl ****************************
+AC_MSG_CHECKING([libmapi windows_to_utf8 function])
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+	[[#include <libmapi/libmapi.h>]],
+	[[windows_to_utf8 (NULL, NULL)]])],
+	[AC_DEFINE(HAVE_WINDOWS_TO_UTF8, 1, [libmapi provides windows_to_utf8 function]) ac_cv_have_wtu=yes],[ac_cv_have_wtu=no])
+CFLAGS=$save_cflags
+LIBS=$save_libs
+AC_MSG_RESULT([$ac_cv_have_wtu])
+
+dnl ****************************
 dnl Expose version information
 dnl ****************************
 API_VERSION=$EDS_PACKAGE
diff --git a/src/libexchangemapi/exchange-mapi-utils.c b/src/libexchangemapi/exchange-mapi-utils.c
index 3a91e1f..2f9430b 100644
--- a/src/libexchangemapi/exchange-mapi-utils.c
+++ b/src/libexchangemapi/exchange-mapi-utils.c
@@ -44,6 +44,11 @@
 gchar *
 utf8tolinux (const char *wstring)
 {
+	#ifndef HAVE_WINDOWS_TO_UTF8
+	/* newer Openchange (0.10+) doesn't provide windows_to_utf8 function,
+	   it does all the necessary decoding to utf8 transparently */
+	return g_strdup (wstring);
+	#else
 	TALLOC_CTX 	*mem_ctx;
 	gchar		*newstr, *retval = NULL;
 	gint i;
@@ -78,6 +83,7 @@ utf8tolinux (const char *wstring)
 	talloc_free (mem_ctx);
 
 	return retval;
+	#endif
 }
 
 inline gchar *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]