[tracker] Make it possible to disable libicu and libenca based charset detectors



commit bc4f363d504e1508530b36183e4c7a6362f88e92
Author: Philip Van Hoof <philip codeminded be>
Date:   Sun Mar 2 15:45:08 2014 +0100

    Make it possible to disable libicu and libenca based charset detectors

 configure.ac                              |   23 +++++++++++++++++++----
 src/libtracker-extract/Makefile.am        |    2 +-
 src/libtracker-extract/tracker-encoding.c |    8 ++++----
 3 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index af34d92..4adac1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1454,8 +1454,8 @@ AM_CONDITIONAL(HAVE_TRACKER_RESDUMP, test "$have_tracker_resdump" = "yes")
 # Check for tracker-extract: enca for defect Russian/Cyrillic in MP3s
 ####################################################################
 
-AC_ARG_WITH(enca,
-            AS_HELP_STRING([--with-enca],
+AC_ARG_ENABLE(enca,
+            AS_HELP_STRING([--enable-enca],
                            [enable libenca for Cyrillic language detection in MP3s [[default=auto]]]),,
             [enable_enca=auto])
 
@@ -1472,13 +1472,28 @@ else
    have_enca="no  (disabled)"
 fi
 
-if test "x$have_enca" = "xyes" || test "x$have_libicu" = "xyes"; then
+AC_ARG_ENABLE(icu-charset-detection,
+            AS_HELP_STRING([--enable-icu-charset-detection],
+                           [enable libicu for charset detection in MP3s [[default=auto]]]),,
+            [enable_icu_charset_detection=auto])
+
+if test "x$have_libicu" = "xyes"; then
+       if test "x$enable_icu_charset_detection" != "xno"; then
+               have_libicu_charset_detection="yes"
+               AC_DEFINE(HAVE_LIBICU_CHARSET_DETECTION, [], [ICU language detection aid])
+       else
+               have_libicu_charset_detection="no"
+       fi
+fi
+
+if test "x$have_enca" = "xyes" || test "x$have_libicu_charset_detection" = "xyes"; then
    have_charset_detection="yes"
 else
    have_charset_detection="no"
 fi
 
 AM_CONDITIONAL(HAVE_ENCA, test "$have_enca" = "yes")
+AM_CONDITIONAL(HAVE_LIBICU_CHARSET_DETECTION, test "$have_libicu_charset_detection" = "yes")
 
 ##################################################################
 # Check for tracker-extract: libxml2 for XML/HTML extractor
@@ -2502,7 +2517,7 @@ Metadata Extractors:
        Support AbiWord document parsing:       $have_abiword
        Support DVI parsing:                    $have_dvi
        Support MP3 parsing:                    $have_mp3
-       Support MP3 tag charset detection:      $have_charset_detection (icu: $have_libicu, enca: $have_enca)
+       Support MP3 tag charset detection:      $have_charset_detection (icu: $have_libicu_charset_detection, 
enca: $have_enca)
        Support PS parsing:                     $have_ps
        Support text parsing:                   $have_text
        Support icon parsing:                   $have_icon
diff --git a/src/libtracker-extract/Makefile.am b/src/libtracker-extract/Makefile.am
index fb0693a..b63f248 100644
--- a/src/libtracker-extract/Makefile.am
+++ b/src/libtracker-extract/Makefile.am
@@ -63,7 +63,7 @@ libtracker_extract_la_SOURCES += \
        tracker-encoding-meegotouch.h
 endif
 
-if HAVE_LIBICU
+if HAVE_LIBICU_CHARSET_DETECTION
 libtracker_extract_la_SOURCES += \
        tracker-encoding-libicu.c                      \
        tracker-encoding-libicu.h
diff --git a/src/libtracker-extract/tracker-encoding.c b/src/libtracker-extract/tracker-encoding.c
index b5c82d5..d8da3c4 100644
--- a/src/libtracker-extract/tracker-encoding.c
+++ b/src/libtracker-extract/tracker-encoding.c
@@ -30,14 +30,14 @@
 #include "tracker-encoding-meegotouch.h"
 #endif
 
-#ifdef HAVE_LIBICU
+#ifdef HAVE_LIBICU_CHARSET_DETECTION
 #include "tracker-encoding-libicu.h"
 #endif
 
 gboolean
 tracker_encoding_can_guess (void)
 {
-#if defined (HAVE_ENCA) || defined (HAVE_MEEGOTOUCH) || defined (HAVE_LIBICU)
+#if defined (HAVE_ENCA) || defined (HAVE_MEEGOTOUCH) || defined (HAVE_LIBICU_CHARSET_DETECTION)
        return TRUE;
 #else
        return FALSE;
@@ -54,10 +54,10 @@ tracker_encoding_guess (const gchar *buffer,
        encoding = tracker_encoding_guess_meegotouch (buffer, size);
 #endif /* HAVE_MEEGOTOUCH */
 
-#ifdef HAVE_LIBICU
+#ifdef HAVE_LIBICU_CHARSET_DETECTION
        if (!encoding)
                encoding = tracker_encoding_guess_icu (buffer, size);
-#endif
+#endif /* HAVE_LIBICU_CHARSET_DETECTION */
 
 #ifdef HAVE_ENCA
        if (!encoding)


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