[tracker] tracker-extract: Don't try to spawn odt2txt if it isn't installed



commit 232e3b0190ae538160162c3d5fd14b346b23323a
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Mar 12 11:55:11 2010 +0000

    tracker-extract: Don't try to spawn odt2txt if it isn't installed

 configure.ac                                |   10 ++++++++++
 src/tracker-extract/tracker-extract-oasis.c |    6 ++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f1278f6..b543749 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1027,6 +1027,16 @@ if test x$enable_unzip_psgz_files != "xno"; then
   AC_DEFINE(USING_UNZIPPSFILES, 1, [Unzip ps.gz files])
 fi
 
+####################################################################
+# Oasis odt2txt binary check
+####################################################################
+
+AC_CHECK_PROG(have_odt2txt, odt2txt, "yes", "no")
+
+if test "x$have_odt2txt" = "xyes"; then
+   AC_DEFINE(HAVE_ODT2TXT, 1, [Define if we have odt2txt binary available])
+fi
+
 ##################################################################
 # Check for poppler's glib bingings
 ##################################################################
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 59a76e0..a359ac6 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -18,6 +18,8 @@
  * Boston, MA  02110-1301, USA.
  */
 
+#include "config.h"
+
 #include <stdio.h>
 #include <string.h>
 
@@ -74,6 +76,7 @@ static gchar *
 extract_content (const gchar *path,
                  guint        n_words)
 {
+#ifdef HAVE_ODT2TXT
 	gchar *command, *output, *text;
 	GError *error = NULL;
 
@@ -93,6 +96,9 @@ extract_content (const gchar *path,
 	g_free (output);
 
 	return text;
+#else  /* HAVE_ODT2TXT */
+	return NULL;
+#endif /* HAVE_ODT2TXT */
 }
 
 static void



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