[almanah] Make Evolution dependency optional



commit e16b019fe921a36b751c7462f8866ce7a2f13b24
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Dec 17 08:45:46 2009 +0000

    Make Evolution dependency optional
    
    Also remove forced -Wall flag.

 configure.ac        |   11 ++++++++++-
 src/Makefile.am     |   28 +++++++++++++++-------------
 src/event-factory.h |    3 +++
 src/event-manager.c |    4 ++++
 4 files changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 81b3995..ff7696a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,10 +69,19 @@ AM_PROG_LIBTOOL
 AM_GCONF_SOURCE_2
 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
 
-PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.14 gmodule-2.0 gio-2.0 sqlite3 cairo gconf-2.0 atk libecal-1.2 libedataserver-1.2 libedataserverui-1.2 dbus-glib-1)
+PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.14 gmodule-2.0 gio-2.0 sqlite3 cairo gconf-2.0 atk dbus-glib-1)
 AC_SUBST(STANDARD_CFLAGS)
 AC_SUBST(STANDARD_LIBS)
 
+PKG_CHECK_MODULES(EVO, libecal-1.2 libedataserver-1.2 libedataserverui-1.2, have_evo=yes, have_evo=no)
+if test "x$have_evo" = "xyes"; then
+	AC_DEFINE(HAVE_EVO, 1, [Defined if libecal-1.2 is installed])
+fi
+AM_CONDITIONAL([HAVE_EVO], [test x$have_evo = xyes])
+
+AC_SUBST(EVO_CFLAGS)
+AC_SUBST(EVO_LIBS)
+
 if test $spell_checking = "true"; then
 	PKG_CHECK_MODULES(SPELL_CHECKING, gtkspell-2.0)
 	AC_SUBST(SPELL_CHECKING_CFLAGS)
diff --git a/src/Makefile.am b/src/Makefile.am
index 63fc1f5..91a010d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,15 +6,12 @@ INCLUDES = \
 	-I$(srcdir)/events						\
 	-I$(srcdir)/event-factories					\
 	$(STANDARD_CFLAGS)						\
+	$(EVO_CFLAGS)							\
 	$(ENCRYPTION_CFLAGS)						\
 	$(SPELL_CHECKING_CFLAGS)
 
-AM_CFLAGS = \
-	-Wall		\
-	-g
-
 if DEBUG
-AM_CFLAGS += \
+AM_CFLAGS = \
 	-fprofile-arcs	\
 	-ftest-coverage
 endif
@@ -57,20 +54,19 @@ almanah_SOURCES = \
 	date-entry-dialog.h	\
 	import-dialog.c		\
 	import-dialog.h		\
-	definitions/contact.c		\
-	definitions/contact.h		\
 	definitions/file.c		\
 	definitions/file.h		\
 	definitions/note.c		\
 	definitions/note.h		\
 	definitions/uri.c		\
 	definitions/uri.h		\
-	events/calendar-appointment.c	\
-	events/calendar-appointment.h	\
-	events/calendar-task.c		\
-	events/calendar-task.h		\
 	events/f-spot-photo.c		\
 	events/f-spot-photo.h		\
+	event-factories/f-spot.c	\
+	event-factories/f-spot.h
+
+if HAVE_EVO
+almanah_SOURCES += \
 	event-factories/calendar.c	\
 	event-factories/calendar.h	\
 	event-factories/calendar-client.c	\
@@ -78,8 +74,13 @@ almanah_SOURCES = \
 	event-factories/calendar-debug.h	\
 	event-factories/calendar-sources.c	\
 	event-factories/calendar-sources.h	\
-	event-factories/f-spot.c		\
-	event-factories/f-spot.h
+	events/calendar-appointment.c	\
+	events/calendar-appointment.h	\
+	events/calendar-task.c		\
+	events/calendar-task.h		\
+	definitions/contact.c		\
+	definitions/contact.h
+endif
 
 if ENCRYPTION
 almanah_SOURCES += \
@@ -90,6 +91,7 @@ endif
 almanah_LDFLAGS = 
 almanah_LDADD = \
 	$(STANDARD_LIBS)	\
+	$(EVO_LIBS)		\
 	$(ENCRYPTION_LIBS)	\
 	$(SPELL_CHECKING_LIBS)
 
diff --git a/src/event-factory.h b/src/event-factory.h
index ec8c2ec..85258e3 100644
--- a/src/event-factory.h
+++ b/src/event-factory.h
@@ -20,6 +20,7 @@
 #ifndef ALMANAH_EVENT_FACTORY_H
 #define ALMANAH_EVENT_FACTORY_H
 
+#include <config.h>
 #include <glib.h>
 #include <glib-object.h>
 
@@ -27,7 +28,9 @@ G_BEGIN_DECLS
 
 typedef enum {
 	ALMANAH_EVENT_FACTORY_UNKNOWN = 0,
+#ifdef HAVE_EVO
 	ALMANAH_EVENT_FACTORY_CALENDAR,
+#endif /* HAVE_EVO */
 	ALMANAH_EVENT_FACTORY_F_SPOT
 } AlmanahEventFactoryType;
 
diff --git a/src/event-manager.c b/src/event-manager.c
index 93016b6..62dff23 100644
--- a/src/event-manager.c
+++ b/src/event-manager.c
@@ -30,12 +30,16 @@ typedef struct {
 
 /* TODO: This is still a little hacky */
 
+#ifdef HAVE_EVO
 #include "calendar.h"
+#endif /* HAVE_EVO */
 #include "main.h"
 #include "f-spot.h"
 
 const EventFactoryType event_factory_types[] = {
+#ifdef HAVE_EVO
 	{ ALMANAH_EVENT_FACTORY_CALENDAR, almanah_calendar_event_factory_get_type },
+#endif /* HAVE_EVO */
 	{ ALMANAH_EVENT_FACTORY_F_SPOT, almanah_f_spot_event_factory_get_type }
 };
 



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