[folks] build: Make telepathy backend optional



commit 855803a62b3a89ddb3c6abd3fa316d80cd036baf
Author: Arun Raghavan <arun raghavan collabora co uk>
Date:   Tue Aug 21 16:43:14 2012 +0530

    build: Make telepathy backend optional
    
    This is handy for while developing for those who don't always have
    bleeding edge telepathy-glib. As a side-effect, tests are also made
    optional (but on by default).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682346

 Makefile.am           |    7 ++++++-
 backends/Makefile.am  |    5 ++++-
 configure.ac          |   46 +++++++++++++++++++++++++++++++++++++---------
 tests/Makefile.am     |    5 ++++-
 tests/lib/Makefile.am |    5 ++++-
 5 files changed, 55 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 799b193..347c511 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,18 +3,23 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = \
 	folks \
 	backends \
-	tests \
 	tools \
 	po \
 	$(NULL)
 
+if ENABLE_TESTS
+SUBDIRS += tests
+endif
+
 if HAVE_VALADOC
 SUBDIRS += docs
 endif
 
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-docs \
+	--enable-tests \
 	--enable-eds-backend \
+	--enable-telepathy-backend \
 	--enable-libsocialweb-backend \
 	--enable-tracker-backend \
 	--enable-zeitgeist \
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 0aa6709..a81ed00 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -1,8 +1,11 @@
 SUBDIRS = \
-	telepathy \
 	key-file \
 	$(NULL)
 
+if ENABLE_TELEPATHY
+SUBDIRS += telepathy
+endif
+
 if ENABLE_LIBSOCIALWEB
 SUBDIRS += libsocialweb
 endif
diff --git a/configure.ac b/configure.ac
index dc5f4a8..933b20a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,9 +98,22 @@ else
         AC_DEFINE(HAVE_EDS, [0], [Define as 1 if you have the eds backend])
 fi
 
-
 AM_CONDITIONAL([ENABLE_EDS], [test "x$enable_eds_backend" = "xyes"])
 
+AC_ARG_ENABLE(telepathy-backend,
+        AC_HELP_STRING([--enable-telepathy-backend],
+                       [ build the Telepathy backend]),
+        enable_telepathy_backend=$enableval,
+        enable_telepathy_backend=yes )
+
+if test "x$enable_telepathy_backend" = "xyes"; then
+        AC_DEFINE(HAVE_TELEPATHY, [1], [Define as 1 if you have the Telepathy backend])
+else
+        AC_DEFINE(HAVE_TELEPATHY, [0], [Define as 1 if you have the Telepathy backend])
+fi
+
+AM_CONDITIONAL([ENABLE_TELEPATHY], [test "x$enable_eds_backend" = "xyes"])
+
 # Automatically check the dependencies for the libsocialweb backend
 SW_CLIENT_REQUIRED=0.25.20
 AC_ARG_ENABLE(libsocialweb-backend,
@@ -177,7 +190,10 @@ Gee 0.6.x)])
 fi
 
 TP_GLIB_REQUIRED=0.19.0
-PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
+if test x$enable_telepathy_backend = xyes; then
+        PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
+        PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED])
+fi
 
 # Ignore post 0.20 deprecations
 TP_GLIB_CFLAGS="$TP_GLIB_CFLAGS -DTP_VERSION_MIN_REQUIRED=TP_VERSION_0_20"
@@ -195,8 +211,6 @@ if test x$enable_eds_backend = xyes; then
         PKG_CHECK_MODULES([EDATASERVER], [libedataserver-1.2 >= $EDATASERVER_REQUIRED])
 fi
 
-PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED])
-
 #
 # Vala building options -- allows tarball builds without installing Vala
 #
@@ -268,10 +282,12 @@ if test "x$enable_vala" = "xyes" ; then
         AC_SUBST([VAPIGENFLAGS])
         AC_SUBST([VAPIDIR])
 
-        VALA_CHECK_PACKAGES([telepathy-glib
-                             gio-2.0
-                             gee-1.0
-                             zeitgeist-1.0])
+        VALA_CHECK_PACKAGES([gio-2.0
+                             gee-1.0])
+
+        if test x$enable_telepathy_backend = xyes; then
+          VALA_CHECK_PACKAGES([telepathy-glib zeitgeist-1.0])
+        fi
 
         if test x$enable_tracker_backend = xyes; then
           VALA_CHECK_PACKAGES([tracker-sparql-$TRACKER_SPARQL_MAJOR])
@@ -383,6 +399,17 @@ AS_IF([test "$enable_inspect_tool" = "yes" -a "$with_inspect_tool" = "no"],
 AM_CONDITIONAL([ENABLE_INSPECT_TOOL], [test "$with_inspect_tool" = "yes"])
 
 # -----------------------------------------------------------
+# Tests
+# -----------------------------------------------------------
+
+AC_ARG_ENABLE([tests],
+              AS_HELP_STRING([--enable-tests],[Enable building of tests]),
+              [enable_tests=$enableval], [enable_tests=yes])
+AS_IF([test "$enable_tests" = "yes" -a "$enable_telepathy_backend" = "no"],
+      [AC_MSG_ERROR([The Telepathy backend must be enabled to build tests])])
+AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
+
+# -----------------------------------------------------------
 # Documentation
 # -----------------------------------------------------------
 
@@ -617,8 +644,9 @@ Configure summary:
         Documentation...............:  ${have_valadoc}
         Import tool.................:  ${with_import_tool}
         Inspector tool..............:  ${with_inspect_tool}
+        Telepathy backend...........:  ${enable_telepathy_backend}
         Tracker backend.............:  ${enable_tracker_backend}
         Libsocialweb backend........:  ${have_libsocialweb_backend}
         E-D-S backend...............:  ${enable_eds_backend}
-
+        Build tests.................:  ${enable_tests}
 "
diff --git a/tests/Makefile.am b/tests/Makefile.am
index be349c6..ae26f91 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,9 +3,12 @@ SUBDIRS = \
     lib \
     tools \
     folks \
-    telepathy \
     $(NULL)
 
+if ENABLE_TELEPATHY
+SUBDIRS += telepathy
+endif
+
 if ENABLE_LIBSOCIALWEB
 SUBDIRS += libsocialweb
 endif
diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index b3bd792..bcaf81d 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -1,8 +1,11 @@
 SUBDIRS = \
 	key-file \
-	telepathy \
 	$(NULL)
 
+if ENABLE_TELEPATHY
+SUBDIRS += telepathy
+endif
+
 if ENABLE_LIBSOCIALWEB
 SUBDIRS += libsocialweb
 endif



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