ICU-10740 Copy ICU tools trunk r35512 to tags/release-53-rc

X-SVN-Rev: 35514
diff --git a/.gitattributes b/.gitattributes
index d6a6199..662e027 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -121,6 +121,132 @@
 trac/IcuCodeTools/0.12/readme.txt -text
 trac/IcuCodeTools/0.12/setup.cfg -text
 trac/IcuCodeTools/0.12/setup.py -text
+trunk/currency/.classpath -text
+trunk/currency/.project -text
+trunk/currency/.settings/org.eclipse.core.resources.prefs -text
+trunk/currency/.settings/org.eclipse.jdt.core.prefs -text
+trunk/currency/.settings/org.eclipse.jdt.ui.prefs -text
+trunk/multi/c/Makefile-c.inc -text
+trunk/multi/c/patch/3_0 -text
+trunk/multi/c/patch/3_2 -text
+trunk/multi/c/patch/3_4_1 -text
+trunk/multi/common/Makefile-multi.inc -text
+trunk/multi/j/Makefile-j.inc -text
+trunk/multi/proj/icu4cscan/Makefile -text
+trunk/multi/proj/icu4cscan/Makefile.local.sample -text
+trunk/multi/proj/icu4cscan/Makefile_c -text
+trunk/multi/proj/icu4cscan/Makefile_j -text
+trunk/multi/proj/icu4cscan/dtd/icucaps.dtd -text
+trunk/multi/proj/icu4cscan/old-xmls.tar.bz2 -text
+trunk/multi/proj/icu4cscan/zappit.sed -text
+trunk/multi/proj/icu4jscan/.classpath -text
+trunk/multi/proj/icu4jscan/.project -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/CapDocument.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/CapElement.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/CapNode.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/CapScan.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/ScanICU.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/ScanJava.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/SimpleScan.java -text
+trunk/multi/proj/icu4jscan/src/com/ibm/icu/dev/scan/Spinner.java -text
+trunk/multi/proj/provider/Makefile.local-sample -text
+trunk/multi/proj/provider/icu-config.sed -text
+trunk/multi/proj/provider/readme.txt -text
+trunk/release/c/bomfix.py -text
+trunk/release/java/.classpath -text
+trunk/release/java/.project -text
+trunk/release/java/Makefile -text
+trunk/release/java/icu4c.css -text
+trunk/release/java/lib/LICENSE.txt -text
+trunk/release/java/lib/README.TXT -text
+trunk/release/java/lib/serializer.jar -text
+trunk/release/java/lib/xalan.jar -text
+trunk/release/java/lib/xercesImpl.jar -text
+trunk/release/java/src/com/ibm/icu/dev/tools/docs/dumpAllCFunc_xml.xslt -text
+trunk/release/java/src/com/ibm/icu/dev/tools/docs/dumpAllCppFunc_xml.xslt -text
+trunk/release/java/src/com/ibm/icu/dev/tools/docs/genreport_xml.xslt -text
+trunk/scripts/icurun -text
+trunk/scripts/reticket -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/__init__.py -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/dcut.py -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/htdocs/css/icuxtn.css -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/htdocs/js/review.js -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/review.py -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/templates/nothing.html -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/templates/review.html -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/ticketmgr.py -text
+trunk/trac/IcuCodeTools/0.11/icucodetools/tktlist.py -text
+trunk/trac/IcuCodeTools/0.11/license.html -text
+trunk/trac/IcuCodeTools/0.11/readme.txt -text
+trunk/trac/IcuCodeTools/0.11/setup.cfg -text
+trunk/trac/IcuCodeTools/0.11/setup.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/__init__.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/dcut.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/htdocs/css/icuxtn.css -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/htdocs/js/review.js -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/review.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/templates/nothing.html -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/templates/review.html -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/ticketmgr.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/tktlist.py -text
+trunk/trac/IcuCodeTools/0.12/icucodetools/traccheck.py -text
+trunk/trac/IcuCodeTools/0.12/license.html -text
+trunk/trac/IcuCodeTools/0.12/readme.txt -text
+trunk/trac/IcuCodeTools/0.12/setup.cfg -text
+trunk/trac/IcuCodeTools/0.12/setup.py -text
+trunk/unicodetools/com/ibm/rbm/docs/images/TitleLogo_transparent.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/arrow_bullet.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/diamond_bullet.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/ibm_logo_small_white.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/RBReporter.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/basic_file.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/basic_group.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/basic_resource.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/basic_translation.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/basic_untranslated.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/create_group.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/empty_group.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/empty_resource.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/empty_screen.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/empty_with_preferences.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/laf_metal.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/laf_motif.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/laf_windows.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/lookup_resource.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/main_page.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_file.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_file_export.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_file_import.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_help.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_options.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/menu_popup_tree.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/new_baseclass.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/new_bundle.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/preferences_dialog.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_groups_bundle.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_groups_file.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_search.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_stats_bundle.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_stats_file.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_tree_basic.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_untrans_bundle.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_untrans_dialog0.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/screenshots/view_untrans_file.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/spacer.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/template_l.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/template_line.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/template_ll.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/template_u.gif -text
+trunk/unicodetools/com/ibm/rbm/docs/images/template_ul.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/TitleLogo_transparent.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_bundle.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_country.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_file.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_group.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_item.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_language.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_project.gif -text
+trunk/unicodetools/com/ibm/rbm/gui/images/tree_icon_variant.gif -text
 unicodetools/com/ibm/rbm/docs/images/TitleLogo_transparent.gif -text
 unicodetools/com/ibm/rbm/docs/images/arrow_bullet.gif -text
 unicodetools/com/ibm/rbm/docs/images/diamond_bullet.gif -text
diff --git a/.gitignore b/.gitignore
index 856e86a..1268aa0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,62 @@
 trac/IcuCodeTools/0.12/build
 trac/IcuCodeTools/0.12/dist
 trac/IcuCodeTools/0.12/icucodetools/*.pyc
+trunk/multi/c/Makefile.local
+trunk/multi/packages/*.jar
+trunk/multi/packages/*.tgz
+trunk/multi/proj/chello/out
+trunk/multi/proj/icu4cscan/Makefile.local
+trunk/multi/proj/icu4cscan/cooked
+trunk/multi/proj/icu4cscan/dtdcache
+trunk/multi/proj/icu4cscan/jxml
+trunk/multi/proj/icu4cscan/xml
+trunk/multi/proj/icu4jscan/bin
+trunk/multi/proj/provider/Makefile.local
+trunk/multi/proj/provider/out
+trunk/multi/tmp
+trunk/release/c/uconfigtest
+trunk/release/c/uconfigtest.local
+trunk/release/java/APIChangeReport*
+trunk/release/java/Makefile.local
+trunk/release/java/classes
+trunk/release/java/lib
+trunk/trac/IcuCodeTools/0.11/*.egg-info
+trunk/trac/IcuCodeTools/0.11/build
+trunk/trac/IcuCodeTools/0.11/icucodetools/*.pyc
+trunk/trac/IcuCodeTools/0.12/*.egg-info
+trunk/trac/IcuCodeTools/0.12/build
+trunk/trac/IcuCodeTools/0.12/dist
+trunk/trac/IcuCodeTools/0.12/icucodetools/*.pyc
+trunk/unicode/c/genprops/*.d
+trunk/unicode/c/genprops/*.ncb
+trunk/unicode/c/genprops/*.o
+trunk/unicode/c/genprops/*.opt
+trunk/unicode/c/genprops/*.pdb
+trunk/unicode/c/genprops/*.plg
+trunk/unicode/c/genprops/Debug
+trunk/unicode/c/genprops/Makefile
+trunk/unicode/c/genprops/Release
+trunk/unicode/c/genprops/debug
+trunk/unicode/c/genprops/genprops
+trunk/unicode/c/genprops/genprops.[0-9]
+trunk/unicode/c/genprops/genprops.vcproj.*.*.user
+trunk/unicode/c/genprops/release
+trunk/unicode/c/genprops/x64
+trunk/unicode/c/genprops/x86
+trunk/unicode/c/genuca/*.d
+trunk/unicode/c/genuca/*.o
+trunk/unicode/c/genuca/*.pdb
+trunk/unicode/c/genuca/Debug
+trunk/unicode/c/genuca/Makefile
+trunk/unicode/c/genuca/Release
+trunk/unicode/c/genuca/debug
+trunk/unicode/c/genuca/genuca
+trunk/unicode/c/genuca/genuca.8
+trunk/unicode/c/genuca/genuca.vcproj.*.*.user
+trunk/unicode/c/genuca/release
+trunk/unicode/c/genuca/x64
+trunk/unicode/c/genuca/x86
+trunk/unicodetools/com/ibm/rbm/lib
 unicode/c/genprops/*.d
 unicode/c/genprops/*.ncb
 unicode/c/genprops/*.o
diff --git a/trunk/colprobe/Makefile.in b/trunk/colprobe/Makefile.in
new file mode 100644
index 0000000..c6beffd
--- /dev/null
+++ b/trunk/colprobe/Makefile.in
@@ -0,0 +1,81 @@
+## Makefile.in for ICU - extra/colprobe
+## Copyright (c) 2001, International Business Machines Corporation and
+## others. All Rights Reserved.
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+top_builddir = ../..
+
+include $(top_builddir)/icudefs.mk
+
+## Build directory information
+subdir = extra/colprobe
+
+## Extra files to remove for 'make clean'
+CLEANFILES = *~ $(DEPS)
+
+## Target information
+TARGET = colprobe 
+LONGNAME = longname
+
+CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/io
+LIBS = $(LIBICUI18N) $(LIBICUUC) $(LIBUSTDIO) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
+
+OBJECTS = colprobeNew.o line.o sortedlines.o strengthprobe.o uprinter.o 
+LONGNAME_OBJ = longname.o
+
+DEPS = $(OBJECTS:.o=.d)
+LONGNAME_DEPS = $(LONGNAME_OBJ:.o=.d)
+
+## List of phony targets
+.PHONY : all all-local install install-local clean clean-local	\
+distclean distclean-local dist dist-local check check-local
+
+## Clear suffix list
+.SUFFIXES :
+
+## List of standard targets
+all: all-local
+install: install-local
+clean: clean-local
+distclean : distclean-local
+dist: dist-local
+check: all check-local
+
+all-local: $(TARGET)
+
+install-local:
+
+dist-local:
+
+clean-local:
+	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
+	$(RMV) $(OBJECTS) $(TARGET)
+
+distclean-local: clean-local
+	$(RMV) Makefile
+
+check-local: all-local
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) \
+	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(TARGET) : $(OBJECTS)
+	$(LINK.cc) -o $@ $^ $(LIBS)
+
+$(LONGNAME) : $(LONGNAME_OBJ)
+	$(LINK.cc) -o $@ $^ $(LIBS)
+
+invoke:
+	ICU_DATA=$${ICU_DATA:-$(top_builddir)/data/} TZ=PST8PDT $(INVOKE) $(INVOCATION)
+
+ifeq (,$(MAKECMDGOALS))
+-include $(DEPS)
+else
+ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
+-include $(DEPS)
+endif
+endif
diff --git a/trunk/colprobe/colprobe.cpp b/trunk/colprobe/colprobe.cpp
new file mode 100644
index 0000000..d1751be
--- /dev/null
+++ b/trunk/colprobe/colprobe.cpp
@@ -0,0 +1,1730 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File colprobe.cpp
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+#include "uoptions.h"
+#include "unicode/ucol.h"
+#include "unicode/ucoleitr.h"
+#include "unicode/ures.h"
+#include "unicode/uniset.h"
+#include "unicode/usetiter.h"
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/uscript.h"
+#include "uprops.h"
+#include "hash.h"
+#include "ucol_imp.h"
+
+#include "unicode/ustdio.h"
+#include "unicode/utrans.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <io.h>
+#include <fcntl.h>
+
+#include "colprobe.h"
+
+
+#ifdef WIN32
+#include <windows.h>
+#else
+//
+//  Stubs for Windows API functions when building on UNIXes.
+//
+typedef int DWORD;
+inline int CompareStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;};
+#include <sys/time.h>
+unsigned long timeGetTime() {
+    struct timeval t;
+    gettimeofday(&t, 0);
+    unsigned long val = t.tv_sec * 1000;  // Let it overflow.  Who cares.
+    val += t.tv_usec / 1000;
+    return val;
+};
+inline int LCMapStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;};
+const int LCMAP_SORTKEY = 0;
+#define MAKELCID(a,b) 0
+const int SORT_DEFAULT = 0;
+#endif
+
+#include "line.h"
+
+static UBool gVerbose = FALSE;
+static UBool gDebug = FALSE;
+static UBool gQuiet = FALSE;
+static UBool gExemplar = FALSE;
+
+DWORD          gWinLCID;
+int            gCount;
+Line          **gICULines;
+UCollator     *gCol;
+UCollator     *gUCA;
+Line          source;
+Line          target;
+Line          *gSource = &source;
+Line          *gTarget = &target;
+Hashtable     gElements(FALSE);
+Hashtable     gExpansions(FALSE);
+CompareFn gComparer;
+
+const UChar separatorChar = 0x0030;
+
+UFILE *out = NULL;
+UFILE *err = NULL;
+UFILE *log = NULL; 
+
+const char *progName = "colprobe";
+
+const char *gLocale = NULL;
+//char platform[256];
+int32_t platformIndex = -1;
+int32_t gPlatformNo = 0;
+int32_t gPlatformIndexes[10];
+int32_t gLocaleNo = 0;
+const char* gLocales[100];
+UBool gRulesStdin = FALSE;
+
+enum {
+  HELP1,
+    HELP2,
+    VERBOSE,
+    QUIET,
+    VERSION,
+    ICUDATADIR,
+    COPYRIGHT,
+    LOCALE,
+    PLATFORM,
+    DEBUG, 
+    EXEMPLAR,
+    RULESSTDIN
+};
+
+UOption options[]={
+  /*0*/ UOPTION_HELP_H,
+  /*1*/ UOPTION_HELP_QUESTION_MARK,
+  /*2*/ UOPTION_VERBOSE,
+  /*3*/ UOPTION_QUIET,
+  /*4*/ UOPTION_VERSION,
+  /*5*/ UOPTION_ICUDATADIR,
+  /*6*/ UOPTION_COPYRIGHT,
+  /*7*/ UOPTION_DEF("locale", 'l', UOPT_REQUIRES_ARG),
+  /*8*/ UOPTION_DEF("platform", 'p', UOPT_REQUIRES_ARG),
+  /*9*/ UOPTION_DEF("debug", 'D', UOPT_NO_ARG),
+  /*10*/ UOPTION_DEF("exemplar", 'E', UOPT_NO_ARG),
+  /*11*/ UOPTION_DEF("rulesstdin", 'R', UOPT_NO_ARG)
+};
+
+int Winstrcmp(const void *a, const void *b) {
+    gCount++;
+    int t;
+    t = CompareStringW(gWinLCID, 0, 
+      (*(Line **)a)->name, (*(Line **)a)->len, 
+      (*(Line **)b)->name, (*(Line **)b)->len);
+    return t-2;
+}
+
+int ICUstrcmp(const void *a, const void *b) {
+    gCount++;
+    UCollationResult t;
+    t = ucol_strcoll(gCol, 
+      (*(Line **)a)->name, (*(Line **)a)->len,  
+      (*(Line **)b)->name, (*(Line **)b)->len);
+    if (t == UCOL_LESS) return -1;
+    if (t == UCOL_GREATER) return +1;
+    return 0;
+}
+
+struct {
+  const char* name;
+  CompareFn comparer;
+} platforms[] = {
+  { "icu", ICUstrcmp },
+  { "win", Winstrcmp}
+};
+
+
+void deleteLineElement(void *line) {
+  delete((Line *)line);
+}
+
+void stringToLower(char *string) {
+  uint32_t i = 0;
+  for(i = 0; i < strlen(string); i++) {
+    string[i] = tolower(string[i]);
+  }
+}
+
+void usage(const char *name) {
+  u_fprintf(out, "Usage: %s --locale loc_name --platform platform\n", name);
+}
+
+void listKnownPlatforms() {
+  int32_t i = 0;
+  u_fprintf(err, "Known platforms:\n");
+  for(i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
+    u_fprintf(err, "\t%s\n", platforms[i]);
+  }
+}
+
+void addPlatform(const char *platform) {
+  int32_t i;
+  //stringToLower(platform);
+  int32_t oldPlatformNo = gPlatformNo;
+
+  for(i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
+    if(strcmp(platform, platforms[i].name) == 0) {
+      gPlatformIndexes[gPlatformNo++] = i;
+    }
+  }
+  if(gPlatformNo == oldPlatformNo) {
+    u_fprintf(err, "Unknown platform %s\n", platform);
+    listKnownPlatforms();
+  }
+}
+
+void processArgs(int argc, char* argv[], UErrorCode &status)
+{
+  int32_t i = 0;
+  U_MAIN_INIT_ARGS(argc, argv);
+
+  argc = u_parseArgs(argc, argv, (int32_t)(sizeof(options)/sizeof(options[0])), options);
+
+  if(argc < 0) {
+    u_fprintf(err, "Unknown option: %s\n", argv[-argc]);
+    usage(progName);
+    return;
+  }
+
+  if(options[0].doesOccur || options[1].doesOccur) {
+    usage(progName);
+    return;
+  }
+  if(options[VERBOSE].doesOccur) {
+    gVerbose = TRUE;
+  }
+  if(options[DEBUG].doesOccur) {
+    gDebug = TRUE;
+    gVerbose = TRUE;
+  }
+  if(options[EXEMPLAR].doesOccur) {
+    gExemplar = TRUE;
+  }
+  if(options[QUIET].doesOccur) {
+    gQuiet = TRUE;
+  }
+/*
+  for(i = 8; i < 9; i++) {
+    if(!options[i].doesOccur) {
+      u_fprintf(err, "Option %s is required!\n", options[i].longName);
+      usage(progName);
+      status = U_ILLEGAL_ARGUMENT_ERROR;
+    }
+    if(options[i].value == NULL) {
+      u_fprintf(err, "Option %s needs an argument!\n", options[i].longName);
+      usage(progName);
+      status = U_ILLEGAL_ARGUMENT_ERROR;
+    }
+  }
+*/
+  // ASCII based options specified on the command line
+  // this is for testing purposes, will allow to load
+  // up ICU rules and then poke through them.
+  // In that case, we test only ICU and don't need 
+  // a locale.
+  if(options[RULESSTDIN].doesOccur) {
+    gRulesStdin = TRUE;
+    addPlatform("icu");
+    return;
+  } 
+
+  if(options[LOCALE].doesOccur) {
+    gLocale = options[LOCALE].value;
+  } else {
+    for(i = 1; i < argc; i++) {
+      gLocales[gLocaleNo++] = argv[i];
+    }
+  }
+  if(options[PLATFORM].doesOccur) {
+    //strcpy(platform, options[PLATFORM].value);
+    //addPlatform("icu");
+    addPlatform(options[PLATFORM].value);
+  } else { // there is a list of platforms 
+    u_fprintf(err, "Option %s is required!\n", options[i].longName);
+    usage(progName);
+    status = U_ILLEGAL_ARGUMENT_ERROR;
+  }
+
+  //
+  //  Set up a Windows LCID
+  //
+  gWinLCID = uloc_getLCID(gLocale);
+  /*
+  if (gLocale != 0) {
+      gWinLCID = MAKELCID(gLocale, SORT_DEFAULT);
+  }
+  else {
+      gWinLCID = uloc_getLCID(gLocale);
+  }
+  */
+
+}
+
+void printRules(const UChar *name, int32_t len, UFILE *file) {
+  // very rudimentary pretty rules print
+  int32_t i = 0;
+  UChar toPrint[16384];
+  int32_t toPrintIndex = 0;
+  for(i = 0; i < len; i++) {
+    if(name[i] == 0x0026) {
+      if(toPrintIndex) {
+        toPrint[toPrintIndex] = 0;
+        u_fprintf(file, "%U\n", toPrint);
+        toPrintIndex = 0;
+        toPrint[toPrintIndex++] = name[i];
+      } else {
+        toPrint[toPrintIndex++] = name[i];
+      } 
+    } else {
+      toPrint[toPrintIndex++] = name[i];
+    }
+  }
+  if(toPrintIndex) {
+    toPrint[toPrintIndex] = 0;
+    u_fprintf(file, "%U\n", toPrint);
+    toPrintIndex = 0;
+  }
+
+
+}
+
+void escapeString(const UChar *name, int32_t len, UFILE *file) {
+  u_fprintf(file, "%U", name);
+/*
+  int32_t j = 0;
+  for(j = 0; j < len; j++) {
+    if(name[j] >= 0x20 && name[j] < 0x80) {
+      u_fprintf(file, "%c", name[j]);
+    } else {
+      u_fprintf(file, "\\u%04X", name[j]);
+    }
+  }
+*/
+}
+void escapeALine(Line *line, UFILE *file) {
+  escapeString(line->name, line->len, file);
+}
+
+void escapeExpansion(Line *line, UFILE *file) {
+  escapeString(line->expansionString, line->expLen, file);
+}
+
+void showNames(Line *line, UFILE *file) {
+  UErrorCode status = U_ZERO_ERROR;
+  int32_t j = 0;
+  char charName[256];
+  for(j = 0; j < line->len; j++) {
+    u_charName(line->name[j], U_EXTENDED_CHAR_NAME, charName, 256, &status);
+    u_fprintf(file, "%s ", charName);
+  }
+}
+
+void setArray(Line **array, Line *contents, int32_t size) {
+  int32_t i = 0;
+  for(i = 0; i < size; i++) {
+    array[i] = contents+i;
+  }
+}
+
+// set an array from a Hashtable
+int32_t 
+setArray(Line **array, Hashtable *table = &gElements) {
+  int32_t size = table->count();
+  int32_t hashIndex = -1;
+  const UHashElement *hashElement = NULL;
+  int32_t count = 0;
+  while((hashElement = table->nextElement(hashIndex)) != NULL) {
+    array[count++] = (Line *)hashElement->value.pointer;
+  }
+  return size;
+}
+
+UBool trySwamped(Line **smaller, Line **greater, UChar chars[2], CompareFn comparer) {
+  u_strcpy(gSource->name, (*smaller)->name);
+  gSource->name[(*smaller)->len] = separatorChar;
+  gSource->name[(*smaller)->len+1] = chars[0];
+  gSource->name[(*smaller)->len+2] = 0;
+  gSource->len = (*smaller)->len+2;
+
+  u_strcpy(gTarget->name, (*greater)->name);
+  gTarget->name[(*greater)->len] = separatorChar;
+  gTarget->name[(*greater)->len+1] = chars[1];
+  gTarget->name[(*greater)->len+2] = 0;
+  gTarget->len = (*greater)->len+2;
+
+  if(comparer(&gSource, &gTarget) > 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UBool trySwamps(Line **smaller, Line **greater, UChar chars[2], CompareFn comparer) {
+  gSource->name[0] = chars[0];
+  gSource->name[1] = separatorChar;
+  u_strcpy(gSource->name+2, (*smaller)->name);
+  gSource->len = (*smaller)->len+2;
+
+  gTarget->name[0] = chars[1];
+  gTarget->name[1] = separatorChar;
+  u_strcpy(gTarget->name+2, (*greater)->name);
+  gTarget->len = (*greater)->len+2;
+
+  if(comparer(&gSource, &gTarget) < 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UColAttributeValue 
+probeStrength(Line** prevLine, Line **currLine, CompareFn comparer) {
+  // Primary swamps secondary
+  // have pairs where [0] 2> [1]
+  UChar primSwamps[][2] = {
+    { 0x00E0, 0x0061 },
+    { 0x0450, 0x0435 },
+    { 0x31a3, 0x310d }
+  };
+  // Secondary swamps tertiary
+  // have pairs where [0] 3> [1]
+  UChar secSwamps[][2] = {
+    { 0x0053, 0x0073 },
+    { 0x0415, 0x0435 },
+    { 0x31b6, 0x310e }
+  };
+  // Secondary is swamped by primary
+  // have pairs where [0] 1> [1]
+  UChar secSwamped[][2] = {
+    { 0x0062, 0x0061 },
+    { 0x0436, 0x0454 },
+    { 0x310e, 0x310d }
+  };
+  // Tertiary is swamped by secondary
+  // have pairs where [0] 2> [1]
+  UChar terSwamped[][2] = {
+    { 0x00E0, 0x0061 },
+    { 0x0450, 0x0435 },
+    { 0x31a3, 0x310d }
+  };
+  int32_t i = 0;
+  // Tertiary swamps equal?
+  int result = 0;
+  // Choose the pair
+  i = 0;
+  /*
+  if((*prevLine)->name[0] > 0xFF && (*currLine)->name[0] > 0xFF) {
+    i = 0;
+  } else if((*prevLine)->name[0] < 0x0400 && (*currLine)->name[0] < 0x0400) {
+    i = 1;
+  } else {
+    i = 2;
+  }
+  */
+  // are they equal?
+  if((result = comparer(prevLine, currLine)) == 0) {
+    return UCOL_IDENTICAL;
+  } else if(result > 0) {
+    //fprintf(stderr, "lines should be ordered!");
+    return UCOL_OFF;
+  } else if(trySwamps(prevLine, currLine, primSwamps[i], comparer)) {
+    return UCOL_PRIMARY;
+  } else if(trySwamps(prevLine, currLine, secSwamps[i], comparer)) {
+    return UCOL_SECONDARY;
+  } else if(trySwamped(prevLine, currLine, terSwamped[i], comparer)) {
+    // is there a tertiary difference
+    return UCOL_TERTIARY;
+  } else {
+    //fprintf(stderr, "Unknown strength!\n");
+    return UCOL_ON;
+  }
+}
+
+// This function tries to probe the set of lines 
+// (already sorted by qsort) and deduct the strengths
+void 
+analyzeStrength(Line **lines, int32_t size, CompareFn comparer) {
+  int32_t i = 0;
+
+  for(i = 1; i < size; i++) {
+    Line **prevLine = lines+i-1;
+    Line **currLine = lines+i;
+    (*currLine)->strength = probeStrength(prevLine, currLine, comparer);
+    (*currLine)->sortedIndex = i;
+    (*currLine)->previous = *prevLine;
+    (*prevLine)->next = *currLine;
+
+  }
+
+}
+
+void printStrength(UColAttributeValue strength, UFILE *file) {
+  u_fprintf(file, " ");
+  switch(strength) {
+  case UCOL_IDENTICAL:
+    u_fprintf(file, "=");
+    break;
+  case UCOL_TERTIARY:
+    //u_fprintf(file, "<3");
+    u_fprintf(file, "<<<");
+    break;
+  case UCOL_SECONDARY:
+    //u_fprintf(file, "<2");
+    u_fprintf(file, "<<");
+    break;
+  case UCOL_PRIMARY:
+    //u_fprintf(file, "<1");
+    u_fprintf(file, "<");
+    break;
+  case UCOL_OFF:
+    u_fprintf(file, ">?");
+  default:
+    u_fprintf(file, "?!");
+    break;
+  }
+  u_fprintf(file, " ");
+}
+
+void printStrength(Line *line, UFILE *file) {
+  printStrength(line->strength, file);
+}
+
+void printLine(Line *line, UFILE *file) {
+  escapeALine(line, file);
+  if(line->isExpansion) {
+    u_fprintf(file, "/");
+    escapeExpansion(line, file);
+  }
+}
+
+void printOrdering(Line **lines, int32_t size, UFILE *file, UBool useLinks = FALSE) {
+  int32_t i = 0;
+
+  //printLine(*lines);
+  //escapeALine(*lines); // Print first line
+
+  Line *line = NULL;
+  Line *previous = *lines;
+  if(previous->isReset) {
+    u_fprintf(file, "\n& ");
+    escapeALine(previous, file);
+  } else if(!previous->isRemoved) {
+    printLine(previous, file);
+  }
+  i = 1;
+  while(i < size && previous->next) {
+    if(useLinks) {
+      line = previous->next;
+    } else {
+      line = *(lines+i);
+    }
+    if(line->isReset) {
+      u_fprintf(file, "\n& ");
+      escapeALine(line, file);
+    } else if(!line->isRemoved) {
+      if(file == out) {
+        u_fprintf(file, "\n");
+      }
+      if(i > 0) {
+        printStrength(line, file);
+      }
+      printLine(line, file);
+      //escapeALine(line, file);
+    }
+    previous = line;
+    i++;
+  }
+  u_fprintf(file, "\n");
+}
+
+
+void setIndexes(Line **lines, int32_t size) {
+  int32_t i = 0;
+  (*lines)->sortedIndex = 0;
+  for(i = 1; i < size; i++) {
+    Line *line = *(lines+i);
+    Line *prev = *(lines+i-1);
+    line->previous = prev;
+    prev->next = line;
+    line->sortedIndex = i;
+  }
+}
+
+
+// this seems to be a dead end
+void
+noteExpansion(Line **gLines, Line *line, int32_t size, CompareFn comparer) {
+  UErrorCode status = U_ZERO_ERROR;
+
+  UnicodeString key(line->name, line->len);
+  //Line *toInsert = (Line *)gElements.get(key);
+  Line *toInsert = (Line *)gExpansions.get(key);
+  if(toInsert != NULL) {
+    toInsert->isExpansion = TRUE;
+    u_strcpy(toInsert->expansionString, line->expansionString);
+    toInsert->expLen = line->expLen;
+    toInsert->previous->next = toInsert->next;
+    toInsert->next->previous = toInsert->previous;
+    gElements.remove(key);
+  } else {
+    toInsert = new Line(*line); 
+    toInsert->isExpansion = TRUE;
+    gElements.put(UnicodeString(toInsert->name, toInsert->len), toInsert, status);
+  }
+
+  int32_t i = 0;
+  Line testLine;
+  Line *l = &testLine;
+  for(i = 0; i < size; i++) {
+    u_strcpy(testLine.name, (*(gLines+i))->name);
+    u_strcat(testLine.name, line->expansionString);
+    testLine.len = (*(gLines+i))->len + line->expLen;
+    if(comparer(&l, &line) > 0) {
+      toInsert->previous = *(gLines+i-1);
+      toInsert->next = *(gLines+i);
+      toInsert->previous->next = toInsert;
+      toInsert->next->previous = toInsert;
+      break;
+    }
+  }
+  if(gVerbose) {
+    u_fprintf(log, "Adding expansion\n");
+    escapeALine(line, log);
+    u_fprintf(log, "/");
+    escapeExpansion(line, log);
+    u_fprintf(log, " ");
+  }
+}
+
+void
+positionExpansions(Line **gLines, int32_t size, CompareFn comparer) {
+  int result = 0;
+  Line *line = NULL;
+  Line *toMove = NULL;
+  int32_t i = 0, j = 0;
+  Line **sortedExpansions = new Line*[gExpansions.count()];
+  int32_t sortedExpansionsSize = setArray(sortedExpansions, &gExpansions);
+  qsort(sortedExpansions, sortedExpansionsSize, sizeof(Line *), comparer);
+  // Make a list of things in the vincinity of expansion candidate
+  for(j = 0; j < sortedExpansionsSize; j++) {
+    line = *(sortedExpansions+j);
+    UnicodeString key(line->name, line->len);
+    toMove = (Line *)gElements.get(key);
+    int32_t i = 0;
+    Line testLine, prevTestLine;
+    Line *l = &testLine;
+    Line *prevL = &prevTestLine;
+    // This can be further optimized, since we now know that we have a 
+    // sorted list of expansions, so current can start from toMove, since all
+    // the elements before it are already smaller. In the beggining it needs to 
+    // be on gLines, though.
+    Line *current = *gLines;
+    while(current) {
+      if(current == toMove) {
+        // we are wading through a sorted list
+        // if we found ourselves, it means that we 
+        // are already in a right place, so no moving
+        // is needed, but we need to make sure we have
+        // the right strength.
+        toMove->strength = probeStrength(&prevL, &toMove, comparer);
+        if(0) {
+          u_fprintf(log, "Positioned expansion without moving ");
+          printLine(toMove, log);
+          u_fprintf(log, " new ordering: \n");
+          printOrdering(gLines, size, log, TRUE);
+        }
+        break;
+      } else {
+        u_strcpy(testLine.name, current->name);
+        if(!current->isExpansion) {
+          u_strcat(testLine.name, line->expansionString);
+          testLine.len = current->len + line->expLen;
+        } else {
+          testLine.len = current->len;
+        }
+        if(comparer(&l, &line) > 0) {
+          // remove from chain
+          if(toMove->next) {
+            toMove->next->strength = probeStrength(&(toMove->previous), &(toMove->next), comparer);
+            toMove->next->previous = toMove->previous;
+          }
+          if(toMove->previous) {
+            toMove->previous->next = toMove->next;
+          }
+
+          // insert
+          toMove->previous = current->previous;
+          toMove->next = current;
+
+          if(current->previous) {
+            current->previous->next = toMove;
+          }
+          current->previous = toMove;
+
+          toMove->strength = probeStrength(&prevL, &toMove, comparer);
+          toMove->next->strength = probeStrength(&toMove, &l, comparer);
+          if(0) {
+            u_fprintf(log, "Positioned expansion ");
+            printLine(toMove, log);
+            u_fprintf(log, " new ordering: \n");
+            printOrdering(gLines, size, log, TRUE);
+          }
+          if(toMove->strength == UCOL_IDENTICAL) {
+            // check for craziness such as s = ss/s
+            // such line would consist of previous (or next) concatenated with the expansion value
+            // make a test
+            UChar fullString[256];
+            u_strcpy(fullString, toMove->previous->name);
+            u_strcat(fullString, toMove->expansionString);
+            if(u_strcmp(fullString, toMove->name) == 0) {
+              toMove->previous->next = toMove->next;
+              toMove->next->previous = toMove->previous;
+              toMove->isRemoved = TRUE;
+              u_fprintf(log, "Removed: ");
+              printLine(toMove, log);
+              u_fprintf(log, "\n");
+            } 
+          } else if(toMove->next->strength == UCOL_IDENTICAL) {
+            UChar fullString[256];
+            u_strcpy(fullString, toMove->next->name);
+            u_strcat(fullString, toMove->expansionString);
+            if(u_strcmp(fullString, toMove->name) == 0) {
+              toMove->next->strength = toMove->strength;
+              toMove->previous->next = toMove->next;
+              toMove->next->previous = toMove->previous;
+              toMove->isRemoved = TRUE;
+              u_fprintf(log, "Removed because of back: ");
+              printLine(toMove, log);
+              u_fprintf(log, "\n");
+            } 
+          }
+          break;
+        }
+        prevTestLine = testLine;
+      }
+      current = current->next;
+    }
+  }
+  delete[] sortedExpansions;
+}
+
+
+void
+noteExpansion(Line *line) {
+  UErrorCode status = U_ZERO_ERROR;
+  UnicodeString key(line->name, line->len);
+  Line *el = (Line *)gElements.get(key);
+  if(el != NULL) {
+    el->isExpansion = TRUE;
+    u_strcpy(el->expansionString, line->expansionString);
+    el->expLen = line->expLen;
+  } else {
+    Line *toInsert = new Line(*line); 
+    toInsert->isExpansion = TRUE;
+    gElements.put(UnicodeString(line->name, line->len), toInsert, status);
+  }
+
+  Line *el2 = (Line *)gExpansions.get(key);
+  el2->isExpansion = TRUE;
+  u_strcpy(el2->expansionString, line->expansionString);
+  el2->expLen = line->expLen;
+
+  if(gDebug) {
+    u_fprintf(log, "Adding expansion\n");
+    printLine(line, log);
+    u_fprintf(log, "\n");
+  }
+}
+
+void 
+noteContraction(Line *line) {
+  UErrorCode status = U_ZERO_ERROR;
+  Line *toInsert = new Line(*line); 
+  toInsert->isContraction = TRUE;
+  gElements.put(UnicodeString(line->name, line->len), toInsert, status);
+  if(gVerbose) {
+    u_fprintf(log, "Adding contraction\n");
+    escapeALine(line, log);
+    u_fprintf(log, " ");
+  }
+}
+
+void
+noteElement(Line *line) {
+  UErrorCode status = U_ZERO_ERROR;
+  Line *toInsert = new Line(*line);
+  gElements.put(UnicodeString(line->name, line->len), toInsert, status);
+  if(0) { //if(gDebug) 
+    escapeALine(line, log);
+    u_fprintf(log, " ");
+  }
+}
+
+
+
+// This function checks if a combination of characters has changed place with the 
+// adjacent elements. If so, these are most probably contractions.
+// However, it still needs to be checked if these contractions are fake - the 
+// test is simple - if xy is suspected contraction, if we get that x/y is expansion, then
+// xy is a fake contraction.
+int32_t 
+analyzeContractions(Line** lines, int32_t size, CompareFn comparer) {
+  int32_t i = 0, j = 0;
+  int32_t outOfOrder = 0;
+  UColAttributeValue strength = UCOL_OFF;
+  UColAttributeValue currStrength = UCOL_OFF;
+  Line **prevLine = lines;
+  Line **currLine = NULL;
+  Line **backupLine = NULL;
+  UBool prevIsContraction = FALSE, currIsContraction = FALSE;
+  // Problem here is detecting a contraction that is at the very end of the sorted list
+  for(i = 1; i < size; i++) {
+    currLine = lines+i;
+    strength = probeStrength(prevLine, currLine, comparer);
+    if(strength == UCOL_OFF || strength != (*currLine)->strength) {
+      prevIsContraction = FALSE;
+      currIsContraction = FALSE;
+      if(!outOfOrder) {
+        if(gVerbose) {
+          u_fprintf(log, "Possible contractions: ");
+        }
+      }
+      // now we have two elements that are different. The question is, 
+      // which one of them is the contraction - which one has moved. 
+      // Could be the previous, but could also be the current.
+
+      outOfOrder++;
+
+      // First, lets check whether the previous has jumped back
+      j = i+1;
+      // skip all the nexts that have smaller strength, they don't have an effect
+      while(j < size && (*(lines+j))->strength > (*currLine)->strength) {
+        j++;
+      }
+      // check if there are other elements of same or greater strength
+      while(j < size && 
+        (strength = probeStrength(prevLine, (backupLine = lines+j), comparer)) == UCOL_OFF) {
+        j++;
+        // if we skipped more than one, it might be in fact a contraction
+        prevIsContraction = TRUE;
+      }
+      if(prevIsContraction) {
+        noteContraction(*prevLine);
+        j = i-2;
+        // add all the previous elements with smaller strength, since they also
+        // will jump over and are contractions
+        while(j >= 0 && (*(lines+j+1))->strength > (*currLine)->strength) {
+          strength = probeStrength(lines+j, currLine, comparer);
+          if(strength == UCOL_OFF) {
+            noteContraction(*(lines+j));
+          }
+          j--;
+        }
+      }
+
+      // now we check if the current element is jumping forward,
+      // the dance steps are analogous to above.
+      j = i - 2;
+      while(j >= 0 && (*(lines+j+1))->strength > (*currLine)->strength) {
+        j--;
+      }
+      while(j >= 0 && 
+        (strength = probeStrength((backupLine = lines+j), currLine, comparer)) == UCOL_OFF) {
+        j--;
+        currIsContraction = TRUE;
+      }
+      if(currIsContraction) {
+        if(gVerbose) {
+          escapeALine(*currLine, log);
+          u_fprintf(log, " ");
+        }
+        j = i+1;
+        while(j < size && (*(lines+j))->strength > (*currLine)->strength) {
+          strength = probeStrength(prevLine, lines+j, comparer);
+          if(strength == UCOL_OFF) {
+            noteContraction(*(lines+j));
+          }
+          j++;
+        }
+      }
+
+      // Not sure about either. List both and then check
+      if(!(prevIsContraction || currIsContraction)) {
+        noteContraction(*prevLine);
+        noteContraction(*currLine);
+      }
+    }
+    prevLine = currLine;
+  }
+  if(outOfOrder) {
+    if(gVerbose) {
+      u_fprintf(log, "\n");
+    }
+  }
+  return outOfOrder;
+}
+
+int32_t
+detectContractions(Line **gLines, Line *lines, int32_t size, CompareFn comparer) {
+  int32_t i = 0, j = 0;
+  int32_t noContractions = 0;
+  // Create and compare doubles:
+  Line *backupLines = new Line[size]; 
+  Line::copyArray(backupLines, lines, size); 
+  // detect contractions
+
+  Line **gLinesBackup = NULL; //new Line*[size]; 
+
+  for(i = 0; i < size; i++) {
+    // preserve index and previous
+    Line::copyArray(lines, backupLines, size); 
+    for(j = 0; j < size; j++) {
+      u_strcpy(lines[j].name, backupLines[i].name);
+      u_strcat(lines[j].name, backupLines[j].name);
+      lines[j].len = backupLines[i].len+backupLines[j].len;     
+    }
+
+    if((noContractions += analyzeContractions(gLines, size, comparer)) && gDebug) {
+      if(gLinesBackup == NULL) {
+        gLinesBackup = new Line*[size];
+      }
+      // Show the sorted doubles, for debugging
+      setArray(gLinesBackup, lines, size);
+      qsort(gLinesBackup, size, sizeof(Line *), comparer);
+      //setIndexes(gLinesBackup, size);
+      analyzeStrength(gLinesBackup, size, comparer);
+      printOrdering(gLinesBackup, size, log);
+    }
+    if(!gQuiet) {
+      u_fprintf(log, ".");
+    }
+  }
+  if(!gQuiet) {
+    u_fprintf(log, "\n");
+  }
+  delete[] backupLines; 
+  if(gLinesBackup) {
+    delete[] gLinesBackup; 
+  }
+  return noContractions;
+}
+
+// gLines in this function is an array of sorted pointers.
+// Contractions are already included. 
+int32_t
+detectExpansions(Line **gLines, int32_t size, CompareFn comparer) {
+  UErrorCode status = U_ZERO_ERROR;
+  // detect expansions
+
+  UColAttributeValue startStrength = UCOL_OFF, endStrength = UCOL_OFF, 
+    strength = UCOL_OFF, previousStrength = UCOL_OFF;
+  Line start, end, src;
+  Line *startP = &start, *endP = &end, *srcP = &src;
+  Line *current = NULL;
+  memset(startP, 0, sizeof(Line));
+  memset(endP, 0, sizeof(Line));
+  memset(srcP, 0, sizeof(Line));
+  int32_t srcLen;
+  int32_t i = 0, j = 0, k = 0;
+  for(i = 0; i < size; i++) {
+    u_strcpy(start.name, (*(gLines+i))->name);
+    u_strcpy(end.name, (*(gLines+i))->name);
+    srcLen = (*(gLines+i))->len;
+    u_strcpy(start.name+srcLen, (*(gLines))->name);
+    start.len = srcLen + (*(gLines))->len;
+    u_strcpy(end.name+srcLen, (*(gLines+size-1))->name);
+    end.len = srcLen + (*(gLines+size-1))->len;
+
+    for(k = 0; k < size; k++) { // k is index of a thing that is not doubled
+      current = *(gLines+k);
+      // see if we have moved to front
+      // has it moved to the very beggining
+      if((startStrength = probeStrength((gLines+k), &startP, comparer)) != UCOL_OFF) {
+        continue; // this one is in the front
+      }
+      // has it moved to the very end?
+      if((endStrength = probeStrength(&endP, (gLines+k), comparer)) != UCOL_OFF) {
+        continue; // this one is in the back
+      }
+      // Potential Expansion     
+      if(gDebug) { //gVerbose
+        u_fprintf(log, "Possible expansion: ");
+        escapeALine(*(gLines+k), log);
+        u_fprintf(log, " ");
+      }
+      // Now we have to make sure that this is really an expansion
+      // First, we have to find it
+      u_strcpy(src.name, (*(gLines+i))->name);
+      for(j = 0; j < size; j++) {
+        u_strcpy(src.name+srcLen, (*(gLines+j))->name);
+        src.len = srcLen + (*(gLines+j))->len;
+        if((strength = probeStrength(&srcP, (gLines+k), comparer)) == UCOL_OFF) {
+          strength = probeStrength((gLines+k), &srcP, comparer);
+          // we found it *(gLines+j-1) is the element that is interesting
+          // since gLines+j-1 < gLines+k < gLines+j
+          if(gDebug) { //gVerbose
+            u_fprintf(log, "i = %i, k = %i, j = %i ", i, k, j);
+            escapeALine(*(gLines+i), log);
+            escapeALine(*(gLines+j-1), log);
+            printStrength(previousStrength, log);
+            escapeALine(current, log);
+            printStrength(strength, log);
+            escapeALine(*(gLines+i), log);
+            escapeALine(*(gLines+j), log);
+            u_fprintf(log, "\n");
+          }
+          // check whether it is a contraction that is the same as an expansion
+          // or a multi character that doesn't do anything
+          current->addExpansionHit(i, j);
+          current->isExpansion = TRUE;
+          current->expIndex = k;
+          // cache expansion
+          gExpansions.put(UnicodeString(current->name, current->len), current, status); //new Line(*current)
+          break;
+        }
+        previousStrength = strength;
+      }
+    }
+    if(!gQuiet) {
+      u_fprintf(log, ".");
+    }
+  }  
+  if(!gQuiet) {
+    u_fprintf(log, "\n");
+  }
+  // now we have identified possible expansions. We need to find out how do they expand. 
+  // Let's iterate over expansions cache - it's easier.
+  const UHashElement *el = NULL;
+  int32_t hashIndex = -1;
+  Line *doubles = new Line[size*10]; 
+  Line **sorter = new Line*[size*10];
+  int32_t currSize = 0;
+  int32_t newSize = 0;
+  Line *prev = NULL;
+  Line *next = NULL;
+  Line *origin = NULL;
+  int result = 0;
+  // Make a list of things in the vincinity of expansion candidate
+  // in expansionPrefixes and expansionAfter we have stored the
+  // prefixes of stuff that caused the detection of an expansion
+  // and a position where the expansion was. 
+  // For example (icu, de__PHONEBOOK), we had:
+  // aE <<< \u00E4 < af
+  // AD < \u00E4 <<< Ae
+  // From that we will construct the following sequence:
+  // AD < aE <<< \u00E4/ <<< Ae < af
+  // then we will take the vincinity of \u00E4:
+  // aE <<< \u00E4/ <<< Ae
+  // then we will choose the smallest expansion to be the expansion
+  // part: 'e'.
+  // if there is equality, we choose the equal part:
+  // (win32, de__PHONEBOOK):
+  // AD < \u00E4/ = ae <<< aE <<< Ae
+  // we choose 'e'.
+
+  while((el = gExpansions.nextElement(hashIndex)) != NULL) {
+    newSize = 0;
+    current = (Line *)el->value.pointer;
+    currSize = size*current->expansionPrefixesSize;
+    if(gDebug) {
+      escapeALine(current, log);
+      u_fprintf(log, " Number: %i\n", current->expansionPrefixesSize);
+    }
+    // construct the doubles 
+    for(i = 0; i < current->expansionPrefixesSize; i++) {
+      doubles[newSize].suffix = current->expansionAfter[i]-1;
+      doubles[newSize++].setToConcat(*(gLines+current->expansionPrefixes[i]), *(gLines+current->expansionAfter[i]-1));
+      doubles[newSize].suffix = current->expansionAfter[i];
+      doubles[newSize++].setToConcat(*(gLines+current->expansionPrefixes[i]), *(gLines+current->expansionAfter[i]));
+    }
+    // add the expansion we're observing
+    doubles[newSize++] = *current;
+    setArray(sorter, doubles, newSize);
+    qsort(sorter, newSize, sizeof(Line*), comparer);
+    analyzeStrength(sorter, newSize, comparer);
+    if(gDebug) {
+      printOrdering(sorter, newSize, log);
+    }
+    i = 0;
+    while(**(sorter+i) != *current) {
+      i++;
+    }
+    // find the two additions
+    if((*(sorter+i))->strength == UCOL_IDENTICAL) {
+      // if we ae id
+      origin = *(gLines+((*(sorter+i-1))->suffix));
+      u_strcpy(current->expansionString, origin->name);
+      current->expLen = origin->len;
+    } else if(i < newSize-1 && (*(sorter+i+1))->strength == UCOL_IDENTICAL) {
+      origin = *(gLines+((*(sorter+i+1))->suffix));
+      u_strcpy(current->expansionString, origin->name);
+      current->expLen = origin->len;
+    } else {
+      if(i > 0) {
+        prev = *(gLines+(*(sorter+i-1))->suffix);
+        if(i < newSize-1) {
+          next = *(gLines+(*(sorter+i+1))->suffix);
+          result = comparer(&prev, &next);
+          if(result <= 0) {
+            u_strcpy(current->expansionString, prev->name);
+            current->expLen = prev->len;
+          } else {
+            u_strcpy(current->expansionString, next->name);
+            current->expLen = next->len;
+          }
+        }      
+      }
+      if(0) { //if(gDebug)
+        u_fprintf(log, "Expansion is: ");
+        escapeALine(current, log);
+        u_fprintf(log, "/");
+        escapeExpansion(current, log);
+        u_fprintf(log, "\n");
+      }
+    }
+    noteExpansion(current);
+    //noteExpansion(gLines, current, size, comparer);
+    if(!gQuiet) {
+      u_fprintf(log, ".");
+    }
+  }
+  if(!gQuiet) {
+    u_fprintf(log, "\n");
+  }
+  delete[] doubles;
+  delete[] sorter;
+  return gExpansions.count();
+}
+
+UBool
+isTailored(Line *line, UErrorCode &status) {
+  UBool result = FALSE;
+  UCollationElements *tailoring = ucol_openElements(gCol, line->name, line->len, &status);
+  UCollationElements *uca = ucol_openElements(gUCA, line->name, line->len, &status);
+
+  int32_t tailElement = UCOL_NULLORDER;
+  int32_t ucaElement = UCOL_NULLORDER;
+
+  do {
+    do {
+      tailElement = ucol_next(tailoring, &status);
+    } while(tailElement == 0);
+    do {
+      ucaElement = ucol_next(uca, &status);
+    } while(ucaElement == 0);
+    if(tailElement != ucaElement) {
+      result = TRUE;
+      break;
+    }
+  } while (tailElement != UCOL_NULLORDER && ucaElement != UCOL_NULLORDER);
+
+  ucol_closeElements(tailoring);
+  ucol_closeElements(uca);
+  return result;
+}
+
+void
+reduceUntailored(Line **gLines, int32_t size){
+  UErrorCode status = U_ZERO_ERROR;
+  Line *current = *(gLines);
+  Line *previous = NULL;
+  while(current) {
+    // if the current line is not tailored according to the UCA
+    if(!isTailored(current, status)) {
+      // we remove it
+      current->isRemoved = TRUE;
+    } else {
+      // if it's tailored 
+      if(current->previous && current->previous->isRemoved == TRUE) {
+        previous = current->previous;
+        while(previous && (previous->strength > current->strength || previous->isExpansion || previous->isContraction) && previous->isRemoved) {
+          if(previous->previous && previous->previous->isRemoved) {
+            previous = previous->previous;
+          } else {
+            break;
+          }
+        }
+        if(previous) {
+          previous->isReset = TRUE;
+        } else {
+          (*(gLines))->isReset = TRUE;
+        }
+      }
+    }
+    current = current->next;
+  }
+}
+
+void
+constructAndAnalyze(Line **gLines, Line *lines, int32_t size, CompareFn comparer) {
+  int32_t i = 0, j = 0, k = 0;
+  // setup our compare arrays to point to single set.
+
+  // For contractions we need a block of data
+  setArray(gLines, lines, size);
+  //size = setArray(gLines);
+
+  qsort(gLines, size, sizeof(Line *), comparer);
+
+  // Establish who is previous according to the sort order
+  //setIndexes(gLines, size);
+
+  analyzeStrength(gLines, size, comparer);
+  if(gVerbose) {
+    u_fprintf(log, "Ordering:\n");
+    printOrdering(gLines, size, log);
+  }
+
+  //showDifferences(exemplarSetSize);
+  //dumpData(exemplarSetSize);
+
+  if(!gQuiet) {
+    u_fprintf(log, "Detecting contractions?\n");
+  }
+  int32_t noContractions = 0;
+  noContractions = detectContractions(gLines, lines, size, comparer);
+  if(!gQuiet) {
+    u_fprintf(log, "Detected %i contractions\n", noContractions);
+  }
+
+  // now we have suspected contractions in the table
+  // we have to re-sort the things 
+  size = setArray(gLines);
+  qsort(gLines, size, sizeof(Line *), comparer);
+  analyzeStrength(gLines, size, comparer);
+
+  if(!gQuiet) {
+    u_fprintf(log, "Detecting expansions\n");
+  }
+  int32_t noExpansions = detectExpansions(gLines, size, comparer);
+  if(!gQuiet) {
+    u_fprintf(log, "Detected %i expansions\n", noExpansions);
+  }
+
+  positionExpansions(gLines, size, comparer);
+
+  if(gVerbose) {
+    u_fprintf(log, "After positioning expansions:\n");
+    printOrdering(gLines, size, log, TRUE);
+  }
+  //reduceUntailored(gLines, size);
+  if(!gQuiet) {
+    u_fprintf(out, "Final result\n");
+  }
+  printOrdering(gLines, size, out, TRUE);
+  printOrdering(gLines, size, log, TRUE);
+}
+
+// Check whether upper case comes before lower case or vice-versa
+int32_t 
+checkCaseOrdering(void) {
+  UChar stuff[][3] = {
+    { 0x0061, separatorChar, 0x0061}, //"aa",
+    { 0x0061, separatorChar, 0x0041 }, //"a\\u00E0",
+    { 0x0041, separatorChar, 0x0061 }, //"\\u00E0a",
+    { 0x0041, separatorChar, 0x0041 }, //"\\u00E0a",
+    //{ 0x00E0, separatorChar, 0x00E0 }  //"\\u00E0\\u00E0"
+  };
+  const int32_t size = sizeof(stuff)/sizeof(stuff[0]);
+
+  Line **sortedLines = new Line*[size];
+  Line lines[size];
+
+  int32_t i = 0;
+  int32_t ordered = 0, reversed = 0;
+
+  for(i = 0; i < size; i++) {
+    lines[i].setName(stuff[i], 3);
+  }
+  setArray(sortedLines, lines, size);
+  qsort(sortedLines, size, sizeof(Line*), gComparer);
+
+  for(i = 0; i < size; i++) {
+    if(*(sortedLines+i) == &lines[i]) {
+      ordered++;
+    }
+    if(*(sortedLines+i) == &lines[size-i-1]) {
+      reversed++;
+    }
+  }
+
+  delete[] sortedLines;
+  if(ordered == size) {
+    return 0; // in normal order
+  } else if(reversed == size) {
+    return 1; // in reversed order
+  } else {
+    return -1; // unknown order
+  }
+}
+
+
+// Check whether the secondaries are in the straight or reversed order
+int32_t 
+checkSecondaryOrdering(void) {
+  UChar stuff[][5] = {
+    { 0x0061, separatorChar, 0x0061, separatorChar, 0x00E0 }, //"aa",
+    { 0x0061, separatorChar, 0x00E0, separatorChar, 0x0061 }, //"a\\u00E0",
+    { 0x00E0, separatorChar, 0x0061, separatorChar, 0x0061 }, //"\\u00E0a",
+    //{ 0x00E0, separatorChar, 0x00E0 }  //"\\u00E0\\u00E0"
+  };
+  const int32_t size = sizeof(stuff)/sizeof(stuff[0]);
+
+  Line **sortedLines = new Line*[size];
+  Line lines[size];
+
+  int32_t i = 0;
+  int32_t ordered = 0, reversed = 0;
+
+  for(i = 0; i < size; i++) {
+    lines[i].setName(stuff[i], 5);
+  }
+  setArray(sortedLines, lines, size);
+  qsort(sortedLines, size, sizeof(Line*), gComparer);
+
+  for(i = 0; i < size; i++) {
+    if(*(sortedLines+i) == &lines[i]) {
+      ordered++;
+    }
+    if(*(sortedLines+i) == &lines[size-i-1]) {
+      reversed++;
+    }
+  }
+
+  delete[] sortedLines;
+  if(ordered == size) {
+    return 0; // in normal order
+  } else if(reversed == size) {
+    return 1; // in reversed order
+  } else {
+    return -1; // unknown order
+  }
+}
+
+// We have to remove ignorable characters from the exemplar set,
+// otherwise, we get messed up results
+void removeIgnorableChars(UnicodeSet &exemplarUSet, CompareFn comparer, UErrorCode &status) {
+  UnicodeSet ignorables, primaryIgnorables;
+  UnicodeSetIterator exemplarUSetIter(exemplarUSet);
+  exemplarUSetIter.reset();
+  Line empty;
+  Line *emptyP = &empty;
+  Line current;
+  Line *currLine = &current;
+  UColAttributeValue strength = UCOL_OFF;
+
+
+  while(exemplarUSetIter.next()) {
+    if(exemplarUSetIter.isString()) { // process a string
+      u_memcpy(currLine->name, exemplarUSetIter.getString().getBuffer(), exemplarUSetIter.getString().length());
+      currLine->len = exemplarUSetIter.getString().length();
+      strength = probeStrength(&emptyP, &currLine, comparer);
+      if(strength == UCOL_IDENTICAL) {
+        ignorables.add(exemplarUSetIter.getString());
+      } else if(strength > UCOL_PRIMARY) {
+        primaryIgnorables.add(exemplarUSetIter.getString());
+      }
+    } else { // process code point
+      UBool isError = FALSE;
+      UChar32 codePoint = exemplarUSetIter.getCodepoint();
+      currLine->len = 0;
+      U16_APPEND(currLine->name, currLine->len, 25, codePoint, isError);
+      strength = probeStrength(&emptyP, &currLine, comparer);
+      if(strength == UCOL_IDENTICAL) {
+        ignorables.add(codePoint);
+      } else if(strength > UCOL_PRIMARY) {
+        primaryIgnorables.add(codePoint);
+      }
+    }
+  }
+
+
+
+  exemplarUSet.removeAll(ignorables);
+  exemplarUSet.removeAll(primaryIgnorables);
+
+  UnicodeString removedPattern;
+  if(ignorables.size()) {
+    u_fprintf(log, "Ignorables:\n");
+    ignorables.toPattern(removedPattern, TRUE);
+    removedPattern.setCharAt(removedPattern.length(), 0);
+    escapeString(removedPattern.getBuffer(), removedPattern.length(), log);
+    u_fprintf(log, "\n");
+  }
+  if(primaryIgnorables.size()) {
+    u_fprintf(log, "Primary ignorables:\n");
+    primaryIgnorables.toPattern(removedPattern, TRUE);
+    removedPattern.setCharAt(removedPattern.length(), 0);
+    escapeString(removedPattern.getBuffer(), removedPattern.length(), log);
+    u_fprintf(log, "\n");
+  }
+
+}
+
+// TODO: develop logic for choosing boundary characters - right now it is hardcoded
+// It should be a function of used scripts. Also, check whether we need to save 
+// used script names
+void addUtilityChars(UnicodeSet &exemplarUSet, UErrorCode &status) {
+
+  // in order to get nice rules, we need to add some characters to the
+  // starting set. These are mostly parts of compatibity composed characters,
+  // such as L-middle dot (middle dot is 0x00B7). If we don't add these, we would
+  // get a reset at a funky character, such as L-middle dot. This list will probably
+  // grow.
+  exemplarUSet.add(0x00B7);
+
+  // these things represent a script before the target script and 
+  // a script after. More logic should be added so that these characters are
+  // chosen automatically
+
+  exemplarUSet.add(0x0038);
+  exemplarUSet.add(0x0039);
+
+  //exemplarUSet.add(0x0433);
+  //exemplarUSet.add(0x0436);
+  exemplarUSet.add(0xfa29);
+  exemplarUSet.add(0xfa28);
+}
+
+void
+getExemplars(const char *locale, UnicodeSet &exemplars, UErrorCode &status) {
+  // first we fill out structures with exemplar characters.
+  UResourceBundle *res = ures_open(NULL, locale, &status);
+  int32_t exemplarLength = 0;
+  UnicodeString exemplarString = ures_getUnicodeStringByKey(res, "ExemplarCharacters", &status);
+  exemplars.clear();
+  exemplars.applyPattern(exemplarString, status);
+  ures_close(res);
+}
+
+void
+prepareStartingSet(UnicodeSet &exemplarUSet, CompareFn comparer, UErrorCode &status) {
+  int32_t i = 0;
+  UnicodeString exemplarString;
+  exemplarUSet.toPattern(exemplarString);
+  // Produce case closure of exemplar characters
+  // Then we want to figure out what is the script of the exemplar characters
+  // just pick several and see their script
+  const char* usedScriptNames[USCRIPT_CODE_LIMIT];
+  int32_t numberOfUsedScripts = 0;
+  char scriptSetPattern[256];
+  UnicodeString pattern; // for debugging
+  UChar32 exChar = -1;
+  while(exemplarUSet.size() != 0 && (exChar = exemplarUSet.charAt(0)) != -1) { 
+    int32_t scriptNo = u_getIntPropertyValue(exChar, UCHAR_SCRIPT);
+    usedScriptNames[numberOfUsedScripts] = u_getPropertyValueName(UCHAR_SCRIPT, scriptNo, U_SHORT_PROPERTY_NAME);
+    sprintf(scriptSetPattern, "[:%s:]", usedScriptNames[numberOfUsedScripts]);
+    numberOfUsedScripts++;
+    UnicodeSet scriptSet(UnicodeString(scriptSetPattern, ""), status);
+    exemplarUSet.removeAll(scriptSet);
+    exemplarUSet.toPattern(pattern, TRUE);
+  }
+  exemplarUSet.clear();
+
+  // always add ASCII
+  //exemplarUSet.addAll(UnicodeSet(UnicodeString("[\\u0020-\\u007f]", ""), status));
+  exemplarUSet.addAll(UnicodeSet(UnicodeString("[\\u0041-\\u005b]", ""), status));
+  if(gExemplar) {
+    exemplarUSet.applyPattern(exemplarString, status);
+    exemplarUSet.closeOver(USET_CASE);
+    if(!gQuiet) {
+      u_fprintf(out, "ICU exemplar characters:\n");
+      escapeString(exemplarString.getBuffer(), exemplarString.length(), out);
+      u_fprintf(out, "\n");
+    }
+  } else {
+    if(!gQuiet) {
+      u_fprintf(out, "Using scripts:\n");
+    }
+    // add interesting scripts
+    for(i = 0; i < numberOfUsedScripts; i++) {
+      sprintf(scriptSetPattern, "[:%s:]", usedScriptNames[i]);
+      exemplarUSet.addAll(UnicodeSet(UnicodeString(scriptSetPattern, ""), status));
+      if(!gQuiet) {
+        u_fprintf(out, "%s\n", scriptSetPattern);
+      }
+    }
+  }
+
+
+  removeIgnorableChars(exemplarUSet, comparer, status);
+
+  addUtilityChars(exemplarUSet, status);
+
+/*
+  // try to check whether tailored set and exemplar characters match.
+  USet *tailored = ucol_getTailoredSet(gCol, &status);
+  UBool tailoredContained = exemplarUSet.containsAll(*((UnicodeSet *)tailored));
+  if(!tailoredContained) {
+    ((UnicodeSet *)tailored)->removeAll(exemplarUSet);
+    UnicodeString pattern;
+    ((UnicodeSet *)tailored)->toPattern(pattern, TRUE);
+  }
+  uset_close(tailored);
+*/
+
+  //return exemplarUSet;
+}
+
+void 
+setOutputFile(const char *name, UErrorCode &status) {
+  int32_t i = 0;
+  char filename[256];
+  strcpy(filename, name);
+  for(i = 0; i < gPlatformNo; i++) {
+    strcat(filename, "_");
+    strcat(filename, platforms[gPlatformIndexes[i]].name);
+  }
+  if(gExemplar) {
+    strcat(filename, "_exemplar");
+  } else {
+    strcat(filename, "_script");
+  }
+  strcat(filename, ".utf16.txt");
+  out = u_fopen(filename, "wb", "en", "utf-16");
+}
+
+void
+processCollator(UCollator *col, UErrorCode &status) {
+  int32_t i = 0;
+  gCol = col;
+  UChar ruleString[16384];
+  int32_t ruleStringLength = ucol_getRulesEx(gCol, UCOL_TAILORING_ONLY, ruleString, 16384);
+  if(!gQuiet) {
+    u_fprintf(out, "ICU rules:\n");
+    printRules(ruleString, ruleStringLength, out);
+    printRules(ruleString, ruleStringLength, log);
+    //escapeString(ruleString, ruleStringLength, out);
+    u_fprintf(out, "\n");
+  }
+  const char *locale = ucol_getLocale(gCol, ULOC_REQUESTED_LOCALE, &status);
+  UnicodeSet exemplarUSet;
+  if(locale) {
+    getExemplars(locale, exemplarUSet, status);
+  } else {
+    exemplarUSet = *((UnicodeSet *)ucol_getTailoredSet(gCol, &status));
+  }
+
+
+  for(i = 0; i < gPlatformNo; i++) {
+    u_fprintf(out, "\nGenerating order for platform: %s\n", platforms[gPlatformIndexes[i]].name);
+    gComparer = platforms[gPlatformIndexes[i]].comparer;
+
+    prepareStartingSet(exemplarUSet, gComparer, status);
+    int32_t itemLen = 0;
+    // get the number of all the items from the set (both codepoints and strings)
+    int32_t exemplarSetSize = exemplarUSet.size();
+    UnicodeSetIterator exemplarUSetIter(exemplarUSet);
+
+    // allocate ICU lines
+    gICULines = new Line*[exemplarSetSize*5]; 
+    int32_t j = 0;
+    int32_t linesCount = 0;
+    Line *lines = new Line[exemplarSetSize]; 
+
+    int32_t reversedSecondary = checkSecondaryOrdering();
+    if(reversedSecondary == 0) {
+      u_fprintf(out, "Secondaries do not seem to be reversed\n");
+    } else if(reversedSecondary == 1) {
+      u_fprintf(out, "Secondaries are reversed\n");
+      if(gComparer == ICUstrcmp) {
+        ucol_setAttribute(gCol, UCOL_FRENCH_COLLATION, UCOL_OFF, &status);
+      }
+    } else {
+      u_fprintf(out, "Cannot conclude if secondaries are reversed\n");
+    }
+
+    int32_t reversedCase = checkCaseOrdering();
+    if(reversedCase == 0) {
+      u_fprintf(out, "Case does not seem to be reversed\n");
+    } else if(reversedCase == 1) {
+      u_fprintf(out, "Case is reversed\n");
+      if(gComparer == ICUstrcmp) {
+        ucol_setAttribute(gCol, UCOL_CASE_FIRST, UCOL_OFF, &status);
+      }
+    } else {
+      u_fprintf(out, "Cannot conclude if case is reversed\n");
+    }
+      
+    exemplarUSetIter.reset();
+    gElements.removeAll();
+    gExpansions.removeAll();
+    linesCount = 0;
+
+    while(exemplarUSetIter.next()) {
+      Line *currLine = lines+linesCount;
+      if(exemplarUSetIter.isString()) { // process a string
+        u_memcpy(currLine->name, exemplarUSetIter.getString().getBuffer(), exemplarUSetIter.getString().length());
+        currLine->len = exemplarUSetIter.getString().length();
+      } else { // process code point
+        UBool isError = FALSE;
+        currLine->len = 0;
+        U16_APPEND(currLine->name, currLine->len, 25, exemplarUSetIter.getCodepoint(), isError);
+      }
+      currLine->name[currLine->len] = 0; // zero terminate, for our evil ways
+      currLine->index = linesCount;
+      linesCount++;
+      noteElement(currLine);
+    }
+    constructAndAnalyze(gICULines, lines, exemplarSetSize, gComparer);
+
+    delete[] lines; 
+  }
+
+
+  // cleanup globals
+  delete[] gICULines; 
+  u_fflush(out);
+  u_fclose(out);
+  ucol_close(gCol);
+}
+
+void
+processLocale(const char *locale, UErrorCode &status) {
+  gWinLCID = uloc_getLCID(locale);
+
+  UCollator *col = ucol_open(locale, &status);
+
+  setOutputFile(locale, status);
+
+  u_fprintf(out, "Locale %s (LCID:%06X)\n", locale, gWinLCID);
+
+  processCollator(col, status);
+}
+
+UBool 
+hasCollationElements(const char *locName) {
+
+  UErrorCode status = U_ZERO_ERROR;
+  UResourceBundle *ColEl = NULL;
+
+  UResourceBundle *loc = ures_open(NULL, locName, &status);;
+
+  if(U_SUCCESS(status)) {
+    status = U_ZERO_ERROR;
+    ColEl = ures_getByKey(loc, "CollationElements", ColEl, &status);
+    if(status == U_ZERO_ERROR) { /* do the test - there are real elements */
+      ures_close(ColEl);
+      ures_close(loc);
+      return TRUE;
+    }
+    ures_close(ColEl);
+    ures_close(loc);
+  }
+  return FALSE;
+}
+
+int
+main(int argc,
+     char* argv[])
+{
+  UErrorCode status = U_ZERO_ERROR;
+  err = u_finit(stderr, "en", "latin-1");
+  log = u_finit(stdout, "en", "latin-1");
+
+/*
+  USet *wsp = uprv_openRuleWhiteSpaceSet(&status);
+  uset_add(wsp, 0x0041);
+  uset_remove(wsp, 0x0041);
+  UnicodeString pat;
+  ((UnicodeSet *)wsp)->toPattern(pat, TRUE);
+  pat.setCharAt(pat.length(), 0);
+  escapeString(pat.getBuffer(), pat.length(), log);
+  u_fflush(log);
+*/
+
+  UTransliterator *anyHex = utrans_open("[^\\u000a\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+  u_fsettransliterator(log, U_WRITE, anyHex, &status);
+
+  processArgs(argc, argv, status);
+  int32_t i = 0;
+
+
+  gElements.setValueDeleter(deleteLineElement);
+
+
+  if(U_FAILURE(status) || gPlatformNo == 0) {
+    return -1;
+  }
+
+  gUCA = ucol_open("root", &status);
+
+  if(gRulesStdin) {
+    char buffer[1024];
+    UChar ruleBuffer[16384];
+    UChar *rules = ruleBuffer;
+    int32_t maxRuleLen = 16384;
+    int32_t rLen = 0;
+    while(gets(buffer)) {
+      if(buffer[0] != '/' && buffer[1] != '/') {
+        rLen = u_unescape(buffer, rules, maxRuleLen);
+        rules += rLen;
+        maxRuleLen -= rLen;
+      }
+    }
+    UParseError parseError;
+    //escapeString(ruleBuffer, rules-ruleBuffer, log);//
+    u_fprintf(log, "%U\n", ruleBuffer);
+
+    UCollator *col = ucol_openRules(ruleBuffer, rules-ruleBuffer, UCOL_DEFAULT, UCOL_DEFAULT, &parseError, &status);
+    if(U_SUCCESS(status)) {
+      setOutputFile("stdinRules", status);
+      processCollator(col, status);
+    } else {
+      u_fprintf(err, "Error %s\n", u_errorName(status));
+    }
+  } else {
+
+    if(gLocale) {
+      processLocale(gLocale, status);
+    } else if(gLocaleNo) {
+      for(i = 0; i < gLocaleNo; i++) {
+        processLocale(gLocales[i], status);
+      }
+    } else { // do the loop through all the locales
+      int32_t noOfLoc = uloc_countAvailable();
+      const char *locName = NULL;
+      for(i = 0; i<noOfLoc; i++) {
+        status = U_ZERO_ERROR;
+        locName = uloc_getAvailable(i);
+        if(hasCollationElements(locName)) {
+          processLocale(locName, status);
+        }
+      }
+    }
+  }
+
+
+  ucol_close(gUCA);
+
+  u_fflush(log);
+  u_fclose(log);
+  u_fflush(err);
+  u_fclose(err);
+
+  return 0;
+}
\ No newline at end of file
diff --git a/trunk/colprobe/colprobe.dsp b/trunk/colprobe/colprobe.dsp
new file mode 100644
index 0000000..d274c85
--- /dev/null
+++ b/trunk/colprobe/colprobe.dsp
@@ -0,0 +1,148 @@
+# Microsoft Developer Studio Project File - Name="colprobe" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=colprobe - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "colprobe.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "colprobe.mak" CFG="colprobe - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "colprobe - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "colprobe - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "colprobe - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../../tools/toolutil" /I "../../common" /I "../../i18n" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 icuio.lib icuuc.lib icuin.lib icutu.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../lib"
+
+!ELSEIF  "$(CFG)" == "colprobe - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../tools/toolutil" /I "../../common" /I "../../i18n" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 icuiod.lib icuucd.lib icuind.lib icutud.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "colprobe - Win32 Release"
+# Name "colprobe - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\colprobeNew.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\line.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sortedlines.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\strengthprobe.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\targetsetgenerator.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\uprinter.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\colprobe.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\line.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sortedlines.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strengthprobe.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\targetsetgenerator.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\uprinter.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/trunk/colprobe/colprobe.h b/trunk/colprobe/colprobe.h
new file mode 100644
index 0000000..ca12c44
--- /dev/null
+++ b/trunk/colprobe/colprobe.h
@@ -0,0 +1,15 @@
+#ifndef COLPROBE_H
+#define COLPROBE_H
+
+#include "unicode/uniset.h"
+#include "unicode/normlzr.h"
+
+typedef int (*CompareFn) (const void *elem1, const void *elem2);
+typedef int (*GetSortKeyFn) (const UChar *string, int32_t len, uint8_t *buffer, int32_t buffCapacity);
+//typedef int (__cdecl *CompareFn)(const void *elem1, const void *elem2);
+void generateRepertoire(const char *locale, UnicodeSet &rep, UBool &hanAppears, UErrorCode &status);
+UnicodeSet flatten(const UnicodeSet &source, UErrorCode &status);
+
+//UnicodeSet generateRepertoire(const char *locale);
+
+#endif
diff --git a/trunk/colprobe/colprobeNew.cpp b/trunk/colprobe/colprobeNew.cpp
new file mode 100644
index 0000000..6bcfc51
--- /dev/null
+++ b/trunk/colprobe/colprobeNew.cpp
@@ -0,0 +1,1078 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File colprobe.cpp
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+#include "uoptions.h"
+#include "unicode/ucol.h"
+#include "unicode/ucoleitr.h"
+#include "unicode/ures.h"
+#include "unicode/uniset.h"
+#include "unicode/usetiter.h"
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/uscript.h"
+#include "unicode/locid.h"
+#include "unicode/ucnv.h"
+#include "uprops.h"
+#include "hash.h"
+#include "ucol_imp.h"
+
+#include "unicode/ustdio.h"
+#include "unicode/utrans.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+
+// unix tolower
+#include <ctype.h>
+// unix setlocale
+#include <locale.h>
+
+#include "colprobe.h"
+
+#include "line.h"
+#include "sortedlines.h"
+#include "strengthprobe.h"
+
+void testWin(StrengthProbe &probe, UErrorCode &status) ;
+
+#if defined WIN32
+#include <io.h>
+#include <windows.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <direct.h>
+
+int createDir(const char* dirName) {
+  struct _stat myStat;
+  int result = _stat(dirName, &myStat);
+ 
+  if(result == -1) {
+    result = _mkdir(dirName);
+    return result;
+  } else if(myStat.st_mode & _S_IFDIR) {
+    return 0;
+  } else {
+    return 1;
+  }
+}
+
+//#elif defined POSIX
+#else
+#include <sys/stat.h>
+#include <unistd.h>
+
+int createDir(const char* dirName) {
+  struct stat myStat;
+  int result = stat(dirName, &myStat);
+ 
+  if(result == -1) {
+    result = mkdir(dirName, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+    return result;
+  } else if(S_ISDIR(myStat.st_mode)) {
+    return 0;
+  } else {
+    return 1;
+  }
+}
+//
+//  Stubs for Windows API functions when building on UNIXes.
+//
+typedef int DWORD;
+inline int CompareStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;};
+//#else
+//#error "Not POSIX or Windows. Won't work."
+#endif
+
+#include "line.h"
+
+static UBool gVerbose = FALSE;
+static UBool gDebug = FALSE;
+static UBool gQuiet = FALSE;
+static UBool gExemplar = FALSE;
+
+DWORD          gWinLCID;
+int            gCount;
+UCollator     *gCol;
+UCollator     *gUCA;
+UConverter    *utf8cnv;
+CompareFn gComparer;
+int       gRefNum;
+UnicodeSet gExcludeSet;
+UnicodeSet gRepertoire;
+
+const UChar separatorChar = 0x0030;
+
+UPrinter *logger;
+UPrinter *debug;
+UPrinter *tailoringBundle;
+UPrinter *referenceBundle;
+UPrinter *bundle;
+FILE     *fTailoringDump;
+FILE     *fDefaultDump;
+
+const char *progName = "colprobe";
+
+const char *gLocale = NULL;
+int32_t platformIndex = -1;
+int32_t gPlatformNo = 0;
+int32_t gPlatformIndexes[10];
+int32_t gLocaleNo = 0;
+const char* gLocales[100];
+UBool gRulesStdin = FALSE;
+const char *outputFormat = "HTML";
+const char *outExtension = "html";
+
+enum {
+  HELP1,
+    HELP2,
+    VERBOSE,
+    QUIET,
+    VERSION,
+    ICUDATADIR,
+    COPYRIGHT,
+    LOCALE,
+    PLATFORM,
+    DEBUG, 
+    EXEMPLAR,
+    RULESSTDIN,
+    REFERENCE,
+    EXCLUDESET,
+    REPERTOIRE,
+  INTERACTIVE,
+  PRINTREF,
+  DIFF, 
+  OUTPUT
+};
+
+UOption options[]={
+  /*0*/ UOPTION_HELP_H,
+  /*1*/ UOPTION_HELP_QUESTION_MARK,
+  /*2*/ UOPTION_VERBOSE,
+  /*3*/ UOPTION_QUIET,
+  /*4*/ UOPTION_VERSION,
+  /*5*/ UOPTION_ICUDATADIR,
+  /*6*/ UOPTION_COPYRIGHT,
+  /*7*/ UOPTION_DEF("locale", 'l', UOPT_REQUIRES_ARG),
+  /*8*/ UOPTION_DEF("platform", 'p', UOPT_REQUIRES_ARG),
+  /*9*/ UOPTION_DEF("debug", 'D', UOPT_NO_ARG),
+  /*10*/ UOPTION_DEF("exemplar", 'E', UOPT_NO_ARG),
+  /*11*/ UOPTION_DEF("rulesstdin", 'R', UOPT_NO_ARG),
+  /*12*/ UOPTION_DEF("ref", 'c', UOPT_REQUIRES_ARG),
+  /*13*/ UOPTION_DEF("excludeset", 'x', UOPT_REQUIRES_ARG),
+  /*14*/ UOPTION_DEF("repertoire", 't', UOPT_REQUIRES_ARG),
+  /*15*/ UOPTION_DEF("interactive", 'I', UOPT_NO_ARG),
+  /*16*/ UOPTION_DEF("printref", 0, UOPT_NO_ARG),
+  /*17*/ UOPTION_DEF("diff", 0, UOPT_NO_ARG),
+  /*18*/ UOPTION_DEF("output", 0, UOPT_REQUIRES_ARG)
+};
+
+UChar compA[256];
+UChar compB[256];
+int32_t compALen = 0;
+int32_t compBLen = 0;
+
+char compUTF8A[256];
+char compUTF8B[256];
+int32_t compUTF8ALen = 0;
+int32_t compUTF8BLen = 0;
+
+int UNIXstrcmp(const void *a, const void *b) {
+  UErrorCode status = U_ZERO_ERROR;
+    gCount++;
+    int t;
+    compALen = unorm_normalize((*(Line **)a)->name, (*(Line **)a)->len, UNORM_NFC, 0, compA, 256, &status);
+    compBLen = unorm_normalize((*(Line **)b)->name, (*(Line **)b)->len, UNORM_NFC, 0, compB, 256, &status);
+    compUTF8ALen = ucnv_fromUChars(utf8cnv, compUTF8A, 256, compA, compALen, &status);
+    compUTF8A[compUTF8ALen] = 0;
+    compUTF8BLen = ucnv_fromUChars(utf8cnv, compUTF8B, 256, compB, compBLen, &status);
+    compUTF8B[compUTF8BLen] = 0;
+    t = strcoll(compUTF8A, compUTF8B);
+    return t;
+}
+
+int UNIXgetSortKey(const UChar *string, int32_t len, uint8_t *buffer, int32_t buffCapacity) {
+  UErrorCode status = U_ZERO_ERROR;
+  compALen = unorm_normalize(string, len, UNORM_NFC, 0, compA, 256, &status);
+  compUTF8ALen = ucnv_fromUChars(utf8cnv, compUTF8A, 256, compA, compALen, &status);
+  compUTF8A[compUTF8ALen] = 0;
+  return (strxfrm((char *)buffer, compUTF8A, buffCapacity)+1);
+}
+
+#ifdef WIN32
+int Winstrcmp(const void *a, const void *b) {
+  UErrorCode status = U_ZERO_ERROR;
+    gCount++;
+    int t;
+    //compALen = unorm_compose(compA, 256, (*(Line **)a)->name, (*(Line **)a)->len, FALSE, 0, &status);
+    //compBLen = unorm_compose(compB, 256, (*(Line **)b)->name, (*(Line **)b)->len, FALSE, 0, &status);
+    compALen = unorm_normalize((*(Line **)a)->name, (*(Line **)a)->len, UNORM_NFC, 0, compA, 256, &status);
+    compBLen = unorm_normalize((*(Line **)b)->name, (*(Line **)b)->len, UNORM_NFC, 0, compB, 256, &status);
+    t = CompareStringW(gWinLCID,  SORT_STRINGSORT, //0,
+      compA, compALen, 
+      compB, compBLen);
+
+/*    
+    t = CompareStringW(gWinLCID, 0, 
+      (*(Line **)a)->name, (*(Line **)a)->len, 
+      (*(Line **)b)->name, (*(Line **)b)->len);
+*/
+    return t-2;
+}
+
+int WingetSortKey(const UChar *string, int32_t len, uint8_t *buffer, int32_t buffCapacity) {
+  UErrorCode status = U_ZERO_ERROR;
+  compALen = unorm_normalize(string, len, UNORM_NFC, 0, compA, 256, &status);
+  return LCMapStringW(gWinLCID, LCMAP_SORTKEY | SORT_STRINGSORT, compA, compALen, (unsigned short *)buffer, buffCapacity);
+}
+
+#if 0
+int Winstrcmp(const void *a, const void *b) {
+  UErrorCode status = U_ZERO_ERROR;
+  uint8_t b1[256], b2[256];
+  int32_t b1Len, b2Len;
+  b1Len = WingetSortKey((*(Line **)a)->name, (*(Line **)a)->len, b1, 256);
+  b2Len = WingetSortKey((*(Line **)b)->name, (*(Line **)b)->len, b2, 256);
+
+  b1[b1Len] = 0;
+  b2[b2Len] = 0;
+  
+  return strcmp((const char *)b1, (const char *)b2);
+}
+#endif
+
+#else
+int Winstrcmp(const void *a, const void *b) {
+  if(a == b);
+  return 0;
+}
+int WingetSortKey(const UChar *, int32_t , uint8_t *, int32_t ) {
+  return 0;
+}
+#endif
+
+int ICUstrcmp(const void *a, const void *b) {
+    gCount++;
+    UCollationResult t;
+    t = ucol_strcoll(gCol, 
+      (*(Line **)a)->name, (*(Line **)a)->len,  
+      (*(Line **)b)->name, (*(Line **)b)->len);
+    if (t == UCOL_LESS) return -1;
+    if (t == UCOL_GREATER) return +1;
+    return 0;
+}
+
+int ICUgetSortKey(const UChar *string, int32_t len, uint8_t *buffer, int32_t buffCapacity) {
+  return ucol_getSortKey(gCol, string, len, buffer, buffCapacity);
+}
+
+struct {
+  const char* name;
+  CompareFn comparer;
+  GetSortKeyFn skgetter;
+} platforms[] = {
+  { "icu", ICUstrcmp, ICUgetSortKey },
+  { "w2k", Winstrcmp, WingetSortKey},
+  { "winxp", Winstrcmp, WingetSortKey},
+  { "aix", UNIXstrcmp, UNIXgetSortKey},
+  { "linux", UNIXstrcmp, UNIXgetSortKey}
+};
+
+
+void stringToLower(char *string) {
+  uint32_t i = 0;
+  for(i = 0; i < strlen(string); i++) {
+    string[i] = tolower(string[i]);
+  }
+}
+
+void usage(const char *name) {
+  logger->log("Usage: %s --locale loc_name --platform platform\n", name);
+}
+
+void listKnownPlatforms() {
+  uint32_t i = 0;
+  logger->log("Known platforms:\n");
+  for(i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
+    logger->log("\t%s\n", platforms[i]);
+  }
+}
+
+void addPlatform(const char *platform) {
+  uint32_t i;
+  //stringToLower(platform);
+  int32_t oldPlatformNo = gPlatformNo;
+
+  for(i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
+    if(strcmp(platform, platforms[i].name) == 0) {
+      gPlatformIndexes[gPlatformNo++] = i;
+    }
+  }
+  if(gPlatformNo == oldPlatformNo) {
+    logger->log("Unknown platform %s\n", platform);
+    listKnownPlatforms();
+  }
+}
+
+void processArgs(int argc, char* argv[], UErrorCode &status)
+{
+  int32_t i = 0;
+  U_MAIN_INIT_ARGS(argc, argv);
+
+  argc = u_parseArgs(argc, argv, (int32_t)(sizeof(options)/sizeof(options[0])), options);
+
+  if(argc < 0) {
+    logger->log("Unknown option: %s\n", argv[-argc]);
+    usage(progName);
+    return;
+  }
+
+  if(options[0].doesOccur || options[1].doesOccur) {
+    usage(progName);
+    return;
+  }
+  if(options[VERBOSE].doesOccur) {
+    gVerbose = TRUE;
+  }
+  if(options[DEBUG].doesOccur) {
+    gDebug = TRUE;
+    gVerbose = TRUE;
+  }
+  if(options[EXEMPLAR].doesOccur) {
+    gExemplar = TRUE;
+  }
+  if(options[QUIET].doesOccur) {
+    gQuiet = TRUE;
+  }
+
+  // ASCII based options specified on the command line
+  // this is for testing purposes, will allow to load
+  // up ICU rules and then poke through them.
+  // In that case, we test only ICU and don't need 
+  // a locale.
+  if(options[RULESSTDIN].doesOccur) {
+    gRulesStdin = TRUE;
+    addPlatform("icu");
+    return;
+  } 
+
+  if(options[LOCALE].doesOccur) {
+    gLocale = options[LOCALE].value;
+  } else {
+    gLocale = argv[1];
+    //for(i = 1; i < argc; i++) {
+    //gLocales[gLocaleNo++] = argv[i];
+    //}
+  }
+
+  if(options[PLATFORM].doesOccur) {
+    addPlatform(options[PLATFORM].value);
+  } else { // there is a list of platforms 
+    addPlatform("icu");
+  }
+
+  if(options[REFERENCE].doesOccur) {
+    for(i = 0; i < (int32_t)(sizeof(platforms)/sizeof(platforms[0])); i++) {
+      if(strcmp(options[REFERENCE].value, platforms[i].name) == 0) {
+        gRefNum = i;
+        break;
+      }
+    }
+    if(i == sizeof(platforms)/sizeof(platforms[0])) {
+      logger->log("Unknown reference %s!\n", options[REFERENCE].value);
+      status = U_ILLEGAL_ARGUMENT_ERROR;
+      return;
+    }
+  } else {
+    gRefNum = 0;
+  }
+
+  if(options[EXCLUDESET].doesOccur) {
+    gExcludeSet.applyPattern(UnicodeString(options[EXCLUDESET].value), status);
+    if(U_FAILURE(status)) {
+      logger->log("Cannot construct exclude set from argument %s. Error %s\n", options[EXCLUDESET].value, u_errorName(status));
+      return;
+    } else {
+      UnicodeString pattern;
+      logger->log(gExcludeSet.toPattern(pattern, TRUE), TRUE);
+    }
+  }
+
+  if(options[REPERTOIRE].doesOccur)  {
+    gRepertoire.applyPattern(UnicodeString(options[REPERTOIRE].value), status);
+    if(U_FAILURE(status)) {
+      logger->log("Cannot construct repertoire from argument %s. Error %s\n", options[REPERTOIRE].value, u_errorName(status));
+      return;
+    }
+  }
+
+  if(options[OUTPUT].doesOccur) {
+    outputFormat = options[OUTPUT].value;
+    if(strcmp(outputFormat, "HTML") == 0) {
+      outExtension = "html";
+    } else if(strcmp(outputFormat, "XML") == 0) {
+      outExtension = "xml";
+    } else {
+      outExtension = "txt";
+    }
+  }
+
+}
+
+// Check whether upper case comes before lower case or vice-versa
+int32_t 
+checkCaseOrdering(void) {
+  UChar stuff[][3] = {
+    { 0x0061, separatorChar, 0x0061}, //"aa",
+    { 0x0061, separatorChar, 0x0041 }, //"a\\u00E0",
+    { 0x0041, separatorChar, 0x0061 }, //"\\u00E0a",
+    { 0x0041, separatorChar, 0x0041 }, //"\\u00E0a",
+    //{ 0x00E0, separatorChar, 0x00E0 }  //"\\u00E0\\u00E0"
+  };
+  const int32_t size = sizeof(stuff)/sizeof(stuff[0]);
+
+  Line **sortedLines = new Line*[size];
+  Line lines[size];
+
+  int32_t i = 0;
+  int32_t ordered = 0, reversed = 0;
+
+  for(i = 0; i < size; i++) {
+    lines[i].setName(stuff[i], 3);
+  }
+  //setArray(sortedLines, lines, size);
+  qsort(sortedLines, size, sizeof(Line*), gComparer);
+
+  for(i = 0; i < size; i++) {
+    if(*(sortedLines+i) == &lines[i]) {
+      ordered++;
+    }
+    if(*(sortedLines+i) == &lines[size-i-1]) {
+      reversed++;
+    }
+  }
+
+  delete[] sortedLines;
+  if(ordered == size) {
+    return 0; // in normal order
+  } else if(reversed == size) {
+    return 1; // in reversed order
+  } else {
+    return -1; // unknown order
+  }
+}
+
+void
+getExemplars(const char *locale, UnicodeSet &exemplars, UErrorCode &status) {
+  // first we fill out structures with exemplar characters.
+  UResourceBundle *res = ures_open(NULL, locale, &status);
+  UnicodeString exemplarString = ures_getUnicodeStringByKey(res, "ExemplarCharacters", &status);
+  exemplars.clear();
+  exemplars.applyPattern(exemplarString, status);
+  ures_close(res);
+}
+
+
+void
+getFileNames(const char *name, char *tailoringName, char *tailoringDumpName, char *defaultName, char *defaultDumpName, char *diffName) {
+  if(tailoringName) {
+    strcpy(tailoringName, platforms[gPlatformIndexes[0]].name);
+    strcat(tailoringName, "/");
+    strcat(tailoringName, name);
+    strcat(tailoringName, "_raw.");
+    strcat(tailoringName, outExtension);
+  }
+  if(tailoringDumpName) {
+    strcpy(tailoringDumpName, platforms[gPlatformIndexes[0]].name);
+    strcat(tailoringDumpName, "/");
+    strcat(tailoringDumpName, name);
+    strcat(tailoringDumpName, ".dump");
+  }
+
+  if(diffName) {
+    strcpy(diffName, platforms[gPlatformIndexes[0]].name);
+    strcat(diffName, "/");
+    strcat(diffName, name);
+    strcat(diffName, "_collation.");
+    strcat(diffName, outExtension);
+  }
+
+  if(defaultName) {
+    strcpy(defaultName, platforms[gRefNum].name);
+    strcat(defaultName, "/");
+    strcat(defaultName, name);
+    strcat(defaultName, "_default_raw.");
+    strcat(defaultName, outExtension);
+  }
+
+  if(defaultDumpName) {
+    strcpy(defaultDumpName, platforms[gRefNum].name);
+    strcat(defaultDumpName, "/");
+    strcat(defaultDumpName, name);
+    strcat(defaultDumpName, "_default.dump");
+  }
+}
+
+void 
+setFiles(const char *name, UErrorCode &status) {
+  if(U_FAILURE(status)) {
+    return;
+  }
+  int32_t i = 0;
+  char tailoringName[256];
+  char tailoringDumpName[256];
+  char defaultName[256];
+  char defaultDumpName[256];
+  char diffName[256];
+
+  getFileNames(name, tailoringName, tailoringDumpName, defaultName, defaultDumpName, diffName);
+  if(options[PLATFORM].doesOccur && !options[DIFF].doesOccur) {  
+    if(createDir(platforms[gPlatformIndexes[0]].name) == 0) {
+      tailoringBundle = new UPrinter(tailoringName, "en", "utf-8", NULL, FALSE);
+      fTailoringDump = fopen(tailoringDumpName, "wb");
+    } else {
+      status = U_FILE_ACCESS_ERROR;
+      return;
+    }
+  }
+
+  if(options[REFERENCE].doesOccur && !options[DIFF].doesOccur) {
+    if(createDir(platforms[gRefNum].name) == 0) {
+      referenceBundle = new UPrinter(defaultName, "en", "utf-8", NULL, FALSE);
+      fDefaultDump = fopen(defaultDumpName, "wb");
+    } else {
+      status = U_FILE_ACCESS_ERROR;
+      return;
+    }
+  }
+
+  if((options[PLATFORM].doesOccur && options[REFERENCE].doesOccur) || options[DIFF].doesOccur) {
+    if(createDir(platforms[gPlatformIndexes[0]].name) == 0) {
+      bundle = new UPrinter(diffName, "en", "utf-8", NULL, FALSE);
+    }
+  }
+  if(options[DIFF].doesOccur) {
+    fTailoringDump = fopen(tailoringDumpName, "rb");
+    fDefaultDump = fopen(defaultDumpName, "rb");
+  }
+}
+
+
+UErrorCode status = U_ZERO_ERROR;
+static UnicodeSet UNASSIGNED(UnicodeString("[:Cn:]"), status);
+static UnicodeSet GENERAL_ACCENTS(UnicodeString("[[:block=Combining Diacritical Marks:]-[:Cn:]]"), status);
+//static UnicodeSet ASCII_BASE(UnicodeString("[[:ASCII:]-[:L:]-[:N:]]"), status);
+static UnicodeSet ASCII_BASE(UnicodeString("[[:ASCII:]]"), status);
+static UnicodeSet ALPHABETIC(UnicodeString("[:alphabetic:]"), status);
+//static UnicodeSet CONTROL(UnicodeString("[[:control:][\\u0000-\\u002F]]"), status);
+static UnicodeSet BMP(UnicodeString("[\\u0000-\\uFFFF]"), status);
+
+static UnicodeSet CONTROL(UnicodeString("[:control:]"), status);
+
+UCollator *
+setLocale(const char* locale, UErrorCode &status)
+{
+  gWinLCID = uloc_getLCID(locale);
+  setlocale(LC_COLLATE, locale);
+
+  if(gCol) {
+    ucol_close(gCol);
+  }
+  gCol = ucol_open(locale, &status);
+  ucol_setAttribute(gCol, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
+  //ucol_setAttribute(col, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);
+  //ucol_setAttribute(col, UCOL_STRENGTH, UCOL_QUATERNARY, &status);
+
+  return gCol;
+}
+
+
+
+UCollator *
+setReference(UErrorCode &status) 
+{
+  gWinLCID = uloc_getLCID("en");
+  setlocale(LC_COLLATE, "en_US.UTF-8");
+  if(gCol) {
+    ucol_close(gCol);
+  }
+  gCol = ucol_open("root", &status);
+  ucol_setAttribute(gCol, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
+  return gCol;
+}
+
+void
+processInteractive() {
+  char command[256];
+  while(fgets(command, 256, stdin)) {
+
+  }
+}
+
+UChar probeChars[][4] = {
+  { 0x0061, 0x0062, 0x00E1, 0x0041 }, // latin with a-grave
+  { 0x0041, 0x0042, 0x00C1, 0x0061 }, // upper first
+  { 0x006E, 0x006F, 0x00F1, 0x004E }, // latin with n-tilda
+  { 0x004E, 0x004F, 0x00D1, 0x006E }, // upper first
+  { 0x0433, 0x0493, 0x0491, 0x0413 }, // Cyrillic
+  { 0x0413, 0x0492, 0x0490, 0x0433 }, // upper first
+  { 0x3045, 0x3047, 0x3094, 0x3046 }  // Hiragana/Katakana (last resort)
+
+};
+
+void
+processCollator(UCollator *col, UErrorCode &status) {
+  int32_t i = 0;
+  uint32_t j = 0;
+  gCol = col;
+  UChar ruleString[16384];
+  char myLoc[256];
+
+  int32_t ruleStringLength = ucol_getRulesEx(gCol, UCOL_TAILORING_ONLY, ruleString, 16384);
+  logger->log(UnicodeString(ruleString, ruleStringLength), TRUE);
+  const char *locale = ucol_getLocale(gCol, ULOC_REQUESTED_LOCALE, &status);
+  if(locale == NULL) {
+    locale = "en";
+  }
+  strcpy(myLoc, locale);
+  UnicodeSet exemplarUSet;
+  UnicodeSet RefRepertoire;
+
+  UnicodeSet tailored;
+
+  tailored = *((UnicodeSet *)ucol_getTailoredSet(gCol, &status));
+  tailored.removeAll(CONTROL);
+
+
+  UnicodeString pattern;
+  int sanityResult;
+
+  UnicodeSet hanSet;
+  UBool hanAppears = FALSE;
+
+  debug->log("\nGenerating order for platform: %s\n", platforms[gPlatformIndexes[0]].name);
+  gComparer = platforms[gPlatformIndexes[0]].comparer;
+
+  StrengthProbe probe(platforms[gPlatformIndexes[0]].comparer, platforms[gPlatformIndexes[0]].skgetter, 0x0030, probeChars[0][0], probeChars[0][1], probeChars[0][2], probeChars[0][3]);
+  sanityResult = probe.checkSanity();
+  j = 0;
+  while(sanityResult && j+1 < sizeof(probeChars)/sizeof(probeChars[0])) {
+   j++;
+   sanityResult =  probe.setProbeChars(probeChars[j][0], probeChars[j][1], probeChars[j][2], probeChars[j][3]);
+  }
+  if(sanityResult) {
+    logger->log("Bad choice of probe characters! Sanity returned %i. Exiting\n", sanityResult, sanityResult);
+    return;
+  }
+  logger->log("Probe chars: %C, %C, %C, %C\n", probeChars[j][0], probeChars[j][1], probeChars[j][2], probeChars[j][3]); 
+
+  debug->off();
+
+  if(gRepertoire.size()) {
+    exemplarUSet = gRepertoire;
+  } else {
+    generateRepertoire(locale, exemplarUSet, hanAppears, status);
+  }
+  exemplarUSet.addAll(tailored);
+  hanSet.applyIntPropertyValue(UCHAR_SCRIPT, USCRIPT_HAN, status);
+  exemplarUSet.removeAll(hanSet);
+  
+  logger->log(exemplarUSet.toPattern(pattern, TRUE), TRUE);
+
+  exemplarUSet = flatten(exemplarUSet, status);
+  logger->log(exemplarUSet.toPattern(pattern, TRUE), TRUE);
+
+  if(!options[PRINTREF].doesOccur) {
+
+    logger->log("\n*** Detecting ordering for the locale\n\n");
+
+    debug->on();
+    SortedLines lines(exemplarUSet, gExcludeSet, probe, logger, debug);
+    lines.analyse(status);
+    lines.calculateSortKeys();
+    debug->log("\n*** Final order\n\n");
+    debug->log(lines.toPrettyString(TRUE, TRUE), TRUE);
+    lines.toFile(fTailoringDump, TRUE, status);
+    tailoringBundle->log(lines.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, TRUE, TRUE, hanAppears), TRUE);
+    //debug->off();
+
+    if(options[REFERENCE].doesOccur) {
+      status = U_ZERO_ERROR;
+      lines.getRepertoire(RefRepertoire);
+      setReference(status);
+
+      logger->log(exemplarUSet.toPattern(pattern, TRUE), TRUE);
+      logger->log(RefRepertoire.toPattern(pattern, TRUE), TRUE);
+
+      StrengthProbe RefProbe(platforms[gRefNum].comparer, platforms[gRefNum].skgetter);
+      logger->log("\n*** Detecting ordering for reference\n\n");
+      SortedLines RefLines(exemplarUSet, gExcludeSet, RefProbe, logger, debug);
+      RefLines.analyse(status);
+      referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, NULL, TRUE, TRUE, FALSE), TRUE);
+      RefLines.toFile(fDefaultDump, TRUE, status);
+
+      lines.reduceDifference(RefLines);
+      logger->log("\n*** Final rules\n\n");
+      logger->log(lines.toPrettyString(TRUE), TRUE);
+      bundle->log(lines.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name, TRUE, TRUE, hanAppears), TRUE);
+    }
+  } else {
+    setReference(status);
+    StrengthProbe RefProbe(platforms[gRefNum].comparer, platforms[gRefNum].skgetter);
+    logger->log("\n*** Detecting ordering for reference\n\n");
+    SortedLines RefLines(exemplarUSet, gExcludeSet, RefProbe, logger, debug);
+    RefLines.analyse(status);
+    logger->log(RefLines.toPrettyString(TRUE), TRUE);
+    referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, NULL, TRUE, TRUE, FALSE), TRUE);
+  }
+  if(hanAppears) {
+    // there are Han characters. This is a huge block. The best we can do is to just sort it, compare to empty
+    // and spit it out. Anything else would be a suicide (actually is - kernel just kills you :)
+    logger->log("\n*** Detecting order for Han\n");
+    debug->off();
+    setLocale(gLocale, status);
+    exemplarUSet.clear();
+    exemplarUSet.applyIntPropertyValue(UCHAR_SCRIPT, USCRIPT_HAN, status);
+    exemplarUSet = flatten(exemplarUSet, status);
+    SortedLines han(exemplarUSet, gExcludeSet, probe, logger, debug);
+    han.sort(TRUE, TRUE);
+    han.classifyRepertoire();
+    han.getBounds(status);
+    tailoringBundle->log("Han ordering:<br>\n");
+    tailoringBundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, TRUE, FALSE, FALSE), TRUE);
+    bundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, TRUE, FALSE, FALSE), TRUE);
+  }
+  ucol_close(gCol);
+}
+
+void
+processLocale(const char *locale, UErrorCode &status) {
+  setLocale(locale, status);
+  setFiles(locale, status);
+  if(U_FAILURE(status)) {
+    return;
+  }
+
+  debug->log("Locale %s (LCID:%06X, unix:%s)\n", locale, gWinLCID, setlocale(LC_COLLATE, NULL));
+  tailoringBundle->log("// Ordering for locale %s (LCID:%06X, unix:%s), platform %s reference %s<br>\n", 
+    locale, gWinLCID, setlocale(LC_COLLATE, NULL), 
+    platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name);
+  if(options[REFERENCE].doesOccur) {
+    referenceBundle->log("// Reference for locale %s (LCID:%06X, unix:%s), platform %s reference %s<br>\n", 
+      locale, gWinLCID, setlocale(LC_COLLATE, NULL), 
+      platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name);
+  }
+
+
+  processCollator(gCol, status);
+}
+
+
+
+UBool 
+hasCollationElements(const char *locName) {
+
+  UErrorCode status = U_ZERO_ERROR;
+  UResourceBundle *ColEl = NULL;
+
+  UResourceBundle *loc = ures_open(NULL, locName, &status);;
+
+  if(U_SUCCESS(status)) {
+    status = U_ZERO_ERROR;
+    ColEl = ures_getByKey(loc, "CollationElements", ColEl, &status);
+    if(status == U_ZERO_ERROR) { /* do the test - there are real elements */
+      ures_close(ColEl);
+      ures_close(loc);
+      return TRUE;
+    }
+    ures_close(ColEl);
+    ures_close(loc);
+  }
+  return FALSE;
+}
+
+int
+main(int argc,
+     char* argv[])
+{
+  UErrorCode status = U_ZERO_ERROR;
+  logger = new UPrinter(stdout, "en", "latin-1");
+  debug =  new UPrinter(stderr, "en", "latin-1");
+
+/*
+  USet *wsp = uprv_openRuleWhiteSpaceSet(&status);
+  uset_add(wsp, 0x0041);
+  uset_remove(wsp, 0x0041);
+  UnicodeString pat;
+  ((UnicodeSet *)wsp)->toPattern(pat, TRUE);
+  pat.setCharAt(pat.length(), 0);
+  escapeString(pat.getBuffer(), pat.length(), log);
+  u_fflush(log);
+*/
+
+  processArgs(argc, argv, status);
+  int32_t i = 0;
+
+
+
+  if(U_FAILURE(status) || gPlatformNo == 0) {
+    return -1;
+  }
+
+  utf8cnv = ucnv_open("utf-8", &status);    // we are just doing UTF-8 locales for now.
+  gUCA = ucol_open("root", &status);
+
+  if(options[INTERACTIVE].doesOccur) {
+    processInteractive();
+  } else {
+    if(gRulesStdin) {
+      char buffer[1024];
+      UChar ruleBuffer[16384];
+      UChar *rules = ruleBuffer;
+      int32_t maxRuleLen = 16384;
+      int32_t rLen = 0;
+      while(fgets(buffer, 1024, stdin)) {
+        if(buffer[0] != '/' && buffer[1] != '/') {
+          rLen = u_unescape(buffer, rules, maxRuleLen);
+          rules += rLen;
+          maxRuleLen -= rLen;
+        }
+      }
+      UParseError parseError;
+      //escapeString(ruleBuffer, rules-ruleBuffer, log);//
+      debug->log("%U\n", ruleBuffer);
+
+      UCollator *col = ucol_openRules(ruleBuffer, rules-ruleBuffer, UCOL_DEFAULT, UCOL_DEFAULT, &parseError, &status);
+      if(U_SUCCESS(status)) {
+        setFiles("stdinRules", status);
+        processCollator(col, status);
+      } else {
+        logger->log("Error %s\n", u_errorName(status));
+      }
+    } else if(options[DIFF].doesOccur) {
+      logger->log("Diffing two dumps\n");
+      // must have locale, platform and ref in order to be 
+      // able to find dump files.
+      setFiles(gLocale, status);
+  
+      if(fTailoringDump && fDefaultDump) {
+	    SortedLines tailoring(fTailoringDump, logger, debug, status);
+	    logger->log(tailoring.toString(TRUE), TRUE);
+	    SortedLines reference(fDefaultDump, logger, debug, status);
+	    logger->log(reference.toString(TRUE), TRUE);
+	    tailoring.reduceDifference(reference);
+	    logger->log("\n*** Final rules\n\n");
+	    logger->log(tailoring.toPrettyString(TRUE), TRUE);
+	    //result->log(lines.toPrettyString(TRUE), TRUE);
+	    bundle->log(tailoring.toOutput(outputFormat, gLocale, platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name, TRUE, TRUE, FALSE), TRUE);
+      }
+
+    } else {
+      if(gLocale) {
+        processLocale(gLocale, status);
+      } else if(gLocaleNo) {
+        for(i = 0; i < gLocaleNo; i++) {
+          processLocale(gLocales[i], status);
+        }
+      } else { // do the loop through all the locales
+        int32_t noOfLoc = uloc_countAvailable();
+        const char *locName = NULL;
+        for(i = 0; i<noOfLoc; i++) {
+          status = U_ZERO_ERROR;
+          locName = uloc_getAvailable(i);
+          if(hasCollationElements(locName)) {
+            processLocale(locName, status);
+          }
+        }
+      }
+    }
+  }
+
+
+  ucol_close(gUCA);
+  ucnv_close(utf8cnv);
+
+  delete logger;
+  delete debug;
+  if(tailoringBundle) {
+    delete tailoringBundle;
+  }
+  if(referenceBundle) {
+    delete referenceBundle;
+  }
+  if(bundle) {
+    delete bundle;
+  }
+  if(fTailoringDump) {
+    fclose(fTailoringDump);
+  }
+  if(fDefaultDump) {
+    fclose(fDefaultDump);
+  }
+  return 0;
+}
+
+
+UnicodeString propertyAndValueName(UProperty prop, int32_t i) {
+  UnicodeString result;
+  result.append(u_getPropertyName(prop, U_LONG_PROPERTY_NAME));
+  result.append("=");
+  result.append(u_getPropertyValueName(prop, i, U_LONG_PROPERTY_NAME));
+
+    //+ "(" + prop + "," + i + ") ";
+  return result;
+}
+
+
+void generateRepertoire(const char *locale, UnicodeSet &rep, UBool &hanAppears, UErrorCode &status) {
+    UnicodeString dispName;
+    debug->log("Getting repertoire for %s\n", locale);
+    tailoringBundle->log("// Scripts in repertoire: ");
+    if(options[REFERENCE].doesOccur) {
+      referenceBundle->log("// Scripts in repertoire: ");
+    }
+	rep.clear();
+    UnicodeSet delta;
+    
+    UScriptCode script[256];
+    int32_t i = 0;
+    // now add the scripts for the locale
+    UProperty prop = UCHAR_SCRIPT;
+	int32_t scriptLength = uscript_getCode(locale, script, 256, &status);
+    if(scriptLength) {
+	  for (i = 0; i < scriptLength; ++i) {
+        if(script[i] == USCRIPT_HAN) {
+          hanAppears = TRUE;
+          continue;
+        }
+        delta.applyIntPropertyValue(prop, script[i], status);
+        debug->log("Adding ");
+        debug->log(propertyAndValueName(prop, script[i]), TRUE);
+        tailoringBundle->log("// ");
+        tailoringBundle->log(propertyAndValueName(prop, script[i]), TRUE);
+        if(options[REFERENCE].doesOccur) {
+          referenceBundle->log("// ");
+          referenceBundle->log(propertyAndValueName(prop, script[i]), TRUE);
+        }
+		rep.addAll(delta);
+	  }
+    } else {
+      delta.applyIntPropertyValue(UCHAR_SCRIPT, USCRIPT_LATIN, status);
+      rep.addAll(delta);
+    }
+    
+    // now see which blocks those overlap, and add
+    prop = UCHAR_BLOCK;
+    int32_t min = u_getIntPropertyMinValue(prop);
+    int32_t max = u_getIntPropertyMaxValue(prop);
+    UnicodeSet checkDelta;
+    for (i = min; i <= max; ++i) {
+        // skip certain blocks
+        const char *name = u_getPropertyValueName(prop, i, U_LONG_PROPERTY_NAME);
+        if (strcmp(name, "Superscripts_and_Subscripts") == 0
+        || strcmp(name, "Letterlike_Symbols") == 0
+        || strcmp(name, "Alphabetic_Presentation_Forms") == 0
+        || strcmp(name, "Halfwidth_and_Fullwidth_Forms") == 0) continue;
+
+        delta.applyIntPropertyValue(prop, i, status).removeAll(UNASSIGNED);
+        if (!rep.containsSome(delta)) continue;
+        if (rep.containsAll(delta)) continue; // just to see what we are adding
+        debug->log("Adding ");
+        debug->log(propertyAndValueName(prop, i), TRUE);                
+        tailoringBundle->log("// ");
+        tailoringBundle->log(propertyAndValueName(prop, i), TRUE);
+        if(options[REFERENCE].doesOccur) {
+          referenceBundle->log("// ");
+          referenceBundle->log(propertyAndValueName(prop, i), TRUE);
+        }
+        rep.addAll(delta);
+    }
+    
+    // add ASCII and general accents
+    rep.addAll(GENERAL_ACCENTS).addAll(ASCII_BASE);
+    rep.removeAll(CONTROL);
+    //delta.applyIntPropertyValue(UCHAR_SCRIPT, USCRIPT_HAN, status);
+    //rep.removeAll(delta);
+
+    // now add the exemplar characters
+    // can't get at them from Java right now
+    tailoringBundle->log("<br>\n");
+    if(options[REFERENCE].doesOccur) {
+      referenceBundle->log("<br>\n");
+    }
+}
+
+UnicodeSet flatten(const UnicodeSet &source, UErrorCode &status) {
+    UnicodeSet result;
+    UnicodeSetIterator it(source);
+    UnicodeString item, itemNFKD, toNormalize;
+    while (it.next()) {
+        // would be nicer if UnicodeSetIterator had a getString function
+        if (it.isString()) {
+          Normalizer::normalize(it.getString(), UNORM_NFD, 0, item, status);
+          Normalizer::normalize(it.getString(), UNORM_NFKD, 0, itemNFKD, status);
+        } else {
+          toNormalize.setTo(it.getCodepoint());
+          Normalizer::normalize(toNormalize, UNORM_NFD, 0, item, status);
+          Normalizer::normalize(toNormalize, UNORM_NFKD, 0, itemNFKD, status);
+        }
+        result.addAll(item);
+        result.addAll(itemNFKD);
+    }
+    return result;
+}
+
+
+void testWin(StrengthProbe &probe, UErrorCode &status) 
+{
+  UnicodeSet trailings(UnicodeString("[\\uFE7D\\uFE7C\\u30FD\\uFF70\\u30FC\\u309D\\u3032\\u3031\\u3005\\u0651]"), status);
+  char intChar[] = "\\uFE7D\\uFE7C\\u30FD\\uFF70\\u30FC\\u309D\\u3032\\u3031\\u3005\\u0651";
+  UChar interesting[256];
+  int32_t intLen = u_unescape(intChar, interesting, 256);
+  UChar i = 0;
+  UChar j = 0,  k = 0;
+  int32_t count;
+  Line myCh, combo, trial, inter, kLine;
+  for(i = 0; i < intLen; i++) {
+    inter.setTo(interesting[i]);
+    logger->log(inter.toString(TRUE), TRUE);
+    logger->log("----------------------\n");
+    for(j = 0; j < 0xFFFF; j++) {
+      myCh.setTo(j);
+      if(probe.distanceFromEmptyString(myCh) == UCOL_IDENTICAL) {
+        continue;
+      }
+      logger->log(myCh.toString(TRUE));
+      combo.setTo(j);
+      combo.append(interesting[i]);
+      count = 0;
+      for(k = 0; k < 0xFFFF; k++) {
+        kLine.setTo(k);
+        trial.setTo(j);
+        trial.append(k);
+        if(probe.compare(kLine, inter) < 0) {
+          if(probe.compare(trial, combo) >= 0) {
+            count++;
+          }
+        }
+      }
+      logger->log("%i %i\n", count, count);
+    }
+  }
+}
+
diff --git a/trunk/colprobe/createComparisonTables.pl b/trunk/colprobe/createComparisonTables.pl
new file mode 100755
index 0000000..18f6a14
--- /dev/null
+++ b/trunk/colprobe/createComparisonTables.pl
@@ -0,0 +1,164 @@
+#! /usr/bin/perl -w
+
+use strict;
+
+
+my $locale = $ARGV[0];
+
+
+my $long_name = `/home/weiv/src/icu/source/extra/colprobe/longname $locale`;
+my $pageTitle = $locale."_collation";
+my $filename = $pageTitle.".html";
+
+open TABLE, ">$filename";
+
+
+print TABLE <<"EndOfTemplate";
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>$pageTitle</title>
+<style>
+         <!--
+         table        { border-spacing: 0; border-collapse: collapse; width: 100%; 
+               border: 1px solid black }
+td, th       { width: 10%; border-spacing: 0; border-collapse: collapse; color: black; 
+               vertical-align: top; border: 1px solid black }
+-->
+     </style>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p><b><font color="#FF0000">Collation:</font> $locale ($long_name) <a href="http://oss.software.ibm.com/cgi-bin/icu/lx/en/?_=$locale">Demo</a>, 
+
+<a href="../all_diff_xml/comparison_charts.html">Cover 
+Page</a>, <a href="../all_diff_xml/index.html">Index</a></b></p>
+<table>
+  <tr>
+EndOfTemplate
+
+my $dirCommon = "common";
+my $refCommon = $dirCommon."/UCARules.txt";
+my $nameCommon = $dirCommon."/".$locale."_collation.html";
+my $colorCommon = "#AD989D";
+
+my $loc;
+
+if(!(-e $nameCommon)) {
+  $locale =~ /_/;
+  $loc = $`;
+  $nameCommon = "$dirCommon/$loc"."_collation.html";
+}
+print TABLE "    <th bgcolor=\"$colorCommon\">COMMON (<a href=\"$refCommon\">UCA</a> <a href=\"../$dirCommon/xml/$locale.xml\">xml</a>)</th>\n";
+
+my $dirLinux = "linux";
+my $refLinux = $dirLinux."/".$locale.".utf8_default_raw.html";
+my $rawLinux = $dirLinux."/".$locale.".utf8_raw.html";
+my $defLinux = $dirLinux."/".$locale;
+my $nameLinux = "$dirLinux/$locale".".utf8_collation.html";
+my $colorLinux = "#1191F1";
+
+print TABLE "    <th bgcolor=\"$colorLinux\">LINUX (";
+if (!(-e $nameLinux)) {
+#try the variant that has @euro stuck in
+  $nameLinux = "$dirLinux/$locale".'.utf8@euro_collation.html';
+  if(-e $nameLinux) {
+    $refLinux = $dirLinux."/".$locale.'.utf8@euro_default_raw.html';
+    $rawLinux = $dirLinux."/".$locale.'.utf8@euro_raw.html';
+  }
+}
+if (-e $nameLinux) {
+    print TABLE "<a href=\"$rawLinux\">Ordering</a> <a href=\"$defLinux\">Definition</a> <a href=\"$refLinux\">base</a>";
+} 
+
+print TABLE " <a href=\"../$dirLinux/xml/$locale.xml\">xml</a>)</th>\n";
+
+my $dirWin = "winxp";
+my $refWin = $dirWin."/".$locale."_default_raw.html";
+my $rawWin = $dirWin."/".$locale."_raw.html";
+my $nameWin = "$dirWin/$locale"."_collation.html";
+my $colorWin = "#98FB98";
+
+print TABLE "    <th bgcolor=\"$colorWin\">WINDOWS ("; 
+if (-e $nameWin) {
+   print TABLE "<a href=\"$rawWin\">Ordering</a> <a href=\"$refWin\">base</a> ";
+} 
+print TABLE "<a href=\"../windows/xml/$locale.xml\">xml</a>)</th>\n";
+
+print TABLE "  </tr>\n  <tr>";
+
+
+readRules($nameCommon, "#AD989D", "Same as the UCA.");
+readRules($nameLinux, "#1191F1", "No data available.");      
+readRules($nameWin, "#98FB98", "No data available.");
+
+
+print TABLE <<"EndOfFooter";
+  </tr>
+</table>
+
+</body>
+</html>
+EndOfFooter
+
+
+sub readRules {
+  # readRules($file, $color)
+  my $filename  = shift;
+  my $color = shift;
+  my $comment = shift;
+  my $noLines = 0;
+  my $printOut = 0;
+
+  my $file;
+
+  if(-e $filename) {
+    open($file, "<$filename") || die "something very strange happened\n";
+    print TABLE "<td bgcolor=\"$color\">\n";
+    while (<$file>) {
+      if (/\}\<br\>$/) {
+        $printOut = 0;
+
+      }
+      if ($printOut) {
+        print TABLE $_;
+        $noLines++;
+      }
+      if (/Sequence/) {
+        $printOut = 1;
+        print "found sequence\n";
+        $noLines = 0;
+      }
+
+    }
+    if (!$noLines) {
+      print TABLE "Same ordering as base\n";
+    }
+    print TABLE "</td>\n";
+  } else {
+    print TABLE "<td bgcolor=\"$color\">\n$comment</td>\n";
+  }    
+}
+
+
+# Tasting of food product
+# 650-574-4551 $50 1 hour
+
+
+#     <td bgcolor="#AD989D">1.0-alpha</td>
+#     <td bgcolor="#FF6633">1.0</td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FF6633"><span title="006E {LATIN SMALL LETTER N}">&amp;n</span><br>
+#       <span title="006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&lt;&nbsp;ny</span><br>
+
+#       <span title="006E 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y} / 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;nny&nbsp;/&nbsp;ny</span><br>
+#       <span title="006E 0059 {LATIN SMALL LETTER N} {LATIN CAPITAL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&nbsp;nY</span><br>
+#     </td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FFFF33">1.2</td>
+
+#     <td bgcolor="#98FB98">Windows XP</td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FF6633">=</td>
diff --git a/trunk/colprobe/doComparisonTable.pl b/trunk/colprobe/doComparisonTable.pl
new file mode 100755
index 0000000..7a02ef3
--- /dev/null
+++ b/trunk/colprobe/doComparisonTable.pl
@@ -0,0 +1,209 @@
+#! /usr/bin/perl -w
+
+use strict;
+use IO::File;
+
+
+my $locale = $ARGV[0];
+
+
+my $long_name = `/home/weiv/src/icu/source/extra/colprobe/longname $locale`;
+print "Long name is $long_name\n";
+my $pageTitle = $locale." collation";
+my $filename = $locale.".html";
+
+open TABLE, ">$filename";
+
+
+print TABLE <<"EndOfTemplate";
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>$pageTitle</title>
+<style>
+         <!--
+         table        { border-spacing: 0; border-collapse: collapse; width: 100%; 
+               border: 1px solid black }
+td, th       { width: 10%; border-spacing: 0; border-collapse: collapse; color: black; 
+               vertical-align: top; border: 1px solid black }
+-->
+     </style>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p><b><font color="#FF0000">Collation:</font> $locale ($long_name) <a href="http://oss.software.ibm.com/cgi-bin/icu/lx/en/?_=$locale">Demo</a>, 
+
+<a href="../../comparison_charts.html">Cover 
+Page</a>, <a href="../main/index.html">Locale Diffs Index</a>, <a href="index.html">Collation Diffs Index</a></b></p>
+<table>
+  <tr>
+EndOfTemplate
+
+my $dirCommon = "icucollations";
+my $refCommon = $dirCommon."/UCARules.txt";
+my $nameCommon = $dirCommon."/".$locale."_collation.html";
+my $colorCommon = "#AD989D";
+
+my $loc = $locale;
+
+if(!(-e $nameCommon)) {
+  $locale =~ /_/;
+  $loc = $`;
+  $nameCommon = "$dirCommon/$loc"."_collation.html";
+}
+
+print "Common is $nameCommon\n";
+
+print TABLE "    <th bgcolor=\"$colorCommon\">COMMON (";
+if(-e $nameCommon) {
+  print TABLE "<a href=\"../../common/collation/$loc.xml\">xml</a> ";
+}
+print TABLE "<a href=\"../../common/collation/root.xml\">UCA</a>)</th>\n";
+
+my $dirLinux = "linuxcollations";
+my $refLinux = $dirLinux."/".$locale.".utf8_default_raw.html";
+my $rawLinux = $dirLinux."/".$locale.".utf8_raw.html";
+my $defLinux = $dirLinux."/".$locale;
+my $nameLinux = "$dirLinux/$locale"."_collation.html";
+my $colorLinux = "#1191F1";
+
+print TABLE "    <th bgcolor=\"$colorLinux\">LINUX";
+if (!(-e $nameLinux)) {
+#try the variant that has @euro stuck in
+  $nameLinux = "$dirLinux/$locale".'.utf8@euro_collation.html';
+  if(-e $nameLinux) {
+    $refLinux = $dirLinux."/".$locale.'.utf8@euro_default_raw.html';
+    $rawLinux = $dirLinux."/".$locale.'.utf8@euro_raw.html';
+  }
+}
+if (-e $nameLinux) {
+  print TABLE " (<a href=\"../../linux/collation/$locale.xml\">xml</a>";
+  my $linuxBase = &getBaseLocale("$dirLinux/base", $locale);
+  if($linuxBase ne "") {
+    print TABLE " <a href=\"../../linux/collation/$linuxBase.xml\">Base ($linuxBase)</a>";
+  }
+  print TABLE ")";
+} 
+print TABLE "</th>\n";
+
+
+my $dirWin = "w2kcollations";
+my $refWin = $dirWin."/".$locale."_default_raw.html";
+my $rawWin = $dirWin."/".$locale."_raw.html";
+my $nameWin = "$dirWin/$locale"."_collation.html";
+my $colorWin = "#98FB98";
+$loc = $locale;
+#try fallback for windows
+print TABLE "    <th bgcolor=\"$colorWin\">WINDOWS"; 
+if(!(-e $nameWin)) {
+  $locale =~ /_/;
+  $loc = $`;
+  $nameWin = "$dirWin/$loc"."_collation.html";
+}
+
+print "Windows loc is $loc\n";
+
+if (-e $nameWin) {
+  print TABLE " (<a href=\"../../windows/collation/$loc.xml\">xml</a>";
+  my $winBase = &getBaseLocale("$dirWin/base", $locale);
+  if($winBase ne "") {
+    print TABLE "<a href=\"../../windows/collation/$winBase.xml\">base ($winBase)</a>";
+  }
+  print TABLE ")";
+} 
+print TABLE "</th>\n";
+print TABLE "  </tr>\n  <tr>";
+
+
+readRules($nameCommon, "#AD989D", "Same as the UCA.");
+readRules($nameLinux, "#1191F1", "No data available.");      
+readRules($nameWin, "#98FB98", "No data available.");
+
+
+print TABLE <<"EndOfFooter";
+  </tr>
+</table>
+
+</body>
+</html>
+EndOfFooter
+
+
+sub readRules {
+  # readRules($file, $color)
+  my $filename  = shift;
+  my $color = shift;
+  my $comment = shift;
+  my $noLines = 0;
+  my $printOut = 0;
+
+  my $file;
+
+  if(-e $filename) {
+    open($file, "<$filename") || die "something very strange happened\n";
+    print TABLE "<td bgcolor=\"$color\">\n";
+    while (<$file>) {
+      if (/\}\<br\>$/) {
+        $printOut = 0;
+
+      }
+      if ($printOut) {
+        if(!/^$/ && !/&nbsp;<br>$/) {
+          print TABLE $_;
+          $noLines++;
+        }
+      }
+      if (/Sequence/) {
+        $printOut = 1;
+        print "found sequence\n";
+        $noLines = 0;
+      }
+
+    }
+    if (!$noLines) {
+      print TABLE "Same ordering as base\n";
+    }
+    print TABLE "</td>\n";
+  } else {
+    print TABLE "<td bgcolor=\"$color\">\n$comment</td>\n";
+  }    
+}
+
+sub getBaseLocale(){
+    my $basefile = shift;
+    my $locale = shift;
+    my $baseFH = IO::File->new($basefile,"r")
+            or die  "could not open the file $basefile for reading: $! \n";
+    my $bse;
+    my $loc;
+    while(defined ( my $line = <$baseFH>)){
+        if( $line =~ /\<$locale\>/){
+            ($loc,$bse) = split (/\>/, $line);
+             $bse =~ s/^\s+\<//;
+             return $bse;
+        }
+    }
+}
+
+
+# Tasting of food product
+# 650-574-4551 $50 1 hour
+
+
+#     <td bgcolor="#AD989D">1.0-alpha</td>
+#     <td bgcolor="#FF6633">1.0</td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FF6633"><span title="006E {LATIN SMALL LETTER N}">&amp;n</span><br>
+#       <span title="006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&lt;&nbsp;ny</span><br>
+
+#       <span title="006E 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y} / 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;nny&nbsp;/&nbsp;ny</span><br>
+#       <span title="006E 0059 {LATIN SMALL LETTER N} {LATIN CAPITAL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&nbsp;nY</span><br>
+#     </td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FFFF33">1.2</td>
+
+#     <td bgcolor="#98FB98">Windows XP</td>
+#     <td bgcolor="#FF6633">=</td>
+#     <td bgcolor="#FF6633">=</td>
diff --git a/trunk/colprobe/extractCollationData.pl b/trunk/colprobe/extractCollationData.pl
new file mode 100755
index 0000000..f7079be
--- /dev/null
+++ b/trunk/colprobe/extractCollationData.pl
@@ -0,0 +1,246 @@
+#!/usr/bin/perl
+
+use strict;
+use Unicode::UCD 'charinfo';
+use Unicode::Normalize;
+use utf8;
+use open ':utf8';
+
+my $printout = 0;
+my $braces = 0;
+my $colls = 0;
+my $aliased = 0;
+my $newName = "";
+my $filename;
+my $suffix;
+my $locale;
+
+NEW_FILE:
+foreach my $arg (@ARGV) {
+  if($newName =~ /^$/) {
+    $locale = $arg;
+    $locale =~ s#^.*/##g;
+    $locale =~ s/\.txt//;
+  } else {
+    $newName = "";
+  }
+  my $command = "/home/weiv/build/current/bin/uconv -x hex-any/Java -f utf8 -t utf8 $arg";
+  print $command."\n";
+  my @bundle = `$command`;
+  foreach $_ (@bundle) {
+ #while(<>) {
+   #print $ARGV if eof;
+   if(/^\/\//) {
+     next;
+   }
+   if(/collations/) {
+     print "found Collations\n";
+     $colls = 1;
+     if(/alias/) {
+       print "collations are aliased\n";
+       $aliased = 1;
+     }
+   }
+   if($aliased) {
+     print "processing aliased data: $_\n";
+     if(/\{/) {
+       print "Braces opened\n";
+       $braces = 1;
+     }
+     if($braces && /\"(.*)\"/) {
+       $newName = $1;
+       print "Aliasing to $newName\n";
+     }
+     if($braces && /\}/) {
+       $braces = 0;
+       print "Braces closed\n";
+       $aliased = 0;
+       print "Switching from $filename to $newName\n";
+       $arg =~ s/$locale\.txt$/$newName\.txt/;
+       print "$arg\n";
+       redo NEW_FILE;
+     }
+
+   }
+   if(/standard|phonebook|traditional|pinyin|stroke|direct/ && $colls) {
+     print "found $& collation\n";
+     $suffix = "_".uc($&);
+     if(/standard/) {
+       $suffix = "";
+     }
+   }
+   if(/Sequence/ && $colls) {
+     #binmode ARGV, ":utf8";
+     $printout = 1;
+     #$filename = $ARGV;
+     $filename = $locale;
+     if($suffix) {
+       $filename .= "_".$suffix;
+     }
+     $filename .= "_collation.html";
+     print "filename is $filename\n";
+     #open(OUT, ">:utf8", "$filename");
+     open(OUT, ">$filename");
+     printHeading($arg);
+     #next;
+   }
+   my $line = $_;
+   if($line =~ /\{/ && $printout) {
+     $braces++;
+   }
+   if($printout) {
+     print OUT processLine($line);
+     print OUT "\n";
+   }
+   if( $line =~ /\}/ && $printout) {
+     $braces--;
+     if($braces == 0) {
+       $printout = 0;
+       printFooting();
+       close(OUT);
+     }
+   }
+ } 
+}
+
+sub processLine {
+  my $line = shift;
+  $_ = $line;
+  my $i = 0;
+  my $j = 0;
+  my $result;
+# remove comments
+  s#//.*$##g;
+# remove "Sequence" if present
+  s/Sequence\s*//;
+# remove leading brace if present
+  s/^\s*{//;
+# remove trailing brace if present
+  s/}\s*$//;
+# remove trailing quote
+  s/"\s*$//;
+#remove lead quote
+  s/^\s*"//;
+#separate options
+  s/(\[.*\])/\n\1/g;
+#separate resets
+  s/\s*\&\s*/\n\& /g;
+#separate strengths and insert spaces
+  s/\s*(<{1,4})\s*/\n\1 /g;
+#separate equals and insert spaces
+  s/\s*=\s*/\n= /g;
+
+# break into individual reset/strength/setting lines
+  my @lines = split(/\n/);
+
+  my $line;
+  my $name;
+  my $spanEnd = "";
+  my $result = "";
+  my $names = "";
+  my $codes = "";
+  my $lrm = "";
+
+  foreach $line (@lines) {
+    # skip empty lines
+    if($line =~ /^$/) {
+      next;
+    }
+    $spanEnd = "";
+    $name = "";
+    $lrm = "";
+    $line = NFC($line);
+    # for resets and strengths we will get name for elements
+    if($line =~ /<{1,4} |= |& \[.*\]|& /) {
+      $name = "<span title=\"";
+      $names = "";
+      $codes = "";
+      my $start = $&;
+      my $rest = $';
+      for ($j = 0; $j < length($rest); $j++) {
+	my $char = substr($rest, $j, 1);
+	my $charVal = ord($char);
+	# some of elements are part of the syntax, so they are
+	# entered without translation to the name
+	if($charVal == 0x002F || $charVal == 0x007C) {
+	  $name .= $codes.$names." $char ";
+	  $codes = "";
+	  $names = "";
+	} elsif($charVal == 0x0027) { #quote requires more processing
+	  #$name .= "'";
+	} else {
+	  my $charinfo = charinfo($charVal);
+	  $codes .= $charinfo->{'code'}." ";
+	  $names .= "{".$charinfo->{'name'}."} ";
+          if($charinfo->{'bidi'} eq "R" || $charinfo->{'bidi'} eq "AL") {
+            $lrm = "&lrm;";
+          }
+	  #$name .= $charinfo->{'code'}." {".$charinfo->{'name'}."} ";
+	}
+      }
+      $name .= $codes.$names."\" >";
+      $spanEnd = "</span>";
+    }
+    #print $name."\n";
+    if($line =~ /^<<<</) {
+      $line = "    $line";
+    } elsif($line =~ /^<<</) {
+      $line = "   $line";
+    } elsif($line =~ /^<</) {
+      $line = "  $line";
+    } elsif($line =~ /^</) {
+      $line = " $line";
+    } elsif($line =~ /^=/) {
+      $line = "    $line";
+    }
+    # insert spaces around vertical bars (fix prefixes)
+
+    # insert spaces around slashes (fix expansions)
+    $line =~ s#/# / #g;
+    # replace &
+    $line =~ s/\&/&amp;/g;
+    # replace spaces
+    $line =~ s/ /&nbsp;/g;
+    # replace <
+    $line =~ s/</&lt;/g;
+    # replace >
+    $line =~ s/>/&gt;/g;
+
+    #$lines[$i] = $name.$lrm.$line."</span><br>"; 
+    #$i++;
+    $result .=  $name.$lrm.$line.$spanEnd."<br>\n";
+  }
+
+  #$_ = join("\n", @lines);
+  return $result;
+
+}
+ 
+sub printHeading {
+my $filename = shift;
+$filename =~ s/\.txt//;
+print OUT <<"EndOfHeading";
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+# Collation data resource bundle generated for locale: $filename<br>
+# For platform icu reference platform UCA<br><br>
+
+
+$filename&nbsp;{<br>
+&nbsp;&nbsp;CollationElements&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Sequence&nbsp;{<br>
+EndOfHeading
+}
+
+sub printFooting {
+print OUT <<"EndOfFooting";
+&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;}<br>
+}<br>
+
+</pre>
+</html>
+EndOfFooting
+}
diff --git a/trunk/colprobe/gcd2.pl b/trunk/colprobe/gcd2.pl
new file mode 100755
index 0000000..c8e5f87
--- /dev/null
+++ b/trunk/colprobe/gcd2.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+#my $localeMinusA = `locale -a`;
+my $localeMinusA = `cat ~/src/icu/source/extra/colprobe/locale.txt`;
+my @locales = split(/\n/, $localeMinusA);
+my $locale;
+my $command;
+
+my $platform = $ARGV[0];
+
+mkdir $platform."logs2";
+mkdir $platform;
+
+foreach $locale (@locales) {
+  $command = "~/src/icu/source/extra/colprobe/colprobe --platform $platform --ref $platform --diff $locale >$platform"."logs2/$locale"."Log.txt 2>&1";
+  ($locale, $_) = split(/\./, $locale);
+  $command .= "; cp /usr/share/i18n/locales/$locale $platform/";
+  print "$command\n";
+  `$command`;
+  #chdir "..";
+
+}
diff --git a/trunk/colprobe/genCollData.pl b/trunk/colprobe/genCollData.pl
new file mode 100755
index 0000000..2f46184
--- /dev/null
+++ b/trunk/colprobe/genCollData.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $localeMinusA = `locale -a`;
+my @locales = split(/\n/, $localeMinusA);
+my $locale;
+my $command;
+
+my $platform = $ARGV[0];
+
+mkdir $platform."logs";
+mkdir $platform;
+
+foreach $locale (@locales) {
+  $command = "~/src/icu/source/extra/colprobe/colprobe --output resb --platform linux --ref linux $locale >$platform"."logs/$locale"."Log.txt 2>&1";
+  ($locale, $_) = split(/\./, $locale);
+  $command .= "; cp /usr/share/i18n/locales/$locale $platform/";
+  print "$command\n";
+  `$command`;
+  #chdir "..";
+
+}
diff --git a/trunk/colprobe/line.cpp b/trunk/colprobe/line.cpp
new file mode 100644
index 0000000..d8829d9
--- /dev/null
+++ b/trunk/colprobe/line.cpp
@@ -0,0 +1,701 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File line.cpp
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+#include "line.h"
+#include <stdio.h>
+
+UnicodeSet * Line::needsQuoting = NULL;
+
+void
+Line::init()
+{
+        len = 0;
+        expLen = 0;
+        strength = UCOL_OFF;
+        strengthFromEmpty = UCOL_OFF;
+        cumulativeStrength = UCOL_OFF;
+        expStrength = UCOL_OFF;
+        previous = NULL;
+        next = NULL;
+        left = NULL;
+        right = NULL;
+        isContraction = FALSE;
+        isExpansion = FALSE;
+        isRemoved = FALSE;
+        isReset = FALSE;
+        expIndex = 0;
+        firstCC = 0;
+        lastCC = 0;
+        sortKey = NULL;
+}
+
+Line::Line()
+{
+  init();
+  memset(name, 0, 25*sizeof(UChar));
+  memset(expansionString, 0, 25*sizeof(UChar));
+}
+
+Line::Line(const UChar* name, int32_t len)
+{
+  init();
+  this->len = len;
+  u_memcpy(this->name, name, len);
+  memset(expansionString, 0, 25*sizeof(UChar));
+  UChar32 c;
+  U16_GET(name, 0, 0, len, c);
+  firstCC = u_getCombiningClass(c);
+  U16_GET(name, 0, len-1, len, c);
+  lastCC = u_getCombiningClass(c);
+}
+
+Line::Line(const UChar name)
+{
+    init();
+    len = 1;
+    this->name[0] = name;
+    this->name[1] = 0;
+  memset(expansionString, 0, 25*sizeof(UChar));
+  firstCC = u_getCombiningClass(name);
+  lastCC = firstCC;
+}
+
+Line::Line(const UnicodeString &string)
+{
+  init();
+  setTo(string);
+}
+
+Line::Line(const char *buff, int32_t buffLen, UErrorCode &status) :
+previous(NULL),
+next(NULL),
+left(NULL),
+right(NULL)
+{
+  initFromString(buff, buffLen, status);
+}
+
+Line::Line(const Line &other) :
+  previous(NULL),
+  next(NULL),
+left(NULL),
+right(NULL)
+{
+  *this = other;
+}
+         
+Line &
+Line::operator=(const Line &other) {
+  len = other.len;
+  expLen = other.expLen;
+  strength = other.strength;
+  strengthFromEmpty = other.strengthFromEmpty;
+  cumulativeStrength = other.cumulativeStrength;
+  expStrength = other.expStrength;
+  isContraction = other.isContraction;
+  isExpansion = other.isExpansion;
+  isRemoved = other.isRemoved;
+  isReset = other.isReset;
+  expIndex = other.expIndex;
+  firstCC = other.firstCC;
+  lastCC = other.lastCC;
+  u_strcpy(name, other.name);
+  u_strcpy(expansionString, other.expansionString);
+  sortKey = other.sortKey;
+  left = other.left;
+  right = other.right;
+  return *this;
+}
+
+UBool 
+Line::operator==(const Line &other) const {
+  if(this == &other) {
+    return TRUE;
+  }
+  if(len != other.len) {
+    return FALSE;
+  }
+  if(u_strcmp(name, other.name) != 0) {
+    return FALSE;
+  }
+  return TRUE;
+}
+
+UBool 
+Line::equals(const Line &other) const {
+  if(this == &other) {
+    return TRUE;
+  }
+  if(len != other.len) {
+    return FALSE;
+  }
+  if(u_strcmp(name, other.name) != 0) {
+    return FALSE;
+  }
+  if(strength != other.strength) {
+    return FALSE;
+  }
+  if(expLen != other.expLen) {
+    return FALSE;
+  }
+  if(u_strcmp(expansionString, other.expansionString)) {
+    return FALSE;
+  }
+  return TRUE;
+}
+
+UBool
+Line::operator!=(const Line &other) const {
+  return !(*this == other);
+}
+
+
+Line::~Line() {
+}
+
+void
+Line::copyArray(Line *dest, const Line *src, int32_t size) {
+  int32_t i = 0;
+  for(i = 0; i < size; i++) {
+    dest[i] = src[i];
+  }
+}
+
+void
+Line::setName(const UChar* name, int32_t len) {
+  this->len = len;
+  u_memcpy(this->name, name, len);
+  UChar32 c;
+  U16_GET(name, 0, 0, len, c);
+  firstCC = u_getCombiningClass(c);
+  U16_GET(name, 0, len-1, len, c);
+  lastCC = u_getCombiningClass(c);
+}
+
+void 
+Line::setToConcat(const Line *first, const Line *second) {
+  u_strcpy(name, first->name);
+  u_strcat(name, second->name);
+  len = first->len + second->len;
+  firstCC = first->firstCC;
+  lastCC = second->lastCC;
+}
+
+UnicodeString
+Line::stringToName(UChar *string, int32_t len) {
+  UErrorCode status = U_ZERO_ERROR;
+  UnicodeString result;
+  char buffer[256];
+  int32_t i = 0;
+  UChar32 c; 
+  while(i < len) {
+    U16_NEXT(string, i, len, c);
+    if(c < 0x10000) {
+      sprintf(buffer, "%04X ", c);
+    } else {
+      sprintf(buffer, "%06X ", c);
+    }
+    result.append(buffer);
+  }
+  i = 0;
+  while(i < len) {
+    U16_NEXT(string, i, len, c);
+    u_charName(c, U_EXTENDED_CHAR_NAME, buffer, 256, &status);
+    result.append("{");
+    result.append(buffer);
+    result.append("} ");
+  }
+/*
+  for(i = 0; i < len; i++) {
+    sprintf(buffer, "%04X ", string[i]);
+    result.append(buffer);
+  }
+  for(i = 0; i < len; i++) {
+    u_charName(string[i], U_EXTENDED_CHAR_NAME, buffer, 256, &status);
+    result.append("{");
+    result.append(buffer);
+    result.append("} ");
+  }
+*/  
+  return result;
+}
+
+UnicodeString
+Line::toBundleString() 
+{
+
+  UnicodeString result;
+  UErrorCode status = U_ZERO_ERROR;
+  if(!needsQuoting) {
+    needsQuoting = new UnicodeSet("[[:whitespace:][:c:][:z:][[:ascii:]-[a-zA-Z0-9]]]", status);
+  }
+  UChar NFC[50];
+  int32_t NFCLen = unorm_normalize(name, len, UNORM_NFC, 0, NFC, 50, &status);
+  result.append("\"");
+  if(isReset) {
+    result.append("&");
+  } else {
+    result.append(strengthToString(strength, FALSE, FALSE));
+  }
+  UBool quote = needsQuoting->containsSome(name) || needsQuoting->containsSome(NFC);
+  if(quote) {
+    result.append("'");
+  }
+  if(NFC[0] == 0x22) {
+    result.append("\\u0022");
+  } else {
+    result.append(NFC, NFCLen);
+  }
+  if(quote && NFC[0] != 0x0027) {
+    result.append("'");
+  }
+  if(expLen && !isReset) {
+    quote = needsQuoting->containsSome(expansionString);
+    result.append(" / ");
+    if(quote) {
+      result.append("'");
+    }
+    result.append(expansionString);
+    if(quote) {
+      result.append("'");
+    }
+  }
+  result.append("\" //");
+
+  result.append(stringToName(NFC, NFCLen));
+  if(expLen && !isReset) {
+    result.append(" / ");
+    result.append(stringToName(expansionString, expLen));
+  }
+  result.append("\n");
+  return result;
+}
+
+UnicodeString
+Line::toHTMLString() 
+{
+  UnicodeString result;
+  UErrorCode status = U_ZERO_ERROR;
+  UChar NFC[50];
+  int32_t NFCLen = unorm_normalize(name, len, UNORM_NFC, 0, NFC, 50, &status);
+  result.append("<span title=\"");
+  result.append(stringToName(NFC, NFCLen));
+  if(expLen && !isReset) {
+    result.append(" / ");
+    result.append(stringToName(expansionString, expLen));
+  }
+  result.append("\">");
+  if(isReset) {
+    result.append("&amp;");
+  } else {
+    result.append(strengthToString(strength, FALSE, TRUE));
+  }
+  result.append(NFC, NFCLen);
+  if(expLen && !isReset) {
+    result.append("&nbsp;/&nbsp;");
+    result.append(expansionString);
+  }
+  result.append("</span><br>\n");
+  return result;
+}
+
+UnicodeString
+Line::toString(UBool pretty) {
+  UnicodeString result;
+  if(!pretty) {
+    result.setTo(name);
+    if(expLen) {
+      result.append("/");
+      result.append(expansionString);
+    }
+  } else {
+    UErrorCode status = U_ZERO_ERROR;
+    UChar NFC[50];
+    int32_t NFCLen = unorm_normalize(name, len, UNORM_NFC, 0, NFC, 50, &status);
+    result.setTo(NFC, NFCLen);
+    if(expLen) {
+      result.append("/");
+      result.append(expansionString);
+    }
+    /*
+    if(NFCLen != len || u_strncmp(name, NFC, len) != 0) {
+      result.append("(NFC: ");
+      result.append(NFC, NFCLen);
+      result.append(stringToName(NFC, NFCLen));
+      result.append(")");
+    }
+    */
+    result.append("    # ");
+    result.append(stringToName(NFC, NFCLen));
+    if(expLen) {
+      result.append("/ ");
+      result.append(stringToName(expansionString, expLen));
+    }
+  }
+  return result;
+}
+
+
+void
+Line::setTo(const UnicodeString &string) {
+  int32_t len = string.length();
+  u_strncpy(name, string.getBuffer(), len);
+  name[len] = 0;
+  this->len = len;
+  UChar32 c;
+  U16_GET(name, 0, 0, len, c);
+  firstCC = u_getCombiningClass(c);
+  U16_GET(name, 0, len-1, len, c);
+  lastCC = u_getCombiningClass(c);
+}
+
+void 
+Line::setTo(const UChar32 n) {
+  UBool isError = FALSE;
+  len = 0; // we are setting the line to char, not appending
+  U16_APPEND(name, len, 25, n, isError);
+  name[len] = 0;
+  firstCC = u_getCombiningClass(n);
+  lastCC = firstCC;
+}
+
+
+UnicodeString
+Line::strengthIndent(UColAttributeValue strength, int indentSize, UnicodeString &result) 
+{
+  int i;
+  int numIndents = strength+1;
+  if(strength > UCOL_IDENTICAL) {
+    return result;
+  } else if(strength == UCOL_IDENTICAL) {
+    numIndents = 5;
+  }
+  for(i = 0; i < numIndents*indentSize; i++) {
+    result.append(" ");
+  }
+  return result;
+}
+
+UnicodeString 
+Line::strengthToString(UColAttributeValue strength, UBool pretty, UBool html) {
+  UnicodeString result;
+  if(html) {
+    switch(strength) {
+    case UCOL_IDENTICAL:
+      result.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;");
+      break;
+    case UCOL_QUATERNARY:
+      result.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&lt;&nbsp;");
+      break;
+    case UCOL_TERTIARY:
+      result.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&nbsp;");
+      break;
+    case UCOL_SECONDARY:
+      result.append("&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;");
+      break;
+    case UCOL_PRIMARY:
+      result.append("&nbsp;&nbsp;&lt;&nbsp;");
+      break;
+    case UCOL_OFF:
+      result.append("&nbsp;&gt;?&nbsp;");
+      break;
+    default:
+      result.append("&nbsp;?!&nbsp;");
+      break;
+    }
+  } else {
+    switch(strength) {
+    case UCOL_IDENTICAL:
+      if(pretty) {
+        result.append("        ");
+      }
+      result.append(" = ");
+      break;
+    case UCOL_QUATERNARY:
+      if(pretty) {
+        result.append("        ");
+      }
+      result.append(" <<<< ");
+      break;
+    case UCOL_TERTIARY:
+      //u_fprintf(file, "<3");
+      if(pretty) {
+        result.append("      ");
+      }
+      result.append(" <<< ");
+      break;
+    case UCOL_SECONDARY:
+      //u_fprintf(file, "<2");
+      if(pretty) {
+        result.append("    ");
+      }
+      result.append(" << ");
+      break;
+    case UCOL_PRIMARY:
+      //u_fprintf(file, "<1");
+      if(pretty) {
+        result.append("  ");
+      }
+      result.append(" < ");
+      break;
+    case UCOL_OFF:
+      result.append(" >? ");
+      break;
+    default:
+      result.append(" ?! ");
+      break;
+    }
+  }
+  return result;
+}
+
+Line *
+Line::nextInteresting() {
+  Line *result = this->next;
+  while(result && result->strength != UCOL_IDENTICAL) {
+    result = result->next;
+  }
+  return result;
+}
+
+void
+Line::append(const UChar* n, int32_t length) 
+{
+  u_strncat(name, n, length);
+  name[len+length] = 0;
+  len += length;
+  UChar32 end;
+  U16_GET(n, 0, length-1, length, end);
+  lastCC = u_getCombiningClass(end);
+}
+
+void
+Line::append(const UChar n) 
+{
+  name[len] = n;
+  name[len+1] = 0;
+  len++;
+  lastCC = u_getCombiningClass(n);
+}
+
+void
+Line::append(const Line &l)
+{
+  append(l.name, l.len);
+  lastCC = l.lastCC;
+}
+
+void
+Line::clear()
+{
+  name[0] = 0;
+  len = 0;
+}
+
+int32_t
+Line::write(char *buff, int32_t, UErrorCode &) 
+{
+  /*
+    UChar     name[25];
+    int32_t   len;
+    UChar     expansionString[25];
+    int32_t   expLen;
+
+    UColAttributeValue strength;
+    UColAttributeValue strengthFromEmpty;
+    UColAttributeValue cumulativeStrength;
+    UColAttributeValue expStrength;
+
+    Line *previous;
+    Line *next;
+
+    UBool   isContraction;
+    UBool   isExpansion;
+    UBool   isRemoved;
+    UBool   isReset;
+
+    int32_t expIndex;
+    uint8_t firstCC;
+    uint8_t lastCC;
+*/
+  int32_t resLen = 0;
+  int32_t i = 0;
+  sprintf(buff+resLen, "%04X", name[0]);
+  resLen += 4;
+  for(i = 1; i < len; i++) {
+    sprintf(buff+resLen, " %04X", name[i]);
+    resLen += 5;
+  }
+  sprintf(buff+resLen, "/");
+  resLen += 1;
+
+  i = 0;
+  if(expLen) {
+    sprintf(buff+resLen, "%04X", expansionString[0]);
+    resLen += 4;
+    for(i = 1; i < expLen; i++) {
+      sprintf(buff+resLen, " %04X", expansionString[i]);
+      resLen += 5;
+    }
+  }
+  sprintf(buff+resLen, "; ");
+  resLen += 2;
+
+  sprintf(buff+resLen, "%02i ", strength);
+  resLen += 3;
+  sprintf(buff+resLen, "%02i", strengthFromEmpty);
+  resLen += 2;
+  sprintf(buff+resLen, "%02i", cumulativeStrength);
+  resLen += 2;
+  sprintf(buff+resLen, "%02i", expStrength);
+  resLen += 2;
+
+  // Various flags. The only interesting ones are isReset and isRemoved. We will not output removed lines
+  //sprintf(buff+resLen, "%1i%1i%1i%1i ", isContraction, isExpansion, isRemoved, isReset);
+  //resLen += 5;
+  sprintf(buff+resLen, "%1i%1i ", isRemoved, isReset);
+  resLen += 3;
+
+  // first and last CC
+  // can be calculated on reading
+  //sprintf(buff+resLen, "%03i %03i ", firstCC, lastCC);
+  //resLen += 8;
+
+  sprintf(buff+resLen, "%08X", expIndex);
+  resLen += 8;
+
+  buff[resLen] = 0;
+
+  return resLen;
+}
+
+void
+Line::initFromString(const char *buff, int32_t, UErrorCode &)
+{
+  int32_t bufIndex = 0;
+  int32_t i = 0;
+
+  sscanf(buff+bufIndex, "%04X", &name[i]);
+  i++;
+  bufIndex += 4;
+  while(buff[bufIndex] != '/') {
+    sscanf(buff+bufIndex, " %04X", &name[i]);
+    i++;
+    bufIndex += 5;
+  }
+  len = i;
+  name[len] = 0;
+  bufIndex++;
+
+  if(i > 1) {
+    isContraction = TRUE;
+  } else {
+    isContraction = FALSE;
+  }
+
+  if(buff[bufIndex] == ';') {
+    isExpansion = FALSE;
+    bufIndex += 2;
+    expansionString[0] = 0;
+    expLen = 0;
+  } else {
+    i = 0;
+    sscanf(buff+bufIndex, "%04X", &expansionString[i]);
+    i++;
+    bufIndex += 4;
+    while(buff[bufIndex] != ';') {
+      sscanf(buff+bufIndex, " %04X", &expansionString[i]);
+      i++;
+      bufIndex += 5;
+    }
+    expLen = i;
+    expansionString[expLen] = 0;
+    bufIndex += 2;
+  }
+  sscanf(buff+bufIndex, "%02i ", &strength);
+  bufIndex += 3;
+  sscanf(buff+bufIndex, "%02i", &strengthFromEmpty);
+  bufIndex += 2;
+  sscanf(buff+bufIndex, "%02i", &cumulativeStrength);
+  bufIndex += 2;
+  sscanf(buff+bufIndex, "%02i", &expStrength);
+  bufIndex += 2;
+
+  sscanf(buff+bufIndex, "%1i%1i ", &isRemoved, &isReset);
+  bufIndex += 3;
+
+  sscanf(buff+bufIndex, "%08X", &expIndex);
+  bufIndex += 8;
+
+  // calculate first and last CC
+  UChar32 c;
+  U16_GET(name, 0, 0, len, c);
+  firstCC = u_getCombiningClass(c);
+  U16_GET(name, 0, len-1, len, c);
+  lastCC = u_getCombiningClass(c);
+}
+
+void
+Line::swapCase(UChar *string, int32_t &sLen)
+{
+  UChar32 c = 0;
+  int32_t i = 0, j = 0;
+  UChar buff[256];
+  UBool isError = FALSE;
+  while(i < sLen) {
+    U16_NEXT(string, i, sLen, c);
+    if(u_isUUppercase(c)) {
+      c = u_tolower(c);
+    } else if(u_isULowercase(c)) {
+      c = u_toupper(c);
+    }
+    U16_APPEND(buff, j, 256, c, isError);
+  }
+  buff[j] = 0;
+  u_strcpy(string, buff);
+  sLen = j;
+}
+
+
+void
+Line::swapCase()
+{
+  swapCase(name, len);
+  swapCase(expansionString, expLen);
+}
+
+UnicodeString
+Line::dumpSortkey() 
+{
+
+  char buffer[256];
+  char *buff = buffer;
+  *buff = 0;
+  uint8_t *key = sortKey;
+  if(sortKey) {
+    while(*key) {
+      sprintf(buff, "%02X ", *key);
+      key++;
+      buff += 3;
+      if(buff - buffer > 252) {
+        break;
+      }
+    }
+  }
+  return UnicodeString(buffer);
+}
+
diff --git a/trunk/colprobe/line.h b/trunk/colprobe/line.h
new file mode 100644
index 0000000..31ce204
--- /dev/null
+++ b/trunk/colprobe/line.h
@@ -0,0 +1,113 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File line.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+//
+//   class Line
+//
+//      Each line from the source file (containing a name, presumably) gets
+//      one of these structs.
+//
+
+#ifndef COLPROBE_LINE_H
+#define COLPROBE_LINE_H
+#include "unicode/utypes.h"
+#include "unicode/ucol.h"
+#include "unicode/ustring.h"
+#include "unicode/unistr.h"
+#include "unicode/uchar.h"
+#include "unicode/uniset.h"
+#include "colprobe.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static const int MAX_EXPANSION_PREFIXES = 10;
+
+class  Line {
+public:
+  static void copyArray(Line *dest, const Line *src, int32_t size);
+  Line();
+  Line(const Line &other);
+  Line(const UChar* name, int32_t len);
+  Line(const UnicodeString &string);
+  Line(const UChar name);
+  Line(const char *buff, int32_t buffLen, UErrorCode &status);
+  ~Line();
+  Line & operator=(const Line &other);
+  UBool operator==(const Line &other) const;
+  UBool operator!=(const Line &other) const;
+  void setToConcat(const Line *first, const Line *second);
+  void setName(const UChar* name, int32_t len);
+  UnicodeString toString(UBool pretty = FALSE);
+  UnicodeString toBundleString();
+  UnicodeString toHTMLString();
+  int32_t write(char *buff, int32_t buffLen, UErrorCode &status);
+  void initFromString(const char *buff, int32_t buffLen, UErrorCode &status);
+  
+
+  UnicodeString strengthIndent(UColAttributeValue strength, int indentSize, UnicodeString &result);
+  UnicodeString strengthToString(UColAttributeValue strength, UBool pretty, UBool html = FALSE);
+  UnicodeString stringToName(UChar *string, int32_t len);
+  void setTo(const UnicodeString &string);
+  void setTo(const UChar32 n);
+  UBool equals(const Line &other) const;
+  Line *nextInteresting();
+  void append(const UChar n);
+  void append(const UChar* n, int32_t length);
+  void append(const Line &l);
+  void clear();
+  void swapCase();
+  void swapCase(UChar *string, int32_t &sLen);
+  UnicodeString dumpSortkey();
+  void init();
+
+  
+public:
+    UChar     name[25];
+    int32_t   len;
+    UChar     expansionString[25];
+    int32_t   expLen;
+
+    UColAttributeValue strength;
+    UColAttributeValue strengthFromEmpty;
+    UColAttributeValue cumulativeStrength;
+    UColAttributeValue expStrength;
+
+    Line *previous;
+    Line *next;
+
+    // In case this element is a contraction
+    // we keep a pointer at which lines were components
+    Line *left;
+    Line *right;
+
+    UBool   isContraction;
+    UBool   isExpansion;
+    UBool   isRemoved;
+    UBool   isReset;
+
+    int32_t expIndex;
+    uint8_t firstCC;
+    uint8_t lastCC;
+
+    uint8_t   *sortKey;
+public:
+  static UnicodeSet *needsQuoting;
+};
+
+
+#endif //COLPROBE_LINE_H
diff --git a/trunk/colprobe/locale.txt b/trunk/colprobe/locale.txt
new file mode 100644
index 0000000..324ab56
--- /dev/null
+++ b/trunk/colprobe/locale.txt
@@ -0,0 +1,241 @@
+af
+af_ZA
+am
+am_ET
+ar
+ar_AE
+ar_BH
+ar_DZ
+ar_EG
+ar_IN
+ar_IQ
+ar_JO
+ar_KW
+ar_LB
+ar_LY
+ar_MA
+ar_OM
+ar_QA
+ar_SA
+ar_SD
+ar_SY
+ar_TN
+ar_YE
+be
+be_BY
+bg
+bg_BG
+bn
+bn_IN
+ca
+ca_ES
+#ca_ES_PREEURO
+cs
+cs_CZ
+da
+da_DK
+de
+de_AT
+#de_AT_PREEURO
+de_BE
+de_CH
+de_DE
+#de_DE_PREEURO
+de_LU
+#de_LU_PREEURO
+de__PHONEBOOK
+el
+el_GR
+#el_GR_PREEURO
+en
+en_AU
+en_BE
+#en_BE_PREEURO
+en_BW
+en_CA
+en_GB
+#en_GB_EURO
+en_HK
+en_IE
+#en_IE_PREEURO
+en_IN
+en_MT
+en_NZ
+en_PH
+en_SG
+en_US
+en_US_POSIX
+en_VI
+en_ZA
+en_ZW
+eo
+es
+es_AR
+es_BO
+es_CL
+es_CO
+es_CR
+es_DO
+es_EC
+es_ES
+#es_ES_PREEURO
+es_GT
+es_HN
+es_MX
+es_NI
+es_PA
+es_PE
+es_PR
+es_PY
+es_SV
+es_US
+es_UY
+es_VE
+es__TRADITIONAL
+et
+et_EE
+eu
+eu_ES
+#eu_ES_PREEURO
+fa
+fa_AF
+fa_IR
+fi
+fi_FI
+#fi_FI_PREEURO
+fo
+fo_FO
+fr
+fr_BE
+#fr_BE_PREEURO
+fr_CA
+fr_CH
+fr_FR
+#fr_FR_PREEURO
+fr_LU
+#fr_LU_PREEURO
+ga
+ga_IE
+#ga_IE_PREEURO
+gl
+gl_ES
+#gl_ES_PREEURO
+gu
+gu_IN
+gv
+gv_GB
+he
+he_IL
+hi
+hi_IN
+hi__DIRECT
+hr
+hr_HR
+hu
+hu_HU
+hy
+hy_AM
+hy_AM_REVISED
+id
+id_ID
+is
+is_IS
+it
+it_CH
+it_IT
+#it_IT_PREEURO
+ja
+ja_JP
+#ja_JP_TRADITIONAL
+kk_KZ
+kl
+kl_GL
+kn
+kn_IN
+ko
+ko_KR
+kok
+kok_IN
+kw
+kw_GB
+lt
+lt_LT
+lv
+lv_LV
+mk
+mk_MK
+mr
+mr_IN
+ms_MY
+mt
+mt_MT
+nb
+nb_NO
+nl
+nl_BE
+#nl_BE_PREEURO
+nl_NL
+#nl_NL_PREEURO
+nn
+nn_NO
+om
+om_ET
+om_KE
+pl
+pl_PL
+ps
+ps_AF
+pt
+pt_BR
+pt_PT
+#pt_PT_PREEURO
+ro
+ro_RO
+ru
+ru_RU
+ru_UA
+sh
+sh_YU
+sk
+sk_SK
+sl
+sl_SI
+so
+so_DJ
+so_ET
+so_KE
+so_SO
+sq
+sq_AL
+sr
+sr_YU
+sv
+sv_FI
+sv_SE
+sw
+sw_KE
+sw_TZ
+ta
+ta_IN
+te
+te_IN
+th
+th_TH
+#th_TH_TRADITIONAL
+ti
+ti_ER
+ti_ET
+tr
+tr_TR
+uk
+uk_UA
+vi
+vi_VN
+zh
+zh_CN
+zh_HK
+zh_MO
+zh_SG
+zh_TW
+zh_TW_STROKE
+zh__PINYIN
diff --git a/trunk/colprobe/longname.cpp b/trunk/colprobe/longname.cpp
new file mode 100644
index 0000000..71ba45d
--- /dev/null
+++ b/trunk/colprobe/longname.cpp
@@ -0,0 +1,48 @@
+#include "unicode/unistr.h"
+#include "unicode/locid.h"
+#include "unicode/ucnv.h"
+#include <stdio.h>
+
+int main(int argc,
+     char* argv[])
+{
+  UErrorCode status = U_ZERO_ERROR;
+  const char *loc = argv[1];
+  int32_t hasCountry;
+  UConverter *conv = ucnv_open("utf8", &status);
+
+  
+  UChar UBuffer[256];
+  int32_t uBufLen = 0;
+  char buffer[256];
+  int32_t bufLen = 0;
+
+  uBufLen = uloc_getDisplayLanguage(loc, "en", UBuffer, 256, &status);
+  bufLen = ucnv_fromUChars(conv, buffer, 256, UBuffer, uBufLen, &status);
+  //u_UCharsToChars(UBuffer,  buffer, uBufLen);
+  buffer[bufLen] = 0;
+  printf("%s", buffer);
+
+  if(hasCountry = uloc_getCountry(loc, buffer, 256, &status)) {
+    uBufLen = uloc_getDisplayCountry(loc, "en", UBuffer, 256, &status);
+    bufLen = ucnv_fromUChars(conv, buffer, 256, UBuffer, uBufLen, &status);
+    //u_UCharsToChars(UBuffer,  buffer, uBufLen);
+    buffer[bufLen] = 0;
+    printf("_%s", buffer);
+  }
+
+  if(uloc_getVariant(loc, buffer, 256, &status)) {
+    uBufLen = uloc_getDisplayVariant(loc, "en", UBuffer, 256, &status);
+    bufLen = ucnv_fromUChars(conv, buffer, 256, UBuffer, uBufLen, &status);
+    //u_UCharsToChars(UBuffer,  buffer, uBufLen);
+    buffer[bufLen] = 0;
+    if(!hasCountry) {
+      printf("_");
+    }
+    printf("_%s", buffer);
+  }
+  printf("\n");
+
+
+  return 0;
+}
diff --git a/trunk/colprobe/readme.txt b/trunk/colprobe/readme.txt
new file mode 100644
index 0000000..fd2914a
--- /dev/null
+++ b/trunk/colprobe/readme.txt
@@ -0,0 +1,4 @@
+There are several tools in this directory that should make it easier to generate collation data:
+extractCollationData.pl - perl script that reads ICU resource bundle files and outputs a locale_collation.html file if collation elements are present in the locale. Arguments are the list of locale source files (*.txt) that need to be processed.
+createComparisonTables.pl - takes a locale name. Looks in directories that should contain the html data produced by colprobe or extractCollationData.
+tableStarter.pl - invokes createComparisonTables.pl with a list of locales. 
diff --git a/trunk/colprobe/sortedlines.cpp b/trunk/colprobe/sortedlines.cpp
new file mode 100644
index 0000000..a4f3dfe
--- /dev/null
+++ b/trunk/colprobe/sortedlines.cpp
@@ -0,0 +1,2067 @@
+#include "sortedlines.h"
+
+static int codePointCmp(const void *a, const void *b) {
+  return u_strcmp((*(Line **)a)->name, (*(Line **)b)->name);
+}
+
+SortedLines::SortedLines(const UnicodeSet &set, const UnicodeSet &excludeBounds, const StrengthProbe &probe, 
+                         UPrinter *logger, UPrinter *debug) :
+toSort(NULL),
+toSortCapacity(0),
+lines(NULL),
+size(0),
+capacity(0),
+repertoire(set),
+excludeBounds(excludeBounds),
+probe(probe),
+first(NULL),
+last(NULL),
+logger(logger),
+debug(debug),
+contractionsTable(NULL),
+duplicators(NULL),
+maxExpansionPrefixSize(0),
+wordSort(FALSE),
+frenchSecondary(FALSE),
+upperFirst(FALSE),
+sortkeys(NULL),
+sortkeyOffset(0)
+{
+  memset(UB, 0, sizeof(UB));
+  int32_t i = 0;
+  for(i = 0; i < UCOL_OFF; i++) {
+    UB[i] = &empty;
+  }
+  init();
+}
+
+SortedLines::~SortedLines()
+{
+  delete[] lines;
+  if(sortkeys) {
+    delete[] sortkeys;
+  }
+  if(toSort) {
+    delete[] toSort;
+  }
+  if(contractionsTable) {
+    delete contractionsTable;
+  }
+  if(duplicators) {
+    delete duplicators;
+  }
+}
+
+void
+SortedLines::getBounds(UErrorCode &status) {
+  // first sort through the set
+  debug->log(toString(), TRUE);
+  int32_t i = 0, j = 0;
+  UColAttributeValue strength = UCOL_OFF;
+  for(i = 0; i < size; i++) {
+    if(toSort[i]->strengthFromEmpty < strength) {
+      if(i && strength < UCOL_OFF) {
+        //u_strcpy(UB[strength], toSort[i-1]->name);
+        j = 1;
+        while(excludeBounds.contains(UnicodeString(toSort[i-j]->name, toSort[i-j]->len))) {
+          j++;
+        }
+        UB[strength] = toSort[i-j];
+      }
+      strength = toSort[i]->strengthFromEmpty;
+      if(strength == UCOL_PRIMARY) {
+        probe.SE = toSort[i]->name[0];
+      }
+    }
+  }
+  //u_strcpy(UB[strength], toSort[size-1]->name);
+  // a different solution for bounds: go from end and see if the guys on the top
+  // cause duplication for things
+  UChar dupch[] = { 0x0020, 0x0030, 0x0042, 0x0051, 0x0062, 0x0071, 0x0391, 0x0396, 0x03b1, 0x03b6 };
+  j = 1;
+  Line dup;
+  Line bound;
+  int32_t dups = 0;
+  while(j < size) {
+    dups = 0;
+    for(i = 0; i < sizeof(dupch)/sizeof(dupch[0]); i++) {
+      dup.setTo(dupch[i]);
+      dup.append(dupch[i]);
+      bound.setTo(dupch[i]);
+      bound.append(toSort[size-j]->name, toSort[size-j]->len);
+      if(probe.getStrength(dup, bound) >= UCOL_IDENTICAL) {
+        dups++;
+      }
+    }
+    if(dups == 0) {
+      break;
+    } else {
+      if(!duplicators) {
+        duplicators = new Hashtable();
+      }
+      duplicators->put(UnicodeString(toSort[size-j]->name, toSort[size-j]->len), &toSort[size-j], status);
+      debug->log(toSort[size-j]->toString());
+      debug->log(" is not good enough to be an upper bound\n");
+      j++;
+    }
+  }
+  if(j == size) {
+    debug->log("Oi! I'm hallucinating. Will use the first upper bound");
+    delete duplicators;
+    duplicators = NULL;
+    j = 1;
+  }
+/*
+  j = 1;
+  while(excludeBounds.contains(UnicodeString(toSort[size-j]->name, toSort[size-j]->len))) {
+    j++;
+  }
+*/
+  UB[strength] = toSort[size-j];
+  for(i = 0; i < UCOL_OFF; i++) {
+    if(UB[i]) {
+      //debug->log(UB[i], TRUE);
+      debug->log(UB[i]->toString(TRUE), TRUE);
+    }
+  }
+}
+
+// classifies repertoire according to the strength of their difference
+// from the empty string
+void
+SortedLines::classifyRepertoire() {
+  UColAttributeValue strongestStrengthFromEmpty = UCOL_OFF;
+  int32_t lastChange = 0;
+  int32_t i = 0, j = 0;
+  while(i < size) // && probe.distanceFromEmptyString(*toSort[i]) > UCOL_PRIMARY) 
+  {
+    toSort[i]->strengthFromEmpty = probe.distanceFromEmptyString(*toSort[i]);
+    if(toSort[i]->strengthFromEmpty < strongestStrengthFromEmpty) {
+      strongestStrengthFromEmpty = toSort[i]->strengthFromEmpty;
+      lastChange = i;
+    } else if (toSort[i]->strengthFromEmpty > strongestStrengthFromEmpty) { 
+      // there is a problem in detection. Most probably a quaternary.
+      // why don't we try to interpolate
+      UColAttributeValue nextStrength = UCOL_OFF;
+      UColAttributeValue prevStrength = UCOL_OFF;
+      UColAttributeValue st = UCOL_OFF;
+
+      logger->log("Interpolating to get the distance from empty for Line ");
+      logger->log(toSort[i]->toString(TRUE), TRUE);
+
+      if(i) {
+        st = probe.getStrength(*toSort[i-1], *toSort[i]);
+        if(st == UCOL_OFF) {
+          logger->log("Cannot deduce distance from empty using previous element. Something is very wrong! Line:");
+          logger->log(toSort[i]->toString(TRUE), TRUE);
+        } else if(st == UCOL_IDENTICAL || st >= toSort[i-1]->strengthFromEmpty) {
+          prevStrength  = toSort[i-1]->strengthFromEmpty;
+        } else if(st < toSort[i-1]->strengthFromEmpty) { 
+          prevStrength = st;
+        }
+        toSort[i]->strengthFromEmpty = prevStrength;
+      }
+      if(i < size-2) {
+        toSort[i+1]->strengthFromEmpty = probe.distanceFromEmptyString(*toSort[i+1]);
+        st = probe.getStrength(*toSort[i+1], *toSort[i]);
+        if(st == UCOL_OFF) {
+          logger->log("Cannot deduce distance from empty using next element. Something is very wrong! Line:");
+          logger->log(toSort[i]->toString(TRUE), TRUE);
+        } else if(st == UCOL_IDENTICAL || st < toSort[i+1]->strengthFromEmpty) {
+          nextStrength = toSort[i+1]->strengthFromEmpty;
+        } else if(st >= toSort[i+1]->strengthFromEmpty) { 
+          nextStrength = st;
+        }        
+        if(i) {
+          if(prevStrength != nextStrength) {
+            logger->log("Inconsistent results from interpolation! Results will most likely be wrong\n");
+          }
+        }
+        toSort[i]->strengthFromEmpty = nextStrength;
+      }
+      /*
+      UColAttributeValue problemStrength = UCOL_PRIMARY;
+      for(j = lastChange; j < i ; j++) {
+        if(toSort[j]->strength > problemStrength) {
+          problemStrength = toSort[j]->strength;
+        }
+      }
+      for(j = lastChange; j < i ; j++) {
+        toSort[j]->strengthFromEmpty = problemStrength;
+      }
+      strongestStrengthFromEmpty = toSort[i]->strengthFromEmpty;
+      lastChange = i;
+      debug->log("Problem detected in distances from empty. Most probably word sort is on\n");
+      */
+      wordSort = TRUE;
+    }
+    i++;
+  }
+  debug->log("Distances from empty string\n");
+  debug->log(toStringFromEmpty(), TRUE);
+}
+
+void
+SortedLines::analyse(UErrorCode &status) {
+  frenchSecondary = probe.isFrenchSecondary(status);
+  if(U_FAILURE(status)) {
+    logger->log("Test for French secondary failed. Bailing out!\n");
+    return;
+  }
+  logger->log("French secondary value is %i\n", frenchSecondary, frenchSecondary);
+  upperFirst = probe.isUpperFirst(status);
+  if(U_FAILURE(status)) {
+    logger->log("Test for upper first failed. Bailing out!\n");
+    return;
+  }
+  logger->log("upper first value is %i\n", upperFirst, upperFirst);
+  sort(TRUE, TRUE);
+  classifyRepertoire();
+  getBounds(status);
+  //sort(TRUE, TRUE);
+  addContractionsToRepertoire(status);
+  //sort(TRUE, TRUE);
+  debug->log("\n*** Order after detecting contractions\n\n");
+  calculateSortKeys();
+  debug->log(toPrettyString(FALSE, TRUE), TRUE);
+  detectExpansions();
+}
+
+void SortedLines::init() 
+{
+  size = repertoire.size();
+  capacity = 5*size;
+  lines = new Line[capacity];
+  init(repertoire, lines);
+}
+
+void SortedLines::init(UnicodeSet &rep, Line *lin)
+{
+
+  UnicodeSetIterator exemplarUSetIter(rep);
+  int32_t size = 0;
+
+  while(exemplarUSetIter.next()) {
+    Line *currLine = lin+size;
+    if(exemplarUSetIter.isString()) { // process a string
+      currLine->setTo(exemplarUSetIter.getString());
+    } else { // process code point
+      currLine->setTo(exemplarUSetIter.getCodepoint());
+    }
+    currLine->name[currLine->len] = 0; // zero terminate, for our evil ways
+    //currLine->index = size;
+    size++;
+  }
+}
+
+void 
+SortedLines::setSortingArray(Line **sortingArray, Line *elements, int32_t sizeToSort) {
+  int32_t i = 0;
+  for(i = 0; i < sizeToSort; i++) {
+    sortingArray[i] = &elements[i];
+  }
+}
+
+int32_t
+SortedLines::setSortingArray(Line **sortingArray, Hashtable *table) {
+  int32_t size = table->count();
+  int32_t hashIndex = -1;
+  const UHashElement *hashElement = NULL;
+  int32_t count = 0;
+  while((hashElement = table->nextElement(hashIndex)) != NULL) {
+    sortingArray[count++] = (Line *)hashElement->value.pointer;
+  }
+  return size;
+}
+
+void
+SortedLines::sort(Line **sortingArray, int32_t sizeToSort, UBool setStrengths, UBool link) {
+  int32_t i = 0;
+  int32_t equalStart = 0;
+  UColAttributeValue equalStrength = UCOL_OFF;
+
+  qsort(sortingArray, sizeToSort, sizeof(Line *), probe.comparer);
+
+  if(setStrengths) { // analyze strengths
+    for(i = 1; i < sizeToSort; i++) {
+      sortingArray[i]->strength = probe.getStrength(*sortingArray[i-1], *sortingArray[i]);
+    }
+    // for equal guys, do the code point ordering
+    
+    i = 1;
+    while(i < sizeToSort) 
+    {
+      if(sortingArray[i]->strength == UCOL_IDENTICAL) {
+        equalStart = i - 1;
+        equalStrength = sortingArray[equalStart]->strength;
+        sortingArray[equalStart]->strength = UCOL_IDENTICAL;
+        while(i < sizeToSort && sortingArray[i]->strength == UCOL_IDENTICAL) {
+          i++;
+        }
+        qsort(sortingArray+equalStart, i-equalStart, sizeof(Line *), codePointCmp);
+        sortingArray[equalStart]->strength = equalStrength;
+      } else {
+        i++;
+      }
+    }
+    
+  }
+
+
+
+  if(link) { // do the linking
+    for(i = 0; i < sizeToSort - 1; i++) {
+      Line *curr = *(sortingArray+i);
+      curr->next = *(sortingArray+i+1);
+      (*(sortingArray+i+1))->previous = curr;
+    }
+  }
+}
+
+void
+SortedLines::sort(UBool setStrengths, UBool link) {
+  if(toSortCapacity < size || !toSort) {
+    if(toSort) {
+      delete[] toSort;
+    }
+    toSort = new Line*[size*2];
+    toSortCapacity = size*2;
+  }
+
+  setSortingArray(toSort, lines, size);
+  sort(toSort, size, setStrengths, link);
+
+  first = last = NULL;
+
+  if(link) { // do the linking
+    first = *toSort;
+    last = *(toSort+size-1);
+  }
+}
+
+void
+SortedLines::updateBounds(UnicodeSet &set) {
+  Line line;
+  UnicodeString s1;
+  UnicodeSetIterator it1(set); 
+  while(it1.next()) {
+    if(!debug->isOn()) {
+      logger->log(".");
+    }
+    if(it1.isString()) { // process a string
+      s1.setTo(it1.getString());
+    } else { // process code point
+      s1.setTo(it1.getCodepoint());
+    }
+    //line.setTo(s1);
+    UColAttributeValue strength = probe.distanceFromEmptyString(s1);
+    if(probe.compare(UnicodeString(UB[strength]->name), s1) < 0) {
+      // TODO: leak here - fixit!
+      UB[strength] = new Line(s1);
+      //u_strcpy(UB[strength], s1.getTerminatedBuffer());
+    }
+  }
+
+
+
+}
+
+void SortedLines::addAll(Line* toAdd, int32_t toAddSize) 
+{
+  if(size+toAddSize > capacity) {
+    int32_t doGrowingBreakpoint = 0;
+    // we need to do growing here
+  }
+  int32_t i = 0;
+
+  for(i = 0; i < toAddSize; i++) {
+    lines[size+i] = toAdd[i];
+  }
+  size += toAddSize;
+}
+
+void SortedLines::setDistancesFromEmpty(Line* array, int32_t arraySize)
+{
+  int32_t i = 0;
+  for(i = 0; i < arraySize; i++) {
+    array[i].strengthFromEmpty = probe.distanceFromEmptyString(array[i]);
+  }
+}
+
+
+// adds contractions in to repertoire
+int32_t SortedLines::addContractionsToRepertoire(UErrorCode &status) 
+{
+  logger->log("\n*** Detecting contractions\n\n");
+  contractionsTable = new Hashtable();
+  int32_t noConts = 0;
+  int32_t allocateSize = 50*size;
+  // first check for simple contractions
+  Line* delta = new Line[allocateSize];
+  Line** deltaSorted = new Line*[allocateSize];
+  Line* lesserToAddTo = new Line[allocateSize];
+  Line* newDelta = new Line[allocateSize];
+  Line** newDeltaSorted = new Line*[allocateSize];
+  Line* deltaP = delta; 
+  Line** deltaPP = deltaSorted;
+  Line* newDeltaP = newDelta;
+  int32_t deltaSize = 0, lesserToAddToSize = 0, newDeltaSize = 0;
+  logger->log("++ Contraction detection generation 0\n");
+  noConts = detectContractions(toSort, size, toSort, size, 
+			       delta, deltaSize, lesserToAddTo, lesserToAddToSize, 3*size, status);
+  setSortingArray(deltaSorted, delta, deltaSize);
+  sort(deltaSorted, deltaSize, TRUE);
+
+  setDistancesFromEmpty(delta, deltaSize);
+  int32_t deltaPSize = deltaSize;
+  //updateBounds(delta);
+
+  int32_t generation = 0;
+  // if we found any, we have to try multiple contractions
+  // However, we want to prevent the contractions explosion
+  // if the number of simple contractions is greater than the
+  // starting size, chances are that we either have an algorithmic
+  // contraction (like iteration marks on w2k) or something
+  // is seriosly wrong.
+  if(deltaPSize < size/2) {
+    while (deltaPSize && generation < 1) {
+      generation++;
+      logger->log("\n++ Contraction detection generation %i\n", generation, generation);
+      // find more, but avoid testing the combinations we already have
+      noConts += detectContractions(toSort, size, deltaPP, deltaPSize,
+				    newDeltaP, newDeltaSize, lesserToAddTo, lesserToAddToSize, 3*size, status);
+      noConts += detectContractions(deltaPP, deltaPSize, toSort, size, 
+				    newDeltaP, newDeltaSize, lesserToAddTo, lesserToAddToSize, 3*size, status);
+      calculateSortKeys();
+
+      addAll(deltaP, deltaPSize);
+      setSortingArray(toSort, lines, size);
+      sort(TRUE, TRUE);
+      setSortingArray(newDeltaSorted, newDeltaP, newDeltaSize);
+      sort(newDeltaSorted, newDeltaSize, TRUE);
+	  
+      // if no new ones, bail
+      //if (newDeltaSize == 0) break;
+
+      deltaPSize = newDeltaSize;
+      newDeltaSize = 0;
+      if(deltaP == delta) {
+        deltaP = newDelta;
+        deltaPP = newDeltaSorted;
+        newDeltaP = delta;
+      } else {
+        deltaP = delta;
+        deltaPP = deltaSorted;
+        newDeltaP = newDelta;
+      }
+      setDistancesFromEmpty(deltaP, deltaPSize);
+    }
+  }
+  status = U_ZERO_ERROR;
+  // add stuff from the last batch
+  addAll(deltaP, deltaPSize);
+
+  // warning: we don't add the lesser ones in recursively, since they will
+  // infinitely loop
+  setDistancesFromEmpty(lesserToAddTo, lesserToAddToSize);
+  addAll(lesserToAddTo, lesserToAddToSize);
+  setSortingArray(toSort, lines, size);
+  sort(TRUE, TRUE);
+
+  delete[] deltaSorted;
+  delete[] delta;
+  delete[] lesserToAddTo;
+  delete[] newDeltaSorted;
+  delete[] newDelta;
+  return noConts;
+}
+
+
+int32_t SortedLines::detectContractions(Line **firstRep, int32_t firstSize,
+                                        Line **secondRep, int32_t secondSize,
+                                        Line *toAddTo, int32_t &toAddToSize, 
+                                        Line *lesserToAddTo, int32_t &lesserToAddToSize,
+                                        int32_t capacity, UErrorCode &status) 
+{
+  int32_t noConts = 0;
+  int i = 0, j = 0, k = 0;
+  Line lower, upper, trial, toAdd, helper;
+  UChar32 firstStart, firstEnd, secondStart;
+  UChar NFCTrial[256];
+  int32_t NFCTrialLen = 0;
+  UBool thai;
+  i = -1;
+  while(i < firstSize-1 && U_SUCCESS(status)) {
+    i++;
+    if(!debug->isOn()) {
+      logger->log("\rTesting %05i/%05i. Found %05i conts.", i, firstSize, noConts);
+    }
+    U16_GET(firstRep[i]->name, 0, 0, firstRep[i]->len, firstStart);
+    if(uscript_getScript(firstStart, &status) == USCRIPT_HAN || firstRep[i]->strengthFromEmpty > UCOL_PRIMARY) //UCOL_TERTIARY) 
+      {
+        continue;
+      }
+    lower = *firstRep[i];
+    for(j = 0; j < secondSize; j++) {
+      if(noConts == capacity) {
+        return noConts;
+      }
+      U16_GET(secondRep[j]->name, 0, 0, secondRep[j]->len, secondStart);
+      if(firstStart == 0x41 && secondStart == 0x308) {
+      int32_t putBreakPointHere = 0;
+    }
+      if(uscript_getScript(secondStart, &status) == USCRIPT_HAN) // || secondRep[j]->strengthFromEmpty > UCOL_TERTIARY) 
+	{
+          continue;
+        }
+      	if(duplicators && duplicators->get(UnicodeString(secondRep[j]->name, secondRep[j]->len)) != NULL) {
+          debug->log("Skipping duplicator ");
+          debug->log(secondRep[j]->toString(), TRUE);
+		  continue;
+		}
+
+      if(firstRep[i]->name[0] == 0x61 && secondRep[j]->name[0] == 0x308) {
+	    int32_t putBreakpointhere = 0;
+      }
+      upper.setToConcat(firstRep[i], UB[UCOL_PRIMARY]);
+      //upper.setToConcat(firstRep[i], UB[secondRep[j]->strengthFromEmpty]);
+      toAdd.setToConcat(firstRep[i], secondRep[j]);          
+      U16_GET(firstRep[i]->name, 0, firstRep[i]->len-1, firstRep[i]->len, firstEnd);
+      if((thai = u_hasBinaryProperty(firstEnd, UCHAR_LOGICAL_ORDER_EXCEPTION))) {
+	// this means that the lower is single reordering character
+	// if we do the lower test without taking this into account,
+	// we'll comparing the secondRep directly to Thai. We add UB[UCOL_PRIMARY] to
+	// end of lower and in the middle of trial, so we will have 
+	// lower = Thai + UB, trial Thai + UB + x, resolving to
+	// UB + Thai vs UB + Thai + x.
+	// for upper bound, we do the similar, so we have
+	// upper = Thai + UB + UB, trial = Thai + UB + x,
+	// resolving to UB + Thai + UB vs UB + Thai + x
+	if(secondRep[j]->firstCC) {
+	  UChar32 UBChar;
+	  U16_GET(UB[UCOL_SECONDARY]->name, 0, 0, UB[UCOL_SECONDARY]->len, UBChar);
+	  if(secondRep[j]->firstCC > u_getCombiningClass(UBChar)) {
+	    continue;
+	  }
+	} 
+	upper = *firstRep[i];
+	upper.append(*UB[UCOL_PRIMARY]);
+	//upper.append(*UB[secondRep[j]->strengthFromEmpty]);
+	upper.append(*UB[UCOL_PRIMARY]);
+	lower.append(*UB[UCOL_PRIMARY]);
+	trial = *firstRep[i];
+	trial.append(*UB[UCOL_PRIMARY]);
+	trial.append(*secondRep[j]);
+      } else if((firstRep[i]->lastCC > secondRep[j]->firstCC && secondRep[j]->firstCC && !frenchSecondary) 
+		|| (firstRep[i]->firstCC < secondRep[j]->lastCC && firstRep[i]->firstCC && frenchSecondary)) {
+	// Skip because normalization will reorder
+	// there will be a chance to check this again, since if we
+	// try a+b, we will also try b+a
+	    continue;
+      } else if(frenchSecondary && (firstRep[i]->strengthFromEmpty > UCOL_PRIMARY && secondRep[j]->strengthFromEmpty > UCOL_PRIMARY)) {
+	    continue;
+      }else if(firstRep[i]->lastCC && secondRep[j]->firstCC && frenchSecondary) {
+	    trial.setToConcat(secondRep[j], firstRep[i]);
+      } else {
+    	trial.setToConcat(firstRep[i], secondRep[j]);          
+      }
+      // Now let's check the trial. The problem is that when you combine characters, 
+      // you can end up with concatenation that is unknown for the examined API.
+      NFCTrialLen = unorm_normalize(trial.name, trial.len, UNORM_NFC, 0, NFCTrial, 256, &status);
+      if((u_strcmp(trial.name, NFCTrial) == 0) || u_strFindLast(NFCTrial, NFCTrialLen, secondRep[j]->name, secondRep[j]->len)) {
+	   if(secondRep[j]->strengthFromEmpty > UCOL_TERTIARY) {
+	     continue;
+	   }
+	 }
+      UChar32 c;
+      U16_GET(NFCTrial, 0, 0, NFCTrialLen, c);
+      helper.setTo(c);
+      if(probe.distanceFromEmptyString(helper) > UCOL_TERTIARY) {
+	    continue;
+      }
+      if(NFCTrialLen > 1) {
+	    U16_GET(NFCTrial, 0, NFCTrialLen-1, NFCTrialLen, c);
+	    helper.setTo(c);
+        if(probe.distanceFromEmptyString(helper) > UCOL_TERTIARY) {
+	      continue;
+	    }
+      }
+
+      if (probe.compare(lower, trial) >= 0) { // if lower is bigger than trial
+        // this might be ok, but I'm having doubts. Here is an additional check:
+        if(firstRep[i]->len == 1 || secondRep[j]->strengthFromEmpty == UCOL_PRIMARY) {
+          // I'm basically saying that I'll add this kind of contraction for cases where I combine
+          // one letter with an accent OR when I'm combining more than one symbol with a letter.
+          noteContraction("L", lesserToAddTo, lesserToAddToSize, firstRep[i], secondRep[j], noConts, status);
+        }
+      } 
+      else if (probe.compare(trial, upper) > 0) { // trial is bigger than upper??
+        noteContraction("U", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+      } 
+#if 0
+      else if(firstRep[i]->strengthFromEmpty == UCOL_PRIMARY)
+      {
+        Line expansionLine;
+        if(getExpansionLine(trial, *firstRep[i], *secondRep[j], expansionLine) &&
+        expansionLine.len && !(expansionLine == *secondRep[j])) {
+          noteContraction("D", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+        }            
+      }
+#endif
+      else if(firstRep[i]->strengthFromEmpty == UCOL_PRIMARY && probe.getStrength(lower, trial) < secondRep[j]->strengthFromEmpty) {
+        noteContraction("D1", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+      } 
+      else if (firstRep[i]->strengthFromEmpty == UCOL_PRIMARY && secondRep[j]->strengthFromEmpty == UCOL_PRIMARY) 
+      {
+        // I have added an additional check. The checks versus upper and lower bound should be sufficient
+        // when the right side is a combining mark. There might be a reordering of combining marks, but
+        // that should be already visible in their order.
+	// compare the sequence 
+	// Y- <? Y <? Y+
+	// and 
+	// XY- <? XY <? XY+
+	Line xym, xyp, xy;
+	UBool xymIsContraction = FALSE, toAddIsContraction = FALSE;
+    if(j) {
+	  if(((!secondRep[j-1]->firstCC || firstRep[i]->lastCC < secondRep[j-1]->firstCC) && !frenchSecondary) 
+             ||((!firstRep[i]->firstCC || firstRep[i]->firstCC > secondRep[j-1]->lastCC) && frenchSecondary)) {
+	    xym.setToConcat(firstRep[i], secondRep[j-1]);
+	    toAdd.strength = probe.getStrength(xym, toAdd);
+	    if(secondRep[j]->strength != toAdd.strength) {
+	      // there is possibility that either xym or xy are contractions
+	      // There are two situations:
+	      // xym > xy or xym <n xy and ym <k y but n != k
+	      // if they are reordered, we are going to see if each of them 
+	      // is further reordered
+	      if(toAdd.strength == UCOL_OFF) {
+		// check whether toAdd shifted more down
+		k = j - 2;
+		while(k>=0 && secondRep[k]->strength > secondRep[j]->strength) {
+		  k--;
+		}
+		while(!toAddIsContraction && k>=0) {
+		  xyp.setToConcat(firstRep[i], secondRep[k]);
+		  if(contractionsTable->get(UnicodeString(xyp.name, xyp.len)) != NULL) {
+		    k--;
+		    continue;
+		  }
+		  if(probe.compare(xyp, xym) >= 0) {
+		    // xyp looks like a contraction
+		    noteContraction("!1", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+		    toAddIsContraction = TRUE;
+		  } else {
+		    break;
+		  }
+		}
+          // first let's see if xym has moved beyond
+          if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == NULL) {
+            k = j+1;
+            // ignore weaker strengths
+            while(k < secondSize && secondRep[k]->strength > secondRep[j]->strength) {
+              k++;
+            }
+            // check if we skipped the following guy
+            if(k < secondSize) {
+              xyp.setToConcat(firstRep[i], secondRep[k]);
+              if(probe.compare(xyp, xym) <= 0) {
+	            // xyp looks like a contraction
+	            noteContraction("!2", toAddTo, toAddToSize, firstRep[i], secondRep[j-1], noConts, status);
+	            xymIsContraction = TRUE;
+              }
+            }
+          } else {
+            xymIsContraction = TRUE;
+          }
+          // if they have reordered, but none has moved, then we add them both
+          // and hope for the best
+          if(!xymIsContraction && !toAddIsContraction) {
+              // it is possible that there is an NFC version version of one of the 
+              // strings. If we have XY > XZ, but NFC(XZ) = W and X < W, we might have
+              // have a false contraction.
+              trial.len = unorm_normalize(toAdd.name, toAdd.len, UNORM_NFC, 0, trial.name, 25, &status);
+              //UColAttributeValue strength = probe.getStrength(*firstRep[i], trial);
+              if(trial == toAdd) {
+                noteContraction("!3", toAddTo, toAddToSize, firstRep[i], secondRep[j-1], noConts, status);
+                noteContraction("!3", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+              } else {
+                noteContraction("!4", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+              }
+            }
+	      } else { // only the strength has changed
+            // check whether the previous is contraction and if not, add the current
+            if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == NULL) {
+              noteContraction("!5", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
+            }                  
+	      }
+	    }
+	  }
+	}
+      }
+      if(thai) { // restore lower
+        lower = *firstRep[i];
+      }
+    }
+  }
+  return noConts;
+}
+
+void
+SortedLines::noteContraction(const char* msg, Line *toAddTo, int32_t &toAddToSize, Line *left, Line *right, int32_t &noConts, UErrorCode &status) 
+{
+  Line toAdd;
+  toAdd.setToConcat(left, right);
+  toAdd.left = left;
+  toAdd.right = right;
+  // if we're adding an accent to an existing contraction, we want to check
+#if 0
+  Line test, trial1, trial2;
+  if(right->strengthFromEmpty > UCOL_PRIMARY) {
+    if(left->right && left->right->previous && left->right->next) {
+      test.setToConcat(left->left, left->right->previous);
+      trial1.setToConcat(&test, right);
+
+      test.setToConcat(left->left, left->right->next);
+      trial2.setToConcat(&test, right);
+      if(probe.compare(trial1, toAdd) < 0 && probe.compare(toAdd, trial2) < 0) {
+        // this means that the contraction has been broken by the newly added accent
+        // so while 'ch' is contraction, 'ch'+dot_above sorts between 'cg'+dot_above and 'ci'+dot_above
+        debug->log("Con -");
+        debug->log(msg);
+        debug->log(toAdd.toString(FALSE), TRUE);
+        return;
+      }
+    } else {
+      if(right->previous && right->next) {
+        trial1.setToConcat(left, right->previous);
+        trial2.setToConcat(left, right->next);
+        if(probe.compare(trial1, toAdd) < 0 && probe.compare(toAdd, trial2) < 0) {
+          // this means that the contraction has been broken by the newly added accent
+          // so while 'ch' is contraction, 'ch'+dot_above sorts between 'cg'+dot_above and 'ci'+dot_above
+          debug->log("Con -");
+          debug->log(msg);
+          debug->log(toAdd.toString(FALSE), TRUE);
+          return;
+        }
+      }
+      if(left->previous && left->next) {
+        trial1.setToConcat(left->previous, right);
+        trial2.setToConcat(left->next, right);
+        if(probe.compare(trial1, toAdd) < 0 && probe.compare(toAdd, trial2) < 0) {
+          // this means that the contraction has been broken by the newly added accent
+          // so while 'ch' is contraction, 'ch'+dot_above sorts between 'cg'+dot_above and 'ci'+dot_above
+          debug->log("Con -");
+          debug->log(msg);
+          debug->log(toAdd.toString(FALSE), TRUE);
+          return;
+        }
+      }
+
+    }
+  }
+  if(right->right && right->right->strengthFromEmpty > UCOL_PRIMARY && right->left->previous && right->left->next) { // maybe we already had a contraction with an accent
+    test.setToConcat(right->left->previous, right->right);
+    trial1.setToConcat(left, &test);
+    test.setToConcat(right->left->next, right->right);
+    trial2.setToConcat(left, &test);
+    if(probe.compare(trial1, toAdd) < 0 && probe.compare(toAdd, trial2) < 0) {
+      // this means that the contraction has been broken by the newly added accent
+      // so while 'ch' is contraction, 'ch'+dot_above sorts between 'cg'+dot_above and 'ci'+dot_above
+      debug->log("Con -");
+      debug->log(msg);
+      debug->log(toAdd.toString(FALSE), TRUE);
+      return;
+    }
+  }
+#endif
+  if(contractionsTable->get(UnicodeString(toAdd.name, toAdd.len)) == NULL) {
+    if(probe.distanceFromEmptyString(toAdd) <= UCOL_TERTIARY) {
+      toAddTo[toAddToSize++] = toAdd;
+      contractionsTable->put(UnicodeString(toAdd.name, toAdd.len), &toAdd, status);
+      noConts++;
+      debug->log(msg);
+      debug->log(" Con + ");
+      debug->log(toAdd.toString(FALSE), TRUE);
+
+      if(!left->sortKey) {
+        calculateSortKey(*left);
+      }
+      debug->log(left->dumpSortkey());
+      debug->log(" + ");
+
+      if(!right->sortKey) {
+        calculateSortKey(*right);
+      }
+      debug->log(right->dumpSortkey());
+      debug->log(" = ");
+
+      calculateSortKey(toAdd);
+      debug->log(toAdd.dumpSortkey(), TRUE);
+      if(noConts > size/2) {
+        status = U_BUFFER_OVERFLOW_ERROR;
+      }
+    }
+  }
+}
+
+
+UBool
+SortedLines::getExpansionLine(const Line &expansion, const Line &previous, const Line &exp, Line &expansionLine) 
+{
+  int expIndexSize = 0;
+  UColAttributeValue expStrength = UCOL_OFF;
+  int32_t comparisonResult = 0;
+  int32_t i = 0, k = 0, prevK = 0;
+  Line trial;
+  UBool sequenceCompleted = FALSE;
+  int32_t expIndexes[256];
+  int32_t expIndexesSize = 0;
+
+  if(!sequenceCompleted) {
+    expIndexSize = 0;
+    expansionLine.clear();
+
+    // we will start from strength between the expansion
+    // and the target (toSort[i] and toSort[j]. First we
+    // will add as many primaries as possible. Then we will
+    // try to add secondary pieces and then tertiary. 
+    // found an expansion - what is the expanding sequence?
+  
+    expStrength = UCOL_PRIMARY;
+    while(!sequenceCompleted) {
+      k = 0;
+      prevK = 0;
+      while(k < size) {
+        if(expansionLine.len > 15) {
+          sequenceCompleted = TRUE;
+          break;
+        }
+        while(k < size && toSort[k]->strength != UCOL_PRIMARY) 
+        {
+          k++;
+        }
+        // nothing found
+        if(k == size) {
+          break;
+        }
+        // we need to skip over reordering things. If they were worthy, they would
+        // have been detected in the previous iteration.
+        //if(expansionLine.lastCC && toSort[k]->firstCC && expansionLine.lastCC > toSort[k]->firstCC) {
+          //k++;
+          //continue;
+        //}
+        trial = previous;
+        trial.append(expansionLine);
+        trial.append(*toSort[k]);        
+        if(toSort[k]->name[0] == 0x0067) {
+          int32_t putBreakPointHere = 0;
+        }
+        comparisonResult = probe.compare(trial, expansion);
+        if(comparisonResult == 0) {
+          expansionLine = *toSort[k];
+          return TRUE;
+        } else if (comparisonResult > 0) {
+          if(prevK) {
+            if(exp == *toSort[prevK]) {
+              expansionLine = exp;
+              return TRUE;
+            }
+            i = prevK;
+            while(i < k-1) {
+              i++;
+              if(toSort[i]->strength > exp.strength) {
+                continue;
+              }
+              trial = previous;
+              trial.append(expansionLine);
+              trial.append(*toSort[i]);
+              if(probe.compare(trial, expansion) > 0) {
+                break;
+              }
+            }
+            // we got into situation where we have ch > ch+dot-below
+            // however, ch is a contraction and therefore we cannot use
+            // it properly. If we have hit on a contraction, we'll just try
+            // to continue. Probably need more logic here.
+            if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == NULL) {
+              expansionLine.append(*toSort[i-1]);
+              expIndexes[expIndexSize++] = i-1;
+              break;
+            } else {
+              int32_t putBreakPointHere = 0;
+            }
+          } else {
+            sequenceCompleted = TRUE;
+            break;
+          }
+          //break;
+        }
+        prevK = k;
+        k++;
+      }
+      if(!prevK || k == size) {
+        break;
+      }
+    }
+  }
+  return expIndexSize > 0;
+}
+
+int32_t
+SortedLines::gooseUp(int32_t resetIndex, int32_t expansionIndex, Line &expLine, int32_t *expIndexes, int32_t &expIndexSize, UColAttributeValue strength) 
+{
+  int32_t i = expansionIndex, k = resetIndex+1, n = 0, m = 0, start = 0;
+  UBool haveChanges = FALSE;
+  Line trial, prefix, suffix;
+  // we will first try goosing up the reset index
+  //while(toSort[k]->strength >= strength)
+  for( ; toSort[k]->strength == strength; k++) 
+  {
+    //if(toSort[k]->strength > strength) {
+      //continue;
+    //}
+    trial.setToConcat(toSort[k], &expLine);
+    if(probe.compare(trial, *toSort[i]) > 0) {
+      break;
+    }
+  }
+  resetIndex = k-1;
+
+  // goose up individual characters
+  prefix = *toSort[resetIndex];
+  for(n = 0; n < expIndexSize; n++) {
+    suffix.clear();
+    for(m = n+1; m < expIndexSize; m++) {
+      suffix.append(*toSort[expIndexes[m]]);
+    }
+    k = expIndexes[n]+1;
+    //while(toSort[k]->strength >= strength)
+    for( ; toSort[k]->strength == strength; k++) 
+    {
+      //if(toSort[k]->strength > strength) {
+        //continue;
+      //}
+      trial.setToConcat(&prefix, toSort[k]);
+      trial.append(suffix);
+      if(probe.compare(trial, *toSort[i]) > 0) {
+        break;
+      }
+    }
+    if(k > expIndexes[n]+1) {
+      haveChanges = TRUE;
+      expIndexes[n] = k-1;
+    }
+    prefix.append(*toSort[expIndexes[n]]);
+  }
+
+  // try inserting ingorables
+  UColAttributeValue lastStr = UCOL_OFF;
+  k = 0;
+  while(toSort[k]->strengthFromEmpty > strength) {
+    k++;
+  }
+  if(toSort[k]->strengthFromEmpty == strength) {
+    start = k;
+    prefix = *toSort[resetIndex];
+    n = 0;
+    while(n <= expIndexSize) {
+      suffix.clear();
+      for(m = n; m < expIndexSize; m++) {
+        suffix.append(*toSort[expIndexes[m]]);
+      }
+      k = start;
+      while(toSort[k]->strengthFromEmpty == strength) {
+        trial.setToConcat(&prefix, toSort[k]);
+        trial.append(suffix);
+        lastStr = probe.getStrength(trial, *toSort[i]);
+        if(lastStr == UCOL_OFF) { // shot over - we won't find anything here
+          break;
+        } else if(lastStr > strength) {
+          for(m = expIndexSize; m > n; m--) {
+            expIndexes[m] = expIndexes[m-1];
+          }
+          expIndexes[n] = k;
+          expIndexSize++;
+          haveChanges = TRUE;
+          break;
+        }
+#if 0
+        if(probe.compare(trial, *toSort[i]) > 0) {
+          // if the first one skips, that means that
+          // this position doesn't work
+          if(k > start) {
+            // insert an ignorable on position n
+            for(m = expIndexSize; m > n; m--) {
+              expIndexes[m] = expIndexes[m-1];
+            }
+            expIndexes[n] = k-1;
+            expIndexSize++;
+            haveChanges = TRUE;
+            if(n == expIndexSize-1) { // added to the end of the string
+              UColAttributeValue str = probe.getStrength(trial, *toSort[i]);
+              int32_t putBreakHere = 0;
+            }
+          }
+          break;
+        } else {
+          lastStr = probe.getStrength(trial, *toSort[i]);
+        }
+#endif
+        k++;
+      }
+      prefix.append(*toSort[expIndexes[n]]);
+      n++;
+    }
+  }
+
+  if(haveChanges) {
+    expLine.clear();
+    for(m = 0; m < expIndexSize; m++) {
+      expLine.append(*toSort[expIndexes[m]]);
+    }
+  }
+  return resetIndex;
+}
+
+int32_t 
+SortedLines::detectExpansions() 
+{
+  logger->log("\n*** Detecting expansions\n\n");
+  int32_t exCount = 0;
+  int32_t i = 0, j = 0, k = 0, prevK = 0;
+  Line *previous, trial, expansionLine;
+  UBool foundExp = FALSE, sequenceCompleted = FALSE;
+  UColAttributeValue strength = UCOL_OFF;
+  UColAttributeValue maxStrength = UCOL_IDENTICAL;
+  UColAttributeValue expStrength = UCOL_OFF;
+  int32_t expIndexes[256];
+  int32_t expIndexSize = 0;
+  memset(expIndexes, 0, sizeof(expIndexes));
+
+  // for each element, we look back to find whether there is such a q for which
+  // q <n x < qUBn. These are possible expansions. When going backwards we skip 
+  // over already detected expansions.
+  i = 0;
+  // it turns out that looking at accents as possible expansions is
+  // quite a stupid thing to do, especially on non ICU platforms.
+  // Previously this line skipped over identicals only, but 
+  // now we are going to skip all the way to non-ignorables.
+  while(toSort[i]->strengthFromEmpty > UCOL_PRIMARY) {
+    i++;
+  }
+  i++;
+  for( ; i < size; i++) {
+    if(toSort[i]->name[0]==0x0063 && toSort[i]->name[1] == 0x68) // && toSort[i]->name[1] == 0x308)0043 0043 0219
+    { 
+      int32_t putBreakpointhere = 0;
+    }
+    foundExp = FALSE;
+    sequenceCompleted = FALSE;
+    strength = toSort[i]->strength;
+    if(strength == UCOL_IDENTICAL && toSort[i-1]->isExpansion == TRUE) {
+      u_strcpy(toSort[i]->expansionString, toSort[i-1]->expansionString);
+      toSort[i]->expLen = toSort[i-1]->expLen;
+      toSort[i]->isExpansion = TRUE;
+      toSort[i]->expIndex = toSort[i-1]->expIndex;
+      toSort[i]->expStrength = UCOL_IDENTICAL;
+      //toSort[i]->expStrength = toSort[i-1]->expStrength;
+      foundExp = TRUE;
+      sequenceCompleted = TRUE;
+    }
+    //logger->log("%i %i\n", i, j);
+    while(!foundExp && strength <= maxStrength) {
+      j = i-1;
+      while(j && (toSort[j]->isExpansion == TRUE || toSort[j]->isRemoved == TRUE)) {
+        //if(toSort[j]->strength < strength) {
+          //strength = toSort[j]->strength;
+        //}
+        j--;
+      }
+
+      //while(j && toSort[j]->strength > strength)
+      while(j && toSort[j]->strength > probe.getStrength(*toSort[j], *toSort[i]))
+      {
+        j--;
+      }
+      //if(toSort[j]->strength == strength) {
+        previous = toSort[j];
+        if(previous->strengthFromEmpty >= UCOL_IDENTICAL ||
+          (previous->strengthFromEmpty == UCOL_SECONDARY
+          && strength == UCOL_SECONDARY
+          && previous->lastCC > UB[strength]->firstCC)) {
+          break;
+          //continue;
+        }
+        //trial.setToConcat(previous, UB[strength]);
+        trial.setToConcat(previous, UB[probe.getStrength(*toSort[j], *toSort[i])]);
+        if(probe.compare(trial, *toSort[i]) > 0) {
+          foundExp = TRUE;
+        }
+      //}
+      if(strength == UCOL_QUATERNARY) {
+        strength = UCOL_IDENTICAL;
+      } else {
+        strength = (UColAttributeValue)(strength + 1);
+      }
+    }
+    // calculate the expanding sequence
+    if(foundExp && !sequenceCompleted) {
+      expIndexSize = 0;
+      expansionLine.clear();
+      exCount++;
+      // we will start from strength between the expansion
+      // and the target (toSort[i] and toSort[j]. First we
+      // will add as many primaries as possible. Then we will
+      // try to add secondary pieces and then tertiary. 
+      // found an expansion - what is the expanding sequence?
+      
+      expStrength = UCOL_PRIMARY;
+      while(!sequenceCompleted) {
+        k = 0;
+        prevK = 0;
+        while(k < size) {
+          if(expansionLine.len > 15) {
+            sequenceCompleted = TRUE;
+            break;
+          }
+          while(k < size && toSort[k]->strength != UCOL_PRIMARY) {
+            k++;
+          }
+          // nothing found
+          if(k == size) {
+            break;
+          }
+          // we need to skip over reordering things. If they were worthy, they would
+          // have been detected in the previous iteration.
+          //if(expansionLine.lastCC && toSort[k]->firstCC && expansionLine.lastCC > toSort[k]->firstCC) {
+            //k++;
+            //continue;
+          //}
+          trial = *previous;
+          trial.append(expansionLine);
+          trial.append(*toSort[k]);        
+          if(toSort[k]->name[0] == 0x0067) {
+            int32_t putBreakPointHere = 0;
+          }
+          if(probe.compare(trial, *toSort[i]) > 0) {
+            if(prevK) {
+              // we got into situation where we have ch > ch+dot-below
+              // however, ch is a contraction and therefore we cannot use
+              // it properly. If we have hit on a contraction, we'll just try
+              // to continue. Probably need more logic here.
+              if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == NULL) {
+                expansionLine.append(*toSort[prevK]);
+                expIndexes[expIndexSize++] = prevK;
+                break;
+              } else {
+                int32_t putBreakPointHere = 0;
+              }
+            } else {
+              sequenceCompleted = TRUE;
+              break;
+            }
+            //break;
+          }
+          prevK = k;
+          k++;
+        }
+        if(!prevK || k == size) {
+          break;
+        }
+      }
+      // after this we have primaries lined up.
+      // we are going to goose up with secondaries and 
+      // tertiaries
+      trial.setToConcat(toSort[j], &expansionLine);
+      expStrength = probe.getStrength(trial, *toSort[i]);
+      if(expStrength > UCOL_PRIMARY) {
+        if(expStrength == UCOL_SECONDARY || expStrength == UCOL_OFF) {
+          j = gooseUp(j, i, expansionLine, expIndexes, expIndexSize, UCOL_SECONDARY);
+          trial.setToConcat(toSort[j], &expansionLine);
+          expStrength = probe.getStrength(trial, *toSort[i]);
+          if(expStrength == UCOL_TERTIARY) {
+            j = gooseUp(j, i, expansionLine, expIndexes, expIndexSize, UCOL_TERTIARY);
+          }
+        } else if(expStrength == UCOL_TERTIARY) {
+          j = gooseUp(j, i, expansionLine, expIndexes, expIndexSize, UCOL_TERTIARY);
+        }
+      }
+      trial.setToConcat(toSort[j], &expansionLine);
+      expStrength = probe.getStrength(trial, *toSort[i]);
+      if(expansionLine.len) {
+        if(expansionLine.name[0] == 0x73 && expansionLine.name[1] == 0x7a) {
+          int32_t putBreakpointhere = 0;
+        }
+        UBool isExpansionLineAContraction = (contractionsTable->get(UnicodeString(expansionLine.name, expansionLine.len)) != NULL);
+        // we have an expansion line and an expansion. There could be some expansions where 
+        // the difference between expansion line and the end of expansion sequence is less or 
+        // equal than the expansion strength. These should probably be removed.
+        int32_t diffLen = toSort[i]->len - expansionLine.len;
+        if(diffLen > 0) {
+          trial.setTo(UnicodeString(toSort[i]->name + diffLen, toSort[i]->len - diffLen));
+        } else {
+          trial = *toSort[i];
+        }
+        UColAttributeValue s1 = probe.getStrength(trial, expansionLine);
+        if(s1 == UCOL_OFF) {
+          s1 = probe.getStrength(expansionLine, trial);
+        }
+        if((!isExpansionLineAContraction && s1 >= expStrength) || (diffLen <= 0 && s1 == UCOL_IDENTICAL)) {
+          contractionsTable->remove(UnicodeString(toSort[i]->name, toSort[i]->len));
+          toSort[i]->isRemoved = TRUE;
+          if(toSort[i]->next && toSort[i]->previous) {
+            toSort[i]->previous->next = toSort[i]->next;
+          }
+          if(toSort[i]->previous && toSort[i]->next) {
+            toSort[i]->next->previous = toSort[i]->previous;
+          }
+	      debug->log("Exp -N: ");
+	      debug->log(toSort[i]->toString(FALSE));
+	      debug->log(" / ");
+	      debug->log(expansionLine.toString(FALSE), TRUE);
+        }
+        else
+        {         
+          u_strncat(toSort[i]->expansionString, expansionLine.name, expansionLine.len);
+          toSort[i]->isExpansion = TRUE;
+          toSort[i]->expStrength = expStrength;
+          toSort[i]->expLen = expansionLine.len;
+          toSort[i]->expansionString[toSort[i]->expLen] = 0;
+          toSort[i]->expIndex = j;
+        }
+      }
+    }
+    if(toSort[i]->isExpansion == TRUE) {
+      if(debug->isOn()) {
+        debug->log("Exp + : &");
+        debug->log(toSort[j]->toString(FALSE));
+        debug->log(toSort[i]->strengthToString(toSort[i]->expStrength, TRUE));
+        debug->log(toSort[i]->toString(FALSE));
+        debug->log(" ");
+        if(!toSort[j]->sortKey) {
+          calculateSortKey(*toSort[j]);
+        }
+        debug->log(toSort[j]->dumpSortkey());
+        debug->log(" ... ");
+        if(!toSort[i]->sortKey) {
+          calculateSortKey(*toSort[i]);
+        }
+        debug->log(toSort[i]->dumpSortkey());
+        calculateSortKey(expansionLine);
+        debug->log("/");
+        debug->log(expansionLine.dumpSortkey(), TRUE);
+      }
+      
+    }
+  }
+  // after detecting expansions, we want to position them. 
+  // it is better to position expansions after all have been detected,
+  // since otherwise we will change the ordering.
+  for(i = size-1; i >= 0; i--) {
+    if(toSort[i]->isExpansion) {
+      if(toSort[i]->name[0] == 0x2A3) {
+        int32_t putBreakPointHere = 0;
+      }
+      if(i) {
+        if(toSort[i]->previous) {
+          toSort[i]->previous->next = toSort[i]->next;
+        }
+      }
+      if(i < size-1) {
+        if(toSort[i]->next) {
+          toSort[i]->next->previous = toSort[i]->previous;
+        }
+      }
+      j = toSort[i]->expIndex;
+      toSort[i]->next = toSort[j]->next;
+      toSort[i]->previous = toSort[j];
+      toSort[j]->next = toSort[i];
+      if(toSort[i]->next) {
+        toSort[i]->next->previous = toSort[i];
+      }
+      toSort[i]->strength = toSort[i]->expStrength;
+    }
+  }
+  return exCount;
+}
+
+
+Line *
+SortedLines::getFirst() {
+  current = first;
+  return current;
+}
+
+Line *
+SortedLines::getLast() {
+  current = last;
+  return current;
+}
+
+void 
+SortedLines::add(Line *line, UBool linkIn) {
+  if(size++ == capacity) {
+    // grow
+  }
+  lines[size] = *line;
+  Line *toAdd = &lines[size];
+  if(linkIn && first) {
+    Line *current = first;
+    while(current != NULL && probe.comparer(&current, &toAdd) < 0) {
+      current = current->next;
+    }
+    if(current == NULL) {
+      toAdd->previous = last;
+      toAdd->next = NULL;
+      if(last != NULL) {
+        last->next = toAdd;
+      }
+      last = toAdd;
+      if(first == NULL) {
+        first = toAdd;
+      }
+    } else { // current != NULL
+      toAdd->next = current;
+      toAdd->previous = current->previous;
+      if(current->previous) {
+        current->previous->next = toAdd;
+      } else {
+        first = toAdd;
+      }
+      current->previous = toAdd;
+    }
+  }
+}
+
+
+Line *
+SortedLines::getNext()
+{
+  if(current != NULL) {
+    current=current->next;
+  }
+  return current;
+}
+
+Line *
+SortedLines::getPrevious()
+{
+  if(current != NULL) {
+    current=current->previous;
+  }
+  return current;
+}
+
+Line *
+SortedLines::operator[](int32_t index)
+{
+  int32_t i = 0;
+  Line *c = first;
+  for(i = 0; i < index; i++) {
+    if(c != NULL) {
+      c = c->next;
+    }
+  }
+  return c;
+}
+
+UnicodeString
+SortedLines::arrayToString(Line** sortedLines, int32_t linesSize, UBool pretty, UBool useLinks, UBool printSortKeys) {
+  UnicodeString result;
+  int32_t i = 0;
+
+  Line *line = NULL;
+  Line *previous = sortedLines[0];
+  if(printSortKeys && !sortkeys) {
+    printSortKeys = FALSE;
+  }
+  if(previous->isReset) {
+    result.append(" & ");
+    result.append(previous->name, previous->len);
+    if(pretty) {
+      result.append("        # ");
+      result.append(previous->stringToName(previous->name, previous->len));
+      result.append("\n");
+    }
+  } else if(!previous->isRemoved) {
+    result.append(previous->toString(pretty));
+    if(pretty) {
+      result.append("\n");
+    }
+  }
+  i = 1;
+  while((i < linesSize && !useLinks) || (previous->next && useLinks)) {
+    if(useLinks) {
+      line = previous->next;
+    } else {
+      line = sortedLines[i];
+    }
+    if(line->isReset) {
+      result.append(" &");
+      result.append(line->name, line->len);
+      if(pretty) {
+        result.append("        # ");
+        result.append(line->stringToName(line->name, line->len));
+        result.append("\n");
+      }
+    } else if(!line->isRemoved) {
+      if(i > 0) {
+        result.append(line->strengthToString(line->strength, pretty));
+      }
+      result.append(line->toString(pretty));
+      if(printSortKeys) {
+        result.append(line->dumpSortkey());
+      }
+      if(pretty) {
+        result.append("\n");
+      }
+    }
+    previous = line;
+    i++;
+  }
+  return result;
+}
+
+SortedLines::SortedLines(FILE *file, UPrinter *logger, UPrinter *debug, UErrorCode &status) :
+toSort(NULL),
+toSortCapacity(0),
+lines(NULL),
+size(0),
+capacity(0),
+first(NULL),
+last(NULL),
+logger(logger),
+debug(debug),
+contractionsTable(NULL),
+duplicators(NULL),
+maxExpansionPrefixSize(0),
+wordSort(FALSE),
+frenchSecondary(FALSE),
+upperFirst(FALSE),
+sortkeys(NULL),
+sortkeyOffset(0)
+{
+  debug->log("*** loading a dump\n");
+  memset(UB, 0, sizeof(UB));
+  int32_t i = 0;
+  for(i = 0; i < UCOL_OFF; i++) {
+    UB[i] = &empty;
+  }
+
+  int32_t newFrench, newUpperFirst;
+  fscanf(file, "%i,%i,%i\n", &size, &newFrench, &newUpperFirst);
+  debug->log("Read size %i, frenchSecondary %i and upperFirst %i\n", size, newFrench, newUpperFirst);
+  frenchSecondary = (UBool)newFrench;
+  upperFirst = (UBool)newUpperFirst;
+  capacity = size;
+  lines = new Line[capacity];
+  i = 0;
+
+  char buff[256];
+
+  while(fgets(buff, 256, file)) {
+    if(i % 20 == 0) {
+      logger->log("\rLine: %04i", i, buff);
+    }
+    lines[i].initFromString(buff, 256, status);
+    if(i) {
+      lines[i].previous = &lines[i-1];
+      lines[i-1].next = &lines[i];
+    }
+    i++;
+  }
+  size = i;
+  toSort = new Line*[size];
+  setSortingArray(toSort, lines, size);
+  first = &lines[0];
+  last = &lines[size-1];
+}
+
+void
+SortedLines::toFile(FILE *file, UBool useLinks, UErrorCode &status) 
+{
+  fprintf(file, "%i,%i,%i\n", size, frenchSecondary, upperFirst);
+  int32_t i = 1;
+  Line *previous = toSort[0];
+  Line *line = NULL;
+  char buff[256];
+  previous->write(buff, 256, status);
+  fprintf(file, "%s\n", buff);
+  fflush(file);
+  while(previous->next) {
+    if(useLinks) {
+      line = previous->next;
+    } else {
+      line = toSort[i];
+    }
+    line->write(buff, 256, status);
+    fprintf(file, "%s\n", buff);
+    i++;
+    previous = line;
+  }
+}
+
+
+
+UnicodeString 
+SortedLines::toStringFromEmpty() {
+  UBool useLinks = FALSE;
+  UBool pretty = FALSE;
+  UnicodeString result;
+  int32_t i = 0;
+
+  Line *line = NULL;
+  Line *previous = toSort[0];
+  if(previous->isReset) {
+    result.append(" & ");
+    if(pretty) {
+      result.append("\n");
+    }
+    result.append(previous->name, previous->len);
+  } else if(!previous->isRemoved) {
+    result.append(previous->toString(pretty));
+    if(pretty) {
+      result.append("\n");
+    }
+  }
+  i = 1;
+  while(i < size || previous->next) {
+    if(useLinks) {
+      line = previous->next;
+    } else {
+      line = toSort[i];
+    }
+    if(line->isReset) {
+      result.append(" &");
+      result.append(line->name, line->len);
+      if(pretty) {
+        result.append("        # ");
+        result.append(line->stringToName(line->name, line->len));
+        result.append("\n");
+      }
+    } else if(!line->isRemoved) {
+      if(i > 0) {
+        result.append(line->strengthToString(line->strengthFromEmpty, pretty));
+      }
+      result.append(line->toString(pretty));
+      if(pretty) {
+        result.append("\n");
+      }
+    }
+    previous = line;
+    i++;
+  }
+  return result;
+}
+
+UnicodeString 
+SortedLines::toString(UBool useLinks) 
+{
+  return arrayToString(toSort, size, FALSE, useLinks, FALSE);
+}
+
+
+UnicodeString 
+SortedLines::toPrettyString(UBool useLinks, UBool printSortKeys) 
+{
+  return arrayToString(toSort, size, TRUE, useLinks, printSortKeys);
+}
+
+UnicodeString 
+SortedLines::toOutput(const char *format, 
+                       const char *locale, const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome) {
+  if(strcmp(format, "HTML") == 0) {
+    return toHTML(locale, platform, reference, useLinks, initialize, moreToCome);
+  } else if(strcmp(format, "XML") == 0) {
+    return toXML(locale, platform, reference, useLinks, initialize, moreToCome);
+  } else {
+    return toBundle(locale, platform, reference, useLinks, initialize, moreToCome);
+  }
+}
+
+
+UnicodeString 
+SortedLines::toHTML(const char *locale, 
+                       const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome)
+{
+  UnicodeString result;
+  int32_t i = 0;
+  if(initialize) {
+    result.append("<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n</head>\n");
+    result.append("# Collation data resource bundle generated for locale: ");
+    result.append(locale);
+    result.append("<br>\n# For platform ");
+    result.append(platform);
+    result.append(" reference platform ");
+    result.append(reference);
+    result.append("<br><br>\n\n\n");
+
+    result.append(locale);
+    if(platform) {
+      result.append("_");
+      result.append(platform);
+    }
+    if(reference) {
+      result.append("_vs_");
+      result.append(reference);
+    }
+    result.append("&nbsp;{<br>\n");
+
+    result.append("&nbsp;&nbsp;collations&nbsp;{<br>\n&nbsp;&nbsp;&nbsp;&nbsp;standard&nbsp;{<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sequence&nbsp;{<br>\n");
+  }
+
+  if(frenchSecondary) {
+    result.append("[backwards 2]<br>\n");
+  }
+  if(upperFirst) {
+    result.append("[casefirst upper]<br>\n");
+  }
+
+  Line *line = toSort[0];
+
+  i = 0;
+  while((i < size && !useLinks) || (line->next && useLinks)) {
+    if(line->isReset || !line->isRemoved) {
+      result.append(line->toHTMLString());
+    }
+    i++;
+    if(useLinks) {
+      line = line->next;
+    } else {
+      line = toSort[i];
+    }
+  }
+  if(!moreToCome) {
+    result.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n&nbsp;&nbsp;}<br>\n}<br>\n");
+
+    result.append("</html>\n");
+  }
+
+  return result;
+}
+
+UnicodeString 
+SortedLines::toXML(const char *locale, 
+                       const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome)
+{
+  UnicodeString result;
+  int32_t i = 0;
+  if(initialize) {
+    result.append("<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n</head>\n");
+    result.append("# Collation data resource bundle generated for locale: ");
+    result.append(locale);
+    result.append("<br>\n# For platform ");
+    result.append(platform);
+    result.append(" reference platform ");
+    result.append(reference);
+    result.append("<br><br>\n\n\n");
+
+    result.append(locale);
+    if(platform) {
+      result.append("_");
+      result.append(platform);
+    }
+    if(reference) {
+      result.append("_vs_");
+      result.append(reference);
+    }
+    result.append("&nbsp;{<br>\n");
+
+    result.append("&nbsp;&nbsp;collations&nbsp;{<br>\n&nbsp;&nbsp;&nbsp;&nbsp;standard&nbsp;{<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sequence&nbsp;{<br>\n");
+  }
+
+  if(frenchSecondary) {
+    result.append("[backwards 2]<br>\n");
+  }
+  if(upperFirst) {
+    result.append("[casefirst upper]<br>\n");
+  }
+
+  Line *line = toSort[0];
+
+  i = 0;
+  while((i < size && !useLinks) || (line->next && useLinks)) {
+    if(line->isReset || !line->isRemoved) {
+      result.append(line->toHTMLString());
+    }
+    i++;
+    if(useLinks) {
+      line = line->next;
+    } else {
+      line = toSort[i];
+    }
+  }
+  if(!moreToCome) {
+    result.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n&nbsp;&nbsp;}<br>\n}<br>\n");
+
+    result.append("</html>\n");
+  }
+
+  return result;
+}
+
+UnicodeString 
+SortedLines::toBundle(const char *locale, 
+                       const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome)
+{
+  UnicodeString result;
+  int32_t i = 0;
+
+  if(initialize) {
+    result.append("// Collation data resource bundle generated for locale: ");
+    result.append(locale);
+    result.append("\n// For platform ");
+    result.append(platform);
+    result.append(" reference platform ");
+    result.append(reference);
+    result.append("\n\n\n");
+
+    result.append(locale);
+    /*
+    if(platform) {
+      result.append("_");
+      result.append(platform);
+    }
+    if(reference) {
+      result.append("_vs_");
+      result.append(reference);
+    }
+    */
+    result.append(" {\n");
+
+    result.append("  collations {\n   standard {\n    Sequence {\n");
+  }
+
+  if(frenchSecondary) {
+    result.append("[backwards 2]\n");
+  }
+  if(upperFirst) {
+    result.append("[casefirst upper]\n");
+  }
+
+  Line *line = toSort[0];
+
+  i = 0;
+  while((i < size && !useLinks) || (line->next && useLinks)) {
+    if(line->isReset || !line->isRemoved) {
+      result.append(line->toBundleString());
+    }
+    i++;
+    if(useLinks) {
+      line = line->next;
+    } else {
+      line = toSort[i];
+    }
+  }
+
+  if(!moreToCome) {
+    result.append("    }\n   }\n  }\n}\n");
+  }
+
+  return result;
+}
+
+
+int32_t 
+SortedLines::getSize() const {
+  return repertoire.size();
+}
+
+void
+SortedLines::reduceDifference(SortedLines& reference) {
+  UErrorCode status = U_ZERO_ERROR;
+  if(upperFirst) {
+    swapCase();
+  }
+  // both sorted lines structures need to have established links and strengths
+  // We walk down both structures and note differences. These
+  // differences will modify this by removng elements, setting resets
+  // etc...
+  // we will prefer insertions from tailoring to reference, then deletions
+  // there are two tables that keep seen elements.
+  Hashtable *seenThis = new Hashtable();
+  Hashtable *seenReference = new Hashtable();
+
+
+  UBool found = FALSE;
+  UBool finished = FALSE;
+  const int32_t lookForward = 20;
+  int32_t tailoringMove = 0;
+  //int32_t referenceSize = reference.getSize();
+  Line *refLine = reference.getFirst();
+  Line *refLatestEqual = refLine;
+  refLine = refLine->next;
+  Line *myLine = getFirst();
+  Line *myLatestEqual = myLine;
+  myLatestEqual->isRemoved = TRUE;
+  myLine = myLine->next;
+  while(myLine && refLine) {
+    found = FALSE;
+    while(myLine && refLine && myLine->equals(*refLine)) {
+      myLatestEqual = myLine;
+      myLatestEqual->isRemoved = TRUE;
+      myLine = myLine->next;
+      refLatestEqual = refLine;
+      refLine = refLine->next;
+      if(refLine == NULL && myLine == NULL) {
+        finished = TRUE;
+      }
+    }
+    if(myLine) {
+      myLine->cumulativeStrength = myLine->strength;  
+    }
+    if(refLine) {
+      refLine->cumulativeStrength = refLine->strength;
+    }
+ 
+    // here is the difference
+    while(!found && !finished) {
+      tailoringMove = 0;
+      if(myLine && refLine) {
+        if(myLine->cumulativeStrength > refLine->cumulativeStrength) { 
+          // tailoring z <<< x, UCA z < y
+          while(myLine->cumulativeStrength > refLine->cumulativeStrength) {
+            myLine = myLine->next;
+            if(myLine) {
+              transferCumulativeStrength(myLine->previous, myLine);
+            } else {
+              break;
+            }
+          }
+        } else if(myLine->cumulativeStrength < refLine->cumulativeStrength) {  
+          // tailoring z < x, UCA z <<< y
+          while(myLine->cumulativeStrength < refLine->cumulativeStrength) {
+            seenReference->put(UnicodeString(refLine->name, refLine->len), refLine, status);
+            refLine = refLine->next;
+            if(refLine) {
+              transferCumulativeStrength(refLine->previous, refLine);
+            } else {
+              break;
+            }
+          }
+        }
+        // this is the interesting point. Now we search for character match
+        while(myLine && refLine && (!myLine->equals(*refLine) || myLine->strength == UCOL_IDENTICAL)
+          && tailoringMove < lookForward) {
+          if(seenThis->get(UnicodeString(refLine->name, refLine->len))) {
+            // we are not interested in stuff from the reference that is already accounted
+            // for in the tailoring.
+            refLine = refLine->next;
+            if(refLine) {
+              transferCumulativeStrength(refLine->previous, refLine);
+            }
+          } else {
+            myLine = myLine->next;
+            if(myLine) {
+              transferCumulativeStrength(myLine->previous, myLine);
+              if(!seenReference->get(UnicodeString(myLine->name, myLine->len))) {
+                tailoringMove++;
+              }
+            }
+          }
+        }
+      }
+      if(refLine == NULL) { // ran out of reference
+        // this is the tail of tailoring - the last insertion
+        myLine  = NULL;
+        found = TRUE;
+      } else if(tailoringMove == lookForward || myLine == NULL) { // run over treshold or out of tailoring
+        tailoringMove = 0;
+        // we didn't find insertion after all
+        // we will try substitution next
+        // reset the tailoring pointer
+        myLine = myLatestEqual->next;
+        // move the reference
+        refLine = refLine->next;
+        if(refLine) {
+          transferCumulativeStrength(refLine->previous, refLine);
+        }
+      } else { // we found an insertion
+        tailoringMove = 0;
+        if(myLine->strength != refLine->strength) {
+          while(myLine && refLine && *myLine == *refLine 
+            && (myLine->strength != refLine->strength 
+            || myLine->strength == UCOL_IDENTICAL)) {
+            myLine = myLine->next;
+            refLine = refLine->next;
+          }
+          if(*myLine != *refLine) {
+            continue;
+          }
+        }
+        if(myLine && refLine && myLine->previous->strength < myLine->strength) {
+          myLine = myLine->next;
+          refLine = refLine->next;
+          if(*myLine != *refLine) {
+            continue;
+          }
+        }
+        found = TRUE;
+      }
+      if(found) {
+        if(myLatestEqual->next != myLine || refLine == NULL) {
+          Line *myStart = NULL;
+          // this is a reset and a sequence
+          // myLatestEqual points at the last point that was the same
+          // This point will be a reset
+          if(myLine && refLine) { // if there is anything more to do - it might be worth saving it
+            myStart = myLatestEqual;
+            while(myStart != myLine) {
+              seenThis->put(UnicodeString(myStart->name, myStart->len), myStart, status);
+              myStart = myStart->next;
+            }
+          }
+          // Try to weed out stuff that is not affected, like:
+          // Tailoring:
+          // <<<S<<\u017F<\u0161<<<\u0160<t
+          // UCA:
+          // <<<S<<\u0161<<<\u0160<<\u017F<t
+          // Result:
+          // &S<<\u017F<\u0161<<<\u0160
+          // we have a sequence that spans from myLatestEqual to myLine (that one could be NULL, 
+          // so we have to go down from myLatestEqual. 
+          // Basically, for every element, we want to see the strongest cumulative difference 
+          // from the reset point. If the cumulative difference is the same in both the reference and
+          // tailoring, that element could be removed.
+          calculateCumulativeStrengths(myLatestEqual, myLine);
+          calculateCumulativeStrengths(refLatestEqual, refLine);
+          myStart = myLatestEqual;
+          int32_t removed = 0;
+          int32_t traversed = 0;
+          while(myStart && myStart != myLine) {
+            Line *refStart = refLatestEqual;
+            while(refStart && refStart != refLine) {
+              if(*myStart == *refStart) {
+                if(myStart->cumulativeStrength == refStart->cumulativeStrength) {
+                  myStart->isRemoved = TRUE;
+                  removed++;
+                }
+              }
+              refStart = refStart->next;
+            }
+            myStart = myStart->next;
+            traversed++;
+          }
+          if(removed < traversed) {
+            myLatestEqual->isReset = TRUE;
+            myLatestEqual->isRemoved = FALSE;
+          }
+
+          myLatestEqual = myLine;
+        }
+      }
+    }
+  }
+
+  if(upperFirst) {
+    //swapCase();
+  }
+
+  delete seenThis;
+  delete seenReference;
+
+}
+
+void
+SortedLines::transferCumulativeStrength(Line *previous, Line *that) {
+  if(that->strength > previous->cumulativeStrength) {
+    that->cumulativeStrength = previous->cumulativeStrength;
+  } else {
+    that->cumulativeStrength = that->strength;
+  }
+}
+
+void
+SortedLines::calculateCumulativeStrengths(Line *start, Line *end) {
+  // start is a reset - end may be NULL
+  start = start->next;
+  UColAttributeValue cumulativeStrength = UCOL_OFF;
+  while(start && start != end) {
+    if(start->strength < cumulativeStrength) {
+      cumulativeStrength = start->strength;
+    }
+    start->cumulativeStrength = cumulativeStrength;
+    start = start->next;
+  }
+}
+
+
+void 
+SortedLines::getRepertoire(UnicodeSet &fillIn) {
+  fillIn.clear();
+  fillIn.addAll(repertoire);
+}
+
+
+void
+SortedLines::removeDecompositionsFromRepertoire() {
+  UnicodeSetIterator repertoireIter(repertoire);
+  UErrorCode status = U_ZERO_ERROR;
+  UChar string[256];
+  UChar composed[256];
+  int32_t len = 0, compLen = 0;
+  UnicodeString compString;
+  UnicodeSet toRemove;
+
+  while(repertoireIter.next()) {
+    len = 0;
+    if(repertoireIter.isString()) { // process a string
+      len = repertoireIter.getString().length();
+      u_memcpy(string, repertoireIter.getString().getBuffer(), len);
+    } else { // process code point
+      UBool isError = FALSE;
+      U16_APPEND(string, len, 25, repertoireIter.getCodepoint(), isError);
+    }
+    string[len] = 0; // zero terminate, for our evil ways
+    compLen = unorm_normalize(string, len, UNORM_NFC, 0, composed, 256, &status);
+    if(compLen != len || u_strcmp(string, composed) != 0) {
+      compString.setTo(composed, compLen);
+      if(repertoire.contains(compString)) {
+        toRemove.add(UnicodeString(string, len));
+      }
+    }
+  }
+  debug->log("\nRemoving\n");
+  debug->log(toRemove.toPattern(compString, TRUE), TRUE);
+  repertoire.removeAll(toRemove);
+}
+
+
+void
+SortedLines::swapCase() 
+{
+  int32_t i = 0;
+  for(i = 0; i < size; i++) {
+    toSort[i]->swapCase();
+  }
+}
+
+void
+SortedLines::calculateSortKey(Line &line) 
+{
+  if(!sortkeys) {
+    sortkeys = new uint8_t[size*1024];
+    memset(sortkeys, 0, size*1024);
+  }
+  line.sortKey = sortkeys+sortkeyOffset;
+  sortkeyOffset += probe.getSortKey(line, sortkeys+sortkeyOffset, size*256-sortkeyOffset);
+}
+
+
+void 
+SortedLines::calculateSortKeys()
+{
+  if(sortkeys) {
+    delete[] sortkeys;
+  }
+  sortkeyOffset = 0;
+  sortkeys = new uint8_t[size*256];
+  memset(sortkeys, 0, size*256);
+  int32_t i = 0;
+  for(i = 0; i < size; i++) {
+    calculateSortKey(*toSort[i]);
+  }
+}
diff --git a/trunk/colprobe/sortedlines.h b/trunk/colprobe/sortedlines.h
new file mode 100644
index 0000000..5f37006
--- /dev/null
+++ b/trunk/colprobe/sortedlines.h
@@ -0,0 +1,120 @@
+#ifndef COLPROBE_SORTEDLINES_H
+#define COLPROBE_SORTEDLINES_H
+
+// colprobe includes
+#include "colprobe.h"
+#include "line.h"
+#include "uprinter.h"
+#include "strengthprobe.h"
+
+
+// ICU includes
+#include "unicode/uniset.h"
+#include "unicode/usetiter.h"
+#include "unicode/uscript.h"
+#include "hash.h"
+
+class SortedLines {
+  Line empty;
+  Line *UB[UCOL_OFF];
+  UnicodeSet ignorables[UCOL_OFF];
+
+  Line **toSort;
+  int32_t toSortCapacity;
+  Line *lines;
+  int32_t size;
+  int32_t capacity;
+
+  UnicodeSet repertoire;
+  UnicodeSet excludeBounds;
+
+  StrengthProbe probe;
+
+  Line *first;
+  Line *last;
+  Line *current;
+  SortedLines() {};
+
+  UPrinter *logger;
+  UPrinter *debug;
+
+  Hashtable *contractionsTable;
+  Hashtable *duplicators; // elements that duplicate preceding characters
+  int32_t maxExpansionPrefixSize;
+
+  // Properties of the sort
+  UBool wordSort;
+  UBool frenchSecondary;
+  UBool upperFirst;
+
+  uint8_t *sortkeys;
+  int32_t sortkeyOffset;
+public:
+  SortedLines(const UnicodeSet &set, const UnicodeSet &excludeBounds, const StrengthProbe &probe, UPrinter *logger, UPrinter *debug);
+  SortedLines(FILE *file, UPrinter *logger, UPrinter *debug, UErrorCode &status);
+  ~SortedLines();
+  void analyse(UErrorCode &status);
+
+  void sort(UBool setStrengths = TRUE, UBool link = FALSE);
+  void sort(Line **sortingArray, int32_t sizeToSort, UBool setStrengths = TRUE, UBool link = FALSE);
+
+  Line *getFirst();
+  Line *getLast();
+  void add(Line *line, UBool linkIn = FALSE);
+  void insert(Line *line, int32_t index);
+  Line *getNext();
+  Line *getPrevious();
+  Line *operator[](int32_t index);
+  int32_t addContractionsToRepertoire(UErrorCode &status);
+
+  int32_t getSize() const;
+
+  int32_t detectExpansions();
+  
+  UnicodeString toString(UBool useLinks = FALSE);
+  UnicodeString toStringFromEmpty();
+  UnicodeString toPrettyString(UBool useLinks, UBool printSortKeys = FALSE);
+  UnicodeString toOutput(const char *format, 
+                         const char *locale, const char *platform, const char *reference, 
+                         UBool useLinks, UBool initialize, UBool moreToCome);
+  UnicodeString toBundle(const char *locale, const char *platform, const char *reference, 
+                         UBool useLinks, UBool initialize, UBool moreToCome);
+  UnicodeString toHTML(const char *locale, const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome);
+  UnicodeString toXML(const char *locale, const char *platform, const char *reference, 
+                       UBool useLinks, UBool initialize, UBool moreToCome);
+  UnicodeString arrayToString(Line** sortedLines, int32_t linesSize, UBool pretty, UBool useLinks, UBool printSortKeys);
+  void setSortingArray(Line **sortingArray, Line *elements, int32_t sizeToSort);
+  int32_t setSortingArray(Line **sortingArray, Hashtable *table);
+
+  void reduceDifference(SortedLines& reference);
+  void getRepertoire(UnicodeSet &fillIn);
+  void removeDecompositionsFromRepertoire();
+  void getBounds(UErrorCode &status);
+  void classifyRepertoire();
+  void toFile(FILE *file, UBool useLinks, UErrorCode &status);
+  void swapCase();
+  void calculateSortKeys();
+  void calculateSortKey(Line &line);
+private:
+  void init();
+  void init(UnicodeSet &rep, Line *lin);
+  int32_t detectContractions(Line **firstRep, int32_t firstSize,
+                                        Line **secondRep, int32_t secondSize,
+                                        Line *toAddTo, int32_t &toAddToSize, 
+                                        Line *lesserToAddTo, int32_t &lesserToAddToSize,
+                                        int32_t capacity, UErrorCode &status);
+
+  void calculateCumulativeStrengths(Line *start, Line *end);
+  void transferCumulativeStrength(Line *previous, Line *that);
+  void updateBounds(UnicodeSet &set);
+  void addAll(Line* toAdd, int32_t toAddSize);
+  void setDistancesFromEmpty(Line* array, int32_t arraySize);
+  void noteContraction(const char* msg, Line *toAddTo, int32_t &toAddToSize, Line *left, Line *right, int32_t &noConts, UErrorCode &status);
+  int32_t gooseUp(int32_t resetIndex, int32_t expansionIndex, Line &expLine, int32_t *expIndexes, int32_t &expIndexSize, UColAttributeValue strength);
+  UBool getExpansionLine(const Line &expansion, const Line &previous, const Line &exp, Line &expansionLine);
+
+
+};
+
+#endif  // #ifndef COLPROBE_SORTEDLINES_H
diff --git a/trunk/colprobe/strengthprobe.cpp b/trunk/colprobe/strengthprobe.cpp
new file mode 100644
index 0000000..afa94b6
--- /dev/null
+++ b/trunk/colprobe/strengthprobe.cpp
@@ -0,0 +1,402 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File line.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   07/07/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+//
+//   class Line
+//
+//      Each line from the source file (containing a name, presumably) gets
+//      one of these structs.
+//
+
+#include "strengthprobe.h"
+
+StrengthProbe::StrengthProbe(CompareFn comparer, GetSortKeyFn getter, UChar SE, 
+                             UChar B0, UChar B1, UChar B2, UChar B3) :
+SE(SE),
+B0(B0), B1(B1), B2(B2), B3(B3),
+utilFirstP(&utilFirst), utilSecondP(&utilSecond),
+frenchSecondary(FALSE),
+comparer(comparer), skgetter(getter)
+{
+}
+
+int
+StrengthProbe::setProbeChars(UChar B0, UChar B1, UChar B2, UChar B3)
+{
+  this->B0 = B0;
+  this->B1 = B1;
+  this->B2 = B2;
+  this->
+B3 = B3;
+  return checkSanity();
+}
+
+int
+StrengthProbe::checkSanity() 
+{
+  int sanityRes;
+  utilFirst.setTo(B0);
+  utilSecond.setTo(B3);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 3;
+  }
+  utilSecond.setTo(B2);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 2;
+  }
+  utilSecond.setTo(B1);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 1;
+  }
+  utilFirst.setTo(B3);
+  utilSecond.setTo(B2);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 5;
+  }
+  utilSecond.setTo(B1);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 4;
+  }
+  utilFirst.setTo(B2);
+  if((sanityRes = comparer(&utilFirstP, &utilSecondP)) >= 0) {
+    return sanityRes*10 + 6;
+  }
+  utilFirst.setTo(B0);
+  if(distanceFromEmptyString(utilFirst) > UCOL_PRIMARY) {
+    return 1000;
+  }
+  utilFirst.setTo(B1);
+  if(distanceFromEmptyString(utilFirst) > UCOL_PRIMARY) {
+    return 1001;
+  }
+  utilFirst.setTo(B2);
+  if(distanceFromEmptyString(utilFirst) > UCOL_PRIMARY) {
+    return 1002;
+  }
+  utilFirst.setTo(B3);
+  if(distanceFromEmptyString(utilFirst) > UCOL_PRIMARY) {
+    return 1003;
+  }
+  return 0;
+}
+
+UBool 
+StrengthProbe::probePrefix(const Line &x, const Line &y, UChar first, UChar second) {
+  utilFirst.name[0] = first;
+  utilFirst.name[1] = SE;
+  u_strcpy(utilFirst.name+2, x.name);
+  utilFirst.name[x.len+2] = 0;
+  utilFirst.len = x.len+2;
+
+  utilSecond.name[0] = second;
+  utilSecond.name[1] = SE;
+  u_strcpy(utilSecond.name+2, y.name);
+  utilSecond.name[y.len+2] = 0;
+  utilSecond.len = y.len+2;
+
+  if(comparer(&utilFirstP, &utilSecondP) < 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UBool 
+StrengthProbe::probeSuffix(const Line &x, const Line &y, UChar first, UChar second) {
+  u_strcpy(utilFirst.name, x.name);
+  utilFirst.name[x.len] = SE;
+  utilFirst.name[x.len+1] = first;
+  utilFirst.name[x.len+2] = 0;
+  utilFirst.len = x.len + 2;
+  u_strcpy(utilSecond.name, y.name);
+  utilSecond.name[y.len] = SE;
+  utilSecond.name[y.len+1] = second;
+  utilSecond.name[y.len+2] = 0;
+  utilSecond.len = y.len + 2;
+
+  if(comparer(&utilFirstP, &utilSecondP) < 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UBool 
+StrengthProbe::probePrefixNoSep(const Line &x, const Line &y, UChar first, UChar second) {
+  utilFirst.name[0] = first;
+  u_strcpy(utilFirst.name+1, x.name);
+  utilFirst.name[x.len+1] = 0;
+  utilFirst.len = x.len + 1;
+
+  utilSecond.name[0] = second;
+  u_strcpy(utilSecond.name+1, y.name);
+  utilSecond.name[y.len+1] = 0;
+  utilSecond.len = y.len + 1;
+
+  if(comparer(&utilFirstP, &utilSecondP) < 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UBool 
+StrengthProbe::probeSuffixNoSep(const Line &x, const Line &y, UChar first, UChar second) {
+  u_strcpy(utilFirst.name, x.name);
+  utilFirst.name[x.len] = first;
+  utilFirst.name[x.len+1] = 0;
+  utilFirst.len = x.len + 1;
+  u_strcpy(utilSecond.name, y.name);
+  utilSecond.name[y.len] = second;
+  utilSecond.name[y.len+1] = 0;
+  utilSecond.len = y.len + 1;
+
+  if(comparer(&utilFirstP, &utilSecondP) < 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+UColAttributeValue 
+StrengthProbe::getStrength(const Line &x, const Line &y) {
+  const Line *xp = &x;
+  const Line *yp = &y;
+
+  Line empty;
+  Line *emptyP = &empty;
+  if(comparer(&emptyP, &xp) == 0) {
+    return distanceFromEmptyString(y);
+  }
+
+  int32_t result = comparer(&xp, &yp);
+
+  if(result == 0) {
+    return UCOL_IDENTICAL;
+  } else if(result > 0) {
+    return UCOL_OFF; // bad situation
+  } else { // we need to probe strength
+    if(probeSuffix(x, y, B1, B0)) {
+    //if(probePrefix(x, y, B2, B0)) { // swamps secondary difference
+      return UCOL_PRIMARY;
+    } else if(probePrefix(x, y, B3, B0)) { // swamps tertiary difference
+      return UCOL_SECONDARY;
+    } else if(probeSuffix(x, y, B3, B0)) { // swamped by tertiary difference
+      return UCOL_TERTIARY;
+    } else if(!probePrefix(x, y, B3, B0)) {
+      return UCOL_QUATERNARY;
+    }
+    /*
+    //if(probeSuffix(x, y, B1, B0)) {
+    if(probePrefix(x, y, B2, B0)) { // swamps secondary difference
+      return UCOL_PRIMARY;
+    } else if(probePrefix(x, y, B3, B0)) { // swamps tertiary difference
+      return UCOL_SECONDARY;
+    } else if(probeSuffix(x, y, B3, B0)) { // swamped by tertiary difference
+      return UCOL_TERTIARY;
+    } else if(!probePrefix(x, y, B3, B0)) {
+      return UCOL_QUATERNARY;
+    }
+    */
+  }
+  return UCOL_OFF; // bad
+}
+
+UColAttributeValue 
+StrengthProbe::getStrength(const UnicodeString &sx, const UnicodeString &sy) {
+  Line x(sx);
+  Line y(sy);
+  return getStrength(x, y);
+}
+
+int32_t 
+StrengthProbe::compare(const UnicodeString &sx, const UnicodeString &sy) {
+  Line x(sx);
+  Line y(sy);
+  const Line *xp = &x;
+  const Line *yp = &y;
+  return comparer(&xp, &yp);
+}
+
+int32_t 
+StrengthProbe::compare(const Line &x, const Line &y) {
+  const Line *xp = &x;
+  const Line *yp = &y;
+  return comparer(&xp, &yp);
+}
+
+UColAttributeValue 
+StrengthProbe::distanceFromEmptyString(const Line &x) {
+  if(x.name[0] == 0x30D) {
+    int32_t putBreakPointHere = 0;
+  }
+  Line empty;
+  Line *emptyP = &empty;
+  uint8_t buff[256];
+  getSortKey(empty.name, empty.len, buff, 256);
+  Line B0Line(B0);
+  Line *B0LineP = &B0Line;
+  const Line *xp = &x;
+  int32_t result = comparer(&emptyP, &xp);
+  if(result == 0) {
+    return UCOL_IDENTICAL;
+  } else if(result > 0) {
+    return UCOL_OFF;
+  }
+  result = comparer(&B0LineP, &xp);
+  if(result <= 0) {
+    return UCOL_PRIMARY;
+  }
+  Line sexb0(SE);
+  sexb0.append(x.name, x.len);
+  sexb0.append(B0);
+
+  Line seb0(SE);
+  seb0.append(B0);
+  uint8_t seb0K[256];
+  uint8_t sexb0K[256];
+  uint8_t seb2K[256];
+  uint8_t seb3K[256];
+  memset(seb0K, 0, 256);
+  memset(sexb0K, 0, 256);
+  memset(seb2K, 0, 256);
+  memset(seb3K, 0, 256);
+
+  getSortKey(seb0, seb0K, 256);
+  getSortKey(sexb0, sexb0K, 256);
+
+  if(compare(seb0, sexb0) <= 0) {
+    Line seb2(SE);
+    seb2.append(B2);
+    getSortKey(seb2, seb2K, 256);
+    result = compare(seb2, sexb0);
+    if((result <= 0 && !frenchSecondary) || (result >= 0 && frenchSecondary)) { // swamps tertiary difference
+      return UCOL_SECONDARY;
+    }
+    Line seb3(SE);
+    seb3.append(B3);
+    getSortKey(seb3, seb3K, 256);
+    if(compare(seb3, sexb0) < 0) {
+      return UCOL_TERTIARY;
+    }
+    return UCOL_QUATERNARY;
+  } else {
+    // if this was UCA, we would have a primary difference.
+    // however, this might not be so, since not everybody 
+    // makes well formed CEs.
+    // in cs_CZ on linux, space is tertiary ignorable, but
+    // its quaternary level strength is lower than quad 
+    // strengths for non-ignorables. oh well, more testing
+    // required
+    // I think that we can only have quaternary difference
+    // here (in addition to primary difference).
+    //if(!probePrefix(x, empty, B3, B0)) {
+      //return UCOL_QUATERNARY;
+    //} else {
+      return UCOL_PRIMARY;
+    //}
+  }
+}
+
+UColAttributeValue 
+StrengthProbe::distanceFromEmptyString(const UnicodeString &x) {
+  const Line xp(x);
+  return distanceFromEmptyString(xp);
+}
+
+
+UColAttributeValue 
+StrengthProbe::getPrefixedStrength(const Line &prefix, const Line &x, const Line &y) {
+  contractionUtilFirst.setToConcat(&prefix, &x);
+  contractionUtilSecond.setToConcat(&prefix, &y);
+  return getStrength(contractionUtilFirst, contractionUtilSecond);
+}
+
+
+StrengthProbe::StrengthProbe(const StrengthProbe &that) {
+  *this = that;
+}
+
+StrengthProbe &
+StrengthProbe::operator=(const StrengthProbe &that) {
+  if(this != &that) {
+    B0 = that.B0;
+    B1 = that.B1;
+    B2 = that.B2;
+    B3 = that.B3;
+    SE = that.SE;
+    frenchSecondary = that.frenchSecondary;
+    comparer = that.comparer;
+    skgetter = that.skgetter;
+
+    utilFirstP = &utilFirst;
+    utilSecondP = &utilSecond;
+  }
+
+  return *this;
+}
+
+UBool
+StrengthProbe::isFrenchSecondary(UErrorCode &status) {
+  utilFirst.setTo(B0);
+  utilFirst.append(SE);
+  utilFirst.append(B2);
+  utilSecond.setTo(B2);
+  utilSecond.append(SE);
+  utilSecond.append(B0);
+
+  int32_t result = compare(utilFirst, utilSecond);
+
+  if(result < 0) {
+    return FALSE;
+  } else if(result > 0) {
+    frenchSecondary = TRUE;
+    return TRUE;
+  } else {
+    status = U_INTERNAL_PROGRAM_ERROR;
+    return FALSE;
+  }
+}
+
+UBool
+StrengthProbe::isUpperFirst(UErrorCode &status) {
+  UChar i = 0;
+  int32_t result = 0;
+  int32_t upper = 0, lower = 0, equal = 0;
+  for(i = 0x41; i < 0x5B; i++) {
+    utilFirst.setTo(i);
+    utilSecond.setTo(i+0x20);
+    result = compare(utilFirst, utilSecond);
+    if(result < 0) {
+      upper++;
+    } else if(result > 0) {
+      lower++;
+    } else {
+      equal++;
+    }
+  }
+  
+  if(lower == 0 && equal == 0) {
+    return TRUE;
+  }
+  if(upper == 0 && equal == 0) {
+    return FALSE;
+  }
+  status = U_INTERNAL_PROGRAM_ERROR;
+  return FALSE;
+}
+
diff --git a/trunk/colprobe/strengthprobe.h b/trunk/colprobe/strengthprobe.h
new file mode 100644
index 0000000..ec925b2
--- /dev/null
+++ b/trunk/colprobe/strengthprobe.h
@@ -0,0 +1,85 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File line.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   07/07/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+//
+//   class Line
+//
+//      Each line from the source file (containing a name, presumably) gets
+//      one of these structs.
+//
+
+#ifndef COLPROBE_STRENGTHPROBE_H
+#define COLPROBE_STRENGTHPROBE_H
+
+#include "colprobe.h"
+#include "line.h"
+#include "unicode/uniset.h"
+#include "unicode/usetiter.h"
+
+class StrengthProbe {
+public:
+  UChar SE;
+  UChar B0;
+  UChar B1;
+  UChar B2;
+  UChar B3;
+private:
+  Line utilFirst;
+  Line utilSecond;
+  Line *utilFirstP;
+  Line *utilSecondP;
+  Line contractionUtilFirst;
+  Line contractionUtilSecond;
+  UBool probePrefix(const Line &x, const Line &y, UChar first, UChar second);
+  UBool probeSuffix(const Line &x, const Line &y, UChar first, UChar second);
+  UBool probePrefixNoSep(const Line &x, const Line &y, UChar first, UChar second);
+  UBool probeSuffixNoSep(const Line &x, const Line &y, UChar first, UChar second);
+
+  UBool frenchSecondary;
+
+public:
+  CompareFn comparer;
+  GetSortKeyFn skgetter;
+  
+  StrengthProbe() {};
+  StrengthProbe(CompareFn comparer, GetSortKeyFn getter, UChar SE = 0x0030, UChar B0 = 0x0061, UChar B1 = 0x0062, UChar B2 = 0x00E1, UChar B3 = 0x0041); //, UChar LB = 0x0039, UChar UB = 0xfa29);
+  int setProbeChars(UChar B0, UChar B1, UChar B2, UChar B3);
+  int checkSanity();
+  StrengthProbe(const StrengthProbe &that);
+  StrengthProbe &operator=(const StrengthProbe &that);
+  UColAttributeValue getStrength(const Line &x, const Line &y);
+  UColAttributeValue getStrength(const UnicodeString &x, const UnicodeString &y);
+  UColAttributeValue getPrefixedStrength(const Line &prefix, const Line &x, const Line &y);
+  int32_t compare(const UnicodeString &x, const UnicodeString &y);
+  int32_t compare(const Line &x, const Line &y);
+  UColAttributeValue distanceFromEmptyString(const Line &x);
+  UColAttributeValue distanceFromEmptyString(const UnicodeString &x);
+  UBool isFrenchSecondary(UErrorCode &status);
+  UBool isUpperFirst(UErrorCode &status);
+  int getSortKey(const Line &l, uint8_t *buffer, int32_t buffCap) {
+    return skgetter(l.name, l.len, buffer, buffCap);
+  };
+
+  int getSortKey(UChar *string, int32_t sLen, uint8_t *buffer, int32_t buffCap) {
+    return skgetter(string, sLen, buffer, buffCap);
+  };
+ 
+};
+
+
+#endif //#ifndef COLPROBE_STRENGTHPROBE_H
+
diff --git a/trunk/colprobe/tableStarter.pl b/trunk/colprobe/tableStarter.pl
new file mode 100755
index 0000000..d1b7fbb
--- /dev/null
+++ b/trunk/colprobe/tableStarter.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $localeMinusA = `cat /home/weiv/src/icu/source/extra/colprobe/locale.txt`;
+my @locales = split(/\n/, $localeMinusA);
+my $locale;
+my $command;
+
+foreach $locale (@locales) {
+  if($locale =~ /_/ && !($locale =~ /^#/)) {
+    $command = "/home/weiv/src/icu/source/extra/colprobe/doComparisonTable.pl $locale";
+    print "$command\n";
+    `$command`;
+  }
+}
diff --git a/trunk/colprobe/targetsetgenerator.cpp b/trunk/colprobe/targetsetgenerator.cpp
new file mode 100644
index 0000000..e3dcbe8
--- /dev/null
+++ b/trunk/colprobe/targetsetgenerator.cpp
@@ -0,0 +1,8 @@
+#include "targetsetgenerator.h"
+
+TargetSetGenerator::TargetSetGenerator(UnicodeSet &startingSet, CompareFn comparer) :
+ comparer(comparer),
+ set(startingSet)
+{
+   addAll(startingSet);
+}
diff --git a/trunk/colprobe/targetsetgenerator.h b/trunk/colprobe/targetsetgenerator.h
new file mode 100644
index 0000000..cd89734
--- /dev/null
+++ b/trunk/colprobe/targetsetgenerator.h
@@ -0,0 +1,15 @@
+#ifndef TARGETSETGENERATOR_H
+#define TARGETSETGENERATOR_H
+
+#include "colprobe.h"
+#include "unicode/uniset.h"
+
+class TargetSetGenerator : public UnicodeSet {
+public:
+  TargetSetGenerator(UnicodeSet &startingSet, CompareFn comparer);
+private:
+  CompareFn comparer;
+  UnicodeSet set;
+};
+
+#endif
\ No newline at end of file
diff --git a/trunk/colprobe/template b/trunk/colprobe/template
new file mode 100644
index 0000000..1a1aa91
--- /dev/null
+++ b/trunk/colprobe/template
@@ -0,0 +1,48 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>$locale</title>
+<style>
+         <!--
+         table        { border-spacing: 0; border-collapse: collapse; width: 100%; 
+               border: 1px solid black }
+td, th       { width: 10%; border-spacing: 0; border-collapse: collapse; color: black; 
+               vertical-align: top; border: 1px solid black }
+-->
+     </style>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p><b><font color="#FF0000">Collation:</font> $locale <a href="http://oss.software.ibm.com/cgi-bin/icu/lx/en/?_=$locale">Demo</a>, 
+
+<a href="http://oss.software.ibm.com/cvs/icu/~checkout~/locale/all_diff_xml/comparison_charts.html">Cover 
+Page</a>, <a href="http://oss.software.ibm.com/cvs/icu/~checkout~/locale/all_diff_xml/index.html">Index</a></b></p>
+<table>
+  <tr>
+    <th bgcolor="#AD989D">COMMON (<a href="http://oss.software.ibm.com/cvs/icu/~checkout~/locale/common/xml/$locale.xml">xml</a>)</th>
+    <th bgcolor="#1191F1">LINUX (<a href="http://oss.software.ibm.com/cvs/icu/~checkout~/locale/linux/xml/$locale.xml">xml</a>)</th>
+    <th bgcolor="#98FB98">WINDOWS (<a href="http://oss.software.ibm.com/cvs/icu/~checkout~/locale/windows/xml/$locale.xml">xml</a>)</th>
+  </tr>
+
+  <tr>
+    <td bgcolor="#AD989D">1.0-alpha</td>
+    <td bgcolor="#FF6633">1.0</td>
+    <td bgcolor="#FF6633">=</td>
+    <td bgcolor="#FF6633"><span title="006E {LATIN SMALL LETTER N}">&amp;n</span><br>
+      <span title="006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&lt;&nbsp;ny</span><br>
+
+      <span title="006E 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y} / 006E 0079 {LATIN SMALL LETTER N} {LATIN SMALL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;nny&nbsp;/&nbsp;ny</span><br>
+      <span title="006E 0059 {LATIN SMALL LETTER N} {LATIN CAPITAL LETTER Y}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&nbsp;nY</span><br>
+    </td>
+    <td bgcolor="#FF6633">=</td>
+    <td bgcolor="#FFFF33">1.2</td>
+
+    <td bgcolor="#98FB98">Windows XP</td>
+    <td bgcolor="#FF6633">=</td>
+    <td bgcolor="#FF6633">=</td>
+  </tr>
+</table>
+
+</body>
diff --git a/trunk/colprobe/uniqueFiles.pl b/trunk/colprobe/uniqueFiles.pl
new file mode 100755
index 0000000..67da54e
--- /dev/null
+++ b/trunk/colprobe/uniqueFiles.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $file;
+my $secondfile;
+my %secondfilelist;
+my @same;
+my %list;
+my $samefile;
+
+foreach $secondfile (@ARGV) {
+  $secondfilelist{$secondfile} = "";
+}
+
+foreach $file (sort keys(%secondfilelist)) {
+  if(exists $secondfilelist{$file}) {
+    delete $secondfilelist{$file};
+    foreach $secondfile (sort(keys %secondfilelist)) {
+      #print "diffing: $file and $secondfile\n";
+      if (!`diff $file $secondfile`) {
+        #print "$file and $secondfile are the same\n";
+        push @same, $secondfile;
+      }
+    }
+#    if ($#same > -1) {
+      print "Adding @same to $file\n";
+      $list{$file} =  [@same] ;
+      foreach $samefile (@same) {
+        delete $secondfilelist{$samefile};
+      }
+      delete @same[0..$#same];
+#    }
+  }
+}
+
+
+my $i = 0;
+my $j = 0;
+ foreach $file (sort( keys %list)) {
+   #print "$file -> "; #@{list{$file}}\n";
+   print "<$file> <$j>\n";
+   foreach $i ( 0 .. $#{ $list{$file} } ) {
+     #print "$list{$file}[$i] ";
+     print "<$list{$file}[$i]> <$j>\n ";
+   }
+   $j++;
+ }
+
diff --git a/trunk/colprobe/uprinter.cpp b/trunk/colprobe/uprinter.cpp
new file mode 100644
index 0000000..fd9ab9c
--- /dev/null
+++ b/trunk/colprobe/uprinter.cpp
@@ -0,0 +1,116 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File uprinter.cpp
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+#include "uprinter.h"
+
+UPrinter::UPrinter(FILE *file, const char *locale, const char *encoding, UBool transliterateNonPrintable) {
+  _on = TRUE;
+  out = u_finit(file, locale, encoding);
+  strcpy(_locale, locale);
+  if(transliterateNonPrintable) {
+    UErrorCode status = U_ZERO_ERROR;
+    UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+    u_fsettransliterator(out, U_WRITE, anyHex, &status);
+  }
+};
+
+UPrinter::UPrinter(const char *name, const char *locale, const char *encoding, UTransliterator *trans, UBool transliterateNonPrintable) {
+  _on = TRUE;
+  out = u_fopen(name, "wb", locale, encoding);
+  u_fputc(0xFEFF, out); // emit a BOM
+  strcpy(_locale, locale);
+  if(transliterateNonPrintable) {
+    UErrorCode status = U_ZERO_ERROR;
+    if(trans == NULL) {
+      UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+      u_fsettransliterator(out, U_WRITE, anyHex, &status);
+    } else {
+      u_fsettransliterator(out, U_WRITE, trans, &status);
+    }
+  }
+};
+
+UPrinter::~UPrinter() {
+  u_fclose(out);
+}
+
+void 
+UPrinter::log(const UnicodeString &string, UBool nl) {
+  if(_on) {
+    log(((UnicodeString)string).getTerminatedBuffer(), nl);
+  }
+}
+
+void 
+UPrinter::log(const UChar *string, UBool nl) {
+  if(_on) {
+    u_fprintf(out, "%S", string);
+    if(nl) {
+      u_fprintf(out, "\n");
+    }
+    u_fflush(out);
+  }
+}
+/*
+void 
+UPrinter::log(const char *string, UBool nl) {
+  if(_on) {
+    u_fprintf(out, "%s", string);
+    if(nl) {
+      u_fprintf(out, "\n");
+    }
+  }
+}
+*/
+void 
+UPrinter::log(const Line *line, UBool nl) {
+  if(_on) {
+    log(line->name);
+    if(line->expLen) {
+      log("/");
+      log(line->expansionString);
+    }
+    if(nl) {
+      u_fprintf(out, "\n");
+      u_fflush(out);
+    }
+  }
+}
+
+void UPrinter::log(const char *fmt, ...)
+{
+    UChar buffer[4000];
+    va_list ap;
+
+    va_start(ap, fmt);
+    /* sprintf it just to make sure that the information is valid */
+    u_vsprintf(buffer, _locale, fmt, ap);
+    va_end(ap);
+    if( _on ) {
+        log(buffer);
+    }
+}
+
+void
+UPrinter::on(void) {
+  _on = TRUE;
+}
+
+void
+UPrinter::off(void) {
+  _on = FALSE;
+}
diff --git a/trunk/colprobe/uprinter.h b/trunk/colprobe/uprinter.h
new file mode 100644
index 0000000..c242104
--- /dev/null
+++ b/trunk/colprobe/uprinter.h
@@ -0,0 +1,51 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2003, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*
+* File uprinter.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   03/18/2003  weiv        Creation.
+*******************************************************************************
+*/
+
+#ifndef COLPROBE_UPRINTER_H
+#define COLPROBE_UPRINTER_H
+
+#include "line.h"
+
+#include "unicode/ustdio.h"
+#include "unicode/unistr.h"
+#include "unicode/ustring.h"
+
+
+class UPrinter {
+  UFILE *out;
+  UChar buffer[256];
+  UBool _on;
+  char _locale[256];
+public:
+  UPrinter(FILE *file, const char *locale, const char *encoding, UBool transliterateNonPrintable=TRUE);
+  UPrinter(const char *name, const char *locale, const char *encoding, UTransliterator *trans, UBool transliterateNonPrintable);
+  ~UPrinter();
+  void log(const UnicodeString &string, UBool nl = FALSE);
+  void log(const UChar *string, UBool nl = FALSE);
+  //void log(const char *string, UBool nl = FALSE);
+  void log(const Line *line, UBool nl = FALSE);
+  void log(const char *fmt, ...);
+  void off(void);
+  void on(void);
+  UBool isOn(void) {
+    return _on;
+  };
+};
+
+
+
+#endif // #ifndef COLPROBE_UPRINTER_H
diff --git a/trunk/colprobe/winGenCollData.pl b/trunk/colprobe/winGenCollData.pl
new file mode 100755
index 0000000..e77464c
--- /dev/null
+++ b/trunk/colprobe/winGenCollData.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+#my $localeMinusA = `locale -a`;
+my $localeMinusA = `cat locale.txt`;
+
+my @locales = split(/\r\n/, $localeMinusA);
+my $locale;
+my $command;
+
+#my $commandPath = "~/src/icu/source/extra/colprobe/";
+my $commandPath = "c:/dev/0_icu/source/extra/colprobe/release/";
+
+
+my $platform = $ARGV[0];
+
+mkdir $platform."logs";
+mkdir $platform;
+
+foreach $locale (@locales) {
+  $_ = $locale;
+  chomp;
+  if(!/^\#/) { # && /\_/) {
+    $command = $commandPath."colprobe --platform $platform --ref $platform --output resb $locale >$platform"."logs/$locale"."_log.txt 2>&1";
+ 
+    print "$command\n";
+    `$command`;
+  }
+}
diff --git a/trunk/currency/.classpath b/trunk/currency/.classpath
new file mode 100644
index 0000000..17d748d
--- /dev/null
+++ b/trunk/currency/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="output" path="out/bin"/>

+</classpath>

diff --git a/trunk/currency/.project b/trunk/currency/.project
new file mode 100644
index 0000000..d380ad1
--- /dev/null
+++ b/trunk/currency/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>currency-numeric</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/trunk/currency/.settings/org.eclipse.core.resources.prefs b/trunk/currency/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..2201c34
--- /dev/null
+++ b/trunk/currency/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Jan 20 00:09:53 EST 2012

+eclipse.preferences.version=1

+encoding/<project>=UTF-8

diff --git a/trunk/currency/.settings/org.eclipse.jdt.core.prefs b/trunk/currency/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..1dc7e58
--- /dev/null
+++ b/trunk/currency/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,347 @@
+#Thu Jan 19 10:20:40 EST 2012

+eclipse.preferences.version=1

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve

+org.eclipse.jdt.core.compiler.compliance=1.6

+org.eclipse.jdt.core.compiler.debug.lineNumber=generate

+org.eclipse.jdt.core.compiler.debug.localVariable=generate

+org.eclipse.jdt.core.compiler.debug.sourceFile=generate

+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore

+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning

+org.eclipse.jdt.core.compiler.problem.deadCode=warning

+org.eclipse.jdt.core.compiler.problem.deprecation=warning

+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled

+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled

+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning

+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning

+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled

+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore

+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning

+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning

+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error

+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning

+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning

+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore

+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore

+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore

+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning

+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore

+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore

+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore

+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning

+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning

+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning

+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore

+org.eclipse.jdt.core.compiler.problem.nullReference=warning

+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning

+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore

+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore

+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore

+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning

+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore

+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore

+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled

+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning

+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore

+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning

+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning

+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore

+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning

+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore

+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore

+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

+org.eclipse.jdt.core.compiler.problem.unusedImport=warning

+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning

+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning

+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore

+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled

+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled

+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning

+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning

+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning

+org.eclipse.jdt.core.compiler.source=1.6

+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16

+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16

+org.eclipse.jdt.core.formatter.alignment_for_assignment=0

+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16

+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16

+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80

+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0

+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16

+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0

+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16

+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16

+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16

+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16

+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1

+org.eclipse.jdt.core.formatter.blank_lines_after_package=1

+org.eclipse.jdt.core.formatter.blank_lines_before_field=0

+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0

+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1

+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1

+org.eclipse.jdt.core.formatter.blank_lines_before_method=1

+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1

+org.eclipse.jdt.core.formatter.blank_lines_before_package=0

+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1

+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1

+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line

+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line

+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false

+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false

+org.eclipse.jdt.core.formatter.comment.format_block_comments=true

+org.eclipse.jdt.core.formatter.comment.format_header=false

+org.eclipse.jdt.core.formatter.comment.format_html=true

+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true

+org.eclipse.jdt.core.formatter.comment.format_line_comments=true

+org.eclipse.jdt.core.formatter.comment.format_source_code=true

+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true

+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true

+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert

+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert

+org.eclipse.jdt.core.formatter.comment.line_length=120

+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true

+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true

+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false

+org.eclipse.jdt.core.formatter.compact_else_if=true

+org.eclipse.jdt.core.formatter.continuation_indentation=2

+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2

+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off

+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on

+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false

+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true

+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true

+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true

+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true

+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true

+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true

+org.eclipse.jdt.core.formatter.indent_empty_lines=false

+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true

+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true

+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true

+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false

+org.eclipse.jdt.core.formatter.indentation.size=4

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert

+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert

+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert

+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert

+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert

+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert

+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert

+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert

+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert

+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert

+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert

+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert

+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert

+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert

+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert

+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert

+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert

+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert

+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert

+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert

+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert

+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert

+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert

+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert

+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert

+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert

+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert

+org.eclipse.jdt.core.formatter.join_lines_in_comments=true

+org.eclipse.jdt.core.formatter.join_wrapped_lines=true

+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false

+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false

+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false

+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false

+org.eclipse.jdt.core.formatter.lineSplit=120

+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false

+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false

+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0

+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1

+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true

+org.eclipse.jdt.core.formatter.tabulation.char=space

+org.eclipse.jdt.core.formatter.tabulation.size=4

+org.eclipse.jdt.core.formatter.use_on_off_tags=false

+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false

+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

diff --git a/trunk/currency/.settings/org.eclipse.jdt.ui.prefs b/trunk/currency/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..72fef40
--- /dev/null
+++ b/trunk/currency/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,10 @@
+#Thu Jan 19 10:20:39 EST 2012

+eclipse.preferences.version=1

+formatter_profile=_ICU4J Standard

+formatter_settings_version=12

+org.eclipse.jdt.ui.ignorelowercasenames=true

+org.eclipse.jdt.ui.importorder=java;javax;org;com;

+org.eclipse.jdt.ui.javadoc=true

+org.eclipse.jdt.ui.ondemandthreshold=99

+org.eclipse.jdt.ui.staticondemandthreshold=99

+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n *******************************************************************************\r\n * Copyright (C) ${year}, International Business Machines Corporation and         *\r\n * others. All Rights Reserved.                                                *\r\n *******************************************************************************\r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>

diff --git a/trunk/currency/build.xml b/trunk/currency/build.xml
new file mode 100644
index 0000000..a7618f7
--- /dev/null
+++ b/trunk/currency/build.xml
@@ -0,0 +1,76 @@
+<!--
+*******************************************************************************
+* Copyright (C) 2012-2013, International Business Machines Corporation and    *
+* others. All Rights Reserved.                                                *
+*******************************************************************************
+-->
+<project name="currency-numeric" default="build" basedir=".">
+    <property name="out.dir" value="${basedir}/out"/>
+    <property name="src.dir" value="${basedir}/src"/>
+    <property name="classes.dir" value="${out.dir}/bin"/>
+    <property name="res.dir" value="${out.dir}/res"/>
+    <property name="xml.dir" value="${out.dir}/xml"/>
+
+    <property name="base.url" value="http://www.currency-iso.org/dam/downloads/"/>
+    <property name="current.xml" value="table_a1.xml"/>
+    <property name="historic.xml" value="table_a3.xml"/>
+
+<target name="build" depends="check, resource" description="Verify ICU's local data and generate ISO 4217 alpha-numeric code mapping data resource"/>
+
+<target name="classes" description="Build the Java tool">
+    <mkdir dir="${classes.dir}"/>
+    <javac srcdir="${src.dir}" destdir="${classes.dir}"
+            target="1.6" encoding="UTF-8" includeAntRuntime="false"/>
+</target>
+
+<target name="_checkLocalXml">
+    <condition property="isLocalXml">
+        <and>
+            <available file="${basedir}/${current.xml}"/>
+            <available file="${basedir}/${historic.xml}"/>
+        </and>
+    </condition>
+</target>
+
+<target name="_localXml" depends="_checkLocalXml" if="isLocalXml">
+    <echo message="Using local ISO 4217 XML data files"/>
+    <copy file="${current.xml}" todir="${xml.dir}"/>
+    <copy file="${historic.xml}" todir="${xml.dir}"/>
+</target>
+
+<target name="_downloadXml" unless="isLocalXml">
+    <echo message="Downloading ISO 4217 XML data files"/>
+    <mkdir dir="${xml.dir}"/>
+    <get src="${base.url}${current.xml}" dest="${xml.dir}"/>
+    <get src="${base.url}${historic.xml}" dest="${xml.dir}"/>
+</target>
+
+<target name="xmlData" depends="_localXml, _downloadXml" description="Prepare necessary ISO 4217 XML data files">
+</target>
+
+<target name="check" depends="classes, xmlData" description="Verify if ICU's local mapping data is synchronized with the XML data">
+    <java classname="com.ibm.icu.dev.tool.currency.Main"
+            classpath="${classes.dir}"
+            failonerror="true">
+        <arg value="check"/>
+        <arg value="${xml.dir}/${current.xml}"/>
+        <arg value="${xml.dir}/${historic.xml}"/>
+    </java>
+</target>
+
+<target name="resource" depends="classes" description="Build ISO 4217 alpha-numeric code mapping data resource">
+    <mkdir dir="${res.dir}"/>
+    <java classname="com.ibm.icu.dev.tool.currency.Main"
+            classpath="${classes.dir}"
+            failonerror="true">
+        <arg value="build"/>
+        <arg value="${res.dir}"/>
+    </java>
+    <echo message="ISO 4217 numeric code mapping data was successfully created in ${res.dir}"/>
+</target>
+
+<target name="clean" description="Delete build outputs">
+    <delete dir="${out.dir}"/>
+</target>
+
+</project>
\ No newline at end of file
diff --git a/trunk/currency/readme.txt b/trunk/currency/readme.txt
new file mode 100644
index 0000000..f755507
--- /dev/null
+++ b/trunk/currency/readme.txt
@@ -0,0 +1,112 @@
+*******************************************************************************
+* Copyright (C) 2012-2013, International Business Machines Corporation and    *
+* others. All Rights Reserved.                                                *
+*******************************************************************************
+
+[Overview]
+
+This directory contains a tool used for maintaining ICU's ISO 4217 currency
+code mapping data. ICU uses a resource generated by this tool for mapping
+ISO 4217 currency alpha codes to numeric codes.
+
+
+[Files]
+
+package com.ibm.icu.dev.tool.currency
+
+Main.java - The tool's entry point
+NumericCodeData.java - The mapping data used by ICU
+CurrencyDataParser.java - ISO 4217 XML data parser
+CurrencyDataEntry.java - ISO 4217 XML data entry
+
+
+[Details]
+
+com.ibm.icu.dev.tool.NumericCodeData has String[][] CODE_MAP_DATA.
+This array represents mappings between ISO 4217 alpha codes and
+numeric codes. ICU's resource bundle currencyNumericCodes is generated
+from the table.
+
+ISO 4217 maintenance agency - SIX Interbank Clearing distributes
+ISO 4217 code data in XML format. These files are found in
+http://www.currency-iso.org/iso_index/iso_tables.htm. There are two
+files that we're interested in.
+
+ - http://www.currency-iso.org/dl_iso_table_a1.xml
+ - http://www.currency-iso.org/dl_iso_tables_a3.xml
+
+Table A.1 contains current currencies and funds and Table A.3 contains
+historic denominations.
+
+The tool supports 2 commands - check / resource.
+
+1) check
+
+This command compares the hardcoded mapping data in NumericCodeData.java
+with the ISO 4217 XML data files side by side and check differences.
+
+2) resource
+
+This command writes out the hardcoded mapping data in NumericCodeData.java
+in ICU resource bundle source format - currencyNumericCodes.txt.
+
+
+[Release Tasks]
+
+For each ICU release, we should check if the mapping data is up to date.
+
+Prerequisites: Java 6+, ant
+
+First, run the ant target "check". This ant target download XML files from
+the SIX Interbank Clearing site and invoke the tool command "check".
+
+When the target successfully finished, you should see the log like below:
+----------------------------------------------------------------------------
+C:\devtls\trunk\currency>ant check
+Buildfile: C:\devtls\trunk\currency\build.xml
+
+classes:
+
+_checkLocalXml:
+
+_localXml:
+
+_downloadXml:
+     [echo] Downloading ISO 4217 XML data files
+      [get] Getting: http://www.currency-iso.org/dl_iso_table_a1.xml
+      [get] To: C:\devtls\trunk\currency\out\xml\dl_iso_table_a1.xml
+      [get] Getting: http://www.currency-iso.org/dl_iso_tables_a3.xml
+      [get] To: C:\devtls\trunk\currency\out\xml\dl_iso_tables_a3.xml
+
+xmlData:
+
+check:
+     [java] [OK] ICU data is synchronized with the reference data
+
+BUILD SUCCESSFUL
+Total time: 2 seconds
+----------------------------------------------------------------------------
+In this case, our data is synchronized with the latest XML data and you're done.
+
+
+If the data is out of sync, you should see message like below:
+----------------------------------------------------------------------------
+check:
+     [java] Missing alpha code in ICU map [ZWR]
+     [java] Codes not found in the reference data: ZZZ
+
+BUILD FAILED
+C:\devtls\trunk\currency\build.xml:54: Java returned: 1
+----------------------------------------------------------------------------
+In this case, you have to update the hardcoded data in NumericCodeData.
+You can either edit the table in NumericCodeData manually, or run the tool
+command "print" and copy the output and paste it to the table.
+
+Once you make sure "ant check" returns no errors, run "ant resource". This
+target generate out/res/currencyNumericCodes.txt. The file should go to
+<icu4c>/source/data/misc directory.
+
+Note: The default ant target does both operation. Although it creates the
+ICU resource file, you do not need to replace the one in ICU4C package with
+the newly generated one if "check" successfully finished.
+
diff --git a/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java b/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java
new file mode 100644
index 0000000..69dfc40
--- /dev/null
+++ b/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java
@@ -0,0 +1,141 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 2012, International Business Machines Corporation and         *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.tool.currency;
+
+/**
+ * Currency data entry corresponding to the XML data distributed by SIX Interbank Clearing
+ * (The ISO 4217 maintenance agency).
+ */
+public class CurrencyDataEntry {
+    private String entity;
+    private String currency;
+    private String alphabeticCode;
+    private Integer numericCode;
+    private Integer minorUnit;
+    private String withdrawalDate;
+    private String remark;
+    private boolean historic;
+
+    private CurrencyDataEntry(String entity, String currency, String alphabeticCode, Integer numericCode, Integer minorUnit, String withdrawalDate, String remark, boolean historic) {
+        this.entity = entity;
+        this.currency = currency;
+        this.alphabeticCode = alphabeticCode;
+        this.numericCode = numericCode;
+        this.minorUnit = minorUnit;
+        this.withdrawalDate = withdrawalDate;
+        this.remark = remark;
+        this.historic = historic;
+    }
+
+    public String entity() {
+        return entity;
+    }
+
+    public String currency() {
+        return currency;
+    }
+
+    public String alphabeticCode() {
+        return alphabeticCode;
+    }
+
+    public Integer numericCode() {
+        return numericCode;
+    }
+
+    public Integer minorUnit() {
+        return minorUnit;
+    }
+
+    public String withdrawalDate() {
+        return withdrawalDate;
+    }
+
+    public String remark() {
+        return remark;
+    }
+
+    public boolean historic() {
+        return historic;
+    }
+
+    public static class Builder {
+        private String entity_;
+        private String currency_;
+        private String alphabeticCode_;
+        private Integer numericCode_;
+        private Integer minorUnit_;
+
+        private String withdrawalDate_;
+        private String remark_;
+        private boolean historic_ = false;
+
+        public Builder setEntity(String entity) {
+            entity_ = entity;
+            return this;
+        }
+
+        public Builder setCurrency(String currency) {
+            currency_ = currency;
+            return this;
+        }
+
+        public Builder setAlphabeticCode(String alphabeticCode) {
+            alphabeticCode_ = alphabeticCode;
+            return this;
+        }
+
+        public Builder setNumericCode(String numericCode) {
+            try {
+                numericCode_ = Integer.parseInt(numericCode);
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+            return this;
+        }
+
+        public Builder setMinorUnit(String minorUnit) {
+            try {
+                minorUnit_ = Integer.parseInt(minorUnit);
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+            return this;
+        }
+
+        public Builder setWithdrawalDate(String withdrawalDate) {
+            withdrawalDate_ = withdrawalDate;
+            return this;
+        }
+
+        public Builder setRemark(String remark) {
+            remark_ = remark;
+            return this;
+        }
+
+        public Builder setHistoric() {
+            historic_ = true;
+            return this;
+        }
+
+        public CurrencyDataEntry build() {
+            return new CurrencyDataEntry(entity_, currency_, alphabeticCode_, numericCode_, minorUnit_, withdrawalDate_, remark_, historic_);
+        }
+
+        public Builder reset() {
+            entity_ = null;
+            currency_ = null;
+            alphabeticCode_ = null;
+            numericCode_ = null;
+            minorUnit_ = null;
+            withdrawalDate_ = null;
+            remark_ = null;
+            historic_ = false;
+            return this;
+        }
+    }
+}
diff --git a/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java b/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java
new file mode 100644
index 0000000..332824f
--- /dev/null
+++ b/trunk/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java
@@ -0,0 +1,145 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 2012-2013, International Business Machines Corporation and    *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.tool.currency;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import com.ibm.icu.dev.tool.currency.CurrencyDataEntry.Builder;
+
+/**
+ * Parser for ISO 4217 data file in XML format distributed by SIX Interbank Clearing
+ * (The ISO 4217 maintenance agency).
+ */
+public class CurrencyDataParser {
+
+    public static Collection<CurrencyDataEntry> parse(File dataFile, boolean historic) throws IOException {
+        Collection<CurrencyDataEntry> result = null;
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            SAXParser parser;
+            parser = factory.newSAXParser();
+            Handler handler = new Handler(historic);
+            parser.parse(new FileInputStream(dataFile), handler);
+            result = handler.getParsedISOCurrencies();
+        } catch (SAXException e) {
+            throw new RuntimeException(e);
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e);
+        }
+        return result;
+    }
+
+    private static class Handler extends DefaultHandler {
+        private enum ElementType {
+            ENTITY("CtryNm"),
+            CURRENCY("CcyNm"),
+            ALPHABETIC_CODE("Ccy"),
+            NUMERIC_CODE("CcyNbr"),
+            MINOR_UNIT("CcyMnrUnts"),
+            WITHDRAWAL_DATE("WthdrwlDt"),
+            REMARK("Remark"),   // obsolete
+            OTHER("Other");     // place holder
+
+            private String elemName;
+
+            ElementType(String elemName) {
+                this.elemName = elemName;
+            }
+
+            public static ElementType forName(String name) {
+                for (ElementType type : values()) {
+                    if (type.elemName.equals(name)) {
+                        return type;
+                    }
+                }
+                return OTHER;
+            }
+        };
+
+        Collection<CurrencyDataEntry> isoCurrencies = new LinkedList<CurrencyDataEntry>();
+        ElementType elem = ElementType.OTHER;
+        Builder currBld = new Builder();
+
+        private final boolean historic;
+        private final String currElemName;
+
+        public Handler(boolean historic) {
+            this.historic = historic;
+            currElemName = historic ? "HstrcCcyNtry" : "CcyNtry";
+        }
+
+        public Collection<CurrencyDataEntry> getParsedISOCurrencies() {
+            return isoCurrencies;
+        }
+
+        public void startElement(String uri, String localName, String qName, Attributes attributes) {
+            if (qName.equals(currElemName)) {
+                currBld.reset();
+                elem = ElementType.OTHER;
+            } else {
+                try {
+                    elem = ElementType.forName(qName);
+                } catch (IllegalArgumentException e) {
+                    elem = ElementType.OTHER;
+                }
+            }
+        }
+
+        public void endElement(String uri, String localName, String qName) {
+            // emit a currency data
+            if (qName.equals(currElemName)) {
+                if (historic) {
+                    currBld.setHistoric();
+                }
+                isoCurrencies.add(currBld.build());
+                currBld.reset();
+            }
+            elem = ElementType.OTHER;
+        }
+
+        public void characters(char[] ch, int start, int length) {
+            switch (elem) {
+            case ENTITY:
+                currBld.setEntity(new String(ch, start, length).trim());
+                break;
+            case CURRENCY:
+                currBld.setCurrency(new String(ch, start, length).trim());
+                break;
+            case ALPHABETIC_CODE:
+                currBld.setAlphabeticCode(new String(ch, start, length).trim());
+                break;
+            case NUMERIC_CODE:
+                currBld.setNumericCode(new String(ch, start, length).trim());
+                break;
+            case MINOR_UNIT:
+                currBld.setMinorUnit(new String(ch, start, length).trim());
+                break;
+            case WITHDRAWAL_DATE:
+                currBld.setWithdrawalDate(new String(ch, start, length).trim());
+                break;
+            case REMARK:
+                currBld.setRemark(new String(ch, start, length).trim());
+                break;
+            default:
+                // NOOP
+                break;
+            }
+        }
+    }
+}
diff --git a/trunk/currency/src/com/ibm/icu/dev/tool/currency/Main.java b/trunk/currency/src/com/ibm/icu/dev/tool/currency/Main.java
new file mode 100644
index 0000000..6bbc1b6
--- /dev/null
+++ b/trunk/currency/src/com/ibm/icu/dev/tool/currency/Main.java
@@ -0,0 +1,181 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 2012, International Business Machines Corporation and         *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.tool.currency;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.Collection;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeSet;
+
+/**
+ * The tool used for ISO 4217 alpha3-numeric3 code mapping data maintenance.
+ * This code is used for synchronizing ICU alpha3-numeric3 mapping data with
+ * the data distributed by SIX Interbank Clearing.
+ */
+public class Main {
+    private enum Command {
+        CHECK,
+        PRINT,
+        BUILD,
+    };
+
+    private static final String RESNAME = "currencyNumericCodes";
+
+    public static void main(String... args) {
+        if (args.length == 0) {
+            printUsage();
+            System.exit(1);
+        }
+
+        Command cmd = null;
+
+        // 1st argument must be command
+        if (args[0].equalsIgnoreCase(Command.CHECK.name())) {
+            if (args.length == 3) {
+                cmd = Command.CHECK;
+            }
+        } else if (args[0].equalsIgnoreCase(Command.PRINT.name())) {
+            if (args.length == 3) {
+                cmd = Command.PRINT;
+            }
+        } else if (args[0].equalsIgnoreCase(Command.BUILD.name())) {
+            if (args.length == 2) {
+                cmd = Command.BUILD;
+            }
+        }
+
+        if (cmd == null) {
+            printUsage();
+            System.exit(1);
+        }
+ 
+        int status = 0;
+
+        if (cmd == Command.BUILD) {
+            File outfile = new File(args[1], RESNAME + ".txt");
+            try {
+                OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8");
+                NumericCodeData.getDefaultInstance().writeResource(osw, RESNAME);
+            } catch (IOException e) {
+                e.printStackTrace();
+                status = 1;
+            }
+        } else {
+            // 2nd argument is current data xml file
+            // 3rd argument is historic data xml file
+            File currentXml = new File(args[1]);
+            File historicXml = new File(args[2]);
+            Collection<CurrencyDataEntry> currentDataEntries = null;
+            Collection<CurrencyDataEntry> historicDataEntries = null;
+
+            try {
+                currentDataEntries = CurrencyDataParser.parse(currentXml, false);
+                historicDataEntries = CurrencyDataParser.parse(historicXml, true);
+            } catch (IOException e) {
+                e.printStackTrace();
+                status = 1;
+            }
+
+            if (status == 0) {
+                NumericCodeData numCodeData = NumericCodeData.createInstance(currentDataEntries);
+                numCodeData.merge(NumericCodeData.createInstance(historicDataEntries));
+
+                if (cmd == Command.PRINT) {
+                    numCodeData.printArray();
+                } else {
+                    assert(cmd == Command.CHECK);
+                    boolean isOK = checkData(numCodeData);
+                    if (isOK) {
+                        System.out.println("[OK] ICU data is synchronized with the reference data");
+                    } else {
+                        status = 1;
+                    }
+                }
+            }
+        }
+
+        System.exit(status);
+    }
+
+    private static void printUsage() {
+        System.out.println("[Usage]");
+        System.out.println("");
+        System.out.println("  1) java com.ibm.icu.dev.tool.currency.Main check <currentXML> <historicXML>");
+        System.out.println("");
+        System.out.println("  Verifies the ICU data (table in NumericCodeData) with the reference data.");
+        System.out.println("");
+        System.out.println("  Argument(s):");
+        System.out.println("    <currentXML>  - Current currencies & funds data (Table A.1) in XML format");
+        System.out.println("    <historicXML> - Historic denominations data (Table A.3) in XML format");
+        System.out.println("");
+        System.out.println("  2) java com.ibm.icu.dev.tool.currency.Main print <currentXML> <historicXML>");
+        System.out.println("");
+        System.out.println("  Prints out the alpha-numeric code mapping imported from the reference data.");
+        System.out.println("");
+        System.out.println("  Argument(s):");
+        System.out.println("    <currentXML>  - Current currencies & funds data (Table A.1) in XML format");
+        System.out.println("    <historicXML> - Historic denominations data (Table A.3) in XML format");
+        System.out.println("");
+        System.out.println("  3) java com.ibm.icu.dev.tool.currency.Main build <outtxt>");
+        System.out.println("");
+        System.out.println("  Writes out the alpha-numeric in NumericCodeData into ICU resource bundle source");
+        System.out.println("  (.txt) format.");
+        System.out.println("");
+        System.out.println("  Argument(s):");
+        System.out.println("    <outdir>      - Output directory of the ICU resource bundle source (.txt) format");
+        System.out.println("");
+        System.out.println("[Note]");
+        System.out.println("  Reference XML files are distributed by the ISO 4217 maintenance agency at");
+        System.out.println("  [http://www.currency-iso.org/iso_index/iso_tables.htm].");
+    }
+
+    private static boolean checkData(NumericCodeData refData) {
+        boolean isOK = true;
+
+        SortedMap<String, String> icuMap = NumericCodeData.getDefaultInstance().getAlphaNumericCodeMap();
+        SortedMap<String, String> refMap = refData.getAlphaNumericCodeMap();
+
+        for (Entry<String, String> refEntry : refMap.entrySet()) {
+            String refAlpha = refEntry.getKey();
+            String refNumeric = refEntry.getValue();
+
+            String icuNumeric = icuMap.get(refAlpha);
+            if (icuNumeric == null) {
+                System.out.println("Missing alpha code in ICU map [" + refAlpha + "]");
+                isOK = false;
+            } else if (!icuNumeric.equals(refNumeric)) {
+                System.out.println("Numeric code mismatch [" + refAlpha + "] ICU=" + icuNumeric + " - Reference=" + refNumeric);
+                isOK = false;
+            }
+        }
+
+        Set<String> icuKeySet = icuMap.keySet();
+        Set<String> refKeySet = refMap.keySet();
+        if (!refKeySet.containsAll(icuKeySet)) {
+            isOK = false;
+            Set<String> tmp = new TreeSet<String>(icuKeySet);
+            tmp.removeAll(refKeySet);
+
+            StringBuilder buf = new StringBuilder();
+            for (String alpha : tmp) {
+                if (buf.length() != 0) {
+                    buf.append(", ");
+                }
+                buf.append(alpha);
+            }
+            
+            System.out.println("Codes not found in the reference data: " + buf);
+        }
+
+        return isOK;
+    }
+}
diff --git a/trunk/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java b/trunk/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java
new file mode 100644
index 0000000..5ca9d8e
--- /dev/null
+++ b/trunk/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java
@@ -0,0 +1,375 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 2012-2013, International Business Machines Corporation and    *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.tool.currency;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.TimeZone;
+import java.util.TreeMap;
+
+/**
+ * Container of ISO 4217 alpha3 - numeric3 code mapping data
+ */
+public class NumericCodeData {
+    private SortedMap<String, String> _codeMap;
+
+    private NumericCodeData(SortedMap<String, String> codeMap) {
+        _codeMap = codeMap;
+    }
+
+    public static NumericCodeData getDefaultInstance() {
+        SortedMap<String, String> map = new TreeMap<String, String>();
+        for (String[] dataEntry : CODE_MAP_DATA) {
+            map.put(dataEntry[0], dataEntry[1]);
+        }
+        return new NumericCodeData(map);
+    }
+
+    public static NumericCodeData createInstance(Collection<CurrencyDataEntry> dataEntries) {
+        SortedMap<String, String> map = new TreeMap<String, String>();
+        for (CurrencyDataEntry dataEntry : dataEntries) {
+            String alphaCode = dataEntry.alphabeticCode();
+            Integer numCode = dataEntry.numericCode();
+            if (alphaCode == null || numCode == null) {
+                continue;
+            }
+            map.put(alphaCode, String.format("%03d", numCode));
+        }
+        return new NumericCodeData(map);
+    }
+
+    public NumericCodeData merge(NumericCodeData anotherData) {
+        SortedMap<String, String> codeMap = anotherData.getAlphaNumericCodeMap();
+        for (Entry<String, String> codeMapEntry : codeMap.entrySet()) {
+            String alphaCode = codeMapEntry.getKey();
+            String numCode = codeMapEntry.getValue();
+            if (!_codeMap.containsKey(alphaCode)) {
+                _codeMap.put(alphaCode, numCode);
+            } else {
+                String existingValue = _codeMap.get(alphaCode);
+                if (!existingValue.equals(numCode)) {
+                    throw new RuntimeException("Duplicated definition for " + alphaCode + ": value=" + existingValue + "/another value=" + numCode);
+                }
+            }
+        }
+        return this;
+    }
+
+    public SortedMap<String, String> getAlphaNumericCodeMap() {
+        return Collections.unmodifiableSortedMap(_codeMap);
+    }
+
+    public void printArray() {
+        for (Entry<String, String> entry : getAlphaNumericCodeMap().entrySet()) {
+            System.out.println("        {\"" + entry.getKey() + "\", \"" + entry.getValue() + "\"},");
+        }
+    }
+
+    public void writeResource(OutputStreamWriter osw, String resName) throws IOException {
+        GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
+
+        PrintWriter pw = new PrintWriter(osw, true);
+
+        // Header
+        pw.println("//---------------------------------------------------------");
+        pw.println(String.format("// Copyright (C) %1$tY, International Business Machines", cal));
+        pw.println("// Corporation and others.  All Rights Reserved.");
+        pw.println("//---------------------------------------------------------");
+        pw.println("// Build tool: com.ibm.icu.dev.tool.currency.NumericCodeData");
+        pw.println(String.format("// Build date: %1$tFT%1$tTZ", cal));
+        pw.println("//---------------------------------------------------------");
+        pw.println("// >> !!! >>   THIS IS A MACHINE-GENERATED FILE   << !!! <<");
+        pw.println("// >> !!! >>>            DO NOT EDIT             <<< !!! <<");
+        pw.println("//---------------------------------------------------------");
+        pw.println("");
+
+        // Resource root
+        pw.println(resName + ":table(nofallback){");
+
+        // Map data
+        pw.println("    codeMap{");
+
+        for (Entry<String, String> mapEntry : _codeMap.entrySet()) {
+            String alphaCode = mapEntry.getKey();
+            int numericCodeVal = Integer.parseInt(mapEntry.getValue());
+            pw.println(String.format("        %1$s:int{%2$d}", alphaCode, numericCodeVal));
+        }
+
+        pw.println("    }");
+
+        pw.println("}");
+    }
+
+    private static final String[][] CODE_MAP_DATA = {
+        {"ADP", "020"},
+        {"AED", "784"},
+        {"AFA", "004"},
+        {"AFN", "971"},
+        {"ALL", "008"},
+        {"AMD", "051"},
+        {"ANG", "532"},
+        {"AOA", "973"},
+        {"AON", "024"},
+        {"AOR", "982"},
+        {"ARA", "032"},
+        {"ARP", "032"},
+        {"ARS", "032"},
+        {"ATS", "040"},
+        {"AUD", "036"},
+        {"AWG", "533"},
+        {"AYM", "945"},
+        {"AZM", "031"},
+        {"AZN", "944"},
+        {"BAD", "070"},
+        {"BAM", "977"},
+        {"BBD", "052"},
+        {"BDT", "050"},
+        {"BEC", "993"},
+        {"BEF", "056"},
+        {"BEL", "992"},
+        {"BGL", "100"},
+        {"BGN", "975"},
+        {"BHD", "048"},
+        {"BIF", "108"},
+        {"BMD", "060"},
+        {"BND", "096"},
+        {"BOB", "068"},
+        {"BOV", "984"},
+        {"BRC", "076"},
+        {"BRE", "076"},
+        {"BRL", "986"},
+        {"BRN", "076"},
+        {"BRR", "987"},
+        {"BSD", "044"},
+        {"BTN", "064"},
+        {"BWP", "072"},
+        {"BYB", "112"},
+        {"BYR", "974"},
+        {"BZD", "084"},
+        {"CAD", "124"},
+        {"CDF", "976"},
+        {"CHC", "948"},
+        {"CHE", "947"},
+        {"CHF", "756"},
+        {"CHW", "948"},
+        {"CLF", "990"},
+        {"CLP", "152"},
+        {"CNY", "156"},
+        {"COP", "170"},
+        {"COU", "970"},
+        {"CRC", "188"},
+        {"CSD", "891"},
+        {"CSK", "200"},
+        {"CUC", "931"},
+        {"CUP", "192"},
+        {"CVE", "132"},
+        {"CYP", "196"},
+        {"CZK", "203"},
+        {"DDM", "278"},
+        {"DEM", "276"},
+        {"DJF", "262"},
+        {"DKK", "208"},
+        {"DOP", "214"},
+        {"DZD", "012"},
+        {"ECS", "218"},
+        {"ECV", "983"},
+        {"EEK", "233"},
+        {"EGP", "818"},
+        {"ERN", "232"},
+        {"ESA", "996"},
+        {"ESB", "995"},
+        {"ESP", "724"},
+        {"ETB", "230"},
+        {"EUR", "978"},
+        {"FIM", "246"},
+        {"FJD", "242"},
+        {"FKP", "238"},
+        {"FRF", "250"},
+        {"GBP", "826"},
+        {"GEK", "268"},
+        {"GEL", "981"},
+        {"GHC", "288"},
+        {"GHP", "939"},
+        {"GHS", "936"},
+        {"GIP", "292"},
+        {"GMD", "270"},
+        {"GNF", "324"},
+        {"GQE", "226"},
+        {"GRD", "300"},
+        {"GTQ", "320"},
+        {"GWP", "624"},
+        {"GYD", "328"},
+        {"HKD", "344"},
+        {"HNL", "340"},
+        {"HRD", "191"},
+        {"HRK", "191"},
+        {"HTG", "332"},
+        {"HUF", "348"},
+        {"IDR", "360"},
+        {"IEP", "372"},
+        {"ILS", "376"},
+        {"INR", "356"},
+        {"IQD", "368"},
+        {"IRR", "364"},
+        {"ISK", "352"},
+        {"ITL", "380"},
+        {"JMD", "388"},
+        {"JOD", "400"},
+        {"JPY", "392"},
+        {"KES", "404"},
+        {"KGS", "417"},
+        {"KHR", "116"},
+        {"KMF", "174"},
+        {"KPW", "408"},
+        {"KRW", "410"},
+        {"KWD", "414"},
+        {"KYD", "136"},
+        {"KZT", "398"},
+        {"LAK", "418"},
+        {"LBP", "422"},
+        {"LKR", "144"},
+        {"LRD", "430"},
+        {"LSL", "426"},
+        {"LTL", "440"},
+        {"LTT", "440"},
+        {"LUC", "989"},
+        {"LUF", "442"},
+        {"LUL", "988"},
+        {"LVL", "428"},
+        {"LVR", "428"},
+        {"LYD", "434"},
+        {"MAD", "504"},
+        {"MDL", "498"},
+        {"MGA", "969"},
+        {"MGF", "450"},
+        {"MKD", "807"},
+        {"MLF", "466"},
+        {"MMK", "104"},
+        {"MNT", "496"},
+        {"MOP", "446"},
+        {"MRO", "478"},
+        {"MTL", "470"},
+        {"MUR", "480"},
+        {"MVR", "462"},
+        {"MWK", "454"},
+        {"MXN", "484"},
+        {"MXV", "979"},
+        {"MYR", "458"},
+        {"MZM", "508"},
+        {"MZN", "943"},
+        {"NAD", "516"},
+        {"NGN", "566"},
+        {"NIO", "558"},
+        {"NLG", "528"},
+        {"NOK", "578"},
+        {"NPR", "524"},
+        {"NZD", "554"},
+        {"OMR", "512"},
+        {"PAB", "590"},
+        {"PEI", "604"},
+        {"PEN", "604"},
+        {"PES", "604"},
+        {"PGK", "598"},
+        {"PHP", "608"},
+        {"PKR", "586"},
+        {"PLN", "985"},
+        {"PLZ", "616"},
+        {"PTE", "620"},
+        {"PYG", "600"},
+        {"QAR", "634"},
+        {"ROL", "642"},
+        {"RON", "946"},
+        {"RSD", "941"},
+        {"RUB", "643"},
+        {"RUR", "810"},
+        {"RWF", "646"},
+        {"SAR", "682"},
+        {"SBD", "090"},
+        {"SCR", "690"},
+        {"SDD", "736"},
+        {"SDG", "938"},
+        {"SEK", "752"},
+        {"SGD", "702"},
+        {"SHP", "654"},
+        {"SIT", "705"},
+        {"SKK", "703"},
+        {"SLL", "694"},
+        {"SOS", "706"},
+        {"SRD", "968"},
+        {"SRG", "740"},
+        {"SSP", "728"},
+        {"STD", "678"},
+        {"SVC", "222"},
+        {"SYP", "760"},
+        {"SZL", "748"},
+        {"THB", "764"},
+        {"TJR", "762"},
+        {"TJS", "972"},
+        {"TMM", "795"},
+        {"TMT", "934"},
+        {"TND", "788"},
+        {"TOP", "776"},
+        {"TPE", "626"},
+        {"TRL", "792"},
+        {"TRY", "949"},
+        {"TTD", "780"},
+        {"TWD", "901"},
+        {"TZS", "834"},
+        {"UAH", "980"},
+        {"UAK", "804"},
+        {"UGX", "800"},
+        {"USD", "840"},
+        {"USN", "997"},
+        {"USS", "998"},
+        {"UYI", "940"},
+        {"UYU", "858"},
+        {"UZS", "860"},
+        {"VEB", "862"},
+        {"VEF", "937"},
+        {"VND", "704"},
+        {"VUV", "548"},
+        {"WST", "882"},
+        {"XAF", "950"},
+        {"XAG", "961"},
+        {"XAU", "959"},
+        {"XBA", "955"},
+        {"XBB", "956"},
+        {"XBC", "957"},
+        {"XBD", "958"},
+        {"XCD", "951"},
+        {"XDR", "960"},
+        {"XEU", "954"},
+        {"XOF", "952"},
+        {"XPD", "964"},
+        {"XPF", "953"},
+        {"XPT", "962"},
+        {"XSU", "994"},
+        {"XTS", "963"},
+        {"XUA", "965"},
+        {"XXX", "999"},
+        {"YDD", "720"},
+        {"YER", "886"},
+        {"YUM", "891"},
+        {"YUN", "890"},
+        {"ZAL", "991"},
+        {"ZAR", "710"},
+        {"ZMK", "894"},
+        {"ZMW", "967"},
+        {"ZRN", "180"},
+        {"ZRZ", "180"},
+        {"ZWD", "716"},
+        {"ZWL", "932"},
+        {"ZWN", "942"},
+        {"ZWR", "935"},
+    };
+}
diff --git a/trunk/multi/Makefile b/trunk/multi/Makefile
new file mode 100644
index 0000000..457dbe6
--- /dev/null
+++ b/trunk/multi/Makefile
@@ -0,0 +1,3 @@
+# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
+clean:
+	-rm -rf ./tmp
diff --git a/trunk/multi/c/Makefile b/trunk/multi/c/Makefile
new file mode 100644
index 0000000..babe9f0
--- /dev/null
+++ b/trunk/multi/c/Makefile
@@ -0,0 +1,104 @@
+# Copyright (c) 2009-2013 IBM Corp. and Others. All Rights Reserved
+# multicu/c makefile
+
+all:
+	@echo To build all ICUs:  $(MAKE) all-icus
+	@echo "Using the -k option may be a good idea if some are not building properly."
+	@echo ICUVERS: $(ICUVERS)
+
+info:
+
+#ICUCONF=sh ./configure
+ICUCONF=$(MULTICU_ROOT)/c/superconf.sh
+DOT=$(shell pwd)
+MULTICU_ROOT=$(DOT)/..
+include $(MULTICU_ROOT)/common/Makefile-multi.inc
+-include Makefile.local
+
+ICUVERS:=$(shell cd $(ICUS); ls icu4c*.tgz | cut -d- -f2 | sort | uniq | fgrep -v -f $(MULTICU_ROOT)/c/old-icu.txt)
+ICU4JVERS:=$(shell cd $(ICUS); ls icu4j*.jar | cut -d- -f2 | cut -d. -f1 |  sort | uniq | fgrep -v -f $(MULTICU_ROOT)/j/old-icu4j.txt)
+
+BLD=$(C_BLD)
+INS=$(C_INS)
+SRC=$(C_SRC)
+
+ALLICUS=$(ICUVERS:%=$(BLD)/%/$(S_BLD)) $(ICUVERS:%=$(BLD)/r%/$(S_BLD))
+RICUS=$(ICUVERS:%=$(INS)/r%/$(S_INS))
+IICUS=$(ICUVERS:%=$(INS)/%/$(S_INS)) $(RICUS)
+
+
+APRECIOUS=$(ICUVERS:%=$(BLD)/%/$(S_SRC)) $(ICUVERS:%=$(BLD)/r%/$(S_SRC)) $(ICUVERS:%=$(BLD)/%/$(S_BLD)) $(ICUVERS:%=$(INS)/%/$(S_INS)) $(ICUVERS:%=$(BLD)/r%/$(S_BLD)) $(ICUVERS:%=$(INS)/r%/$(S_INS))
+
+.PRECIOUS: $(APRECIOUS)
+
+tehprecious:
+	echo $(APRECIOUS)
+
+$(M_TMP) $(BLD) $(INS):
+	mkdir $(M_TMP)
+	mkdir $(BLD) $(SRC)  $(INS)
+
+$(INS)/%/$(S_INS): $(BLD)/%/$(S_BLD)
+	@if [ -f $(BLD)/$*/build.err ]; then echo '###' Error for $* stored in $(BLD)/$*/build.err - remove if you want me to retry; false;  fi
+	( make $(MAKE_OPTS) -C $(BLD)/$*/icu/source 2>&1 all install | tee $(BLD)/$*/build.log ) || ( mv $(BLD)/$*/build.log $(BLD)/$*/build.err ; false )
+	touch -c $@
+
+$(INS)/r%/$(S_INS): $(BLD)/r%/$(S_BLD)
+	@if [ -f $(BLD)/r$*/build.err ]; then echo '###' Error for $* stored in $(BLD)/r$*/build.err - remove if you want me to retry; false;  fi
+	( make $(MAKE_OPTS) -C $(BLD)/r$*/icu/source 2>&1 all install | tee $(BLD)/r$*/build.log ) || ( mv $(BLD)/r$*/build.log $(BLD)/r$*/build.err ; false )
+	touch -c $@
+
+$(BLD)/r%/$(S_SRC): $(ICUS)/icu4c-%-src.tgz
+	-mv $(BLD)/r$* $(BLD)/r$*.old
+	-( rm -rf ./$(BLD)/r$*.old& )
+	mkdir -p $(BLD)/r$*
+	( cd $(BLD)/r$* ; gunzip -d < $^ | tar xfp - )
+	([ -f $(DOT)/patch/$* ] && patch -d $(BLD)/r$* -p1 < $(DOT)/patch/$*) || true
+	touch -c $@
+
+$(BLD)/%/$(S_SRC): $(ICUS)/icu4c-%-src.tgz
+	-mv $(BLD)/$* $(BLD)/$*.old
+	-( rm -rf ./$(BLD)/$*.old& )
+	mkdir -p $(BLD)/$*
+	( cd $(BLD)/$* ; gunzip -d < $^ | tar xfp - )
+	([ -f $(DOT)/patch/$* ] && patch -d $(BLD)/$* -p1 < $(DOT)/patch/$*) || true
+	touch -c $@
+
+
+$(BLD)/r%/$(S_BLD): $(BLD)/r%/$(S_SRC)
+	-mkdir -p $(INS)
+	-chmod a+rx $(BLD)/r$*/icu/source/configure $(BLD)/r$*/icu/source/runConfigureICU
+	( cd $(BLD)/r$*/icu/source ; env CPPFLAGS="$(XTRA_RICU_CPPFLAGS)" `$(ICUCONF) "$(BLD)/r$*/icu/source" "$*"` --enable-renaming --enable-shared --disable-static --enable-release --disable-debug --prefix=$(INS)/r$* )
+	touch -c $@
+
+$(BLD)/%/$(S_BLD): $(BLD)/%/$(S_SRC)
+	-mkdir -p $(INS)
+	-chmod a+rx $(BLD)/$*/icu/source/configure $(BLD)/$*/icu/source/runConfigureICU
+	( cd $(BLD)/$*/icu/source ; env CPPFLAGS="$(XTRA_ICU_CPPFLAGS)" `$(ICUCONF) "$(BLD)/$*/icu/source" "$*"` --disable-renaming --enable-shared --disable-static --enable-release --disable-debug --prefix=$(INS)/$* )
+	touch -c $@
+
+
+$(INS)/%/bin/$(TARGET): $(INS)/%/$(S_INS) $(SRCS)
+# 	Don't delete the built version.
+#	-rm -rf ./$(BLD)/$*/tmp
+	mkdir ./$(BLD)/$*/tmp
+	@for file in $(OBJECTS); \
+	do \
+		what=`basename $$file .o` ; \
+		echo compiling $*/$$what ; \
+		echo $(CXX) -c -o ./$(BLD)/$*/tmp/$$what.o $$what.cpp -I $(INS)/$*/include -I $(BLD)/$*/icu/source/tools/toolutil ; \
+		$(CXX) -c -o ./$(BLD)/$*/tmp/$$what.o $$what.cpp -I $(INS)/$*/include -I $(BLD)/$*/icu/source/tools/toolutil ; \
+	done
+	$(CXX) -o $@ $(OBJECTS:%.o=./$(BLD)/$*/tmp/%.o)  -licudata -licuuc -licutu -licui18n -L$(INS)/$*/lib 
+
+foo:
+	echo $(ALLICUS)
+
+allicus: $(BLD) $(ALLICUS)
+
+
+all-icus: iicus
+
+iicus: $(BLD) $(IICUS)
+
+ricus: $(RICUS)
diff --git a/trunk/multi/c/Makefile-c.inc b/trunk/multi/c/Makefile-c.inc
new file mode 100644
index 0000000..404ed85
--- /dev/null
+++ b/trunk/multi/c/Makefile-c.inc
@@ -0,0 +1,50 @@
+# -*- makefile -*-
+# Copyright (c) 2008-2013 IBM Corp. and Others. All Rights Reserved
+
+include $(MULTICU_ROOT)/common/Makefile-multi.inc
+
+C_GOOD:=$(shell [ -d $(C_INS) ] && (cd $(C_INS) ; ls -d */$(S_INS) 2>/dev/null | cut -d/ -f1))
+C_REL:=$(shell [ -d $(C_INS) ] && (cd $(C_INS) ; ls -d r*/$(S_INS) 2>/dev/null | cut -d/ -f1))
+
+C_CLEAN_TARGET=$(C_GOOD:%=$(C_INS)/%/bin/$(TARGET))
+
+SOURCES=$(C_SOURCES) $(CXX_SOURCES)
+C_OBJECTS=$(C_SOURCES:%.c=%.o)
+CXX_OBJECTS=$(CXX_SOURCES:%.cpp=%.o)
+OBJECTS=$(C_OBJECTS) $(CXX_OBJECTS)
+#DEBUGOPT=-g
+
+# list of ICUs to be built	
+ICU_TARBALLS=$(shell cd $(ICUS) ; ls icu4c-*-src.tgz)
+# list of versions ( form "3_8  4_0" etc. )
+ICU_TARBALLS_VERS=$(ICU_TARBALLS:icu4c-%-src.tgz=%)
+
+
+$(C_INS)/%/bin/$(TARGET):	$(SOURCES) $(HEADERS)
+	-rm -rf $(C_INS)/$*/tmp
+	mkdir $(C_INS)/$*/tmp
+ifneq (,$(CXX_OBJECTS))
+	@for file in $(CXX_OBJECTS); \
+	do \
+		what=`basename $$file .o` ; \
+		echo tools=$(C_BLD)/$*/icu/source/tools/toolutil ; \
+		echo compiling '(C++)' $*/$$what ; \
+		echo `$(C_INS)/$*/bin/icu-config --cxx` `$(C_INS)/$*/bin/icu-config --cxxflags` $(DEBUGOPT)  -c -o $(C_INS)/$*/tmp/$$what.o $$what.cpp -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil ; \
+		`$(C_INS)/$*/bin/icu-config --cxx` `$(C_INS)/$*/bin/icu-config --cxxflags` $(DEBUGOPT)  -c -o $(C_INS)/$*/tmp/$$what.o $$what.cpp -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil  || \
+		$(CXX) $(DEBUGOPT) -c -o $(C_INS)/$*/tmp/$$what.o $${what}.cpp -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil ; \
+	done
+endif
+ifneq (,$(C_OBJECTS))
+	@for file in $(C_OBJECTS); \
+	do \
+		what=`basename $$file .o` ; \
+		echo compiling '(C  )' $*/$$what ; \
+		$(CC) $(DEBUGOPT) -c -o $(C_INS)/$*/tmp/$$what.o $${what}.c -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil ; \
+	done
+endif
+	@echo linking $*/$$what
+	@echo `$(C_INS)/$*/bin/icu-config --cxx` `$(C_INS)/$*/bin/icu-config --ldflags `  $(DEBUGOPT) -o $@ $(OBJECTS:%.o=$(C_INS)/$*/tmp/%.o)  -licudata -licuuc -licutu -licui18n -licuio -L$(C_INS)/$*/lib
+	@`$(C_INS)/$*/bin/icu-config --cxx` -Wl,--verbose `$(C_INS)/$*/bin/icu-config --ldflags `  $(DEBUGOPT) -o $@ $(OBJECTS:%.o=$(C_INS)/$*/tmp/%.o)  -licudata -licuuc -licutu -licui18n -licuio -L$(C_INS)/$*/lib || \
+	 $(CXX) $(DEBUGOPT) -o $@ $(OBJECTS:%.o=$(C_INS)/$*/tmp/%.o)  -licudata -licuuc -licutu -licui18n -licuio -L$(C_INS)/$*/lib 
+
+
diff --git a/trunk/multi/c/old-icu.txt b/trunk/multi/c/old-icu.txt
new file mode 100644
index 0000000..8867e7d
--- /dev/null
+++ b/trunk/multi/c/old-icu.txt
@@ -0,0 +1,2 @@
+# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
+# a list of ICU4Cs too old to build with the current patchset.
diff --git a/trunk/multi/c/patch/3_0 b/trunk/multi/c/patch/3_0
new file mode 100644
index 0000000..ea33801
--- /dev/null
+++ b/trunk/multi/c/patch/3_0
@@ -0,0 +1,12775 @@
+# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
+Only in 3_0/icu/source: bin
+Only in 3_0.orig/icu/source: confdefs.h
+diff -ru 3_0.orig/icu/source/config/mh-darwin 3_0/icu/source/config/mh-darwin
+--- 3_0.orig/icu/source/config/mh-darwin	2008-10-20 14:57:52.000000000 -0700
++++ 3_0/icu/source/config/mh-darwin	2008-10-20 15:57:28.000000000 -0700
+@@ -15,6 +15,8 @@
+ ## Commands to generate dependency files
+ GEN_DEPS.c=	$(CC) -E -MMD  $(DEFS) $(CPPFLAGS)
+ GEN_DEPS.cc=	$(CXX) -E -MMD  $(DEFS) $(CPPFLAGS)
++GEN_DEPS.c=	echo
++GEN_DEPS.cc=	echo
+ 
+ ## Commands to compile
+ COMPILE.c=	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -fno-common -c
+Only in 3_0.orig/icu/source: config.cache
+Only in 3_0.orig/icu/source: config.log
+diff -ru 3_0.orig/icu/source/configure 3_0/icu/source/configure
+--- 3_0.orig/icu/source/configure	2008-10-20 14:58:10.000000000 -0700
++++ 3_0/icu/source/configure	2008-10-20 15:54:46.000000000 -0700
+@@ -1,65 +1,822 @@
+ #! /bin/sh
+-
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated automatically using autoconf version 2.13 
+-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
++# Generated by GNU Autoconf 2.63.
+ #
++# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
++# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
++## --------------------- ##
++## M4sh Initialization.  ##
++## --------------------- ##
++
++# Be more Bourne compatible
++DUALCASE=1; export DUALCASE # for MKS sh
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++  emulate sh
++  NULLCMD=:
++  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '${1+"$@"}'='"$@"'
++  setopt NO_GLOB_SUBST
++else
++  case `(set -o) 2>/dev/null` in
++  *posix*) set -o posix ;;
++esac
++
++fi
++
++
++
++
++# PATH needs CR
++# Avoid depending upon Character Ranges.
++as_cr_letters='abcdefghijklmnopqrstuvwxyz'
++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
++as_cr_Letters=$as_cr_letters$as_cr_LETTERS
++as_cr_digits='0123456789'
++as_cr_alnum=$as_cr_Letters$as_cr_digits
++
++as_nl='
++'
++export as_nl
++# Printing a long string crashes Solaris 7 /usr/bin/printf.
++as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
++if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
++  as_echo='printf %s\n'
++  as_echo_n='printf %s'
++else
++  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
++    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
++    as_echo_n='/usr/ucb/echo -n'
++  else
++    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
++    as_echo_n_body='eval
++      arg=$1;
++      case $arg in
++      *"$as_nl"*)
++	expr "X$arg" : "X\\(.*\\)$as_nl";
++	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
++      esac;
++      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
++    '
++    export as_echo_n_body
++    as_echo_n='sh -c $as_echo_n_body as_echo'
++  fi
++  export as_echo_body
++  as_echo='sh -c $as_echo_body as_echo'
++fi
++
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++  PATH_SEPARATOR=:
++  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
++    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
++      PATH_SEPARATOR=';'
++  }
++fi
++
++# Support unset when possible.
++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
++  as_unset=unset
++else
++  as_unset=false
++fi
++
++
++# IFS
++# We need space, tab and new line, in precisely that order.  Quoting is
++# there to prevent editors from complaining about space-tab.
++# (If _AS_PATH_WALK were called with IFS unset, it would disable word
++# splitting by setting IFS to empty value.)
++IFS=" ""	$as_nl"
++
++# Find who we are.  Look in the path if we contain no directory separator.
++case $0 in
++  *[\\/]* ) as_myself=$0 ;;
++  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
++done
++IFS=$as_save_IFS
++
++     ;;
++esac
++# We did not find ourselves, most probably we were run as `sh COMMAND'
++# in which case we are not to be found in the path.
++if test "x$as_myself" = x; then
++  as_myself=$0
++fi
++if test ! -f "$as_myself"; then
++  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
++  { (exit 1); exit 1; }
++fi
++
++# Work around bugs in pre-3.0 UWIN ksh.
++for as_var in ENV MAIL MAILPATH
++do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
++done
++PS1='$ '
++PS2='> '
++PS4='+ '
++
++# NLS nuisances.
++LC_ALL=C
++export LC_ALL
++LANGUAGE=C
++export LANGUAGE
++
++# Required to use basename.
++if expr a : '\(a\)' >/dev/null 2>&1 &&
++   test "X`expr 00001 : '.*\(...\)'`" = X001; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
++  as_basename=basename
++else
++  as_basename=false
++fi
++
++
++# Name of the executable.
++as_me=`$as_basename -- "$0" ||
++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
++	 X"$0" : 'X\(//\)$' \| \
++	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X/"$0" |
++    sed '/^.*\/\([^/][^/]*\)\/*$/{
++	    s//\1/
++	    q
++	  }
++	  /^X\/\(\/\/\)$/{
++	    s//\1/
++	    q
++	  }
++	  /^X\/\(\/\).*/{
++	    s//\1/
++	    q
++	  }
++	  s/.*/./; q'`
++
++# CDPATH.
++$as_unset CDPATH
++
++
++if test "x$CONFIG_SHELL" = x; then
++  if (eval ":") 2>/dev/null; then
++  as_have_required=yes
++else
++  as_have_required=no
++fi
++
++  if test $as_have_required = yes &&	 (eval ":
++(as_func_return () {
++  (exit \$1)
++}
++as_func_success () {
++  as_func_return 0
++}
++as_func_failure () {
++  as_func_return 1
++}
++as_func_ret_success () {
++  return 0
++}
++as_func_ret_failure () {
++  return 1
++}
++
++exitcode=0
++if as_func_success; then
++  :
++else
++  exitcode=1
++  echo as_func_success failed.
++fi
++
++if as_func_failure; then
++  exitcode=1
++  echo as_func_failure succeeded.
++fi
++
++if as_func_ret_success; then
++  :
++else
++  exitcode=1
++  echo as_func_ret_success failed.
++fi
++
++if as_func_ret_failure; then
++  exitcode=1
++  echo as_func_ret_failure succeeded.
++fi
++
++if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
++  :
++else
++  exitcode=1
++  echo positional parameters were not saved.
++fi
++
++test \$exitcode = 0) || { (exit 1); exit 1; }
++
++(
++  as_lineno_1=\$LINENO
++  as_lineno_2=\$LINENO
++  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
++  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
++") 2> /dev/null; then
++  :
++else
++  as_candidate_shells=
++    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  case $as_dir in
++	 /*)
++	   for as_base in sh bash ksh sh5; do
++	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
++	   done;;
++       esac
++done
++IFS=$as_save_IFS
++
++
++      for as_shell in $as_candidate_shells $SHELL; do
++	 # Try only shells that exist, to save several forks.
++	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
++		{ ("$as_shell") 2> /dev/null <<\_ASEOF
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++  emulate sh
++  NULLCMD=:
++  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '${1+"$@"}'='"$@"'
++  setopt NO_GLOB_SUBST
++else
++  case `(set -o) 2>/dev/null` in
++  *posix*) set -o posix ;;
++esac
++
++fi
++
++
++:
++_ASEOF
++}; then
++  CONFIG_SHELL=$as_shell
++	       as_have_required=yes
++	       if { "$as_shell" 2> /dev/null <<\_ASEOF
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++  emulate sh
++  NULLCMD=:
++  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '${1+"$@"}'='"$@"'
++  setopt NO_GLOB_SUBST
++else
++  case `(set -o) 2>/dev/null` in
++  *posix*) set -o posix ;;
++esac
++
++fi
++
++
++:
++(as_func_return () {
++  (exit $1)
++}
++as_func_success () {
++  as_func_return 0
++}
++as_func_failure () {
++  as_func_return 1
++}
++as_func_ret_success () {
++  return 0
++}
++as_func_ret_failure () {
++  return 1
++}
++
++exitcode=0
++if as_func_success; then
++  :
++else
++  exitcode=1
++  echo as_func_success failed.
++fi
++
++if as_func_failure; then
++  exitcode=1
++  echo as_func_failure succeeded.
++fi
++
++if as_func_ret_success; then
++  :
++else
++  exitcode=1
++  echo as_func_ret_success failed.
++fi
++
++if as_func_ret_failure; then
++  exitcode=1
++  echo as_func_ret_failure succeeded.
++fi
++
++if ( set x; as_func_ret_success y && test x = "$1" ); then
++  :
++else
++  exitcode=1
++  echo positional parameters were not saved.
++fi
++
++test $exitcode = 0) || { (exit 1); exit 1; }
++
++(
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
++
++_ASEOF
++}; then
++  break
++fi
++
++fi
++
++      done
++
++      if test "x$CONFIG_SHELL" != x; then
++  for as_var in BASH_ENV ENV
++	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
++	done
++	export CONFIG_SHELL
++	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
++fi
++
++
++    if test $as_have_required = no; then
++  echo This script requires a shell more modern than all the
++      echo shells that I found on your system.  Please install a
++      echo modern shell, or manually run the script under such a
++      echo shell if you do have one.
++      { (exit 1); exit 1; }
++fi
++
++
++fi
++
++fi
++
++
++
++(eval "as_func_return () {
++  (exit \$1)
++}
++as_func_success () {
++  as_func_return 0
++}
++as_func_failure () {
++  as_func_return 1
++}
++as_func_ret_success () {
++  return 0
++}
++as_func_ret_failure () {
++  return 1
++}
++
++exitcode=0
++if as_func_success; then
++  :
++else
++  exitcode=1
++  echo as_func_success failed.
++fi
++
++if as_func_failure; then
++  exitcode=1
++  echo as_func_failure succeeded.
++fi
++
++if as_func_ret_success; then
++  :
++else
++  exitcode=1
++  echo as_func_ret_success failed.
++fi
++
++if as_func_ret_failure; then
++  exitcode=1
++  echo as_func_ret_failure succeeded.
++fi
++
++if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
++  :
++else
++  exitcode=1
++  echo positional parameters were not saved.
++fi
++
++test \$exitcode = 0") || {
++  echo No shell found that supports shell functions.
++  echo Please tell bug-autoconf@gnu.org about your system,
++  echo including any error possibly output before this message.
++  echo This can help us improve future autoconf versions.
++  echo Configuration will now proceed without shell functions.
++}
++
++
++
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
++
++  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
++  # uniformly replaced by the line number.  The first 'sed' inserts a
++  # line-number line after each line using $LINENO; the second 'sed'
++  # does the real work.  The second script uses 'N' to pair each
++  # line-number line with the line containing $LINENO, and appends
++  # trailing '-' during substitution so that $LINENO is not a special
++  # case at line end.
++  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
++  # scripts with optimization help from Paolo Bonzini.  Blame Lee
++  # E. McMahon (1931-1989) for sed's syntax.  :-)
++  sed -n '
++    p
++    /[$]LINENO/=
++  ' <$as_myself |
++    sed '
++      s/[$]LINENO.*/&-/
++      t lineno
++      b
++      :lineno
++      N
++      :loop
++      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
++      t loop
++      s/-\n.*//
++    ' >$as_me.lineno &&
++  chmod +x "$as_me.lineno" ||
++    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
++   { (exit 1); exit 1; }; }
++
++  # Don't try to exec as it changes $[0], causing all sort of problems
++  # (the dirname of $[0] is not the place where we might find the
++  # original and so on.  Autoconf is especially sensitive to this).
++  . "./$as_me.lineno"
++  # Exit status is that of the last command.
++  exit
++}
++
++
++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
++  as_dirname=dirname
++else
++  as_dirname=false
++fi
++
++ECHO_C= ECHO_N= ECHO_T=
++case `echo -n x` in
++-n*)
++  case `echo 'x\c'` in
++  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
++  *)   ECHO_C='\c';;
++  esac;;
++*)
++  ECHO_N='-n';;
++esac
++if expr a : '\(a\)' >/dev/null 2>&1 &&
++   test "X`expr 00001 : '.*\(...\)'`" = X001; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++rm -f conf$$ conf$$.exe conf$$.file
++if test -d conf$$.dir; then
++  rm -f conf$$.dir/conf$$.file
++else
++  rm -f conf$$.dir
++  mkdir conf$$.dir 2>/dev/null
++fi
++if (echo >conf$$.file) 2>/dev/null; then
++  if ln -s conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s='ln -s'
++    # ... but there are two gotchas:
++    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
++    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
++    # In both cases, we have to default to `cp -p'.
++    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
++      as_ln_s='cp -p'
++  elif ln conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s=ln
++  else
++    as_ln_s='cp -p'
++  fi
++else
++  as_ln_s='cp -p'
++fi
++rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
++rmdir conf$$.dir 2>/dev/null
++
++if mkdir -p . 2>/dev/null; then
++  as_mkdir_p=:
++else
++  test -d ./-p && rmdir ./-p
++  as_mkdir_p=false
++fi
+ 
+-# Defaults:
+-ac_help=
++if test -x / >/dev/null 2>&1; then
++  as_test_x='test -x'
++else
++  if ls -dL / >/dev/null 2>&1; then
++    as_ls_L_option=L
++  else
++    as_ls_L_option=
++  fi
++  as_test_x='
++    eval sh -c '\''
++      if test -d "$1"; then
++	test -d "$1/.";
++      else
++	case $1 in
++	-*)set "./$1";;
++	esac;
++	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
++	???[sx]*):;;*)false;;esac;fi
++    '\'' sh
++  '
++fi
++as_executable_p=$as_test_x
++
++# Sed expression to map a string onto a valid CPP name.
++as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
++
++# Sed expression to map a string onto a valid variable name.
++as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
++
++
++
++exec 7<&0 </dev/null 6>&1
++
++# Name of the host.
++# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
++# so uname gets run too.
++ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
++
++#
++# Initializations.
++#
+ ac_default_prefix=/usr/local
+-# Any additions from configure.in:
+-ac_help="$ac_help
+-  --enable-strict         compile with strict compiler options [default=no]"
+-ac_help="$ac_help
+-  --enable-64bit-libs     build 64-bit libraries [default=yes]"
+-ac_help="$ac_help
+-  --enable-shared         build shared libraries [default=yes]"
+-ac_help="$ac_help
+-  --enable-static         build static libraries [default=no]"
+-ac_help="$ac_help
+-  --enable-debug          build debug libraries [default=no]"
+-ac_help="$ac_help
+-  --enable-release        build release libraries [default=yes]"
+-ac_help="$ac_help
+-  --enable-renaming       add a version suffix to symbols [default=yes]"
+-ac_help="$ac_help
+-  --enable-tracing        enable function and data tracing [default=yes]"
+-ac_help="$ac_help
+-  --enable-rpath          use rpath when linking [default is only if necessary]"
+-ac_help="$ac_help
+-  --enable-threads        build ICU with thread safety [default=yes]"
+-ac_help="$ac_help
+-  --with-iostream=version specify the version of iostream to use (none, old, std, auto) [default=auto]"
+-ac_help="$ac_help
+-  --enable-extras         build ICU extras [default=yes]"
+-ac_help="$ac_help
+-  --enable-icuio          build ICU's icuio library [default=yes]"
+-ac_help="$ac_help
+-  --enable-layout         build ICU's layout library [default=yes]"
+-ac_help="$ac_help
+-  --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) [default=auto]"
+-ac_help="$ac_help
+-"
+-ac_help="$ac_help
+-  --with-library-suffix=suffix    tag a suffix to the library names [default=]"
+-ac_help="$ac_help
+-  --enable-tests          build ICU tests [default=yes]"
+-ac_help="$ac_help
+-  --enable-samples        build ICU samples [default=yes]  
+-Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries."
++ac_clean_files=
++ac_config_libobj_dir=.
++LIBOBJS=
++cross_compiling=no
++subdirs=
++MFLAGS=
++MAKEFLAGS=
++SHELL=${CONFIG_SHELL-/bin/sh}
++
++# Identity of this package.
++PACKAGE_NAME=
++PACKAGE_TARNAME=
++PACKAGE_VERSION=
++PACKAGE_STRING=
++PACKAGE_BUGREPORT=
++
++ac_unique_file="common/unicode/utypes.h"
++# Factoring default headers for most tests.
++ac_includes_default="\
++#include <stdio.h>
++#ifdef HAVE_SYS_TYPES_H
++# include <sys/types.h>
++#endif
++#ifdef HAVE_SYS_STAT_H
++# include <sys/stat.h>
++#endif
++#ifdef STDC_HEADERS
++# include <stdlib.h>
++# include <stddef.h>
++#else
++# ifdef HAVE_STDLIB_H
++#  include <stdlib.h>
++# endif
++#endif
++#ifdef HAVE_STRING_H
++# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
++#  include <memory.h>
++# endif
++# include <string.h>
++#endif
++#ifdef HAVE_STRINGS_H
++# include <strings.h>
++#endif
++#ifdef HAVE_INTTYPES_H
++# include <inttypes.h>
++#endif
++#ifdef HAVE_STDINT_H
++# include <stdint.h>
++#endif
++#ifdef HAVE_UNISTD_H
++# include <unistd.h>
++#endif"
++
++ac_subst_vars='LTLIBOBJS
++LIBOBJS
++AIX_SHLIB
++ld_rpath_suf
++platform_make_fragment
++platform_make_fragment_name
++platform
++ICUDATA_CHAR
++SAMPLES_TRUE
++TESTS_TRUE
++ICULIBSUFFIXCNAME
++U_HAVE_LIB_SUFFIX
++ICULIBSUFFIX
++DATA_PACKAGING_MODE
++DATA_PACKAGING_CPPFLAGS
++thepkgicudatadir
++pkgicudatadir
++thelibdir
++thedatadir
++thesysconfdir
++LAYOUT_TRUE
++ICUIO_TRUE
++EXTRAS_TRUE
++U_SIZEOF_WCHAR_T
++U_HAVE_WCSCPY
++U_HAVE_WCHAR_H
++HAVE_UINT64_T
++HAVE_INT64_T
++HAVE_UINT32_T
++HAVE_INT32_T
++HAVE_UINT16_T
++HAVE_INT16_T
++HAVE_UINT8_T
++HAVE_INT8_T
++U_TIMEZONE
++U_HAVE_TIMEZONE
++U_TZNAME
++U_TZSET
++U_HAVE_POPEN
++U_HAVE_PLACEMENT_NEW
++U_OVERRIDE_CXX_ALLOCATION
++U_HAVE_NAMESPACE
++U_NL_LANGINFO_CODESET
++U_HAVE_NL_LANGINFO_CODESET
++U_HAVE_NL_LANGINFO
++U_IS_BIG_ENDIAN
++U_IOSTREAM_SOURCE
++CXXCPP
++U_HAVE_INTTYPES_H
++EGREP
++GREP
++CPP
++GENCCODE_ASSEMBLY
++HAVE_MMAP
++ICU_USE_THREADS
++THREADS_TRUE
++U_INLINE
++ENABLE_RPATH
++U_ENABLE_TRACING
++U_DISABLE_RENAMING
++AR
++RANLIB
++ENABLE_RELEASE
++ENABLE_DEBUG
++ENABLE_STATIC
++ENABLE_SHARED
++LIB_M
++COMPILE_LINK_ENVVAR
++ARFLAGS
++host_os
++host_vendor
++host_cpu
++host
++build_os
++build_vendor
++build_cpu
++build
++DOXYGEN
++U_MAKE
++STRIP
++INSTALL_DATA
++INSTALL_SCRIPT
++INSTALL_PROGRAM
++ac_ct_CXX
++CXXFLAGS
++CXX
++OBJEXT
++EXEEXT
++ac_ct_CC
++LDFLAGS
++CFLAGS
++CC
++CPPFLAGS
++UNICODE_VERSION
++LIB_VERSION_MAJOR
++LIB_VERSION
++VERSION
++PACKAGE
++target_alias
++host_alias
++build_alias
++LIBS
++ECHO_T
++ECHO_N
++ECHO_C
++DEFS
++mandir
++localedir
++libdir
++psdir
++pdfdir
++dvidir
++htmldir
++infodir
++docdir
++oldincludedir
++includedir
++localstatedir
++sharedstatedir
++sysconfdir
++datadir
++datarootdir
++libexecdir
++sbindir
++bindir
++program_transform_name
++prefix
++exec_prefix
++PACKAGE_BUGREPORT
++PACKAGE_STRING
++PACKAGE_VERSION
++PACKAGE_TARNAME
++PACKAGE_NAME
++PATH_SEPARATOR
++SHELL'
++ac_subst_files=''
++ac_user_opts='
++enable_option_checking
++enable_strict
++enable_64bit_libs
++enable_shared
++enable_static
++enable_debug
++enable_release
++enable_renaming
++enable_tracing
++enable_rpath
++enable_threads
++with_iostream
++enable_extras
++enable_layout
++with_data_packaging
++enable_mapped
++with_library_suffix
++enable_tests
++enable_samples
++'
++      ac_precious_vars='build_alias
++host_alias
++target_alias
++CC
++CFLAGS
++LDFLAGS
++LIBS
++CPPFLAGS
++CXX
++CXXFLAGS
++CCC
++CPP
++CXXCPP'
++
+ 
+ # Initialize some variables set by options.
++ac_init_help=
++ac_init_version=false
++ac_unrecognized_opts=
++ac_unrecognized_sep=
+ # The variables have the same names as the options, with
+ # dashes changed to underlines.
+-build=NONE
+-cache_file=./config.cache
++cache_file=/dev/null
+ exec_prefix=NONE
+-host=NONE
+ no_create=
+-nonopt=NONE
+ no_recursion=
+ prefix=NONE
+ program_prefix=NONE
+@@ -68,94 +825,133 @@
+ silent=
+ site=
+ srcdir=
+-target=NONE
+ verbose=
+ x_includes=NONE
+ x_libraries=NONE
++
++# Installation directory options.
++# These are left unexpanded so users can "make install exec_prefix=/foo"
++# and all the variables that are supposed to be based on exec_prefix
++# by default will actually change.
++# Use braces instead of parens because sh, perl, etc. also accept them.
++# (The list follows the same order as the GNU Coding Standards.)
+ bindir='${exec_prefix}/bin'
+ sbindir='${exec_prefix}/sbin'
+ libexecdir='${exec_prefix}/libexec'
+-datadir='${prefix}/share'
++datarootdir='${prefix}/share'
++datadir='${datarootdir}'
+ sysconfdir='${prefix}/etc'
+ sharedstatedir='${prefix}/com'
+ localstatedir='${prefix}/var'
+-libdir='${exec_prefix}/lib'
+ includedir='${prefix}/include'
+ oldincludedir='/usr/include'
+-infodir='${prefix}/info'
+-mandir='${prefix}/man'
+-
+-# Initialize some other variables.
+-subdirs=
+-MFLAGS= MAKEFLAGS=
+-SHELL=${CONFIG_SHELL-/bin/sh}
+-# Maximum number of lines to put in a shell here document.
+-ac_max_here_lines=12
++docdir='${datarootdir}/doc/${PACKAGE}'
++infodir='${datarootdir}/info'
++htmldir='${docdir}'
++dvidir='${docdir}'
++pdfdir='${docdir}'
++psdir='${docdir}'
++libdir='${exec_prefix}/lib'
++localedir='${datarootdir}/locale'
++mandir='${datarootdir}/man'
+ 
+ ac_prev=
++ac_dashdash=
+ for ac_option
+ do
+-
+   # If the previous option needs an argument, assign it.
+   if test -n "$ac_prev"; then
+-    eval "$ac_prev=\$ac_option"
++    eval $ac_prev=\$ac_option
+     ac_prev=
+     continue
+   fi
+ 
+-  case "$ac_option" in
+-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+-  *) ac_optarg= ;;
++  case $ac_option in
++  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
++  *)	ac_optarg=yes ;;
+   esac
+ 
+   # Accept the important Cygnus configure options, so we can diagnose typos.
+ 
+-  case "$ac_option" in
++  case $ac_dashdash$ac_option in
++  --)
++    ac_dashdash=yes ;;
+ 
+   -bindir | --bindir | --bindi | --bind | --bin | --bi)
+     ac_prev=bindir ;;
+   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+-    bindir="$ac_optarg" ;;
++    bindir=$ac_optarg ;;
+ 
+   -build | --build | --buil | --bui | --bu)
+-    ac_prev=build ;;
++    ac_prev=build_alias ;;
+   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+-    build="$ac_optarg" ;;
++    build_alias=$ac_optarg ;;
+ 
+   -cache-file | --cache-file | --cache-fil | --cache-fi \
+   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+     ac_prev=cache_file ;;
+   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+-    cache_file="$ac_optarg" ;;
++    cache_file=$ac_optarg ;;
+ 
+-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
++  --config-cache | -C)
++    cache_file=config.cache ;;
++
++  -datadir | --datadir | --datadi | --datad)
+     ac_prev=datadir ;;
+-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+-  | --da=*)
+-    datadir="$ac_optarg" ;;
++  -datadir=* | --datadir=* | --datadi=* | --datad=*)
++    datadir=$ac_optarg ;;
++
++  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
++  | --dataroo | --dataro | --datar)
++    ac_prev=datarootdir ;;
++  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
++  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
++    datarootdir=$ac_optarg ;;
+ 
+   -disable-* | --disable-*)
+-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
++    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+-    fi
+-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+-    eval "enable_${ac_feature}=no" ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
++   { (exit 1); exit 1; }; }
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"enable_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
++	 ac_unrecognized_sep=', ';;
++    esac
++    eval enable_$ac_useropt=no ;;
++
++  -docdir | --docdir | --docdi | --doc | --do)
++    ac_prev=docdir ;;
++  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
++    docdir=$ac_optarg ;;
++
++  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
++    ac_prev=dvidir ;;
++  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
++    dvidir=$ac_optarg ;;
+ 
+   -enable-* | --enable-*)
+-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
++    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+-    fi
+-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+-    case "$ac_option" in
+-      *=*) ;;
+-      *) ac_optarg=yes ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
++   { (exit 1); exit 1; }; }
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"enable_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
++	 ac_unrecognized_sep=', ';;
+     esac
+-    eval "enable_${ac_feature}='$ac_optarg'" ;;
++    eval enable_$ac_useropt=\$ac_optarg ;;
+ 
+   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+@@ -164,116 +960,77 @@
+   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+   | --exec=* | --exe=* | --ex=*)
+-    exec_prefix="$ac_optarg" ;;
++    exec_prefix=$ac_optarg ;;
+ 
+   -gas | --gas | --ga | --g)
+     # Obsolete; use --with-gas.
+     with_gas=yes ;;
+ 
+-  -help | --help | --hel | --he)
+-    # Omit some internal or obsolete options to make the list less imposing.
+-    # This message is too long to be a string in the A/UX 3.1 sh.
+-    cat << EOF
+-Usage: configure [options] [host]
+-Options: [defaults in brackets after descriptions]
+-Configuration:
+-  --cache-file=FILE       cache test results in FILE
+-  --help                  print this message
+-  --no-create             do not create output files
+-  --quiet, --silent       do not print \`checking...' messages
+-  --version               print the version of autoconf that created configure
+-Directory and file names:
+-  --prefix=PREFIX         install architecture-independent files in PREFIX
+-                          [$ac_default_prefix]
+-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+-                          [same as prefix]
+-  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+-  --datadir=DIR           read-only architecture-independent data in DIR
+-                          [PREFIX/share]
+-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+-                          [PREFIX/com]
+-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+-  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+-  --includedir=DIR        C header files in DIR [PREFIX/include]
+-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+-  --infodir=DIR           info documentation in DIR [PREFIX/info]
+-  --mandir=DIR            man documentation in DIR [PREFIX/man]
+-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+-  --program-prefix=PREFIX prepend PREFIX to installed program names
+-  --program-suffix=SUFFIX append SUFFIX to installed program names
+-  --program-transform-name=PROGRAM
+-                          run sed PROGRAM on installed program names
+-EOF
+-    cat << EOF
+-Host type:
+-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+-  --host=HOST             configure for HOST [guessed]
+-  --target=TARGET         configure for TARGET [TARGET=HOST]
+-Features and packages:
+-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+-  --x-includes=DIR        X include files are in DIR
+-  --x-libraries=DIR       X library files are in DIR
+-EOF
+-    if test -n "$ac_help"; then
+-      echo "--enable and --with options recognized:$ac_help"
+-    fi
+-    exit 0 ;;
++  -help | --help | --hel | --he | -h)
++    ac_init_help=long ;;
++  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
++    ac_init_help=recursive ;;
++  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
++    ac_init_help=short ;;
+ 
+   -host | --host | --hos | --ho)
+-    ac_prev=host ;;
++    ac_prev=host_alias ;;
+   -host=* | --host=* | --hos=* | --ho=*)
+-    host="$ac_optarg" ;;
++    host_alias=$ac_optarg ;;
++
++  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
++    ac_prev=htmldir ;;
++  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
++  | --ht=*)
++    htmldir=$ac_optarg ;;
+ 
+   -includedir | --includedir | --includedi | --included | --include \
+   | --includ | --inclu | --incl | --inc)
+     ac_prev=includedir ;;
+   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+   | --includ=* | --inclu=* | --incl=* | --inc=*)
+-    includedir="$ac_optarg" ;;
++    includedir=$ac_optarg ;;
+ 
+   -infodir | --infodir | --infodi | --infod | --info | --inf)
+     ac_prev=infodir ;;
+   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+-    infodir="$ac_optarg" ;;
++    infodir=$ac_optarg ;;
+ 
+   -libdir | --libdir | --libdi | --libd)
+     ac_prev=libdir ;;
+   -libdir=* | --libdir=* | --libdi=* | --libd=*)
+-    libdir="$ac_optarg" ;;
++    libdir=$ac_optarg ;;
+ 
+   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+   | --libexe | --libex | --libe)
+     ac_prev=libexecdir ;;
+   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+   | --libexe=* | --libex=* | --libe=*)
+-    libexecdir="$ac_optarg" ;;
++    libexecdir=$ac_optarg ;;
++
++  -localedir | --localedir | --localedi | --localed | --locale)
++    ac_prev=localedir ;;
++  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
++    localedir=$ac_optarg ;;
+ 
+   -localstatedir | --localstatedir | --localstatedi | --localstated \
+-  | --localstate | --localstat | --localsta | --localst \
+-  | --locals | --local | --loca | --loc | --lo)
++  | --localstate | --localstat | --localsta | --localst | --locals)
+     ac_prev=localstatedir ;;
+   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+-    localstatedir="$ac_optarg" ;;
++  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
++    localstatedir=$ac_optarg ;;
+ 
+   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+     ac_prev=mandir ;;
+   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+-    mandir="$ac_optarg" ;;
++    mandir=$ac_optarg ;;
+ 
+   -nfp | --nfp | --nf)
+     # Obsolete; use --without-fp.
+     with_fp=no ;;
+ 
+   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+-  | --no-cr | --no-c)
++  | --no-cr | --no-c | -n)
+     no_create=yes ;;
+ 
+   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+@@ -287,26 +1044,26 @@
+   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+-    oldincludedir="$ac_optarg" ;;
++    oldincludedir=$ac_optarg ;;
+ 
+   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+     ac_prev=prefix ;;
+   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+-    prefix="$ac_optarg" ;;
++    prefix=$ac_optarg ;;
+ 
+   -program-prefix | --program-prefix | --program-prefi | --program-pref \
+   | --program-pre | --program-pr | --program-p)
+     ac_prev=program_prefix ;;
+   -program-prefix=* | --program-prefix=* | --program-prefi=* \
+   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+-    program_prefix="$ac_optarg" ;;
++    program_prefix=$ac_optarg ;;
+ 
+   -program-suffix | --program-suffix | --program-suffi | --program-suff \
+   | --program-suf | --program-su | --program-s)
+     ac_prev=program_suffix ;;
+   -program-suffix=* | --program-suffix=* | --program-suffi=* \
+   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+-    program_suffix="$ac_optarg" ;;
++    program_suffix=$ac_optarg ;;
+ 
+   -program-transform-name | --program-transform-name \
+   | --program-transform-nam | --program-transform-na \
+@@ -323,7 +1080,17 @@
+   | --program-transfo=* | --program-transf=* \
+   | --program-trans=* | --program-tran=* \
+   | --progr-tra=* | --program-tr=* | --program-t=*)
+-    program_transform_name="$ac_optarg" ;;
++    program_transform_name=$ac_optarg ;;
++
++  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
++    ac_prev=pdfdir ;;
++  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
++    pdfdir=$ac_optarg ;;
++
++  -psdir | --psdir | --psdi | --psd | --ps)
++    ac_prev=psdir ;;
++  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
++    psdir=$ac_optarg ;;
+ 
+   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+   | -silent | --silent | --silen | --sile | --sil)
+@@ -333,7 +1100,7 @@
+     ac_prev=sbindir ;;
+   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+   | --sbi=* | --sb=*)
+-    sbindir="$ac_optarg" ;;
++    sbindir=$ac_optarg ;;
+ 
+   -sharedstatedir | --sharedstatedir | --sharedstatedi \
+   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+@@ -344,58 +1111,69 @@
+   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+   | --sha=* | --sh=*)
+-    sharedstatedir="$ac_optarg" ;;
++    sharedstatedir=$ac_optarg ;;
+ 
+   -site | --site | --sit)
+     ac_prev=site ;;
+   -site=* | --site=* | --sit=*)
+-    site="$ac_optarg" ;;
++    site=$ac_optarg ;;
+ 
+   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+     ac_prev=srcdir ;;
+   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+-    srcdir="$ac_optarg" ;;
++    srcdir=$ac_optarg ;;
+ 
+   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+   | --syscon | --sysco | --sysc | --sys | --sy)
+     ac_prev=sysconfdir ;;
+   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+-    sysconfdir="$ac_optarg" ;;
++    sysconfdir=$ac_optarg ;;
+ 
+   -target | --target | --targe | --targ | --tar | --ta | --t)
+-    ac_prev=target ;;
++    ac_prev=target_alias ;;
+   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+-    target="$ac_optarg" ;;
++    target_alias=$ac_optarg ;;
+ 
+   -v | -verbose | --verbose | --verbos | --verbo | --verb)
+     verbose=yes ;;
+ 
+-  -version | --version | --versio | --versi | --vers)
+-    echo "configure generated by autoconf version 2.13"
+-    exit 0 ;;
++  -version | --version | --versio | --versi | --vers | -V)
++    ac_init_version=: ;;
+ 
+   -with-* | --with-*)
+-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
++    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+-    fi
+-    ac_package=`echo $ac_package| sed 's/-/_/g'`
+-    case "$ac_option" in
+-      *=*) ;;
+-      *) ac_optarg=yes ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
++   { (exit 1); exit 1; }; }
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"with_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
++	 ac_unrecognized_sep=', ';;
+     esac
+-    eval "with_${ac_package}='$ac_optarg'" ;;
++    eval with_$ac_useropt=\$ac_optarg ;;
+ 
+   -without-* | --without-*)
+-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
++    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+-    fi
+-    ac_package=`echo $ac_package| sed 's/-/_/g'`
+-    eval "with_${ac_package}=no" ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
++   { (exit 1); exit 1; }; }
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"with_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
++	 ac_unrecognized_sep=', ';;
++    esac
++    eval with_$ac_useropt=no ;;
+ 
+   --x)
+     # Obsolete; use --with-x.
+@@ -406,167 +1184,735 @@
+     ac_prev=x_includes ;;
+   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+-    x_includes="$ac_optarg" ;;
++    x_includes=$ac_optarg ;;
+ 
+   -x-libraries | --x-libraries | --x-librarie | --x-librari \
+   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+     ac_prev=x_libraries ;;
+   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+-    x_libraries="$ac_optarg" ;;
++    x_libraries=$ac_optarg ;;
+ 
+-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
++  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
++Try \`$0 --help' for more information." >&2
++   { (exit 1); exit 1; }; }
+     ;;
+ 
++  *=*)
++    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
++    # Reject names that are not valid shell variable names.
++    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
++      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
++   { (exit 1); exit 1; }; }
++    eval $ac_envvar=\$ac_optarg
++    export $ac_envvar ;;
++
+   *)
+-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+-      echo "configure: warning: $ac_option: invalid host type" 1>&2
+-    fi
+-    if test "x$nonopt" != xNONE; then
+-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+-    fi
+-    nonopt="$ac_option"
++    # FIXME: should be removed in autoconf 3.0.
++    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
++    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
++      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
++    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+     ;;
+ 
+   esac
+ done
+ 
+ if test -n "$ac_prev"; then
+-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
++  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
++  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
++   { (exit 1); exit 1; }; }
+ fi
+ 
+-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+-
+-# File descriptor usage:
+-# 0 standard input
+-# 1 file creation
+-# 2 errors and warnings
+-# 3 some systems may open it to /dev/tty
+-# 4 used on the Kubota Titan
+-# 6 checking for... messages and results
+-# 5 compiler messages saved in config.log
+-if test "$silent" = yes; then
+-  exec 6>/dev/null
+-else
+-  exec 6>&1
++if test -n "$ac_unrecognized_opts"; then
++  case $enable_option_checking in
++    no) ;;
++    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
++   { (exit 1); exit 1; }; } ;;
++    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
++  esac
+ fi
+-exec 5>./config.log
+-
+-echo "\
+-This file contains any messages produced by compilers while
+-running configure, to aid debugging if configure makes a mistake.
+-" 1>&5
+ 
+-# Strip out --no-create and --no-recursion so they do not pile up.
+-# Also quote any args containing shell metacharacters.
+-ac_configure_args=
+-for ac_arg
++# Check all directory arguments for consistency.
++for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
++		datadir sysconfdir sharedstatedir localstatedir includedir \
++		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
++		libdir localedir mandir
+ do
+-  case "$ac_arg" in
+-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+-  | --no-cr | --no-c) ;;
+-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
++  eval ac_val=\$$ac_var
++  # Remove trailing slashes.
++  case $ac_val in
++    */ )
++      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
++      eval $ac_var=\$ac_val;;
+   esac
++  # Be sure to have absolute directory names.
++  case $ac_val in
++    [\\/$]* | ?:[\\/]* )  continue;;
++    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
++  esac
++  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
++   { (exit 1); exit 1; }; }
+ done
+ 
+-# NLS nuisances.
+-# Only set these to C if already set.  These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
++# There might be people who depend on the old broken behavior: `$host'
++# used to hold the argument of --host etc.
++# FIXME: To remove some day.
++build=$build_alias
++host=$host_alias
++target=$target_alias
++
++# FIXME: To remove some day.
++if test "x$host_alias" != x; then
++  if test "x$build_alias" = x; then
++    cross_compiling=maybe
++    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
++    If a cross compiler is detected then cross compile mode will be used." >&2
++  elif test "x$build_alias" != "x$host_alias"; then
++    cross_compiling=yes
++  fi
++fi
++
++ac_tool_prefix=
++test -n "$host_alias" && ac_tool_prefix=$host_alias-
++
++test "$silent" = yes && exec 6>/dev/null
++
++
++ac_pwd=`pwd` && test -n "$ac_pwd" &&
++ac_ls_di=`ls -di .` &&
++ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
++  { $as_echo "$as_me: error: working directory cannot be determined" >&2
++   { (exit 1); exit 1; }; }
++test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
++  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
++   { (exit 1); exit 1; }; }
+ 
+-# confdefs.h avoids OS command line length limits that DEFS can exceed.
+-rm -rf conftest* confdefs.h
+-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+-echo > confdefs.h
+-
+-# A filename unique to this package, relative to the directory that
+-# configure is in, which we can look for to find out if srcdir is correct.
+-ac_unique_file=common/unicode/utypes.h
+ 
+ # Find the source files, if location was not specified.
+ if test -z "$srcdir"; then
+   ac_srcdir_defaulted=yes
+-  # Try the directory containing this script, then its parent.
+-  ac_prog=$0
+-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
++  # Try the directory containing this script, then the parent directory.
++  ac_confdir=`$as_dirname -- "$as_myself" ||
++$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++	 X"$as_myself" : 'X\(//\)[^/]' \| \
++	 X"$as_myself" : 'X\(//\)$' \| \
++	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X"$as_myself" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
++	    s//\1/
++	    q
++	  }
++	  /^X\(\/\/\)[^/].*/{
++	    s//\1/
++	    q
++	  }
++	  /^X\(\/\/\)$/{
++	    s//\1/
++	    q
++	  }
++	  /^X\(\/\).*/{
++	    s//\1/
++	    q
++	  }
++	  s/.*/./; q'`
+   srcdir=$ac_confdir
+-  if test ! -r $srcdir/$ac_unique_file; then
++  if test ! -r "$srcdir/$ac_unique_file"; then
+     srcdir=..
+   fi
+ else
+   ac_srcdir_defaulted=no
+ fi
+-if test ! -r $srcdir/$ac_unique_file; then
+-  if test "$ac_srcdir_defaulted" = yes; then
+-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+-  else
+-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+-  fi
+-fi
+-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+-
+-# Prefer explicitly selected file to automatically selected ones.
+-if test -z "$CONFIG_SITE"; then
+-  if test "x$prefix" != xNONE; then
+-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+-  else
+-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+-  fi
+-fi
+-for ac_site_file in $CONFIG_SITE; do
+-  if test -r "$ac_site_file"; then
+-    echo "loading site script $ac_site_file"
+-    . "$ac_site_file"
+-  fi
++if test ! -r "$srcdir/$ac_unique_file"; then
++  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
++  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
++   { (exit 1); exit 1; }; }
++fi
++ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
++ac_abs_confdir=`(
++	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
++   { (exit 1); exit 1; }; }
++	pwd)`
++# When building in place, set srcdir=.
++if test "$ac_abs_confdir" = "$ac_pwd"; then
++  srcdir=.
++fi
++# Remove unnecessary trailing slashes from srcdir.
++# Double slashes in file names in object file debugging info
++# mess up M-x gdb in Emacs.
++case $srcdir in
++*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
++esac
++for ac_var in $ac_precious_vars; do
++  eval ac_env_${ac_var}_set=\${${ac_var}+set}
++  eval ac_env_${ac_var}_value=\$${ac_var}
++  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
++  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+ done
+ 
+-if test -r "$cache_file"; then
+-  echo "loading cache $cache_file"
+-  . $cache_file
+-else
+-  echo "creating cache $cache_file"
+-  > $cache_file
++#
++# Report the --help message.
++#
++if test "$ac_init_help" = "long"; then
++  # Omit some internal or obsolete options to make the list less imposing.
++  # This message is too long to be a string in the A/UX 3.1 sh.
++  cat <<_ACEOF
++\`configure' configures this package to adapt to many kinds of systems.
++
++Usage: $0 [OPTION]... [VAR=VALUE]...
++
++To assign environment variables (e.g., CC, CFLAGS...), specify them as
++VAR=VALUE.  See below for descriptions of some of the useful variables.
++
++Defaults for the options are specified in brackets.
++
++Configuration:
++  -h, --help              display this help and exit
++      --help=short        display options specific to this package
++      --help=recursive    display the short help of all the included packages
++  -V, --version           display version information and exit
++  -q, --quiet, --silent   do not print \`checking...' messages
++      --cache-file=FILE   cache test results in FILE [disabled]
++  -C, --config-cache      alias for \`--cache-file=config.cache'
++  -n, --no-create         do not create output files
++      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
++
++Installation directories:
++  --prefix=PREFIX         install architecture-independent files in PREFIX
++                          [$ac_default_prefix]
++  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
++                          [PREFIX]
++
++By default, \`make install' will install all the files in
++\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
++an installation prefix other than \`$ac_default_prefix' using \`--prefix',
++for instance \`--prefix=\$HOME'.
++
++For better control, use the options below.
++
++Fine tuning of the installation directories:
++  --bindir=DIR            user executables [EPREFIX/bin]
++  --sbindir=DIR           system admin executables [EPREFIX/sbin]
++  --libexecdir=DIR        program executables [EPREFIX/libexec]
++  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
++  --libdir=DIR            object code libraries [EPREFIX/lib]
++  --includedir=DIR        C header files [PREFIX/include]
++  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
++  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
++  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
++  --infodir=DIR           info documentation [DATAROOTDIR/info]
++  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
++  --mandir=DIR            man documentation [DATAROOTDIR/man]
++  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
++  --htmldir=DIR           html documentation [DOCDIR]
++  --dvidir=DIR            dvi documentation [DOCDIR]
++  --pdfdir=DIR            pdf documentation [DOCDIR]
++  --psdir=DIR             ps documentation [DOCDIR]
++_ACEOF
++
++  cat <<\_ACEOF
++
++System types:
++  --build=BUILD     configure for building on BUILD [guessed]
++  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
++_ACEOF
+ fi
+ 
+-ac_ext=c
+-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+-cross_compiling=$ac_cv_prog_cc_cross
+-
+-ac_exeext=
+-ac_objext=o
+-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+-  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+-    ac_n= ac_c='
+-' ac_t='	'
+-  else
+-    ac_n=-n ac_c= ac_t=
++if test -n "$ac_init_help"; then
++
++  cat <<\_ACEOF
++
++Optional Features:
++  --disable-option-checking  ignore unrecognized --enable/--with options
++  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
++  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
++  --enable-strict         compile with strict compiler options default=no
++  --enable-64bit-libs     build 64-bit libraries default=yes
++  --enable-shared         build shared libraries default=yes
++  --enable-static         build static libraries default=no
++  --enable-debug          build debug libraries default=no
++  --enable-release        build release libraries default=yes
++  --enable-renaming       add a version suffix to symbols default=yes
++  --enable-tracing        enable function and data tracing default=yes
++  --enable-rpath          use rpath when linking default is only if necessary
++  --enable-threads        build ICU with thread safety default=yes
++  --enable-extras         build ICU extras default=yes
++  --enable-icuio          build ICU's icuio library default=yes
++  --enable-layout         build ICU's layout library default=yes
++
++  --enable-tests          build ICU tests default=yes
++  --enable-samples        build ICU samples default=yes
++Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries.
++
++Optional Packages:
++  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
++  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
++  --with-iostream=version specify the version of iostream to use (none, old, std, auto) default=auto
++  --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) default=auto
++  --with-library-suffix=suffix    tag a suffix to the library names default=
++
++Some influential environment variables:
++  CC          C compiler command
++  CFLAGS      C compiler flags
++  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
++              nonstandard directory <lib dir>
++  LIBS        libraries to pass to the linker, e.g. -l<library>
++  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
++              you have headers in a nonstandard directory <include dir>
++  CXX         C++ compiler command
++  CXXFLAGS    C++ compiler flags
++  CPP         C preprocessor
++  CXXCPP      C++ preprocessor
++
++Use these variables to override the choices made by `configure' or to help
++it to find libraries and programs with nonstandard names/locations.
++
++_ACEOF
++ac_status=$?
++fi
++
++if test "$ac_init_help" = "recursive"; then
++  # If there are subdirs, report their specific --help.
++  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
++    test -d "$ac_dir" ||
++      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
++      continue
++    ac_builddir=.
++
++case "$ac_dir" in
++.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
++*)
++  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
++  # A ".." for each directory in $ac_dir_suffix.
++  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
++  case $ac_top_builddir_sub in
++  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
++  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
++  esac ;;
++esac
++ac_abs_top_builddir=$ac_pwd
++ac_abs_builddir=$ac_pwd$ac_dir_suffix
++# for backward compatibility:
++ac_top_builddir=$ac_top_build_prefix
++
++case $srcdir in
++  .)  # We are building in place.
++    ac_srcdir=.
++    ac_top_srcdir=$ac_top_builddir_sub
++    ac_abs_top_srcdir=$ac_pwd ;;
++  [\\/]* | ?:[\\/]* )  # Absolute name.
++    ac_srcdir=$srcdir$ac_dir_suffix;
++    ac_top_srcdir=$srcdir
++    ac_abs_top_srcdir=$srcdir ;;
++  *) # Relative name.
++    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
++    ac_top_srcdir=$ac_top_build_prefix$srcdir
++    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
++esac
++ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
++
++    cd "$ac_dir" || { ac_status=$?; continue; }
++    # Check for guested configure.
++    if test -f "$ac_srcdir/configure.gnu"; then
++      echo &&
++      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
++    elif test -f "$ac_srcdir/configure"; then
++      echo &&
++      $SHELL "$ac_srcdir/configure" --help=recursive
++    else
++      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
++    fi || ac_status=$?
++    cd "$ac_pwd" || { ac_status=$?; break; }
++  done
++fi
++
++test -n "$ac_init_help" && exit $ac_status
++if $ac_init_version; then
++  cat <<\_ACEOF
++configure
++generated by GNU Autoconf 2.63
++
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
++This configure script is free software; the Free Software Foundation
++gives unlimited permission to copy, distribute and modify it.
++_ACEOF
++  exit
++fi
++cat >config.log <<_ACEOF
++This file contains any messages produced by compilers while
++running configure, to aid debugging if configure makes a mistake.
++
++It was created by $as_me, which was
++generated by GNU Autoconf 2.63.  Invocation command line was
++
++  $ $0 $@
++
++_ACEOF
++exec 5>>config.log
++{
++cat <<_ASUNAME
++## --------- ##
++## Platform. ##
++## --------- ##
++
++hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
++uname -m = `(uname -m) 2>/dev/null || echo unknown`
++uname -r = `(uname -r) 2>/dev/null || echo unknown`
++uname -s = `(uname -s) 2>/dev/null || echo unknown`
++uname -v = `(uname -v) 2>/dev/null || echo unknown`
++
++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
++/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
++
++/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
++/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
++/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
++/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
++/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
++/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
++/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
++
++_ASUNAME
++
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  $as_echo "PATH: $as_dir"
++done
++IFS=$as_save_IFS
++
++} >&5
++
++cat >&5 <<_ACEOF
++
++
++## ----------- ##
++## Core tests. ##
++## ----------- ##
++
++_ACEOF
++
++
++# Keep a trace of the command line.
++# Strip out --no-create and --no-recursion so they do not pile up.
++# Strip out --silent because we don't want to record it for future runs.
++# Also quote any args containing shell meta-characters.
++# Make two passes to allow for proper duplicate-argument suppression.
++ac_configure_args=
++ac_configure_args0=
++ac_configure_args1=
++ac_must_keep_next=false
++for ac_pass in 1 2
++do
++  for ac_arg
++  do
++    case $ac_arg in
++    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
++    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
++    | -silent | --silent | --silen | --sile | --sil)
++      continue ;;
++    *\'*)
++      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
++    esac
++    case $ac_pass in
++    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
++    2)
++      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
++      if test $ac_must_keep_next = true; then
++	ac_must_keep_next=false # Got value, back to normal.
++      else
++	case $ac_arg in
++	  *=* | --config-cache | -C | -disable-* | --disable-* \
++	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
++	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
++	  | -with-* | --with-* | -without-* | --without-* | --x)
++	    case "$ac_configure_args0 " in
++	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
++	    esac
++	    ;;
++	  -* ) ac_must_keep_next=true ;;
++	esac
++      fi
++      ac_configure_args="$ac_configure_args '$ac_arg'"
++      ;;
++    esac
++  done
++done
++$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
++$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
++
++# When interrupted or exit'd, cleanup temporary files, and complete
++# config.log.  We remove comments because anyway the quotes in there
++# would cause problems or look ugly.
++# WARNING: Use '\'' to represent an apostrophe within the trap.
++# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
++trap 'exit_status=$?
++  # Save into config.log some information that might help in debugging.
++  {
++    echo
++
++    cat <<\_ASBOX
++## ---------------- ##
++## Cache variables. ##
++## ---------------- ##
++_ASBOX
++    echo
++    # The following way of writing the cache mishandles newlines in values,
++(
++  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
++    eval ac_val=\$$ac_var
++    case $ac_val in #(
++    *${as_nl}*)
++      case $ac_var in #(
++      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
++$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
++      esac
++      case $ac_var in #(
++      _ | IFS | as_nl) ;; #(
++      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
++      *) $as_unset $ac_var ;;
++      esac ;;
++    esac
++  done
++  (set) 2>&1 |
++    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
++    *${as_nl}ac_space=\ *)
++      sed -n \
++	"s/'\''/'\''\\\\'\'''\''/g;
++	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
++      ;; #(
++    *)
++      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
++      ;;
++    esac |
++    sort
++)
++    echo
++
++    cat <<\_ASBOX
++## ----------------- ##
++## Output variables. ##
++## ----------------- ##
++_ASBOX
++    echo
++    for ac_var in $ac_subst_vars
++    do
++      eval ac_val=\$$ac_var
++      case $ac_val in
++      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++      esac
++      $as_echo "$ac_var='\''$ac_val'\''"
++    done | sort
++    echo
++
++    if test -n "$ac_subst_files"; then
++      cat <<\_ASBOX
++## ------------------- ##
++## File substitutions. ##
++## ------------------- ##
++_ASBOX
++      echo
++      for ac_var in $ac_subst_files
++      do
++	eval ac_val=\$$ac_var
++	case $ac_val in
++	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++	esac
++	$as_echo "$ac_var='\''$ac_val'\''"
++      done | sort
++      echo
++    fi
++
++    if test -s confdefs.h; then
++      cat <<\_ASBOX
++## ----------- ##
++## confdefs.h. ##
++## ----------- ##
++_ASBOX
++      echo
++      cat confdefs.h
++      echo
++    fi
++    test "$ac_signal" != 0 &&
++      $as_echo "$as_me: caught signal $ac_signal"
++    $as_echo "$as_me: exit $exit_status"
++  } >&5
++  rm -f core *.core core.conftest.* &&
++    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
++    exit $exit_status
++' 0
++for ac_signal in 1 2 13 15; do
++  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
++done
++ac_signal=0
++
++# confdefs.h avoids OS command line length limits that DEFS can exceed.
++rm -f -r conftest* confdefs.h
++
++# Predefined preprocessor variables.
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_NAME "$PACKAGE_NAME"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_VERSION "$PACKAGE_VERSION"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_STRING "$PACKAGE_STRING"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
++_ACEOF
++
++
++# Let the site file select an alternate cache file if it wants to.
++# Prefer an explicitly selected file to automatically selected ones.
++ac_site_file1=NONE
++ac_site_file2=NONE
++if test -n "$CONFIG_SITE"; then
++  ac_site_file1=$CONFIG_SITE
++elif test "x$prefix" != xNONE; then
++  ac_site_file1=$prefix/share/config.site
++  ac_site_file2=$prefix/etc/config.site
++else
++  ac_site_file1=$ac_default_prefix/share/config.site
++  ac_site_file2=$ac_default_prefix/etc/config.site
++fi
++for ac_site_file in "$ac_site_file1" "$ac_site_file2"
++do
++  test "x$ac_site_file" = xNONE && continue
++  if test -r "$ac_site_file"; then
++    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
++$as_echo "$as_me: loading site script $ac_site_file" >&6;}
++    sed 's/^/| /' "$ac_site_file" >&5
++    . "$ac_site_file"
++  fi
++done
++
++if test -r "$cache_file"; then
++  # Some versions of bash will fail to source /dev/null (special
++  # files actually), so we avoid doing that.
++  if test -f "$cache_file"; then
++    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
++$as_echo "$as_me: loading cache $cache_file" >&6;}
++    case $cache_file in
++      [\\/]* | ?:[\\/]* ) . "$cache_file";;
++      *)                      . "./$cache_file";;
++    esac
+   fi
+ else
+-  ac_n= ac_c='\c' ac_t=
++  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
++$as_echo "$as_me: creating cache $cache_file" >&6;}
++  >$cache_file
++fi
++
++# Check that the precious variables saved in the cache have kept the same
++# value.
++ac_cache_corrupted=false
++for ac_var in $ac_precious_vars; do
++  eval ac_old_set=\$ac_cv_env_${ac_var}_set
++  eval ac_new_set=\$ac_env_${ac_var}_set
++  eval ac_old_val=\$ac_cv_env_${ac_var}_value
++  eval ac_new_val=\$ac_env_${ac_var}_value
++  case $ac_old_set,$ac_new_set in
++    set,)
++      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
++$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
++      ac_cache_corrupted=: ;;
++    ,set)
++      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
++$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
++      ac_cache_corrupted=: ;;
++    ,);;
++    *)
++      if test "x$ac_old_val" != "x$ac_new_val"; then
++	# differences in whitespace do not lead to failure.
++	ac_old_val_w=`echo x $ac_old_val`
++	ac_new_val_w=`echo x $ac_new_val`
++	if test "$ac_old_val_w" != "$ac_new_val_w"; then
++	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
++$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
++	  ac_cache_corrupted=:
++	else
++	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
++$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
++	  eval $ac_var=\$ac_old_val
++	fi
++	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
++$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
++	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
++$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
++      fi;;
++  esac
++  # Pass precious variables to config.status.
++  if test "$ac_new_set" = set; then
++    case $ac_new_val in
++    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
++    *) ac_arg=$ac_var=$ac_new_val ;;
++    esac
++    case " $ac_configure_args " in
++      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
++      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
++    esac
++  fi
++done
++if $ac_cache_corrupted; then
++  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
++$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
++  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
++$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
++   { (exit 1); exit 1; }; }
+ fi
+ 
+ 
+ 
+ 
++
++
++
++
++
++
++
++
++
++
++
++
++
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++
++
++ac_config_headers="$ac_config_headers common/icucfg.h"
++
+ PACKAGE="icu"
+ 
+ 
+-echo $ac_n "checking for ICU version numbers""... $ac_c" 1>&6
+-echo "configure:570: checking for ICU version numbers" >&5
++{ $as_echo "$as_me:$LINENO: checking for ICU version numbers" >&5
++$as_echo_n "checking for ICU version numbers... " >&6; }
+ 
+ geticuversion() {
+     sed -n 's/^[ 	]*#[ 	]*define[ 	]*U_ICU_VERSION[ 	]*"\([^"]*\)".*/\1/p' "$@"
+@@ -575,7 +1921,9 @@
+ if test x"$VERSION" = x; then
+     VERSION=`geticuversion $srcdir/common/unicode/*.h`
+     if test x"$VERSION" = x; then
+-        { echo "configure: error: Cannot determine ICU version number from header files" 1>&2; exit 1; }
++        { { $as_echo "$as_me:$LINENO: error: Cannot determine ICU version number from header files" >&5
++$as_echo "$as_me: error: Cannot determine ICU version number from header files" >&2;}
++   { (exit 1); exit 1; }; }
+     fi
+ fi
+ LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`
+@@ -583,7 +1931,8 @@
+ 
+ 
+ 
+-echo "$ac_t""release $VERSION, library $LIB_VERSION" 1>&6
++{ $as_echo "$as_me:$LINENO: result: release $VERSION, library $LIB_VERSION" >&5
++$as_echo "release $VERSION, library $LIB_VERSION" >&6; }
+ 
+ UNICODE_VERSION="4.0.1"
+ 
+@@ -591,214 +1940,804 @@
+ 
+ #AC_SUBST(CINTLTST_CPPFLAGS)
+ 
+-# Extract the first word of "gcc", so it can be a program name with args.
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}gcc; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$CC"; then
++  ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_CC="${ac_tool_prefix}gcc"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
++fi
++fi
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++  { $as_echo "$as_me:$LINENO: result: $CC" >&5
++$as_echo "$CC" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_CC"; then
++  ac_ct_CC=$CC
++  # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:598: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_CC"; then
++  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_ac_ct_CC="gcc"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_ct_CC" = x; then
++    CC=""
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    CC=$ac_ct_CC
++  fi
++else
++  CC="$ac_cv_prog_CC"
++fi
++
++if test -z "$CC"; then
++          if test -n "$ac_tool_prefix"; then
++    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}cc; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_CC="gcc"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_CC="${ac_tool_prefix}cc"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+ fi
+ fi
+-CC="$ac_cv_prog_CC"
++CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  echo "$ac_t""$CC" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
++
++  fi
++fi
+ if test -z "$CC"; then
+   # Extract the first word of "cc", so it can be a program name with args.
+ set dummy cc; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:628: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_prog_rejected=no
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+-        ac_prog_rejected=yes
+-	continue
+-      fi
+-      ac_cv_prog_CC="cc"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
++       ac_prog_rejected=yes
++       continue
++     fi
++    ac_cv_prog_CC="cc"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+ if test $ac_prog_rejected = yes; then
+   # We found a bogon in the path, so make sure we never use it.
+   set dummy $ac_cv_prog_CC
+   shift
+-  if test $# -gt 0; then
++  if test $# != 0; then
+     # We chose a different compiler from the bogus one.
+     # However, it has the same basename, so the bogon will be chosen
+     # first if we set CC to just the basename; use the full file name.
+     shift
+-    set dummy "$ac_dir/$ac_word" "$@"
+-    shift
+-    ac_cv_prog_CC="$@"
++    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+   fi
+ fi
+ fi
+ fi
+-CC="$ac_cv_prog_CC"
++CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  echo "$ac_t""$CC" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+-  if test -z "$CC"; then
+-    case "`uname -s`" in
+-    *win32* | *WIN32*)
+-      # Extract the first word of "cl", so it can be a program name with args.
+-set dummy cl; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:679: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++
++fi
++if test -z "$CC"; then
++  if test -n "$ac_tool_prefix"; then
++  for ac_prog in cl.exe
++  do
++    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
++set dummy $ac_tool_prefix$ac_prog; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_CC="cl"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+ fi
+ fi
+-CC="$ac_cv_prog_CC"
++CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  echo "$ac_t""$CC" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+- ;;
+-    esac
++
++
++    test -n "$CC" && break
++  done
++fi
++if test -z "$CC"; then
++  ac_ct_CC=$CC
++  for ac_prog in cl.exe
++do
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_CC"; then
++  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_ac_ct_CC="$ac_prog"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
+   fi
+-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
++done
++done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+-echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+ 
+-ac_ext=c
+-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+-cross_compiling=$ac_cv_prog_cc_cross
+-
+-cat > conftest.$ac_ext << EOF
+-
+-#line 722 "configure"
+-#include "confdefs.h"
+-
+-main(){return(0);}
+-EOF
+-if { (eval echo configure:727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+-  ac_cv_prog_cc_works=yes
+-  # If we can't run a trivial program, we are probably using a cross compiler.
+-  if (./conftest; exit) 2>/dev/null; then
+-    ac_cv_prog_cc_cross=no
++  test -n "$ac_ct_CC" && break
++done
++
++  if test "x$ac_ct_CC" = x; then
++    CC=""
+   else
+-    ac_cv_prog_cc_cross=yes
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    CC=$ac_ct_CC
+   fi
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  ac_cv_prog_cc_works=no
+ fi
+-rm -fr conftest*
+-ac_ext=c
+-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+-cross_compiling=$ac_cv_prog_cc_cross
+ 
+-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+-if test $ac_cv_prog_cc_works = no; then
+-  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+ fi
+-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+-echo "configure:753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+-cross_compiling=$ac_cv_prog_cc_cross
+ 
+-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+-echo "configure:758: checking whether we are using GNU C" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  cat > conftest.c <<EOF
+-#ifdef __GNUC__
+-  yes;
+-#endif
+-EOF
+-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+-  ac_cv_prog_gcc=yes
++
++test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
++See \`config.log' for more details." >&5
++$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }; }
++
++# Provide some information about the compiler.
++$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
++set X $ac_compile
++ac_compiler=$2
++{ (ac_try="$ac_compiler --version >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler --version >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (ac_try="$ac_compiler -v >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler -v >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (ac_try="$ac_compiler -V >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler -V >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++ac_clean_files_save=$ac_clean_files
++ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
++# Try to create an executable without -o first, disregard a.out.
++# It will help us diagnose broken compilers, and finding out an intuition
++# of exeext.
++{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
++$as_echo_n "checking for C compiler default output file name... " >&6; }
++ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
++
++# The possible output files:
++ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
++
++ac_rmfiles=
++for ac_file in $ac_files
++do
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
++    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
++  esac
++done
++rm -f $ac_rmfiles
++
++if { (ac_try="$ac_link_default"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link_default") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
++# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
++# in a Makefile.  We should not override ac_cv_exeext if it was cached,
++# so that the user can short-circuit this test for compilers unknown to
++# Autoconf.
++for ac_file in $ac_files ''
++do
++  test -f "$ac_file" || continue
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
++	;;
++    [ab].out )
++	# We found the default executable, but exeext='' is most
++	# certainly right.
++	break;;
++    *.* )
++        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
++	then :; else
++	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
++	fi
++	# We set ac_cv_exeext here because the later test for it is not
++	# safe: cross compilers may not add the suffix if given an `-o'
++	# argument, so we may need to know it at that point already.
++	# Even if this section looks crufty: it has the advantage of
++	# actually working.
++	break;;
++    * )
++	break;;
++  esac
++done
++test "$ac_cv_exeext" = no && ac_cv_exeext=
++
+ else
+-  ac_cv_prog_gcc=no
++  ac_file=''
+ fi
++
++{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
++$as_echo "$ac_file" >&6; }
++if test -z "$ac_file"; then
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
++See \`config.log' for more details." >&5
++$as_echo "$as_me: error: C compiler cannot create executables
++See \`config.log' for more details." >&2;}
++   { (exit 77); exit 77; }; }; }
++fi
++
++ac_exeext=$ac_cv_exeext
++
++# Check that the compiler produces executables we can run.  If not, either
++# the compiler is broken, or we cross compile.
++{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
++$as_echo_n "checking whether the C compiler works... " >&6; }
++# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
++# If not cross compiling, check that we can run a simple program.
++if test "$cross_compiling" != yes; then
++  if { ac_try='./$ac_file'
++  { (case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_try") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++    cross_compiling=no
++  else
++    if test "$cross_compiling" = maybe; then
++	cross_compiling=yes
++    else
++	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
++If you meant to cross compile, use \`--host'.
++See \`config.log' for more details." >&5
++$as_echo "$as_me: error: cannot run C compiled programs.
++If you meant to cross compile, use \`--host'.
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }; }
++    fi
++  fi
+ fi
++{ $as_echo "$as_me:$LINENO: result: yes" >&5
++$as_echo "yes" >&6; }
++
++rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
++ac_clean_files=$ac_clean_files_save
++# Check that the compiler produces executables we can run.  If not, either
++# the compiler is broken, or we cross compile.
++{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
++$as_echo_n "checking whether we are cross compiling... " >&6; }
++{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
++$as_echo "$cross_compiling" >&6; }
++
++{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
++$as_echo_n "checking for suffix of executables... " >&6; }
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  # If both `conftest.exe' and `conftest' are `present' (well, observable)
++# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
++# work properly (i.e., refer to `conftest.exe'), while it won't with
++# `rm'.
++for ac_file in conftest.exe conftest conftest.*; do
++  test -f "$ac_file" || continue
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
++    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
++	  break;;
++    * ) break;;
++  esac
++done
++else
++  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
++See \`config.log' for more details." >&5
++$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }; }
++fi
++
++rm -f conftest$ac_cv_exeext
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
++$as_echo "$ac_cv_exeext" >&6; }
++
++rm -f conftest.$ac_ext
++EXEEXT=$ac_cv_exeext
++ac_exeext=$EXEEXT
++{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
++$as_echo_n "checking for suffix of object files... " >&6; }
++if test "${ac_cv_objext+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ 
+-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.o conftest.obj
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  for ac_file in conftest.o conftest.obj conftest.*; do
++  test -f "$ac_file" || continue;
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
++    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
++       break;;
++  esac
++done
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
++See \`config.log' for more details." >&5
++$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }; }
++fi
++
++rm -f conftest.$ac_cv_objext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
++$as_echo "$ac_cv_objext" >&6; }
++OBJEXT=$ac_cv_objext
++ac_objext=$OBJEXT
++{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
++$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
++if test "${ac_cv_c_compiler_gnu+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ 
+-if test $ac_cv_prog_gcc = yes; then
++int
++main ()
++{
++#ifndef __GNUC__
++       choke me
++#endif
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  ac_compiler_gnu=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_compiler_gnu=no
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ac_cv_c_compiler_gnu=$ac_compiler_gnu
++
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
++$as_echo "$ac_cv_c_compiler_gnu" >&6; }
++if test $ac_compiler_gnu = yes; then
+   GCC=yes
+ else
+   GCC=
+ fi
++ac_test_CFLAGS=${CFLAGS+set}
++ac_save_CFLAGS=$CFLAGS
++{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
++$as_echo_n "checking whether $CC accepts -g... " >&6; }
++if test "${ac_cv_prog_cc_g+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  ac_save_c_werror_flag=$ac_c_werror_flag
++   ac_c_werror_flag=yes
++   ac_cv_prog_cc_g=no
++   CFLAGS="-g"
++   cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  ac_cv_prog_cc_g=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
+ 
+-ac_test_CFLAGS="${CFLAGS+set}"
+-ac_save_CFLAGS="$CFLAGS"
+-CFLAGS=
+-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+-echo "configure:786: checking whether ${CC-cc} accepts -g" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++	CFLAGS=""
++      cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  :
+ else
+-  echo 'void f(){}' > conftest.c
+-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_c_werror_flag=$ac_save_c_werror_flag
++	 CFLAGS="-g"
++	 cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
+   ac_cv_prog_cc_g=yes
+ else
+-  ac_cv_prog_cc_g=no
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-rm -f conftest*
+ 
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
+-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++   ac_c_werror_flag=$ac_save_c_werror_flag
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
++$as_echo "$ac_cv_prog_cc_g" >&6; }
+ if test "$ac_test_CFLAGS" = set; then
+-  CFLAGS="$ac_save_CFLAGS"
++  CFLAGS=$ac_save_CFLAGS
+ elif test $ac_cv_prog_cc_g = yes; then
+   if test "$GCC" = yes; then
+     CFLAGS="-g -O2"
+@@ -812,136 +2751,481 @@
+     CFLAGS=
+   fi
+ fi
++{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
++$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
++if test "${ac_cv_prog_cc_c89+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  ac_cv_prog_cc_c89=no
++ac_save_CC=$CC
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++#include <stdarg.h>
++#include <stdio.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
++struct buf { int x; };
++FILE * (*rcsopen) (struct buf *, struct stat *, int);
++static char *e (p, i)
++     char **p;
++     int i;
++{
++  return p[i];
++}
++static char *f (char * (*g) (char **, int), char **p, ...)
++{
++  char *s;
++  va_list v;
++  va_start (v,p);
++  s = g (p, va_arg (v,int));
++  va_end (v);
++  return s;
++}
+ 
+-for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
++/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
++   function prototypes and stuff, but not '\xHH' hex character constants.
++   These don't provoke an error unfortunately, instead are silently treated
++   as 'x'.  The following induces an error, until -std is added to get
++   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
++   array size at least.  It's necessary to write '\x00'==0 to get something
++   that's true only with -std.  */
++int osf4_cc_array ['\x00' == 0 ? 1 : -1];
++
++/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
++   inside strings and character constants.  */
++#define FOO(x) 'x'
++int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
++
++int test (int i, double x);
++struct s1 {int (*f) (int a);};
++struct s2 {int (*f) (double a);};
++int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
++int argc;
++char **argv;
++int
++main ()
++{
++return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
++  ;
++  return 0;
++}
++_ACEOF
++for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
++	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+ do
+-# Extract the first word of "$ac_prog", so it can be a program name with args.
+-set dummy $ac_prog; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:822: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++  CC="$ac_save_CC $ac_arg"
++  rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  ac_cv_prog_cc_c89=$ac_arg
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++
++fi
++
++rm -f core conftest.err conftest.$ac_objext
++  test "x$ac_cv_prog_cc_c89" != "xno" && break
++done
++rm -f conftest.$ac_ext
++CC=$ac_save_CC
++
++fi
++# AC_CACHE_VAL
++case "x$ac_cv_prog_cc_c89" in
++  x)
++    { $as_echo "$as_me:$LINENO: result: none needed" >&5
++$as_echo "none needed" >&6; } ;;
++  xno)
++    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;;
++  *)
++    CC="$CC $ac_cv_prog_cc_c89"
++    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
++$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
++esac
++
++
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++ac_ext=cpp
++ac_cpp='$CXXCPP $CPPFLAGS'
++ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
++if test -z "$CXX"; then
++  if test -n "$CCC"; then
++    CXX=$CCC
++  else
++    if test -n "$ac_tool_prefix"; then
++  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
++  do
++    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
++set dummy $ac_tool_prefix$ac_prog; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CXX+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CXX"; then
+   ac_cv_prog_CXX="$CXX" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_CXX="$ac_prog"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+ fi
+ fi
+-CXX="$ac_cv_prog_CXX"
++CXX=$ac_cv_prog_CXX
+ if test -n "$CXX"; then
+-  echo "$ac_t""$CXX" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $CXX" >&5
++$as_echo "$CXX" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+-test -n "$CXX" && break
++
++    test -n "$CXX" && break
++  done
++fi
++if test -z "$CXX"; then
++  ac_ct_CXX=$CXX
++  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
++do
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_CXX"; then
++  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_ac_ct_CXX="$ac_prog"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
+ done
+-test -n "$CXX" || CXX="gcc"
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
++if test -n "$ac_ct_CXX"; then
++  { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
++$as_echo "$ac_ct_CXX" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
++fi
+ 
+ 
+-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+-echo "configure:854: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
++  test -n "$ac_ct_CXX" && break
++done
+ 
+-ac_ext=C
+-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+-ac_cpp='$CXXCPP $CPPFLAGS'
+-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+-cross_compiling=$ac_cv_prog_cxx_cross
+-
+-cat > conftest.$ac_ext << EOF
+-
+-#line 865 "configure"
+-#include "confdefs.h"
+-
+-int main(){return(0);}
+-EOF
+-if { (eval echo configure:870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+-  ac_cv_prog_cxx_works=yes
+-  # If we can't run a trivial program, we are probably using a cross compiler.
+-  if (./conftest; exit) 2>/dev/null; then
+-    ac_cv_prog_cxx_cross=no
++  if test "x$ac_ct_CXX" = x; then
++    CXX="g++"
+   else
+-    ac_cv_prog_cxx_cross=yes
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    CXX=$ac_ct_CXX
+   fi
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  ac_cv_prog_cxx_works=no
+ fi
+-rm -fr conftest*
+-ac_ext=c
+-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+-cross_compiling=$ac_cv_prog_cc_cross
+ 
+-echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
+-if test $ac_cv_prog_cxx_works = no; then
+-  { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
++  fi
+ fi
+-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+-echo "configure:896: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+-echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
+-cross_compiling=$ac_cv_prog_cxx_cross
++# Provide some information about the compiler.
++$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
++set X $ac_compile
++ac_compiler=$2
++{ (ac_try="$ac_compiler --version >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler --version >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (ac_try="$ac_compiler -v >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler -v >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (ac_try="$ac_compiler -V >&5"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compiler -V >&5") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++
++{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
++$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
++if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ 
+-echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
+-echo "configure:901: checking whether we are using GNU C++" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  cat > conftest.C <<EOF
+-#ifdef __GNUC__
+-  yes;
++int
++main ()
++{
++#ifndef __GNUC__
++       choke me
+ #endif
+-EOF
+-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+-  ac_cv_prog_gxx=yes
+-else
+-  ac_cv_prog_gxx=no
+-fi
+-fi
+ 
+-echo "$ac_t""$ac_cv_prog_gxx" 1>&6
+-
+-if test $ac_cv_prog_gxx = yes; then
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_cxx_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  ac_compiler_gnu=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_compiler_gnu=no
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
++
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
++$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
++if test $ac_compiler_gnu = yes; then
+   GXX=yes
+ else
+   GXX=
+ fi
++ac_test_CXXFLAGS=${CXXFLAGS+set}
++ac_save_CXXFLAGS=$CXXFLAGS
++{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
++$as_echo_n "checking whether $CXX accepts -g... " >&6; }
++if test "${ac_cv_prog_cxx_g+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
++   ac_cxx_werror_flag=yes
++   ac_cv_prog_cxx_g=no
++   CXXFLAGS="-g"
++   cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_cxx_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  ac_cv_prog_cxx_g=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	CXXFLAGS=""
++      cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
+ 
+-ac_test_CXXFLAGS="${CXXFLAGS+set}"
+-ac_save_CXXFLAGS="$CXXFLAGS"
+-CXXFLAGS=
+-echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+-echo "configure:929: checking whether ${CXX-g++} accepts -g" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_cxx_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  :
+ else
+-  echo 'void f(){}' > conftest.cc
+-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
++	 CXXFLAGS="-g"
++	 cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_cxx_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
+   ac_cv_prog_cxx_g=yes
+ else
+-  ac_cv_prog_cxx_g=no
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-rm -f conftest*
+ 
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
+-echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
++$as_echo "$ac_cv_prog_cxx_g" >&6; }
+ if test "$ac_test_CXXFLAGS" = set; then
+-  CXXFLAGS="$ac_save_CXXFLAGS"
++  CXXFLAGS=$ac_save_CXXFLAGS
+ elif test $ac_cv_prog_cxx_g = yes; then
+   if test "$GXX" = yes; then
+     CXXFLAGS="-g -O2"
+@@ -955,76 +3239,42 @@
+     CXXFLAGS=
+   fi
+ fi
+-
+-for ac_declaration in \
+-   ''\
+-   '#include <stdlib.h>' \
+-   'extern "C" void std::exit (int) throw (); using std::exit;' \
+-   'extern "C" void std::exit (int); using std::exit;' \
+-   'extern "C" void exit (int) throw ();' \
+-   'extern "C" void exit (int);' \
+-   'void exit (int);'
+-do
+-  cat > conftest.$ac_ext <<EOF
+-#line 970 "configure"
+-#include "confdefs.h"
+-#include <stdlib.h>
+-$ac_declaration
+-int main() {
+-exit (42);
+-; return 0; }
+-EOF
+-if { (eval echo configure:978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+-  :
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  continue
+-fi
+-rm -f conftest*
+-  cat > conftest.$ac_ext <<EOF
+-#line 988 "configure"
+-#include "confdefs.h"
+-$ac_declaration
+-int main() {
+-exit (42);
+-; return 0; }
+-EOF
+-if { (eval echo configure:995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+-  rm -rf conftest*
+-  break
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-fi
+-rm -f conftest*
+-done
+-if test -n "$ac_declaration"; then
+-  echo '#ifdef __cplusplus' >>confdefs.h
+-  echo $ac_declaration      >>confdefs.h
+-  echo '#endif'             >>confdefs.h
+-fi
+-
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ 
+ ac_aux_dir=
+-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+-  if test -f $ac_dir/install-sh; then
++for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
++  if test -f "$ac_dir/install-sh"; then
+     ac_aux_dir=$ac_dir
+     ac_install_sh="$ac_aux_dir/install-sh -c"
+     break
+-  elif test -f $ac_dir/install.sh; then
++  elif test -f "$ac_dir/install.sh"; then
+     ac_aux_dir=$ac_dir
+     ac_install_sh="$ac_aux_dir/install.sh -c"
+     break
++  elif test -f "$ac_dir/shtool"; then
++    ac_aux_dir=$ac_dir
++    ac_install_sh="$ac_aux_dir/shtool install -c"
++    break
+   fi
+ done
+ if test -z "$ac_aux_dir"; then
+-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
++  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
++$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
++   { (exit 1); exit 1; }; }
+ fi
+-ac_config_guess=$ac_aux_dir/config.guess
+-ac_config_sub=$ac_aux_dir/config.sub
+-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
++
++# These three variables are undocumented and unsupported,
++# and are intended to be withdrawn in a future Autoconf release.
++# They can cause serious problems if a builder's source tree is in a directory
++# whose full name contains unusual characters.
++ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
++ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
++ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
++
+ 
+ # Find a good install program.  We prefer a C program (faster),
+ # so one script is as good as another.  But avoid the broken or
+@@ -1033,60 +3283,89 @@
+ # SunOS /usr/etc/install
+ # IRIX /sbin/install
+ # AIX /bin/install
++# AmigaOS /C/install, which installs bootblocks on floppy discs
+ # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+ # AFS /usr/afsws/bin/install, which mishandles nonexistent args
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
++# OS/2's system install, which has a completely different semantic
+ # ./install, which can be erroneously created by make from ./install.sh.
+-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+-echo "configure:1042: checking for a BSD compatible install" >&5
++# Reject install programs that cannot install multiple files.
++{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
++$as_echo_n "checking for a BSD-compatible install... " >&6; }
+ if test -z "$INSTALL"; then
+-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++if test "${ac_cv_path_install+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+-  for ac_dir in $PATH; do
+-    # Account for people who put trailing slashes in PATH elements.
+-    case "$ac_dir/" in
+-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+-    *)
+-      # OSF1 and SCO ODT 3.0 have their own names for install.
+-      # Don't use installbsd from OSF since it installs stuff as root
+-      # by default.
+-      for ac_prog in ginstall scoinst install; do
+-        if test -f $ac_dir/$ac_prog; then
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  # Account for people who put trailing slashes in PATH elements.
++case $as_dir/ in
++  ./ | .// | /cC/* | \
++  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
++  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
++  /usr/ucb/* ) ;;
++  *)
++    # OSF1 and SCO ODT 3.0 have their own names for install.
++    # Don't use installbsd from OSF since it installs stuff as root
++    # by default.
++    for ac_prog in ginstall scoinst install; do
++      for ac_exec_ext in '' $ac_executable_extensions; do
++	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ 	  if test $ac_prog = install &&
+-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
++	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ 	    # AIX install.  It has an incompatible calling convention.
+ 	    :
++	  elif test $ac_prog = install &&
++	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
++	    # program-specific install script used by HP pwplus--don't use.
++	    :
+ 	  else
+-	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+-	    break 2
++	    rm -rf conftest.one conftest.two conftest.dir
++	    echo one > conftest.one
++	    echo two > conftest.two
++	    mkdir conftest.dir
++	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
++	      test -s conftest.one && test -s conftest.two &&
++	      test -s conftest.dir/conftest.one &&
++	      test -s conftest.dir/conftest.two
++	    then
++	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
++	      break 3
++	    fi
+ 	  fi
+ 	fi
+       done
+-      ;;
+-    esac
+-  done
+-  IFS="$ac_save_IFS"
++    done
++    ;;
++esac
++
++done
++IFS=$as_save_IFS
++
++rm -rf conftest.one conftest.two conftest.dir
+ 
+ fi
+   if test "${ac_cv_path_install+set}" = set; then
+-    INSTALL="$ac_cv_path_install"
++    INSTALL=$ac_cv_path_install
+   else
+-    # As a last resort, use the slow shell script.  We don't cache a
+-    # path for INSTALL within a source directory, because that will
++    # As a last resort, use the slow shell script.  Don't cache a
++    # value for INSTALL within a source directory, because that will
+     # break other packages using the cache if that directory is
+-    # removed, or if the path is relative.
+-    INSTALL="$ac_install_sh"
++    # removed, or if the value is a relative name.
++    INSTALL=$ac_install_sh
+   fi
+ fi
+-echo "$ac_t""$INSTALL" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
++$as_echo "$INSTALL" >&6; }
+ 
+ # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+ # It thinks the first close brace ends the variable substitution.
+ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+ 
+-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+ 
+@@ -1102,73 +3381,86 @@
+ #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
+ # Extract the first word of "strip", so it can be a program name with args.
+ set dummy strip; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1107: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_STRIP+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$STRIP"; then
+   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_STRIP="strip"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_STRIP="strip"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+   test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP="true"
+ fi
+ fi
+-STRIP="$ac_cv_prog_STRIP"
++STRIP=$ac_cv_prog_STRIP
+ if test -n "$STRIP"; then
+-  echo "$ac_t""$STRIP" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
++$as_echo "$STRIP" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+ 
++
+ for ac_prog in gmake gnumake
+ do
+-# Extract the first word of "$ac_prog", so it can be a program name with args.
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1140: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_path_U_MAKE'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_U_MAKE+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  case "$U_MAKE" in
+-  /*)
++  case $U_MAKE in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_U_MAKE="$U_MAKE" # Let the user override the test with a path.
+   ;;
+-  ?:/*)			 
+-  ac_cv_path_U_MAKE="$U_MAKE" # Let the user override the test with a dos path.
+-  ;;
+   *)
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do 
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_U_MAKE="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_U_MAKE="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+   ;;
+ esac
+ fi
+-U_MAKE="$ac_cv_path_U_MAKE"
++U_MAKE=$ac_cv_path_U_MAKE
+ if test -n "$U_MAKE"; then
+-  echo "$ac_t""$U_MAKE" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $U_MAKE" >&5
++$as_echo "$U_MAKE" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+-test -n "$U_MAKE" && break
++
++  test -n "$U_MAKE" && break
+ done
+ test -n "$U_MAKE" || U_MAKE="make"
+ 
+@@ -1176,182 +3468,150 @@
+ 
+ # Extract the first word of "doxygen", so it can be a program name with args.
+ set dummy doxygen; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1181: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_path_DOXYGEN'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_DOXYGEN+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  case "$DOXYGEN" in
+-  /*)
++  case $DOXYGEN in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path.
+   ;;
+-  ?:/*)			 
+-  ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a dos path.
+-  ;;
+   *)
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH:/usr/local/bin:/usr/bin"
+-  for ac_dir in $ac_dummy; do 
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_DOXYGEN="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++as_dummy="$PATH:/usr/local/bin:/usr/bin"
++for as_dir in $as_dummy
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+   ;;
+ esac
+ fi
+-DOXYGEN="$ac_cv_path_DOXYGEN"
++DOXYGEN=$ac_cv_path_DOXYGEN
+ if test -n "$DOXYGEN"; then
+-  echo "$ac_t""$DOXYGEN" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $DOXYGEN" >&5
++$as_echo "$DOXYGEN" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+ 
+ 
+ # Make sure we can run config.sub.
+-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+-fi
+-
+-echo $ac_n "checking host system type""... $ac_c" 1>&6
+-echo "configure:1221: checking host system type" >&5
+-
+-host_alias=$host
+-case "$host_alias" in
+-NONE)
+-  case $nonopt in
+-  NONE)
+-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+-    fi ;;
+-  *) host_alias=$nonopt ;;
+-  esac ;;
++$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
++  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
++$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
++   { (exit 1); exit 1; }; }
++
++{ $as_echo "$as_me:$LINENO: checking build system type" >&5
++$as_echo_n "checking build system type... " >&6; }
++if test "${ac_cv_build+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  ac_build_alias=$build_alias
++test "x$ac_build_alias" = x &&
++  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
++test "x$ac_build_alias" = x &&
++  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
++$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
++   { (exit 1); exit 1; }; }
++ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
++  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
++$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
++   { (exit 1); exit 1; }; }
++
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
++$as_echo "$ac_cv_build" >&6; }
++case $ac_cv_build in
++*-*-*) ;;
++*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
++$as_echo "$as_me: error: invalid value of canonical build" >&2;}
++   { (exit 1); exit 1; }; };;
+ esac
+-
+-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+-echo "$ac_t""$host" 1>&6
+-
+-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+-echo "configure:1242: checking for Cygwin environment" >&5
+-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1247 "configure"
+-#include "confdefs.h"
+-
+-int main() {
+-
+-#ifndef __CYGWIN__
+-#define __CYGWIN__ __CYGWIN32__
+-#endif
+-return __CYGWIN__;
+-; return 0; }
+-EOF
+-if { (eval echo configure:1258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+-  rm -rf conftest*
+-  ac_cv_cygwin=yes
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  ac_cv_cygwin=no
+-fi
+-rm -f conftest*
+-rm -f conftest*
++build=$ac_cv_build
++ac_save_IFS=$IFS; IFS='-'
++set x $ac_cv_build
++shift
++build_cpu=$1
++build_vendor=$2
++shift; shift
++# Remember, the first character of IFS is used to create $*,
++# except with old shells:
++build_os=$*
++IFS=$ac_save_IFS
++case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
++
++
++{ $as_echo "$as_me:$LINENO: checking host system type" >&5
++$as_echo_n "checking host system type... " >&6; }
++if test "${ac_cv_host+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test "x$host_alias" = x; then
++  ac_cv_host=$ac_cv_build
++else
++  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
++    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
++$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
++   { (exit 1); exit 1; }; }
+ fi
+ 
+-echo "$ac_t""$ac_cv_cygwin" 1>&6
+-CYGWIN=
+-test "$ac_cv_cygwin" = yes && CYGWIN=yes
+-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+-echo "configure:1275: checking for mingw32 environment" >&5
+-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1280 "configure"
+-#include "confdefs.h"
+-
+-int main() {
+-return __MINGW32__;
+-; return 0; }
+-EOF
+-if { (eval echo configure:1287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+-  rm -rf conftest*
+-  ac_cv_mingw32=yes
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  ac_cv_mingw32=no
+-fi
+-rm -f conftest*
+-rm -f conftest*
+ fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
++$as_echo "$ac_cv_host" >&6; }
++case $ac_cv_host in
++*-*-*) ;;
++*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
++$as_echo "$as_me: error: invalid value of canonical host" >&2;}
++   { (exit 1); exit 1; }; };;
++esac
++host=$ac_cv_host
++ac_save_IFS=$IFS; IFS='-'
++set x $ac_cv_host
++shift
++host_cpu=$1
++host_vendor=$2
++shift; shift
++# Remember, the first character of IFS is used to create $*,
++# except with old shells:
++host_os=$*
++IFS=$ac_save_IFS
++case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+ 
+-echo "$ac_t""$ac_cv_mingw32" 1>&6
+-MINGW32=
+-test "$ac_cv_mingw32" = yes && MINGW32=yes
+-
+-
+-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+-echo "configure:1306: checking for executable suffix" >&5
+-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+-  ac_cv_exeext=.exe
+-else
+-  rm -f conftest*
+-  echo 'int main () { return 0; }' > conftest.$ac_ext
+-  ac_cv_exeext=
+-  if { (eval echo configure:1316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+-    for file in conftest.*; do
+-      case $file in
+-      *.c | *.o | *.obj) ;;
+-      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+-      esac
+-    done
+-  else
+-    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+-  fi
+-  rm -f conftest*
+-  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+-fi
+-fi
+ 
+-EXEEXT=""
+-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+-echo "$ac_t""${ac_cv_exeext}" 1>&6
+-ac_exeext=$EXEEXT
+ 
+ 
+ 
+-    echo $ac_n "checking whether strict compiling is on""... $ac_c" 1>&6
+-echo "configure:1339: checking whether strict compiling is on" >&5
+-    # Check whether --enable-strict or --disable-strict was given.
++    { $as_echo "$as_me:$LINENO: checking whether strict compiling is on" >&5
++$as_echo_n "checking whether strict compiling is on... " >&6; }
++    # Check whether --enable-strict was given.
+ if test "${enable_strict+set}" = set; then
+-  enableval="$enable_strict"
+-  
++  enableval=$enable_strict;
+         if test "$enableval" = no
+         then
+             ac_use_strict_options=no
+         else
+             ac_use_strict_options=yes
+         fi
+-      
++
+ else
+   ac_use_strict_options=no
+ fi
+ 
+-    echo "$ac_t""$ac_use_strict_options" 1>&6
++    { $as_echo "$as_me:$LINENO: result: $ac_use_strict_options" >&5
++$as_echo "$ac_use_strict_options" >&6; }
+ 
+     if test "$ac_use_strict_options" = yes
+     then
+@@ -1391,17 +3651,17 @@
+ 
+ 
+ 
+-    # Check whether --enable-64bit-libs or --disable-64bit-libs was given.
++
++    # Check whether --enable-64bit-libs was given.
+ if test "${enable_64bit_libs+set}" = set; then
+-  enableval="$enable_64bit_libs"
+-  ENABLE_64BIT_LIBS=${enableval}
++  enableval=$enable_64bit_libs; ENABLE_64BIT_LIBS=${enableval}
+ else
+   ENABLE_64BIT_LIBS=yes
+-    
++
+ fi
+ 
+-        echo $ac_n "checking for 64-bit executable support""... $ac_c" 1>&6
+-echo "configure:1405: checking for 64-bit executable support" >&5
++        { $as_echo "$as_me:$LINENO: checking for 64-bit executable support" >&5
++$as_echo_n "checking for 64-bit executable support... " >&6; }
+     if test "$ENABLE_64BIT_LIBS" = no; then
+         case "${host}" in
+         *-*-hpux*)
+@@ -1465,7 +3725,7 @@
+             fi
+             ;;
+         *-*-aix*)
+-            if test "$ac_cv_prog_gcc" = no; then
++            if test "$ac_cv_c_compiler_gnu" = no; then
+                 # Note: Have not tested 64-bitness with gcc.
+                 # Maybe the flag "-maix64" could be used with gcc?
+                 OLD_CFLAGS="${CFLAGS}"
+@@ -1477,23 +3737,50 @@
+                 if test "$cross_compiling" = yes; then
+   ENABLE_64BIT_LIBS=no
+ else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1482 "configure"
+-#include "confdefs.h"
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ int main(void) {return 0;}
+-EOF
+-if { (eval echo configure:1486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+-then
++_ACEOF
++rm -f conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
++  { (case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_try") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
+   ENABLE_64BIT_LIBS=yes
+ else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -fr conftest*
+-  ENABLE_64BIT_LIBS=no
++  $as_echo "$as_me: program exited with status $ac_status" >&5
++$as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++( exit $ac_status )
++ENABLE_64BIT_LIBS=no
+ fi
+-rm -fr conftest*
++rm -rf conftest.dSYM
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
++
+                 if test "$ENABLE_64BIT_LIBS" = no; then
+                     CFLAGS="${OLD_CFLAGS}"
+                     CXXFLAGS="${OLD_CXXFLAGS}"
+@@ -1504,7 +3791,7 @@
+             fi
+             ;;
+         *-*-hpux*)
+-                        
++
+             OLD_CFLAGS="${CFLAGS}"
+             OLD_CXXFLAGS="${CXXFLAGS}"
+             CFLAGS="${CFLAGS} +DD64"
+@@ -1512,23 +3799,50 @@
+             if test "$cross_compiling" = yes; then
+   ENABLE_64BIT_LIBS=no
+ else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1517 "configure"
+-#include "confdefs.h"
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ int main(void) {return 0;}
+-EOF
+-if { (eval echo configure:1521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+-then
++_ACEOF
++rm -f conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
++  { (case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_try") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
+   ENABLE_64BIT_LIBS=yes
+ else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -fr conftest*
+-  ENABLE_64BIT_LIBS=no
++  $as_echo "$as_me: program exited with status $ac_status" >&5
++$as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++( exit $ac_status )
++ENABLE_64BIT_LIBS=no
+ fi
+-rm -fr conftest*
++rm -rf conftest.dSYM
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
++
+             if test "$ENABLE_64BIT_LIBS" = no; then
+                 CFLAGS="${OLD_CFLAGS}"
+                 CXXFLAGS="${OLD_CXXFLAGS}"
+@@ -1537,23 +3851,50 @@
+                 if test "$cross_compiling" = yes; then
+   ENABLE_64BIT_LIBS=no
+ else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1542 "configure"
+-#include "confdefs.h"
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
+ int main(void) {return 0;}
+-EOF
+-if { (eval echo configure:1546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+-then
++_ACEOF
++rm -f conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
++  { (case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_try") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
+   ENABLE_64BIT_LIBS=yes
+ else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -fr conftest*
+-  ENABLE_64BIT_LIBS=no
++  $as_echo "$as_me: program exited with status $ac_status" >&5
++$as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++( exit $ac_status )
++ENABLE_64BIT_LIBS=no
+ fi
+-rm -fr conftest*
++rm -rf conftest.dSYM
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ fi
+ 
++
+                 if test "$ENABLE_64BIT_LIBS" = no; then
+                     CFLAGS="${OLD_CFLAGS}"
+                     CXXFLAGS="${OLD_CXXFLAGS}"
+@@ -1565,34 +3906,35 @@
+             ;;
+         esac
+     fi
+-        echo "$ac_t""$ENABLE_64BIT_LIBS" 1>&6
++        { $as_echo "$as_me:$LINENO: result: $ENABLE_64BIT_LIBS" >&5
++$as_echo "$ENABLE_64BIT_LIBS" >&6; }
+ 
+ 
+ 
+ 
+ 
+-	echo $ac_n "checking which Makefile fragment to use""... $ac_c" 1>&6
+-echo "configure:1576: checking which Makefile fragment to use" >&5
+-if eval "test \"`echo '$''{'icu_cv_host_frag'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++	{ $as_echo "$as_me:$LINENO: checking which Makefile fragment to use" >&5
++$as_echo_n "checking which Makefile fragment to use... " >&6; }
++if test "${icu_cv_host_frag+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  
++
+ case "${host}" in
+ *-*-solaris*)
+-	if test "$GCC" = yes; then	
+-		icu_cv_host_frag=mh-solaris-gcc 
++	if test "$GCC" = yes; then
++		icu_cv_host_frag=mh-solaris-gcc
+ 	else
+ 		icu_cv_host_frag=mh-solaris
+ 	fi ;;
+ alpha*-*-linux-gnu)
+ 	if test "$GCC" = yes; then
+ 		icu_cv_host_frag=mh-alpha-linux-gcc
+-	else  
++	else
+ 		icu_cv_host_frag=mh-alpha-linux-cc
+ 	fi ;;
+ *-*-linux*) icu_cv_host_frag=mh-linux ;;
+ *-*-cygwin)
+-	if test "$ac_cv_prog_gcc" = yes; then
++	if test "$ac_cv_c_compiler_gnu" = yes; then
+ 	  	icu_cv_host_frag=mh-cygwin
+ 	else
+ 	  	icu_cv_host_frag=mh-cygwin-msvc
+@@ -1629,113 +3971,169 @@
+ *-sequent-*) 	icu_cv_host_frag=mh-ptx ;;
+ *) 		icu_cv_host_frag=mh-unknown ;;
+ esac
+-		
+-	
+-fi
+ 
+-echo "$ac_t""$icu_cv_host_frag" 1>&6
++
++fi
++{ $as_echo "$as_me:$LINENO: result: $icu_cv_host_frag" >&5
++$as_echo "$icu_cv_host_frag" >&6; }
+ 
+ 
+ case "${host}" in
+-	*-*-hpux*) 	echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
+-echo "configure:1642: checking for floor in -lm" >&5
+-ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
+-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++	*-*-hpux*) 	{ $as_echo "$as_me:$LINENO: checking for floor in -lm" >&5
++$as_echo_n "checking for floor in -lm... " >&6; }
++if test "${ac_cv_lib_m_floor+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  ac_save_LIBS="$LIBS"
++  ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lm  $LIBS"
+-cat > conftest.$ac_ext <<EOF
+-#line 1650 "configure"
+-#include "confdefs.h"
+-/* Override any gcc2 internal prototype to avoid an error.  */
+-/* We use char because int might match the return type of a gcc2
+-    builtin and then its argument prototype would still apply.  */
+-char floor();
+-
+-int main() {
+-floor()
+-; return 0; }
+-EOF
+-if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+-  rm -rf conftest*
+-  eval "ac_cv_lib_$ac_lib_var=yes"
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  eval "ac_cv_lib_$ac_lib_var=no"
+-fi
+-rm -f conftest*
+-LIBS="$ac_save_LIBS"
+-
+-fi
+-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+-  echo "$ac_t""yes" 1>&6
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char floor ();
++int
++main ()
++{
++return floor ();
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest$ac_exeext && {
++	 test "$cross_compiling" = yes ||
++	 $as_test_x conftest$ac_exeext
++       }; then
++  ac_cv_lib_m_floor=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_cv_lib_m_floor=no
++fi
++
++rm -rf conftest.dSYM
++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
++      conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5
++$as_echo "$ac_cv_lib_m_floor" >&6; }
++if test "x$ac_cv_lib_m_floor" = x""yes; then
+   LIB_M="-lm"
+-else
+-  echo "$ac_t""no" 1>&6
+ fi
+  ;;
+-	
+-	*) 		echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
+-echo "configure:1683: checking for floor in -lm" >&5
+-ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
+-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++
++	*)
++{ $as_echo "$as_me:$LINENO: checking for floor in -lm" >&5
++$as_echo_n "checking for floor in -lm... " >&6; }
++if test "${ac_cv_lib_m_floor+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  ac_save_LIBS="$LIBS"
++  ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lm  $LIBS"
+-cat > conftest.$ac_ext <<EOF
+-#line 1691 "configure"
+-#include "confdefs.h"
+-/* Override any gcc2 internal prototype to avoid an error.  */
+-/* We use char because int might match the return type of a gcc2
+-    builtin and then its argument prototype would still apply.  */
+-char floor();
+-
+-int main() {
+-floor()
+-; return 0; }
+-EOF
+-if { (eval echo configure:1702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+-  rm -rf conftest*
+-  eval "ac_cv_lib_$ac_lib_var=yes"
+-else
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  eval "ac_cv_lib_$ac_lib_var=no"
+-fi
+-rm -f conftest*
+-LIBS="$ac_save_LIBS"
+-
+-fi
+-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+-  echo "$ac_t""yes" 1>&6
+-    ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+-  cat >> confdefs.h <<EOF
+-#define $ac_tr_lib 1
+-EOF
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char floor ();
++int
++main ()
++{
++return floor ();
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++  (eval "$ac_link") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest$ac_exeext && {
++	 test "$cross_compiling" = yes ||
++	 $as_test_x conftest$ac_exeext
++       }; then
++  ac_cv_lib_m_floor=yes
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	ac_cv_lib_m_floor=no
++fi
++
++rm -rf conftest.dSYM
++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
++      conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5
++$as_echo "$ac_cv_lib_m_floor" >&6; }
++if test "x$ac_cv_lib_m_floor" = x""yes; then
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_LIBM 1
++_ACEOF
+ 
+   LIBS="-lm $LIBS"
+ 
+-else
+-  echo "$ac_t""no" 1>&6
+ fi
+- 
++
+ 			LIB_M="" ;;
+ esac
+ 
+ 
+-echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
+-echo "configure:1734: checking whether to build shared libraries" >&5
++{ $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
++$as_echo_n "checking whether to build shared libraries... " >&6; }
+ enabled=no
+-# Check whether --enable-shared or --disable-shared was given.
++# Check whether --enable-shared was given.
+ if test "${enable_shared+set}" = set; then
+-  enableval="$enable_shared"
+-   case "${enableval}" in
++  enableval=$enable_shared;  case "${enableval}" in
+ 	     yes|"") enabled=yes; ENABLE_SHARED=YES ;;
+ 	     no);;
+ 	     *) ;;
+@@ -1745,162 +4143,230 @@
+ 
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
+-echo "configure:1753: checking whether to build static libraries" >&5
++{ $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
++$as_echo_n "checking whether to build static libraries... " >&6; }
+ enabled=no
+-# Check whether --enable-static or --disable-static was given.
++# Check whether --enable-static was given.
+ if test "${enable_static+set}" = set; then
+-  enableval="$enable_static"
+-   case "${enableval}" in
++  enableval=$enable_static;  case "${enableval}" in
+ 	     yes|"") enabled=yes; ENABLE_STATIC=YES ;;
+ 	     no) ;;
+ 	     *) ;;
+     esac
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-echo $ac_n "checking whether to build debug libraries""... $ac_c" 1>&6
+-echo "configure:1769: checking whether to build debug libraries" >&5
++{ $as_echo "$as_me:$LINENO: checking whether to build debug libraries" >&5
++$as_echo_n "checking whether to build debug libraries... " >&6; }
+ enabled=no
+ ENABLE_DEBUG=0
+-# Check whether --enable-debug or --disable-debug was given.
++# Check whether --enable-debug was given.
+ if test "${enable_debug+set}" = set; then
+-  enableval="$enable_debug"
+-   case "${enableval}" in
++  enableval=$enable_debug;  case "${enableval}" in
+          yes|"") enabled=yes; ENABLE_DEBUG=1 ;;
+          *) ;;
+     esac
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-echo $ac_n "checking whether to build release libraries""... $ac_c" 1>&6
+-echo "configure:1785: checking whether to build release libraries" >&5
++{ $as_echo "$as_me:$LINENO: checking whether to build release libraries" >&5
++$as_echo_n "checking whether to build release libraries... " >&6; }
+ enabled=yes
+ ENABLE_RELEASE=1
+-# Check whether --enable-release or --disable-release was given.
++# Check whether --enable-release was given.
+ if test "${enable_release+set}" = set; then
+-  enableval="$enable_release"
+-   case "${enableval}" in
++  enableval=$enable_release;  case "${enableval}" in
+          no) enabled=no; ENABLE_RELEASE=0 ;;
+          *) ;;
+     esac
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-# Extract the first word of "ranlib", so it can be a program name with args.
+-set dummy ranlib; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1803: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
++set dummy ${ac_tool_prefix}ranlib; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_RANLIB+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$RANLIB"; then
+   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+ else
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH"
+-  for ac_dir in $ac_dummy; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_RANLIB="ranlib"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
+-  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+ fi
+ fi
+-RANLIB="$ac_cv_prog_RANLIB"
++RANLIB=$ac_cv_prog_RANLIB
+ if test -n "$RANLIB"; then
+-  echo "$ac_t""$RANLIB" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
++$as_echo "$RANLIB" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_RANLIB"; then
++  ac_ct_RANLIB=$RANLIB
++  # Extract the first word of "ranlib", so it can be a program name with args.
++set dummy ranlib; ac_word=$2
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_RANLIB"; then
++  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_ac_ct_RANLIB="ranlib"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
++if test -n "$ac_ct_RANLIB"; then
++  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
++$as_echo "$ac_ct_RANLIB" >&6; }
++else
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_ct_RANLIB" = x; then
++    RANLIB=":"
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    RANLIB=$ac_ct_RANLIB
++  fi
+ else
+-  echo "$ac_t""no" 1>&6
++  RANLIB="$ac_cv_prog_RANLIB"
+ fi
+ 
+ # Extract the first word of "ar", so it can be a program name with args.
+ set dummy ar; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1833: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_AR+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+-  case "$AR" in
+-  /*)
++  case $AR in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_AR="$AR" # Let the user override the test with a path.
+   ;;
+-  ?:/*)			 
+-  ac_cv_path_AR="$AR" # Let the user override the test with a dos path.
+-  ;;
+   *)
+-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="$PATH:/bin:/usr/bin:/usr/ccs/bin"
+-  for ac_dir in $ac_dummy; do 
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_AR="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++as_dummy="$PATH:/bin:/usr/bin:/usr/ccs/bin"
++for as_dir in $as_dummy
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++IFS=$as_save_IFS
++
+   test -z "$ac_cv_path_AR" && ac_cv_path_AR="echo archiver ar not found re-run configure ; false"
+   ;;
+ esac
+ fi
+-AR="$ac_cv_path_AR"
++AR=$ac_cv_path_AR
+ if test -n "$AR"; then
+-  echo "$ac_t""$AR" 1>&6
++  { $as_echo "$as_me:$LINENO: result: $AR" >&5
++$as_echo "$AR" >&6; }
+ else
+-  echo "$ac_t""no" 1>&6
++  { $as_echo "$as_me:$LINENO: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+ 
+ 
+-echo $ac_n "checking whether to enable renaming of symbols""... $ac_c" 1>&6
+-echo "configure:1868: checking whether to enable renaming of symbols" >&5
++
++{ $as_echo "$as_me:$LINENO: checking whether to enable renaming of symbols" >&5
++$as_echo_n "checking whether to enable renaming of symbols... " >&6; }
+ enabled=yes
+ U_DISABLE_RENAMING=0
+-# Check whether --enable-renaming or --disable-renaming was given.
++# Check whether --enable-renaming was given.
+ if test "${enable_renaming+set}" = set; then
+-  enableval="$enable_renaming"
+-   case "${enableval}" in
++  enableval=$enable_renaming;  case "${enableval}" in
+ 	     yes|"") enabled=yes ;;
+ 	     no) enabled=no; U_DISABLE_RENAMING=1 ;;
+ 	     *) ;;
+     esac
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-echo $ac_n "checking whether to enable function and data tracing""... $ac_c" 1>&6
+-echo "configure:1885: checking whether to enable function and data tracing" >&5
++{ $as_echo "$as_me:$LINENO: checking whether to enable function and data tracing" >&5
++$as_echo_n "checking whether to enable function and data tracing... " >&6; }
+ enabled=yes
+ U_ENABLE_TRACING=1
+-# Check whether --enable-tracing or --disable-tracing was given.
++# Check whether --enable-tracing was given.
+ if test "${enable_tracing+set}" = set; then
+-  enableval="$enable_tracing"
+-   case "${enableval}" in
++  enableval=$enable_tracing;  case "${enableval}" in
+ 	     yes|"") enabled=yes ;;
+ 	     no) enabled=no; U_ENABLE_TRACING=0 ;;
+ 	     *) ;;
+     esac
+ fi
+ 
+-echo "$ac_t""$enabled" 1>&6
++{ $as_echo "$as_me:$LINENO: result: $enabled" >&5
++$as_echo "$enabled" >&6; }
+ 
+ 
+-# Check whether --enable-rpath or --disable-rpath was given.
++# Check whether --enable-rpath was given.
+ if test "${enable_rpath+set}" = set; then
+-  enableval="$enable_rpath"
+-   case "${enableval}" in
++  enableval=$enable_rpath;  case "${enableval}" in
+ 	     yes|"") ENABLE_RPATH=YES ;;
+ 	     no) ;;
+ 	     *) ;;
+@@ -1913,34 +4379,60 @@
+ 
+ 
+ 
+-echo $ac_n "checking for definition of U_INLINE for C""... $ac_c" 1>&6
+-echo "configure:1918: checking for definition of U_INLINE for C" >&5
+-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++{ $as_echo "$as_me:$LINENO: checking for definition of U_INLINE for C" >&5
++$as_echo_n "checking for definition of U_INLINE for C... " >&6; }
++if test "${ac_cv_c_inline+set}" = set; then
++  $as_echo_n "(cached) " >&6
+ else
+   ac_cv_c_inline=no
+ for ac_kw in inline __inline__ __inline; do