[tracker/parser-unicode-libs-review] configure option now defaults to libunistring if found



commit 4a072c37b1f833297e8f041b65a1665707a4a907
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Wed May 5 15:48:40 2010 +0200

    configure option now defaults to libunistring if found

 configure.ac |   96 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 57 insertions(+), 39 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5cb0413..258b56b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -828,53 +828,71 @@ AM_CONDITIONAL(HAVE_MINER_FLICKR, test "x$have_miner_flickr" = "xyes")
 
 ##################################################################
 # GLib, libunistring or libicu?
+# By default, AUTO with this order of preference:
+#  1)  libunistring
+#  2)  libicu
+#  3)  glib
 ##################################################################
+
+# Check for libunistring...
+AC_CHECK_HEADER(uniwbrk.h,
+                AC_CHECK_LIB(unistring, u8_wordbreaks))
+have_libunistring=${ac_cv_lib_unistring_u8_wordbreaks:-no}
+LIBUNISTRING_CFLAGS="$CFLAGS"
+LIBUNISTRING_LIBS="$LIBS"
+
+# Check for libicu... Note that AC_CHECK_LIB cannot be used as
+#  symbol name includes libicu library version... don't want to
+#  look for ubrk_next_4_2
+AC_CHECK_HEADER(unicode/ubrk.h, [have_libicu=yes],[have_libicu=no])
+LIBICU_CFLAGS=""
+LIBICU_LIBS="-licuuc"
+
+# Configure option
 AC_ARG_WITH([unicode-support],
             AS_HELP_STRING([--with-unicode-support],
-                           [Unicode support library? (glib|libunistring|libicu) [[default=glib]]]))
-if test "x$with_unicode_support" = "xlibunistring"; then
-   # Check for libunistring...
-   unicode_library=libunistring
-   AC_CHECK_HEADER(uniwbrk.h,
-		   AC_CHECK_LIB(unistring, u8_wordbreaks))
-
-   have_libunistring=${ac_cv_lib_unistring_u8_wordbreaks:-no}
-
-   LIBUNISTRING_CFLAGS="$CFLAGS"
-   LIBUNISTRING_LIBS="$LIBS"
-
-   AC_SUBST(LIBUNISTRING_CFLAGS)
-   AC_SUBST(LIBUNISTRING_LIBS)
+                           [Unicode support library? (libunistring|libicu|glib) [[default=auto]]]))
 
+# If auto, decide ourselves
+if test "x$with_unicode_support" = "x"; then
    if test "x$have_libunistring" = "xyes"; then
-     AC_DEFINE(HAVE_LIBUNISTRING, [], [libunistring Unicode support library])
-   else
-     AC_MSG_ERROR([***libunistring requested but not found - exiting!])
-   fi
-else
-   if test "x$with_unicode_support" = "xlibicu"; then
-      # Check for libicu... Note that AC_CHECK_LIB cannot be used as
-      #  symbol name includes libicu library version... don't want to
-      #  look for ubrk_next_4_2
-      unicode_library=libicu
-      AC_CHECK_HEADER(unicode/ubrk.h, [have_libicu=yes],[have_libicu=no])
-
-      LIBICU_CFLAGS=""
-      LIBICU_LIBS="-licuuc"
-
-      AC_SUBST(LIBICU_CFLAGS)
-      AC_SUBST(LIBICU_LIBS)
-
-     if test "x$have_libicu" = "xyes"; then
-       AC_DEFINE(HAVE_LIBICU, [], [libicu Unicode support library])
-     else
-       AC_MSG_ERROR([***libicu requested but not found - exiting!])
-     fi
+      with_unicode_support=libunistring
    else
-      unicode_library=glib
+      if test "x$have_libicu" = "xyes"; then
+         with_unicode_support=libicu
+      else
+         with_unicode_support=glib
+      fi
    fi
 fi
 
+case "x$with_unicode_support" in
+     # Use libunistring
+     "xlibunistring")
+        AC_SUBST(LIBUNISTRING_CFLAGS)
+        AC_SUBST(LIBUNISTRING_LIBS)
+        if test "x$have_libunistring" = "xyes"; then
+           AC_DEFINE(HAVE_LIBUNISTRING, [], [libunistring Unicode support library])
+        else
+           AC_MSG_ERROR([***libunistring requested but not found - exiting!])
+        fi
+     ;;
+     # Use libicu
+     "xlibicu")
+        AC_SUBST(LIBICU_CFLAGS)
+        AC_SUBST(LIBICU_LIBS)
+        if test "x$have_libicu" = "xyes"; then
+          AC_DEFINE(HAVE_LIBICU, [], [libicu Unicode support library])
+        else
+          AC_MSG_ERROR([***libicu requested but not found - exiting!])
+        fi
+     ;;
+     # Use glib
+     "xglib") ;;
+     # Invalid option value
+     *) AC_MSG_ERROR([***wrong value for --with-unicode-support: $with_unicode_support - exiting!]) ;;
+esac
+
 AM_CONDITIONAL(HAVE_LIBUNISTRING, test "x$have_libunistring" = "xyes")
 AM_CONDITIONAL(HAVE_LIBICU, test "x$have_libicu" = "xyes")
 
@@ -1835,7 +1853,7 @@ Build Configuration:
 	Support for file monitoring:            $have_file_monitor
 	Support for accent stripping (unac):  	$have_unac
 	Support for Cyrillic languages (enca): 	$have_enca
-	Unicode support library: 		$unicode_library
+	Unicode support library: 		$with_unicode_support
 
 Applications:
 



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