[libxml2] Bug 760190: configure.ac should be able to build --with-icu without icu-config tool <https://bugzill



commit 6e3af87055d2c868d20d8b2b9da59bbafe84e5e0
Author: David Kilzer <ddkilzer apple com>
Date:   Tue Jan 5 16:11:28 2016 -0800

    Bug 760190: configure.ac should be able to build --with-icu without icu-config tool 
<https://bugzilla.gnome.org/show_bug.cgi?id=760190>
    
    * configure.ac: Add fallback tests if the icu-config tool is not
    installed (like on Mac OS X).  This also allows an include
    prefix to be set using "--with-icu=/prefix/to/icu", similar to
    --with-iconv.

 configure.ac |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 55a5a6f..fd05c56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1480,8 +1480,6 @@ case "$host" in
        *) M_LIBS="-lm"
        ;;
 esac
-XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
-XML_LIBTOOLLIBS="libxml2.la"
 AC_SUBST(WITH_ICONV)
 
 WITH_ICU=0
@@ -1496,11 +1494,41 @@ else
         WITH_ICU=1
         echo Enabling ICU support
     else
-        AC_MSG_ERROR([libicu config program icu-config not found])
+        if test "$with_icu" != "yes" -a "$with_iconv" != "" ; then
+            CPPFLAGS="${CPPFLAGS} -I$with_icu"
+            # Export this since our headers include icu.h
+            XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_icu"
+        fi
+
+        AC_CHECK_HEADER(unicode/ucnv.h,
+        AC_MSG_CHECKING(for icu)
+        AC_TRY_LINK([#include <unicode/ucnv.h>],[
+    UConverter *utf = ucnv_open("UTF-8", NULL);],[
+            AC_MSG_RESULT(yes)
+            WITH_ICU=1],[
+            AC_MSG_RESULT(no)
+            AC_MSG_CHECKING(for icu in -licucore)
+
+            _ldflags="${LDFLAGS}"
+            _libs="${LIBS}"
+            LDFLAGS="${LDFLAGS} ${ICU_LIBS}"
+            LIBS="${LIBS} -licucore"
+
+            AC_TRY_LINK([#include <unicode/ucnv.h>],[
+    UConverter *utf = ucnv_open("UTF-8", NULL);],[
+                AC_MSG_RESULT(yes)
+                WITH_ICU=1
+                ICU_LIBS="${ICU_LIBS} -licucore"
+                LIBS="${_libs}"
+                LDFLAGS="${_ldflags}"],[
+                AC_MSG_RESULT(no)
+                LIBS="${_libs}"
+                LDFLAGS="${_ldflags}"])]))
     fi
 fi
+XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS"
+XML_LIBTOOLLIBS="libxml2.la"
 AC_SUBST(WITH_ICU)
-AC_SUBST(ICU_LIBS)
 
 WITH_ISO8859X=1
 if test "$WITH_ICONV" != "1" ; then
@@ -1639,6 +1667,7 @@ AC_SUBST(XML_LIBDIR)
 AC_SUBST(XML_LIBS)
 AC_SUBST(XML_LIBTOOLLIBS)
 AC_SUBST(ICONV_LIBS)
+AC_SUBST(ICU_LIBS)
 AC_SUBST(XML_INCLUDEDIR)
 AC_SUBST(HTML_DIR)
 AC_SUBST(HAVE_ISNAN)


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