Index: configure.in
===================================================================
--- configure.in	(revision 9793)
+++ configure.in	(working copy)
@@ -33,6 +33,7 @@
 m4_define([gnome_keyring_minimum_version], [2.20.1])
 m4_define([sqlite_minimum_version], [3.5])
 m4_define([gweather_minimum_version], [2.25.3])
+m4_define([libical_minimum_version], [0.42])
 
 dnl *************************************************************************************************
 dnl Base Version
@@ -244,6 +245,13 @@
 	 gweather >= gweather_minimum_version])
 
 dnl **************************************************
+dnl Check for libical
+dnl **************************************************
+PKG_CHECK_MODULES(LIBICAL, libical >= libical_minimum_version)
+LIBICAL_REQUIRED=libical_minimum_version
+AC_SUBST(LIBICAL_REQUIRED)
+
+dnl **************************************************
 dnl * regex checking
 dnl **************************************************
 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
@@ -995,7 +1003,6 @@
 
 if test "x${enable_calendar}" != "xno"; then
         AC_DEFINE(ENABLE_CALENDAR, 1, [Define if Calendar should be built])
-	AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [Define it once memory returned by libical is free'ed properly])
 fi
 AM_CONDITIONAL(ENABLE_CALENDAR, test x$enable_calendar = xyes)
 AC_MSG_RESULT($enable_calendar)
@@ -1665,9 +1672,6 @@
 export privincludedir
 export privdatadir
 
-if test $enable_calendar = yes; then
-        AC_CONFIG_SUBDIRS(calendar/libical)
-fi
 if test $dynamic_libdb = no; then
         AC_CONFIG_SUBDIRS(libdb/dist)
 fi
Index: docs/reference/camel/tmpl/camel-unused.sgml
===================================================================
--- docs/reference/camel/tmpl/camel-unused.sgml	(revision 9793)
+++ docs/reference/camel/tmpl/camel-unused.sgml	(working copy)
@@ -186,6 +186,30 @@
 camel-search-private
 
 
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/camel-search-sql-sexp.h.sgml:Title ##### -->
+camel-search-sql-sexp.h
+
+
 <!-- ##### SECTION ./tmpl/camel-types.sgml:Long_Description ##### -->
 <para>
 
Index: docs/reference/calendar/libedata-cal/Makefile.am
===================================================================
--- docs/reference/calendar/libedata-cal/Makefile.am	(revision 9793)
+++ docs/reference/calendar/libedata-cal/Makefile.am	(working copy)
@@ -21,12 +21,9 @@
 GTKDOC_CFLAGS = \
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
 	-I$(top_builddir)				\
 	-I$(top_builddir)/calendar			\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src/libical	\
+	$(LIBICAL_CFLAGS)				\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 GTKDOC_LIBS = \
Index: docs/reference/calendar/libecal/Makefile.am
===================================================================
--- docs/reference/calendar/libecal/Makefile.am	(revision 9793)
+++ docs/reference/calendar/libecal/Makefile.am	(working copy)
@@ -22,13 +22,10 @@
 GTKDOC_CFLAGS = \
 	-I$(top_srcdir) 					\
 	-I$(top_srcdir)/calendar				\
-	-I$(top_srcdir)/calendar/libical/src			\
-	-I$(top_srcdir)/calendar/libical/src/libical		\
 	-I$(top_builddir)					\
 	-I$(top_builddir)/calendar				\
 	-I$(top_builddir)/calendar/libecal			\
-	-I$(top_builddir)/calendar/libical/src			\
-	-I$(top_builddir)/calendar/libical/src/libical		\
+	$(LIBICAL_CFLAGS)					\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 GTKDOC_LIBS = \

Property changes on: calendar
___________________________________________________________________
Deleted: svn:externals
   - libical http://svn.gnome.org/svn/libical/trunk


Index: calendar/libedata-cal/e-cal-backend-cache.c
===================================================================
--- calendar/libedata-cal/e-cal-backend-cache.c	(revision 9793)
+++ calendar/libedata-cal/e-cal-backend-cache.c	(working copy)
@@ -618,7 +618,7 @@
 	if (!icalcomp)
 		return FALSE;
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	if (e_file_cache_get_object (E_FILE_CACHE (cache), icaltimezone_get_tzid ((icaltimezone *)zone))) {
 		retval = e_file_cache_replace_object (E_FILE_CACHE (cache),
 						      icaltimezone_get_tzid ((icaltimezone *)zone),
@@ -667,7 +667,7 @@
 	if (!icalcomp)
 		return FALSE;
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	if (e_file_cache_get_object (E_FILE_CACHE (cache), "default_zone")) {
 		retval = e_file_cache_replace_object (E_FILE_CACHE (cache), "default_zone",
 						      obj);
Index: calendar/libedata-cal/e-cal-backend-sync.c
===================================================================
--- calendar/libedata-cal/e-cal-backend-sync.c	(revision 9793)
+++ calendar/libedata-cal/e-cal-backend-sync.c	(working copy)
@@ -906,7 +906,7 @@
 						/* change tzid to our, because the component has the buildin tzid */
 						icalproperty_set_tzid (prop, tzid);
 
-						object = icalcomponent_as_ical_string (clone);
+						object = icalcomponent_as_ical_string_r (clone);
 					}
 					icalcomponent_free (clone);
 				}
Index: calendar/libedata-cal/libedata-cal.pc.in
===================================================================
--- calendar/libedata-cal/libedata-cal.pc.in	(revision 9793)
+++ calendar/libedata-cal/libedata-cal.pc.in	(working copy)
@@ -13,6 +13,6 @@
 Name: libedata-cal
 Description: Backend library for evolution calendars
 Version: @VERSION@
-Requires: libbonobo-2.0 >= @LIBBONOBO_REQUIRED@ libedataserver-1.2 libebackend-1.2 libecal-1.2 gio-2.0
+Requires: libbonobo-2.0 >= @LIBBONOBO_REQUIRED@ libical >= @LIBICAL_REQUIRED@ libedataserver-1.2 libebackend-1.2 libecal-1.2 gio-2.0
 Libs: -L${libdir} -ledata-cal-1.2 -lecal-1.2
 Cflags: -I${privincludedir}
Index: calendar/libedata-cal/Makefile.am
===================================================================
--- calendar/libedata-cal/Makefile.am	(revision 9793)
+++ calendar/libedata-cal/Makefile.am	(working copy)
@@ -1,13 +1,11 @@
 INCLUDES =						\
 	-DG_LOG_DOMAIN=\"libedata-cal\"			\
+	-DBASE_VERSION=\""$(BASE_VERSION)"\"		\
 	-I$(top_srcdir)					\
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
+	$(LIBICAL_CFLAGS)				\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 CORBA_GENERATED_H =				\
@@ -48,8 +46,9 @@
 
 libedata_cal_1_2_la_LIBADD =					\
 	$(top_builddir)/calendar/libecal/libecal-1.2.la		\
-	$(top_builddir)/libedataserver/libedataserver-1.2.la \
-	$(top_builddir)/libebackend/libebackend-1.2.la \
+	$(top_builddir)/libedataserver/libedataserver-1.2.la 	\
+	$(top_builddir)/libebackend/libebackend-1.2.la 		\
+	$(LIBICAL_LIBS)						\
 	$(EVOLUTION_CALENDAR_LIBS)
 
 libedata_cal_1_2_la_LDFLAGS = 								\
Index: calendar/libedata-cal/e-data-cal-factory.c
===================================================================
--- calendar/libedata-cal/e-data-cal-factory.c	(revision 9793)
+++ calendar/libedata-cal/e-data-cal-factory.c	(working copy)
@@ -139,8 +139,8 @@
 		g_signal_emit (G_OBJECT (factory), signals[LAST_CALENDAR_GONE], 0);
 }
 
-
 
+
 static GNOME_Evolution_Calendar_Cal
 impl_CalFactory_getCal (PortableServer_Servant servant,
 			const CORBA_char *source_xml,
Index: calendar/tests/ecal/test-ecal.c
===================================================================
--- calendar/tests/ecal/test-ecal.c	(revision 9793)
+++ calendar/tests/ecal/test-ecal.c	(working copy)
@@ -115,7 +115,7 @@
 		printf ("\n");
 
 		for (l = objects; l; l = l->next) {
-			char *obj = icalcomponent_as_ical_string (l->data);
+			char *obj = icalcomponent_as_ical_string_r (l->data);
 			printf ("------------------------------\n");
 			printf ("%s", obj);
 			printf ("------------------------------\n");
@@ -537,7 +537,7 @@
 	GError *error = NULL;
 	char *ical_string;
 	if (e_cal_get_default_object (client, &icalcomp, &error)) {
-		ical_string = icalcomponent_as_ical_string (icalcomp);
+		ical_string = icalcomponent_as_ical_string_r (icalcomp);
 		cl_printf (client, "Obtained default object: %s\n", ical_string);
 		g_free (ical_string);
 		tests_passed++;
@@ -594,7 +594,7 @@
 		return error->message;
 	}
 
-	actual = icalcomponent_as_ical_string (icalcomp);
+	actual = icalcomponent_as_ical_string_r (icalcomp);
 	compare = !strcmp (actual, EXPECTED);
 
 	g_free (actual);
Index: calendar/tests/ecal/Makefile.am
===================================================================
--- calendar/tests/ecal/Makefile.am	(revision 9793)
+++ calendar/tests/ecal/Makefile.am	(working copy)
@@ -4,10 +4,7 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
+	$(LIBICAL_CFLAGS)				\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 EXTRA_DIST =                          \
@@ -27,7 +24,7 @@
 	-DG_LOG_DOMAIN=\"test-ecal\"
 test_ecal_LDADD =								\
 	$(top_builddir)/calendar/libecal/libecal-1.2.la				\
-	$(top_builddir)/calendar/libical/src/libical/libical-evolution.la	\
+	$(LIBICAL_LIBS)								\
 	$(EVOLUTION_CALENDAR_LIBS)
 
 test_recur_SOURCES = test-recur.c
@@ -36,7 +33,7 @@
 	-DG_LOG_DOMAIN=\"test-ecal\"
 test_recur_LDADD =								\
 	$(top_builddir)/calendar/libecal/libecal-1.2.la				\
-	$(top_builddir)/calendar/libical/src/libical/libical-evolution.la	\
+	$(LIBICAL_LIBS)								\
 	$(EVOLUTION_CALENDAR_LIBS)
 
 test_search_SOURCES = test-search.c
@@ -45,5 +42,5 @@
 	-DG_LOG_DOMAIN=\"test-ecal\"
 test_search_LDADD =								\
 	$(top_builddir)/calendar/libecal/libecal-1.2.la				\
-	$(top_builddir)/calendar/libical/src/libical/libical-evolution.la	\
+	$(LIBICAL_LIBS)								\
 	$(EVOLUTION_CALENDAR_LIBS)
Index: calendar/Makefile.am
===================================================================
--- calendar/Makefile.am	(revision 9793)
+++ calendar/Makefile.am	(working copy)
@@ -1 +1 @@
-SUBDIRS = libical idl libecal libedata-cal backends tests
\ No newline at end of file
+SUBDIRS = idl libecal libedata-cal backends tests
Index: calendar/backends/file/e-cal-backend-file.c
===================================================================
--- calendar/backends/file/e-cal-backend-file.c	(revision 9793)
+++ calendar/backends/file/e-cal-backend-file.c	(working copy)
@@ -171,7 +171,7 @@
 		goto error;
 	}
 
-	buf = icalcomponent_as_ical_string (priv->icalcomp);
+	buf = icalcomponent_as_ical_string_r (priv->icalcomp);
 	g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (char), NULL, NULL, &e);
 	g_free (buf);
 
@@ -738,7 +738,7 @@
 		if (!old_icomp)
 			return;
 
-		old_obj_str = icalcomponent_as_ical_string (old_icomp);
+		old_obj_str = icalcomponent_as_ical_string_r (old_icomp);
 		if (!old_obj_str)
 			return;
 
@@ -773,7 +773,7 @@
 		if (!new_icomp)
 			return;
 
-		new_obj_str = icalcomponent_as_ical_string (new_icomp);
+		new_obj_str = icalcomponent_as_ical_string_r (new_icomp);
 		if (!new_obj_str)
 			return;
 
@@ -785,8 +785,8 @@
 		if (!old_icomp || !new_icomp)
 			return;
 
-		old_obj_str = icalcomponent_as_ical_string (old_icomp);
-		new_obj_str = icalcomponent_as_ical_string (new_icomp);
+		old_obj_str = icalcomponent_as_ical_string_r (old_icomp);
+		new_obj_str = icalcomponent_as_ical_string_r (new_icomp);
 		if (!old_obj_str || !new_obj_str)
 			return;
 
@@ -1145,7 +1145,7 @@
 				return GNOME_Evolution_Calendar_ObjectNotFound;
                         }
 
-			*object = icalcomponent_as_ical_string (icalcomp);
+			*object = icalcomponent_as_ical_string_r (icalcomp);
 
 			icalcomponent_free (icalcomp);
 		}
@@ -1162,7 +1162,7 @@
 			/* add all detached recurrences */
 			g_hash_table_foreach (obj_data->recurrences, (GHFunc) add_detached_recur_to_vcalendar, icalcomp);
 
-			*object = icalcomponent_as_ical_string (icalcomp);
+			*object = icalcomponent_as_ical_string_r (icalcomp);
 
 			icalcomponent_free (icalcomp);
 		} else
@@ -1209,7 +1209,7 @@
 		return GNOME_Evolution_Calendar_InvalidObject;
 	}
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 	return GNOME_Evolution_Calendar_Success;
@@ -1556,7 +1556,7 @@
 	if (users == NULL) {
 		if (e_cal_backend_mail_account_get_default (&address, &name)) {
 			vfb = create_user_free_busy (cbfile, address, name, start, end);
-			calobj = icalcomponent_as_ical_string (vfb);
+			calobj = icalcomponent_as_ical_string_r (vfb);
 			*freebusy = g_list_append (*freebusy, calobj);
 			icalcomponent_free (vfb);
 			g_free (address);
@@ -1567,7 +1567,7 @@
 			address = l->data;
 			if (e_cal_backend_mail_account_is_valid (address, &name)) {
 				vfb = create_user_free_busy (cbfile, address, name, start, end);
-				calobj = icalcomponent_as_ical_string (vfb);
+				calobj = icalcomponent_as_ical_string_r (vfb);
 				*freebusy = g_list_append (*freebusy, calobj);
 				icalcomponent_free (vfb);
 				g_free (name);
Index: calendar/backends/file/Makefile.am
===================================================================
--- calendar/backends/file/Makefile.am	(revision 9793)
+++ calendar/backends/file/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 extension_LTLIBRARIES = libecalbackendfile.la
Index: calendar/backends/http/e-cal-backend-http.c
===================================================================
--- calendar/backends/http/e-cal-backend-http.c	(revision 9793)
+++ calendar/backends/http/e-cal-backend-http.c	(working copy)
@@ -338,14 +338,14 @@
 				e_cal_component_get_uid (comp, &uid);
 				/* middle (void*) cast only because of 'dereferencing type-punned pointer will break strict-aliasing rules' */
 				if (g_hash_table_lookup_extended (old_cache, uid, (void **)(void*)&orig_key, (void **)(void*)&orig_value)) {
-					obj = icalcomponent_as_ical_string (subcomp);
+					obj = icalcomponent_as_ical_string_r (subcomp);
 					e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbhttp),
 									      orig_value,
 									      obj);
 					g_free (obj);
 					g_hash_table_remove (old_cache, uid);
 				} else {
-					obj = icalcomponent_as_ical_string (subcomp);
+					obj = icalcomponent_as_ical_string_r (subcomp);
 					e_cal_backend_notify_object_created (E_CAL_BACKEND (cbhttp),
 									     obj);
 					g_free (obj);
@@ -706,7 +706,7 @@
 
 	kind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
 	icalcomp = e_cal_util_new_component (kind);
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 	icalcomponent_free (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
@@ -764,7 +764,7 @@
 	if (!icalcomp)
 		return GNOME_Evolution_Calendar_InvalidObject;
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
@@ -1065,7 +1065,7 @@
         if (users == NULL) {
 		if (e_cal_backend_mail_account_get_default (&address, &name)) {
                         vfb = create_user_free_busy (cbhttp, address, name, start, end);
-                        calobj = icalcomponent_as_ical_string (vfb);
+                        calobj = icalcomponent_as_ical_string_r (vfb);
                         *freebusy = g_list_append (*freebusy, calobj);
                         icalcomponent_free (vfb);
                         g_free (address);
@@ -1077,7 +1077,7 @@
                         address = l->data;
                         if (e_cal_backend_mail_account_is_valid (address, &name)) {
                                 vfb = create_user_free_busy (cbhttp, address, name, start, end);
-                                calobj = icalcomponent_as_ical_string (vfb);
+                                calobj = icalcomponent_as_ical_string_r (vfb);
                                 *freebusy = g_list_append (*freebusy, calobj);
                                 icalcomponent_free (vfb);
                                 g_free (name);
Index: calendar/backends/http/Makefile.am
===================================================================
--- calendar/backends/http/Makefile.am	(revision 9793)
+++ calendar/backends/http/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	$(EVOLUTION_CALENDAR_CFLAGS)			\
 	$(SOUP_CFLAGS)
 
Index: calendar/backends/weather/e-cal-backend-weather.c
===================================================================
--- calendar/backends/weather/e-cal-backend-weather.c	(revision 9793)
+++ calendar/backends/weather/e-cal-backend-weather.c	(working copy)
@@ -159,7 +159,7 @@
 		icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (l->data));
 		id = e_cal_component_get_id (E_CAL_COMPONENT (l->data));
 
-		obj = icalcomponent_as_ical_string (icomp);
+		obj = icalcomponent_as_ical_string_r (icomp);
 		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbw),
 			id,
 			obj,
@@ -178,7 +178,7 @@
 
 		e_cal_backend_cache_put_component (priv->cache, comp);
 		icomp = e_cal_component_get_icalcomponent (comp);
-		obj = icalcomponent_as_ical_string (icomp);
+		obj = icalcomponent_as_ical_string_r (icomp);
 		e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), obj);
 		g_free (obj);
 
@@ -195,7 +195,7 @@
 					if (comp) {
 						e_cal_backend_cache_put_component (priv->cache, comp);
 						icomp = e_cal_component_get_icalcomponent (comp);
-						obj = icalcomponent_as_ical_string (icomp);
+						obj = icalcomponent_as_ical_string_r (icomp);
 						e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), obj);
 						g_free (obj);
 					}
@@ -583,7 +583,7 @@
 	if (!icalcomp)
 		return GNOME_Evolution_Calendar_InvalidObject;
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
@@ -665,7 +665,7 @@
 	icalcomponent_set_dtstart (vfb, icaltime_from_timet_with_zone (start, FALSE, utc_zone));
 	icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
 
-	calobj = icalcomponent_as_ical_string (vfb);
+	calobj = icalcomponent_as_ical_string_r (vfb);
 	*freebusy = g_list_append (NULL, calobj);
 	icalcomponent_free (vfb);
 
Index: calendar/backends/weather/Makefile.am
===================================================================
--- calendar/backends/weather/Makefile.am	(revision 9793)
+++ calendar/backends/weather/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	-I$(top_srcdir)/addressbook			\
 	-I$(top_builddir)/addressbook			\
 	-DE_DATA_SERVER_PREFIX=\"$(prefix)\"		\
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(revision 9793)
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(working copy)
@@ -176,7 +176,7 @@
 				icaltime_adjust (&temp, i, 0, 0, 0);
 				icaltime_set_timezone (&temp, default_zone);
 				temp = icaltime_convert_to_zone (temp, utc);
-				value = icaltime_as_ical_string (temp);
+				value = icaltime_as_ical_string_r (temp);
 				e_gw_item_set_reply_within (item, value);
 				g_free (value);
 			}
@@ -187,7 +187,7 @@
 			icaltime_adjust (&temp, atoi (x_val), 0, 0, 0);
 			icaltime_set_timezone (&temp, default_zone);
 			temp = icaltime_convert_to_zone (temp, utc);
-			expire = icaltime_as_ical_string (temp);
+			expire = icaltime_as_ical_string_r (temp);
 			e_gw_item_set_expires (item, expire);
 			g_free (expire);
 
@@ -197,7 +197,7 @@
 			temp = icaltime_from_string (x_val);
 			icaltime_set_timezone (&temp, default_zone);
 			temp = icaltime_convert_to_zone (temp, utc);
-			delay = icaltime_as_ical_string (temp);
+			delay = icaltime_as_ical_string_r (temp);
 			e_gw_item_set_delay_until (item, delay);
 			g_free (delay);
 
@@ -509,7 +509,7 @@
 		if (ical_recur->count != 0)
 			item_rrule->count = ical_recur->count;
 		else
-			item_rrule->until =  icaltime_as_ical_string (ical_recur->until);
+			item_rrule->until =  icaltime_as_ical_string_r (ical_recur->until);
 
 		item_rrule->interval = ical_recur->interval;
 
@@ -541,7 +541,7 @@
 					if (!icaltime_get_timezone (*(dt->value)))
 						icaltime_set_timezone (dt->value, default_zone ? default_zone : utc);
 					itt_utc = icaltime_convert_to_zone (*dt->value, utc);
-					item_exdate_list = g_slist_append (item_exdate_list, icaltime_as_ical_string (itt_utc));
+					item_exdate_list = g_slist_append (item_exdate_list, icaltime_as_ical_string_r (itt_utc));
 				}
 			}
 			e_gw_item_set_exdate_list (item, item_exdate_list);
@@ -612,7 +612,7 @@
 			if (!icaltime_get_timezone (*dt.value))
 				icaltime_set_timezone (dt.value, default_zone ? default_zone : utc);
 			itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-			value = icaltime_as_ical_string (itt_utc);
+			value = icaltime_as_ical_string_r (itt_utc);
 			e_gw_item_set_end_date (item, value);
 			g_free (value);
 			e_cal_component_free_datetime (&dt);
@@ -629,7 +629,7 @@
 			if (!icaltime_get_timezone (*dt.value))
 				icaltime_set_timezone (dt.value, default_zone);
 			itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-			value = icaltime_as_ical_string (itt_utc);
+			value = icaltime_as_ical_string_r (itt_utc);
 			e_gw_item_set_due_date (item,  value);
 			g_free (value);
 			e_cal_component_free_datetime (&dt);
@@ -707,7 +707,7 @@
 		if (!icaltime_get_timezone (*dt.value))
 			icaltime_set_timezone (dt.value, default_zone);
 		itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-		value = icaltime_as_ical_string (itt_utc);
+		value = icaltime_as_ical_string_r (itt_utc);
 		e_gw_item_set_start_date (item, value);
 		g_free (value);
 	} else if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
@@ -730,14 +730,14 @@
 		if (!icaltime_get_timezone (*dt.value))
 			icaltime_set_timezone (dt.value, default_zone);
 		itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-		value = icaltime_as_ical_string (itt_utc);
+		value = icaltime_as_ical_string_r (itt_utc);
 		e_gw_item_set_creation_date (item, value);
 		g_free (value);
 	} else {
 		struct icaltimetype itt;
 
 		e_cal_component_get_dtstamp (comp, &itt);
-		value = icaltime_as_ical_string (itt);
+		value = icaltime_as_ical_string_r (itt);
 		e_gw_item_set_creation_date (item, value);
 		g_free (value);
 	}
@@ -1625,10 +1625,10 @@
 
 	utc = icaltimezone_get_utc_timezone ();
 	icaltime = icaltime_from_timet_with_zone (start, FALSE, utc);
-	start_date = icaltime_as_ical_string (icaltime);
+	start_date = icaltime_as_ical_string_r (icaltime);
 
 	icaltime = icaltime_from_timet_with_zone (end, FALSE, utc);
-	end_date = icaltime_as_ical_string (icaltime);
+	end_date = icaltime_as_ical_string_r (icaltime);
 
         e_gw_message_write_string_parameter (msg, "startDate", NULL, start_date);
         e_gw_message_write_string_parameter (msg, "endDate", NULL, end_date);
@@ -2088,7 +2088,7 @@
 			char *value;
 			tt = icaltime_today ();
 			icaltime_adjust (&tt, gopts->delay_until, 0, 0, 0);
-			value = icaltime_as_ical_string (tt);
+			value = icaltime_as_ical_string_r (tt);
 		} else
 			value = g_strdup ("none");
 		e_source_set_property (source, "delay-delivery", value);
Index: calendar/backends/groupwise/Makefile.am
===================================================================
--- calendar/backends/groupwise/Makefile.am	(revision 9793)
+++ calendar/backends/groupwise/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	-I$(top_srcdir)/servers/groupwise		\
 	-I$(top_builddir)/servers/groupwise		\
 	$(EVOLUTION_CALENDAR_CFLAGS)			\
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	(revision 9793)
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	(working copy)
@@ -545,7 +545,7 @@
 			if (!tt.is_date) {
 				tt = icaltime_convert_to_zone (tt, priv->default_zone);
 				icaltime_set_timezone (&tt, priv->default_zone);
-				rid = icaltime_as_ical_string (tt);
+				rid = icaltime_as_ical_string_r (tt);
 				temp = rid;
 			} else
 				rid = calid->ical_id;
@@ -1574,7 +1574,7 @@
         if (!icalcomp)
                 return GNOME_Evolution_Calendar_InvalidObject;
 
-        *object = icalcomponent_as_ical_string (icalcomp);
+        *object = icalcomponent_as_ical_string_r (icalcomp);
 
         return GNOME_Evolution_Calendar_Success;
 }
Index: calendar/backends/caldav/e-cal-backend-caldav.c
===================================================================
--- calendar/backends/caldav/e-cal-backend-caldav.c	(revision 9793)
+++ calendar/backends/caldav/e-cal-backend-caldav.c	(working copy)
@@ -301,7 +301,7 @@
 	}
 
 	if (xprop) {
-		return icalproperty_get_value_as_string (xprop);
+		return icalproperty_get_value_as_string_r (xprop);
 	}
 
 	return NULL;
@@ -1942,7 +1942,7 @@
 		calcomp = icalcomponent_new_clone (icomp);
 	}
 
-	objstr = icalcomponent_as_ical_string (calcomp);
+	objstr = icalcomponent_as_ical_string_r (calcomp);
 
 	g_assert (objstr);
 
@@ -2665,7 +2665,7 @@
 		return GNOME_Evolution_Calendar_InvalidObject;
 	}
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
Index: calendar/backends/caldav/Makefile.am
===================================================================
--- calendar/backends/caldav/Makefile.am	(revision 9793)
+++ calendar/backends/caldav/Makefile.am	(working copy)
@@ -3,10 +3,6 @@
 	-I$(top_srcdir)						\
 	-I$(top_srcdir)/calendar                                \
 	-I$(top_builddir)/calendar                              \
-	-I$(top_srcdir)/calendar/libical/src		        \
-	-I$(top_builddir)/calendar/libical/src		        \
-	-I$(top_srcdir)/calendar/libical/src/libical	        \
-	-I$(top_builddir)/calendar/libical/src/libical	        \
 	$(SOUP_CFLAGS)					        \
 	-DG_LOG_DOMAIN=\"e-cal-backend-caldav\"
 
Index: calendar/backends/google/e-cal-backend-google.c
===================================================================
--- calendar/backends/google/e-cal-backend-google.c	(revision 9793)
+++ calendar/backends/google/e-cal-backend-google.c	(working copy)
@@ -249,7 +249,7 @@
 	if (!icalcomp)
 		return GNOME_Evolution_Calendar_InvalidObject;
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
Index: calendar/backends/google/Makefile.am
===================================================================
--- calendar/backends/google/Makefile.am	(revision 9793)
+++ calendar/backends/google/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	-I$(top_srcdir)/servers/google/libgdata		\
 	-I$(top_builddir)/servers/google/libgdata	\
 	-I$(top_srcdir)/servers/google/libgdata-google	\
Index: calendar/backends/contacts/e-cal-backend-contacts.c
===================================================================
--- calendar/backends/contacts/e-cal-backend-contacts.c	(revision 9793)
+++ calendar/backends/contacts/e-cal-backend-contacts.c	(working copy)
@@ -653,7 +653,7 @@
 	icalcomponent_set_dtstart (vfb, icaltime_from_timet_with_zone (start, FALSE, utc_zone));
 	icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
 
-	calobj = icalcomponent_as_ical_string (vfb);
+	calobj = icalcomponent_as_ical_string_r (vfb);
 	*freebusy = g_list_append (NULL, calobj);
 	icalcomponent_free (vfb);
 
@@ -788,7 +788,7 @@
 	if (!icalcomp)
 		return GNOME_Evolution_Calendar_InvalidObject;
 
-	*object = icalcomponent_as_ical_string (icalcomp);
+	*object = icalcomponent_as_ical_string_r (icalcomp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
Index: calendar/backends/contacts/Makefile.am
===================================================================
--- calendar/backends/contacts/Makefile.am	(revision 9793)
+++ calendar/backends/contacts/Makefile.am	(working copy)
@@ -4,10 +4,6 @@
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/calendar			\
 	-I$(top_builddir)/calendar			\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
 	-I$(top_srcdir)/addressbook			\
 	-I$(top_builddir)/addressbook			\
 	$(EVOLUTION_CALENDAR_CFLAGS)
Index: calendar/libecal/e-cal-recur.c
===================================================================
--- calendar/libecal/e-cal-recur.c	(revision 9793)
+++ calendar/libecal/e-cal-recur.c	(working copy)
@@ -4004,7 +4004,7 @@
 	utc_zone = icaltimezone_get_utc_timezone ();
 	icaltime = icaltime_from_timet_with_zone (end_date, FALSE, utc_zone);
 	value = icalvalue_new_datetime (icaltime);
-	end_date_string = icalvalue_as_ical_string (value);
+	end_date_string = icalvalue_as_ical_string_r (value);
 	icalvalue_free (value);
 
 	/* If we already have an X-EVOLUTION-ENDDATE parameter, set the value
Index: calendar/libecal/e-cal-check-timezones.c
===================================================================
--- calendar/libecal/e-cal-check-timezones.c	(revision 9793)
+++ calendar/libecal/e-cal-check-timezones.c	(working copy)
@@ -17,19 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef HANDLE_LIBICAL_MEMORY
-# define HANDLE_LIBICAL_MEMORY 1
-#endif
 #include <libical/ical.h>
 
-#ifdef LIBICAL_MEMFIXES
-/* avoid dependency on icalstrdup.h, works when compiling as part of EDS >= 2.22 */
-# define ical_strdup(_x) (_x)
-#else
-/* use icalstrdup.h to get runtime detection of memory fix patch */
-# include "libical/icalstrdup.h"
-#endif
-
 #include "e-cal-check-timezones.h"
 #include <libecal/e-cal.h>
 #include <string.h>
@@ -298,7 +287,7 @@
                 } else {
                     int counter;
 
-                    zonestr = ical_strdup(icalcomponent_as_ical_string(subcomp));
+                    zonestr = icalcomponent_as_ical_string_r(subcomp);
 
                     /* check for collisions with existing timezones */
                     for (counter = 0;
@@ -321,7 +310,7 @@
                             }
                         }
                         g_free(buffer);
-                        buffer = ical_strdup(icalcomponent_as_ical_string(icaltimezone_get_component(existing_zone)));
+                        buffer = icalcomponent_as_ical_string_r(icaltimezone_get_component(existing_zone));
 
                         if (counter) {
                             char *fulltzid = g_strdup_printf("TZID:%s", value);
Index: calendar/libecal/libecal.pc.in
===================================================================
--- calendar/libecal/libecal.pc.in	(revision 9793)
+++ calendar/libecal/libecal.pc.in	(working copy)
@@ -13,6 +13,6 @@
 Name: libecal
 Description: Client library for evolution calendars
 Version: @VERSION@
-Requires: libbonobo-2.0 >= @LIBBONOBO_REQUIRED@ libedataserver-1.2
+Requires: libbonobo-2.0 >= @LIBBONOBO_REQUIRED@ libical >= @LIBICAL_REQUIRED@ libedataserver-1.2
 Libs: -L${libdir} -lecal-1.2
 Cflags: -I${privincludedir}
Index: calendar/libecal/e-cal.c
===================================================================
--- calendar/libecal/e-cal.c	(revision 9793)
+++ calendar/libecal/e-cal.c	(working copy)
@@ -4109,7 +4109,7 @@
 	if (!vtimezone_comp)
 		return;
 
-	vtimezone_as_string = icalcomponent_as_ical_string (vtimezone_comp);
+	vtimezone_as_string = icalcomponent_as_ical_string_r (vtimezone_comp);
 
 	g_hash_table_insert (data->timezone_hash, (char*) tzid,
 			     vtimezone_as_string);
@@ -4190,7 +4190,7 @@
 			      vcal_string);
 
 	/* Get the string for the VEVENT/VTODO. */
-	obj_string = icalcomponent_as_ical_string (icalcomp);
+	obj_string = icalcomponent_as_ical_string_r (icalcomp);
 
 	/* If there were any timezones to send, create a complete VCALENDAR,
 	   else just send the VEVENT/VTODO string. */
@@ -4271,7 +4271,7 @@
 
 	CORBA_exception_init (&ev);
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	GNOME_Evolution_Calendar_Cal_createObject (priv->cal, obj, &ev);
 	if (BONOBO_EX (&ev)) {
 		e_calendar_remove_op (ecal, our_op);
@@ -4352,7 +4352,7 @@
 
 	CORBA_exception_init (&ev);
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	GNOME_Evolution_Calendar_Cal_modifyObject (priv->cal, obj, mod, &ev);
 	if (BONOBO_EX (&ev)) {
 		e_calendar_remove_op (ecal, our_op);
@@ -4519,7 +4519,7 @@
 
 	CORBA_exception_init (&ev);
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	GNOME_Evolution_Calendar_Cal_receiveObjects (priv->cal, obj, &ev);
 	if (BONOBO_EX (&ev)) {
 		e_calendar_remove_op (ecal, our_op);
@@ -4591,7 +4591,7 @@
 
 	CORBA_exception_init (&ev);
 
-	obj = icalcomponent_as_ical_string (icalcomp);
+	obj = icalcomponent_as_ical_string_r (icalcomp);
 	GNOME_Evolution_Calendar_Cal_sendObjects (priv->cal, obj, &ev);
 	if (BONOBO_EX (&ev)) {
 		e_calendar_remove_op (ecal, our_op);
@@ -4858,7 +4858,7 @@
 	}
 
 	/* convert icaltimezone into a string */
-	tzobj = icalcomponent_as_ical_string (icalcomp);
+	tzobj = icalcomponent_as_ical_string_r (icalcomp);
 
 	/* call the backend */
 	CORBA_exception_init (&ev);
@@ -5009,7 +5009,7 @@
 	}
 
 	/* convert icaltimezone into a string */
-	tzobj = icalcomponent_as_ical_string (icalcomp);
+	tzobj = icalcomponent_as_ical_string_r (icalcomp);
 
 	/* call the backend */
 	CORBA_exception_init (&ev);
Index: calendar/libecal/e-cal-component.c
===================================================================
--- calendar/libecal/e-cal-component.c	(revision 9793)
+++ calendar/libecal/e-cal-component.c	(working copy)
@@ -1263,7 +1263,7 @@
 	/* Ensure that the user has committed the new SEQUENCE */
 	g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
 
-	str = icalcomponent_as_ical_string (priv->icalcomp);
+	str = icalcomponent_as_ical_string_r (priv->icalcomp);
 
 	return str;
 }
@@ -3588,7 +3588,7 @@
         e_cal_component_free_range (&range);
 
         return icaltime_is_valid_time (tt) && !icaltime_is_null_time (tt) ?
-                icaltime_as_ical_string (tt) : g_strdup ("0");
+                icaltime_as_ical_string_r (tt) : g_strdup ("0");
 }
 
 /**
Index: calendar/libecal/Makefile.am
===================================================================
--- calendar/libecal/Makefile.am	(revision 9793)
+++ calendar/libecal/Makefile.am	(working copy)
@@ -6,10 +6,7 @@
 	-I.. 						\
 	-I$(top_builddir)				\
 	-I$(top_builddir)/calendar/libecal		\
-	-I$(top_srcdir)/calendar/libical/src		\
-	-I$(top_builddir)/calendar/libical/src		\
-	-I$(top_srcdir)/calendar/libical/src/libical	\
-	-I$(top_builddir)/calendar/libical/src/libical	\
+	$(LIBICAL_CFLAGS)				\
 	$(EVOLUTION_CALENDAR_CFLAGS)
 
 # The corba stubs and skels
@@ -55,14 +52,12 @@
 	e-cal-view-listener.h	\
 	e-cal-view-private.h
 
-libecal_1_2_la_LIBADD =									\
-	$(top_builddir)/calendar/libical/src/libical/libical-evolution.la		\
-	$(top_builddir)/calendar/libical/src/libicalvcal/libicalvcal-evolution.la	\
-	$(top_builddir)/calendar/libical/src/libicalss/libicalss-evolution.la		\
-	$(top_builddir)/libedataserver/libedataserver-1.2.la \
+libecal_1_2_la_LIBADD = 					\
+	$(top_builddir)/libedataserver/libedataserver-1.2.la 	\
+	$(LIBICAL_LIBS)						\
 	$(EVOLUTION_CALENDAR_LIBS)
 
-libecal_1_2_la_LDFLAGS = 								\
+libecal_1_2_la_LDFLAGS = 					\
 	-version-info $(LIBECAL_CURRENT):$(LIBECAL_REVISION):$(LIBECAL_AGE) $(NO_UNDEFINED)
 
 libecalincludedir = $(privincludedir)/libecal
