Hello everyone,

I believe I have a solution for the problems building sword-1.5.9 with ICU.
Tests were failing to build properly.  The attached patch solved the compile
errors in Unicode streams for me, maybe it will for everyone else hopefully
including Fedora Core users.

A good test to see your "true" ICU version is to type "icu-config --version" at
the command line.  That is what the configure script is using, no matter what
your package is named.  Mine reported "3.4.1".

The key for recent ICU versions is to make sure that icu-config is called with
--ldflags-icuio, not --ldflags-ustdio.  The version check was broken, and
failed to set up ICU_IOLIBS correctly.

The attached patch is more complex than absolutely necessary, since you could
just check that the first part of the version number is 3 or greater, but I
wanted to build a script that was capable of doing version checking against an
arbitrary version identifier (must be numerical).

Hope this helps,
Scott

Index: configure.ac
===================================================================
--- configure.ac	(revision 1983)
+++ configure.ac	(working copy)
@@ -1,4 +1,4 @@
-# ---------------------------------------------------------------------
+z# ---------------------------------------------------------------------
 # Initialisation
 # ---------------------------------------------------------------------
 
@@ -133,7 +133,36 @@
 	else
 	   ICU_VER=`$ICU_CONFIG --version`
 	   ICU_LIBS=`$ICU_CONFIG --ldflags`
-	   ICU_IOLIBS=`if test $(echo "$ICU_VER >= 3.0"|bc) -eq 1; then $ICU_CONFIG --ldflags-icuio; else $ICU_CONFIG --ldflags-ustdio; fi;`
+	   # Do smart version comparison to arbitrary depth
+	   ICU_VER_COMPARE_RESULT=0
+	   ICU_TEST_VER=3.0
+	   ICU_VER_LEVEL=1
+	   ICU_TEST_PART_VER=`echo $ICU_TEST_VER | cut -d. -s -f$ICU_VER_LEVEL`
+	   ICU_ACT_PART_VER=`echo $ICU_VER | cut -d. -s -f$ICU_VER_LEVEL`
+	   while test -n "$ICU_ACT_PART_VER" || test -n "$ICU_TEST_PART_VER"
+	   do
+		if test -z "$ICU_TEST_PART_VER"; then
+		   ICU_TEST_PART_VER=0
+		fi
+		if test -z "$ICU_ACT_PART_VER"; then
+		   ICU_ACT_PART_VER=0
+		fi
+		if test "$ICU_ACT_PART_VER" -gt "$ICU_TEST_PART_VER"; then
+		   ICU_VER_COMPARE_RESULT=1
+		   break
+		elif test "$ICU_ACT_PART_VER" -lt "$ICU_TEST_PART_VER"; then
+		   ICU_VER_COMPARE_RESULT=-1
+		   break
+		fi
+		ICU_VER_LEVEL=`expr $ICU_VER_LEVEL + 1`
+		ICU_TEST_PART_VER=`echo $ICU_TEST_VER | cut -d. -s -f$ICU_VER_LEVEL`
+		ICU_ACT_PART_VER=`echo $ICU_VER | cut -d. -s -f$ICU_VER_LEVEL`
+	   done
+	   if test $ICU_VER_COMPARE_RESULT -ge 0; then
+	      ICU_IOLIBS=`$ICU_CONFIG --ldflags-icuio`
+	   else
+	      ICU_IOLIBS=`$ICU_CONFIG --ldflags-ustdio`
+	   fi
 	fi
 fi
 
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to