[evolution-data-server/openismus-work-master: 10/10] Make GTK+ a soft dependancy



commit 38fadbd984da10d08359769501a986d66422ab31
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Wed Jan 16 18:02:40 2013 +0900

    Make GTK+ a soft dependancy
    
    This patch disables building of the user-prompter service and trust-prompt
    module if GTK+ is not available, allowing alternative implementations of
    the user prompter service to be installed on platforms where GTK+ is not
    available.

 configure.ac                                       |   24 +++++++++++++++++++-
 modules/Makefile.am                                |    6 ++++-
 modules/trust-prompt/Makefile.am                   |   12 ++-------
 services/Makefile.am                               |    6 ++++-
 .../evolution-addressbook-factory.c                |    4 +-
 .../evolution-calendar-factory.c                   |    4 +-
 .../evolution-source-registry.c                    |    4 +-
 services/evolution-user-prompter/Makefile.am       |   12 ++-------
 tests/libedataserver/Makefile.am                   |   15 ++++++-----
 9 files changed, 53 insertions(+), 34 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 676d241..ccfe3a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -369,7 +369,6 @@ dnl ***********************************
 PKG_CHECK_MODULES(GNOME_PLATFORM,
 	[gio-2.0 >= glib_minimum_version
 	gmodule-2.0 >= glib_minimum_version
-	gtk+-3.0 >= gdk_minimum_version
 	libxml-2.0 >= libxml_minimum_version
 	libsoup-2.4 >= soup_minimum_version])
 
@@ -377,6 +376,29 @@ if test x$os_win32 = xno; then
 	PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
 fi
 
+dnl *************************
+dnl Check for GTK+
+dnl *************************
+AC_ARG_ENABLE([gtk],
+	[AS_HELP_STRING([--enable-gtk],
+	[enable GTK+ (default=yes)])],
+	[enable_gtk=$enableval], [enable_gtk=yes])
+AC_MSG_CHECKING([if GTK+ support is enabled])
+AC_MSG_RESULT([$enable_gtk])
+if test "x$enable_gtk" = xyes; then
+	PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= gdk_minimum_version],,
+	[AC_MSG_ERROR([
+
+	gtk+-3.0 not found (or version < gdk_minimum_version)
+
+	If you want to disable GTK+ support,
+	please append --disable-gtk to configure.
+	])])
+
+	AC_DEFINE(HAVE_GTK, 1, [Define to 1 if you have the gtk+-3.0 package.])
+fi
+AM_CONDITIONAL(HAVE_GTK, [test x$enable_gtk = xyes])
+
 dnl *******************************
 dnl Check for GNOME Online Accounts
 dnl *******************************
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 21e7252..ed946b0 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -4,11 +4,15 @@ if HAVE_GOA
 GNOME_ONLINE_ACCOUNTS_DIR = gnome-online-accounts
 endif
 
+if HAVE_GTK
+TRUST_PROMPT_DIR = trust-prompt
+endif
+
 SUBDIRS = \
 	cache-reaper \
 	google-backend \
-	trust-prompt \
 	yahoo-backend \
+	$(TRUST_PROMPT_DIR) \
 	$(GNOME_ONLINE_ACCOUNTS_DIR) \
 	$(NULL)
 
diff --git a/modules/trust-prompt/Makefile.am b/modules/trust-prompt/Makefile.am
index 2e6d62a..eedf305 100644
--- a/modules/trust-prompt/Makefile.am
+++ b/modules/trust-prompt/Makefile.am
@@ -1,16 +1,10 @@
 NULL =
 
-#if USE_GTK
-   TRUST_PROMPT_SOURCES = trust-prompt-gtk.c \
+TRUST_PROMPT_SOURCES = trust-prompt-gtk.c \
 			  certificate-viewer.c \
 			  certificate-viewer.h
-   TRUST_PROMPT_CFLAGS = $(GNOME_PLATFORM_CFLAGS)
-   TRUST_PROMPT_LIBS = $(GNOME_PLATFORM_LIBS)
-#else
-#   TRUST_PROMPT_SOURCES = trust-prompt-.c
-#   TRUST_PROMPT_CFLAGS = $()
-#   TRUST_PROMPT_LIBS = $()
-#endif
+TRUST_PROMPT_CFLAGS = $(GNOME_PLATFORM_CFLAGS) $(GTK_CFLAGS)
+TRUST_PROMPT_LIBS = $(GNOME_PLATFORM_LIBS) $(GTK_LIBS)
 
 module_LTLIBRARIES = module-trust-prompt.la
 
diff --git a/services/Makefile.am b/services/Makefile.am
index f3c8447..affc7c9 100644
--- a/services/Makefile.am
+++ b/services/Makefile.am
@@ -1,10 +1,14 @@
 NULL =
 
+if HAVE_GTK
+USER_PROMPTER_DIR = evolution-user-prompter
+endif
+
 SUBDIRS = \
 	evolution-addressbook-factory \
 	evolution-calendar-factory \
 	evolution-source-registry \
-	evolution-user-prompter \
+	$(USER_PROMPTER_DIR) \
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/services/evolution-addressbook-factory/evolution-addressbook-factory.c b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
index ffb69b7..959095b 100644
--- a/services/evolution-addressbook-factory/evolution-addressbook-factory.c
+++ b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -92,7 +92,7 @@ main (gint argc,
 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 	/* This is only to load gtk-modules, like
 	 * bug-buddy's gnomesegvhandler, if possible */
 	gtk_init_check (&argc, &argv);
diff --git a/services/evolution-calendar-factory/evolution-calendar-factory.c b/services/evolution-calendar-factory/evolution-calendar-factory.c
index a80731b..ee40da7 100644
--- a/services/evolution-calendar-factory/evolution-calendar-factory.c
+++ b/services/evolution-calendar-factory/evolution-calendar-factory.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -96,7 +96,7 @@ main (gint argc,
 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 	/* This is only to load gtk-modules, like
 	 * bug-buddy's gnomesegvhandler, if possible. */
 	gtk_init_check (&argc, &argv);
diff --git a/services/evolution-source-registry/evolution-source-registry.c b/services/evolution-source-registry/evolution-source-registry.c
index 567052c..d4cc15c 100644
--- a/services/evolution-source-registry/evolution-source-registry.c
+++ b/services/evolution-source-registry/evolution-source-registry.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@ -48,7 +48,7 @@ main (gint argc,
 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
-#ifdef ENABLE_MAINTAINER_MODE
+#if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK)
 	/* This is only to load gtk-modules, like
 	 * bug-buddy's gnomesegvhandler, if possible */
 	gtk_init_check (&argc, &argv);
diff --git a/services/evolution-user-prompter/Makefile.am b/services/evolution-user-prompter/Makefile.am
index 8f865cf..941b7a4 100644
--- a/services/evolution-user-prompter/Makefile.am
+++ b/services/evolution-user-prompter/Makefile.am
@@ -8,15 +8,9 @@ service_DATA = $(service_in_files:.service.in=.service)
 CLEANFILES = $(service_DATA)
 EXTRA_DIST = $(service_in_files)
 
-#if USE_GTK
-   PROMPT_USER_SOURCES = prompt-user-gtk.c
-   PROMPT_USER_CFLAGS = $(GNOME_PLATFORM_CFLAGS)
-   PROMPT_USER_LIBS = $(GNOME_PLATFORM_LIBS)
-#else
-#   PROMPT_USER_SOURCES = prompt-user-.c
-#   PROMPT_USER_CFLAGS = $()
-#   PROMPT_USER_LIBS = $()
-#endif
+PROMPT_USER_SOURCES = prompt-user-gtk.c
+PROMPT_USER_CFLAGS = $(GNOME_PLATFORM_CFLAGS) $(GTK_CFLAGS)
+PROMPT_USER_LIBS = $(GNOME_PLATFORM_LIBS) $(GTK_LIBS)
 
 libexec_PROGRAMS = evolution-user-prompter
 
diff --git a/tests/libedataserver/Makefile.am b/tests/libedataserver/Makefile.am
index 7dc05e3..c64aef7 100644
--- a/tests/libedataserver/Makefile.am
+++ b/tests/libedataserver/Makefile.am
@@ -4,7 +4,6 @@ NULL =
 
 TESTS = \
 	e-source-test \
-	e-user-prompter-test \
 	$(NULL)
 
 noinst_PROGRAMS = $(TESTS)
@@ -28,14 +27,16 @@ e_source_test_SOURCES = \
 	e-source-test.c \
 	$(NULL)
 
-e_user_prompter_test_SOURCES = \
-	e-user-prompter-test.c \
-	$(NULL)
-
 e_source_test_CPPFLAGS = $(test_CPPFLAGS)
 e_source_test_LDADD = $(test_LDADD)
 
-e_user_prompter_test_CPPFLAGS = $(test_CPPFLAGS)
-e_user_prompter_test_LDADD = $(top_builddir)/libebackend/libebackend-1.2.la $(test_LDADD)
+
+if HAVE_GTK
+TESTS += e-user-prompter-test
+
+e_user_prompter_test_SOURCES = e-user-prompter-test.c
+e_user_prompter_test_CPPFLAGS = $(test_CPPFLAGS) $(GTK_CFLAGS)
+e_user_prompter_test_LDADD = $(top_builddir)/libebackend/libebackend-1.2.la $(test_LDADD) $(GTK_LIBS)
+endif
 
 -include $(top_srcdir)/git.mk



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