From f61d33bb76676a30210f9671603517b703584c5f Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Sun, 3 Jun 2007 22:15:03 +0000 Subject: [PATCH] Add --disable-calendar to build without any calendar support (#438928). 2007-06-03 Ross Burton * configure.in: * Makefile.am: * src/Makefile.am: * src/offline-listener.[ch]: * src/server.c: Add --disable-calendar to build without any calendar support (#438928). svn path=/trunk/; revision=7799 --- ChangeLog | 10 ++++++++++ Makefile.am | 6 +++++- configure.in | 30 ++++++++++++++++++++++++------ src/Makefile.am | 5 ++++- src/offline-listener.c | 28 +++++++++++++++++++--------- src/offline-listener.h | 7 +++++++ src/server.c | 38 +++++++++++++++++++++++++++++++++----- 7 files changed, 102 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index df09e24..1533840 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-06-03 Ross Burton + + * configure.in: + * Makefile.am: + * src/Makefile.am: + * src/offline-listener.[ch]: + * src/server.c: + Add --disable-calendar to build without any calendar support + (#438928). + 2007-05-31 Matthew Barnes * docs/reference/addressbook/libebook/Makefile.am: diff --git a/Makefile.am b/Makefile.am index 905ef3e..9b7cf8a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,11 @@ if ! WITH_LIBDB LIBDB = libdb endif -SUBDIRS = $(LIBDB) win32 libedataserver servers camel addressbook calendar libedataserverui src docs art po +if ENABLE_CALENDAR +CALENDAR_DIR = calendar +endif + +SUBDIRS = $(LIBDB) win32 libedataserver servers camel addressbook $(CALENDAR_DIR) libedataserverui src docs art po DIST_SUBDIRS= win32 libedataserver servers camel addressbook calendar libedataserverui src docs art po changelogs = \ diff --git a/configure.in b/configure.in index afadeec..a30fee6 100644 --- a/configure.in +++ b/configure.in @@ -869,6 +869,19 @@ fi AM_CONDITIONAL(ENABLE_IPv6, test "x$enable_ipv6" = "xyes") dnl ************************************************** +dnl Calendar support +dnl ************************************************** +AC_MSG_CHECKING(if we should build the calendar) +AC_ARG_ENABLE(calendar, AC_HELP_STRING([--disable-calendar],[Disable the calendar components]), + enable_calendar="$enableval", enable_calendar="yes") +if test "x${enable_calendar}" != "xno"; then + AC_DEFINE(ENABLE_CALENDAR, 1, [Define if Calendar should be built]) +fi +AM_CONDITIONAL(ENABLE_CALENDAR, test x$enable_calendar = xyes) +AC_MSG_RESULT($enable_calendar) +msg_calendar=$enable_calendar + +dnl ************************************************** dnl NNTP support. dnl ************************************************** AC_ARG_ENABLE(nntp, @@ -1275,12 +1288,13 @@ AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS) AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS) dnl --- evolution-calendar flags +if test "x${enable_calendar}" = "xyes"; then + EVOLUTION_CALENDAR_DEPS="libxml-2.0 gobject-2.0 gconf-2.0 libbonobo-2.0 >= $LIBBONOBO_REQUIRED libgnome-2.0 gnome-vfs-2.0" -EVOLUTION_CALENDAR_DEPS="libxml-2.0 gobject-2.0 gconf-2.0 libbonobo-2.0 >= $LIBBONOBO_REQUIRED libgnome-2.0 gnome-vfs-2.0" - -EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS) -AC_SUBST(EVOLUTION_CALENDAR_CFLAGS) -AC_SUBST(EVOLUTION_CALENDAR_LIBS) + EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS) + AC_SUBST(EVOLUTION_CALENDAR_CFLAGS) + AC_SUBST(EVOLUTION_CALENDAR_LIBS) +fi dnl --- factory flags @@ -1413,7 +1427,10 @@ dnl ****************************** export privlibdir export privincludedir export privdatadir -AC_CONFIG_SUBDIRS(calendar/libical) + +if test $enable_calendar = yes; then + AC_CONFIG_SUBDIRS(calendar/libical) +fi if test $dynamic_libdb = no; then AC_CONFIG_SUBDIRS(libdb/dist) fi @@ -1511,6 +1528,7 @@ esac echo " evolution-data-server has been configured as follows: + Calendar: $msg_calendar Mail Directory: $system_mail_dir, $system_mail_perm LDAP support: $msg_ldap" if test "$msg_nntp" = "yes"; then diff --git a/src/Makefile.am b/src/Makefile.am index 0b88e6b..d637ff4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,9 +53,12 @@ evolution_data_server_SOURCES = \ evolution_data_server_LDADD = \ $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \ - $(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la \ $(E_FACTORY_LIBS) +if ENABLE_CALENDAR +evolution_data_server_LDADD += $(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la +endif + install-evolution-data-servers: $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) evolution-data-server $(DESTDIR)$(libexecdir)/evolution-data-server-$(BASE_VERSION) diff --git a/src/offline-listener.c b/src/offline-listener.c index 92e75ac..a48015e 100644 --- a/src/offline-listener.c +++ b/src/offline-listener.c @@ -26,7 +26,9 @@ #include "offline-listener.h" #include +#if ENABLE_CALENDAR #include +#endif #include enum { @@ -40,7 +42,10 @@ static GObjectClass *parent_class = NULL; struct _OfflineListenerPrivate { GConfClient *default_client; + +#if ENABLE_CALENDAR EDataCalFactory *cal_factory; +#endif EDataBookFactory *book_factory; gboolean is_offline_now; }; @@ -52,17 +57,15 @@ set_online_status (OfflineListener *offline_listener, gboolean is_offline) OfflineListenerPrivate *priv; priv = offline_listener->priv; - - if (is_offline) { - e_data_cal_factory_set_backend_mode (priv->cal_factory, OFFLINE_MODE); - e_data_book_factory_set_backend_mode (priv->book_factory, OFFLINE_MODE); - - } else { - e_data_cal_factory_set_backend_mode (priv->cal_factory, ONLINE_MODE); - e_data_book_factory_set_backend_mode (priv->book_factory, ONLINE_MODE); - } +#if ENABLE_CALENDAR + e_data_cal_factory_set_backend_mode + (priv->cal_factory, is_offline ? OFFLINE_MODE : ONLINE_MODE); +#endif + e_data_book_factory_set_backend_mode + (priv->book_factory, is_offline ? OFFLINE_MODE : ONLINE_MODE); } + static void online_status_changed (GConfClient *client, int cnxn_id, GConfEntry *entry, gpointer data) { @@ -97,14 +100,21 @@ setup_offline_listener (OfflineListener *offline_listener) set_online_status (offline_listener, priv->is_offline_now); } +#if ENABLE_CALENDAR OfflineListener* offline_listener_new (EDataBookFactory *book_factory, EDataCalFactory *cal_factory) +#else +OfflineListener* +offline_listener_new (EDataBookFactory *book_factory) +#endif { OfflineListener *offline_listener = g_object_new (OFFLINE_TYPE_LISTENER, NULL); OfflineListenerPrivate *priv = offline_listener->priv; priv->book_factory = book_factory; +#if ENABLE_CALENDAR priv->cal_factory = cal_factory; +#endif setup_offline_listener (offline_listener); return offline_listener; diff --git a/src/offline-listener.h b/src/offline-listener.h index c86ebd5..7cd5eb7 100644 --- a/src/offline-listener.h +++ b/src/offline-listener.h @@ -29,7 +29,9 @@ #include #include +#if ENABLE_CALENDAR #include +#endif G_BEGIN_DECLS @@ -57,7 +59,12 @@ struct _OfflineListenerClass { GType offline_listener_get_type (void); + +#if ENABLE_CALENDAR OfflineListener *offline_listener_new (EDataBookFactory *book_factory, EDataCalFactory *cal_factory); +#else +OfflineListener *offline_listener_new (EDataBookFactory *book_factory); +#endif G_END_DECLS diff --git a/src/server.c b/src/server.c index 5913da5..1c0abc7 100644 --- a/src/server.c +++ b/src/server.c @@ -45,7 +45,9 @@ #include #include +#if ENABLE_CALENDAR #include +#endif #ifdef G_OS_WIN32 #include @@ -63,7 +65,9 @@ /* The and addressbook calendar factories */ +#if ENABLE_CALENDAR static EDataCalFactory *e_data_cal_factory; +#endif static EDataBookFactory *e_data_book_factory; @@ -143,9 +147,14 @@ setup_segv_handler (void) static gboolean termination_handler (gpointer data) { - - if (e_data_cal_factory_get_n_backends (e_data_cal_factory) == 0 && - e_data_book_factory_get_n_backends (e_data_book_factory) == 0) { + int count = 0; + +#if ENABLE_CALENDAR + count += e_data_cal_factory_get_n_backends (e_data_cal_factory); +#endif + count += e_data_book_factory_get_n_backends (e_data_book_factory); + + if (count == 0) { g_message ("termination_handler(): Terminating the Server. Have a nice day."); bonobo_main_quit (); } @@ -201,6 +210,7 @@ setup_books (void) /* Personal calendar server */ +#if ENABLE_CALENDAR /* Callback used when the calendar factory has no more running backends */ static void last_calendar_gone_cb (EDataCalFactory *factory, gpointer data) @@ -233,7 +243,15 @@ setup_cals (void) NULL); return TRUE; + } +#else +static gboolean +setup_cals (void) +{ + return TRUE; +} +#endif /* Logging iface. */ @@ -284,7 +302,9 @@ static void dump_backends (int signal) { e_data_book_factory_dump_active_backends (e_data_book_factory); +#if ENABLE_CALENDAR e_data_cal_factory_dump_active_backends (e_data_cal_factory); +#endif } #endif @@ -376,15 +396,20 @@ main (int argc, char **argv) e_data_book_factory = NULL; } +#if ENABLE_CALENDAR if (e_data_cal_factory) { bonobo_object_unref (BONOBO_OBJECT (e_data_cal_factory)); e_data_cal_factory = NULL; } +#endif exit (EXIT_FAILURE); } - - offline_listener = offline_listener_new (e_data_book_factory, e_data_cal_factory); +#if ENABLE_CALENDAR + offline_listener = offline_listener_new (e_data_book_factory, e_data_cal_factory); +#else + offline_listener = offline_listener_new (e_data_book_factory); +#endif if ( setup_logging ()) { if ( setup_interface_check ()) { @@ -397,8 +422,11 @@ main (int argc, char **argv) g_error (G_STRLOC "Cannot register DataServer::Logging object"); g_object_unref (offline_listener); + +#if ENABLE_CALENDAR bonobo_object_unref (BONOBO_OBJECT (e_data_cal_factory)); e_data_cal_factory = NULL; +#endif bonobo_object_unref (BONOBO_OBJECT (e_data_book_factory)); e_data_book_factory = NULL; -- 2.7.4