[giggle] configure.ac: Improve eds autodetection
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle] configure.ac: Improve eds autodetection
- Date: Tue, 31 Jan 2012 14:03:54 +0000 (UTC)
commit 195153b6d44603ef1d6b324ff5326e76f4f58c3f
Author: Javier JardÃn <jjardon gnome org>
Date: Tue Jan 31 14:02:18 2012 +0000
configure.ac: Improve eds autodetection
Also use more autoconf syntax
configure.ac | 59 ++++++++++++++++++++----------
plugins/Makefile.am | 2 +-
plugins/giggle-personal-details-window.c | 20 +++++-----
3 files changed, 50 insertions(+), 31 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index aa11046..9c4aebf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,9 @@ GLIB_REQUIRED_VERSION=2.30
GDK_PIXBUF_REQUIRED_VERSION=2.22
GTK_REQUIRED_VERSION=3.0
GTKSOURCE_REQUIRED_VERSION=3.0
+EDS_REQUIRED_VERSION=3.2
+VTE_REQUIRED_VERSION=0.28
+
PKG_CHECK_MODULES(GIGGLE, [
gio-2.0 >= $GLIB_REQUIRED_VERSION
@@ -68,33 +71,49 @@ dnl | Evolution Data Server |-----------------------------------
dnl -----------------------
AC_ARG_ENABLE([evolution-data-server],
- [AS_HELP_STRING([--enable-evolution-data-server],
- [Enable features using Evolution Data Server])])
-
-if test "$enable_evolution_data_server" = "yes"
-then
- PKG_CHECK_MODULES(EBOOK, [libebook-1.2])
- AC_DEFINE(ENABLE_EDS, 1, [Use features from libebook])
-fi
-
-AM_CONDITIONAL([ENABLE_EDS], [test "$enable_evolution_data_server" = "yes"])
+ [AS_HELP_STRING([--enable-evolution-data-server=@<:@yes/no@:>@],
+ [Enable features using Evolution Data Server (default=check)])],
+ [enable_evolution_data_server=$enableval],
+ [enable_evolution_data_server=check])
+
+AS_IF([test "x$enable_evolution_data_server" != xno],
+ [
+ PKG_CHECK_MODULES([EBOOK],
+ [libebook-1.2 >= $EDS_REQUIRED_VERSION],
+ [have_evolution_data_server=yes
+ AC_DEFINE([HAVE_EDS], [1],
+ [Use features from libebook])
+ ],
+ [have_evolution_data_server=no
+ AS_IF([test "x$enable_evolution_data_server" != xcheck],
+ [AC_MSG_FAILURE([--enable-evolution-data-server was given, but libebook-1.2 was not found])])
+ ])
+ ])
+
+AM_CONDITIONAL([USE_EDS], [test "$have_evolution_data_server" = "yes"])
dnl ------------------
dnl | terminal support |-----------------------------------
dnl ------------------
AC_ARG_ENABLE([terminal],
- [AS_HELP_STRING([--disable-terminal],
- [disable features using vte terminal widget])],,
+ [AS_HELP_STRING([--enable-terminal=@<:@yes/no@:>@],
+ [Enable features using vte terminal widget (default=yes)])],
+ [enable_terminal=$enableval],
[enable_terminal=yes])
-if test "$enable_terminal" = "yes"
-then
- PKG_CHECK_MODULES(VTE, [vte-2.90 >= 0.26])
- AC_DEFINE(ENABLE_VTE, 1, [Use features from vte])
-fi
+AS_IF([test "x$enable_terminal" = "xyes"],
+ [
+ PKG_CHECK_MODULES([VTE],
+ [vte-2.90 >= $VTE_REQUIRED_VERSION],
+ [have_vte=yes
+ AC_DEFINE([HAVE_VTE], [1],
+ [Use features from vte])
+ ],
+ [have_vte=no])
+ ])
-AM_CONDITIONAL([ENABLE_VTE], [test "$enable_terminal" = "yes"])
+AM_CONDITIONAL([USE_VTE], [test "x$have_vte" = "xyes"])
dnl ----------------------
dnl | library requirements |-----------------------------------
@@ -232,6 +251,6 @@ echo "Prefix: $prefix"
echo "datadir: ${datadir}"
echo "CFLAGS: ${CFLAGS}"
echo "GIT command path: $GIT_COMMAND"
-echo "Use Evolution Data Server: $enable_evolution_data_server"
-echo "Use VTE terminal widget: $enable_terminal"
+echo "Use Evolution Data Server: $have_evolution_data_server"
+echo "Use VTE terminal widget: $have_vte"
echo
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c9bcee1..ee38e24 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -39,7 +39,7 @@ libpersonal_details_la_LIBADD = \
$(EBOOK_LIBS) \
$(GIGGLE_LIBS)
-if ENABLE_VTE
+if USE_VTE
plugin_LTLIBRARIES += \
libterminal-view.la
diff --git a/plugins/giggle-personal-details-window.c b/plugins/giggle-personal-details-window.c
index 708a6ab..acfce27 100644
--- a/plugins/giggle-personal-details-window.c
+++ b/plugins/giggle-personal-details-window.c
@@ -26,9 +26,9 @@
#include <glib/gi18n.h>
#include <string.h>
-#ifdef ENABLE_EDS
+#ifdef USE_EDS
#include <libebook/e-book.h>
-#endif /* ENABLE_EDS */
+#endif /* USE_EDS */
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIGGLE_TYPE_PERSONAL_DETAILS_WINDOW, GigglePersonalDetailsWindowPriv))
@@ -121,7 +121,7 @@ giggle_personal_details_window_class_init (GigglePersonalDetailsWindowClass *cla
sizeof (GigglePersonalDetailsWindowPriv));
}
-#ifdef ENABLE_EDS
+#ifdef USE_EDS
static GtkEntryCompletion *
create_email_completion (EContact *contact)
@@ -151,7 +151,7 @@ create_email_completion (EContact *contact)
return completion;
}
-#endif /* ENABLE_EDS */
+#endif /* USE_EDS */
static void
personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
@@ -162,11 +162,11 @@ personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
GigglePersonalDetailsWindowPriv *priv = GET_PRIV (window);
const char *name, *email;
-#ifdef ENABLE_EDS
+#ifdef USE_EDS
EContact *contact = NULL;
EBook *book = NULL;
GError *error = NULL;
-#endif /* ENABLE_EDS */
+#endif /* USE_EDS */
gtk_widget_set_sensitive (GTK_WIDGET (window), TRUE);
@@ -194,7 +194,7 @@ personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
name = giggle_git_config_get_field (configuration, GIGGLE_GIT_CONFIG_FIELD_NAME);
email = giggle_git_config_get_field (configuration, GIGGLE_GIT_CONFIG_FIELD_EMAIL);
-#ifdef ENABLE_EDS
+#ifdef USE_EDS
if (!e_book_get_self (&contact, &book, &error)) {
g_warning ("%s: Cannot open retreive self-contact: %s",
@@ -206,7 +206,7 @@ personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
if ((!email || !*email) && contact)
email = e_contact_get_const (contact, E_CONTACT_EMAIL_1);
-#endif /* ENABLE_EDS */
+#endif /* USE_EDS */
if (!name || !*name)
name = g_get_real_name ();
@@ -218,7 +218,7 @@ personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
if (email)
gtk_entry_set_text (GTK_ENTRY (priv->email_entry), email);
-#ifdef ENABLE_EDS
+#ifdef USE_EDS
if (contact) {
GtkEntryCompletion *completion = create_email_completion (contact);
@@ -231,7 +231,7 @@ personal_details_configuration_updated_cb (GiggleGitConfig *configuration,
if (book)
g_object_unref (book);
-#endif /* ENABLE_EDS */
+#endif /* USE_EDS */
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]