From 584cd5cbd7be997400ccb8db24ae5410b0b88117 Mon Sep 17 00:00:00 2001 From: "initial.commit" Date: Sun, 27 Jul 2008 00:38:33 +0000 Subject: Add third_party to the repository. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/libxslt/AUTHORS | 20 + third_party/libxslt/COPYING | 53 + third_party/libxslt/ChangeLog | 7573 +++++++ third_party/libxslt/Copyright | 53 + third_party/libxslt/FEATURES | 244 + third_party/libxslt/INSTALL | 49 + third_party/libxslt/NEWS | 790 + third_party/libxslt/README | 24 + third_party/libxslt/README.google | 16 + third_party/libxslt/SConscript | 116 + third_party/libxslt/TODO | 124 + third_party/libxslt/acconfig.h | 6 + third_party/libxslt/aclocal.m4 | 7442 +++++++ third_party/libxslt/build/libxslt.vcproj | 219 + third_party/libxslt/build/libxslt_config.bat | 13 + third_party/libxslt/build/libxslt_config.rules | 17 + third_party/libxslt/build/libxslt_config.vcproj | 74 + third_party/libxslt/build/using_libxslt.vsprops | 12 + third_party/libxslt/compile | 142 + third_party/libxslt/config.guess | 1516 ++ third_party/libxslt/config.h.in | 160 + third_party/libxslt/config.sub | 1626 ++ third_party/libxslt/configure | 24257 +++++++++++++++++++++ third_party/libxslt/configure.in | 605 + third_party/libxslt/depcomp | 584 + third_party/libxslt/install-sh | 507 + third_party/libxslt/libexslt.pc.in | 12 + third_party/libxslt/libexslt/common.c | 137 + third_party/libxslt/libexslt/crypto.c | 756 + third_party/libxslt/libexslt/date.c | 3794 ++++ third_party/libxslt/libexslt/dynamic.c | 287 + third_party/libxslt/libexslt/exslt.c | 39 + third_party/libxslt/libexslt/exslt.h | 92 + third_party/libxslt/libexslt/exsltconfig.h | 73 + third_party/libxslt/libexslt/exsltconfig.h.in | 73 + third_party/libxslt/libexslt/exsltexports.h | 140 + third_party/libxslt/libexslt/functions.c | 762 + third_party/libxslt/libexslt/libexslt.h | 29 + third_party/libxslt/libexslt/math.c | 1108 + third_party/libxslt/libexslt/saxon.c | 267 + third_party/libxslt/libexslt/sets.c | 292 + third_party/libxslt/libexslt/strings.c | 676 + third_party/libxslt/libxslt.m4 | 191 + third_party/libxslt/libxslt.pc.in | 12 + third_party/libxslt/libxslt.spec | 125 + third_party/libxslt/libxslt.spec.in | 125 + third_party/libxslt/libxslt/attributes.c | 1132 + third_party/libxslt/libxslt/attributes.h | 38 + third_party/libxslt/libxslt/attrvt.c | 377 + third_party/libxslt/libxslt/documents.c | 434 + third_party/libxslt/libxslt/documents.h | 93 + third_party/libxslt/libxslt/extensions.c | 2194 ++ third_party/libxslt/libxslt/extensions.h | 256 + third_party/libxslt/libxslt/extra.c | 330 + third_party/libxslt/libxslt/extra.h | 80 + third_party/libxslt/libxslt/functions.c | 973 + third_party/libxslt/libxslt/functions.h | 78 + third_party/libxslt/libxslt/imports.c | 414 + third_party/libxslt/libxslt/imports.h | 75 + third_party/libxslt/libxslt/keys.c | 916 + third_party/libxslt/libxslt/keys.h | 53 + third_party/libxslt/libxslt/libxslt.h | 30 + third_party/libxslt/libxslt/namespaces.c | 847 + third_party/libxslt/libxslt/namespaces.h | 68 + third_party/libxslt/libxslt/numbers.c | 1351 ++ third_party/libxslt/libxslt/numbersInternals.h | 69 + third_party/libxslt/libxslt/pattern.c | 2619 +++ third_party/libxslt/libxslt/pattern.h | 81 + third_party/libxslt/libxslt/preproc.c | 2340 ++ third_party/libxslt/libxslt/preproc.h | 43 + third_party/libxslt/libxslt/security.c | 475 + third_party/libxslt/libxslt/security.h | 104 + third_party/libxslt/libxslt/templates.c | 822 + third_party/libxslt/libxslt/templates.h | 77 + third_party/libxslt/libxslt/transform.c | 6457 ++++++ third_party/libxslt/libxslt/transform.h | 203 + third_party/libxslt/libxslt/trio.h | 216 + third_party/libxslt/libxslt/triodef.h | 220 + third_party/libxslt/libxslt/variables.c | 2308 ++ third_party/libxslt/libxslt/variables.h | 91 + third_party/libxslt/libxslt/win32config.h | 99 + third_party/libxslt/libxslt/xslt.c | 6923 ++++++ third_party/libxslt/libxslt/xslt.h | 103 + third_party/libxslt/libxslt/xsltInternals.h | 1970 ++ third_party/libxslt/libxslt/xsltconfig.h | 159 + third_party/libxslt/libxslt/xsltconfig.h.in | 159 + third_party/libxslt/libxslt/xsltexports.h | 142 + third_party/libxslt/libxslt/xsltutils.c | 2265 ++ third_party/libxslt/libxslt/xsltutils.h | 309 + third_party/libxslt/libxslt/xsltwin32config.h | 105 + third_party/libxslt/libxslt/xsltwin32config.h.in | 105 + third_party/libxslt/ltmain.sh | 6930 ++++++ third_party/libxslt/missing | 367 + third_party/libxslt/win32/Makefile | 367 + third_party/libxslt/win32/Makefile.mingw | 304 + third_party/libxslt/win32/Makefile.msvc | 367 + third_party/libxslt/win32/Readme.txt | 133 + third_party/libxslt/win32/config.msvc | 28 + third_party/libxslt/win32/configure.js | 504 + third_party/libxslt/win32/defgen.xsl | 44 + third_party/libxslt/win32/libexslt.def.src | 16 + third_party/libxslt/win32/libxslt.def.src | 252 + third_party/libxslt/xslt-config.in | 137 + third_party/libxslt/xsltConf.sh.in | 7 + 104 files changed, 102891 insertions(+) create mode 100644 third_party/libxslt/AUTHORS create mode 100644 third_party/libxslt/COPYING create mode 100644 third_party/libxslt/ChangeLog create mode 100644 third_party/libxslt/Copyright create mode 100644 third_party/libxslt/FEATURES create mode 100644 third_party/libxslt/INSTALL create mode 100644 third_party/libxslt/NEWS create mode 100644 third_party/libxslt/README create mode 100644 third_party/libxslt/README.google create mode 100644 third_party/libxslt/SConscript create mode 100644 third_party/libxslt/TODO create mode 100644 third_party/libxslt/acconfig.h create mode 100644 third_party/libxslt/aclocal.m4 create mode 100644 third_party/libxslt/build/libxslt.vcproj create mode 100644 third_party/libxslt/build/libxslt_config.bat create mode 100644 third_party/libxslt/build/libxslt_config.rules create mode 100644 third_party/libxslt/build/libxslt_config.vcproj create mode 100644 third_party/libxslt/build/using_libxslt.vsprops create mode 100644 third_party/libxslt/compile create mode 100644 third_party/libxslt/config.guess create mode 100644 third_party/libxslt/config.h.in create mode 100644 third_party/libxslt/config.sub create mode 100644 third_party/libxslt/configure create mode 100644 third_party/libxslt/configure.in create mode 100644 third_party/libxslt/depcomp create mode 100644 third_party/libxslt/install-sh create mode 100644 third_party/libxslt/libexslt.pc.in create mode 100644 third_party/libxslt/libexslt/common.c create mode 100644 third_party/libxslt/libexslt/crypto.c create mode 100644 third_party/libxslt/libexslt/date.c create mode 100644 third_party/libxslt/libexslt/dynamic.c create mode 100644 third_party/libxslt/libexslt/exslt.c create mode 100644 third_party/libxslt/libexslt/exslt.h create mode 100644 third_party/libxslt/libexslt/exsltconfig.h create mode 100644 third_party/libxslt/libexslt/exsltconfig.h.in create mode 100644 third_party/libxslt/libexslt/exsltexports.h create mode 100644 third_party/libxslt/libexslt/functions.c create mode 100644 third_party/libxslt/libexslt/libexslt.h create mode 100644 third_party/libxslt/libexslt/math.c create mode 100644 third_party/libxslt/libexslt/saxon.c create mode 100644 third_party/libxslt/libexslt/sets.c create mode 100644 third_party/libxslt/libexslt/strings.c create mode 100644 third_party/libxslt/libxslt.m4 create mode 100644 third_party/libxslt/libxslt.pc.in create mode 100644 third_party/libxslt/libxslt.spec create mode 100644 third_party/libxslt/libxslt.spec.in create mode 100644 third_party/libxslt/libxslt/attributes.c create mode 100644 third_party/libxslt/libxslt/attributes.h create mode 100644 third_party/libxslt/libxslt/attrvt.c create mode 100644 third_party/libxslt/libxslt/documents.c create mode 100644 third_party/libxslt/libxslt/documents.h create mode 100644 third_party/libxslt/libxslt/extensions.c create mode 100644 third_party/libxslt/libxslt/extensions.h create mode 100644 third_party/libxslt/libxslt/extra.c create mode 100644 third_party/libxslt/libxslt/extra.h create mode 100644 third_party/libxslt/libxslt/functions.c create mode 100644 third_party/libxslt/libxslt/functions.h create mode 100644 third_party/libxslt/libxslt/imports.c create mode 100644 third_party/libxslt/libxslt/imports.h create mode 100644 third_party/libxslt/libxslt/keys.c create mode 100644 third_party/libxslt/libxslt/keys.h create mode 100644 third_party/libxslt/libxslt/libxslt.h create mode 100644 third_party/libxslt/libxslt/namespaces.c create mode 100644 third_party/libxslt/libxslt/namespaces.h create mode 100644 third_party/libxslt/libxslt/numbers.c create mode 100644 third_party/libxslt/libxslt/numbersInternals.h create mode 100644 third_party/libxslt/libxslt/pattern.c create mode 100644 third_party/libxslt/libxslt/pattern.h create mode 100644 third_party/libxslt/libxslt/preproc.c create mode 100644 third_party/libxslt/libxslt/preproc.h create mode 100644 third_party/libxslt/libxslt/security.c create mode 100644 third_party/libxslt/libxslt/security.h create mode 100644 third_party/libxslt/libxslt/templates.c create mode 100644 third_party/libxslt/libxslt/templates.h create mode 100644 third_party/libxslt/libxslt/transform.c create mode 100644 third_party/libxslt/libxslt/transform.h create mode 100644 third_party/libxslt/libxslt/trio.h create mode 100644 third_party/libxslt/libxslt/triodef.h create mode 100644 third_party/libxslt/libxslt/variables.c create mode 100644 third_party/libxslt/libxslt/variables.h create mode 100644 third_party/libxslt/libxslt/win32config.h create mode 100644 third_party/libxslt/libxslt/xslt.c create mode 100644 third_party/libxslt/libxslt/xslt.h create mode 100644 third_party/libxslt/libxslt/xsltInternals.h create mode 100644 third_party/libxslt/libxslt/xsltconfig.h create mode 100644 third_party/libxslt/libxslt/xsltconfig.h.in create mode 100644 third_party/libxslt/libxslt/xsltexports.h create mode 100644 third_party/libxslt/libxslt/xsltutils.c create mode 100644 third_party/libxslt/libxslt/xsltutils.h create mode 100644 third_party/libxslt/libxslt/xsltwin32config.h create mode 100644 third_party/libxslt/libxslt/xsltwin32config.h.in create mode 100755 third_party/libxslt/ltmain.sh create mode 100644 third_party/libxslt/missing create mode 100644 third_party/libxslt/win32/Makefile create mode 100644 third_party/libxslt/win32/Makefile.mingw create mode 100644 third_party/libxslt/win32/Makefile.msvc create mode 100644 third_party/libxslt/win32/Readme.txt create mode 100644 third_party/libxslt/win32/config.msvc create mode 100644 third_party/libxslt/win32/configure.js create mode 100644 third_party/libxslt/win32/defgen.xsl create mode 100644 third_party/libxslt/win32/libexslt.def.src create mode 100644 third_party/libxslt/win32/libxslt.def.src create mode 100644 third_party/libxslt/xslt-config.in create mode 100644 third_party/libxslt/xsltConf.sh.in (limited to 'third_party/libxslt') diff --git a/third_party/libxslt/AUTHORS b/third_party/libxslt/AUTHORS new file mode 100644 index 0000000..094ebbc --- /dev/null +++ b/third_party/libxslt/AUTHORS @@ -0,0 +1,20 @@ +Daniel Veillard: + daniel@veillard.com + DV on #gnome IRC channel + http://veillard.com/ + Used to work at W3C, now Red Hat + co-chair of W3C XML Linking WG + invited expert on the W3C XML Core WG + Author of libxml upon which this library is based. + +Bjorn Reese: + breese@users.sourceforge.net + http://home1.stofanet.dk/breese/ + Software developer at http://www.systematic.dk/ + Member of the XML-MTF Mapping WG. + +William Brack + +Thomas Broyer + +Igor Zlatkovic for the Windows port diff --git a/third_party/libxslt/COPYING b/third_party/libxslt/COPYING new file mode 100644 index 0000000..627eeff --- /dev/null +++ b/third_party/libxslt/COPYING @@ -0,0 +1,53 @@ +Licence for libxslt except libexslt +---------------------------------------------------------------------- + Copyright (C) 2001-2002 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Daniel Veillard shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + +---------------------------------------------------------------------- + +Licence for libexslt +---------------------------------------------------------------------- + Copyright (C) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard. + All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the authors shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. +---------------------------------------------------------------------- diff --git a/third_party/libxslt/ChangeLog b/third_party/libxslt/ChangeLog new file mode 100644 index 0000000..175e5b4 --- /dev/null +++ b/third_party/libxslt/ChangeLog @@ -0,0 +1,7573 @@ +Tue May 13 17:51:05 CEST 2008 Daniel Veillard + + * configure.in doc/*: release of 1.1.24 + * python/generator.py: syntactic cleanup (Martin) + +Tue May 13 16:32:22 CEST 2008 Daniel Veillard + + * libxslt/xslt.c libxslt/extensions.c libxslt/extensions.h: + fix the processing of top level elements of stylesheets which + are not in the XSLT namespace and are not an extension either + should fix #529223 + * tests/docs/Makefile.am tests/docs/bug-167.xml + tests/general/Makefile.am tests/general/bug-167.*: add the + test to the regression suite + +Fri May 9 14:30:35 CEST 2008 Daniel Veillard + + * libxslt/documents.c libxslt/keys.c libxslt/xsltInternals.h + libxslt/transform.c libxslt/pattern.c: fix the key initialization + problem introduced when tracking Josef Urban problem from 22 Dec + 2007, this should also handle the problem of recursive keys + definitions should fix #531873. + * tests/docs/bug-166.xml tests/docs/Makefile.am + tests/general/Makefile.am tests/general/bug-166.xsl + tests/general/bug-166.out: add the regression tests when a key + computation depends on another one. + +Mon Apr 21 16:16:29 CEST 2008 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: update the man page based on + Vincent Lefevre suggestion. + +Mon Apr 14 11:19:14 CEST 2008 Daniel Veillard + + * libxslt/pattern.c: fixes #527297 general patter comps fix and cleanup + * libxslt/xsltInternals.h libxslt/pattern.h: other cleanups + +Tue Apr 8 19:15:19 CEST 2008 Daniel Veillard + + * configure.in doc/*: release of 1.1.23 + +Tue Apr 8 18:52:36 CEST 2008 Daniel Veillard + + * libexslt/date.c: new version of patch from Peter Pawlowski + +Tue Apr 8 10:19:01 CEST 2008 Daniel Veillard + + * python/generator.py: fix an infinite loop bug + +Thu Apr 3 09:32:49 CEST 2008 Daniel Veillard + + * libxslt/xsltutils.c: avoid a scary realloc() loop should fix #520383 + +Thu Apr 3 07:32:36 CEST 2008 Daniel Veillard + + * libexslt/date.c: applied patch from Peter Pawlowski fixing + a timezone offset problem, fixes #521680 + * libxslt/namespaces.c: a bit of space/tabs cleanup + +Thu Apr 3 06:25:02 CEST 2008 Daniel Veillard + + * doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to + man page synopsis, should fix #525822 + +Sat Mar 15 11:13:18 HKT 2008 William Brack + + * libexslt/functions.c: fixed minor error reported on the mailing + list by Mark Howe, which caused a segfault if func:result was + postitioned as top-level element. + +Thu Mar 13 09:33:21 CET 2008 Daniel Veillard + + * libxslt/win32config.h: patch from Rob Richards for VS 2008 + * python/types.c: fix a problem with namespace nodes coming from + XPath nodesets. + +Mon Mar 3 09:39:31 CET 2008 Daniel Veillard + + * doc/xsltproc.xml doc/xsltproc.1: fix maxdepth default value + documentation fixes #519921. + +Sat Feb 16 01:24:58 HKT 2008 William Brack + + *libxslt/extensions.c: fixed minor error bug #516483 + *tests/exslt/common - deleted node-set.9 regression test, + because it relied upon an external web import. + +Tue Feb 5 08:53:30 CET 2008 Daniel Veillard + + * libxslt/xslt.c: applied documentation patch from Jason Viers + for xsltParseStylesheetDoc + +Tue Feb 5 08:36:53 CET 2008 Daniel Veillard + + * python/tests/pyxsltproc.py: applied a portability patch from + Stephane Bidoul + +Thu Jan 24 16:24:05 CET 2008 Daniel Veillard + + * doc/xslt.html doc/docbook.html: fix links for Cygwin DocBook + setup as suggested by Philippe Bourcier + +Sun Dec 23 16:40:38 PST 2007 William Brack + + * libxslt/keys.c, libxslt/pattern.c, libxslt/xsltInternals.h: + fixed a problem on superfluous re-generation of keys reported + on the mailing list by Josef Urban. + +Thu Nov 29 11:43:14 CET 2007 Daniel Veillard + + * configure.in: avoid a problem in configure if an old gcrypt + version is installed, patch from Brent Cowgill, fixes #500390 + +Tue Nov 13 13:08:08 PDT 2007 William Brack + + * libexslt/common.c, libexslt/dynamic.c: After discussion on + Bugzilla with Peter Pawlowski, added same code for preventing + deletion of function result during garbage collection (see + bug #495995). + +Mon Nov 12 13:53:58 PDT 2007 William Brack + + * libexslt/strings.c: Added code to mark the results of + str:tokenize and str:split as "function result" to avoid + garbage-collecting them during global variable initialisation. + Should fix bug #495995. + +Wed Oct 24 17:41:08 PDT 2007 William Brack + + * python/libxslt.c: changed iterator argument for Py_Dict_Next + from int to ssize_t (seems Python docs are incorrect) to fix + x86_64 bug #489854. + +Wed Oct 10 16:33:09 CEST 2007 Daniel Veillard + + * libexslt/date.c tests/exslt/date/datetime.1.out + tests/exslt/date/date.1.out tests/exslt/date/date.1.xml: + applied patch from Maurice van der Pot to fix EXSLT + week-in-year extenson which was not conforming to the definition. + This also changes the output of the tests a bit. Should fix #452876 + +Thu Aug 30 08:18:08 HKT 2007 William Brack + + * python/libxslt.c: applied patch from Daniel Gryniewicz to + fix a segfault caused by a parameter array not being preset + to zero. + +Thu Aug 23 17:18:03 CEST 2007 Daniel Veillard + + * configure.in doc/*: preparing release of 1.1.22 + +Thu Aug 23 15:39:18 CEST 2007 Daniel Veillard + + * libxslt/xslt.c: applied patch from Rob Richards to fix a + stylesheet compilation error handling problem #382570 + +Thu Aug 23 15:22:55 CEST 2007 Daniel Veillard + + * libxslt/security.c: applied patch from Roland Schwarz and Rob + Richards to fix the security file checks on Windows, should + close #464432 + +Thu Aug 23 21:15:28 HKT 2007 William Brack + + * tests/general/bug-165.[xsl,out,err], tests/docs/bug-165.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: + added regression test for bug #469410 + +Thu Aug 23 14:13:02 CEST 2007 Daniel Veillard + + * xsltproc/xsltproc.c: patch from Drazen Kacar to add a --encoding + option fixes #443868 + * doc/xsltproc.xml doc/xsltproc.1: augment and regenerate man page. + +Thu Aug 23 11:47:20 CEST 2007 Daniel Veillard + + * libexslt/date.c: apply patch from Björn Wiberg fixing build on AIX + and closing bug #332173 + +Fri Aug 3 15:49:26 CEST 2007 Daniel Veillard + + * win32/Makefile.msvc win32/configure.js: apply patch from + Rob Richards to improve build with VS2005 + +Thu Jul 26 12:43:38 PDT 2007 William Brack + + * libxslt/xslt.c: Removed the exclude-result-prefix change of + 31 May 2007. Fixes bug #459713. + +Sat Jun 16 07:42:18 PDT 2007 William Brack + + * libxslt/transform.c: Fixed problem with RVT cleanup related + to some exslt functions (reported on the list by Marc Adkins). + +Wed Jun 13 13:27:48 PDT 2007 William Brack + + * tests/exslt/common/node-set.9.[xml,xsl,out], + tests/exslt/common/Makefile.am: added test case for bug #413451 + +Tue Jun 12 18:43:05 CEST 2007 Daniel Veillard + + * NEWS configure.in doc/*: preparing release of 1.1.21 + +Thu May 31 12:38:08 PDT 2007 William Brack + + * libxslt/xslt.c: fixed obscure namespace problem related to + exclude-result-prefix + +Mon May 7 00:14:28 HKT 2007 William Brack + + * libxslt/transform.c: fixed minor compilation warning; no change + to logic. + +Sun May 6 23:42:38 HKT 2007 William Brack + + * libexslt/math.c: fixed two memory leaks, one in exsltMathConstant + and one in exsltMathConstantFunction (bug #436324) + +Fri May 4 15:51:58 HKT 2007 William Brack + + * libxslt/transform.c: fixed xpath context housekeeping problem + on processing "choose" (bug 435479). + +Thu Apr 26 11:10:18 HKT 2007 William Brack + + * libxslt/transform.c: fixed (another) problem with cached + RVT's (from re-opened #378766). + +Tue Mar 27 16:50:52 CEST 2007 Daniel Veillard + + * libxslt/xsltutils.c: apply patch fron Shaun McCance to hook + xsl:message construct to the new per-xsltTransformCtxt error + callback if set up. + * Makefile.am: do not package svn files in releases + +Fri Mar 2 18:45:48 HKT 2007 William Brack + + * libxslt/xsltconfig.h.in: added setting of TRIO_REPLACE_STDIO + when TRIO routines are required. + * libxslt/namespaces.c, libxslt/xsltutils.c: enhanced handling + of stdio.h vs. trio.h when trio routines are required (now + use XSLT_NEED_TRIO) (bug #412787) + +Sun Feb 18 09:00:08 PST 2007 William Brack + + * python/libxsl.py: fixed tab/space inconsistency with patch + provided by Andreas Hanke (bug #409193) + +Thu Feb 15 14:03:18 PST 2007 William Brack + + * doc/xslt.html: Changed all + references to CVS to be SVN; changed corresponding links. + * doc/*html: regenerated the documentation for above + +Wed Feb 14 01:21:38 PST 2007 William Brack + + * libxslt/pattern.c: Fixed problem with namespace on compound + predicate (bug #407731) + +Wed Jan 24 11:05:28 PST 2007 William Brack + + * libxslt/pattern.c: added check for memory allocation error + (bug #400242); fixed "type-punned pointer" warnings. + * libxslt/xsltutils.c: added checks for memory allocation error + (bug #400242) + * restored NEWS, doc/EXSLT/downloads.html which mysteriously + disappeared from svn + +Wed Jan 17 14:20:18 CET 2007 Daniel Veillard + + * configure.in doc/*: preparing release of 1.1.20 + * libexslt/crypto.c: small patch for missing includes on some BSD, + fixes #397373 + * configure.in: replace == by = in test, raised by Roland Illig, + should fix #397371 + +Sun Jan 14 18:45:08 PST 2007 William Brack + + * libxslt/functions.c: fixed two problems related to checking + of fragments, related to python htmlCtxtReadFile problem + reported on mailing list by Nic Ferrier. + +Fri Jan 12 23:24:08 PST 2007 William Brack + + * libxslt/extensions.c: reverted last change, fixed some + comments. Note that in it's current state the 'plugin' + implementation will fail if called from a program + compiled as static! + +Fri Jan 12 15:40:08 PST 2007 William Brack + + * configure.in: fixed problem with DV/WMB testing env. + * regenerated docs; doc/APIchunk1[012].html added to SVN + * libxslt/extensions.c: fixed problem with plugin loading; + removed testplugin.c from SVN (current version kept as + tests/plugin/testplugin.c) + +Thu Jan 11 11:08:18 PST 2007 William Brack + + * libxslt/transform.c: enhanced to ignore empty text node + in xsltDefaultProcessOneNode (avoid calling xsltCopyText) + (bug #354900) + * xsltproc/xsltproc.c: added check for output file problem, + yielding new error code 11 (Mike Hommey). + * doc/xsltproc.html, doc/xsltproc.xml: added documentation + for above, regenerated docs (doc/xsltproc.1) + +Wed Jan 10 19:13:08 PST 2007 William Brack + + * libexslt/strings.c: added new function 'replace' from Joel + Reed. + * tests/exslt/Makefile.am, replace.1.xml, replace.1.xsl, + replace.1.out: added new test case for above. + * libxslt.spec.in: trivial change from 'Gnome' to 'GNOME' + * configure.in: trivial change for flags on my compilations + * libxslt/documents.c, libxslt/documents.h, libxslt/keys.c, + libxslt/keys.h, libxslt/variables.c, libxslt/templates.c, + libxslt/transform.c, libxslt/variables.c, libxslt/xslt.c, + libxslt/xsltutils.c: fixed some documentation/comments and + compilation warnings - no change to logic. + * re-generated the documentation. + +Wed Jan 3 16:46:05 CET 2007 Daniel Veillard + + * configure.in: adapt the extra versioning code to SVN + +Fri Dec 22 09:12:08 PST 2006 William Brack + + * python/libxslt.c: applied patch supplied by Kjartan Maraas + (bug #388567). + +Mon Dec 11 14:38:22 PST 2006 William Brack + + * libexslt/functions.c: further enhancement to the original + fix for bug #381319 (which was not correct). + * tests/exslt/functions: minor enhancement to function.9.xsl; + function.10.[xsl,xml,out] added to regression tests to check + recursive calls. + +Mon Dec 11 12:13:14 CET 2006 Daniel Veillard + + * configure python/generator.py python/libxsl.py + python/libxslt-python-api.xml python/libxslt.c + python/tests/2stage.py python/tests/loader.py: applied patch from + Nic James Ferrier to make stylesheets comparable and to add + transformContext handling + +Sat Dec 9 15:22:34 PST 2006 William Brack + + * libexslt/functions.c: changed handling of function params + to fix bug #381319 + * libxslt/transform.[ch]: exposed xsltLocalVariablePush and + xsltLocalVariablePop as global entries so that they could + be used from within libexslt/functions.c + * tests/exslt/functions/function.9.[xsl,xml,out] added to + regression tests + +Tue Dec 5 10:45:04 CET 2006 Daniel Veillard + + * libxslt/extensions.c: applied patch from Marcus Meissner removing + a strict aliasing problem should fix #317921 + +Fri Dec 1 23:02:27 HKT 2006 William Brack + + * libxslt/transform.c: fixed problem with housekeeping of + localRVTBase, bug #378766 + +Wed Nov 29 16:06:43 CET 2006 Daniel Veillard + + * NEWS configure.in doc//*: preparing release of libxslt-1.1.19 + +Sat Nov 25 11:48:28 HKT 2006 William Brack + + * libxslt/variables.c: fixed problem with cached RVT's, + bug #378766 + +Thu Nov 23 17:49:31 CET 2006 Daniel Veillard + + * libxslt/transform.c: applied patch from Mike Hommey about saving + the current in-scope namespace list when calling a template, fixes + bug #377579 + +Thu Nov 23 15:36:28 CET 2006 Daniel Veillard + + * configure.in: fix a python detection problem pointed out by + Joseph Sacco, fixes bug #376391 + +Fri Nov 17 09:53:08 HKT 2006 William Brack + + * libxslt/transform.c: fixed problem with entity handling + within xsltCopyAttrListNoOverwrite (#352907) + * tests/general/bug-164.xsl, tests/general/bug-164.out, + tests/docs/bug-164.oxml: added a regression test for this + +Thu Oct 26 15:31:01 CEST 2006 Daniel Veillard + + * NEWS configure.in doc//*: preparing release of libxslt-1.1.18, + this bumps libxml2 requirement to 1.6.27 + * libexslt/date.c libxslt/namespaces.h libxslt/xslt.c + libxslt/xsltInternals.h: cosmetic cleanups to restore the + API extraction + +Thu Oct 26 10:36:43 CEST 2006 Daniel Veillard + + * doc//*: removed all remaining references to the old Wiki + +Thu Oct 12 23:12:24 HKT 2006 William Brack + + * libexslt/date.c: fixed end-of-month problem in exsltDateCurrent + (#359246) + +Thu Oct 12 14:39:37 CEST 2006 Daniel Veillard + + * libxslt/preproc.c: applied patch from Mike Hommey fixing 2 + erroneous xmlFree() and adding a message on an unsupported feature + +Wed Oct 11 23:16:10 CEST 2006 Daniel Veillard + + * python/libxslt-python-api.xml: applied fix for accessor functions + of a stylesheet returning pointers to immutable strings, patch + from #320540 + * xsltproc/xsltproc.c: fix the xinclude on stylehseet problem + by adding a new parameter to xsltproc names --xincludestyle + +Wed Oct 11 22:27:37 CEST 2006 Daniel Veillard + + * xsltproc/xsltproc.c: apply patch from Gary Coady to compile when + libxml2 has no xinclude support #319886 + * docs/*: renamed Gnome to GNOME fixes #352159 + +Wed Oct 11 21:37:27 CEST 2006 Daniel Veillard + + * libxslt/Makefile.am: a missing DESTDIR + * python/Makefile.am: fix reference to build paths in python module + * libexslt/exsltconfig.h.in libxslt/xsltconfig.h.in: fix the header + comments on version values, the 3 are patches from Peter + Breitenlohner and should fix #340995 + +Wed Oct 11 11:16:34 CEST 2006 Daniel Veillard + + * libxslt/security.c: applied cleanup patch from Mikhail Zabaluev + which should finish fixing #337486 + +Wed Oct 11 09:55:06 CEST 2006 Daniel Veillard + + * libxslt/security.c: applied fix from Shane Corgatelli to pass + the full URL when checking security access for network URLs, + should fix bug #359366 + +Mon Aug 21 10:46:25 CEST 2006 Daniel Veillard + + * doc/xslt.html python/tests/pyxsltproc.py xsltproc/xsltproc.c: + applied patch from Daniel Leidert to fix some typo + * xsltproc.xml xsltproc.1: applied another patch from Daniel Leidert + and regenerated + +Wed Aug 16 17:39:04 CEST 2006 Daniel Veillard + + * xsltproc/xsltproc.c: --xinclude should also force XInclude + processing on the stylesheets themselves, raised by Daniel Leidert + +Thu Aug 10 15:54:02 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c libxslt/variables.c + libxslt/xsltInternals.h: Fixed restoring the context doc + for XPath in xsltForEach(). Eliminated the use of @tmpDoc + of the transformation context. + +Thu Aug 10 13:40:35 CEST 2006 Kasimier Buchcik + + * libxslt/preproc.c: Added missing QName-validation of some + attributes of XSLT-elements. This fixes bug #304921, reported + by Frans Englich. + +Thu Aug 10 13:27:48 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c: As suggested by Bill, I changed + xsltShallowCopyNsNode() to return an xmlNsPtr instead of + an int. The fix of bug #350085 is OK; i.e. the removal + of the call to xsltFreeRVTs() in + xsltApplyStylesheetInternal(). I think I tried to clear + the transformation context as much as possible, in case + it is reused; Daniel informed me on the list that reusing + the context is not intended, so no need anymore to try + to free the fragments immediately after the transformation. + +Wed Aug 9 13:22:13 PDT 2006 William Brack + + * libxslt/transform.c: Fixed problem with cleanup of RVT's, should + clear bug350085; cleaned up most warnings (still a problem in + xsltShallowCopyNsNode) + * trivial warning cleanup in libxslt/[extensions.c, namespaces.c, + xslt.c and xsltInternals.h] and libexslt/functions.c + +Fri Aug 4 14:50:41 CEST 2006 Daniel Veillard + + * python/generator.py: fixed the conversion of long parameters + +Wed Jul 19 15:06:39 EDT 2006 Daniel Veillard + + * python/types.c: fix float and boolean XPath conversions + * libxslt/xsltutils.c: try to fix Stephane Bidoul attempt + at setting XInclude support. + +Mon Jul 17 11:15:23 PDT 2006 William Brack + + * Updated tests affected by recent library changes - + tests/general/bug-1-.out, tests/general/bug-24-.out, + tests/keys/month.out : ( now becomes ); + tests/general/bug-41-.xsl and tests/general/bug-43.xsl : + call-template and apply-template, where the template has + no parameter but one is supplied (var should not be affected) + tests/general/bug-145.err : changed error text + +Fri Jul 14 18:16:59 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/functions.c libxslt/keys.c libxslt/namespaces.c + libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/templates.h libxslt/transform.c + libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c + libexslt/functions.c libexslt/strings.c: + Committing again, since I forgot to switch from win to linux + linebreaks in the files. + +Fri Jul 14 17:55:42 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/functions.c libxslt/keys.c libxslt/namespaces.c + libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/templates.h libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c + libexslt/functions.c libexslt/strings.c: + Refactored xsltValueOf(). Changed to use xmlXPathCastToString() + directly, rather than creating an intermediate object with + xmlXPathConvertString(). This now does not add a text-node to + the result if the string is empty (this has impact on + serialization, since an empty text-node is serialized as + , and now it will be serialized as ). + Refactored other functions in transform.c: + Mostly code cleanup/restructuring. Minimized number of + function variables for instruction which eat up function stack + memory when recursing templates (xsltIf(), xsltChoose(), + xsltApplyTemplates(), xsltCallTemplate()). + Changed XSLT tests to use xmlXPathCompiledEvalToBoolean(). + Implemented redefinition checks at compilation-time and + eliminating them at transformation time in the refactored code + paths. + Introduced the field @currentTemplateRule on xsltTransformContext to + reflect the "Current Template Rule" as defined by the spec. + NOTE that ctxt->currentTemplateRule and ctxt->templ is not the + same; the former is the "Current Template Rule" as defined by the + XSLT spec, the latter is simply the template struct being + currently processed by Libxslt. + Added XML_COMMENT_NODE and XML_CDATA_SECTION_NODE to the macro + IS_XSLT_REAL_NODE. + Misc code cleanup/restructuring and everything else I already forgot. + Refactored lifetime of temporary result tree fragments. + Substituted all calls to the now deprecated xsltRegisterTmpRVT() + for the new xsltRegisterLocalRVT(). + Fragments of xsl:variable and xsl:param are freed when the + variable/pram is freed. + Fragments created when evaluating a "select" of xsl:varible and + xsl:param are also bound to the lifetime of the var/param. + EXSLT's func:function now uses the following functions to let take + care the transformation's garbage collector of returned tree + fragments: + xsltExtensionInstructionResultRegister(), + xsltExtensionInstructionResultFinalize() + Fixes: + #339222 - xsl:param at invalid position inside an xsl:template is + not catched + #346015 - Non-declared caller-parameters are accepted + #160400 - Compiles invalid XSLT; unbound variable accepted + #308441 - namespaced parameters become unregistered + #307103 - problem with proximity position in predicates of match + patterns + #328218 - problem with exsl:node-set() when converting strings + to node sets + #318088 - infinite recursion detection + #321505 - Multiple contiguous CDATA in output + #334493 - "--param" option does not have root context + #114377 - weird func:result/xsl:variable/exsl:node-set interaction + #150309 - Regression caused by fix for 142768 + +Wed Jun 21 15:13:27 CEST 2006 Kasimier Buchcik + + * tests/docs/bug-54.xml tests/general/bug-54.out + tests/general/bug-99.out tests/general/bug-136.out + tests/REC/test-7.1.3.xsl tests/REC/test-7.1.4.xsl + tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl: + Fixed incorrect regression tests/results. + +Mon Jun 19 13:33:50 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/attrvt.c libxslt/namespaces.c + libxslt/namespaces.h libxslt/preproc.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h libxslt/xsltutils.c: + Merged all the namespace lookup/create/disable functions + into xsltGetSpecialNamespace(). Changed xsltGetNamespace() + and xsltGetPlainNamespace() to call xsltGetSpecialNamespace(), + but kept the ns-aliasing mechanism; the ns-aliasing needs + to be removed when we move to the refactored code, which + applies ns-alias only at compilaton time. + Refactored xsltElementComp() (preproc.c); enhanced error reports. + Fixed: if the "namespace" attribute was not given, then this + performed incorrectly only a lookup for a default namespace; + i.e., without taking any prefix on the "name" attribute into + account. + Refactored xsltElement() (transform.c); enhanced error reports. + Refactored xsltAttributeComp() (preproc.c). Added namespace + lookup as in xsltElementComp(). Enhanced error reports. + Refactored xsltAttribute() (transform.c); enhanced error reports. + xsltCopyTreeInternal(): eliminated the need to call xmlGetNsList() + for every element in the tree; this needs to be done only for + the top-most elements. For subsequent elements reconcile only + the ns-declarations. Disallowed setting of ns-declarations if + children have been already added to an element. + Removed ns-aliasing code where necessary. + xsltCopyProp(): disallowed setting of attribute nodes if + children have been already added to an element. + xsltCopy(): removed the incorrect skipping of attributes in the + XSLT namespace. Removed the incorrect ns-aliasing for attributes. + Changed to use the introduced function xsltShallowCopyAttr(). + xsltShallowCopyAttr(): Centralized all attribute-copy related + code in this function. It will now be called by + xsltCopyTreeInternal(), xsltCopyOf() and xsltCopy(). + xsltCopyAttrListNoOverwrite(): Renamed. Refactored. Optimized to + use xsltGetSpecialNamespace() and xmlNewDocProp(). + Further substitution of various scattered namespace-lookup + related code for the use of xsltGetSpecialNamespace(). + xsltAttrTemplateProcess(): Refactored. Removed the incorrect + processing of attribute-sets. Attribute sets need to be applied + before adding any normal attribute of the literal result element; + this is now done in xsltAttrListTemplateProcess(). Fixed to + ensure that the ns-prefix of the overwriting attribute is used. + xsltAttrListTemplateProcess(): Refactored. Moved semantics from + xsltAttrTemplateProcess() over to this function in order to + optimize processing of multiple attributes. This does not call + xsltAttrTemplateProcess() anymore. + Fixed: do not exclude the XSLT namespace after ns-aliasing have + beed applied. + The IFDEFed-out refactored code fixes the following issues: + - #313711: namespace collision with namespace-alias (reported + by by Oleg Paraschenko) + - #338214: Incorrect scope for exclude-result-prefixes + - #341392: Excluding namespace declarations of literal result + elements. + - #341325: Namespace aliasing and resulting namespace prefixes + Already enabled fixes: + - #344183: xsl:copy misses to copy attributes in the XSLT namespace + - #341463: Namespace-alias using #default for result-prefix with no + default namespace in scope + - #313890: namespace collision with xsl:element and xsl:attribute, + reported by Oleg Paraschenko + - #344176: xsl:copy misses to set an element's namespace-URI in + some cases + - #305739: the "name" QName of xsl:element is incorrectly always + resolved to the default namespace + +Mon Jun 12 16:34:15 CEST 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: more info about --output + from Daniel Leidert c.f. #344654 + +Tue Jun 6 17:16:33 CEST 2006 Daniel Veillard + + * configure.in libxslt.spec.in doc//*: preparing release of 1.1.17 + +Tue Jun 6 11:44:34 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c: Eliminated a tiny difference wrt to + the old behaviour in the naming of newly generated ns-decls + in xsltAttributeInternal(). + +Thu Jun 1 15:06:31 CEST 2006 Daniel Veillard + + * configure.in: fix a problem in Python detection + +Thu Jun 1 13:58:19 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/variables.c + libxslt/transform.c libxslt/xslt.c: + Next step in the refactored code: enhanced xsl:attribute; + enhanced xsltCopyProp. + Added the creation of an XPath cache in + xsltNewTransformContext(). + +Wed May 31 22:32:44 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c: Fixed a difference in processing of + xsl:value-of and xsl:text wrt to merging of strings of + output-escaped text-nodes. This difference made the + optimized string-merging mechanism run out of sync, which + led to segfaults in subsequent string reallocations. See + bug #343411, reported by Grzegorz Kaczor. + * xslt.c: Added check for ctxt->internalized when we parse + xsl:text and internalize the strings. + +Mon May 22 10:32:57 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/extensions.c libxslt/keys.c libxslt/pattern.c + libxslt/preproc.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltInternals.h: + Next tiny step of refactoring - mostly bug fixes and + cosmetic changes. + Changes outside of the refactored code: + 1) Optimized xsl:attribute if the content consists of + just 1 text node. + 2) Optimized computation of xsl:key. The keys will now be + computed for a specific document not until the first call + of a key() function; here only the keys with the specific + name used by key() are computed. This means that this + now avoids computation of all keys for all loaded + input documents (even if no key() was called on them). + One exception is the scenario where a key() is used in + a template's match pattern; in this case all keys are + computed for a document if there's a chance that + a "keyed" template could match a node (this could still + be optimized a bit). + +Mon May 15 22:32:13 CEST 2006 Kasimier Buchcik + + * libxslt/namespaces.c libxslt/attributes.c: + Fixed bug #302020, reported by Thomas Blatter. + +Fri May 12 23:23:06 CEST 2006 Kasimier Buchcik + + * libxslt/documents.c libxslt/namespaces.c + libxslt/preproc.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c: + Next step of refactoring. For more details see bug #341588. + I applied the suggestion of Jerome Pesenti to the refactored + (still IDFEDed out with XSLT_REFACTORED) code: The XPath + compilation context (accessible via the compilation context) + is now reused for compilation of expressions at + compilation-time; this should reduce compilation time to 50% + for avarage stylesheets. + +Thu May 11 22:12:22 CEST 2006 Kasimier Buchcik + + * libxslt/extensions.c: Changed a comment to indicate that a + specific bug was already fixed. + +Fri May 5 23:10:47 CEST 2006 Kasimier Buchcik + + * libxslt/xsltInternals.h libxslt/attributes.c + libxslt/documents.c libxslt/extensions.c + libxslt/extensions.h libxslt/functions.c + libxslt/imports.c libxslt/keys.c libxslt/preproc.c + libxslt/transform.c libxslt/variables.c libxslt/xslt.c + libxslt/xsltutils.c libxslt/xsltutils.h libexslt/functions.c: + Next step of refactoring (plus some bug-fixes). + For more details see #340780. + +Fri May 5 14:31:53 CEST 2006 Kasimier Buchcik + + * tests/exslt/common/node-set.5.out + tests/exslt/sets/difference.1.out + tests/exslt/functions/function.6.out: Reverting the + changes; I'll rather change the processing stylesheet + documents in a way that they will produce the same results + for broken and stricter whitespace-stripping. + +Thu May 4 22:55:26 CEST 2006 Kasimier Buchcik + + * tests/exslt/common/node-set.5.out + tests/exslt/sets/difference.1.out + tests/exslt/functions/function.6.out: Changed regression test + results (bug #340684). Those will now produce regression + errors; so we need to fix the processor. + +Mon May 1 17:39:27 EDT 2006 Daniel Veillard + + * configure.in NEWS doc//*: preparing release of 1.1.16, updated and + regenerated the docs. + +Tue Apr 25 15:02:42 CEST 2006 Daniel Veillard + + * configure.in: applied patch from Joseph Sacco changing slightly + the python detection scheme should fix bug #338527 + +Wed Apr 12 13:35:45 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/preproc.c libxslt/transform.c + libxslt/variables.c libxslt/xslt.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: + Refactored the internal structures into specialized + structures and adjusted the code to work with those new + structures. I didn't yet (we should in the future) + renamed any fields of the old structures in order to avoid + changing too much code. + Introduced the internal structure xsltCompilerCtxt to be + used for storage and control of the compilation. + Optimized the way lists of in-scope namespaces are created + and stored; this will now only generate a new list if + really needed, i.e. if we encounter a ns-decl. + All this changes here are IFDEFed out with XSLT_REFACTORED. + +Thu Apr 6 10:16:59 CEST 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: applied man page improvement + from Daniel Leidert + +Thu Mar 30 17:23:52 CEST 2006 Kasimier Buchcik + + * tests/general/bug-36-inc.xsl tests/general/bug-37-inc.xsl + tests/general/bug-65-inc.xsl tests/general/bug-100.xsl + tests/REC/test-15-1.xsl tests/REC/test-7.1.1-3.xsl + tests/namespaces/extra2.xsl tests/extensions/module.xsl + tests/plugins/plugin.xsl python/tests/extelem.py + python/tests/extfunc.py: Fixed regression tests wrt + usage of the attributes "exclude-result-prefixes" + and "extension-element-prefixes". test-7.1.1-3.xsl fails + now, since the code still does not exclude ns-decls + correctly. + +Thu Mar 30 17:11:53 CEST 2006 Kasimier Buchcik + + * libxslt/xslt.c libxslt/xsltutils.c libxslt/preproc.c + libxslt/namespaces.c libxslt/imports.c + libxslt/attributes.c: Eliminated usage of xsltGetNsProp() in cases + where an attribute with a specific namespace is requested. + xsltGetNsProp() uses xmlGetProp() which is not namespace aware + and thus will return the first attribute with the requested + name but of arbitrary namespace. + Changed retrieval of the attributes "exclude-result-prefixes" + and "extension-element-prefixes", which are expected to be in + no namespace on XSLT elements and in the XSLT namespace on + literal result elements or extension elements. + Additional change: for XSLT elements the attribute + "exclude-result-prefixes" is only allowed on xsl:stylesheet + and xsl:transform. This attribute was previously processed on + all XSLT elements. + +Wed Mar 29 12:16:41 CEST 2006 Daniel Veillard + + * libxslt/transform.c: Charles Hardin pointed an OOM condition where + a NULL pointer could be dereferenced, closes #336394 + +Fri Mar 10 12:49:18 CET 2006 Daniel Veillard + + * libexslt/crypto.c libexslt/date.c libexslt/saxon.c + libxslt/attributes.c libxslt/imports.c libxslt/pattern.c + libxslt/preproc.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltutils.c: various assorted small cleanups + based on the Coverity reports + +Wed Feb 22 16:09:10 CET 2006 Daniel Veillard + + * python/types.c: Nic Ferrier found debug statement left in the + XPath conversion code + +Tue Feb 21 20:21:07 CET 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: new update from Daniel Leidert + +Tue Feb 21 17:59:11 CET 2006 Daniel Veillard + + * libxslt/extensions.c libxslt/xslt.c libxslt/xslt.h + libxslt/xsltInternals.h: applied patch from Christopher R. Palmer + to avoid a race condition in xsltInit() + +Sun Feb 19 22:40:58 CET 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: improvement of the man page + by Daniel Leidert, c.f. #331779 + +Sat Feb 11 13:10:01 CET 2006 Daniel Veillard + + * libxslt/xsltutils.c: fix xsltSaveResultToString comment + * libxslt/transform.c: detect loops when computing variables, should + fix bug #330772 + * doc/xsltproc.xml doc/xsltproc.1: fix typo in man page + * tests/namespaces/tst7.out tests/general/bug-152.out: small output + changes due to libxml2 xhtml meta handling modification + +Mon Nov 21 12:22:21 CET 2005 Daniel Veillard + + * libexslt/date.c: Albert Chin found another signed/unsigned problem + in the date and time code raised on IRIX 6.5 + +Mon Nov 21 12:08:05 CET 2005 Daniel Veillard + + * libexslt/crypto.c: patch from Albert Chin needed for HP-UX + which doesn't have + +Mon Nov 21 12:05:41 CET 2005 Daniel Veillard + + * libexslt/date.c: Albert Chin posted a patch to fix a problem on + Solaris with dates, extended bitfield size too to match libxml2 + code from xmlschemastypes.c + +Wed Nov 16 12:47:25 CET 2005 Daniel Veillard + + * libexslt/functions.c: fix an problem raised by Ralf Junker in the + use of xmlHashScanFull() fixes bug #321582 + +Sun Nov 6 19:22:45 CET 2005 Daniel Veillard + + * libxslt/attrvt.c: added a missing parameter to a debug function + +Tue Oct 4 20:37:09 HKT 2005 William Brack + + * libexslt/date.c: applied fix to date:week-in-year posted to + the mailing list by Thomas Broyer + * tests/exslt/date/date.1.out, tests/exslt/date/datetime.1.out: + updated to reflect above fix + +Sun Oct 2 11:52:44 CEST 2005 Daniel Veillard + + * configure.in libxslt/Makefile.am libxslt/xsltconfig.h.in + libxslt.spec.in tests/plugins/Makefile.am xslt-config.in: applied + patch from Joel Reed to ease plugin integration + +Thu Sep 22 21:51:22 HKT 2005 William Brack + + * libxslt/pattern.c: fixed problem in internal XPath compilation + of patterns including variables, fixes #316861 + +Wed Sep 14 14:30:03 CEST 2005 Daniel Veillard + + * libxslt/transform.c: removed a superfluous second sorting of + the node set on xsl:copy-of, fixes #316288 + * libxslt/xsltutils.c: marked xsltDocumentSortFunction as slow, + obsolete and deprecated :-) + +Sat Sep 10 14:35:06 CEST 2005 Daniel Veillard + + * configure.in: check environment for PYTHON, fixes #315367 + +Mon Sep 5 00:44:24 CEST 2005 Daniel Veillard + + * configure.in NEWS doc/*: preparing release 1.1.15 + * libxslt/pattern.c libxslt/xsltutils.c: a bit more cleanup + +Mon Sep 5 00:07:40 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed #303289 variable in match are forbidden + * tests/general/bug-89.xsl: had to fix that test which was doing this + * tests/general/bug-142.out tests/general/bug-152.out + tests/namespaces/tst7.out: small output change on libxml2-2.6.21 + new way of serializing encoding meta in HTML + +Wed Aug 31 13:49:51 CEST 2005 Daniel Veillard + + * libxslt/transform.c: fixed #314936 a dictionnary issue on text + node merging, which probably fixed #311267 too. + +Thu Aug 25 13:29:20 CEST 2005 Daniel Veillard + + * libxslt/xslt.c: libxslt should deallocate directly text node content + use xmlSetNodeContent(..., NULL) + +Fri Aug 12 12:17:10 CEST 2005 Daniel Veillard + + * tests/general/bug-163.*, tests/general/Makefile.am, + tests/docs/bug-163.*, tests/docs/Makefile.am: check fix for + #310692 + +Tue Aug 9 22:13:18 CEST 2005 Daniel Veillard + + * tests/plugins/Makefile.am: try to get rid of complaints from + jhbuild newbies. + +Sun Aug 7 16:04:47 CEST 2005 Daniel Veillard + + * libxslt/xsltutils.c: fixed a bug when size of xmlXPathContext + changes, uses the libxml2 alloc and dealloc functions instead. + +Tue Jul 13 22:41:03 PDT 2005 William Brack + + * libxslt/transform.c: added check in xsltCopyText to assure + content is in dictionary before doing a straight copy of + content (bug 302821) + +Tue Jul 13 16:16:31 PDT 2005 William Brack + + * libxslt/transform.c: fixed to set current default value for + XInclude when creating new TransformContext + * libxslt/xslt.c: minor change for per-mille + +Sun Jul 10 16:17:53 CEST 2005 Daniel Veillard + + * libxslt/xsltwin32config.h*: try to avoid generating conflicts + * libexslt/dynamic.c: applied patch from Mark Vakoc to implement + dyn:map + * configure.in tests/exslt/Makefile.am tests/exslt/dynamic/*: + added test for dyn:map to the regression suite + +Sat Jul 2 02:32:24 PDT 2005 + + * libxslt/numbers.c: further fixes for bug 309209, changing + behaviour of format-number. + * libxslt/xslt.c: changed definition of per-mille character from + '?' to Unicode #2030 (UTF-8 '‰') (ref XSLT spec 12.3) + +2005-06-30 Federico Mena Quintero + + * libxslt/xsltwin32config.h: Added this file back. We'll have to + figure out a way to make jhbuild not get CVS conflicts with it. + +Thu Jun 30 14:09:55 PDT 2005 William Brack + + * libxslt/numbers.c: fixed bug in negative prefix (bug 309209) + +2005-06-17 Federico Mena Quintero + + * libxslt/xsltwin32config.h: Removed from CVS; this is a generated + file anyway and it breaks jhbuild all the time. + +Sat May 7 11:28:41 CEST 2005 Daniel Veillard + + * libexslt/libexslt.3: applied patch from Jonathan Wakely to fix + the namespace name for the EXSLT date and time functions in the man + page. + +Wed Apr 6 23:58:12 CEST 2005 Igor Zlatkovic + + * libexslt/exslt.c libexslt/libexslt.h: Windows build cleanups, + removed obsolete checks + * libxslt/libxslt.h libxslt/win32config.h libxslt/xsltutils.h: + Windows build cleanups, removed obsolete checks + * win32/configure.js: removed obsolete copy operations + * win32/Makefile.*: make install cleanup + * xsltproc/xsltproc.c: Windows build cleanup, removed obsolete + macro definitions + * .cvsignore: added Eclipse project files + +Sat Apr 2 13:34:11 CEST 2005 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of 1.1.14, updated docs + and rebuilt. + +Thu Mar 31 23:50:43 CEST 2005 Daniel Veillard + + * tests/docbook/result/fo/gdp-handbook.fo tests/general/bug-105.out + tests/general/bug-142.out: updated the result of some tests + following the change to serailization in libxml2. + +Thu Mar 31 11:54:31 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed bug #171488 with cascading select in + patterns. + * tests/general/bug-161.*, tests/general/Makefile.am, + tests/docs/bug-161.*, tests/docs/Makefile.am: added test provided + by Ben Ko + +Thu Mar 31 00:28:38 CEST 2005 Daniel Veillard + + * tests/plugins/Makefile.am: fixed build outside of source tree + bug #172155 thanks to patch from Mike Castle + +Wed Mar 30 14:09:19 CEST 2005 Daniel Veillard + + * xsltproc/xsltproc.c: fixed the xinclude problem with document() + as in bug #171893 + * configure.in tests/Makefile.am tests/xinclude/*: added a new + xinclude directory with the test for this problem + +Wed Mar 30 11:59:06 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed bug 169718 with ancestors in patterns + similar to same bug fixed in libxml2 + * tests/general/bug-160.*, tests/general/Makefile.am, + tests/docs/bug-160.*, tests/docs/Makefile.am: added test provided + by Aaron Kaplan + +Tue Mar 29 22:35:14 CEST 2005 Daniel Veillard + + * tests/general/bug-159.*, tests/general/Makefile.am, + tests/docs/bug-159.*, tests/docs/Makefile.am: added test for + bug #168196 fixed in libxml2 + +Tue Mar 29 21:06:11 CEST 2005 Daniel Veillard + + * libxslt/transform.c: working around Mark Vakoc' reported bug related + to mode internaing + * xsltproc/xsltproc.c: adding a --nodict mode to check problems with + document without a dictionnary. + * tests/REC/Makefile.am tests/general/Makefile.am: testing without + dictionnary + +Tue Mar 29 15:37:13 CEST 2005 Daniel Veillard + + * libxslt/xslt.c: fix bug #165201 when calling xsltInit() multiple + times. + +Tue Mar 29 15:13:59 CEST 2005 Daniel Veillard + + * libxslt/preproc.c libxslt/xslt.c libxslt/xsltInternals.h: + added DTD like checking when compiling stylesheets, closes + bug #160402 and a long term TODO + * tests/general/bug-89.xsl: thos spotted a misconstruct of one + of the test cases where was not within + +Mon Mar 21 20:56:43 MST 2005 John Fleck (jfleck@inkstain.net) + + * doc/xsltproc.xml, xsltproc.html, xsltproc.1: + update documentation to reflect addition of --nodtdattr + command line flag. Bug #171098 + +Wed Mar 16 17:19:24 HKT 2005 William Brack (wbrack@mmm.com.hk) + + * libxslt/xslt.c: fixed problem with text node on stylesheet + document without a dictionary (bug 170533) + +Sun Mar 13 20:08:34 CET 2005 Daniel Veillard + + * NEWS configure.in doc/*: preparing 1.1.13, updated and rebuilt + the docs. + * tests/plugins/Makefile.am xsltproc/Makefile.am: trying to fix + some build problems. + * libxslt.spec.in: adding a build require and a require for + libgcrypt-devel, c.f. Red Hat bug #133211 + * libxslt/xsltInternals.h: as for libxml2, XML_CAST_FPTR was wrong. + +Wed Feb 23 19:25:13 HKT 2005 William Brack + + * libxslt/pattern.c: fixed a problem with '//' and + namespaces (bug 168208) + +Mon Feb 14 23:10:21 HKT 2005 William Brack + + * libxslt/namespaces.c: fixed a problem with + exclude-result-prefixes (bug 165560) + +Mon Feb 14 12:51:07 CET 2005 Daniel Veillard + + * libxslt/variables.c: added a cretion of ctxt->globalVars in + xsltProcessUserParamInternal if missing. + +Wed Feb 9 21:58:56 CET 2005 Daniel Veillard + + * doc/Makefile.am doc/libxslt-api.xml doc/libxslt-refs.xml + doc/EXSLT/libexslt-api.xml: applied patch for make wiki from + Joel Reed and rebuild + * tests/plugins/Makefile.am: fix from Joel Reed for make dist + +Sun Jan 30 20:01:21 CET 2005 Daniel Veillard + + * tests/plugins/testplugin.c win32/Makefile.msvc win32/configure.js: + applied plugin patch for Windows by Joel Reed + +Fri Jan 28 01:00:56 CET 2005 Daniel Veillard + + * win32/configure.js: Makefile fixes for Widows from Joel Reed + +Sat Jan 22 22:14:26 CET 2005 Daniel Veillard + + * libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/xslt.c libxslt/xsltInternals.h: chasing xmlStrEqual + calls and removed them when comparing mode and modeURI for + templates by interning those strings when compiling the + stylesheets. + +Sat Jan 22 19:17:13 CET 2005 Daniel Veillard + + * configure.in: small fix for local setup + * libxslt/transform.c libxslt/variables.c : speeding up some + variable lookup. In the process dug out something nasty about + ctxt->dict creation and key initialization order. + +Sat Jan 22 16:28:27 CET 2005 Daniel Veillard + + * libxslt/templates.c libxslt/transform.c libxslt/xslt.c + libxslt/xsltInternals.h: when copying text nodes in elements + or attributes to the output, if interning, then reuse the strings + directly without copying them in the output tree if dicts are + shared between the context and the output docs. Less allocations + smaller output document and no copying involved anymore. + +Sat Jan 22 11:24:43 CET 2005 Daniel Veillard + + * libxslt/xslt.c: internalize all text node content from + stylesheet documents with the stylesheet dictionnary + +Fri Jan 21 12:04:18 HKT 2005 William Brack + + * tests/plugins/Makefile.am: Applied patch 11 (with small + modification) from Joel + +Thu Jan 20 21:05:27 CET 2005 Daniel Veillard + + * tests/plugins/Makefile.am tests/plugins/testplugin.c: applied + patch 10 from Joel Reed + +Wed Jan 19 10:08:55 HKT 2005 William Brack + + * libxslt/xsltwin32config.h, libxslt/xsltwin32config.h.in: + fixed a small error in LIBXSLT_VERSION_EXTRA pointed out + by Michael.Hewarth on the mailing list + +Wed Jan 19 13:58:16 CET 2005 Daniel Veillard + + * configure.in: patch #9 from Joel Reed + +Wed Jan 19 10:21:37 HKT 2005 William Brack + + * transform.c: fixed problem with parserOptions not being + set before loading a new document (bug 164530) + +Mon Jan 17 16:50:02 CET 2005 Daniel Veillard + + * configure.in libxslt/Makefile.am libxslt/xsltwin32config.h + tests/Makefile.am tests/plugins/Makefile.am + tests/plugins/testplugin.c: applied another patch from Joel Reed + still failing here but looking better + +Sun Jan 16 00:09:11 CET 2005 Daniel Veillard + + * libxslt/extensions.c: applied another patch from Joel Reed + +Sat Jan 15 13:54:28 CET 2005 Daniel Veillard + + * tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c + libxslt/Makefile.am configure.in: Applied another patch from + Joel Reed, fixed a segfault and changed the configure code + a bit to work in my debug environment. + +Tue Jan 11 10:50:33 HKT 2005 William Brack + + * configure.in: added python2.4 to the list of accepted + versions (bug 163274) + +Sun Jan 9 17:04:23 CET 2005 Daniel Veillard + + * libxslt/extensions.c: oops previous patch could break build + +Sun Jan 9 16:41:59 CET 2005 Daniel Veillard + + * configure.in win32/configure.js libxslt/extensions.c + libxslt/xsltconfig.h.in libxslt/xsltwin32config.h.in: + integrated the module patch from Joel Reed with just a couple + of changes and cleanup. + +Tue Dec 27 17:50:10 HKT 2004 William Brack + + * libxslt/pattern.c: fixed a problem with the expression + "*//name" (bug 162265), also a small problem with the '|' + operator. + +Thu Dec 23 16:04:47 HKT 2004 William Brack + + * libxslt/transform.c, libxslt/templates.c: fixed a couple of + spots where out-of-memory errors were not detected in time + (bug #153660 on OSF/1) + +Thu Dec 2 21:10:31 HKT 2004 William Brack + + *doc/xslt.html, doc/downloads.html: changed the download link + on the web page for cvs snapshot + +Wed Dec 1 22:37:55 HKT 2004 William Brack + + * libxslt/extensions.c, libxslt/functions.c, libxslt/numbers.c, + libxslt/pattern.c, libxslt/transform.c, libxslt/xslt.c, + libxslt/xsltInternals.h: minor changes to get rid of gcc + warnings, especially on 64-bit system. Implemented + XML_CAST_FPTR macro to cast between function pointer <-> + object pointer while avoiding gcc warnings (a hack). + No change to the logic. + +Wed Dec 1 10:47:15 CET 2004 Daniel Veillard + + * libxslt/security.c xsltproc/xsltproc.c: applied patch from + Aleksey Gurtovoy moving some stat() definition for Windows + to the right place. + +Wed Dec 1 14:30:22 HKT 2004 William Brack + + * libxslt/xslt.c: applied patch from Mark Vakoc fixing bug with + namespace URI on template names. + * tests/namespaces/tst9*, tests/namespaces/Makefile.am: added + test case for this + +Tue Nov 30 10:53:18 HKT 2004 William Brack + + * libxslt/pattern.c: more on RVT's in XPath predicates, this + time for bug 159726. Cleaned up the logic a little, hopefully + now covers all setting of XSLT_RUNTIME_EXTRA. + * tests/general/bug-158.xsl: corrected a typo + +Thu Nov 25 22:24:03 HKT 2004 William Brack + + * libxslt/variables.c, libxslt/xsltInternals.h: backed out the + last change and re-did it the "right way" (bug 158372). + * tests/general/bug-158.*, tests/general/Makefile.am, + tests/docs/bug-158.*, tests/general/Makefile.am: added test + case for this bug + +Wed Nov 24 10:51:51 HKT 2004 William Brack + + * libxslt/variables.c, libxslt/xsltInternals.h: enhanced the + evaluation of global variables to take account of possible + changes to the current document (bug 158372). + +Mon Nov 22 08:10:18 HKT 2004 William Brack + + * libxslt/pattern.c: small change to previous fix for bug 153137, + fixes bug 158840. + * tests/general/bug-157.*, tests/general/Makefile.am, + tests/docs/bug-157.*, tests/docs/Makefile.am: added test for this + +Sun Nov 21 09:42:22 HKT 2004 William Brack + + * libxslt/transform.c: enhanced code to assure the "current + template rule" is not changed by xsl:call-template (bug 157859). + * tests/general/bug-156.*, tests/general/Makefile.am, + tests/docs/bug-156.*, tests/docs/Makefile.am: added a test case + +Mon Nov 8 11:41:32 HKT 2004 William Brack + + * libexslt/date.c: fixed problem with day-of-week-in-month + (bug 157592) with patch from Sal Paradise + * tests/exslt/date/datetime.1.out: corrected expected output + after above fix + +Mon Nov 1 15:57:24 CET 2004 Daniel Veillard + + * tests/general/bug-155.*, tests/general/Makefile.am, + tests/docs/bug-155*, tests/docs/Makefile.am: added a test case + provided by Markus Bertheau breaking on libxml2-2.6.15 + +Fri Oct 29 17:03:26 CEST 2004 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of libxslt-1.1.12 + * libexslt/crypto.c: mini change to avoid breaking apibuild.py + * libxslt/templates.c: small fix, first step in adressing #153660 + +Fri Oct 29 14:18:35 CEST 2004 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: indicate - means stdin closing + #156626 + +Wed Oct 27 17:00:54 CEST 2004 Daniel Veillard + + * libxslt/transform.c: another dictionnary/string interning fix + +Wed Oct 27 00:00:07 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fix to force string interning on generated + documents + +Sat Oct 23 09:36:12 PDT 2004 William Brack + + * libexslt/crypto.c, libexslt/functions.c, libxslt/keys.c, + libxslt/numbers.c, libxslt/pattern.c, libxslt/transform.c, + libxslt/variables.c: changed some variable names for warning + cleanup when -ansi flag is not present. + * libxslt/namespaces.c: fixed potential NULL pointer reference + pointed out by Dennis Dams (bug 156187) + +Mon Oct 18 17:04:27 CEST 2004 Daniel Veillard + + * libxslt.spec.in doc/Makefile.am: fix for RedHat bug #136072 + to include EXSLT doc in libxslt package. + +Thu Oct 14 22:43:22 PDT 2004 William Brack + + * configure.in, config.h.in, libexslt/date.c: changed date.c to use + gmtime_r if available (bug 129983) + * libexslt/functions.c: fixed a namespace problem concerning a + function with a namespace-qualified name (bug 155197) + +Tue Oct 12 03:54:44 CEST 2004 Daniel Veillard + + * libxslt/namespaces.c: fixed a bug in namespace lookup exhibited + by the recent namespace tests in libxml2 + +Thu Oct 7 16:15:15 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fixed a problem of tree structure raised + by the new libxml2 tree checking code. + +Thu Sep 30 11:28:03 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with negative periods + (bug 154021) + * tests/exslt/date/sum.2.out: changed expected output, now + agrees with comments in sum.2.xml test data file + +Thu Sep 30 08:19:28 CEST 2004 Daniel Veillard + + * libxslt/templates.c: patch from Mark Vakoc about an incorrect + attribute document pointer. + +Thu Sep 30 08:13:57 CEST 2004 Daniel Veillard + + * doc/tutorial2/libxslt_pipes.*: updated the tutorial from Panagiotis + Louridas + +Thu Sep 30 00:10:09 CEST 2004 Daniel Veillard + + * configure.in doc/*: release of 1.1.11, rebuilt the docs + +Wed Sep 29 15:42:33 CEST 2004 Daniel Veillard + + * libxslt/pattern.c: try to fix #153137 but without a test case + it's shooting in the dark. + +Tue Sep 28 16:20:48 CEST 2004 Daniel Veillard + + * doc/tutorial2/libxslt_pipes.*: New tutorial from Panagiotis Louridas + * libxslt.spec.in doc/Makefile.am: integrated the tutorial in the + distribution + +Sat Sep 25 21:38:57 CEST 2004 Daniel Veillard + + * libxslt/preproc.c libxslt/variables.c: fixed 2 leaks with + namespaced variable names. + * tests/general/bug-154.*, tests/general/Makefile.am, + tests/docs/bug-154*, tests/docs/Makefile.am: added test case + for above + +Fri Sep 24 18:13:45 CEST 2004 Daniel Veillard + + * Makefile.am: add missing variable + * libxslt/transform.c: fixed some error callback data + * tests/exslt/date/Makefile.am tests/exslt/date/sum*: added new + date:sum testing from Derek Poon + +Fri Sep 24 09:17:22 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with empty sets, etc. + (see discussion on mailing list) + +Sat Sep 18 17:08:31 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with timezone offset + (bug 153000) + * tests/exslt/date/add.1.out: changed regression test output, + which was apparently incorrect for above case + +Sat Sep 18 00:04:02 PDT 2004 William Brack + + * libxslt/transform.c: re-arranged sequence of setting up + namespaces within xsltCopyTree (see the list thread + http://mail.gnome.org/archives/xml/2004-September/msg00072.html) + * tests/general/bug-104.out: slight change to expected output + due to above fix + +Fri Sep 17 23:15:33 PDT 2004 William Brack + + * libexslt/date.c: enhanced validation of date-time to catch + bit-field overflow (bug 152836) + * tests/exslt/date/date.2.*, tests/exslt/time.2.*: added test + cases for above + +Tue Sep 7 18:04:55 PDT 2004 William Brack + + * libxslt/numbers.c: further refinement to UTF8 pattern + separator (bug 151975) + +Tue Sep 7 00:14:12 PDT 2004 William Brack + + * libxslt/numbers.c: fixed problem with UTF8 pattern + separator (bug 151975) + +Mon Sep 6 14:27:38 PDT 2004 William Brack + + * libxslt/imports.c, libxslt/xslt.c, libxslt/xsltInternals.h: + fixed 2 problems with xsl:include (bug #151795) + +Tue Aug 31 15:45:42 CEST 2004 Daniel Veillard + + * NEWS configure.in doc/*: Release of libxslt-1.1.10 + +Tue Aug 31 11:41:11 CEST 2004 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: added missing descriptions + for --path as well as --load-trace, fixes Red Hat bug #106545 + +Fri Aug 27 20:52:52 PDT 2004 William Brack + + * libxslt/keys.c: fixed small problem with key initialisation + disturbing the transformation context (bug 151201). + * tests/general/bug-153.*, tests/general/Makefile.am, + tests/docs/bug-153*, tests/docs/Makefile.am: added test case + for above + +Tue Aug 24 16:40:51 CEST 2004 Igor Zlatkovic + + * win32/configure.js: added support for version extra + +Mon Aug 23 16:53:02 CEST 2004 Daniel Veillard + + * libexslt/date.c libxslt/imports.c libxslt/xslt.c: fixing + compilation problems on Solaris #150844 + +Sun Aug 22 17:19:49 CEST 2004 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of 1.1.9 + +Sat Aug 21 22:08:14 PDT 2004 William Brack + + * transform.c: Further enhancement for keys on exslt:node-sets. + Corrects a rather serious timing problem (bug 150741) + * tests/exslt/common/node-set.8.*: added regression test for this + +Fri Aug 20 18:53:50 CEST 2004 Daniel Veillard + + * Makefile.am configure.in: a bit of cleanup and a extra variable for + CVS dist + +Fri Aug 20 11:30:19 CEST 2004 Daniel Veillard + + * libxslt/imports.c: fix a 64bit bug reported by Andreas Schwab + +Wed Aug 18 14:27:18 PDT 2004 William Brack + + * configure.in libxslt/xsltconfig.h.in libxslt/xslt.c + libxslt/xsltwin32config.* libexslt/exsltconfig.h.in + libexslt/exslt.c: added some code to include the CVS + ChangeLog version in the version strings available for + printing (e.g. by xsltproc) + +Wed Aug 18 00:22:00 CEST 2004 Daniel Veillard + + * xsltproc/xsltproc.c: implemented --nodtdattr to avoid defaulting + DTD attributes, RFE 150311 . Also cleanup the code from all + libxml2 pre 2.6.0 specific code since we are using + LIBXML_REQUIRED_VERSION=2.6.8 in configure.in + +Tue Aug 17 01:01:22 CEST 2004 Daniel Veillard + + * libxslt/documents.c libxslt/documents.h libxslt/imports.c + libxslt/xslt.c libxslt/xsltutils.c: Implemented a hook to + provide document loading as suggested by David Hyatt for + Safari + +Mon Aug 16 12:53:55 PDT 2004 William Brack + + * libxslt/transform.c: added a call to xmlXPathOrderDocElems + in xmlNewTransformContext for the principal document (bug 133289) + +Sat Aug 14 21:49:48 PDT 2004 William Brack + + * libxslt/namespaces.[ch], transform.c, xslt.c, xsltInternals.h: + fixed handling of #default in namespace-alias for default + namespace (bug 149659) + * tests/namespaces/tst7.* tst8.*: added regression tests for above + +Fri Aug 6 11:05:31 PDT 2004 William Brack + + * libexslt/date.c: added date:sum routine supplied by Joel + Reed + +Wed Aug 4 00:04:13 CEST 2004 Daniel Veillard + + * doc/downloads.html doc/xslt.html: fixed a couple of problems + reported by Oliver Stoeneberg + +Mon Aug 2 08:48:03 PDT 2004 William Brack + + * libxslt/documents.c, libxslt/functions.c, libxslt/transform.c, + libxslt/variables.c: added code to assure keys are generated + when needed for node-sets (bug 148773) + * tests/exslt/common/node-set.7.* - added test case for above. + +Mon Jul 26 17:03:22 PDT 2004 William Brack + + * libexslt/strings.c: fixed str:tokenize for case when 2nd + argument is an empty string (should produce a token for + each char in the string). Reported on the mailing list by + Peter Pawlowski. + +Fri Jul 23 21:55:14 PDT 2004 William Brack + * libxslt/imports.c: further enhancement for template priorities + on imported stylesheets (better fix for bug 141279, fixes + bug 148246). + +Fri Jul 16 12:14:57 CEST 2004 Daniel Veillard + + * configure.in libexslt/crypto.c libexslt/exslt.[ch] + libexslt/exsltconfig.h.in win32/configure.js: apply patch from + Rob Richards to add a normal --with-crypto configure option. + +Tue Jul 13 22:57:43 HKT 2004 William Brack + + * libxslt/functions.c: added some logic to xsltKeyFunction + to set the transform context doc ptr when the xpath context + doc is different (bug 147445) + * tests/exslt/common/Makefile.am, tests/exslt/common/node-set.5* + and tests/exslt/common/node-set.6*: added regression tests + for bug 145547 (UNION and FILTER for RVT's) + +Mon Jul 12 08:28:07 HKT 2004 William Brack + + * python/libxslt-python-api.xml: fixed type for doctypeSystem + and doctypePublic (problem reported on the list by Sitsofe + Wheeler) + * doc/libxslt-api.xml: updated database. + +Sun Jul 11 22:46:31 HKT 2004 William Brack + + * transform.c: small change to key handling for RVT, needed + because of enhancement to libxml2 xpath. + +Fri Jul 9 02:51:38 PDT 2004 Daniel Veillard + + * python/libxsl.py: fixes Python on 64bits box problem. + +Tue Jul 6 18:43:37 CEST 2004 Daniel Veillard + + * libxslt.spec.in: better python dependancy Red hat bug #126364 + by Robert Scheck + +Tue Jul 6 21:35:44 HKT 2004 William Brack + + * tests/namespaces/Makefile.am: added extra2.err, tst5.xml, + tst5.xsl and tst.out to EXTRA_DIST + +Mon Jul 5 21:48:13 CEST 2004 Daniel Veillard + + * configure.in doc/*: releasing 1.1.8 + +Sun Jul 4 24:18:12 HKT 2004 William Brack + + * xsltproc/Makefile.am: changed the sequence of LD_ADDS and + LIBGCRYPT_LIBS on xsltproc_LDADD. Previously this was + causing the wrong libs to be linked when using the configure + option --with-libxml-libs-prefix, or --with-libxml-src (nasty) + +Sun Jul 4 21:42:48 HKT 2004 William Brack + + * libexslt/Makefile.am: implemented change from Joel Reed for + automake-1.4 compatibility. + * libexslt/crypto.c: reformatted source to remove an overly + generous supply of tabs. Added a #include for sys/select to + fix a compilation error caused by the gcrypt include file's + usage of 'fd_set'. Made some minor changes to fix + some warning messages (no change to the logic). + * configure.in, config.h.in: added test for presence of + sys/select.h. + Added test for libgcrypt version > 1.1.41 (bug 145245) + +Sat Jul 3 17:52:27 HKT 2004 William Brack + + * doc/xslt.html, doc/extensions.html: corrected the URI for libxslt + namespace, also a small enhancement of the surrounding text on + extension functions. (bug 145250) + +Fri Jul 2 15:51:49 CEST 2004 Daniel Veillard + + * configure.in: convenience change + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c: + try to avoid calling libxml2 cleanup function directly but go + though the python wrapper of libxml2 for memory debug accounting. + +Fri Jul 2 16:24:12 HKT 2004 William Brack + + * libxslt/keys.c: added namespace setup before calling XPath + to evaluate key (Bug 143520) + +Thu Jul 1 10:07:55 HKT 2004 William Brack + + * libxslt/transform.c: added coding to xsltCopyTree to copy + namespaces (bug 139578). + * tests/general/bug-128.out: changed to reflect above fix + * libxslt/xslt.c: minor change to an error message + +Wed Jun 30 18:41:20 CEST 2004 Daniel Veillard + + * win32/Makefile.msvc win32/Makefile.mingw libexslt/Makefile.am + libexslt/exslt.c libexslt/exslt.h config.h.in configure.in + libexslt/crypto.c: applied patch from Joel Reed to get EXSLT + crypto extensions based on libgcrypt if found at configure time. + * tests/namespaces/Makefile.am: fixed a small breakage + +Wed Jun 30 12:28:34 HKT 2004 William Brack + + * libxslt/namespaces: some enhancement for fixing bug 142768 + * tests/namespaces/Makefile.am, tests/namespaces/tst6*: + added regression test for this bug + +Tue Jun 29 09:23:03 CEST 2004 Daniel Veillard + + * Makefile.am examples/xsltICUSort.c: seems I never commited to CVS + the example from Richard Jinks + +Wed Jun 9 16:33:56 CEST 2004 Igor Zlatkovic + + * win32/configure.js win32/Makefile.* minor changes for the new + layout of the Windows binary package + +Wed May 26 10:51:22 HKT 2004 William Brack + + * doc/search.php.inc, doc/search/php: enhanced to remove + forcing module names to lower case, and to fix problem + with links between pages in libxml2 directory. + +Mon May 24 12:46:10 HKT 2004 Igor Zlatkovic + + * win32/makefile.msvc, win32/configure.js: included the cruntime + option, contributed by Oliver Stoeneberg + +Mon May 24 08:37:22 HKT 2004 William Brack + + * libxslt/xsltutils.c: fixed bug in error message printing + for undefined namespace (bug 143004) + +Mon May 17 23:08:42 CEST 2004 Daniel Veillard + + * NEWS doc/*: updated for 1.1.7 + +Mon May 17 06:14:09 CEST 2004 Daniel Veillard + + * configure.in: release of libxslt-1.1.7 + +Sun May 16 23:08:05 CEST 2004 Daniel Veillard + + * tests/general/bug-151*, tests/docs/bug-151.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for old bug #127877 + +Sun May 16 20:48:35 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fixing bug #135542 about the DOCTYPE name + being generated when the root element is namespaced + * tests/general/bug-151*, tests/docs/bug-151.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug #135542 + +Sun May 16 19:39:44 CEST 2004 Daniel Veillard + + * libxslt/namespaces.c libxslt/namespaces.h libxslt/templates.c + libxslt/transform.c: fixing bug #134500 on namespace lookup for + attribute which sometimes lead to default namespace + * tests/general/bug-150*, tests/docs/bug-150.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug #134500 + +Sun May 16 18:09:36 CEST 2004 Daniel Veillard + + * libexslt/date.h: fixing a small portability problem on Solaris + for the declaration of localtime_r bug #140468 + +Sun May 16 16:36:38 CEST 2004 Daniel Veillard + + * libxslt.m4: applied patch from Edward Rudd to fix the problems + raised in bug #142429 + +Sun May 16 11:01:52 CEST 2004 Daniel Veillard + + * libxslt/xslt.c: fixed a weird namespace bug #141532 + * tests/docs/Makefile.am tests/docs/bug-14[89].xml + tests/general/Makefile.am tests/docs/bug-14[89]*: added tests + to the regression for bug #141532 + +Sun May 2 23:47:43 PDT 2004 William Brack + + * libxslt/imports.c: added comments and function header, + improved logic of routine just added. + * tests/general/bug-147*, tests/docs/bug-147.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug 141279 + +Sun May 2 12:47:32 PDT 2004 William Brack + + * libxslt/imports.c: enhanced normalization of comp steps + when an imported stylesheet has it's own imports + (bug 141279) + +Sat May 1 10:35:03 PDT 2004 William Brack + + * libxslt/transform.c: added code to recognize + disable-output-escaping on certain text nodes (bug 140755) + * tests/general/bug-100.out: regenerated to account for change + from next ChangeLog entry (bug 140558) + +Wed Apr 28 18:17:24 PDT 2004 William Brack + + * libxslt/xsltutils.c: suppressed any automatic linefeed after + a comment following the document root element (bug 140558) + +Thu Apr 22 08:38:35 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fix a problem where we updated an + ELEMENT node psvi field as if it was a DOCUMENT one, leading + to a subtle crash later, valgrind rules. + +The Apr 20 00:22:37 HKT 2004 William Brack + + * libexslt/strings.c: fixed bug in UTF8 string tokenize + kindly reported by Vasily Tchekalkin + +Mon Apr 19 00:39:18 CEST 2004 Daniel Veillard + + * configure.in doc/*: preparing release 1.1.6 + * libxslt.spec.in: keep the ChangeLog compressed + +Mon Apr 5 15:23:53 CEST 2004 Daniel Veillard + + * libxslt/keys.c: fixed a stupid cut'npaste bug #139132 + * tests/docs/Makefile.am tests/docs/bug-146.xml + tests/general/Makefile.am tests/docs/bug-146*: added test + to the regression for bug #139132 + +2004-04-02 10:17:23 HKT 2004 William Brack + + * libxslt/keys.c: applied patch from Mark Vakoc to fix problem + with key matching attribute node. + +2004-04-01 Johan Dahlin + + * python/.cvsignore: Add generated files, to make cvs silent. + + * .cvsignore: Add missing libexslt.pc and stamp-h1 + +Tue Mar 23 13:13:56 CET 2004 Daniel Veillard + + * configure.in: prepare release of 1.1.5, made a hard dependancy + to libxml2 2.6.8 due to the dictionnary reference counting change + * doc/*: updated and rebuilt the doc. + * tests/namespaces/Makefile.am: fixed a build problem (tst5 ?) + +Mon Mar 22 20:25:41 CET 2004 Daniel Veillard + + * libxslt/xsltconfig.h.in: small fix for OpenVMS + * libxslt/documents.c: fixed a leak associated to the change + in reference counting when running the XML parser and using + the document() function. + +Wed Mar 17 18:49:55 HKT 2004 William Brack + + * xsltproc/xsltproc.c: added check for state XSLT_STATE_STOPPED + when output file is used (bug 137341) + +Tue Mar 16 08:55:18 HKT 2004 William Brack + + * libxslt/xsltutils.c: corrected my error from bug 135938 + pointed out on the mailing list by Mark Vakoc. + * libxslt/transform.c: enhanced the error message for + call-template when namespace is present. + * tests/general/bug-145.err: regenerated for new message + +Fri Mar 12 13:07:03 HKT 2004 William Brack + + * libxslt/namespaces.c: added additional check to prevent + superfluous namespace href's being generated on elements + (bug 136914) + * tests/namespaces/Makefile.am, tests/namespaces/tst5.x[ms]l: + added new test for bug 136914 + * tests/namespaces, tests/extensions/ tests/reports: fixed + error in "enhanced" Makefile.am, removed superfluous .err files + from cvs + +Wed Mar 10 19:27:39 HKT 2004 William Brack + + * doc/search.php.incl: minor addition for later version of php + requiring $HTTP_GET_VARS. + doc/*: rebuilt the docs + +Wed Mar 10 17:14:13 HKT 2004 William Brack + + * libexslt/strings.c: modified the 'tokenize' routine to work with + UTF8 chars in both string and tokens (Bug 136183) + +Tue Mar 9 23:44:31 HKT 2004 William Brack + + * libxslt/attrvt.c: added coding to allow growing the + AVT structure when a large number of segments are present + (bug 136624) + * libxslt/keys.c: fixed a compilation warning (no logic change) + +Sat Mar 6 23:42:47 HKT 2004 William Brack + + * tests/docbook/Makefile.am: small fix to typo + +Sat Mar 6 23:05:11 HKT 2004 William Brack + + * Makefile.am, tests/Makefile.am, tests/REC/Makefile.am, + tests/REC1/Makefile.am, tests/REC2/Makefile.am, + tests/XSLTMark/Makefile.am, tests/docbook/Makefile.am, + tests/exslt/common/Makefile.am, tests/exslt/date/Makefile.am, + tests/exslt/functions/Makefile.am, tests/exslt/math/Makefile.am, + tests/exslt/sets/Makefile.am, tests/exslt/strings/Makefile.am, + tests/extensions/Makefile.am, tests/general/Makefile.am, + tests/keys/Makefile.am, tests/multiple/Makefile.am, + tests/namespaces/Makefile.am, tests/numbers/Makefile.am, + tests/reports/Makefile.am, test/xmlspec/Makefile.am, + tests/general/bug-60.err, tests/docbook/result/html/gdp-handbook.err, + tests/REC/test-2.5-1.err: + Major enhancement to "make tests". All but Python tests + cleaned up to produce minimum summary output if no problems. + * tests/general/bug-145.xsl, tests/general/bug-145.err, + tests/docs/Makefile.am, tests/docs/bug-145.xml: + Added test case for bugzilla bug 135938 + +Thu Mar 4 23:02:18 HKT 2004 William Brack + + * libxslt/xsltutils.h, libxslt/xsltutils.c, libxslt/preproc.c: + fixed problem with dictionary handling (bug 135938). + * doc/EXSLT/*: fixed a few more "href_base" files. + +Wed Mar 3 21:33:33 HKT 2004 William Brack + + * doc/*, doc/html/*, doc/EXSLT/*: rebuilt the docs to fix + the "href_base" problem. + +Fri Feb 27 01:04:47 HKT 2004 William Brack + + * configure.in, config.h.in: added test for localtime_r + * libexslt/date.c: added usage of localtime_r if present on + system (bug 129983, suggested by Vasily Tchekalkin) + +Thu Feb 26 16:59:45 CET 2004 Daniel Veillard + + * libxslt/keys.c libxslt/pattern.c: removed the last use + of _private that time in the input document, use the psvi + field again, this may be interesting if XSLT2 support gets + in but since this is very unlikely ... + +Thu Feb 26 16:04:28 CET 2004 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c: use the psvi field + of teh document used for RVT instead of _private. + +Thu Feb 26 15:17:52 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/templates.c: use the psvi field of + the attribute instead of the _private one to compile AVT infos + +Thu Feb 26 14:53:16 CET 2004 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-144.xml + tests/general/Makefile.am tests/docs/bug-144*: added test + similar to 143 but checking for AVT in local variables. + +Thu Feb 26 13:16:33 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/variables.c: fixed a regression for + AVT found in global variable content. + * tests/docs/Makefile.am tests/docs/bug-143.xml + tests/general/Makefile.am tests/docs/bug-143*: added test + to the regression suite. + +Wed Feb 25 16:35:01 CET 2004 Daniel Veillard + + * libxslt/attributes.c libxslt/keys.h libxslt/preproc.c + libxslt/transform.c libxslt/variables.c libxslt/xsltutils.c: + First step toward _private cleanup: use the psvi field to store + the precompilation informations in the stylesheet nodes. + +Wed Feb 25 14:24:34 CET 2004 Daniel Veillard + + * libxslt/variables.c: trying to use the fact that names comes + from a dictionnary when looking up for variables. + * tests/documents/Makefile.am: try to fix an error reported on + the list. + +Wed Feb 25 17:02:22 HKT 2004 William Brack + + * tests/general/Makefile.am, tests/general/bug-142.xsl, + tests/general/bug-142.out, tests/docs/Makefile.am, + tests/general/bug-142.xml: added test for language + attribute which previously triggered a memory leak + (from list report by Mike Hommey) + +Mon Feb 23 18:01:44 CET 2004 Daniel Veillard + + * NEWS configure.in doc/*: preparing release 1.1.4, updated and + regenerated the documentation + +Tue Feb 24 00:37:28 HKT 2004 William Brack + + * libxslt/xsltutils.c, libxslt/templates.c, libxslt/preproc.c: + minor changes to eliminate compilation warnings. No change + to logic. + +Sun Feb 22 23:59:12 CET 2004 Daniel Veillard + + * libexslt/exsltexports.h libxslt/xsltexports.h: patches from + Mikhail S Grushinskiy to compile on Mingw + +Sat Feb 21 16:47:04 CET 2004 Daniel Veillard + + * win32/Makefile.msvc: patch from Mark Vadoc for attrvt.c + +Wed Feb 18 13:32:55 CET 2004 Daniel Veillard + + * libxslt/extensions.c: applied patch from Steve Little to + display the extension modules. + +Wed Feb 18 11:40:23 CET 2004 Daniel Veillard + + * libxslt/transform.c: trying to fix an extension regression pointed + out on the list. + +Tue Feb 17 12:20:26 CET 2004 Daniel Veillard + + * libxslt/transform.c: try to fix the problem with yelp + and dictionnaries + +Tue Feb 17 11:29:15 CET 2004 Daniel Veillard + + * libxslt/templates.c: applied patch from #134588 provided by + Mariano Suárez-Alvarez, attribute text node without doc. + +Mon Feb 16 15:55:57 CET 2004 Daniel Veillard + + * configure.in, doc/*: updated and rebuilt the documentation + preparing release of 1.1.3 + * libxslt/attrvt.c libxslt/xsltInternals.h: cleanup + +2004-02-15 Tomasz KÅ‚oczko + + * libxslt.m4: small fix: added missing [] quotation macro name + defined in AC_DEFUN(). Fix is neccessary for aclocal from automake + 1.8.x and is backward compatible with older auto tools. + +Sun Feb 15 23:01:09 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/templates.c: removed the two last + known bug with the new code, was overoptimizing a bit... + +Sun Feb 15 19:57:20 CET 2004 Daniel Veillard + + * libxslt/attrvt.c: found the memory leak shown in DocBook, + mostly an error handling some ATV coupled with doctionnaries + reference counting. + * libxslt/documents.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c: added a bit of debug to be able to trace + dictionnaries. + +Fri Feb 13 16:59:46 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/Makefile.am: added new code to handle + attribute value templates + * libxslt/*.c libxslt/*.h: also a lot of work to reuse the + dictionaries at the stylesheet and transformation level. + * configure.in: this relies on a recent version of libxml2 + with the sub dictionnary catalog. + +Sun Feb 8 16:53:14 HKT 2004 William Brack + + * libxslt/transform.c: added check for "?>" in PI content + (Bug 133726) + +Sat Jan 31 02:43:45 PST 2004 William Brack + + * libxslt/namespaces.c: fixed problem with attribute + namespace (Bug 132953) + +Thu Jan 29 14:47:22 PST 2004 William Brack + + * libxslt/transform.c: added check for "--" or ending '-' + in xsl:comment (Bug 132742) + +Thu Jan 29 14:08:31 PST 2004 William Brack + + * libxslt/transform.c, libxslt/attributes.c: added + validation of QName for xsl:element and xsl:attribute + (Bug 132531) + +Fri Jan 23 18:52:22 HKT 2004 William Brack + + * libxslt/pattern.c: changed priority of template patterns + starting with '//' from 0.0 to 0.5 (Bug 131705) + +Thu Jan 22 18:42:03 CET 2004 Daniel Veillard + + * libxslt/xslt.c: applied patch from Stefan Kost to fix + behaviour on unknown element from the XSLT namespace. + * python/generator.py: applied patch from Stephane bidoul + to export enums in the bindings. + +Thu Jan 22 10:35:14 HKT 2004 William Brack + + * tests/general/Makefile.am, tests/general/bug-141.out, + tests/general/bug-141.xsl, tests/docs/Makefile.am, + tests/general/bug-141.xml: added test case for + Bug 13971 (libxml2 xpath.c bug, but tested here) + +Fri Jan 16 22:15:34 HKT 2004 William Brack + + * libxslt/xsltutils.c: added a newline for any comment before + the root element (Bug 130433) + * libxslt/xslt.c: fixed problem with cdata-section-elements when + default namespace is changed (Bug 130793) + * tests/extensions/module.out, tests/general/bug-100.out: adjusted + for newline after comment change above. + * tests/general/Makefile.am, tests/general/bug-140.xsl, + tests/general/Makefile.am, tests/docs/bug-140.xml: added test for + cdata-section-elements problem. + +Wed Jan 14 16:44:58 CET 2004 Daniel Veillard + + * python/libxsl.py: applied shared lib loading patch for OS X from + Gianni Ceccarelli + +Wed Jan 14 14:28:02 HKT 2004 William Brack + + * libexslt/math.c, libexslt/common.c: fixed problem, + reported on the list by Markus Bayerlein, concerning + math functions on nodesets generated with + exslt:node-set + * tests/exslt/math/max.3.xsl, tests/exslt/math/max.3.xml, + tests/exslt/math/max.3.out, tests/exslt/math/Makefile.am: + added test case for above. + +Tue Jan 13 00:33:50 HKT 2004 William Brack + + * libxslt/transform.c: changed to assure comment which + preceeds root node is output after DTD (Bug 130433) + * test/exslt/common/node-set.4.*: added test case for + Bug 130922 + +Mon Jan 12 12:51:45 HKT 2004 William Brack + + * doc/site.xsl: Changed logo spacing to avoid stacking + * doc/*: rebuilt web pages + +Sun Jan 11 20:10:09 MST 2004 John Fleck + + * doc/site.xsl + * doc/w3c.png + * doc/* + Test William's new site.xsl improvements by adding the + W3C logo icon, rebuild docs, and presto! It shows up + everywhere! + +Mon Jan 10 08:33:18 HKT 2004 William Brack + + * libxslt/transform.c: Refined wrapper code with large + test case submitted by Norm Walsh. (Bug 130922) + +Sun Jan 10 23:33:21 HKT 2004 William Brack + + * libxslt/transform.c: Added coding to create a xsltDocument + wrapper for an RVT, in order to produce the applicable + keys (Bug 130922) + +Sat Jan 9 17:04:38 HKT 2004 William Brack + + * doc/search.xml, doc/search.templ, doc/Makefile.am, + doc/search.php.inc: Added new facility to "autogen" + the search script. Fixed a few more problems with + the API page generation. + * doc/site.xsl, doc/api.xsl, doc/newapi.xsl: integrated + the autogeneration of the php script. Note that from + this point doc/search.php will be include in the + generic "Rebuilt docs". + * doc/*: api docs rebuilt. + +Fri Jan 8 08:32:55 HKT 2004 William Brack + + * doc/site.xsl, doc/api.xsl, doc/newapi.xsl, doc/search.php: + Further cleanup, fully implemented common routine for + "generic page" within the docs. + * doc/*: api docs rebuilt with enhanced scripts. + +Thu Jan 8 06:45:04 MST 2004 John Fleck + + * doc/xslt.html, doc/bugs.html + made link to bugzilla more useful + +Wed Jan 7 20:12:14 HKT 2004 William Brack + + * doc/api.xsl, doc/site.xsl, doc/search.php: a little + cleanup of scripts, assuring page tables are consistent. + * doc/*: api docs rebuilt with enhanced scripts. + +Tue Jan 6 23:38:47 HKT 2004 William Brack + + * configure.in: fixed Bug130593. + * doc/apibuild.py: fixed a couple of sequence problems on + references within APIxxx.html files, rebuild doc/* (and NEWS) + +Sun Jan 4 19:06:59 MST 2004 John Fleck + + * doc/newapi.xsl: change background color of function + declaration to improve readability + * doc/*: rebuild docs with new stylesheet + +Fri Jan 2 21:42:49 MST 2004 John Fleck + + * libxslt/transform.c: fix bad doc comment formatting on + xsltDebugSetDefaultTrace and xsltDebugGetDefaultTrace + * doc/*: rebuild docs + +Wed Dec 24 15:15:52 CET 2003 Daniel Veillard + + * configure.in doc/*: prepared release of libxslt-1.1.2 + * libxslt.spec.in doc/Makefile.am: some tweaking following the + new EXSLT docs. + +Mon Dec 22 20:33:08 HKT 2003 William Brack + + * libxlst/numbers.c: fixed xsl:number level="any" for Bug + 129057 + +Sun Dec 21 21:38:11 HKT 2003 William Brack + + * libxslt/numbers.c: added namespace comparison for + xsl:number count function (Bug 129057) + +Sun Dec 21 13:56:48 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-139.xml + tests/general/Makefile.am tests/general/bug-139*: added + test for entities parsing (Bug #129489) + +Sun Dec 21 20:33:27 HKT 2003 William Brack + + * tests/docs/Makefile.am tests/docs/bug-138.xml + tests/general/Makefile.am tests/general/bug-138*: added + test for namespace problem (Bug #129624) + +Sun Dec 21 13:17:05 CET 2003 Daniel Veillard + + * xsltproc.c: fixed #129327 make sure parser flags get transmitted to + the transformation context + * libxslt/documents.c libxslt/transform.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: add a new call + xsltSetCtxtParseOptions() to update parsing options in document() + +Sun Dec 21 12:51:12 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed second problem on #122483, namespace + definitions must be propagated to keys. + * tests/docs/Makefile.am tests/docs/bug-137.xml + tests/general/Makefile.am tests/docs/bug-137*: added test + to the regression for bug #122483 + +Sun Dec 21 12:08:45 CET 2003 Daniel Veillard + + * libxslt/transform.c: added the cast needed to fix #129188 warning + +Sat Dec 20 23:37:31 HKT 2003 William Brack + + * libexslt/transform.c: fixed Bug 129624 (erroneous output + of namespaces) + +Sat Dec 20 16:22:11 HKT 2003 William Brack + + * libexslt/date.c: fixed several routines to assure empty + string returned (rather than a string object with a null + string pointer) (Bug 129561) + +Mon Dec 16 00:30:47 PST 2003 William Brack + + * doc/Makefile.am doc/site.xsl doc/api.xsl doc/newapi.xsl + doc/xslt.html doc/apibuild.py doc/EXSLT doc/EXSLT/exslt.html: + enhanced documentation to include exslt; rebuilt docs + +Mon Dec 15 20:33:52 MST 2003 John Fleck + + * libxslt/xsltutils.h + * doc/* + document XSLT_TRACE macro (sort of) and rebuild docs + +Thu Dec 11 19:50:41 CET 2003 Igor Zlatkovic + + * win32/Makefile.mingw win32/configure.js: tried to fix mingw + build, no success, it still works halfway. + +Thu Dec 11 16:33:41 CET 2003 Igor Zlatkovic + + * win32/Makefile.* win32/configure.js libxslt/xsltexports.h + libexslt/exsltexports.h libxslt/win32config.h: msvc and + mingw compilation fixes. + +Wed Dec 10 20:37:46 MST 2003 John Fleck + + * doc/xslt.html docs.html + remove reference to gtk-doc + +Wed Dec 10 17:20:27 CET 2003 Daniel Veillard + + * configure.in NEWS doc/*: updated the docs, made release 1.1.1 + +Wed Dec 10 16:13:38 CET 2003 Daniel Veillard + + * configure.in: upp'ed the dependancy to libxml2-2.6.3 + * libxslt/documents.c xsltproc/xsltproc.c: fixed #127473 + by using the new XInclude APIs provided by 2.6.3... + +Mon Dec 8 23:34:32 HKT 2003 William Brack + + * libxslt/transform.c, libxslt/xslt.c: modified to assure + XML_CDATA_SECTION_NODE's do not have xmlStringTextNoenc + set into node name. This modification arises from + bug #128520, and avoids unnecessary work in libxml2. + +Mon Dec 1 16:41:27 CET 2003 Daniel Veillard + + * libxslt/*.h *.h.in: updated the metadata informations in the headers + * doc/* doc/html/*: regenerated the docs. + +Sun Nov 30 23:25:22 HKT 2003 William Brack + + * doc/Makefile.am: small further enhancement to makefile + * doc/APIchunk[127].html, doc/libxslt-api.xml, doc/libxslt-refs.xml, + doc/html/libxslt-transform.html: updated to reflect last change + to transform.c + +Sun Nov 30 22:44:07 HKT 2003 William Brack + + * doc/newapi.xsl, doc/api.xsl, doc/apibuild.py, doc/site.xsl, + Makefile.am: adapted the libxml files for libxslt. + * doc/API*.html, doc/html/*.html, doc/libxslt-api.xml, + doc/libexslt-api.xml, doc/libxslt-refs.xml, + win32/libxslt.def.src, win32/libexslt.def.src: regenerated + the docs. + +Sun Nov 30 18:48:27 HKT 2003 William Brack + + * libxslt/transform.c: change initialisation of external functions + to take place in xsltNewTransformContext instead of in + xsltApplyStylesheetInternal. This fixes bug 122483, and should + also fix problem reported on the mailing list on today's date. + +Wed Nov 26 09:49:11 HKT 2003 William Brack + + * libxslt/imports.c, libxslt/xsltInternals.h: Changed to + detect recursion in xslt:include (bug #127687). + * tests/XSLTMark/reverser.out, + * test/docbook/result/xhtml/gdp-handbook.xhtml: results changed + because of fix of bug #127877 in libxml2 (quotes in text) + +Mon Nov 24 07:32:38 HKT 2003 William Brack + + * libxslt/xslt.c, libxslt/imports.c, libxslt/parserInternals.h: + Changed to detect recursion in xslt:import (bug #127687). + * doc/libxslt-api.xml, python/libxsltclass.txt: regenerated to + include change to xsltParseStylesheetImportedDoc parameters for + above. + +Sat Nov 22 13:04:59 CET 2003 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xsltInternals.h libxslt/xsltutils.h: + Applied patch from Mark Vadoc adding flexible trace debugging + support to the library. + +Sat Nov 22 00:53:47 HKT 2003 William Brack + + * libxslt/transform.c: fixed bug #127561 (xsl:element with a + 'computed' namespace attribute) + * tests/docs/Makefile.am tests/docs/bug-136.xml + tests/general/Makefile.am tests/docs/bug-136*: added tests + to the regression for bug #127561 + +Fri Nov 21 18:17:32 HKT 2003 William Brack + + * libxslt/keys.c: small further enhancement, bug #127450 + +Thu Nov 20 17:26:57 CET 2003 Daniel Veillard + + * libxslt/keys.c: another problem reported by Oleg Paraschenko + on the same code in #127450 + * tests/docs/Makefile.am tests/docs/bug-135.xml + tests/general/Makefile.am tests/docs/bug-135*: added tests + to the regression suite for bug #127450. + +Thu Nov 20 10:59:48 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed an error from #120684 patch raised in + #127450 + * tests/docs/Makefile.am tests/docs/bug-134.xml + tests/general/Makefile.am tests/docs/bug-134*: added tests + to the regression suite for bug #127450. + +Thu Nov 20 00:22:14 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed a bug in the keys selector parsing + #120684 when | is in a predicate or a string. + * tests/docs/Makefile.am tests/docs/bug-133.xml + tests/general/Makefile.am tests/docs/bug-133*: added tests + to the regression suite for bug #120684. + * Makefile.am: don't package cvs temp files + * doc/apibuild.py: update from libxml2 one + +Tue Nov 18 13:42:12 HKT 2003 William Brack + + * libexslt/strings.c: fixed entity problem in exslt:tokenize + uncovered by newapi.xsl + * libxslt/transform.c,libxslt/pattern.c,libxslt/keys.c: changed + to use IS_BLANK_CH for char compares (fixes warnings) + +Fri Nov 14 23:59:08 CET 2003 Daniel Veillard + + * libxslt/preproc.c: applied fix from Bjorn Reese to close + number formatting bug #126994 + +Fri Nov 14 18:44:50 CET 2003 Daniel Veillard + + * Makefile.am configure.in libexslt.pc.in libxslt.spec.in: adding + libexslt.pc support + +Thu Nov 13 11:54:36 CET 2003 Daniel Veillard + + * libxslt/attributes.c libxslt/documents.c libxslt/transform.c + libxslt/variables.c libxslt/xsltInternals.h: applied Mark Vakoc + patch to moves the control of the XSLT debugger into the transform + context. + +Tue Nov 12 18:17:24 HKT 2003 William Brack + + * libexslt/functions.c: applied patch for param visibility from + Shaun McCance. Changed variable scoping in accordance with + Shaun's suggestions. This fixed problem reported on the list + by Bernd Lang + * tests/exslt/functions/function.8.[xml,xsl,out], Makefile.am: + regression test for above + +Sat Nov 8 13:27:12 CET 2003 Daniel Veillard + + * libexslt/libexslt.3: applied improvement patch from Jonathan Wakely + describing the entry points. + +Wed Nov 6 17:27:23 CET 2003 Igor Zlatkovic + + * win32/configure.js: fixed #122146 + +Wed Nov 5 12:25:34 CET 2003 Daniel Veillard + + * tests/multiple/Makefile.am: applied last fix from #125614 + +Tue Nov 4 19:08:53 PST 2003 William Brack + + Minor enhancements to eliminate compile/test warnings + * libxslt/xsltconfig.h.in, libexstl/exsltconfig.h.in: + changed macro ATTRIBUTE_UNUSED for gcc so that, if undefined, + it's defined as __attribute__((unused)) + * python/libxslt.c: fixed ATTRIBUTE_UNUSED to appear after + variable declaration + * libxslt/preproc.c: minor change to get rid of unused var/code + +Tue Nov 4 14:21:06 CET 2003 Daniel Veillard + + * doc/* NEWS: preparing release 1.1.0 + +Tue Nov 4 14:04:58 CET 2003 Daniel Veillard + + * libxslt/preproc.c: fixing the Document element precompilation + to avoid the problem raised in #125614 + +Tue Nov 4 01:08:17 PST 2003 William Brack + + * tests/multiple/out/letter*.orig: updated to reflect change + to HTML output in libxml2 (formatting of

, bug #125093) + +Sun Nov 2 09:07:32 PST 2003 William Brack + + * libxslt/xslt.c: fixed bug #124286 - detect invalid name on + template + +Sun Nov 2 10:51:58 CET 2003 Daniel Veillard + + * Makefile.am configure.in libxslt.spec.in doc/libxslt-api.xml + libxslt/xslt.h libxslt/xsltwin32config.h: some cleanup and trial + for the upcoming 1.1.0 release + * breakpoint/*: this release removes the deprecated breakpoint library + +Sat Nov 1 17:04:27 PST 2003 William Brack + + * libxslt/transform.c, tests/general/bug-119.out: fixed + bug #125502 and corrected expected test output + * tests/general/bug-79.out: fixed broken test (bug #123328) + * libxslt/pattern.c, libexslt/functions.c: minor change to + eliminate compilation warning + +Sat Nov 1 22:36:30 CET 2003 Daniel Veillard + + * tests/REC/test-5.2-17.xsl tests/REC/test-5.2-18.xsl: fixing two + broken tests (revealed by #125502) + +Sat Nov 1 07:41:06 CET 2003 Daniel Veillard + + * libexslt/strings.c: fix bug #125265 about entities breaking + exsl:tokenize and exsl:split + * tests/exslt/strings/split.1.* tests/exslt/strings/tokenize.1.*: + augmented the reression tests with the example from the bug report. + +Fri Oct 31 20:26:04 CET 2003 Daniel Veillard + + * libxslt/preproc.c: fix bug #120828 make sure that xsl:sort is + empty. + +Fri Oct 31 15:53:45 CET 2003 Daniel Veillard + + * libxslt/documents.c libxslt/imports.c libxslt/xslt.c libxslt/xslt.h + xsltproc/xsltproc.c: switch to use xmlReadfile instead of + xmlParseFile, this avoid relying on global parser options, far + far cleaner. + * tests/XSLTMark/xslbench1.out tests/general/bug-90.out: fixes a + slightly corrected output for CDATA and STYLE element save. + +Tue Oct 28 15:30:54 CET 2003 Daniel Veillard + + * configure.in python/Makefile.am python/tests/Makefile.am: applied + patch from Roumen Petrov for bug #124539 when building outside the + source directory + * libxslt/xsltutils.c: fixed the way to grab the line number from + the document, use the predefiend libxml2 API which mate it work + with both 2.5.x and 2.6.x + +Mon Oct 27 08:57:43 HKT 2003 William Brack + + * libxslt/xslt.c: put in #undef for IS_BLANK macros to fix + problem reported on the mailing list by Justin Fletcher + +Fri Oct 24 00:49:05 CEST 2003 Daniel Veillard + + * configure.in libxslt.spec.in: doing some testing and raising + the build requirement to 2.5.10 + * libexslt/Makefile.am configure.in: applied patch from Graham Wilson + for linking the exslt lib with the lib being build instead of the + installed one + +Thu Oct 23 15:48:39 HKT 2003 William Brack + + * libxslt/pattern.c: Fixed problem with cascaded predicates + (more of bug 119946) + +Thu Oct 23 15:37:26 HKT 2003 William Brack + + * restored earliest portion of ChangeLog (was corrupted) + +Wed Oct 22 13:07:50 CEST 2003 Daniel Veillard + + * libxslt/xsltutils.[ch]: applied patch from Kasimier Buchcik + for xsltGetDebuggerStatus and xsltSetDebuggerStatus + * doc/libxslt-api.xml: regenerated the API + +Sun Oct 19 23:32:23 CEST 2003 Daniel Veillard + + * configure.in: bump the libxml2 require to 2.6.0 which + should ship for good real soon... + * doc/Makefile.am: fix installation of HTML pages + * doc/libxslt-api.xml: rebuilt + * libxslt/xsltexports.h: cleanup + * python/generator.py: ATTRIBUTE_UNUSED is after the parameter + * xsltproc/xsltproc.c: applied Crutcher Dunnavant --load-trace patch 2 + +Fri Oct 17 18:25:42 HKT 2003 William Brack + + * libxslt/attributes.c: fixed bug 123822 + +Fri Oct 17 12:40:37 HKT 2003 William Brack + + * libxslt/pattern.c: fixed bug 119946 + * configure.in: enhanced for better devel (me) testing + +Wed Oct 15 17:30:43 CEST 2003 Daniel Veillard + + * configure.in: applied a small patch from Troels Walsted Hansen + for python libxml2 detection. + +Sat Sep 27 18:42:57 PDT 2003 William Brack + + * libxslt/numbers.c, libxslt/extensions.c, libexslt/date.c, + python/libxslt.c, xsltproc/xsltproc.c: minor cleanup for + various compilation warnings (AIX as well as gcc) + +Sat Sep 27 17:29:43 CEST 2003 Daniel Veillard + + * libexslt/saxon.c: applied patch from Brett Kail to implement + saxon:line-number() + +Thu Sep 25 11:46:40 CEST 2003 Daniel Veillard + + * libxslt/extensions.h libxslt/extra.h: fix some header paths + as pointed by Steve Ball + +Wed Sep 24 23:31:45 CEST 2003 Daniel Veillard + + * libxslt/extensions.c: applied patch from Karl Eichwalder + apparently the xmlFree was introducting a memory error + on x86_64, though not reproduced. + * libxslt/transform.c: patch from Shaun McCance fixing a comment. + +Thu Sep 18 11:32:20 CEST 2003 Daniel Veillard + + * python/libxslt.c: don't output errors to stdout by default + use stderr instead. + +Thu Sep 18 11:28:43 CEST 2003 Daniel Veillard + + * libxslt/functions.c libxslt/numbers.c: small fixes w.r.t. + IS_XSLT_REAL_NODE change + * python/Makefile.am Makefile.am: some makefile "distclean" + target improvement from Graham Wilson + * xsltproc/xsltproc.c: small fix from Alexey Efimov for options + display. + +Mon Sep 15 07:41:14 PDT 2003 William Brack + + * libxslt/xsltutils.h: Added XML_PI_NODE to the macro + IS_XSLT_REAL_NODE, fixed bug 120644. + +Sat Sep 13 02:04:13 CEST 2003 Daniel Veillard + + * xsltproc/xsltproc.c doc/xsltproc.1 doc/xsltproc.xml + libxslt/xsltutils.h: removing the DocBook SGML support + +Fri Sep 12 13:52:07 CEST 2003 Daniel Veillard + + * configure.in: preparing release libxslt-1.0.33 + * doc/*: updated and rebuilt the docs + * doc/apibuild.py: small fixes for new tokens + +Wed Sep 10 23:32:42 PDT 2003 William Brack + + * transform.c: enhanced previous fix to bug #120684, using + excellent suggestion by Daniel + * attributes.c: fixed bug #119583, merging attribute sets + from imported stylesheets. + * tests/docs/Makefile.am tests/docs/bug-131.xml + tests/general/Makefile.am tests/docs/bug-131*: added tests + to the regression suite for bug #120684. + +Sat Sep 6 09:57:03 PDT 2003 William Brack + + * pattern.c pattern.h imports.c: fixed bug 119946, caused by + incorrect creation of "extra" variables when compiling + templates on imported stylesheets. + * tests/docs/Makefile.am tests/docs/bug-130.xml tests/docs/bug-130.doc + tests/general/Makefile.am test/docs/bug-130*: added tests + to the regression suite for this bug. + + +Wed Sep 3 15:33:40 CEST 2003 Daniel Veillard + + * tests/xmlspec/*.html: tyny change HTML -> html DOCTYPE due to + a libxml2 change + +Tue Sep 2 18:22:46 PDT 2003 William Brack + + * transform.c: fixing bug #120684 on crash caused by text between + apply-templates + +Tue Sep 2 16:05:37 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: defined additional + macros which affect exports and added mingw section + +Mon Sep 1 23:02:12 CEST 2003 Daniel Veillard + + * libxslt/function.c: patch from Mark Vadoc to allow compiling + against libxml2 without XPointer supoort. + +Fri Aug 29 12:28:12 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing the bug #120971 on cdata-section-elements + with namespaced names reported by Steve Hay + * tests/docs/Makefile.am tests/docs/bug-129.* + tests/general/Makefile.am tests/general/bug-129*: added the + test to the regression suite for this bug. + +Thu Aug 28 18:30:11 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: fixed typos reported by + Mark Vakoc + +Wed Aug 27 12:07:13 CEST 2003 Igor Zlatkovic + + * libxslt/*.h: realigned parameters after taint + +Wed Aug 27 09:59:54 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: fixed defs for + Borland compiler, as reported by Eric Zurcher + +Mon Aug 25 13:39:40 CEST 2003 Daniel Veillard + + * libxslt/Makefile.am libexslt/Makefile.am: add the new header so they + get included in the distrib + +Mon Aug 25 11:56:02 CEST 2003 Igor Zlatkovic + + * libxslt/*.h libexslt/*.h: exportability taint of the headers. + * libxslt/xsltexports.h libexslt/exsltexports.h: new files, + contain the export defs. + +Tue Aug 19 00:38:46 CEST 2003 Daniel Veillard + + * xsltproc/Makefile.am libxslt/libxslt.h libxslt/numbersInternals.h + libexslt/*.c configure.in: applied patch from Mikhail Grushinskiy + for compilation with MingW compiler on Windows. + +Mon Aug 18 14:42:12 HKT 2003 William Brack + + * keys.c: enhanced xsltInitCtxtKey to take care of multiple + instances of a key with the same namespace:name, reported + on the mailing list by Ian Young. Added regression test + (bug-128). + +Thu Aug 15 13:00:02 HKT 2003 William Brack + + * variables.c: fixed bug 119699 (missing error on shadowed + variable) + * autogen.sh: removed dependency on automake-1.4, updated + links for fetching auto* tools + * doc/Makefile.am: added check for automatic regeneration of + win32/*.def.src when api xml files are updated. + +Thu Aug 14 23:15:14 HKT 2003 William Brack + + * transform.c: fixed bug 114563 (params not passed when + default template processed) + +Thu Aug 14 22:04:37 HKT 2003 William Brack + + * xslt.c: fixed bug 119862 (missing param on ns error print) + +Sun Aug 10 00:21:48 CEST 2003 Daniel Veillard + + * News configure.in: preparing libxslt-1.0.32 release + * doc/* : updated the doc and rebuilt + +Thu Aug 7 21:02:07 HKT 2003 William Brack + + * breakpoint/Makefile.am: removed ref to libxslt.la + * numbers.c transform.c python/libxml_wrap.h python/types.c + xlstproc/xsltproc.c: Minor cleanup of warning errors + +Mon Aug 4 22:43:05 CEST 2003 Daniel Veillard + + * doc/libxslt-api.xml doc/* doc/html/*: revuilt the API and docs + +Sun Aug 3 21:34:44 EDT 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-127.* + tests/general/Makefile.am tests/general/bug-127*: added the + test from bug #118763 to the regression suite. + +Sun Aug 3 17:40:13 EDT 2003 Daniel Veillard + + * xsltproc/xsltproc.c: minor change, avoid wasting CPU cycles + +Sun Aug 3 21:05:07 HKT 2003 William Brack + + Minor cleanup of regression test general/bug-125 + +Sun Aug 3 19:46:42 HKT 2003 William Brack + + Fixed bug 116517 - handling of '{' and '}' + * templates.c: added checks for escaping and balancing of + curly brackets + * tests/general/Makefile.am tests/docs/Makefile.am: + Added test case (bug-126) to regression suite. + +Sun Aug 3 15:50:51 HKT 2003 William Brack + + Fixed bug 117552 - sort with multiple keys + * xsltutils.c: enhanced treatment of NaN when multiple sort + keys are specified. + * tests/general/Makefile.am tests/docs/Makefile.am: + Added test case (bug-125) to regression suite. + +Sat Aug 2 09:55:38 HKT 2003 William Brack + + Fixing bug 118561 (IRIX MIPSPro compiler warnings) + * transform.c, variables.c, xslt.c, xsltutils.c: + removed some unused variables + +Thu Jul 31 20:33:12 HKT 2003 William Brack + + Fixing bug 118558 (Solaris 8 compiler warnings) + * xslt.c: minor re-ordering of code + * functions.c: added an explicit cast + * number.c: added include for string.h + * security.c: added an explicit cast + +Tue Jul 29 12:43:17 HKT 2003 William Brack + + * libexslt/date.c test/exslt/data/seconds.1 : changed sign + of date:seconds as previously posted to the mailing list + * numbers.c: extensive modification to cater for UTF8 within + the various routines. + +Thu Jul 24 19:38:56 IST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Shaun McCance to fix bug + #117616 about EXST str:tokenize. + * tests/exslt/strings/Makefile.am tests/exslt/strings/tokenize.3.*: + added the test in the regression suite. + +Wed Jul 23 21:57:39 IST 2003 Daniel Veillard + + * xsltproc/xsltproc.c: applying a patch based on #117377 + for --path option. + +Mon Jul 21 20:28:11 IST 2003 Daniel Veillard + + * libxslt/transform.c: allow strip-space to support full namespaces + using prefix:* , should fix #114287 + * tests/docs/Makefile.am tests/docs/bug-124.* + tests/general/Makefile.am tests/general/bug-124*: added a + test to the regression suite for this bug. + +Mon Jul 21 20:09:57 IST 2003 Daniel Veillard + + * libxslt/tramsform.c: make xsl:copy on attribute a copy in case + the attribute was already defined, should fix bug #113812 + * tests/docs/Makefile.am tests/docs/bug-123.* + tests/general/Makefile.am tests/general/bug-123*: added the + test to the regression suite. + +Fri Jul 18 13:13:52 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Shaun McCance to implement + exslt:split c.f. #117752 + * tests/exslt/strings/Makefile.am tests/exslt/strings/split.1.*: + added the test to the regression suite. + +Thu Jul 17 10:35:22 CEST 2003 Daniel Veillard + + * libxslt/numbers.c: quick fix for an HP-UX compilation problem, + might require more attention could be an Unicode support breakage. + +Wed Jul 16 10:46:35 CEST 2003 Daniel Veillard + + * libxslt/numbers.c libxslt/transform.c libxslt/transform.h + libxslt/xsltInternals.h: optimize text node coalescing by + caching info about the last text node generated and doing + fast alloc/copy of the text. Should fix #115273 + +Mon Jul 14 13:00:00 HKT 2003 William Brack + + * fixed bug 113520, incorrect result for date:seconds + with change to type casting in libexslt/date.c + +Sat Jul 12 20:35:28 HKT 2003 William Brack + + * fixed bug 114764: trouble with globals and RVT's + with minor changes in variables.c and transform.c + so that any global instantiated with an RVT gets + uninitialized when the RVT is destroyed. + +Thu Jul 10 15:47:33 CEST 2003 Daniel Veillard + + * libxslt/transform.c: simple cast missing Peter Breitenlohner + * breakpoint/Makefile.am: added deps to libxslt + * tests/exslt/common/Makefile.am: integrated William Brack test + in the regression suite + +Wed Jul 9 21:27:43 HKT 2003 William Brack + + * fixed bug 114812, trouble with imported exslt functions + added lookup function in libxslt/extension.c + enhanced exsltInitFunc in libexslt/functions.c to take + better care of imports + +Wed Jul 9 12:19:34 CEST 2003 Daniel Veillard + + * python/generator.py python/libxslt-python-api.xml python/libxslt.c + python/libxslt_wrap.h python/libxsltclass.txt: patch from + Sean Treadway, adding Python bindings for extension element and + some bindings cleanups. + * python/tests/Makefile.am python/tests/extelem.py: also add an + example/test. + +Tue Jul 8 12:20:11 CEST 2003 Daniel Veillard + + * python/libxml_wrap.h: applied patch from #116943 which should + fix the xsltSaveResultToFile python binding. + +Mon Jul 7 11:03:18 CEST 2003 Daniel Veillard + + * INSTALL: removed an old reference to libxml2 >= 2.2.12 + +Sun Jul 6 23:57:35 CEST 2003 Daniel Veillard + + * configure.in: releasing 1.0.31 + * doc/*: update and rebuild of the docs + +Sun Jul 6 18:31:56 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #115913 for xsl:copy with namespace + nodes. + * tests/docs/Makefile.am tests/docs/bug-122.* + tests/general/Makefile.am tests/general/bug-122*: added the + test to the regression suite. + +Sun Jul 6 18:09:13 CEST 2003 Daniel Veillard + + * libxslt/preproc.c: fix bug #115778 for attribute value template + on xsl:sort order + +Sun Jul 6 17:22:35 CEST 2003 Daniel Veillard + + * libxslt/documents.c libxslt/transform.c: applied patch from + Keith Isdale to desactivate node numbering when running under + the debugger. + +Sun Jul 6 00:00:31 CEST 2003 Daniel Veillard + + * libxslt/security.c: fix the write checking code when + the output filename does not parse as an URL bug #115402 + +Sun Jun 22 19:38:04 CEST 2003 Daniel Veillard + + * libxslt/Makefile.am: Albert Chin pointed out that trio.h and + triodef.h were missing from the distribution + +Fri Jun 13 16:53:33 CEST 2003 Daniel Veillard + + * libxslt.spec.in libexslt/Makefile.am libexslt/libexslt.3 + libxslt/Makefile.am libxslt/libxslt.3: Moved the man pages + to section 3 + * libexslt/sets.c: applied patch from Peter Breitenlohner + * doc/*: rebuilt the docs + * tests/docbook/result//* tests/xmlspec/*.html: changes in + generattion of " as " in element content. + +Sun Jun 08 22:57:13 CEST 2003 Igor Zlatkovic + + * libxslt/transform.c: changed xsltChoose to ignore whitespace + which is a sibling of xsl:when + +Sat May 31 17:18:21 CEST 2003 Igor Zlatkovic + + * libxslt/xslt.c: fixed a possible crash when the document + wasn't a proper stylesheet. + +Tue May 20 12:14:12 CEST 2003 Daniel Veillard + + * libxslt/variables.c: fixes a 64bits cleanliness issue #113318 + +Sat May 17 13:25:32 CEST 2003 Igor Zlatkovic + + * win32/defgen.xsl: new file, generates the export sources. + * win32/*.def.src: these are now autogenerated, changes to these + will not be logged anymore. + +Fri May 16 13:22:31 EDT 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-121.* + tests/general/Makefile.am tests/general/bug-121*: added the + example for bug #112904 in the regression tests, the bug fix is + actually in libxml2 + +Thu May 15 16:26:34 EDT 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixing portability bug #113002 on HP-UX + * configure.in libxslt.spec.in python/Makefile.am: cleanup + of --with-python like for libxml2 + +Thu May 15 11:45:00 HKT 2003 William Brack + + * libxslt/xsltutils.c: fixing bug #112995, a problem with + NaN within the sort element. Also added regression test. + +Tue May 13 18:22:38 EDT 2003 Daniel Veillard + + * doc/Makefile.am: fixing bug #112803 , make sure to avoid + network accesses when building + +Sat May 10 14:19:14 EDT 2003 Daniel Veillard + + * libxslt/transform.c: fixed a segfault introduced with the RVT + handling change, bug #112703 . + +Sat May 10 13:05:21 EDT 2003 Daniel Veillard + + * libxslt/xslt.c: make sure stylesheet compilation errors + forces a NULL stylesheet, fixes #112270 + +Sun May 4 17:41:23 CEST 2003 Daniel Veillard + + * NEWS configure.in : preparing release 1.0.30 + * doc/apibuild.py: backported a patch from libxml2 + * doc/*: updated and rebuilt the docs + +Wed Apr 30 22:44:49 CEST 2003 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h: + cleaning up Result Value Tree handling + * libexslt/functions.c libexslt/strings.c: fixed a pair of + implementations. + * tests/exslt/strings/Makefile.am tests/exslt/strings/tokenize.2.*: + added Mark Vakoc test combining for-each and exslt:tokenize + +Wed Apr 30 15:23:33 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #111755 when a template is + applied to an attribute + * tests/docs/Makefile.am tests/docs/bug-119.* + tests/general/Makefile.am tests/general/bug-119*: added the + example in the regression tests for that bug. + +Tue Apr 29 15:18:31 CEST 2003 Daniel Veillard + + * doc/Makefile.am doc/libxslt.xml: upgraded to the XML/XSLT toolchain + for the HTML generation fixing #111799 + * doc/html/*.html doc/html/*.png: associated update + +Sun Apr 27 18:00:12 CEST 2003 Igor Zlatkovic + + * libxslt/variables.c: removed premature call to xsltFreeStackElem + * win32/libxslty.def.src: added more exports + +Sun Apr 27 12:46:31 CEST 2003 Daniel Veillard + + * NEWS doc/*.xsl doc/*.html: updated the web site, made the + transition to XHTML1 added validity checking to the makefile rules. + +Sat Apr 26 14:00:58 CEST 2003 Daniel Veillard + + * python/generator.py: fixed a problem in the generator where + the way functions are remapped as methods on classes was + not symetric and dependant on python internal hash order, + as reported by Stéphane Bidoul + * libexslt/strings.c: attempt at fixing an object type pbm + * libxslt/triodef.h: update for OpenVMS from libxml2 + +Fri Apr 25 15:26:26 CEST 2003 Daniel Veillard + + * doc/Makefile.am doc/xsltproc.1 doc/xsltproc.xml: automated the + generation of the man page + +Wed Apr 23 23:27:44 CEST 2003 Daniel Veillard + + * libexslt/sets.c: fixed a bug introduced in the last commit + * libxslt/transform.c: tried to fix #111437 + * tests/docbook/result/xtchunk/html/*.orig + tests/multiple/out/*.orig: side effect of #111437 change. + +Wed Apr 23 22:41:08 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied last patch for #110023 from + Mark Vakoc + * libexslt/sets.c: fixed a memory leak when mixing one of the + EXSLT set functions and a Result Value Tree + * TODO: there are other bugs around in libexslt/sets.c in conjunction + with Result Value Tree + +Wed Apr 23 17:00:16 CEST 2003 Daniel Veillard + + * libxslt/extensions.c: patch from Vasily Tchekalkin fixing + bug #111420 about double initialization of extension contexts + +Wed Apr 23 14:25:46 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fix bug #110577 namespace in copy-of + don't obbey the same rules as for literal reusl elements. + * tests/docs/Makefile.am tests/docs/bug-118.* + tests/general/Makefile.am tests/general/bug-118*: added the + example in the regression tests for that bug. + * libxslt/variables.c: fixed a bug introduced in fixing #110020 + * tests/docs/Makefile.am tests/docs/bug-11[67].* + tests/general/Makefile.am tests/general/bug-11[67]*: added 2 + regression tests one still exposing a mem leak (Mark Vadoc). + +Tue Apr 22 16:01:25 CEST 2003 Daniel Veillard + + * libxslt/pattern.c: fix a memory related segfault on a + pattern compilation error #110189 + +Tue Apr 22 15:45:25 CEST 2003 Daniel Veillard + + * libxslt/variables.c: fixing bug #110020 on global parameter + and variables mismatch + * tests/reports/Makefile.am tests/reports/cmdlineparams.*: added + the test to the regression suite + +Mon Apr 21 12:22:31 CEST 2003 Daniel Veillard + + * libexslt/math.c: applied patch from Charles Bozeman fixing + the math power function where args were inverted #110996 + * tests/exslt/math/Makefile.am tests/exslt/math/power.1.*: + added the test to the regraession for #110996 + * libexslt/sets.c: avoid a problem with nodesets. + +Wed Apr 14 18:10:21 CEST 2003 Igor Zlatkovic + + * libxslt/win32config.h: added HAVE_MATH_H + +Wed Apr 13 14:04:15 CEST 2003 Igor Zlatkovic + + * win32/Makefile.msvc: fixed compilation with thread-enabled + libxml + +Wed Apr 9 22:02:17 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Mark Vakoc fixing a problem + with RTF in libexslt + +Mon Apr 7 14:39:01 CEST 2003 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c: Fixes bug #110023 reported by Mark Vakoc and + other places where ctxt->document pointer may be used without + checking it agaisnt NULL. + * tests/docs/Makefile.am tests/docs/bug-115.* + tests/general/Makefile.am tests/general/bug-115*: added the + example in the regression tests for that bug. + * libxslt/trio.h libxslt/triodef.h: update of Trio from Bjorn Reese + +Tue Apr 1 13:39:26 CEST 2003 Daniel Veillard + + * configure.in NEWS: preparing 1.0.29 release + * libxslt/documents.c: generate the document order for document() + loaded resources. + * doc/*: updated and regenerated the docs + +Tue Apr 1 11:28:01 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixed a namespace redundancy problem + in xsl:element + * tests/docs/Makefile.am tests/docs/bug-114.* + tests/general/Makefile.am tests/general/bug-114*: added an + example in the regression tests for that bug. + +Fri Mar 28 12:19:35 CET 2003 Daniel Veillard + + * python/libxsl.py: fix bug #109395 as pointed out by Ben Phillips + and avoid some warnings when loading the python modules on non + Linux platforms. + * libxslt/transform.c: fix a bug introduced in the document lookup + and exhibited by the keys test. + +Wed Mar 26 22:41:00 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-113.* + tests/general/Makefile.am tests/general/bug-113*: added an + example in the regression tests for bug #109160 fixed in libxml2 + +Wed Mar 26 21:43:30 CET 2003 Daniel Veillard + + * configure.in python/Makefile.am python/libxslt.c libxslt/xsltutils.c + libxslt/trio.h libxslt/triodef.h: portability fixes from Albert Chin + * python/libxslt.py: avoid RTLD_GLOBAL detection warning too + +Wed Mar 26 19:08:55 CET 2003 Daniel Veillard + + * libxslt/transform.c: forgot to make one change related to + Result Value Tree change, pointed out by Sebastian Rahtz + * tests/docs/Makefile.am tests/docs/bug-112.* + tests/general/Makefile.am tests/general/bug-112*: added an + example in the regression tests that bug + +Wed Mar 26 01:38:38 CET 2003 Daniel Veillard + + * libxslt/transform.c: second part of the patch fixing #108905 + performances problems, ask for computation of document order on + the document transformed and avoid inefficiencies building large + nodesets of unique nodes. + * configure.in: fix a trouble with libtool in my debug environment. + +Mon Mar 24 22:30:00 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c libxslt/variables.c: + Result Value Tree are now generated with a document root node + not an element, it's quite cleaner. + * configure.in libxslt.spec.in NEWS: But this requires libxml2-2.5.5 + also prepared for libxslt-1.0.28 release + * doc/*: updated and regenerated the docs + +Mon Mar 24 15:01:07 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c libxslt/variables.c: + Finally fixed bug #75813, processing or Result Value Tree + converted into node-sets should be a bit more sensible now. + * tests/exslt/common/node-set.2.out: the associated fix in libxml2 + fixes this regression test, there is 4 nodes, not 3 + * tests/docs/Makefile.am tests/docs/bug-111.* + tests/general/Makefile.am tests/general/bug-111*: added an + example in the regression tests for bug #75813 + +Sun Mar 23 13:09:17 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-110.* + tests/general/Makefile.am tests/general/bug-110*: added an + example in the regression tests for bug #108976 which is + fixed in libxml2 + +Sat Mar 22 12:35:47 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-109.xml + tests/general/Makefile.am tests/general/bug-109*: added an + example in the regression tests for the invalid bug #108716 + +Sat Mar 22 12:01:24 CET 2003 Daniel Veillard + + * libxslt/variables.c: fixed bug #108633 reported by + Jerome Pesenti about recursive global variables/param detections + * tests/reports/Makefile.am tests/reports/rec*: added regression + tests for the checking of recusion in global/local param/variables. + +Fri Mar 7 16:08:24 CET 2003 Daniel Veillard + + * libxslt/numbers.c: valgrind pointed out an uninitialized + variable use in format-number() + +Fri Mar 7 15:27:56 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-108.xml + tests/general/Makefile.am tests/general/bug-108*: added an + example in the regression tests bug #107804 fixed in libxml2 + +Wed Mar 5 12:47:31 CET 2003 Daniel Veillard + + * libxslt/pattern.c: fixed bug #107591 node() in pattern + matches should catch comments and PIs + * tests/docs/Makefile.am tests/docs/bug-107.xml + tests/general/Makefile.am tests/general/bug-107*: added an + example in the regression tests for this case + +Wed Feb 26 16:49:17 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-106.xml + tests/general/Makefile.am tests/general/bug-106*: added the next + example for bug #106788 from James Clark in the regression tests, + the bug fix is actually in libxml2 + +Tue Feb 25 16:19:45 CET 2003 Daniel Veillard + + * configure.in doc/Makefile.am xsltproc/Makefile.am: some cleanup + for Python checks, makefile cleanup, and convenience changes + +Mon Feb 24 23:49:01 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: had to comment out Igor last change + since it made libxslt-1.0.27 depends on libxml2 newly + API extension which hasn't propagated yet :-( + +Mon Feb 24 22:21:09 CET 2003 Daniel Veillard + + * configure.in: preparing release 1.0.27 + * doc/*: updated and rebuilt the docs + +Mon Feb 24 19:43:15 CET 2003 Daniel Veillard + + * libxslt/namespaces.c: fixed #106554 for spurious xmlns:nsX="" + generation + +Sun Feb 23 14:52:57 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-105.xml + tests/general/Makefile.am tests/general/bug-105*: added the + example for bug #106788 from James Clark in the regression tests, + the bug fix is actually in libxml2 + +Sun Feb 23 14:25:13 CET 2003 Daniel Veillard + + * libxslt/namespaces.c libxslt/transform.c: fixed bug #106789 from + James Clark and a bit of cleanup + * tests/docs/Makefile.am tests/docs/bug-104.xml + tests/general/Makefile.am tests/general/bug-104*: added the + example in the regression tests for this case + +Fri Feb 21 17:07:59 CET 2003 Daniel Veillard + + * libxslt.spec.in: fixed RH#84801 wrong prereqs in the spec file + +Wed Feb 19 18:51:06 CET 2003 Igor Zlatkovic + + * libxslt/functions.c libxslt/xslt.c: fixed bug 106251 + +Wed Feb 19 15:52:33 CET 2003 Igor Zlatkovic + + * xsltproc/xsltproc.c: obsoleted xmlNormalizeWindowsPath + * win32/configure.js: included handling of the trio option + +Mon Feb 10 17:34:32 CET 2003 Daniel Veillard + + * configure.in doc/*: preparing release 1.0.26 + +Fri Feb 7 15:47:20 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixing another bug in document(), bug #105450 + * tests/documents/test_bad.result: Slight change to the output + +Fri Feb 7 15:34:24 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixing a segfault in document(), bug #105418 + * tests/documents/Makefile.am tests/documents/test_bad: add the + specific test as suggested by Jean T Anderson + +Fri Feb 7 14:18:40 CET 2003 Daniel Veillard + + * libxslt/extensions.c libxslt/keys.c libxslt/pattern.c + libxslt/preproc.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c: tried to fix 105387 and all similar cases + in the library sources. + +Wed Feb 5 16:04:10 CET 2003 Daniel Veillard + + * doc/* configure.in: preparing for release of 1.0.25 + +Wed Feb 5 00:07:43 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixed bug #99623 + +Tue Feb 4 22:10:17 CET 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #105116 sometimes one need + to generate a default namespace reset xmlns="" in the output + * tests/docs/Makefile.am tests/docs/bug-103.xml + tests/general/Makefile.am tests/general/bug-103*: added the + example in the regression tests for this case + +Tue Feb 4 18:39:35 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c: changed the way the + root element of value tree are handled to fix bug #104123 + +Tue Feb 4 18:15:01 CET 2003 Daniel Veillard + + * README: change of policy w.r.t. mails + * configure.in: small cleanup + * libxslt/transform.c libxslt/xslt.c libxslt/variables.c: fixed + a couple of bugs raised by Eric van der Vlist in #104114 + * tests/exslt/*/*.out: slight change to the tests + +Tue Feb 4 17:18:54 CET 2003 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: fixing bug #104096, put + emphasis on the fact that --docbook should not be used + for XML. + +Wed Jan 22 16:43:49 CET 2003 Daniel Veillard + + * python/libxslt.c: fixed a couple of return error #104150 + reported by Peter O'Shea + +Fri Jan 17 17:43:43 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixed a double free of stylesheet + when applied to a standalone stylesheet + +Tue Jan 14 16:22:48 CET 2003 Daniel Veillard + + * configure.in: preparing release 2.0.24 + * libxslt.spec.in: small update + * doc/*: updated the news, rebuilt the APIs descriptions + +Tue Jan 14 14:23:47 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixed #101502 by applying and cleaning up + the associated patch from Daniel Stodden. + * tests/documents/Makefile.am tests/documents/fragment*: added a + specific test. + +Mon Jan 13 23:25:59 CET 2003 Daniel Veillard + + * libxslt/extensions.c libxslt/transform.c: fixing bug #101602 + for extension modules init and shutdown callbacks, check that + they are now called when needed. + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c: + started adding the extension module support at the Python level. + Still a strange bug to hunt down left. + +Sun Jan 12 23:56:18 CET 2003 Daniel Veillard + + * libxslt/attributes.c libxslt/xsltInternals.h libxslt/imports.c + libxslt/xslt.c: fixed bug #101003 on attribute-sets value + computation in the presence of imports + * tests/docs/Makefile.am tests/docs/bug-102.xml + tests/general/Makefile.am tests/general/bug-102*: added an + example in the regression tests for this case + +Fri Jan 10 10:34:23 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: final touch to #102800 fix + +Thu Jan 9 18:17:40 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: tried to fix #102800 for good. Reenabled + memory debug checking which got deactivated at some point ?!? + * libexslt/date.c libxslt/attributes.c: fixing some memory leaks + * libxslt/xsltutils.c: very small change on HTML indentation handling + +Thu Jan 9 14:28:19 CET 2003 Daniel Veillard + + * tests/REC/test-8-1.xsl tests/REC/test-9.1-2.xsl + tests/general/bug-83.xsl tests/multiple/dict.xsl: added some + exclude-result-prefixes to avoid extra namespace declaration being + dumped following the fix for #102920 in libxml2 + +Wed Jan 8 12:33:47 CET 2003 Daniel Veillard + + * libxslt/transform.c: fixed a problem related to directory + checking and creation raised by Craig Goss + +Thu Jan 2 23:23:30 CET 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Jörg Walter to provide + URI escaping and unescaping functions. + +Thu Dec 26 15:43:31 CET 2002 Daniel Veillard + + * libexslt/strings.c: Alexey Efimov found a typo bug in + exsltStrPaddingFunction() + +Mon Dec 23 15:43:59 CET 2002 Daniel Veillard + + * python/libxslt.c: patch from Stéphane Bidoul for Python 2.1 + +Sun Dec 22 22:54:04 CET 2002 Daniel Veillard + + * vms/build_xslt.com libxslt/xsltconfig.h.in libxslt/xsltutils.c: + applied patch from Craig A. Berry for the VMS port. + +Wed Dec 18 15:41:21 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h: increase the max number of cascaded + sort operations. + * AUTHORS doc/* win32/*: updated Igor's mail and the Web page for + the Windows binaries. + +Mon Dec 16 19:31:16 CET 2002 Igor Zlatkovic + + * win32/libxslt.def.src: added more exports for Stephane Bidoul + +Fri Dec 13 14:50:12 CET 2002 Daniel Veillard + + * doc/apibuild.py doc/libexslt-api.xml doc/libxslt-api.xml: updated + the apibuilder script, regenerated the APIs + +Fri Dec 13 11:59:07 CET 2002 Daniel Veillard + + * libxslt/numbers.c: numbering should not traverse XInclude + nodes left in the tree. Closes bug #101114 raised by + Bernd Kuemmerlen + +Thu Dec 12 01:17:09 CET 2002 Daniel Veillard + + * doc/apibuild.py: fixed a bug in merging public info from + C modules. + * win32/Makefile.msvc win32/configure.js: patch from Mark Vakoc + the iconv option to configure.js didn't work, and + added zlib option needed when linking xsltproc statically + +Wed Dec 11 19:18:45 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/apibuild.py doc/libexslt-api.xml: added + the generation of libexslt-api.xml + * libexslt/exslt.h: small cleanup. + +Wed Dec 11 18:45:09 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/apibuild.py doc/libxslt-api.xml: + copied over the apibuild.py from libxml2, adapted a bit and + regenerated the API description in XML. Todo: libexslt-api.xml + * libxslt/attributes.c libxslt/documents.c libxslt/extensions.c + libxslt/imports.c libxslt/numbers.c libxslt/numbersInternals.h + libxslt/pattern.c libxslt/preproc.c libxslt/security.c + libxslt/templates.c libxslt/transform.c libxslt/transform.h + libxslt/variables.c libxslt/xslt.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: cleanup based on the + report from the scripts. + * libxslt.spec.in: make sure libxslt-api.xml ends up in the devel + package + +Thu Dec 5 18:05:44 CET 2002 Daniel Veillard + + * libxslt/transform.c: xsl:element generated superfluous xmlns + declarations, closes bug #99905 + * tests/docs/Makefile.am tests/docs/bug-101.xml + tests/general/Makefile.am tests/general/bug-101.*: added the + example in the regression tests for this case + +Wed Dec 4 18:12:24 CET 2002 Daniel Veillard + + * libxslt/xslt.c: Matt Sergeant reported a bug when having comments + within an + +Mon Dec 2 17:19:38 CET 2002 Daniel Veillard + + * libxslt/extensions.c: applied patch from Josh Parsons fixing bug + #100056 + * tests/docs/Makefile.am tests/docs/bug-100.xml + tests/general/Makefile.am tests/general/bug-100.*: added the + example in the regression tests for this case + * tests/docs/Makefile.am tests/docs/bug-99.xml + tests/general/Makefile.am tests/general/bug-99.*: this test + covers an xsl:attribute namespace bug that Norm pointed out. + +Thu Nov 28 17:52:21 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/xsltutils.c libxslt/xsltutils.h + win32/libxslt.def.src: applied another patch from Richard Jinks + for the export of teh sorting routine and allowing per context + sort. + +Wed Nov 27 13:33:26 CET 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h: Applied patch from Richard Jinks to allow + redefining the sorting routine, plus a bit of tweaking of the + interfaces. + +Tue Nov 26 16:02:38 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/parsedecl.py: fixed the API generation + scripts. + * doc/libxslt-api.xml doc/libxslt-refs.xml: regenerated + * doc/html/*.html: updated too + * python/libxsltclass.txt: updated too + +Tue Nov 26 15:17:13 CET 2002 Daniel Veillard + + * libxslt/xsltutils.c libxslt/xsltutils.h: added the function + xsltGetProfileInformation() to retrieve profiling informations + from an XSLT transformation context. It returns it as an XML + tree. Provided by Michael Rothwell this closes RFE #99527 + +Tue Nov 26 14:40:45 CET 2002 Daniel Veillard + + * libxslt/imports.c: apply patch from Daniel Stodden, a bug + in xsltFindElemSpaceHandling() missing imported informations + * tests/REC/stand-2.7-1.stand.out: this change slightly the result + of this test. + +Mon Nov 25 17:33:48 CET 2002 Daniel Veillard + + * libxslt/namespaces.c: fix for namespace generation on + attributes created with xsl:attribute + +Mon Nov 25 17:30:02 CET 2002 Daniel Veillard + + * libxslt.spec.in configure.in: add a line in %changelog for releases + +Mon Nov 25 14:57:53 CET 2002 Daniel Veillard + + * libxslt/transform.h: Kir Kolyshkin pointed out it lacked + xsltInternals.h reference. + +Sun Nov 24 15:49:58 CET 2002 Daniel Veillard + + * python/tests/*.py: enable libxml2 memory debug before + loading libxslt since libxslt initialization now includes + EXSLT registration which initialize the libxml2 library and + allocate memory + +Sun Nov 24 13:58:48 CET 2002 Daniel Veillard + + * python/libxsl.py: updated with new version from Stéphane Bidoul + +Sat Nov 23 22:49:08 CET 2002 Igor Zlatkovic + + * win32/libxslt.def.src: exported new functions + +Sat Nov 23 14:46:06 CET 2002 Daniel Veillard + + * libexslt/date.c: patch from Charles Bozeman fixing a memory + leak in exsltDateDurationFunction pointed out by Bernard Brinkhus + * python/tests/exslt.py: trouble with mem debug in that specific + test... + +Sat Nov 23 12:33:58 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h: Alexey Efimov reported a portability + problem when compiling on HP-UX + +Sat Nov 23 12:23:32 CET 2002 Daniel Veillard + + * python/generator.py python/libxslt.c: fixes for compiling + without config.h + +Thu Nov 21 18:51:29 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #99168 select evaluating to + a node list check + +Thu Nov 21 15:12:33 CET 2002 Daniel Veillard + + * tests/documents/result.xhtml: the XHTML1 serialization change + to libxml2 modifies slightly the result of that test. + +Mon Nov 18 11:38:46 CET 2002 Daniel Veillard + + * configure.in: the python bindings requires libxml2 >= 2.4.25 + for the regexp stuff. + +Mon Nov 18 10:09:06 CET 2002 Daniel Veillard + + * configure.in: similar patch to #98825 for --with-python + +Sun Nov 17 22:06:59 CET 2002 Daniel Veillard + + * libxslt/variables.c: fix bug #98793 on clash of imported global + variables. + * tests/reports/tst-1.err: this changes the output of that test + +Sun Nov 17 18:12:20 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.23 + * doc/*: rebuilding the docs + +Sat Nov 16 23:23:41 CET 2002 Daniel Veillard + + * python/libxslt.c: make sure to register EXSLT for the bindings + * python/tests/Makefile.am python/tests/exslt.py: add a specific test + * xsltproc/xsltproc.c: minor cleanup + +Fri Nov 15 12:35:57 CET 2002 Daniel Veillard + + * python/Makefile.am python/tests/Makefile.am: trying to fix #98518 + when building outside of the source tree + +Thu Nov 14 21:39:37 CET 2002 Daniel Veillard + + * python/generator.py: xpathObjectRet() pertains to the libxml2 + module, add the namespace. + +Thu Nov 14 18:48:00 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: cleanup + * win32/Makefile.mingw: new file, integrated mingw in JScript configure + * win32/Makefile.msvc: modified to allow mingw coexistence + * win32/configure.js: integrated mingw + * win32/Readme.txt: cleanup + * xsltproc/xsltproc.c: allowed stdarg for mingw + +Thu Nov 14 07:22:23 MST 2002 John Fleck + + * doc/xsltproc.1 + * doc/xsltproc.html - ran stylesheets to update man page + and html with Daniel's fix to #95510 + +Thu Nov 14 15:10:13 CET 2002 Daniel Veillard + + * libxslt/transform.c: applied patch from Brian McCauley fixing #95493 + * doc/xsltproc.xml: fixing #95510 missing description of --writesubtree + * README: fix the bug page URL + +Thu Nov 14 10:03:12 CET 2002 Daniel Veillard + + * libxslt/functions.c: make sure the fixup for key() reported + by John Escott actually works. + * tests/docs/Makefile.am tests/docs/bug-98.xml + tests/general/Makefile.am tests/general/bug-98.*: added the + example in the regression tests for this case + +Wed Nov 13 10:35:46 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixes bug #97969 for @*[...] patterns + * tests/docs/Makefile.am tests/docs/bug-97.xml + tests/general/Makefile.am tests/general/bug-97.*: added the + example in the regression tests for this case + +Tue Nov 12 22:35:47 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixes bug #97950 for cdata-section-elements + checks in recursive copies. + * tests/docs/Makefile.am tests/docs/bug-96.xml + tests/general/Makefile.am tests/general/bug-96.*: added the + example in the regression tests for this case + +Tue Nov 12 19:31:49 CET 2002 Daniel Veillard + + * libxslt/functions.c: autoconvert key() first arg to string, + reported by John Escott + +Tue Nov 12 13:40:47 CET 2002 Daniel Veillard + + * libxslt/transform.c: corner case handling of copying a CDATA node. + +Fri Nov 8 18:12:46 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: retired xmlwin32version.h + +Fri Nov 8 17:09:14 CET 2002 Daniel Veillard + + * Makefile.am libxslt.m4 libxslt.spec.in: integrated libxslt.m4 + written by Thomas Schraitle (RFE #96485) + +Thu Nov 7 11:18:42 MST 2002 John Fleck + + * doc/xsltproc.xml + * doc/xsltproc.1 + clarifying --catalog option and xsltproc's use of + XML_CATALOG_FILES and /etc/xml/catalog. fixes + http://bugzilla.gnome.org/show_bug.cgi?id=97891 + +Mon Nov 4 06:55:36 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: remove the use of snprintf, and use + libxml2 string API instead. + * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c: + try to cope with architecture lacking some of the string functions, + reuse the trio ones compiled in libxml2 , should close #97113 + +Wed Oct 23 17:06:24 CEST 2002 Daniel Veillard + + * Makefile.am libxslt.spec.in doc/Makefile.am: cleaned up + the spec file and associated changes in the Makefiles. + +Tue Oct 22 21:02:37 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: Forgot to check a pointer, fixes bug #96495 + +Tue Oct 22 20:53:10 CEST 2002 Daniel Veillard + + * libxslt/keys.h: fixed include c.f. bug #96487 + * config.h.in: Red Hat 8.0 induced change + +Mon Oct 21 20:56:31 CEST 2002 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h libxslt/xsltutils.[ch]: + fixed bug #78501 when using a non ascii character for the + number formatting grouping separator. + * tests/docs/Makefile.am tests/docs/bug-95.xml + tests/general/Makefile.am tests/general/bug-95.*: added the + example in the regression tests for this case + * libxslt/attributes.c: cleaning up a problem introduced in last + patch + +Mon Oct 21 09:31:55 CEST 2002 Igor Zlatkovic + + * libxslt/attributes.c: fixed minor typo in a call to + xmlHasNsProp + +Sun Oct 20 23:20:37 CEST 2002 Daniel Veillard + + * python/types.c: fixed bugs when passing result value tree + to Python functions. + +Sun Oct 20 15:23:28 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: mapped vsnprintf to _vsnprintf for the + MS runtime + * xsltproc/xsltproc.c: mapped snprintf to _snprintf for the MS + runtime + +Fri Oct 18 13:40:12 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.22 + * doc/*: upated and rebuilt the docs + +Thu Oct 17 16:32:44 CEST 2002 Daniel Veillard + + * libxslt/variables.c: fixed bug #86421 + * tests/docs/Makefile.am tests/docs/bug-94.xml + tests/general/Makefile.am tests/general/bug-94.*: added the + example in the regression tests for this case + +Thu Oct 17 15:50:04 CEST 2002 Daniel Veillard + + * xsltproc: added and tested the --path option to close #79638 + +Thu Oct 17 15:25:46 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: fixing bug #95826 the attribute was reset + with the inherited stylesheet value. + * tests/docs/Makefile.am tests/docs/bug-93.xml + tests/general/Makefile.am tests/general/bug-93-inc.* + tests/general/bug-93.*: added the example in the regression + tests for this case + +Tue Oct 15 18:02:37 CEST 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/xsltutils.[ch]: added the + possibility to register a transformation context specific + error handler, with xsltSetTransformErrorFunc() and provided + a new routine xsltTransformError() to handle contextual errors, + this should fix #94435 + * libxslt/*.c: modified all the code to use the context specific + error handling, as a result xsltPrintErrorContext() is not called + anymore except internally from xsltTransformError() + +Tue Oct 15 14:52:23 CEST 2002 Daniel Veillard + + * libxslt/transform.c: closing #94933, any error will make + the transformation abort with no result. + * tests/reports/tst-1.err tests/reports/tst-1.out + tests/reports/undefvar.err: this changed the regression tests + output. + * tests/exslt/date/difference.1.out tests/exslt/date/seconds.1.out: + updated the result accordingly to the fixes done last month. + * libxslt/namespaces.c: make sure to avoid duplicate namespace + declarations in the result trees. May fix #93692 but it's unclear. + +Tue Oct 15 12:45:42 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added a --path option to provide the + enhancement requested by #79638, first cut at it, untested + yet. + +Tue Oct 15 13:02:40 CEST 2002 Daniel Veillard + + * libxslt/xslt.c: seems the media-type attribute wasn't + always correctly handled + +Mon Oct 14 09:27:01 CEST 2002 Daniel Veillard + + * libxslt/transform.c: added URI escaping in case the resource + target computation of exslt:element failed. Should fix #81837 + +Tue Oct 15 12:42:25 CEST 2002 Daniel Veillard + + * README: updated the contact informations + +Tue Oct 15 11:40:19 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: fixed the behaviour of node() patter which + didn't patch the one defined in XPath :-( . Closes bug #95793 + * tests/docs/Makefile.am tests/docs/bug-92.xml + tests/general/Makefile.am tests/general/bug-92.*: added the + example in the regression tests for this case + +Mon Oct 14 12:29:53 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: remapped mkdir to _mkdir for MS runtime + * win32/Makefile.msvc: added security.c to the build + * win32/libxslt.def.src: exported functions from security.c + +Thu Oct 10 18:41:56 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added another option --writesubtree to allow + documents to be written only to a given subtree. + +Thu Oct 10 17:16:52 CEST 2002 Daniel Veillard + + * libxslt/security.[ch] libxslt/Makefile.am: new module with + runtime security checks, it will also check and do directory + creation when allowed + * libxslt/documents.c libxslt/imports.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h: plug-in the new + security infrastructure probes at file reading or file creation + * xsltproc/xsltproc.c: plugged the security module there too, + added the new options --nowrite and --nomkdir + * doc/*: updated the man page and regenerated. + +Wed Oct 9 18:37:56 CEST 2002 Daniel Veillard + + * doc/*: updated the doc XSLT to add the search, added the search + page, fixed a link problem raised by Yves Pratter, regenerated + +Wed Oct 9 14:27:17 CEST 2002 Daniel Veillard + + * doc/index.py: the indexer version of the XSLT part of the + xmlsoft site + archives + +Sun Sep 29 20:02:25 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: introduced double-run compilation. + * win32/configure.js: introduced double-run compilation. + +Thu Sep 26 20:08:50 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.21 + * doc/* : updated and regenerated the docs and web pages + +Wed Sep 25 11:16:06 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed a disable output escaping bug for + HTML output introduced in 1.0.20 and raised by Mario Weilguni + * tests/docs/Makefile.am tests/docs/bug-91.xml + tests/general/Makefile.am tests/general/bug-91.*: added the + example in the regression tests for this case + +Tue Sep 24 20:33:08 MDT 2002 John Fleck + + * doc/xlst.html: changing link on ftp.gnome.org + +Mon Sep 23 10:14:38 CEST 2002 Daniel Veillard + + * Makefile.am: set-up DIST_SUBDIRS to avoid the same problem Jacob + reported for libxml2 + +Fri Sep 20 14:06:45 CEST 2002 Daniel Veillard + + * Makefile.am configure.in: trying to fix the same problem as + #88412 by bypassing all the python subdir if python ain't detected + +Fri Sep 20 10:55:03 CEST 2002 Daniel Veillard + + * libxslt/templates.c: fixed a problem reported by Mark Vakoc + +Wed Sep 18 15:46:50 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed the embedded '-' in the duration format + function + * tests/.../difference.1.xml: added test cases which illustrated + the above bug + +Tue Sep 17 18:01:22 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed date:difference() bugs, removed all + type conversion warnings. + * libxslt/xsltutils.c: removed unused local variable. + +Sat Sep 14 16:17:51 MDT 2002 John Fleck + + * doc/xsltproc.html: + oops, forgot to update the html version of the man page + +Sat Sep 14 16:10:21 MDT 2002 John Fleck + + * doc/xsltproc.xml + * doc/xsltproc.1 + * doc/xsltproc2.html + Fixing erroneous mention of old --warnnet option (thanks to Jean + T. Anderson for pointing this out) + +Tue Sep 10 21:05:28 CEST 2002 Igor Zlatkovic + + * win32/configure.js: added more readme info for the binary + package. + +Mon Sep 9 14:07:06 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: fixed a bug in match="node()" reported by + Ben Ko + +Mon Sep 9 14:06:25 CEST 2002 Daniel Veillard + + * libxslt.spec.in: fixes libary path for x86_64 AMD + +Thu Sep 5 10:07:13 CEST 2002 Daniel Veillard + + * python/Makefile.am: applied patch from Christophe Merlet to + reestablish DESTDIR + +Thu Aug 29 21:26:30 CEST 2002 Daniel Veillard + + * libxslt/transform.c: re-applied the patch from Nathan Myers about + a possible memory leak in case of error + +Wed Aug 28 13:44:54 CEST 2002 Daniel Veillard + + * doc/Libxslt-Logo-180x168.gif doc/Libxslt-Logo-90x34.gif: + nice logos generated by Marc Liyanage + * doc/site.xsl *.html: changed the stylesheet to show the new + logo and regenerated the pages + +Sun Aug 25 17:01:40 CEST 2002 Daniel Veillard + + * python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt python/tests/basic.py: applied a patch + from Ralf Mattes providing style.saveResultToString() + +Fri Aug 23 13:53:50 CEST 2002 Daniel Veillard + + * configure.in: preparing release 1.0.20 + * doc/*: updated and regenerated the docs + +Wed Aug 21 21:27:29 CEST 2002 Daniel Veillard + + * libxslt/templates.c: fixed a bug w.r.t. namespace context when + doing the evaluation of attribute value templates + * libxslt.spec.in python/Makefile.am: fixed some troubles + with "make rpm" + +Wed Aug 21 18:59:28 CEST 2002 Daniel Veillard + + * python/libxslt.c: fixed the parameter order when calling + Python based extensions. + +Wed Aug 21 13:48:07 CEST 2002 Daniel Veillard + + * libxslt/transform.c libxslt/xslt.c: fixed bug #89258 and a bit of + cleanup. + * tests/docs/Makefile.am tests/docs/bug-90.xml + tests/general/Makefile.am tests/general/bug-90.*: added the + example in the regression tests for this case + +Tue Aug 20 16:40:48 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: added the prefix location to the include + and lib search path. + +Mon Aug 19 15:03:11 CEST 2002 Daniel Veillard + + * libxslt/transform.c: found and fixed the small + bug which was giving troubles to DocBook users (the test expression + of was evaluated in the namespace context of !) + +2002-08-18 Havoc Pennington + + * autogen.sh: hardcode aclocal-1.4/automake-1.4 so that users with + both automake 1.6 and 1.4 installed get the right automake. Means + compilation from CVS will now require the latest automake 1.4 + release, or manually creating symlinks called "automake-1.4" and + "aclocal-1.4" + +Wed Aug 14 18:54:19 CEST 2002 Daniel Veillard + + * configure.in python/Makefile.am: AMD x86-64 induced changes from + Frederic Crozat + +Wed Aug 14 13:35:04 CEST 2002 Daniel Veillard + + * libxslt/functions.c: recovering to the old (somewhat) broken + implementation of document('') when there is no base for the + source document or it can't be realoaded (e.g. when the sytlesheet + was loaded from a memory string). Matt Sergeant insisted on this + one :-) + +Tue Aug 13 11:21:44 CEST 2002 Daniel Veillard + + * libxslt/transform.c: applied another patch from Nathan Myers about + a possible memory leak in case of error + +Mon Aug 12 23:12:59 CEST 2002 Daniel Veillard + + * libxslt/transform.c: applied a patch from Nathan Myers about + an erroneous free in case of error + +Thu Aug 1 14:29:11 CEST 2002 Daniel Veillard + + * configure.in: upon suggestion of Marc-Andre Lemburg, make + the misdetection of libxml2 python bindings a warning only + +Sun Jul 21 19:10:00 HKT 2002 William Brack + + * xsltInternals.h/xslt.c/transform.c and pattern.c: fixed + a bug reported by Gero Meissner (87230) + * fixed a problem compiling python directory when multiple + 'make' jobs were executed (python/Makefile.am) + +Wed Jul 17 19:58:36 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: fixed a bug reported by Keith Isdale + at the xsltdbg interface when encountering an empty attribute + set. + +Wed Jul 17 19:51:47 CEST 2002 Daniel Veillard + + * tests/* : the change in HTML meta encoding tag serialization + affected some of the results + +Thu Jul 11 22:04:30 CEST 2002 Daniel Veillard + + * doc/Makefile.am: adding doc/xsltproc.xml to the tarball + to fix Red Hat bug #68614 + +Wed Jul 10 21:28:11 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: Made the copy *.pdb in install succeed even + if there is no *.pdb + +Sat Jul 6 22:00:08 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.19 + * doc/* : rebuilt the docs + +Sat Jul 6 17:51:14 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #83749 about namespace generated + being invalid when they are inherited from the context. + +Fri Jul 5 22:27:47 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #86753 on multiple identical + attributes being generated, oops ... + * tests/docs/Makefile.am tests/docs/bug-89.xml + tests/general/Makefile.am tests/general/bug-89.*: added an + example in the regression tests for this case + +Fri Jul 5 18:28:08 CEST 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/transform.c: fixed bug #87279 + * tests/docs/Makefile.am tests/docs/bug-88.xml + tests/general/Makefile.am tests/general/bug-88.*: added an + example in the regression tests for this case + +Fri Jul 5 16:30:02 CEST 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/xsltutils.c: applied a patch from + Ken Neighbors to implement/fix sorting orders + * tests/docbook/result/*/gdp-handbook.* + tests/docbook/result/xtchunk/html/*.orig + tests/general/bug-12-.out tests/general/bug-63.out: + cleaned up the result of "make tests" following some changes + in namespace axis order and serialization rules in libxml2 + +Thu Jul 4 16:53:00 HKT 2002 William Brack + + * transform.c further enhancement for bug 84902 (another + path), also cleaned up code slightly + +Wed Jul 3 00:50:00 HKT 2002 William Brack + + * transform.c: fixed bug 84902 - message with terminate=yes + caused segfault + +Tue Jul 2 00:02:53 CEST 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-87.xml + tests/general/Makefile.am tests/general/bug-87.*: added a + example in the regression tests for a case where the XML + default namespace was missing from the namespace axis + * xsltproc/xsltproc.c: added the informations that parameter + strings are expected to be UTF8 + * libxslt/attributes.c: fixes on attribute group implementation + +Sat Jun 29 21:12:14 MDT 2002 John Fleck + + * doc/xsltproc.xml, doc/xsltproc.html/, doc/xsltproc.1 + updating docs to add reference to UTF-8 requirement for + stringparam command line option + +Wed Jun 19 13:43:00 CEST 2002 Daniel Veillard + + * libxslt/documents.c libxslt/functions.c libxslt/xsltInternals.h: + fixed document('') as pointed by Eric van der Vlist + * tests/docs/Makefile.am tests/docs/bug-86.xml + tests/general/Makefile.am tests/general/bug-86.*: added the + specific example in the regression tests + +Sat Jun 15 15:44:58 CEST 2002 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h: applied a + patch from Ken Neighbors fixing some format-number inconsistencies + * tests/numbers/format-number.out tests/numbers/format-number.xml + tests/numbers/format-number.xsl: the patch also included + updates to the regression tests + +Mon Jun 10 14:55:31 CEST 2002 Daniel Veillard + + * libxslt/numbers.c: patch from Richard Jinks t correct a bug in + xsl:number level="multiple" + * tests/docs/Makefile.am tests/docs/bug-84.xml + tests/general/Makefile.am tests/general/bug-84.*: added a + specific example in the regression tests + +Fri May 31 09:33:09 CEST 2002 Daniel Veillard + + * libexslt/dynamic.c: turned a function static + * libxslt/win32config.h: applied patch from Mark Vadoc + +Thu May 30 23:35:47 CEST 2002 Daniel Veillard + + * win32/Makefile.msvc libexslt/Makefile.am libexslt/date.c + libexslt/dynamic.c libexslt/exslt.c libexslt/exslt.h: applied + a patch from Mark Vakoc to implement the EXSLT + object dyn:evaluate(string) extension function, and a small fix + to date.c + +Mon May 27 23:24:57 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.18 + * doc/*: recompiled the API and web site + +Mon May 27 19:14:46 CEST 2002 Daniel Veillard + + * libxslt/namespaces.c libxslt/transform.c: fix bug #81099 about + duplicated namespace declarations, this might not be as generic as + it should but works well for DocBook stylesheets + +Sat May 25 12:07:45 CEST 2002 Daniel Veillard + + * libxslt.pc.in: fix bug #82970 + +Fri May 24 15:02:50 CEST 2002 Daniel Veillard + + * python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt : tried to fix #79105 by providing a + specific error registering routine. + +Thu May 23 17:28:35 CEST 2002 Daniel Veillard + + * libxslt/xsltutils.[ch] : applied patch from Morus Walter + adding xsltSaveResultToString() + * doc/APIfiles.html doc/APIfunctions.html doc/libxslt-api.xml + doc/libxslt-decl.txt doc/libxslt-refs.xml: this increased the + API with the new function. + +Wed May 22 11:50:36 CEST 2002 Daniel Veillard + + * libxslt/function.c: applied a patch from Richard Jinks + to avoid a crash in element-available() + +Tue May 21 19:38:20 CEST 2002 Daniel Veillard + + * libxslt.spec.in: applied patch from Geert Kloosterman to + not miss gif and .png files in the RPM documentation + +Tue May 21 08:43:11 CEST 2002 Daniel Veillard + + * libexslt/libexslt.4: Applied patch for the EXSLT man page + from Charles Bozeman + +Sat May 18 10:01:38 CEST 2002 Daniel Veillard + + * libexslt/libexslt.4 libxslt/libxslt.4 libxslt/keys.c + libxslt/xsltconfig.h.in: applied a man page patch from + Christian Cornelssen and fixed a couple of issues he raised. + +Thu May 16 19:38:24 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: moved the extension dump out of the loop + +Thu May 16 19:31:35 CEST 2002 Daniel Veillard + + * libxslt/extensions.[ch] xsltproc/xsltproc.c win32/libxslt.def.src: + Applied Mark Vakoc patch to show registered extensions in xsltproc + * doc/*: rebuilt the API, docs and website + * python/libxsltclass.txt: this added an entry point + +Wed May 15 00:20:10 CEST 2002 Igor Zlatkovic + + * libxslt/xslt.c: xsl:include crash fix + * libxslt/imports.c: xsl:include crash fix + * libxslt/imports.h: xsl:include crash fix + +Wed May 9 01:39:14 CEST 2002 Igor Zlatkovic + + * libexslt/exslt.h: fixed a typo _cplusplus -> __cplusplus + +Thu May 2 11:08:22 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c libxslt/xsltutils.c doc/xsltproc.xml: + fixed some return code problems raised by Thomas Mauch + +Tue Apr 30 18:06:14 CEST 2002 Daniel Veillard + + * libxslt/transform.c: don't allow adding an attribute to + a document node + +Mon Apr 29 19:00:22 CEST 2002 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing 1.0.17 + * doc/*: rebuilt the docs. + +Mon Apr 29 17:22:08 CEST 2002 Daniel Veillard + + * libxslt/variables.c: better attempt to fix the problem in + xsltProcessUserParamInternal reported by Babak Vahedipour-Kunze + +Sun Apr 28 17:53:23 CEST 2002 Igor Zlatkovic + + * win32/dsp/*.dsp: Removed obsolete macros + * win32/dsp/*.def: Updated export definitions + +Sun Apr 28 17:47:17 CEST 2002 Daniel Veillard + + * libxslt/variables.c: tried to fix a problem in + xsltProcessUserParamInternal reported by Babak Vahedipour-Kunze + +Fri Apr 26 08:15:30 CEST 2002 Daniel Veillard + + * libexslt/date.c: applied another patch from Charles Bozeman to + enhance date/duration support + * tests/exslt/date: added the associated set of regression tests + +Thu Apr 25 08:18:57 CEST 2002 Daniel Veillard + + * libexslt/date.c: applied a patch from Charles Bozeman to add + duration routines to the date exslt extensions. + +Thu Apr 18 22:56:06 CEST 2002 Daniel Veillard + + * libexslt/exslt.h: extern "C" { missing by Mark Vakoc + +Tue Apr 17 23:16:54 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed type inconsistencies, double->int + and unsigned/signed mismatch warnings eliminated + +Tue Apr 16 19:40:21 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: XSLT debugger support fix + * win32/configure.js: XSLT debugger support fix + * libxslt/xsltconfig.h.in: XSLT debugger support fix + +Mon Apr 15 19:27:31 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.16 + * doc/*: updated and rebuilt the docs + +Mon Apr 15 17:27:51 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: removed a warning + * libxslt/transform.c libxslt/transform.h win32/libxslt.def.src: + added xsltRunStylesheetUser() API needed to fix #78546 + * xsltproc/xsltproc.c: second part of the fix #78546 + +Mon Apr 15 15:57:28 CEST 2002 Daniel Veillard + + * python/Makefile.am: fixing the equivalent of #75779 + +Mon Apr 15 14:00:12 CEST 2002 Daniel Veillard + + * libxslt/keys.c: fixed bug #78735 + * configure.in tests/Makefile.am tests/keys/*: + added the tests in a separate directory + +Mon Apr 15 00:01:07 CEST 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-83.xml + tests/general/Makefile.am tests/general/bug-83.*: added a + specific example for bug #78662 in the regression tests + * tests/docbook/: this also changed a couple of DocBook results + +Sun Apr 14 15:32:23 CEST 2002 Daniel Veillard + + * configure.in: trying to kill #77827 IEEE conformance on alphas + * libxslt/imports.c libxslt/transform.c libxslt/xslt.c: fixing + bug #78211 + * tests/docs/Makefile.am tests/docs/bug-82.xml + tests/general/Makefile.am tests/general/bug-82.*: added a + specific example for bug #78211 in the regression tests + +Wed Apr 10 20:35:54 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: applied patch from Mark Vakoc + +Fri Mar 29 18:28:23 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-81.xml + tests/general/Makefile.am tests/general/bug-81.*: added a + specific example for bug #76927 in the regression tests + +Wed Mar 27 10:03:11 CET 2002 Daniel Veillard + + * AUTHORS HACKING: Added Igor Zlatkovic as official maintainer + * python/Makefile.am python/tests/Makefile.am: Albert Chin pointed + that $(datadir) should be used for docs + +Mon Mar 25 17:56:44 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.15 + * doc/*: updated and rebuilt + +Mon Mar 25 17:11:42 CET 2002 Daniel Veillard + + * libxslt/attributes.c libxslt/attributes.h libxslt/pattern.c + libxslt/xslt.c: Fix bug #76043 about cascading attribute sets + * tests/docs/Makefile.am tests/docs/bug-80.xml + tests/general/Makefile.am tests/general/bug-80.*: added a + specific example for bug #76043 in the regression tests + +Fri Mar 22 19:26:47 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixing bug #75902 error with @foo[..] + steps which were not compiled + * tests/docs/Makefile.am tests/docs/bug-79.xml + tests/general/Makefile.am tests/general/bug-79.*: added a + specific example for bug #75902 in the regression tests + +Fri Mar 22 16:13:22 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixing bug #75777 error with namespaced + attribute match rules evaluation + * tests/docs/Makefile.am tests/docs/bug-78.xml + tests/general/Makefile.am tests/general/bug-78.*: added a + specific example for bug #75777 in the regression tests + +Thu Mar 21 17:19:56 CET 2002 Daniel Veillard + + * libxslt/transform.c: found another stupid bug by step by + step processing of the code + * libxslt/pattern.c: idem, except that once stupid mistake + ELEM vs NODE forced the templates to be stored in a list + instead of a hash table, fixing this stupidity should + again lead to a substantive improvement of processing speed. + Like divide by 2 processing time for DocBook stylesheets. + +Thu Mar 21 00:25:12 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixing bug #75603 + * tests/docs/Makefile.am tests/docs/bug-77.xml + tests/general/Makefile.am tests/general/bug-77.*: added a + specific example for bug #75603 in the regression tests + +Wed Mar 20 17:49:43 CET 2002 Daniel Veillard + + * python/Makefile.am: Art Haas pointed a stupid error + +Tue Mar 19 19:42:01 CET 2002 Daniel Veillard + + * Makefile.am tests/Makefile.am tests/*/Makefile.am + tests/*/*/Makefile.am : added "make valgrind" targets + to run the test suite under the debugger control + * transform.c: valgrind spotted 2 bugs, one related to + the ordering of the deallocation of the data associated to + a transofrmation, the second in xsltCopyTree when the new + node may have been coalesced with an adjacent text node. + The regression tests now pass cleanly under testgrind. + +Mon Mar 18 21:33:38 CET 2002 Daniel Veillard + + * python/Makefile.am: fixed a stupid bug + +Mon Mar 18 20:45:27 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.14 + * doc/*: updated rebuilt + * libxslt/*.c libexslt/*.c libxslt/libxslt.h libexslt/libexslt.h: + implemented the IN_LIBXSLT and IN_LIBEXSLT mechanism discussed + with the Windows maintainers + +Mon Mar 18 16:22:46 CET 2002 Daniel Veillard + + * python/Makefile.am python/generator.py python/libxslt.c + python/types.c python/tests/Makefile.am: applied the same kind of + fixes to the Python Makefiels than to libxml2 ones. Updates + and cleanups too. + +Sat Mar 16 23:48:21 CET 2002 Daniel Veillard + + * libexslt/common.c libxslt/pattern.c libxslt/transform.c + libxslt/variables.c: chaing result tree values which may + be deallocated and must not be kept in the template + pattern lookup cache. Thanks to Valgrin to allow finding + the real problem in bug #74857 + +Wed Mar 13 15:17:51 CET 2002 Daniel Veillard + + * libxslt/*.h doc/* python/*: applied another cleanup comment + diff from Heiko W. Rupp, regenerated the API and python + +Wed Mar 13 13:41:19 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-76.xml + tests/general/Makefile.am tests/general/bug-76.*: added a + home brewed test for path computation elmininating duplicate + in result sets. + +Sat Mar 9 11:53:39 CET 2002 Daniel Veillard + + * doc/Makefile.am: fixed a build problem in some environements + +2002-03-08 jacob berkman + + * python/Makefile.am (libxsltmodule_la_SOURCES): remove $(srcdir) + as make will automatically look there for these files + +Fri Mar 8 17:44:31 CET 2002 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing release + 1.0.13 + * doc/*: updated and rebuilt the docs + * python/libxslt.c: fixed a possible reentrancy problem + +Fri Mar 8 14:51:59 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixes the problems exposed by #73880 + those ought to be computed at stylesheet compile time, not + at run-time, and the computation was wrong. + * libxslt/transform.c: get rid of fake nodes coming from node-set + transformations. At least if they are still produced they will + become easy to spot as resulting document won't be well-formed. + +Thu Mar 7 17:01:21 CET 2002 Daniel Veillard + + * libxslt/extensions.c: fixed bug #73791 related to extension + function declared in included stylesheets + * tests/exslt/functions/function.7.*: added specific test + +Thu Mar 7 15:20:32 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-75.xml + tests/general/Makefile.am tests/general/bug-75.*: added a + specific example for bug #72150 in the regression tests + +Thu Mar 7 15:17:21 CET 2002 Daniel Veillard + + * configure.in xsltproc/xsltproc.c: fixed bug #71488 in a + similar way as #71457 + +Thu Mar 7 09:41:59 CET 2002 Daniel Veillard + + * tests/xmlspec/REC-xml-20001006*.html tests/XSLTMark/xslbench1.out: + some HTML meta encoding fixups resulting from fix in libxml2 + +Mon Mar 4 18:09:48 CET 2002 Daniel Veillard + + * libxslt/namespaces.c tests/general/bug-63.out: small fixups + related to the XPath changes in fixing #61290 + +Mon Mar 4 12:57:21 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed bug #73363, bad tokenization of + pattern + +Mon Mar 4 12:01:34 CET 2002 Daniel Veillard + + * libexslt/date.c: patch from Charles Bozeman for the exslt date + extension + * configure.in tests/exslt/Makefile.am tests/exslt/date/*: added + the associated regression test provided by Charles + +Fri Mar 1 10:17:26 CET 2002 Daniel Veillard + + * libxslt/preproc.c: Fixed #73088 with the associated patch + +Fri Mar 1 10:14:07 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: similar to #72663 and #72658, don't memdump + unless compiled explicitely with memory debugging switched on + * TODO: refreshed a bit + +Fri Feb 22 23:44:57 CET 2002 Daniel Veillard + + * python/generator.py python/libxslt.c: changes for the 'usual' + setup.py to allow building a libxml2-python + module based on the same code. The initialization is however + different the 2 .so files fo libxml2 and libxslt are identical and + they entry point initialize both libraries. this is done to avoid + some possible nasty problem since the Python don't merge the maps + of all shared modules. + * python/libxsl.py: attempt to cope with the shared library loading + problem when both modules are not merged. + +Thu Feb 21 12:59:59 CET 2002 Daniel Veillard + + * doc/site.xml doc/xslt.html doc/python.html doc/*.html: added + documentation for the wrappers and python modules. + +Wed Feb 13 14:22:22 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-74.xml + tests/general/Makefile.am tests/general/bug-74.*: added a + specific example for bug #71342 in the regression tests + * tests/docbook/result/xhtml/gdp-handbook.xhtml: fixing + #71342 changed one attribute serialization. + +Tue Feb 12 15:08:38 CET 2002 Daniel Veillard + + * python/Makefile.am: trying to fix #71270 + +Mon Feb 11 19:40:34 CET 2002 Daniel Veillard + + * python/*.py: removed tab used spaces + * configure.in libxslt/xsltwin32config.h: preparing 1.0.12 + * doc/news.html doc/xslt.html: rebuild/updated + +Mon Feb 11 16:34:37 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-73.xml + tests/general/Makefile.am tests/general/bug-73.*: added a + specific example for bug #71181 in the regression tests + +Mon Feb 11 16:22:36 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed bug #71181 p/text() would not + work. A bit of cleanup. + +Mon Feb 11 15:01:42 CET 2002 Daniel Veillard + + * xslt-config: fixing Red Hat bug #59508 + +Mon Feb 11 14:27:25 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-72.xml + tests/general/Makefile.am tests/general/bug-72.*: added a + specific example for bug #58444 in the regression tests + +Mon Feb 11 14:13:07 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #58444, was quite simpler + than expected. + +Mon Feb 11 13:27:42 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/pattern.c: expected to have + closed bug #70131, still wondering about the position() when + the node is selected. + +Mon Feb 11 10:45:27 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-71.xml + tests/general/Makefile.am tests/general/bug-71.*: added a + specific example for Norm's bug in the regression tests + +Sun Feb 10 22:08:51 CET 2002 Daniel Veillard + + * libxslt/attributes.c: fixed a bug reported by Norm + +Sun Feb 10 20:25:28 CET 2002 Daniel Veillard + + * python/libxml.c : fixed a small warning. + * doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml + python/libxsltclass.txt: rebuilt the APIs + +Sun Feb 10 20:16:15 CET 2002 Daniel Veillard + + * libxslt/imports.c libxslt/numbers.c libxslt/pattern.c + libxslt/pattern.h libxslt/transform.c libxslt/xslt.c + libxslt/xsltInternals.h: adding extra run-time informations + to make the stylesheet really read-only at run-time. + +Sun Feb 10 16:21:09 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixing bug #70281 + +Sun Feb 10 15:10:56 CET 2002 Daniel Veillard + + * libxslt/numbers.c: trying to fix #68759 + +Sat Feb 9 23:17:53 CET 2002 Daniel Veillard + + * python/Makefile.am: seems some version of automake didn't + generate the dependancies right as Jacob found out. Add + an extra dependancy rule. + +Sat Feb 9 19:04:01 CET 2002 Daniel Veillard + + * configure.in libxslt.spec.in python/Makefile.am python/generator.py + python/libxsl.py python/libxslt.c python/tests/Makefile.am: + Fixed the python Makefiles, corrected a bug showing up on ia64, + changed the name of the python internal module too + +Fri Feb 8 17:01:10 CET 2002 Daniel Veillard + + * Copyright Makefile.am configure.in libxslt.spec.in: change the + Licence to MIT Licence and release of 1.0.11 + * doc/FAQ.html doc/intro.html doc/libxslt-decl.txt doc/news.html + doc/xslt.html: updates of the docs accordingly + * libxslt/xsltwin32config.h: numbering + * python/generator.py python/libxml_wrap.h python/libxsltclass.txt + python/libxslt-python-api.xml: cleanup the dependancies with + libxml2 + * python/tests/extfunc.py: updated examples. + +Thu Feb 7 23:21:18 CET 2002 Daniel Veillard + + * doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml + doc/parsedecl.py: fixup the script and rebuid the API + * libxslt/extensions.h: cleanup + * python/generator.py python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt: provided accessors for a lot of the + tructures involved in the transformation. Stylesheet and + transformation python object don't free automatically the + encapsulated object when deallocated. + * python/tests/Makefile.am python/tests/basic.py + python/tests/extfunc.py python/tests/pyxsltproc.py: + updated the examples + +Thu Feb 7 17:59:27 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: small fix + * Makefile.am: cleanup + * python/tests/Makefile.am: avoid a problem with $(TESTS) + * python/generator.py python/libxml_wrap.h python/libxsl.py + python/libxslt.c python/libxsltclass.txt: augmented the + wrappers + * python/tests/pyxsltproc.py: rewrote xsltproc on top of the + libxslt-python API to get an estimate of what is missing + +Wed Feb 6 23:34:10 CET 2002 Daniel Veillard + + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt: added libxslt_xsltCleanup() added parameters + to libxslt_xsltApplyStylesheet() removed the memleaks left and + fixed an import order. + * python/tests/basic.py python/tests/extfunc.py: updated the tests + +Wed Feb 6 19:46:09 CET 2002 Daniel Veillard + + * python/libxlst.c python/libxslt-python-api.xml + python/libxsltclass.txt: plugged the extension of the engine + with python defined functions + * python/tests/Makefile.am python/tests/extfunc.py: added a + basic test, still a memleak, cleanup function needed. + +Wed Feb 6 13:49:55 CET 2002 Daniel Veillard + + * libxslt.spec.in python/Makefile.am python/libxsl.py: the + spec file will now build libxslt-python, fought with shared + and other crazyness, seems to work now :-) + * doc/libxslt-api.xml: regenerated + +Wed Feb 6 11:29:31 CET 2002 Daniel Veillard + + * Makefile.am configure.in tests/Makefile.am tests/*/Makefile.am + tests/*/*/Makefile.am: refactored make tests, make all now don't + run the test suite + * python/Makefile.am: added tests + * python/tests/basic.py python/tests/Makefile.am: added the first + basic test, memory debug included + +Wed Feb 6 00:20:57 CET 2002 Daniel Veillard + + * configure.in python/Makefile.am: attempst to tweak to get + full memory debug... + * python/generator.py python/libxsl.py python/libxslt-python-api.xml + python/libxslt.c python/libxslt_wrap.h python/libxsltclass.txt: + the basic API starts to work + * python/tests/test.*: first basic test + * libxslt/xsltutils.c: fixed a comment + +Tue Feb 5 17:35:00 CET 2002 Daniel Veillard + + * configure.in doc/Makefile.am: do not install outside of prefix, + make sure the API get shipped. + +Mon Feb 4 19:47:32 CET 2002 Daniel Veillard + + * libxslt/pattern.[ch] doc/libxslt-api.xml doc/libxslt-refs.xml: + reactivated xsltMatchPattern() since this is really something + one may want to have access to in an extension function. + * Makefile.am configure.in python/Makefile.am python/generator.py + python/libxml_wrap.h python/libxsl.py python/libxslt-python-api.xml + python/libxslt.c python/libxslt_wrap.h python/libxsltclass.txt + python/types.c: started working on the python bindings, borrowed + most of the work done for libxml2, most of the generator code + is similar. Commit at the point where this compiles cleanly and + "import libxslt" doesn't yield any missing entry point. + +Wed Jan 30 12:46:41 CET 2002 Daniel Veillard + + * libxslt/pattern.c: patch from Charles Bozeman to support + child::* patterns. + +Wed Jan 30 12:35:28 CET 2002 Daniel Veillard + + * libxslt/keys.c: Bob Stayton pointed out a problem when + using unions in key match patterns. + * tests/docs/Makefile.am tests/docs/bug-70.xml + tests/general/Makefile.am tests/general/bug-70.*: added a + specific example in the regression tests + +Sun Jan 27 13:54:10 CET 2002 Daniel Veillard + + * libxslt/transform.c: avoid a problem with Sun's Workshop CC, + closes bug #69809 submitted by Michael Kroell + +Fri Jan 25 15:31:23 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added links to the Web site from usage() + +Wed Jan 23 23:13:37 CET 2002 Daniel Veillard + + * doc/API*.html doc/parsedecl.py doc/*.xsl parsedecl.py: generated + an index based on comments content similar to libxml2 one + The code need more specific comments. + * doc/*: rebuilt the web site with the new references + +Mon Jan 21 09:53:45 CET 2002 Daniel Veillard + + * libxslt/functions.h: roll back the change after more analysis + proper fix is to restore the definition of xmlXPathFuncLookupFunc + int libxml2 + +Mon Jan 21 09:41:10 CET 2002 Daniel Veillard + + * libxslt/functions.h: fixed a proble after some cleanup of libxml2 + includes. + +Sun Jan 20 14:33:33 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: Fixed RH bug #58124 due to an off-by-one + error when parsing -o arguments. + +Sun Jan 20 14:15:55 CET 2002 Daniel Veillard + + * doc/xsltproc.xml libxslt/xsltutils.c xsltproc/xsltproc.c: + Fixed RH bug #57496, xsltproc was not returning error + code on internal runtime errors. Should return 9 now. + +Fri Jan 18 09:43:16 CET 2002 Daniel Veillard + + * libexslt/math.c: Charlie Bozeman provided the implementation + for the EXSLT math other functions + +Thu Jan 17 23:41:53 CET 2002 Daniel Veillard + + * libexslt/Makefile.am: jacob berkman pointed out that the + Cygwin patch forgot to add libexslt.h to the tarball + +Thu Jan 17 23:39:00 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed I18N problemes in the template parser + pointed out by Xavier Cazin + * tests/docs/Makefile.am tests/docs/bug-69.xml + tests/general/Makefile.am tests/general/bug-69.*: added a + specific example in the regression tests + +Thu Jan 17 10:40:03 CET 2002 Daniel Veillard + + * Makefile.am libexslt/common.c libexslt/date.c libexslt/exslt.c + libexslt/exslt.h libexslt/exsltconfig.h.in libexslt/functions.c + libexslt/libexslt.h libexslt/math.c libexslt/saxon.c + libexslt/sets.c libexslt/strings.c libxslt/libxslt.h + libxslt/xslt.h libxslt/xsltconfig.h.in libxslt/xsltutils.c + xsltproc/xsltproc.c: applied Robert Collins patch for + Cygwin support + +Thu Jan 17 10:34:39 CET 2002 Daniel Veillard + + * xsltproc/Makefile.am configure.in: ugly way to keep + the memory debugging active on my devel workstation + by bypassing libtool completely + +Tue Jan 15 12:00:18 CET 2002 Daniel Veillard + + * libxslt/templates.c: fixed bug #68751 + * tests/docs/Makefile.am tests/docs/bug-68.xml + tests/general/Makefile.am tests/general/bug-68.*: added a + specific example in the regression tests + +Tue Jan 15 10:40:41 CET 2002 Daniel Veillard + + * libxslt/transform.c xsltproc/xsltproc.c: fixed a couple of + small problems raised by Justin Fletcher + +Mon Jan 14 18:35:18 CET 2002 Daniel Veillard + + * configure.in: releasing 1.0.10 + * doc/*: updating the docs for the release. + * libxslt/namespaces.c libxslt/pattern.c libxslt/transform.c: + seems I inadvertantly commited previously stuff from a failed + attempt at fixing namespace nodes parents. + +Mon Jan 14 12:20:33 CET 2002 Daniel Veillard + + * libxslt/numbers.c: the xsl:number implementation incorrectly + cached the format string in some case. Fixes bug #65391 + +Mon Jan 14 10:35:27 CET 2002 Daniel Veillard + + * configure.in: fixed a couple of cut and paste errors in the + math functions detection + * libxslt.spec.in: added missing file entry for libxslt.pc + +Tue Jan 8 21:04:17 MST 2002 John Fleck + + * doc/xsltproc.xml, doc/xsltproc.1, doc/xsltproc.html + update xsltproc man page to add --stringparam option + +Tue Jan 8 17:21:02 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added the --stringparam option + * xsltproc/xsltproc.c: applied John Fleck's patch to correct + the --novalid behaviour. + +Tue Jan 8 13:51:08 CET 2002 Daniel Veillard + + * doc/site.xsl doc/*.html: added a DocBook section docbook.html + +Tue Jan 8 12:51:15 CET 2002 Daniel Veillard + + * doc/*.html: updated gdome2 homepage + +Sat Jan 5 19:32:17 CET 2002 Daniel Veillard + + * win32/dsp: Windows/MSVC project files update from Igor Zlatkovic + +Fri Jan 4 22:13:40 MST 2002 John Fleck + + * doc/xsltproc.xml, xsltproc.1 - updating man page to reflect + increased number of parameteres, changed license, cleaned up some + places where it looked junky because of stylesheet issues + +Fri Jan 4 15:50:25 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: increased the max number of parameters + +Thu Dec 20 14:54:27 CET 2001 Daniel Veillard + + * libxslt.pc.in configure.in: added pkg-config file from Rodrigo Moya + +Thu Dec 20 14:49:39 CET 2001 Daniel Veillard + + * configure.in: applied albert portability patch + * libxslt/libxslt.h libxslt/xslt.h libxslt/xsltconfig.h.in + libxslt/xsltutils.c libxslt/xsltwin32config.h.in win32/dsp/libxslt.def: + applied Igor patch for Windows + +Tue Dec 11 15:27:15 CET 2001 Daniel Veillard + + * libxslt/xsltutils.c: fixed a problem with the debuuger interface. + +Fri Dec 7 15:48:48 CET 2001 Daniel Veillard + + * configure.in: preparing 1.0.9 + * doc/*: updated and rebuild the doc + +Thu Dec 6 14:57:56 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: trying to fix the problem + related to prelinking and libtools crazyness + +Wed Dec 5 18:49:53 CET 2001 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c: applied Keith Isdale + patch for the debugger glue. + +Wed Dec 5 18:43:45 CET 2001 Daniel Veillard + + * breakpoint/Makefile.am breakpoint/deprecated.c: replaced + the whole module with just the entry points. + +Fri Nov 30 18:59:50 CET 2001 Daniel Veillard + + * libxslt/transform.c: Nik Clayton found a bug introduced in + 1.0.8 when using doctypes for HTML output + +Fri Nov 30 12:59:05 CET 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/transform.c libxslt/xsltutils.c + libxslt/xsltutils.h: revamped the mechanism to hook a debuger + to use a callback setup function, deprecating libxsltbreakpoint + * xsltproc/Makefile.am configure.in breakpoint/Makefile.am: removing + dependancies on libxsltbreakpoint + +Thu Nov 29 09:52:38 CET 2001 Daniel Veillard + + Build patch from Peter Williams + * breakpoint/Makefile.am (INCLUDES): meed $(top_builddir)/libxslt. + * doc/Makefile.am ($(PAGES)): xslt.html and site.xsl live in + $(srcdir), not the build directory. + +Wed Nov 28 11:17:04 CET 2001 Daniel Veillard + + * doc/FAQ.html doc/site.xsl doc/*.html doc/Makefile.am: added an FAQ + +Tue Nov 27 21:15:43 MST 2001 John Fleck + + * doc/xsltproc.xml, xsltproc.1, xsltproc.html - documenting new + xsltproc return codes, per + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=56649 + +Tue Nov 27 22:16:50 CET 2001 Daniel Veillard + + * libxslt/pattern.c: Marc Tardif provided a patch to use as + much as 40 steps. A dynamic alloc would still be better + +Mon Nov 26 21:45:07 CET 2001 Daniel Veillard + + * xsltproc/xsltproc.c: return useful code signaling error conditions + closing #56649 (RH) + +Mon Nov 26 13:14:14 CET 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing release of 1.0.8 + +Mon Nov 26 11:21:27 CET 2001 Daniel Veillard + + * libxslt/pattern.c: fixing bug #64044 reported by Gero Meißner, + template matches compilation was failing to skip blanks bewteen + consecutive predicates + +Mon Nov 26 10:27:30 CET 2001 Daniel Veillard + + * Makefile.am configure.in breakpoint/Makefile.am libexslt/Makefile.am: + updating Makefiles to fix the prelinking. + +Sun Nov 25 15:52:38 CET 2001 Daniel Veillard + +* libxslt/transform.c: fixed a bug in the document extension + element where the doctype infos were not taken into account. + +Thu Nov 22 19:08:23 CET 2001 Daniel Veillard + + * libxslt/extra.c: fixed xsltDebug() to output with the normal + error routines + * tests/namespaces/*: updated the tests to separate stdout and + stderr + * libxslt/transform.c: increasing xsltMaxDepth to 5000 + +Thu Nov 22 12:09:56 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: more Makefile fixups + +Wed Nov 21 16:29:04 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: trying to fix more Makefiles + crapola + * libxslt/transform.c: small fix. + +Tue Nov 13 16:16:41 CET 2001 Daniel Veillard + + * vms/* Makefile.am: included OpenVMS port instructions from + John A Fotheringham, integrated in the tar file. + +Mon Nov 12 22:46:26 CET 2001 Daniel Veillard + + * win32/dsp/* xsltproc/xsltproc.c libxslt/transform.c: Patches + from Igor for Windows + * libxslt/xslt.h: try to fix the LIBXSLT_PUBLIC mess + +Sun Nov 11 21:15:05 CET 2001 Daniel Veillard + + * libxslt/transform.c: fixing bug #64298 reported by T. V. Raman + +Sat Nov 10 14:01:44 CET 2001 Daniel Veillard + + * configure.in: preparing 1.0.7 + * libxslt.spec.in: cleanup similar to libxml2 one + * breakpoint/*.[hc]: finished cleaning up contributed code + * doc/*: updated and rebuilt the documentation + * xsltproc/xsltproc.c: cleanup of the timing code + * xsltproc/Makefile.am: auto* sucks + * libxslt/transform.c: added a missing include + +Mon Nov 5 14:29:26 CET 2001 Daniel Veillard + + * Makefile.am acconfig.h config.h.in configure.in + xsltproc/Makefile.am breakpoint/* libxslt/transform.[ch] + libxslt/xsltconfig.h.in: Applied Keith Isdale patch for + the debugger support, make it the default, added the + WITH_XSLT_DEBUGGER define to xsltconfig.h.in, small cleanups + +Fri Nov 2 11:19:49 CET 2001 Daniel Veillard + + * libxslt/libxslt.h: make sure LIBXSLT_PUBLIC is defined + +Thu Nov 1 15:15:39 CET 2001 Daniel Veillard + + * libxslt/xsltutils.c: handle indent=no when using an HTML + output + * tests/docbook/result/* tests/xmlspec/REC-xml-*.html: this + modified the output of those test suites + +Wed Oct 31 18:53:26 CET 2001 Daniel Veillard + + * xsltproc/xsltproc.c: cleanup, moved xsllNoNetExternalEntityLoader() + to libxml and removed the --warnnet option + +Tue Oct 30 19:32:08 CET 2001 Daniel Veillard + + * configure.in: applied patches from David Härdeman closing + bug #62891 + +Tue Oct 30 15:25:19 CET 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing 1.0.6 + * libexslt/date.c: applied patch from Bruce Miller + * doc/*: updated and rebuilt the docs + +Fri Oct 26 14:12:14 CEST 2001 Daniel Veillard + + * win32/dsp/libexslt_a.dsp win32/dsp/libexslt_so.dsp + win32/dsp/libxslt.def: updated with latest ZIP from Igor, + made sure the .def is handled as binary + +Fri Oct 26 11:37:01 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def libxslt/xslt.h: applied Igor patches + for Win32 + * doc/*.html doc/site.xsl: changed the site stylesheet a bit + +Thu Oct 25 23:05:14 CEST 2001 Thomas Broyer + + * libxslt/numbers.c: take NaN and infinity attributes of + xsl:decimal-format into account. Closes #62577 + +Wed Oct 24 13:02:15 CEST 2001 Daniel Veillard + + * doc/*.html doc/site.xsl doc/Makefile.am: the web site + is now extracted from the xslt.html flat file using + the site stylesheet ... eat your own dogfood ! + * libxslt/transform.c libxslt/xsltutils.c: fixed the + HTML output to not generate a DOCTYPE if it should not + i.e. no identifier nor version specified in the xsl:output + * tests/multiple/out/*.orig tests/general/bug-11-.out + tests/general/bug-33-.out tests/general/bug-52.out + tests/docbook/result/xtchunk/html/*.orig + tests/docbook/result/html/gdp-handbook.html + tests/XSLTMark/*.out: fixing xsl:output with method=html + resulted in a number of small changes in the regression tests + output + +Fri Oct 19 16:46:06 CEST 2001 Daniel Veillard + + * libexslt/*.c libexslt/exsltconfig.h.in: moved the + config.h include out of exsltconfig.h since this header is + exported and config.h is not. + +Wed Oct 17 21:20:55 CEST 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/extensions.c libxslt/preproc.c + libxslt/transform.c libxslt/xsltutils.h: cleanup TODO into + XSLT_TODO + +Wed Oct 17 02:46:55 CEST 2001 Thomas Broyer + + * libxslt/numbers.c: reworked internal representation of + tokenized number format and parsing/tokenization. This fixes + many bugs regarding separator and default tokens. + * tests/REC/test-7.7-3.out: the fix changes the output of this + test. It now complies to the XSLT spec (wow! ;o) + +Tue Oct 16 11:25:15 CEST 2001 Daniel Veillard + + * xsltproc/Makefile.am configure.in config.h.in: trying to + bypass libtool crazyness when compiling in my debug environment + * libxslt/templates.c: fix a compilation problem due to recent + libxml changes + +Sun Oct 14 17:17:03 CEST 2001 Thomas Broyer + + * libxslt/numbers.c tests/REC/test-7.7-4.out: implement initial + non-alphanumeric token handling in number formatting. + +Wed Oct 10 11:58:41 CEST 2001 Daniel Veillard + + * configure.in: releasing 1.0.5 + * doc/xslt.html doc/html/*: updated and rebuilt the docs + +Wed Oct 10 00:10:01 CEST 2001 Thomas Broyer + + * tests/REC/test-7.7-4.out: fixed a typo + +Tue Oct 9 22:59:00 CEST 2001 Thomas Broyer + + * libexslt/saxon.c: fixed a typo and improved handling of + non-XPath-expression arguments. + * libexslt/strings.c: fixed a bug in tokenize: function was using + tctxt->output instead of tctxt->document->doc. + * libxslt/transform.c: fixed a bug in xsltDefaultProcessOneNode + which was using variable "node" instead of "cur" + +Tue Oct 9 19:51:48 CEST 2001 Thomas Broyer + + * libxslt/extra.[ch]: removed older SAXON extensions + implementations from Darren Graves. + * libexslt/date.c: applied patch from Charlie Bozeman to fix + a bug with time zone offset on Linux. + +Tue Oct 9 13:02:46 CEST 2001 Daniel Veillard + + * libxslt/documents.c libxslt/extra.c libxslt/transform.[ch]: + strip-space should also be applied to document imported + at run-time. + +Tue Oct 9 12:36:53 CEST 2001 Daniel Veillard + + * libxslt/imports.[ch] libxslt/transform.c libxslt/xslt.c: + rewrote the way strip-space gets applied. Closes bugs #61962 + * tests/docs/Makefile.am tests/docs/bug-66.xml + tests/general/Makefile.am tests/general/bug-66.*: added a + specific example in the regression tests + +Mon Oct 8 11:27:52 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: Fixing bug #61913 + * libxslt/transform.c: removing a small memleak when running with + the profiler. + +Sun Oct 7 18:53:34 CEST 2001 Thomas Broyer + + * libexslt/saxon.c libexslt/Makefile.am libexslt/exslt.[ch]: + added implementation of SAXON expression(), eval() and + evaluate() functions. + See http://saxon.sourceforge.net/saxon6.4.4/extensions.html + * tests/extension/evaluate.xsl tests/extension/list.{xsl,out}: + modified to use SAXON namespace (functions are not registered + in the LibXSLT namespace) + * tests/exslt/common/object-type.1.out: modified to take account + of the new saxon:expression function + +Sun Oct 7 13:15:33 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: fixed bug #61070, number ANY formatting + should be faster too. + * tests/docbook/result/xtchunk/html/* tests/xmlspec/REC-xml-20001006*.html: + updated the result of the tests. A subtle bug unnnoticed yet + in the XML Rec formatting got fixed. + +Sat Oct 6 19:45:07 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: trying to fix bug #61070, seems there + is still a couple of problem left. And optimizations are + certainly needed. + +Sat Oct 6 15:10:16 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixing bug #61673 part II + * tests/docs/Makefile.am tests/docs/bug-65.xml + tests/general/Makefile.am tests/general/bug-65.*: added a + specific example in the regression tests + +Sat Oct 6 12:41:37 CEST 2001 Daniel Veillard + + * libxslt/pattern.c: fixed bug #61627 + * tests/docs/Makefile.am tests/docs/bug-64.xml + tests/general/Makefile.am tests/general/bug-64.*: added a + specific example in the regression tests + * tests/docs/Makefile.am tests/docs/bug-63.xml + tests/general/Makefile.am tests/general/bug-63.*: added a + specific example in the regression tests for bug #61291 + (fixed in libxml2 module) + * tests/reports/Makefile.am tests/reports/undefvar.*: added + a test for handling undefined variables + +Thu Oct 4 15:49:57 CEST 2001 Daniel Veillard + + * configure.in xslt-config.in: trying to fix bug #60890 + +Thu Oct 4 15:28:25 CEST 2001 Daniel Veillard + + * configure.in: applied patch to close bug #60724 + +Tue Oct 2 21:38:23 CEST 2001 Thomas Broyer + + * libexslt/date.c: applied patch from Charlie Bozeman that fixes + a bug in DAY_IN_WEEK and implements the date:week-in-month function + +Tue Oct 2 17:11:15 CEST 2001 Daniel Veillard + + * libxslt/extra.[ch] tests/extensions/list.* + tests/extensions/evaluate.*: applied patch from Darren Graves + adding support for Saxon's evaluate & expression extension functions + http://users.iclway.co.uk/mhkay/saxon/saxon6.3/extensions.html + +Mon Oct 1 17:18:32 CEST 2001 Daniel Veillard + + * libxslt/xsltwin32config.h.in win32/dsp/libexslt_*.dsp: applied + patches from Igor for Windows. + +Tue Sep 18 11:48:20 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: fixed bug #60624 + * libxslt/xsltutils.c: improver the error context reporting + * tests/reports/Makefile.am tests/reports/tst-2.*: added a + specific regression test + * xsltproc/xsltproc: free the stylesheet if it contained an error. + +Mon Sep 17 14:45:48 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed a problem with global var override + being reported as an error. + * tests/docs/Makefile.am tests/docs/bug-61.xml + tests/general/Makefile.am tests/general/bug-61.*: added a + specific example in the regression tests + * configure.in tests/Makefile.am tests/reports/*: adding a test + to make sure redefinition of global variables in the same stylesheet + are still reported + +Sat Sep 15 17:32:16 CEST 2001 Daniel Veillard + + * libxslt/extra.c: okay the code from Norm is really non + portable and break everywhere except on Sun and Linux + platform. Compile it only on those targets. + +Sat Sep 15 06:25:02 CEST 2001 Thomas Broyer + + * libexslt/date.c: fixed some bugs (reported by Charles Bozeman + and Justin Fletcher) + +Fri Sep 14 15:22:30 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: Fixing bug #60415 + * tests/docs/Makefile.am tests/docs/bug-61.xml + tests/general/Makefile.am tests/general/bug-61.*: added a + specific example in the regression tests + +Fri Sep 14 12:42:22 CEST 2001 Daniel Veillard + + * tests/docbook/result/*: the change in libxml to output + decimal charrefs instead of hexadecimal changed a lot of + docbook results + +Thu Sep 13 15:30:01 CEST 2001 Daniel Veillard + + * libxslt.spec.in doc/Makefile.am: install xsltproc man page + +Wed Sep 12 21:09:53 CEST 2001 Daniel Veillard + + * configure.in: preparing for 1.0.4 + * doc/xslt.html doc/html/*: updated and regenerated docs + +Wed Sep 12 18:10:33 CEST 2001 Thomas Broyer + + * libexslt/date.c: fixed some compile warnings and disabled + debugging by default. + +Wed Sep 12 17:00:53 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def libxslt/variables.[ch]: trying to + incorporate comments from bug #59220 + +Wed Sep 12 05:51:32 CEST 2001 Thomas Broyer + + * configure.in libexslt/date.c libexslt/Makefile.am + libexslt/exslt.[ch] libexslt/.cvsignore: added implementation + of the EXSLT - Dates and Times core functions. + The exsltDateFormat* functions need to be reworked but it + works like this, even if it's quite messy. + * tests/exslt/strings/.cvsignore: added + +Tue Sep 11 14:48:43 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: tell in usage that parameter strings + need to be quoted + +Tue Sep 11 13:42:49 CEST 2001 Daniel Veillard + + * libxslt/Makefile.am libxslt/transform.c: trying to close + bug #60304 on xsl:fallback usage + * tests/docs/Makefile.am tests/docs/bug-60.xml + tests/general/Makefile.am tests/general/bug-60.*: added a + specific example in the regression tests + +Tue Sep 11 13:02:34 CEST 2001 Daniel Veillard + + * tests/documents/Makefile.am tests/documents/*: changed the + test to use doc%5Ffile instead of doc%20file, this is + sufficient to preserve the test capacities while closing + bug #60090 + +Tue Sep 11 12:33:03 CEST 2001 Daniel Veillard + + * libxslt/extra.c : close #59570 by simply not providing + Norm's extension on FreeBSD. + * tests/general tests/docs: added a couple of new entries + in the testsuite + * libexslt/strings.c: NULL initialized a local variable + which was tested later on. + +Mon Sep 10 22:52:44 CEST 2001 Daniel Veillard + + * libxslt/pattern.c tests/docbook/result/fo/*: applied fix from + #60143 and rebuilt the FO test outputs + +Mon Sep 10 19:38:54 CEST 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/transform.c: fixed bug #59757 + on inheritance of attributes from multiple attributes-sets + +Mon Sep 3 02:14:58 CEST 2001 Thomas Broyer + + * libexslt/Makefile.am libexslt/exslt.[ch] libexslt/strings.c: + added implementation of EXSLT - Strings. + Currently implemented functins are str:tokenize, str:align + str:concat and str:padding. + * configure.in tests/exslt/Makefile.am + tests/exslt/strings/Makefile.am + tests/exslt/strings/tokenize.1.*: added a test for the + str:tokenize function. + +Fri Aug 31 13:51:53 CEST 2001 Daniel Veillard + + * libxslt/libxslt.4 libexslt/libexslt.4 libxslt/Makefile.am + libexslt/Makefile.am: added man pages provided by Heiko Rupp + +Wed Aug 29 21:23:54 MDT 2001 John Fleck + + * doc/tutorial/libxslttutorial.xml, libxslttutorial.html - update + tutorial text to add references to global variables cleanups + +Wed Aug 29 21:05:43 MDT 2001 John Fleck + + * doc/xsltproc.1 - added xsltproc man page (note: this has not + been added into the build yet) + +Wed Aug 29 22:58:58 CEST 2001 Daniel Veillard + + * doc/tutorial/libxslt_tutorial.c doc/tutorial/libxslttutorial.html + doc/tutorial/libxslttutorial.xml: added global variables cleanups + to the example. + * tests/documents/Makefile.am: mjcox pointed to some missing files + +Wed Aug 29 15:32:52 CEST 2001 Thomas Broyer + + * libexslt/common.c: fixed a bug in exsltNodeSetFunction + +Wed Aug 29 15:18:28 CEST 2001 Thomas Broyer + + * libexslt/common.c: implemented version 3 of the exslt:node-set() + function. + * tests/exslt/common/Makefile.am + tests/exslt/common/node-set.3.{xml,xsl,out}: added a test + +Mon Aug 27 08:27:21 MDT 2001 John Fleck + + * adding doc/xsltproc.html - html generated from xsltproc.xml, + update doc/xslt.html with link to xsltproc.html + +Mon Aug 27 08:21:47 MDT 2001 John Fleck + + * adding doc/xsltproc.xml - user manual for xsltproc + +Sun Aug 26 20:52:02 CEST 2001 Daniel Veillard + + * libxslt/numbers.c libxslt/xslt.c: removed a couple of + warning raised by the Windows compiler (Chris Poblete) + +Fri Aug 24 01:15:24 CEST 2001 Daniel Veillard + + * libxslt/functions.h libxslt/preproc.c libxslt/transform.c: + closed bugs #59212 and #59220 + +Thu Aug 23 23:18:44 CEST 2001 Daniel Veillard + + * config.h.in configure.in xsltproc/xsltproc.c: complete test + of a DocBook XSLt transform with --nonet, need stat(), added + checking in configure. + +Thu Aug 23 17:37:40 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: catalog integration, cleanup with + the --nonet option closing #59427 + * libxslt/xslt.c: removed a small memleak when using a + stylesheet PI + +Tue Aug 21 13:17:19 CEST 2001 Daniel Veillard + + * //Makefile.am : fixed an error I propagated to nearly all + Makefiles.am on Saturday + +Tue Aug 21 13:10:03 CEST 2001 Daniel Veillard + + * libexslt/math.c libxslt/numbers.c: use xmlXPathIsNaN() and + xmlXPathIsInf() + * libxslt/pattern.c: tag a potential threading problem. + +Tue Aug 21 11:18:45 CEST 2001 Bjorn Reese + + * libxslt/numbers.c libexslt/math.c: Re-worked NaN and Inf + support. + +Sat Aug 18 15:57:46 CEST 2001 Daniel Veillard + + * //Makefile.am : fixed a number of small problems with + Makefiles spotted by Albert Chin + +Thu Aug 16 14:37:55 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def: minimal changes to compile 1.0.2 on + Windows/MSC + +Thu Aug 16 12:58:11 CEST 2001 Daniel Veillard + + * libxslt/extensions.c: fixed a permutation of args to + xsltPrintErrorContext() + +Wed Aug 15 15:19:14 CEST 2001 Daniel Veillard + + * Makefile.am config.h.in configure.in libxslt/xsltwin32config.h: + release of 1.0.2 + * tests/docs/Makefile.am libexslt/Makefile.am + tests/documents/Makefile.am tests/general/Makefile.am + xsltproc/Makefile.am: cleaning of Makefiles pointed out + by make distcheck + +Wed Aug 15 13:54:41 CEST 2001 Daniel Veillard + + * libxslt/functions.h libxslt/transform.c: a bit of cleanup + +Wed Aug 15 12:06:43 CEST 2001 Daniel Veillard + + * libexslt/common.c libexslt/math.c libxslt/Makefile.am + libxslt/libxslt.h libxslt/xsltconfig.h.in: cleanup of includes + export xsltconfig.h at make install stage + +Tue Aug 14 20:51:09 MDT 2001 John Fleck + + * doc/xslt.html updated xsltproc description with the many new + command line options Daniel has added, cleaned up some spelling + +Tue Aug 14 18:41:02 CEST 2001 Daniel Veillard + + * libxslt/extra.c libxslt/keys.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c libxslt/xsltutils.c: + serious changes on Result Value Trees and NodeSets + w.r.t. deallocation and collect operations. Probably not + 100% clean (merge of allocated trees smells like a problem). + Seems sufficient to close #58943 . Also check if XPath evaluations + failed, and in this case stops the processing and avoid + going further, goal is to not segfault on broken XSLT. + +Tue Aug 14 15:32:08 CEST 2001 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c: trying to kill bug #58878, + some associated serious cleanup in the pattern code. + * tests/docbook/result/*: regenerated all the results for the + docbook testsuite. Seems killing #58878 also changes the + fo results seriously. + * tests/docs/Makefile.am tests/docs/bug-5[56].xml + tests/general/Makefile.am tests/general/bug-5[56].*: added + 2 more tests + +Tue Aug 14 05:01:30 CEST 2001 Thomas Broyer + + * libxslt/xslt.c libxslt/xsltInternals.h libxslt/transform.c + libxslt/extra.[ch] libxslt/extensions.c libxslt/preproc.[ch]: + fixed compilation warnings due to recent changes to the extension + framework. + * libxslt/preproc.[ch] libexslt/common.c + fixed the precomputation of *:document elements + * libxslt/functions.h: fixed a compilation warning + +Mon Aug 13 11:41:02 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: applied fix suggested by Tom Moog + for xsltTimeStamp() in bug report #58012 + +Sun Aug 12 21:53:13 CEST 2001 Daniel Veillard + + * libxslt/functions.c libxslt/keys.c libxslt/transform.c + libxslt/xsltutils.h: cleaned up the code w.r.t. handling + of 'non-standard' libxml element like namespace nodes. + * tests/docs/Makefile.am tests/docs/bug-54.xml + tests/general/Makefile.am tests/general/bug-54.*: added a + specific example in the regression tests + +Wed Aug 8 22:57:05 CEST 2001 Daniel Veillard + + * HACKING: added John Fleck right to commit in the doc subdir + +Tue Aug 7 03:11:31 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: for heriting defaulted atts from the DTD + * tests/docs/Makefile.am tests/docs/bug-52.xml tests/docs/bug-53.xml + tests/general/Makefile.am tests/general/bug-52.* + tests/general/bug-53.*: Added a few new tests for recently fixed + stuff in libxml + * tests/xmlspec/REC-xml-20001006-review.html + tests/xmlspec/REC-xml-20001006.html: inheriting default attrs from + DTD changed the result by adding extra attributes to the HTML output + +2001-08-06 Peter Williams + + * libexslt/Makefile.am, xsltproc/Makefile.am: Fixes for compiling + when srcdir != builddir. + +Sun Aug 5 09:37:14 CEST 2001 Thomas Broyer + + * libxslt/extensions.[ch] libxslt/preproc.[ch] libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h: modified extension framework + to easify extension element precomputation. + * libexslt/functions.c: uses the new framework and precomputes + func:result elements. + +Sat Aug 4 20:42:32 CEST 2001 Daniel Veillard + + * libxslt/transform.c: bug fix on output="text" from Nicolas Marsgui + +Fri Aug 3 14:23:25 CEST 2001 Daniel Veillard + + * tests/general/bug-21-.out tests/general/bug-31-.out: + this got fixed by libxml patches + * win32/readme.msvc win32/dsp/* xsltproc/xsltproc.c + Makefile.am libexslt/exslt.[ch] libexslt/exsltconfig.h.in + libexslt/functions.c libexslt/math.c libxslt/win32config.h + libxslt/xsltconfig.h.in libxslt/xsltutils.h + libxslt/xsltwin32config.h libxslt/xsltwin32config.h.in: + Applied Igor Zlatkovic Win32 Facelift No.2 patch, and fixed + a few things related to those changes. + +Wed Aug 1 13:58:21 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: well one need one \n after DOCTYPE + * test//*/*.out: the output of some tests changed, looks better + actually + +Wed Aug 1 13:21:18 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: avoid extra \n when serializing top + text nodes. + +Wed Aug 1 10:37:50 CEST 2001 Daniel Veillard + + * libxslt/extra.c: one more revision on Norm's localTime() function + +Wed Aug 1 01:37:41 CEST 2001 Thomas Broyer + + * libexslt/sets.c: fixed bugs in exsltTrailingFunction and + exsltLeadingFunction when passing an empty node-set as the + second argument + * libxslt/functions.[ch]: gave priority to context-level functions + over extension module functions. This allows a function declared + with a func:function element to override an extension module + function for example. This is a bit hackish... + * tests/exslt/sets/{lead,trail}ing.1.out: fixed errors. The result + values didn't conform to the expected values. This is a bug in + the EXSLT official use cases. + +Tue Jul 31 23:53:55 CEST 2001 Daniel Veillard + + * config.h.in configure.in libxslt/extra.c: tried to integrate + Norm's implemntation of localTime() + +Tue Jul 31 03:47:10 EDT 2001 Daniel Veillard + + * libxslt/extra.c: fixed a serious proble is node-set was called + on a nodeset + * tests//*/Makefile.am: fixed the rule to rebuild xsltproc + +Lun Jul 30 05:47:43 CEST 2001 Thomas Broyer + + * libexslt/functions.c: fixed memory leaks + +Sun Jul 29 08:37:59 EDT 2001 Daniel Veillard + + * libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h + libxslt/xslt.[hc] libxslt/xsltInternals.h xsltproc/xsltproc.c: + more cleanup of the problems introduced with EXSLT, also closes + bug #58180 + +Sat Jul 28 08:25:05 MDT 2001 John Fleck + + * doc/internals.html - general cleanup + +Fri Jul 27 04:00:38 CEST 2001 Thomas Broyer + + * configure.in tests/Makefile.am tests/exslt/*: added some tests + to check EXSLT conformance + * libexslt/sets.c: fixed a typo when registering has-same-node + +Fri Jul 27 12:33:52 EDT 2001 Daniel Veillard + + * libxslt/extensions.c xsltproc/xsltproc.c: quick cleanup + of memory allocations, raise a bug in the test suite, also + need to be centralized as a single cleanup function. + +Fri Jul 27 10:50:39 EDT 2001 Daniel Veillard + + * libxslt/transform.[ch]: applied changes from Tom Moog #58002 + * libexslt/functions.c libxslt/documents.c libxslt/extensions.c: + Some cleanup, there is still a memory leak left and some warnings + in libexslt. + +Thu Jul 26 19:05:48 CEST 2001 Thomas Broyer + + * libxslt/extensions.[ch] libxslt/functions.[ch] libxslt/preproc.c + libxslt/transform.[ch] libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h: new extension framework. + Added stylesheet module data, top-level and extension elements + precomputing, global registration of top-level elements and + extension elements and functions. + Extensions are no longer initialized from extension-element-prefixes + declarations but when modules need the data. + init/shutdown functions registered with xsltRegisterExtModule{,Full} + only allocate and free module data, they shouldn't register the + elements and functions any more. + * libxslt/xsltutils.c: fixed a bug in xsltPrintErrorContext when + @node wasn't NULL. + * libxslt/xslt.c: fixed xsltPrecomputeStylesheetTop which allowed + non-XSLT top-level elements before any xsl:import element. + * libexslt/common.c libexslt/functions.c libexslt/math.c + libexslt/sets.c: adapted to use the new extension framework. + * libxslt/functions.c libxslt/extensions[ch] xsltproc/xsltproc.c: + moved the test module from functions.c to extensions.[ch], + modified it to use the new extension framework. Updated xsltproc + to register the test module. + +Thu Jul 26 10:20:19 EDT 2001 Daniel Veillard + + * libxslt/pattern.c: fixed an ugly problem with namespaces + in templates compilation + * tests/namespaces/tst4.*: added a specific testcase + * libxslt/transform.c: reenabled debug + +Tue Jul 24 17:45:22 CEST 2001 Daniel Veillard + + * configure.in libxslt.spec.in libxslt/xsltwin32config.h: + releasing 1.0.1 + * doc/html/*.html: updated the docs. + * xsltproc/xsltproc.c: activate line numbering unfortunately + this works only with CVS, libxml2-2.4.1 is broken in this respect + +Mon Jul 23 23:35:00 HKT 2001 William M. Brack + + * libxslt/documents.c enhancement to xsltFindDocument to + cater for the Matt Sergeant patch + +Mon Jul 23 09:32:27 MDT 2001 John Fleck + + * updating libxslt tutorial to include param support + +Mon Jul 23 20:12:38 CEST 2001 Daniel Veillard + + * libexslt/math.c: small cleanup + * libxslt/functions.c: patch to document('') from Matt Sergeant + * libxslt/xsltInternals.h libxslt/xsltutils.[ch]: profiler on Windows + c.f. bug #57464 from Tom Moog + +2001-07-19 Darin Adler + + * configure.in: Add HTML_DIR definition. + * xsltproc/.cvsignore: Ignore some generated files. + +2001-07-18 Peter Williams + + * xsltproc/Makefile.am (INCLUDES): Fix compiling when + srcdir != builddir. + +2001-07-17 Thomas Broyer + + * libexslt/.cvsignore libexslt/Makefile.am libexslt/utils.[ch] + libexslt/common.c libexslt/functions.c libexslt/math.c + libexslt/sets.c: removed utils.[ch] as their content is + integrated in libxml + * libexslt/sets.c: uses the new libxml functions + * libxslt/extra.[ch]: removed exsl:document + * AUTHORS: added /me + +2001-07-16 Thomas Broyer + + * libexslt/.cvsignore: some more generated files to ignore + * libexslt/Makefile.am: utils.h not installed anymore + * libexslt/common.c libexslt/exslt.[ch] libexslt/functions.c + libexslt/math.c libexslt/sets.c: + changed function prefix from exsl* to exslt* + {common.c,exslt.c} moved exsltLib{rary,exslt,xslt,xml}Version + from common.c to exslt.c + {common.c} removed exslNodeSetFunction, uses xsltFunctionNodeSet + instead + * libxslt/extra.c: fixed xsltFunctionNodeSet to accept + XPATH_NODESET arguments in addition to XPATH_XSLT_TREE + * xsltproc/xsltproc.c: updated to use the new function prefix + +2001-07-15 Darin Adler + + * libxslt/.cvsignore: + * tests/XSLTMark/.cvsignore: + * tests/extensions/.cvsignore: + * tests/xmlspec/.cvsignore: + Some more generated files to ignore. + +Mon Jul 16 14:26:48 CEST 2001 Daniel Veillard + + * Makefile.am configure.in libexslt/Makefile.am: + Integration of libexslt in the build system + * libxslt/Makefile.am libxslt/xsltproc.c libxslt/xsltutils.c + xsltproc/Makefile.am xsltproc/xsltproc.c: + Moved xsltproc to a separate directory, linked it to libexslt, + and added exslt version reports to -V + * tests/*/Makefile.am: updated the path to xsltproc + * libexslt/common.c libexslt/exslt.h libexslt/exsltconfig.h.in + libexslt/functions.c libexslt/math.c libexslt/sets.c: added + versionning informations, some cleanup, and added documentation + to a couple of exported functions + +Sun Jul 15 15:27:47 CEST 2001 Thomas Broyer + + * libexslt/Makefile.am: account for new source files + * libexslt/.cvsignore: added + +Sun Jul 15 05:02:50 CEST 2001 Thomas Broyer + + * libexslt/exslt.[hc] libexslt/common.[hc] libexslt/functions.[hc] + libexslt/math.[hc] libexslt/sets.[hc] libexslt/utils.[hc]: + start implementing EXSLT + +Sun Jul 15 16:01:55 CEST 2001 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h libxslt/preproc.c: + trying to accept AVT for "format" in xsl:number + +Fri Jul 13 16:57:08 CEST 2001 Daniel Veillard + + * win32/libxslt/libxslt.defs: trying to close #57460 by adding + xsltProfileStylesheet + +Thu Jul 12 21:31:06 CEST 2001 Daniel Veillard + + * libxslt/documents.c libxslt/extensions.c libxslt/extra.c + libxslt/functions.c libxslt/imports.c libxslt/keys.c + libxslt/namespaces.c libxslt/numbers.c libxslt/pattern.c + libxslt/preproc.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xslt.c: provide context for + error messages. Requires libxml head changes. + * libxslt/xsltutils.c libxslt/xsltutils.h: fixed a --profile + problem + +Wed Jul 11 00:32:21 CEST 2001 Daniel Veillard + + * libexslt/Makefile.am: initial EXSLT framework + +Tue Jul 10 18:03:36 CEST 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: releaseing 1.0.0 + * win32/libxslt/libxslt.def: added another entry point + * libxslt/transform.c: fixed a comment block + * doc/xslt.html doc/html/*: updated and regenerated the docs + +Tue Jul 10 17:25:59 CEST 2001 Daniel Veillard + + * win32/libxslt/libxslt.def: added missing functions + +Tue Jul 10 16:48:43 CEST 2001 Daniel Veillard + + * FEATURES libxslt/xsltproc.c libxslt/transform.c + libxslt/xsltInternals.h: added Embedding Stylesheets + * tests/REC/Makefile.am tests/REC/stand-2.7-1.*: added the test + from the REC about it + * libxslt/transform.c libxslt/extra.[ch] libxslt/preproc.c: + tried to accomodate the various (and changing) proprietary + ways of implementing chunking. + * tests/docbook/result/xtchunk/html: now output is generated in + ISO-8859-1 + +Mon Jul 9 23:23:50 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: small cleanup + * libxslt/transform.c libxslt/xslt.c : patch from Michal Sajdak + for cdata/text handling + +Mon Jul 9 22:02:40 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: small fix for xsl:message by Stephane GUIBOU + * tests/documents/Makefile.am tests/documents/message.*: added + a specific regression test + * libxslt/transform.c: fixed an infinite loop + * configure.in doc/Makefile.am: attempt to add --with-html-dir, + this may work + +Mon Jul 9 15:55:14 CEST 2001 Daniel Veillard + + * libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h: + fixed exclude-result-prefixes handling and how namespaces + propagate from the stylesheet to the result in general, this + is a serious cleanup. + * tests/general/bug-3[67]-inc.xsl tests/general/bug-6-.xsl + tests/general/itemschoose.out tests/namespaces/extra.xsl + tests/REC/test-10-1.xsl tests/REC/test-10-2.xsl + tests/REC/test-11.2-1.xsl tests/REC/test-11.2-2.xsl + tests/REC/test-11.2-6.xsl tests/REC/test-15-1.xsl + tests/REC/test-16.1-1.xsl tests/REC/test-16.1-2.xsl + tests/REC/test-5.4-1.out tests/REC/test-5.4-2.out + tests/REC/test-5.4-3.out tests/REC/test-5.4-4.out + tests/REC/test-7.1.1-2.out tests/REC/test-7.1.1-2.xsl + tests/REC/test-7.1.1-3.out tests/REC/test-7.1.1-3.xsl + tests/REC/test-7.1.1.out tests/REC/test-7.1.3.xsl + tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl + tests/REC/test-7.6.1-1.xsl tests/REC/test-7.6.1-2.xsl + tests/REC/test-7.6.1-3.xsl tests/REC/test-7.6.2-1.xsl: + fixed and rechecked all the tests where the namespace + propagation was wrong either taht the rules were not applied + correctly or that superfluous namespaces were declared in the + stylesheets + +Sun Jul 8 22:12:02 CEST 2001 Daniel Veillard + + * libxslt/extra.c libxslt/functions.c libxslt/transform.[ch] + libxslt/variables.h: Norm pointed out that element-available() + didn't work, implemented it + * tests/extensions/Makefile.am tests/extensions/list.*: added + a test for all registered xslt element, function and default + extensions. + +Sun Jul 8 20:44:25 CEST 2001 Daniel Veillard + + * tests/documents/Makefile.am 'tests/documents/doc file.xml' + tests/documents/docfile.xml tests/documents/test.result + tests/documents/test.xml tests/documents/test.xsl: + added a test for URI-escaping on document() input + +Sun Jul 8 16:34:07 CEST 2001 Daniel Veillard + + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-49-* tests/docs/bug-49-* + tests/general/bug-50-* tests/docs/bug-50-*: added a + couple of regression tests for bugs posted on the list + +Sun Jul 8 15:40:44 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: avoid generating CDATA node in document + tree when parsed, force generation of text nodes instead. + +Sun Jul 8 14:39:27 CEST 2001 Daniel Veillard + + * doc/extensions.html: fixed a number of typo found by Dan York + * libxslt/xsltutils.c: improved the profiling ouput, added the + average value too. + +Sun Jul 8 00:01:21 CEST 2001 Daniel Veillard + + * libxslt/variables.c: tryingt to fix a problem raised by Norm + +Sat Jul 7 23:19:09 CEST 2001 Daniel Veillard + + * config.h.in configure.in: added gettimeofday() check + * libxslt/transform.c libxslt/xsltInternals.h libxslt/xsltutils.[ch]: + profiling works option --profile (or --norman ;) + +Sat Jul 7 18:58:56 CEST 2001 Daniel Veillard + + * libxslt/templates.c libxslt/transform.c libxslt/transform.h + libxslt/variables.c: big cleanup on the way templates or + template fragments are processed, cleanup of stack building + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-4[1-8]-* tests/docs/bug-4[1-8]-*: added a + series of regression test for the variable/params lookups + * libxslt/transform.c libxslt/xsltutils.[ch] libxslt/xsltproc.c: + started working on profiling code, there is just invocation counting + yet but the framework is in place. + +Sat Jul 7 11:20:59 CEST 2001 Daniel Veillard + + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-40-* tests/docs/bug-40-*: added a specific + regression test for the variable scope within templates problem + +Sat Jul 7 17:05:00 HKT 2001 Wiliam Brack + + * xsltInternals.h variables.c transform.c: + fixed problem with variable scope within templates + +Fri Jul 6 17:42:06 CEST 2001 Daniel Veillard + + * doc/extensions.html doc/internals.html doc/xslt.html: + added a documentation on writing libxslt extensions, and + added links to the main page + * libxslt/functions.c libxslt/xsltInternals.h + +Fri Jul 6 14:30:00 HKT 2001 William Brack + + * cleaned up many comments and error messages + +Fri Jul 6 01:43:51 CEST 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: released 0.14.0 + * doc/xslt.html: added 0.14.0 release + +Fri Jul 6 01:00:55 CEST 2001 Daniel Veillard + + * doc/html/*: rebuilt docs before release + * libxslt/extensions.c: fixed a function doc header + +Fri Jul 6 00:40:55 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/xslt.c libxslt/xsltInternals.h: added exclude-result-prefix + support + * tests/REC/Makefile.am tests/REC/test-7.1.1-[23]*: added a couple + of specific tests + * tests/xmlspec/REC-xml-20001006-review.html: seems this changed + something there, not visually perceptible + +Thu Jul 5 22:49:57 CEST 2001 Daniel Veillard + + * tests/docbook/result/: the change in libxml affected the + output of the Docbook tests (of course it was detected on + a DocBook example) + +Thu Jul 5 15:11:58 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/transform.c: added cdata-section-elements + * tests/REC/Makefile.am tests/REC/test-16.1-*: added 2 tests from + the REC + +Thu Jul 5 10:44:47 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/xsltutils.c: do not dump document for which there have + been no generated content + * tests/multiple/result.xml tests/namespaces/extra2.out: fixed + test output accordingly + * libxslt/transform.c libxslt/preproc.c: added xsl:fallback support + * tests/REC/Makefile.am tests/REC/test-15-1.*: xsl:fallback test + * tests/xmlspec/Makefile.am tests/docbook/Makefile.am: cleanups + +Wed Jul 4 15:15:50 CEST 2001 Daniel Veillard + + * libxslt/extension.[ch] libxslt/extra.[ch] libxslt/xsltInternals.h + libxslt/transform.c libxslt/functions.c: Added the extension API + suggested by Thomas Broyer, this should allow implementation of + EXSLT for example. + * libxslt/extra.[ch]: added a fake xsltFunctionLocalTime() in Norm's + CVS extension namespace to avoid complaints, some cleanup + * configure.in tests/Makefile.am tests/extensions/*: added a test + for new modules testing both elements and functions registration + +Fri Jun 29 23:32:37 CEST 2001 Daniel Veillard + + * libxslt/pattern.c libxslt/preproc.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltutils.[ch]: added xsltGetQNameURI() + and cleaned up the way URI for QNames were computed through + the code, serious cleanup. + * libxslt/xsltInternals.h libxslt/xslt.c: moved cdata-sections + in their own hash table, implementation not yet finished. + +Thu Jun 28 23:01:14 CEST 2001 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xsltutils.c: hum seems I forgot + to save/restore some XPath context, bug raised by + Steve Cheng + +Thu Jun 28 15:48:06 CEST 2001 Daniel Veillard + + * libxslt/xsltwin32config.h[.in]: added configuration/version + informations for Windows/MSC + * libxslt/libxslt.h libxslt/*.c: internal header to centralize + includes switches + * libxslt/Makefile.am: added libxslt.h and xsltwin32config.h[.in] + * libxslt/*.[ch] libxslt/*.in: quite a bit of cleanup, especially + the email addresses + * AUTHORS: added William + +Tue Jun 26 18:45:38 CEST 2001 Daniel Veillard + + * configure.in doc/xslt.html: releasing 0.13.0 + * doc/Makefile.am: don't index the win32 include + * doc/html/*: rebuilt the docs + +Mon Jun 25 15:30:30 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: John Fleck found a typo in usage() + * libxslt/xslt.c: avoid warning if version="1.1" is used + * libxslt/transform.c: forgot to initialize cur->outputFile + * libxslt/functions.c: DOCBOOK_XSL_HACK some versions of DocBook XSL + use the vendor string to detect supporting chunking, this + is a workaround to be considered in the list of decent XSLT + processors + +Mon Jun 25 12:41:30 CEST 2001 Daniel Veillard + + * libxslt/transform.[ch] libxslt/xslt.c libxslt/xsltInternals.h: + added a new interface xsltRunStylesheet() for a more flexible + handling of the output and trying to adhere to xsl:document + filename generation semantic if one knows the URL of the output, + also add IObuf capacity and SAX for output but is currently not + implemented. + * libxslt/xsltproc.c: added a -o or --output filename argument + to test xsltRunStylesheet() or provide a base when generating + multiple outputs + * tests/docbook/Makefile.am tests/docbook/result/xtchunk/html/*: + updated tests to add DocBook xt:document based chunking + * tests/multiple/Makefile.am: cleaned up the makefile a bit + * tests/multiple/out/*.html: the new xt:document now generate + the DOCTYPE if available as is the case for HTML + +Mon Jun 25 08:45:00 HKT 2001 William Brack + + * Removed some redundant code in xsltDefaultProcessOneNode + and revised the default processing of an attribute node + +Sun Jun 24 14:40:00 HKT 2001 William Brack + + * Enhanced ApplyTemplates and ForEach to allow multiple + documents within a nodelist. + * Repaired small bug in xsltDocument function which caused + a crash if invalid second argument was provided. + +Sat Jun 23 15:44:00 MDT 2001 John Fleck + + * doc/tutorial/libxslttutorial.xml, libxslttutorial.html + updating tutorial with explanation of xsltSave vs. xmlSave + functions + +Sat Jun 23 19:04:27 CEST 2001 Daniel Veillard + + * test/docbook: updated to docbook-xsl-1.4, regenerated results + +Sat Jun 23 15:32:25 CEST 2001 Daniel Veillard + + * Makefile.am libxslt/Makefile.am libxslt/numbers.c + libxslt/win32config.h libxslt/xsltconfig.h.in libxslt/xsltproc.c: + Patches for Windows mostly contributed by Yon Derek + * win32/libxslt/libxslt.def win32/libxslt/libxslt.dsw + win32/libxslt/libxslt_so.dsp win32/libxslt/xsltproc.dsp: + Project file for Mircrosoft C provided by Yon Derek + +Sat Jun 23 14:20:01 CEST 2001 Daniel Veillard + + * libxslt/pattern.c: closing bug #56517, fixed a number of + problems in the patterns compilations, priorities and debug + * libxslt/transform.c: improved the template debug message + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-39-* tests/docs/bug-39-*: added a specific + regression test for #56517 + +Fri Jun 22 16:17:23 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: avoid a stupid bug when compiling with + libxml < 2.3.11 and without LIBXML_DEBUG_ENABLED + +Fri Jun 22 00:11:18 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: fix of a small bug + * libxslt/transform.c libxslt/variables.c libxslt/xslt.c: cleanups + while bug-hunting + +Tue Jun 19 16:13:49 CEST 2001 Daniel Veillard + + * tests/docbook/Makefile.am: added XHTML and XSL FO to the + regression tests + * tests/docbook/xhtml/*: added XHTML stylesheets + * tests/docbook/fo/*: added XSL FO stylesheets + * tests/docbook/result/xhtml/*: added XHTML results + * tests/docbook/result/fo/*: added XSL FO results + +Tue Jun 19 00:20:32 CEST 2001 Daniel Veillard + + * HACKING: fixed, added William + +Mon Jun 18 18:36:36 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: forgot to flush in xsltSaveTo() in html and + xml cases, and fixed text output to be recursive in text nodes + lookups + +Mon Jun 18 15:44:51 CEST 2001 Daniel Veillard + + * configure.in: patch from Tony Graham to cleanup libxml2 detection + +Sun Jun 17 17:42:33 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.[ch]: fixed xsltGetNsProp, i always forget + 'namespace' is a reserved C++ identifier + +Sun Jun 17 17:08:30 CEST 2001 Daniel Veillard + + * doc/xslt.html: adding 0.12.0 release + +Sun Jun 17 13:15:48 CEST 2001 Daniel Veillard + + * configure.in: preparing 0.12.0 release + * libxslt/transform.c: a bit of cleanup on the XInclude defaults + * libxslt/xsltconfig.h.in: added doc inline comment + * libxslt/xslt.[ch] libxslt/xsltproc.c: added more version informations + and enriched xsltproc --version to show them + * doc/html/*.html: rebuilt the docs + * doc/Makefile.am libxslt.spec.in: try to make sure John Fleck + tutorial ends up in the tars and RPMs + +Sat Jun 16 23:58:57 CEST 2001 Daniel Veillard + + * libxslt.spec.in: updated the descriptions + +Sat Jun 16 23:26:46 CEST 2001 Daniel Veillard + + * libxslt/namespaces.[ch]: added a single namespace def copy + operation xsltCopyNamespace(). cleaned up xsltCopyNamespaceList() + * libxslt/transform.c: cleaned up xsltCopyNode to cope with + any kind of input nodes. + * libxslt/variables.c: checked and closed the last TODO about + namespace propagation + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-38-* tests/docs/bug-38-*: added a specific + regression test for #56115 + +Sat Jun 16 09:27:27 MDT 2001 John Fleck + + * updating tutorial: adding discussion of freeing memory, image + files for callouts, link to xsltproc.c code + +Sat Jun 16 15:23:43 CEST 2001 Daniel Veillard + + * libxslt/variables.c: bug #56267 was still not fixed, forgot + to remove the old code + * tests/general/bug-37-.xsl: wrong reference to 36 fixed, this does + the test for good + +Sat Jun 16 00:32:39 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed bug #56267, namespaces must + be propagated when evaluating local variables. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-37-* tests/docs/bug-37-*: added a specific + regression test for #56267 + +Fri Jun 15 18:29:29 CEST 2001 Daniel Veillard + + * libxslt/keys.c: avoid a possibility of an uninitialized variable + * libxslt/documents.c libxslt/transform.[ch] libxslt/transform.h + libxslt/xsltInternals.h libxslt/xsltproc.c: Implement Raphael Hertzog + request to have xinclude processing done on document() if requested + +Thu Jun 14 20:52:13 CEST 2001 Daniel Veillard + + * libxslt/Makefile.am: applied patch from Sander Vesik for -j2 + +Thu Jun 14 10:07:59 CEST 2001 Daniel Veillard + + * libxslt/preproc.c: removed a warning on xsl:transform + * tests/docs/Makefile.am tests/docs/array.xml tests/general/Makefile.am + tests/general/array.out tests/general/array.xsl: added a new + test fround in xsl-dev + +Wed Jun 13 23:12:57 CEST 2001 Daniel Veillard + + * tests/docbook/result/html/*.html tests/XSLTMark/xslbench[12].out + tests/xmlspec/REC-xml-20001006*.html: the changes to the HTML + serializer of libxml impacted the result of some tests. Checked + that the XML REC renders identically. + +Mon Jun 11 07:19:06 MDT 2001 John Fleck + + * fixing embarassing typos in doc/tutorial/libxslttutorial.xml and + generated html + +Tue Jun 12 07:42:35 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed bug #55670, namespaces must + be propagated when evaluating global variables. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-36-* tests/docs/bug-36-*: added a specific + regression test for #55670 + +Mon Jun 11 09:35:53 CEST 2001 Daniel Veillard + + * doc/xslt.html: linked to the tutorial + +Sun Jun 10 19:36:31 MDT 2001 John Fleck + + * doc/tutorial/libxslt_tutorial.c, libxslttutorial.html, + libxslttutorial.xml + adding tutorial + +Sun Jun 10 21:52:35 CEST 2001 Daniel Veillard + + * libxslt/transform.c: closed bug #55723, problem was due to + a limitation of xsltGetNamespace() when the insertion point + is the document. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-35-* tests/docs/bug-35-*: added a specific + regression test for #55723 + +Sun Jun 10 13:37:33 HKT 2001 William Brack + + * libxslt/transform.c: fixed problems with document() in + xsltApplyTemplates and xsltForEach. Cleaned up several + error messages. + * libxslt/keys.c: saved and restored ctxt->document within + xsltInitKey to fix problem with keys when doc changed + * libxslt/documents.[ch]: added new procedure xsltFindDocument + needed when document() causes a change of doc within + xsltApplyTemplates and xsltForEach + +Thu Jun 7 21:31:46 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.[ch]: closing bug #55683 required to add + xsltGetNsProp() + * libxslt/attributes.c libxslt/imports.c libxslt/namespaces.c + libxslt/preproc.c libxslt/templates.c libxslt/xslt.c: + Updated to use the new function + * tests/XSLTMark/prettyprint.out tests/docbook/result/html/*.html: + the fixes in the serialization of

 in HTML in libxml
+	  led to a number of changes in the output
+
+Thu Jun  7 04:23:38 CEST 2001 Daniel Veillard 
+
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-32-* tests/docs/bug-32-*: added a specific
+	  regression test for #55722 
+
+Wed Jun  6 09:48:53 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: updated to ask to not send mail directly
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-33-* tests/docs/bug-33-*: added a specific
+	  regression test for #55722 
+
+Wed Jun  6 11:07:50 CEST 2001 Daniel Veillard 
+
+	* libxslt/pattern.c : trying to fix #55670
+	* tests/XSLTMark/reverser.out : result of test changed when
+	  William fixed XPath
+
+Sat Jun  2 06:52:12 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: updated with 0.11.0
+
+Fri Jun  1 11:30:49 CEST 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: released 0.11.0
+
+Mon May 28 12:54:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: William M. Brack found a small bug
+	  when call-template didn't find the template.
+
+Sat May 26 17:08:19 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: fixed handling of PI and comments
+	  (bug raised by Brent M Hendricks).
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-31-* tests/docs/bug-31-*: added a specific
+	  regression test
+
+Wed May 23 13:25:37 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: added --xinclude in the option list,
+	  patch from Raphael Hertzog
+	* test/docbook/Makefile.am: force at least the gdp-handbook.xml
+	  test in the normal testsuite
+
+Wed May 23 00:05:19 CEST 2001 Daniel Veillard 
+
+	* libxslt/variables.c: Mark Vakoc found a bug in variable eval
+	  at the top template level 
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-30-* tests/docs/bug-30-*: added a specific
+	  regression test
+
+Tue May 22 18:52:30 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: fixed the document() bug reported by
+	  Stephane GUIBOUD-RIBAUD
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-29-* tests/docs/bug-29-*: added a specific
+	  regression test
+
+Tue May 22 15:09:02 CEST 2001 Daniel Veillard 
+
+	* configure.in libxslt/Makefile.am: fixed bug #54953
+	* libxslt/attributes.c: cleanup pointed by Joe Orton
+	* libxslt/xsltproc.c: added --catalogs to load catalogs from
+	  $SGML_CATALOG_FILES
+	* libxslt/functions.c: cleanup unreached code
+	* configure.in config.h.in libxslt/xsltproc.c: guarded the
+	  include with preprocessor definitions
+
+Sun May 20 20:55:00 CEST 2001 Daniel Veillard 
+
+	* tests/documents/Makefile.am tests/general/Makefile.am
+	  tests/multiple/Makefile.am tests/namespaces/Makefile.am
+	  tests/numbers/Makefile.am tests/xmlspec/Makefile.am
+	  tests/REC/Makefile.am tests/REC1/Makefile.am tests/REC2/Makefile.am
+	  tests/XSLTMark/Makefile.am tests/docbook/Makefile.am
+	  configure.in: Makefiles cleanup from Joe Orton
+
+Sun May 20 15:20:49 CEST 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/external.html 
+	  tests/docbook/result/html/graphics.html
+	  tests/docbook/result/html/gtest.html
+	  tests/docbook/test/external.xml tests/docbook/test/subdoc.ent:
+	  Added a test from coolo for IDs in external parsed entities
+	  and fixed 2 outputs
+
+Sat May 19 22:28:05 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltconfig.h.in libxslt/xsltproc.c:
+	  added --version info to xsltproc closing #54952
+
+Sat May 19 17:41:23 CEST 2001 Daniel Veillard 
+
+	* tests/documents/Makefile.am tests/general/Makefile.am 
+	  tests/multiple/Makefile.am tests/namespaces/Makefile.am 
+	  tests/numbers/Makefile.am tests/xmlspec/Makefile.am:
+	  Seems some of the changes I made for 0.9.0 Makefiles were
+	  not commited ...
+
+Sat May 19 17:23:54 CEST 2001 Daniel Veillard 
+
+	* configure.in: preparing 0.10.0 release
+	* doc/xslt.html: updated
+	* doc/html/* : rebuilt the docs
+
+Fri May 18 16:48:13 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c libxslt/variables.c libxslt/templates.c
+	  libxslt/keys.[ch] libxslt/functions.c: cleanups for ctxt->inst
+	  avoiding modifying stylesheet informations, and fixing
+	  document() when called from a global variable init
+
+Thu May 17 17:24:35 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  add ctxt->inst to allow stylesheet element lookup (needed
+	  for document() fix)
+	* libxslt/*.[ch]: generate docs for the structures and
+	  macros, general cleanup for docs
+	* doc/html/*.html: regenerated all docs
+
+Wed May 16 23:00:53 CEST 2001 Daniel Veillard 
+
+	* libxslt/extra.c libxslt/transform.c libxslt/variables.[ch]
+	  libxslt/xsltInternals.h: optimizations, cleanup of global
+	  variables handling
+
+Wed May 16 12:29:17 CEST 2001 Daniel Veillard 
+
+	* libxslt/extensions.c libxslt/preproc.c libxslt/transform.c
+	  libxslt/variables.c: force the precompilation of XPath expressions
+	  at stylesheet compilation time
+
+Tue May 15 14:34:23 CEST 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/transform.c: avoid some possibilities
+	  of crashes on debug
+	* tests/REC/Makefile.am: be less verbose if things really go wrong
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/docs/bug-28-.xml tests/general/bug-28-.*: added bug-28 in
+	  the regression tests
+
+Sat May 12 12:39:54 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xsltutils.c: fixed the default
+	  detection method to generate HTML documents 
+	* tests/REC/test-2.5-1.out tests/REC/test-8-1.out
+	  tests/REC/test-9.1-2.out tests/REC2/html.xml tests/XSLTMark/game.out
+	  tests/XSLTMark/html.out tests/XSLTMark/products.out
+	  tests/XSLTMark/xslbench1.out tests/XSLTMark/xslbench2.out
+	  tests/XSLTMark/xslbench3.out tests/general/bug-15-.out
+	  tests/general/bug-5-.out: updated a number of tests output
+	  accordingly
+
+Sat May 12 09:43:10 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: use LIBXML_DOCB_ENABLED, William M. Brack
+
+Fri May 11 19:12:26 CEST 2001 Daniel Veillard 
+
+	* libxslt/templates.c libxslt/transform.c: fixed bug #54446
+	  about attribute being generated twice. Fixed a number of related
+	  bugs on attributes handling.
+	* tests/REC/test-7.1.4.out: this changed an attribute generation
+	  order
+	* tests/docs/bug-27-.xml tests/general/bug-27-.*: added test
+
+Fri May 11 17:08:14 CEST 2001 Daniel Veillard 
+
+	* libxslt/templates.c: fixed bug #54451 on escaped curly brackets
+	* tests/docs/bug-26-.xml tests/general/bug-26-.*: added test
+
+Fri May 11 16:20:40 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/XSLTMark/Makefile.am: try to handle gracefully
+	  the cases where perl is not in the path (nor in /usr/bin)
+	* tests/docbook/result/html/gdp-handbook.html
+	  tests/docbook/result/html/kwrite.html
+	  tests/docbook/test/gdp-handbook.xml
+	  tests/docbook/test/kwrite.xml: commited a few more DocBook tests
+
+Wed May  9 12:29:47 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: added --nonet and --warnnet to catch
+	  cases where a network access is needed to load a DTD or entity
+	* tests/docbook/Makefile.am: added --nonet
+	* tests/docbook/test/classsynop.xml tests/docbook/test/docbook40.xml:
+	  fixed 2 tests as a result
+
+Wed May  9 10:43:53 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/docbook/Makefile.am tests/docbook/**/Makefile.am:
+	  try to remove the unneeded docbook Makefile stuff 
+
+Tue May  8 16:18:19 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: fixed a link error
+	* libxslt/transform.c libxslt/xsltutils.c: fixed DOCTYPE generation
+	* libxslt/xsltproc.c: cleaned up the --repeat loop
+	* tests/documents/result.xhtml tests/xmlspec/REC-xml-20001006*.html:
+	  fixed the DOCTYPE in tests output
+	* tests/docs/bug-25-.xml tests/doc/Makefile.am 
+	  tests/general/bug-25-.* tests/general/Makefile.am : added a new
+	  test case and fixed the EXTRA_DIST
+
+Mon May  7 22:27:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/extra.c: add more debug to xsltDebug
+	* libxslt/transform.c: spent a few hours tracking down an ugly
+	  race like bug in xsltCopyTreeList() arghhh
+	* libxslt/xsltproc.c: call xmlInitMemory() explictely
+
+Mon May  7 11:38:54 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html: more work done on the doc, mostly complete
+	  except the section on the XSLT stack and the extensions API
+	  since both still need more work.
+
+Sun May  6 15:03:59 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html doc/contexts.* doc/object.*: more work done
+	  on the doc
+
+Sun May  6 00:18:39 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html: more work done on the doc
+
+Sat May  5 18:58:13 CEST 2001 Bjorn Reese 
+
+	* libxslt/transform.c tests/XSLTMark/xslbench1.out: Another fix
+	  for the CDATA output
+
+Sat May  5 18:09:15 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: do not escape content of CDATA nodes on output
+
+Sat May  5 17:52:52 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html doc/node.fig doc/node.gif doc/processing.fig
+	  doc/processing.gif doc/stylesheet.fig doc/stylesheet.gif
+	  doc/templates.fig doc/templates.gif: started writing tye doc
+	  on how libxslt works.
+
+Sat May  5 17:13:16 CEST 2001 Bjorn Reese 
+
+	* libxslt/numbersInternals.h libxslt/numbers.c
+	  tests/numbers/format-number.out tests/XSLTMark/number.out:
+	  Patch from William Brack to bring format-number() more in alignment
+	  with the Java implementations.
+
+	* libxslt/xslt.c tests/XSLTMark/xslbench1.out: Do not remove CDATA
+	  from stylesheet
+
+Fri May  4 20:10:45 CEST 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/* tests/general/bug-11-.out 
+	  tests/multiple/result.xml tests/XSLTMark/*.out 
+	  libxslt/transform.c: all the PUBLIC and SYSTEM IDs
+	  were swapped
+
+Fri May  4 19:09:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: add a --docbook option if your libxml2
+	  has the SGML DocBook support compiled in.
+
+Fri May  4 17:06:01 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-2[0-4].* tests/docs/bug-2[0-4].*: added more
+	  tests especially on sorting
+	* test/xsltutils.c: oops multiple sorts was actually broken !!!
+	  this should fix it
+
+Thu May  3 19:02:21 CEST 2001 Daniel Veillard 
+
+	* TODO configure.in libxslt.spec.in: getting ready for 0.9.0
+	  release
+	* doc/html/* doc/xslt.html: updated and regenerated the docs
+
+Thu May  3 17:56:55 CEST 2001 Daniel Veillard 
+
+	* xsltutils.[ch] transform.c: implemented multiple levels of
+	  sorting
+	* test/REC/test-10-2.*: added a really small test for it
+
+Wed May  2 14:04:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: fixed xsl:text processing
+	  there can be multiple text and CDATA child
+
+Wed May  2 10:55:56 CEST 2001 Daniel Veillard 
+
+	* tests/multiple/makefile.am: fixing #54015
+	* tests/XSLTMark/makefile.am tests/docbook/makefile.am: fixing #54014
+	  and a similar problem for the docbook tests
+
+Mon Apr 30 22:31:59 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-8-.out: fixed in libxml xpath
+	* libxslt/templates.[ch] libxslt/pattern.c: fixed an namespace
+	  problem in predicates within a pattern. Spotted another
+	  potential namespace problem
+
+Mon Apr 30 19:29:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/xslt.c libxslt/xsltInternals.h
+	  libxslt/xsltproc.c: counting errors and warnings at compilation
+	  time. Stop processing in case of error.
+	* tests/docs/bug-1[89]* tests/general/-1[89]* tests/general/inner.xsl:
+	  added more namespace related bug checks
+
+Mon Apr 30 13:47:11 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/variables.c: found the source of a
+	  memory leak with DocBook introduced this w.e.. bit of cleanup.
+	* tests/docbook/result/html/*.html : regenerated the DocBook tests
+	  results.
+
+Sun Apr 29 18:54:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/variables.c: fixing bug #53769
+	* tests/general tests/docs: added new examples from the
+	  bug reports to the regression tests, updated the Makefiles
+
+Sun Apr 29 11:47:58 CEST 2001 Daniel Veillard 
+
+	* preproc.[ch] templates.[ch] variables.[ch] xslt.c xsltInternals.h
+	  attributes.c extensions.[ch]: moved all stylesheet precomputation
+	  at stylesheet loading time (stylesheet transform should be thread
+	  safe now), improved params and variables evaluations (but optim
+	  is not complete yet).
+	* TODO: updated
+
+Sat Apr 28 16:28:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c : changed the way --repeat works when
+	  used twice
+
+Sat Apr 28 16:19:06 CEST 2001 Bjorn Reese 
+
+	* libxslt/numbers.c libxslt/preproc.c tests/REC/test-7.7-3.out:
+	  fixed default formatting
+
+Sat Apr 28 14:20:29 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c : fixed  bug reported by Ankh
+	* libxslt/xsltproc.c : added an option to process HTML input
+
+Thu Apr 26 21:13:59 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: Tony Gorski found a bug pointed by
+	  a compiler on Tandem
+	* tests/documents/result.xhtml: this results in a small
+	  change in the output of this test
+
+Thu Apr 26 16:33:36 CEST 2001 Daniel Veillard 
+
+	* test/general/bug-14*.* test/docs/bug-14*.xml: added testcase from
+	  bug #53689
+
+Wed Apr 25 16:58:11 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed text and cdata handling in xsl:copy
+	* xslt.c : avoid crashing on invalid xslt input
+	* test/general/bug-*.* test/docs/bug-*.xml : added a number of
+	  bugs submitted to the regression tests
+
+Wed Apr 25 12:42:48 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c : Renaud Chaillat provided a fix for #53535
+
+Sun Apr 22 22:47:44 CEST 2001 Daniel Veillard 
+
+	* configure.in: updated to 0.8.0
+
+Sun Apr 22 22:46:03 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed a bug introduced on handling #53401
+
+Sun Apr 22 22:27:09 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed #53401
+	* configure.in libxslt/*.c: allowed to suppress debug reporting
+	  functionalities but it brings not noticeable improvements
+	* doc/xslt.html doc/html/*: updated and regenerated docs
+
+Wed Apr 18 15:24:50 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-5-.out tests/multiple/out/*.orig
+	  tests/xmlspec/REC-xml-20001006*.html: fixed the test output
+	  following the libxml changes
+
+Wed Apr 18 12:05:04 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: applied TOM's patch to key()
+	* tests/XSLTMark/chart.out tests/XSLTMark/dbonerow.out
+	  tests/XSLTMark/prettyprint.out tests/multiple/out/*.html:
+	  small HTML output change 
+
+Mon Apr 16 16:14:02 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  fixed current()
+
+Tue Apr 17 10:10:56 CEST 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h:
+	  fixed for the most part the namespace handling problem in XPath
+	  expression computations.
+	* test/doc/ tests/general: added bug 5 and 6
+
+Thu Apr 12 14:40:22 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: applied William M. Brack patch fixing the
+	  template lack of support for priority
+	* test/XSLTMark/*.out : this fixed anumber of problems in the
+	  XSLTMark output
+
+Thu Apr 12 14:29:48 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: removed warning in unparsed-entity-uri()
+	  fixed a bug in generate-id()
+	* libxslt/transform.c: fixed null list result errors
+	* libxslt/transform.c libxslt/xsltutils.c: applied William M. Brack
+	  fixes for sorting semantic
+
+Wed Apr 11 14:25:23 CEST 2001 Daniel Veillard 
+
+	* config.h.in configure.in libxslt/xsltconfig.h.in: added
+	  ansidecl.h test
+	* libxslt/xsltproc.c : added --xinclude option
+	* tests/XSLTMark/union.out : fixed the output
+
+Tue Apr 10 20:05:00 CEST 2001 Fatih Demir 
+
+	* .cvsignore & doc/.cvsignore: Added CVS ignore files.
+
+Tue Apr 10 12:10:25 CEST 2001 Daniel Veillard 
+
+	* configure.in: released 0.7.0
+	* tests/XSLTMark/Makefile.am: trying to solve some make distcheck
+	  problems
+
+Sun Apr  8 11:42:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/keys.c libxslt/transform.c:
+	  some checking against NULL pointers
+
+Mon Apr  2 17:00:39 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/Makefile.am tests/XSLTMark/* tests/multiple:
+	  added the XSLTMark in the regression tests as well as multiple
+	  output test from Ankh
+	* libxslt/functions.c libxslt/keys.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltutils.c: applied William M. Brack
+	  patches and fixed a memory leak
+	* tests/docbook/result/html/*.html : updated the results after
+	  William's patch
+	* tests/xmlspec/REC-xml-20001006-review.html 
+	  tests/xmlspec/REC-xml-20001006.html: libxml now don't invent
+	  an HTML doctype when serializing HTML result, but adds the
+	  encoding in ALT
+
+Thu Mar 29 10:24:42 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied fix to xsltApplyTemplates from
+	  William M. Brack
+	* test/docbook/result/html/*.html: this change the output
+	* tests/xmlspec/REC-xml-20001006-review.html 
+	  tests/xmlspec/REC-xml-20001006.html: this also fixed some of
+	  the reference anchors generated for the XML spec
+
+Mon Mar 26 18:57:58 CEST 2001 Daniel Veillard 
+
+	* libxslt/attributes.c libxslt/extra.c libxslt/keys.c libxslt/numbers.c
+	  libxslt/templates.c libxslt/transform.c libxslt/xsltconfig.h.in
+	  libxslt/xsltutils.c: of course the way I defined
+	  UNUSED breaks on old gcc version. Try to be smart and
+	  also define it directly in xsltconfig.h
+	* tests/xmlspec/Makefile.am: fixed the timing arg test
+
+Sun Mar 25 22:07:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch] libxslt/variables.[ch] libxslt/xsltproc.c:
+	  implemented command line parameter passing
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-20001006-review.html:
+	  tested it by passing show.diff.markup=1 to build the review version too
+
+Sat Mar 24 19:35:42 CET 2001 Daniel Veillard 
+
+        Huge cleanup, I switched to compile with
+	-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit
+	-Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat
+	-Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow
+	-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return
+	-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline
+	* libxslt/attributes.c libxslt/extensions.c libxslt/extra.c
+	  libxslt/functions.c libxslt/keys.c libxslt/numbers.c
+	  libxslt/pattern.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xslt.c
+	  libxslt/xsltutils.c: basically made static unexported functions
+	  avoided name clashes and flagged unused parameters.
+
+Thu Mar 22 22:52:48 CET 2001 Daniel Veillard 
+
+	* configure.in: 0.6.0 yet another release
+	* doc/xslt.html doc/html/*: updated the docs
+
+Wed Mar 21 23:19:11 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/xslt.c libxslt/transform.c
+	  libxslt/templates.[ch] libxslt/preproc.c libxslt/extensions.[ch]
+	  extended xsltEvalStaticAttrValueTemplate and 
+	  xsltEvalAttrValueTemplate to support foreign namespaces,
+	  and fixed document()
+
+Mon Mar 19 18:40:40 CET 2001 Daniel Veillard 
+
+	* xsltutils.h: cleanup some garbage added last night
+	* xsltInternals.h variables.c transform.c templates.[ch]
+	  preproc.c pattern.c keys.c: switched the whole XSLt processing
+	  to use XPath precompiled expressions and reusing them.
+	* functions.c: some cleanup, seems people don't use 
+	  unparsed-entity-uri() the way it's supposed to be used
+
+Mon Mar 19 01:08:05 CET 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/templates.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltutils.h: Changed to work
+	  with the new way XPath is interpreted. This doesn't yet
+	  take advantage of the separate parsing/evaluation phases
+
+Wed Mar 14 15:51:36 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: robert@xsl.00008.org pointed out a
+	  problem in xsl:copy-of in case of attributes
+	* tests/docs/Makefile.am tests/docs/bug-3-.xml
+	  tests/general/Makefile.am tests/general/bug-3-.*:
+	  added the test to the general regression suite
+
+Wed Mar 14 14:21:45 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: applied and fixed ptittom@free.fr patch
+	  fixing some of the missing functionnalities in the XSLT
+	  functions implementations.
+	  
+Tue Mar 13 14:38:48 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am: nick@debian.org forwarded a fix
+
+Tue Mar 13 10:29:45 CET 2001 Daniel Veillard 
+
+	* README.cvs-commits: added, pointing to HACKING
+	* HACKING: added defines commit rules.
+
+Mon Mar 12 14:43:20 CET 2001 Daniel Veillard 
+
+	* libxslt/extra.c libxslt/variables.c: fixing compilation
+	  when libxml was compiled without debug support
+
+Sat Mar 10 13:50:16 CET 2001 Daniel Veillard 
+
+	* configure.in: time for 0.5.0
+	* tests/docs/Makefile.am tests/general/Makefile.am: make sure the
+	  new test files are included in the distribution
+	* doc/xslt.html : updated
+	* doc/html/*.html: regenerated the docs
+
+Thu Mar  8 02:34:52 CET 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/*.html: regenerated the HTML
+	  now that value-of an result tree don't include the fake root
+
+Thu Mar  8 02:26:56 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.c: removed a couple
+	  of possibly uninitialized var probs
+	* tests/xmlspec/Makefile.am: run the processing without verbose
+	  avoid raising generated id differences.
+
+Wed Mar  7 23:22:09 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/xsltInternals.h: fixed a stylesheet
+	  reuse problem.
+	* libxslt/transform.c: fixed a bug which exaplined why no
+	  optimization were resulting from preproc stuff
+
+Wed Mar  7 21:51:52 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/transform.c: a couple of nastyness
+	  w.r.t. value of tree result (and attributes within it) fixed.
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-20001006.html:
+	  Integrated the xmlspec to the test (i.e. diffed output for
+	  changes).
+
+Wed Mar  7 18:01:07 CET 2001 Daniel Veillard 
+
+	* imports.c transform.c xslt.c xsltInternals.h: fixed a
+	  strip-spaces problem
+	* tests/docs/*.xml tests/general/*.[xsl,out]: added reported
+	  bugs to testsuite
+
+Wed Mar  7 13:34:13 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch]: finished integrating the current
+	  state of the preproc optimizations.
+	* tests/xmlspec/diffspec.xsl: switched off diff printing
+
+Wed Mar  7 12:46:09 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/transform.c: started rolling in
+	  some of the optimizations.
+
+Tue Mar  6 19:39:25 CET 2001 Daniel Veillard 
+
+	* attributes.[ch] extra.[ch] preproc.c xsltInternals.h
+	  transform.[ch]: previous commit broke a lot of stuff, fixing
+	  and preparing for next step
+
+Tue Mar  6 19:03:21 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.[ch] Makefile.am templates.[ch] transform.[ch]
+	  xsltInternals.h: started working on optimizing stylesheet
+	  element parsing. Just builds the extra informations so far.
+	* xsltutils.h: added a missing XPath decl
+
+Tue Mar  6 09:52:13 CET 2001 Daniel Veillard 
+
+	* libxslt/variables.c: William M. Brack found a serious bug
+	  with imports and global variables ...
+
+Mon Mar  5 21:51:54 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.[ch] libxslt/transform.c: added 
+	  xsltCleanupTemplates() to clean up state left after processing.
+
+Sun Mar  4 19:03:27 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied patch from William M. Brack
+	  to support with-param in xsltApplyTemplates().
+
+Sun Mar  4 17:53:13 CET 2001 Bjorn Reese 
+
+	* libxslt/pattern.c: fixed the compilation of patterns which
+	  contains XPath NodeTypes. Handling of nested predicates.
+
+Sat Mar  3 20:56:47 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: save ctxt->node after for-each
+
+Thu Mar  1 18:16:58 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: updated to 0.4.0 and 2.3.3
+	* doc/xslt.html: updated
+
+Wed Feb 28 19:24:51 CET 2001 Daniel Veillard 
+
+	* libxslt/extra.[ch] libxslt/transform.[ch] libxslt/xsltInternals.h:
+	  added xsltDocumentElem implementing multiple file output,
+	  including 1.1 xsl:document but yet untested.
+
+Wed Feb 28 00:03:44 CET 2001 Daniel Veillard 
+
+	* libxslt/extensions.c: fixed stoopid bug
+	* libxslt/Makefile.am libxslt/extra.[ch]: added a new module
+	  carrying extensions to the specification. Added node-set()
+	  for existing saxon and xt namespaces and debug() in libxslt
+	  namespace (http://xmlsoft.org/XSLT/namespace)
+	* libxslt/xsltutils.[ch] transform.c: moved xsltDebug to extra.c
+	  plus cleanup.
+	* configure.in tests/Makefile.am tests/namespaces: added some
+	  namespaces tests, including a test calling the extra debugging
+	  function in libxslt namespace, worked first time !!!
+
+Tue Feb 27 16:15:47 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: extension prefix support for the full stylesheet
+	* libxslt/transform.c libxslt/extensions.[ch]: more work should
+	  start working
+
+Mon Feb 26 22:59:44 CET 2001 Daniel Veillard 
+
+	* doc/xslt.html : cleaned up, added a bit more description on
+	  the API section.
+
+Mon Feb 26 09:41:04 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/extensions.[ch]: started working
+	  on functions and element extensions. First on list will be
+	  a document element.
+
+Sun Feb 25 06:52:14 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: releasing 0.3.0
+	* doc/xslt.html: updated
+	
+Sun Feb 25 05:28:30 CET 2001 Daniel Veillard 
+
+	* configure.in tests/docbook/html : oops forgot to add
+	  the stylesheets themselves :-\
+
+Sun Feb 25 04:51:33 CET 2001 Daniel Veillard 
+
+	* configure.in tests/Makefile.am tests/docbook tree:
+	  added docbook XSL based test suite
+
+Sat Feb 24 14:02:05 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltutils.c: reformat of messages
+	* libxslt/xsltproc.c: removed memleak on --noout
+	* libxslt/xsltInternals.h libxslt/variables.[ch] libxslt/transform.c:
+	  changed again the way parameter are evaluated before a
+	  call-template, seems to fix a few nasty bugs, memory alloc debug too
+	
+Wed Feb 21 09:10:13 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h:
+	  fixed the param evaluation problem in apply-template
+	* libxslt/pattern.c: speed up seriously some context computation
+	* libxslt/xsltInternals.h: preparing for extension support
+	  
+Mon Feb 19 19:34:59 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am: small cleanup
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  fixed current() I hope
+
+Mon Feb 19 18:05:47 CET 2001 Daniel Veillard 
+
+	* libxslt/numbers.c libxslt/numbersInternals.h libxslt/xslt.c
+	  libxslt/pattern.[ch] libxslt/xsltInternals.h:  more work on
+	  support of namespaces, both in templates and in XPath subexpressions
+
+Sun Feb 18 19:11:26 CET 2001 Bjorn Reese 
+
+	* libxslt/xsltutils.c: xsltSortFunction uses Shell's sort
+
+Sun Feb 18 17:13:00 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: when precompiled pattern is ALL, predicate
+	  contextual info must be recomputed
+
+Sun Feb 18 16:39:17 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.h libxslt/transform.c: defined and exported xsltMaxDepth
+	* libxslt/xsltproc.c : added --maxdepth
+
+Sun Feb 18 15:44:33 CET 2001 Daniel Veillard 
+
+
+	* libxslt/xsltproc.c: added --novalid and --noout as well
+	  as options printing when no args
+	* libxslt/variables.c libxslt/transform.c: trying to get rid
+	  if some variable/params addressing errors.
+
+Sat Feb 17 14:27:47 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/attributes.c: fixed use-attribute-sets
+	* libxslt/xsltutils.c: add carriage return to xsl:message when
+	  needed
+
+Sat Feb 17 02:25:45 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: fixed a bug with generate-id()
+
+Sat Feb 17 00:51:53 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltutils.c: started doing more useful stuff in
+	  xsltDebug
+	* libxslt/transform.[ch] libxslt/variables.[ch] libxslt/templates.c
+	  libxslt/xsltInternals.h: changed the way variables/params
+	  are stored
+	* libxslt/xsltproc.c: removed a pedantic warning
+	* libxslt/variables.[ch]: found an ugly evaluation bug
+
+Thu Feb 15 18:14:48 CET 2001 Daniel Veillard 
+
+	* tests/REC/Makefile.am: updated
+
+Thu Feb 15 17:40:28 CET 2001 Daniel Veillard 
+
+	* libxlst/functions.c: fixed ID generation
+	* doc/xslt.html doc/html/*.html: updated/regenerated the doc
+
+Thu Feb 15 13:34:42 CET 2001 Daniel Veillard 
+
+	* libxslt/numbers.c: removed a couple of memleaks
+
+Thu Feb 15 12:41:44 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.[ch]: exported pattern matching interfaces
+	  for numbers.c and future debug module
+	* libxslt/numbers.c: updated to new interface, should avoid
+	  unnecessary recompilation of patterns.
+	* libxslt/xsltutils.[ch]: cleanup
+	* tests/REC/gmon.out: removed :-)
+
+Wed Feb 14 19:13:33 CET 2001 Bjorn Reese 
+
+	* libxslt/numbers.c: implemented level=any
+	* libxslt/transform.c: corrected some default values
+	* tests/REC/test-7.7-*.*: added
+
+Wed Feb 14 18:07:25 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: priorities were horribly broken, hope it's
+	  fixed
+
+Wed Feb 14 15:39:06 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/imports.h libxslt/pattern.[ch]
+	  libxslt/xsltInternals.h libxslt/transform.[ch]
+	  libxslt/templates.c libxslt/xslt.c:
+	  Added apply-imports, keep a stack of running templates
+	* libxslt/xsltutils.c: bugfixes, gather the output informations
+	  down the cascade
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-2e.xsl
+	  tests/xmlspec/diffspec.xsl tests/xmlspec/xmlspec.xsl: running
+	  the real set of transformation on XML-1.0 2e generages a near
+	  perfect HTML. Needs just more number fixes and implementation
+	  and an obscure problem in 3.3.3
+
+Tue Feb 13 20:31:03 CET 2001 Bjorn Reese 
+
+	* libxslt/pattern.c: added xsltMatchPattern()
+	* libxslt/numbers.c: implemented "level=multiple" for xsl:number
+
+Tue Feb 13 18:07:12 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xsltproc.c: cleanup and debug
+	* libxslt/xsltutils.[ch] : added a small debugging hook
+
+Mon Feb 12 18:30:26 CET 2001 Daniel Veillard 
+
+	* libxslt/FEATURES libxslt/transform.c: added support for
+	  disable-output-escaping in xsl:copy-of
+	* xmlspec/Makefile.am libxslt/variables.c libxslt/transform.c:
+	  give more debugging info
+
+Sun Feb 11 21:08:35 CET 2001 Daniel Veillard 
+
+	* libxslt/documents.[ch] libxslt/functions.c libxslt/imports.c
+	  libxslt/xslt.c libxslt/xsltInternals.h: changed teh way to store
+	  Includes, more document changes
+	* libxslt/xsltutils.c: fix the output of doctype and what is or
+	  is not HTML
+	* tests/REC/*.out tests/REC2/html.xml : changed output accordingly
+	* tests/Makefile.am tests/documents/* : added a new test from Stric
+	  exercising document() among other things
+
+Sun Feb 11 17:24:03 CET 2001 Bjorn Reese 
+
+	* FEATURES libxslt/transform.c libxslt/numbers.c: partial support
+	  for the level attribute for xsl:number
+	* libxslt/numbers.c: internal restructuring
+
+Fri Feb  9 15:49:19 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/documents.[ch]: added a new module
+	  to deal with documents
+	* libxslt/functions.c: fixed document() to return the same set
+	  for teh same URL
+	* libxslt/keys.[ch] libxslt/templates.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltInternals.h: keys are really
+	  associated to loaded documents, not to the transformation
+	  context, made the change, this impacted a number of modules
+
+Thu Feb  8 12:51:00 CET 2001 Daniel Veillard 
+
+	* doc/libxslt.sgml doc/html/*.html: updated and rebuilt the doc list
+
+Thu Feb  8 12:36:23 CET 2001 Daniel Veillard 
+
+	* README configure.in libxslt.spec.in: bumped to 0.1.0, getting
+	  ready for the release
+	* libxslt/keys.c libxslt/xslt.c: cleanup of uninitialized vars
+	* tests/REC1/Makefile.am tests/REC/Makefile.am: the EXTRA list
+	  was not up to date
+
+Thu Feb  8 12:09:58 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/xsltInternals.h libxslt/pattern.c libxslt/keys.c:
+	  added support for keys in patterns
+	* tests/REC/test-12.2-2.*: added a specific testcase
+
+Wed Feb  7 21:16:47 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c FEATURES: started adding support for key()
+	* tests/REC/test-12.2-1.*: first key test
+
+Wed Feb  7 19:46:07 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* libxslt/Makefile.am libxslt/keys.[ch] libxslt/xslt.c
+	  libxslt/transform.c libxslt/xsltInternals.h: started adding key
+	  support
+	* libxslt/xsltutils.c: warning cleanup
+	* libxslt/pattern.h: fixed soopid cut'n paste prob
+
+Tue Feb  6 10:56:38 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: chased some reported
+	  unitinitialized variables.
+
+Tue Feb  6 10:55:26 CET 2001 Daniel Veillard 
+
+	* tests/numbers/Makefile.am: fixed the EXTRA stuff
+
+Mon Feb  5 22:02:24 CET 2001 Daniel Veillard 
+
+	* Copyright IPR Makefile.am: added some wording and a rewrite
+	  of the W3C IPR but without giving Copyright rights to W3C,
+	  should suit everybody
+
+Mon Feb  5 18:58:17 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated, added mode support for templates
+	* pattern.[ch] transform.c xslt.c xsltInternals.h: added mode
+	  support for templates
+	* templates.c variables.c: simple fixes
+	* xslt.c: added a separate DEBUG_BLANKS debug class disabled
+	* xsltproc.c: added option -timing
+	* xsltutils.c: seem I forgot to add encoding support in output...
+	* configure.in tests/Makefile.am tests/xmlspec/*: added a test
+	  consisting of reformatting the XML REC with the xmlspec XSLT,
+	  heavy !
+
+Mon Feb  5 18:43:37 CET 2001 Bjorn Reese 
+
+	* FEATURES: updated
+	* numbers.c: handles actual number formatting for both xsl:number
+	  and the format-number extension function.
+	* function.c: formatting moved to numbers.c
+	* transform.c: added xsl:number
+	* xslt.c: minor memory leak removed
+	* Makefile.am: added numbers.c and numbersInternals.h
+
+Sat Feb  3 21:49:36 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* doc/html/*.html updated
+	* doc/libxslt.sgml: added new modules
+	* libxslt/pattern.c: fix loop on hash clashes.
+
+Sat Feb  3 16:13:35 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* imports.c: bugfix
+	* pattern.c: lots of changes to make most patterns work
+	* templates.[ch]: added xsltEvalXPathPredicate() for predicate testing
+	* transform.c: cleanup and attribute patterns testing
+	* xslt.c: added xsltFreeStylesheetList() and now cleanup
+	  the imports
+	* tests/REC/test-2.3* tests/REC/test-2.6.2*: more tests
+	* tests/REC/test-5.2-*: 18 pattern tests from the spec, all should
+	  work now.
+
+Fri Feb  2 11:15:24 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* transform.c: added xsl:element support
+	* namespaces.[ch]: added xsltGetSpecialNamespace()
+	* attributes.c: added xsl:attribute namespace support.
+
+Thu Feb  1 20:58:54 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/imports.[ch]: new module to
+	  implement import cascade lookups and traversal
+	* libxslt/attributes.c libxslt/namespaces.c libxslt/pattern.[ch]
+	  libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+	  started coding the import cascade lookup in the places needed,
+	  probably incomplete.
+
+Thu Feb  1 18:04:39 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/xslt.h: started implementing
+	  xsl:include and xsl:import, untested
+
+Thu Feb  1 14:54:39 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated choose/when/otherwise added
+	* libxslt/transform.c: plugged choose in
+	* configure.in tests/Makefile.am tests/REC/Makefile.am
+	  tests/docs/Makefile.am tests/docs/items.xml tests/general/Makefile.am
+	  tests/general/itemschoose.*: started adding a more generic
+	  infrastructure for testing.
+
+Thu Feb  1 05:36:28 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-11*: added more tests
+	* libxslt/transform.c libxslt/variables.c: fixing bugs raised by
+	  said tests
+
+Wed Jan 31 21:42:43 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-[9-10]*: added more tests
+	* tests/REC2/html.xml libxslt/xsltutils.c libxslt/transform.c:
+	  fixed sorting
+
+Wed Jan 31 19:25:38 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-[7-9]*: added more tests
+	* libxslt/templates.c libxslt/transform.c libxslt/variables.c:
+	  fixing bugs raised by said tests, cleaned up the way ctxt->xpathctxt
+	  is allocated, overall cleanup.
+
+Wed Jan 31 14:25:25 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-7.*: added more tests
+	* libxslt/pattern.c libxslt/templates.c libxslt/transform.c:
+	  fixing bugs raised by said tests
+
+Tue Jan 30 18:55:49 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-7.*: added more tests
+	* libxslt/namespaces.[ch] libxslt/pattern.c libxslt/attributes.c
+	  libxslt/templates.c libxslt/transform.c libxslt/xslt.c: fixing bugs
+	  raised by said tests
+
+Tue Jan 30 15:16:56 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* configure.in tests/Makefile.am tests/REC/*: started adding
+	  some regression tests based from fragments of spec examples
+	* libxslt/transform.c: fixed a problem on namespace generation
+
+Mon Jan 29 18:40:23 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* tests/numbers/Makefile.am tests/numbers/format-number.*
+	  tests/Makefile.am configure.in: added number formattting
+	  test from Bjorn
+	* libxslt/attributes.[ch]: separated attribute support, started
+	  add support for attribute-sets
+	* libxslt/functions.[ch]: update for number and formatting
+	  from Bjorn
+	* libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+	  cleanups updates, etc ...
+
+Mon Jan 29 00:53:25 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* libxslt/transform.c: added copy-of support
+	* libxslt/xsltutils.[ch]: added xsltDocumentSortFunction()
+
+Sun Jan 28 21:45:23 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO: updates
+	* libxslt/xsltutils.[ch] libxslt/xsltInternals.h libxslt/xsltutils.h:
+	  added xsl:message
+
+Sun Jan 28 17:25:35 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO: updates
+	* libxslt/namespaces.[ch] libxslt/templates.c libxslt/transform.c
+	  libxslt/xslt.c libxslt/xsltInternals.h: added support for
+	  namespace aliases and cleaned up the overall namespace related
+	  code. This materialize as a new module.
+
+Sun Jan 28 08:41:10 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: changes needed for libxml2-devel
+	  changes
+
+Sat Jan 27 11:00:20 CET 2001 Daniel Veillard 
+
+	* libxslt.spec.in doc/xslt.html: updating doc and trying to add
+	  it to the RPM.
+
+Fri Jan 26 22:29:34 CET 2001 Daniel Veillard 
+
+	* Makefile.am configure.in doc/Makefile.am: added a doc subdir
+	  and the rules to generates the makefiles.
+	* doc/libxslt.sgml doc/xslt.html: very first version of the manual
+	* doc/html/*.html : autogenerated documentation
+	* libxslt/xsltInternals.h: fixed a typedef wich was breaking gtk-doc
+
+Fri Jan 26 21:48:25 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: xsltGenerateIdFunction() small patch
+
+Thu Jan 25 19:36:45 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO README INSTALL: updated
+	* libxslt/xslt.h: added URL and version/vendor :-)
+	* libxslt/transform.c: fixed a problem in xsl:attribute, removed
+	  attempt to support older libxml2 version.
+	* libxslt/variables.h libxslt/xsltInternals.h: update to structures
+	  and macros to add/register new document created by document()
+	* libxslt/functions.c: implemented current(), unparsed-entity-uri()
+	  system-property(), element-available() and function-available().
+	  A crippled version of document() has been added too.
+
+Thu Jan 25 12:13:04 CET 2001 Daniel Veillard 
+
+	* functions.[ch]: Bjorn Reese  provided
+	  number formatting !!!
+	* acconfig.h config.h.in configure.in libxslt/Makefile.am
+	  tests/Makefile.am; added testing for mathematical functions,
+	  fixed make test(s)
+	* FEATURES: updated
+
+Wed Jan 24 16:59:05 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/pattern.c: fixed problems
+	  with non-named rules (*, ...) added accelerators
+	* libxslt/templates.[ch]: added xsltEvalTemplateString()
+	  and xsltEvalAttrValueTemplate() high level functions
+	* libxslt/transform.c: fixed the part where attributes
+	  had to be looked at as templates, added comment and
+	  PI generation
+	* TODO FEATURES: updated to reflect the new state
+
+Wed Jan 24 05:33:54 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.[ch] Makefile.am: added new module functions
+	  with templates for the XSLT functions.
+	* libxslt/variables.h templates.c: added registrations of new
+	  functions when an XPath context is created
+
+Tue Jan 23 17:24:26 CET 2001 Daniel Veillard 
+
+	* tests/Makefile.am: cleanup
+	* libxslt/pattern.c: should support most of the patterns now
+	  except ID/Key and maybe some namespace checks when having
+	  a default namespace
+	* TODO: updated
+
+Tue Jan 23 14:58:32 CET 2001 Daniel Veillard 
+
+	* Makefile.am libxslt.spec.in tests/REC1/Makefile.am
+	  tests/REC2/Makefile.am: updated the makefiles and spec files to
+	  add tests, and the FEATURES file to the RPM
+
+Mon Jan 22 23:35:57 CET 2001 Daniel Veillard 
+
+	* Makefile.am libxslt.spec.in libxslt/Makefile.am tests/Makefile.am:
+	  prepared the Makefiles and spec files for a first release.
+	* COPYING.LIB: added LGPL Licence
+
+Mon Jan 22 22:36:43 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied cleanup patch from Bjorn Reese
+	  
+
+Mon Jan 22 20:24:36 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: first try to get a spec file
+
+Mon Jan 22 19:37:00 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: avoid segfault when stylesheet is inproper
+	* libxslt/transform.c: add support for "*" to strip and preserve
+	  space.
+
+Mon Jan 22 15:30:19 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* FEATURES: added with alist of what's in and what's not
+	* libxslt/xslt.c: fixed top level Param and Variable stuff
+
+Mon Jan 22 11:46:44 CET 2001 Daniel Veillard 
+
+	* xsltproc.c: removed bug
+	* tests/REC2/html.xml: added newline after doctype
+	* libxslt/variables.[ch] libxslt/xsltInternals.h: added param
+	  support, result tree fragment support (requires just commited
+	  extensions to libxml2 XPath !!!)
+	* transform.c: added call-template, with-param support
+	* libxslt/pattern.[ch]: xsltFindTemplate() needed for call-template
+	* TODO: updated, added a DONE section and started migrating stuff :-)
+
+Sun Jan 21 12:03:16 CET 2001 Daniel Veillard 
+
+	* Makefile.am tests/Makefile.am tests/REC1/Makefile.am
+	  tests/REC2/Makefile.am tests/REC2/html.xml: added tests target
+	  too, added the HTML output test
+	* libxmls/xsltutils.c: added HTML output
+	* libxslt/xslt.c: check version on literal result used as templates
+	* libxslt/transform.c: fixed an error in VERSION number
+	* libxslt/templates.c: make sure generated nodes have doc and
+	  parent properly set
+
+Sat Jan 20 23:35:07 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/template.[ch]: added a template
+	  specific module. Added attribute value template, at least in
+	  one spot.
+	* tests/REC2/Makefile.am tests/REC2/svg.xml: the SVG test from
+	  the spec now works too.
+	* libxslt/variables.c: fixed the debug
+	* libxslt/xslt.c: fixed an ugly uninitialized variable
+	* libxslt/transform.c: now using attr template processing
+
+Sat Jan 20 17:59:20 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.[ch] libxslt/xslt.c
+	  libxslt/xsltInternals.h libxslt/xsltutils.h: changed a few
+	  structure to add an execution stack with variables. Tree
+	  valued variables still missing.
+	* TODO: updated
+
+Fri Jan 19 13:16:57 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: check version on stylesheets
+	* libxslt/xslt.c libxslt/xsltInternals.h libxslt/variables[.ch]:
+	  started adding variables interfaces and modules.
+
+Thu Jan 18 16:08:38 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: added support for disable-output-escaping
+	  will need libxml version > 20211
+	* libxslt/transform.c: cleanup
+	* libxslt/xsltutils.[ch]: added output functions
+	* libxslt/xsltproc.c: reuse the output function
+	* tests/REC2/Makefile.am tests/REC2/vrml.xml: added VRML output
+	  test
+
+Wed Jan 17 21:03:01 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: avoiding some problems
+	  with blank node stripping when not allowed.
+
+Wed Jan 17 20:15:40 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: modified apply-templates processing
+	  added select and sort support support.
+
+Wed Jan 17 17:45:20 CET 2001 Daniel Veillard 
+
+	* TODO: guess what, it's growing :-(
+	* configure.in: setup hacking values when compiling in my
+	  own environment.
+	* libxslt/transform.c libxslt/xsltutils.[hc]: added a first
+	  very rudimentary version of xsl:sort
+
+Wed Jan 17 14:25:25 CET 2001 Daniel Veillard 
+
+	* TODO: more stuff
+	* libxslt/transform.c: context position and size in for-each
+	* libxslt/xsltutils[ch] libxslt/makefile.am: added the util module
+	  and put Error and Debug routines
+	* libxslt/xslt.c libxslt/transform.c libxslt/pattern.c: switched
+	  to use the Debug calls, cleanup
+	* libxslt/xsltproc.c: added -v to enable debug printing
+
+Tue Jan 16 17:17:17 CET 2001 Daniel Veillard 
+
+	* TODO: started filling it :-(
+	* libxslt/pattern.c: should now at least compile the full
+	  set of patterns authorized. Default priorities added.
+	* libxslt/transform.c: a bit more work and cleanup.
+
+Mon Jan 15 15:34:17 CET 2001 Daniel Veillard 
+
+	* TODO: started adding in there :-(
+
+Mon Jan 15 15:31:41 CET 2001 Daniel Veillard 
+
+	* transform.c, xslt.c, xsltproc.c: lots of fixes, added
+	  support of xslt:if and xslt:attribute, need libxml2 interfaces
+	  present only in CVS.
+
+Sat Jan 13 23:26:21 CET 2001 Daniel Veillard 
+
+	* test/Makefile.am test/REC*/Makefile.am: added first test
+	* libxslt/pattern.c libxslt/transform.c libxslt/xslt.c:
+	  cleanup of nodes at reading of stylesheet, added support
+	  for xsl:for-each and fixed a few recursion bugs
+
+Fri Jan 12 22:33:07 CET 2001 Daniel Veillard 
+
+	* pattern.c, xslt.c: removed debug
+	* transform.c: added value-of, seems to handle the first
+	  REC example correctly
+
+Fri Jan 12 18:34:01 CET 2001 Daniel Veillard 
+
+	* transform.c, xsltproc.c: small fight with spaces and formatting
+	  may need a revisit later but looks pretty good right now.
+
+Fri Jan 12 13:43:30 CET 2001 Daniel Veillard 
+
+	* transform.c: basic processing in place
+	* xsltInternals.h: exported one xslt.c function
+
+Thu Jan 11 21:10:59 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch] Makefile.am: started adding the
+	  transformation module
+	* pattern.[ch] xslt.c: more work...
+
+Thu Jan 11 14:02:03 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: started adding xsltTestCompMatch()
+
+Wed Jan 10 20:44:30 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: more work on parsing selectors
+
+Wed Jan 10 16:29:41 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt*: completeted the structures
+	* libxslt/pattern.[ch]: started adding code to precompile patterns
+	  and do the lookup
+	* libxslt/makefile.am: added the new files
+
+Mon Jan  8 19:55:18 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c : small cleanup
+	* configure.in libxslt/xsltconfig.h.in: add memory debug and
+	  mechanism for compile-time options
+
+Sun Jan  7 22:53:12 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch]: started parsing templates
+
+Sun Jan  7 19:50:02 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch]: started parsing stylesheet xsl:stylesheet
+
+Sun Jan  7 16:11:42 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltInternals.h libxslt/xsltproc.c:
+	  very early coding
+
+Sun Jan  7 15:10:54 CET 2001 Daniel Veillard 
+
+	* configure.in Makefile.am AUTHORS NEWS autogen.sh config.h.in
+	  libxslt/Makefile.am tests/Makefile.am:
+	  Created the library framework, imported it into the GNOME CVS base
+	* INSTALL: added a small instruction file.
+
+Sun Jan  7 13:51:30 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltInternals.h libxslt/xsltproc.c:
+	  first steps toward building the framework
+
+Sun Jan  7 12:22:13 CET 2001 Daniel Veillard 
+
+	* NOTES: added notes taken while reading the spec.
+
+Fri Jan  5 11:34:12 CET 2001 Daniel Veillard 
+
+	* test/REC1 test/REC2: added examples from the XSLT REC
+
+Fri Jan  5 11:14:29 CET 2001 Daniel Veillard 
+
+	* README: basic informations
+	* Changelog: created
diff --git a/third_party/libxslt/Copyright b/third_party/libxslt/Copyright
new file mode 100644
index 0000000..627eeff
--- /dev/null
+++ b/third_party/libxslt/Copyright
@@ -0,0 +1,53 @@
+Licence for libxslt except libexslt
+----------------------------------------------------------------------
+ Copyright (C) 2001-2002 Daniel Veillard.  All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Daniel Veillard shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from him.
+
+----------------------------------------------------------------------
+
+Licence for libexslt
+----------------------------------------------------------------------
+ Copyright (C) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard.
+ All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the authors shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from him.
+----------------------------------------------------------------------
diff --git a/third_party/libxslt/FEATURES b/third_party/libxslt/FEATURES
new file mode 100644
index 0000000..e7de5a4
--- /dev/null
+++ b/third_party/libxslt/FEATURES
@@ -0,0 +1,244 @@
+       Status of implementation of the XSLT 1.0 Features:
+       ==================================================
+
+      $Id: FEATURES,v 1.28 2001/07/10 15:14:08 veillard Exp $
+
+Stylesheet Constructs:
+======================
+
+YES			    xsl:stylesheet
+?				id = id 
+YES				extension-element-prefixes = tokens 
+YES				exclude-result-prefixes = tokens 
+YES				version = number
+
+YES			    xsl:transform
+?				id = id 
+YES				extension-element-prefixes = tokens 
+YES				exclude-result-prefixes = tokens 
+YES				version = number
+
+
+YES			    Literal Result Element as Stylesheet
+
+YES			    Embedding Stylesheets
+
+NO                          mediaType
+
+Top Level Elements:
+===================
+
+YES			    xsl:include
+YES				href = uri-reference
+
+YES			    xsl:import
+YES				href = uri-reference
+
+YES			    xsl:strip-space
+YES				elements = tokens
+
+YES			    xsl:preserve-space
+YES				elements = tokens
+
+YES			    xsl:template
+YES				match = pattern 
+YES				name = qname 
+YES				priority = number 
+YES				mode = qname
+
+YES			    xsl:namespace-alias
+YES				stylesheet-prefix = prefix | "#default"
+YES				result-prefix = prefix | "#default"
+
+YES			    xsl:attribute-set
+YES				name = qname 
+YES				use-attribute-sets = qnames
+
+YES			    xsl:variable
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:param
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:key
+YES				name = qname 
+YES				match = pattern 
+YES				use = expression
+
+YES			    xsl:output
+YES				method = "xml" | "html" | "text" | qname-but-not-ncname 
+YES				version = nmtoken 
+YES				encoding = string 
+YES				omit-xml-declaration = "yes" | "no"
+YES				standalone = "yes" | "no"
+YES				doctype-public = string 
+YES				doctype-system = string 
+YES				cdata-section-elements = qnames 
+YES				indent = "yes" | "no"
+YES				media-type = string
+
+Instructions:
+=============
+
+YES			    xsl:apply-templates
+YES				select = node-set-expression 
+YES				mode = qname
+
+YES			    xsl:apply-imports
+
+YES			    xsl:call-template
+YES				name = qname
+
+YES			    xsl:element
+YES				name = { qname }
+YES				namespace = { uri-reference }
+YES				use-attribute-sets = qnames
+
+YES			    xsl:attribute
+YES				name = { qname }
+YES				namespace = { uri-reference }
+
+YES			    xsl:text
+YES				disable-output-escaping = "yes" | "no"
+
+YES			    xsl:processing-instruction
+YES				name = { ncname }
+
+YES			    xsl:comment
+
+YES			    xsl:copy
+YES				use-attribute-sets = qnames
+
+YES			    xsl:value-of
+YES				select = string-expression 
+YES				disable-output-escaping = "yes" | "no"
+
+YES			    xsl:number
+YES				level = "single" | "multiple" | "any"
+YES				count = pattern 
+YES				from = pattern 
+YES				value = number-expression 
+YES				format = { string }
+NO				lang = { nmtoken }
+NO				letter-value = { "alphabetic" | "traditional" }
+YES				grouping-separator = { char }
+YES				grouping-size = { number }
+
+YES			    xsl:for-each
+YES				select = node-set-expression
+
+YES			    xsl:if
+YES				test = boolean-expression
+
+YES			    xsl:choose
+
+YES			    xsl:when
+YES				test = boolean-expression
+
+YES			    xsl:otherwise
+
+YES			    xsl:sort
+YES				select = string-expression 
+NO				lang = { nmtoken }
+YES				data-type = { "text" | "number" | qname-but-not-ncname }
+YES				order = { "ascending" | "descending" }
+NO				case-order = { "upper-first" | "lower-first" }
+
+YES			    xsl:variable
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:param
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:copy-of
+YES				select = expression
+
+YES			    xsl:with-param
+YES				name = qname 
+YES				select = expression
+
+YES			    xsl:decimal-format
+YES				name = qname 
+YES				decimal-separator = char 
+YES				grouping-separator = char 
+YES				infinity = string 
+YES				minus-sign = char 
+YES				NaN = string 
+YES				percent = char 
+YES				per-mille = char 
+YES				zero-digit = char 
+YES				digit = char 
+YES				pattern-separator = char
+
+YES			    xsl:message
+YES				terminate = "yes" | "no"
+
+YES			    xsl:fallback
+
+General:
+========
+
+YES			    Conflict Resolution for Template Rules
+
+YES			    Whitespace Stripping
+
+YES			    Built-in Template Rules
+YES			        match="*|/"
+YES				match="text()|@*"
+YES				match="processing-instruction()|comment()"
+YES				Namespace
+YES				Mode
+
+YES			    Extension Elements
+
+YES			    Extension Functions
+
+YES			    Attribute Value Templates
+
+YES			    Result Tree Fragments
+
+Functions:
+==========
+
+YES			    node-set document(object, node-set?)
+YES			    node-set key(string, object)
+YES			    string format-number(number, string, string?)
+YES			    node-set current() 
+YES			    string unparsed-entity-uri(string)
+YES			    string generate-id(node-set?)
+YES			    object system-property(string)
+YES			    boolean element-available(string)
+YES			    boolean function-available(string)
+
+Patterns:
+=========
+
+YES			    para
+YES			    *
+YES			    chapter|appendix
+YES			    olist/item
+YES			    appendix//para
+YES			    /
+YES			    text()
+YES			    processing-instruction()
+YES			    node()
+YES			    id("W11")
+YES			    para[1]
+YES			    *[position()=1 and self::para]
+YES			    para[last()=1]
+YES			    items/item[position()>1]
+YES			    item[position() mod 2 = 1]
+YES			    div[@class="appendix"]//p
+YES			    @class
+YES			    @*
+YES   except ns for key	    key('a','b')
+
+daniel@veillard.com
diff --git a/third_party/libxslt/INSTALL b/third_party/libxslt/INSTALL
new file mode 100644
index 0000000..5fd3ecf
--- /dev/null
+++ b/third_party/libxslt/INSTALL
@@ -0,0 +1,49 @@
+         How to install the XSLT library:
+
+Requirements:
+=============
+
+this library requires a recent version of libxml2 which you can grab from
+either the GNOME FTP or the xmlsoft.org server:
+
+  ftp://xmlsoft.org/
+
+When installing from a distribution package like a tar.gz:
+==========================================================
+
+expand the package
+
+run ./configure possibly indicating the desired installation prefix: 
+
+    ./configure --prefix=/usr
+
+then run
+
+    make
+
+to build the project and
+
+    make install 
+
+(possibly after having gained root access) to install the library
+and associated include and scripts.
+
+When installing from a checkout of the GNOME CVS base:
+======================================================
+
+
+run ./autogen.sh possibly indicating the desired installation prefix: 
+
+    ./autogen.sh --prefix=/usr
+
+then run
+
+    make
+
+to build the project and
+
+    make install 
+
+(possibly after having gained root access) to instal the library
+and associated include and scripts.
+
diff --git a/third_party/libxslt/NEWS b/third_party/libxslt/NEWS
new file mode 100644
index 0000000..de868e5
--- /dev/null
+++ b/third_party/libxslt/NEWS
@@ -0,0 +1,790 @@
+
+        NEWS file for libxslt
+
+  Note that this is automatically generated from the news webpage at:
+       http://xmlsoft.org/XSLT/news.html
+
+The change log at 
+ChangeLog.html
+ describes the recents commits
+to the SVN at 
+http://svn.gnome.org/viewcvs/libxslt/trunk/
+ code base.Those are the public releases made:
+1.1.24: May 13 20088:
+   - Documentation: man page fix (Vincent Lefevre).
+   - Bug fixes: pattern bug fix, key initialization problems, exclusion of
+      unknown namespaced element on top of stylesheets, python generator
+      syntactic cleanup (Martin)
+
+
+1.1.23: Apr  8 2008:
+   - Documentation: fix links for Cygwin DocBook setup (Philippe Bourcier),
+      xsltParseStylesheetDoc doc fix (Jason Viers), fix manpage default
+      maxdepth value 
+   - Bug fixes: python segfault (Daniel Gryniewicz), week-in-year bug fix
+      (Maurice van der Pot), fix python iterator problem (William Brack),
+      avoid garbage collection problems on str:tokenize and str:split
+      and function results (William Brack and Peter Pawlowski) 
+      superfluous re-generation of keys (William Brack), remove superfluous
+      code in xsltExtInitTest (Tony Graham), func:result segfault fix
+      (William Brack), timezone offset problem (Peter Pawlowski),
+   - Portability fixes: old gcrypt support fix (Brent Cowgill), Python
+      portability patch (Stephane Bidoul), VS 2008 fix (Rob Richard) 
+
+
+1.1.22: Aug 23 2007:
+   - Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix
+      bug (William Brack), stylesheet compilation error handling (Rob Richards).
+      
+   - Portability fixes: improve build with VS2005 (Rob Richards), 
+      fixing build on AIX (Bjorn Wiberg), fix the security file checks on
+      Windows (Roland Schwarz and Rob Richards). 
+   - Improvement: add an --encoding option to xsltproc (Drazen Kacar). 
+
+
+1.1.21: Jun 12 2007:
+   - Bug fixes: out of memory allocation errors (William Brack), 
+      namespace problem on compound predicates (William Brack),
+      python space/tab inconsistencies (Andreas Hanke), hook xsl:message
+      to per transformation error callbacks (Shaun McCance),
+      cached RVT problem (William Brack), XPath context maintainance
+      on choose (William Brack), memory leaks in the math module (William
+      Brack), exclude-result-prefix induced namespace problem (William
+      Brack)
+   - Build: configure setup for TRIO_REPLACE_STDIO (William Brack)
+  
+   - Documentation: updated after change from CVs to SVN (William Brack)
+
+
+1.1.20: Jan 17 2007:
+   - Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability
+      patches (Roland Illig)
+   - Bug fixes: Result Value Tree handling fix (William Brack), function
+      parameters fix (William), uninitialized variable (Kjartan Maraas),
+      empty text node handling (William), plugin support and test fixes (William),
+      fragment support fixes (William)
+   - Improvements: python stylesheet compare and transform context
+      access (Nic Ferrier), EXSLT string replace support (Joel Reed),
+      xsltproc better low level error handling (Mike Hommey and William)
+
+
+1.1.19: Nov 29 2006:
+   - Bug fixes: entities within attributes (William Brack), Python detection
+      problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result
+      value tree caching bug (William Brack)
+
+
+1.1.18: Oct 26 2006:
+   - portability and build fixes: DESTDIR problem, build paths in python
+      shared lib, compile when libxml2 doesn't support XInclude (Gary Coady).
+   - bug fixes: a number of namespace related bugs (Kasimier Buchcik), 
+      parameters bugs (Kasimier Buchcik), proximity position in predicates
+      of match patterns (Kasimier), exslt-node-set troubles with strings
+      (Kasimier), CDATA serialization, Python floats and booleans XPath
+      conversions, XInclude support fixes, RVT cleanup problem (William Brack
+      and Kasimier), attribute checking in stylesheets (Kasimier), xsltForEach
+      context problem (Kasimier), security check should pass full URLs (Shane
+      Corgatelli), security cleanup patch (Mikhail Zabaluev), some python
+      accessor for stylesheet were broken, memory errors when compiling 
+      stylesheets (Mike Hommey), EXSLT current date end-of-month problem
+      (William Brack).
+   - improvements: refactoring of namespace handling, value-of impleemntation
+      and template internal processing (Kasimier Buchcik), new xsltproc
+      flag to apply Xinclude to stylesheets.
+   - documentation: xsltproc man pages (Daniel Leidert), tests updates
+      (William Brack), various typo fixes (Daniel Leidert), comments on
+      versions macros (Peter Breitenlohner).
+
+
+1.1.17: Jun 6 2006:
+   - portability fixes: python detection
+   - bug fixes: some regression tests, attribute/namespaces output (Kasimier
+    Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)
+   - improvements: internal refactoring (Kasimier Buchcik), use of the XPath
+    object cache in libxml2-2.6.25 (Kasimier)
+
+
+1.1.16: May 01 2006:
+   - portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin),
+      HP-UX  build (Albert Chin), 
+  
+   - build fixes: Python detection(Joseph Sacco), plugin configurei
+      (Joel Reed)
+   - bug fixes: pattern compilation fix(William Brack), EXSLT date/time
+      fix (Thomas Broyer), EXSLT function bug, potential loop on variable
+      eval, startup race (Christopher Palmer), debug statement left in python
+      (Nic Ferrier), various cleanup based on Coverity reports), error on
+      Out of memory condition (Charles Hardin), various namespace prefixes
+      fixes (Kasimier Buchcik), 
+   - improvement: speed up sortingi, start of internals refactoring (Kasimier
+      Buchcik)
+   - documentation: man page fixes and updates (Daniel Leidert)
+
+
+
+1.1.15: Sep 04 2005:
+   - build fixes: Windows build cleanups and updates (Igor Zlatkovic),
+    remove jhbuild warnings
+   - bug fixes: negative number formatting (William Brack), number
+    formatting per mille definition (William Brack), XInclude default values
+    (William), text copy bugs (William), bug related to xmlXPathContext size,
+    reuse libxml2 memory management for text nodes, dictionary text bug,
+    forbid variables in match (needs libxml2-2.6.21)
+   - improvements: EXSLT dyn:map (Mark Vakoc),
+   - documentation: EXSLT date and time functions namespace in man (Jonathan
+    Wakely)
+
+
+1.1.14: Apr 02 2005:
+   - bug fixes: text node on stylesheet document without a dictionary
+    (William Brack), more checking of XSLT syntax, calling xsltInit()
+    multiple times, mode values interning raised by Mark Vakoc, bug in
+    pattern matching with ancestors, bug in patterna matching with cascading
+    select, xinclude and document() problem, build outside of source tree
+    (Mike Castle)
+   - improvement: added a --nodict mode to xsltproc to check problems for
+    docuemtns without dictionaries
+
+
+1.1.13: Mar 13 2005:
+   - build fixes: 64bits cleanup (William Brack), python 2.4 test (William),
+    LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel
+    Reed), libgcrypt-devel requires for RPM spec.
+   - bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template
+    should not change the current template rule (William Brack), evaluation
+    of global variables (William Brack), RVT's in XPath predicates (William),
+    namespace URI on template names (Mark Vakoc), stat() for Windows patch
+    (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of
+    memory detection misses (William), parserOptions propagation (William),
+    exclude-result-prefixes fix (William), // patten fix (William).
+   - extensions: module support (Joel Reed), dictionary based speedups
+    trying to get rid of xmlStrEqual as much as possible.
+   - documentation: added Wiki (Joel Reed)
+
+
+1.1.12: Oct 29 2004:
+   - build fixes: warnings removal (William).
+   - bug fixes: attribute document pointer fix (Mark Vakoc), exslt date
+    negative periods (William Brack), generated tree structure fixes,
+    namespace lookup fix, use reentrant gmtime_r (William Brack),
+    exslt:funtion namespace fix (William), potential NULL pointer reference
+    (Dennis Dams, William), force string interning on generated
+  documents.
+   - documentation: update of the second tutorial (Panagiotis Louridas), add
+    exslt doc in rpm packages, fix the xsltproc man page.
+
+
+1.1.11: Sep 29 2004:
+   - bug fixes: xsl:include problems (William Brack), UTF8 number pattern
+    (William), date-time validation (William), namespace fix (William),
+    various Exslt date fixes (William), error callback fixes, leak with
+    namespaced global variable, attempt to fix a weird problem #153137
+   - improvements: exslt:date-sum tests (Derek Poon)
+   - documentation: second tutorial by Panagiotis Lourida
+
+
+1.1.10: Aug 31 2004:
+   - build fix: NUL in c file blocking compilation on Solaris, Windows build
+    (Igor Zlatkovic)
+   - fix: key initialization problem (William Brack)
+   - documentation: fixed missing man page description for --path
+
+
+1.1.9: Aug 22 2004:
+   - build fixes: missing tests (William Brack), Python dependancies, Python
+    on 64bits boxes, --with-crypto flag (Rob Richards),
+   - fixes: RVT key handling (William), Python binding (William and Sitsofe
+    Wheeler), key and XPath troubles (William), template priority on imports
+    (William), str:tokenize with empty strings (William), #default namespace
+    alias behaviour (William), doc ordering missing for main document
+    (William), 64bit bug (Andreas Schwab)
+   - improvements: EXSLT date:sum added (Joel Reed), hook for document
+    loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD
+    attributes, extend xsltproc --version with CVS stamp (William).
+   - Documentation: web page problem reported by Oliver Stoeneberg
+
+
+1.1.8: July 5 2004:
+   - build fixes: Windows runtime options (Oliver Stoeneberg), Windows
+    binary package layout (Igor Zlatkovic), libgcrypt version test and link
+    (William)
+   - documentation: fix libxslt namespace name in doc (William)
+   - bug fixes: undefined namespace message (William Brack), search engine
+    (William), multiple namespace fixups (William), namespace fix for key
+    evaluation (William), Python memory debug bindings,
+   - improvements: crypto extensions for exslt (Joel Reed, William)
+
+
+1.1.7: May 17 2004:
+   - build fix: warning about localtime_r on Solaris
+   - bug fix: UTF8 string tokenize (William Brack), subtle memory
+    corruption, linefeed after comment at document level (William),
+    disable-output-escaping problem (William), pattern compilation in deep
+    imported stylesheets (William), namespace extension prefix bug,
+    libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced
+    DOCTYPE name
+
+
+1.1.6: Apr 18 2004:
+   - 2 bug fixes about keys fixed one by Mark Vakoc
+
+
+1.1.5: Mar 23 2004:
+   - performance: use dictionary lookup for variables
+   - remove use of _private from source documents
+   - cleanup of "make tests" output
+   - bugfixes: AVT in local variables, use localtime_r to avoid thread
+    troubles (William), dictionary handling bug (William), limited number of
+    stubstitutions in AVT (William), tokenize fix for UTF-8 (William),
+    superfluous namespace (William), xsltproc error code on
+     halt, OpenVMS fix, dictionary reference counting
+    change.
+
+
+1.1.4: Feb 23 2004:
+   - bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with
+    Yelp, extension problem
+   - display extension modules (Steve Little)
+   - Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)
+
+
+1.1.3: Feb 16 2004:
+   - Rewrote the Attribute Value Template code, new XPath compilation
+    interfaces, dictionary reuses for XSLT with potential for serious
+    performance improvements.
+   - bug fixes: portability (William Brack), key() in node-set() results
+    (William), comment before doctype (William), math and node-set() problems
+    (William), cdata element and default namespace (William), behaviour on
+    unknown XSLT elements (Stefan Kost), priority of "//foo" patterns
+    (William), xsl:element and xsl:attribute QName check (William), comments
+    with -- (William), attribute namespace (William), check for ?> in PI
+    (William)
+   - Documentations: cleanup (John Fleck and William)
+   - Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane
+    bidoul)
+
+
+1.1.2: Dec 24 2003:
+   - Documentation fixes (John Fleck, William Brack), EXSLT documentation
+    (William Brack)
+   - Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)
+   - Bug fixes: exslt:date returning NULL strings (William Brack),
+    namespaces output (William Brack),  key and namespace definition problem,
+    passing options down to the document() parser, xsl:number fixes (William
+    Brack)
+
+
+1.1.1: Dec 10 2003:
+   - code cleanup (William Brack)
+   - Windows: Makefile improvements (Igor Zlatkovic)
+   - documentation improvements: William Brack, libexslt man page (Jonathan
+    Wakely)
+   - param in EXSLT functions (Shaun McCance)
+   - XSLT debugging improvements (Mark Vakoc)
+   - bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William
+    Brack), key selector parsing with | reported by Oleg Paraschenko,
+    xsl:element with computed namespaces (William Brack), xslt:import/include
+    recursion detection (William Brack), exslt:function used in keys (William
+    Brack), bug when CDATA_SECTION are foun in the tree (William Brack),
+    entities handling when using XInclude.
+
+
+1.1.0: Nov 4 2003:
+   - Removed DocBook SGML broken support
+   - fix xsl:key to work with PIs
+   - Makefile and build improvement (Graham Wilson), build cleanup (William
+    Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen
+    Petrov)
+   - xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher
+    Dunnavant)
+   - Python: never use stdout for error
+   - extension memory error fix (Karl Eichwalder)
+   - header path fixes (Steve Ball)
+   - added saxon:line-number() to libexslt (Brett Kail)
+   - Fix some tortuous template problems when using predicates (William
+    Brack)
+   - Debugger status patch (Kasimier Buchcik)
+   - Use new libxml2-2.6.x APIs for faster processing
+   - Make sure xsl:sort is empty
+   - Fixed a bug in default processing of attributes
+   - Removes the deprecated breakpoint library
+   - detect invalid names on templates (William Brack)
+   - fix exslt:document (and similar) base handling problem
+
+
+1.0.33: Sep 12 2003:
+This is a bugfix only release   - error message missing argument (William Brack)
+   - mode not cascaded in template fallbacks (William Brack)
+   - catch redefinition of parameter/variables  (William Brack)
+   - multiple keys with same namespace name (William Brack)
+   - patch for compilation using MingW on Windows (Mikhail Grushinskiy)
+   - header export macros for Windows (Igor Zlatkovic)
+   - cdata-section-elements handling of namespaced names
+   - compilation without libxml2 XPointer support (Mark Vadoc)
+   - apply-templates crash (William Brack)
+   - bug with imported templates (William Brack)
+   - imported attribute-sets merging bug (DocBook) (William Brack)
+
+
+1.0.32: Aug 9 2003:
+   - bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT
+    function (William Brack), RVT for globals (William Brack), EXSLT date
+    (William Brack),
+    speed of large text output, xsl:copy with attributes, strip-space and
+    namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun
+    McCance), EXSLT:seconds (William Brack), sort with multiple keys (William
+    Brack), checking of { and } for attribute value templates (William
+    Brack)
+  
+   - Python bindings for extension elements (Sean Treadway)
+   - EXSLT:split added (Shaun McCance)
+   - portability fixes for HP-UX/Solaris/IRIX (William Brack)
+   - doc cleanup
+
+
+1.0.31: Jul 6 2003:
+   - bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for
+    the debugger (Keith Isdale), output filename limitation, trio.h and
+    triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner),
+    xsltChoose and whitespace (Igor Zlatkovic),
+    stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack),
+    RVT bug introduced in 1.0.30
+  
+   - avoid generating " (fix in libxml2-2.5.8)
+   - fix 64bit cleaness problem and compilation troubles introduced in
+  1.0.30
+   - Windows makefile generation (Igor Zlatkovic)
+   - HP-UX portability fix
+
+
+1.0.30: May 4 2003:
+   - Fixes and new APIs to handle Result Value Trees and avoid leaks
+   - Fixes for: EXSLT math pow() function (Charles Bozeman), global
+    parameter and global variables mismatch, a segfault on pattern
+    compilation errors, namespace copy in xsl:copy-of, python generator
+    problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor),
+    current node when templates applies to attributes
+
+
+1.0.29: Apr 1 2003:
+   - performance improvements especially for large flat documents
+   - bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace
+    declarations with xsl:elements.
+   - portability: python and trio fixes (Albert Chin), python on Solaris
+    (Ben Phillips)
+
+
+1.0.28: Mar 24 2003:
+   - fixed node() in patterns semantic.
+   - fixed a memory access problem in format-number()
+   - fixed stack overflow in recursive global variable or params
+   - cleaned up Result Value Tree handling, and fixed a couple of old bugs
+    in the process
+
+
+1.0.27: Feb 24 2003:
+   - bug fixes: spurious xmlns:nsX="" generation, serialization bug (in
+    libxml2), a namespace copy problem, errors in the RPM spec prereqs
+   - Windows path canonicalization and document cache fix (Igor)
+
+
+1.0.26: Feb 10 2003:
+   - Fixed 3 serious bugs in document() and stylesheet compilation which
+    could lead to a crash
+
+
+1.0.25: Feb 5 2003:
+   - Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C
+    syntax pbm, 3 bugs reported by Eric van der Vlist
+   - Some XPath and XInclude related problems were actually fixed in
+    libxml2-2.5.2
+   - Documentation: emphasize taht --docbook is not for XML docs.
+
+
+1.0.24: Jan 14 2003:
+   - bug fixes: imported global varables, python bindings (Stéphane Bidoul),
+    EXSLT memory leak (Charles Bozeman), namespace generation on
+    xsl:attribute, space handling with imports (Daniel Stodden),
+    extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt
+    Sergeant), superfluous xmlns generation, XInclude related bug for
+    numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on
+    imports, extension module init and shutdown callbacks not called
+   - HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane
+    Bidoul), VMS makefile updates (Craig A. Berry)
+   - adds xsltGetProfileInformation() (Michael Rothwell)
+   - fix the API generation scripts
+   - API to provide the sorting routines (Richard Jinks)
+   - added XML description of the EXSLT API
+   - added ESXLT URI (un)escaping (Jörg Walter)
+   - Some memory leaks have been found and fixed
+   - document() now support fragment identifiers in URIs
+
+
+1.0.23: Nov 17 2002:
+   - Windows build cleanup (Igor)
+   - Unix build and RPM packaging cleanup
+   - Improvement of the python bindings: extension functions and activating
+    EXSLT
+   - various bug fixes: number formatting, portability for bounded string
+    functions, CData nodes, key(), @*[...] patterns
+   - Documentation improvements (John Fleck)
+   - added libxslt.m4 (Thomas Schraitle)
+
+
+1.0.22: Oct 18 2002:
+   - Updates on the Windows Makefiles
+   - Added a security module, and a related set of new options to
+  xsltproc
+   - Allowed per transformation error handler.
+   - Fixed a few bugs: node() semantic, URI escaping, media-type, attribute
+    lists
+
+
+1.0.21: Sep 26 2002:
+   - Bug fixes: match="node()", date:difference() (Igor and Charlie
+    Bozeman), disable-output-escaping
+   - Python bindings: style.saveResultToString() from Ralf Mattes
+   - Logos from Marc Liyanage
+   - Mem leak fix from Nathan Myers
+   - Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake),
+    Windows (Igor), Python detection
+   - Documentation improvements: John Fleck
+
+
+1.0.20: Aug 23 2002:
+   - Windows makefile updates (Igor) and x86-64 (Frederic Crozat)
+   - fixed HTML meta tag saving for Mac/IE users
+   - possible leak patches from Nathan Myers
+   - try to handle document('') as best as possible depending in the
+  cases
+   - Fixed the DocBook stylesheets handling problem
+   - Fixed a few XSLT reported errors
+
+
+1.0.19:  July 6 2002:
+   - EXSLT: dynamic functions and date support bug fixes (Mark Vakoc)
+   - xsl:number fix: Richard Jinks
+   - xsl:format-numbers fix: Ken Neighbors
+   - document('') fix: bug pointed by Eric van der Vlist
+   - xsl:message with terminate="yes" fixes: William Brack
+   - xsl:sort order support added: Ken Neighbors
+   - a few other bug fixes, some of them requiring the latest version of
+    libxml2
+
+
+1.0.18: May 27 2002:
+   - a number of bug fixes: attributes, extra namespace declarations
+    (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen,
+    Charles Bozeman and Geert Kloosterman),  element-available (Richard
+  Jinks)
+   - xsltproc can now list teh registered extensions thanks to Mark
+  Vakoc
+   - there is a new API to save directly to a string
+    xsltSaveResultToString() by Morus Walter
+   - specific error registration function for the python API
+
+
+1.0.17: April 29 2002:
+   - cleanup in code, XSLT debugger support and Makefiles for Windows by
+  Igor
+   - a C++ portability fix by Mark Vakoc
+   - EXSLT date improvement and regression tests by Charles Bozeman
+   - attempt to fix a bug in xsltProcessUserParamInternal
+
+
+1.0.16: April 15 2002:
+   - Bug fixes: strip-space, URL in HTML output, error when xsltproc can't
+    save
+   - portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings
+
+
+1.0.15: Mar 25 2002:
+   - Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..]
+    templates
+   - Debug of memory alocation with valgind
+   - serious profiling leading to significant improvement for DocBook
+    processing
+   - revamp of the Windows build
+
+
+1.0.14: Mar 18 2002:
+   - Improvement in the XPath engine (libxml2-2.4.18)
+   - Nasty bug fix related to exslt:node-set
+   - Fixed the python Makefiles, cleanup of doc comments, Windows
+    portability fixes
+
+
+1.0.13: Mar 8 2002:
+   - a number of bug fixes including "namespace node have no parents"
+   - Improvement of the Python bindings
+   - Charles Bozeman provided fixes and regression tests for exslt date
+    functions.
+
+
+1.0.12: Feb 11 2002:
+   - Fixed the makefiles especially the python module ones
+   - half a dozen bugs fixes including 2 old ones
+
+
+1.0.11: Feb 8 2002:
+   - Change of Licence to the MIT
+  Licence
+   - Added a beta version of the Python bindings, including support to
+    extend the engine with functions written in Python
+   - A number of bug fixes
+   - Charlie Bozeman provided more EXSLT functions
+   - Portability fixes
+
+
+1.0.10: Jan 14 2002:
+   - Windows fixes for Win32 from Igor
+   - Fixed the Solaris compilation trouble (Albert)
+   - Documentation changes and updates: John Fleck
+   - Added a stringparam option to avoid escaping hell at the shell
+  level
+   - A few bug fixes
+
+
+1.0.9: Dec 7 2001:
+   - Makefile patches from Peter Williams
+   - attempt to fix the compilation problem associated to prelinking
+   - obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API
+   - xsltproc return codes are now significant, John Fleck updated the
+    documentation
+   - patch to allow as much as 40 steps in patterns (Marc Tardif), should be
+    made dynamic really
+   - fixed a bug raised by Nik Clayton when using doctypes with HTML
+  output
+   - patches from Keith Isdale to interface with xsltdebugger
+
+
+1.0.8: Nov 26 2001:
+   - fixed an annoying header problem, removed a few bugs and some code
+    cleanup
+   - patches for Windows and update of Windows Makefiles by Igor
+   - OpenVMS port instructions from John A Fotheringham
+   - fixed some Makefiles annoyance and libraries prelinking
+  information
+
+
+1.0.7: Nov 10 2001:
+   - remove a compilation problem with LIBXSLT_PUBLIC
+   - Finishing the integration steps for Keith Isdale debugger
+   - fixes the handling of indent="no" on HTML output
+   - fixes on the configure script and RPM spec file
+
+
+1.0.6: Oct 30 2001:
+   - bug fixes on number formatting (Thomas), date/time functions (Bruce
+    Miller)
+   - update of the Windows Makefiles (Igor)
+   - fixed DOCTYPE generation rules for HTML output (me)
+
+
+1.0.5: Oct 10 2001:
+   - some portability fixes, including Windows makefile updates from
+  Igor
+   - fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)
+   - support for Saxon's evaluate and expressions extensions added (initial
+    contribution from Darren Graves)
+   - better handling of XPath evaluation errors
+
+
+1.0.4: Sep 12 2001:
+   - Documentation updates from John fleck
+   - bug fixes (DocBook  FO generation should be fixed)  and portability
+    improvements
+   - Thomas Broyer improved the existing EXSLT support and added String,
+    Time and Date core functions support
+
+
+1.0.3:  Aug 23 2001:
+   - XML Catalog support see the doc
+   - New NaN/Infinity floating point code
+   - A few bug fixes
+
+
+1.0.2:  Aug 15 2001:
+   - lot of bug fixes, increased the testsuite
+   - a large chunk of EXSLT is implemented
+   - improvements on the extension framework
+   - documentation improvements
+   - Windows MSC projects files should be up-to-date
+   - handle attributes inherited from the DTD by default
+
+
+1.0.1:  July 24 2001:
+   - initial EXSLT framework
+   - better error reporting
+   - fixed the profiler on Windows
+   - bug fixes
+
+
+1.0.0: July 10 2001:
+   - a lot of cleanup, a lot of regression tests added or fixed
+   - added a documentation for writing
+    extensions
+   - fixed some variable evaluation problems (with William)
+   - added profiling of stylesheet execution accessible as the xsltproc
+    --profile option
+   - fixed element-available() and the implementation of the various
+    chunking methods present, Norm Walsh provided a lot of feedback
+   - exclude-result-prefixes and namespaces output should now work as
+    expected
+   - added support of embedded stylesheet as described in section 2.7 of the
+    spec
+
+
+0.14.0: July 5 2001:
+   - lot of bug fixes, and code cleanup
+   - completion of the little XSLT-1.0 features left unimplemented
+   - Added and implemented the extension API suggested by Thomas Broyer
+   - the Windows MSC environment should be complete
+   - tested and optimized with a really large document (DocBook Definitive
+    Guide) libxml/libxslt should really be faster on serious workloads
+
+
+0.13.0: June 26 2001:
+   - lots of cleanups
+   - fixed a C++ compilation problem
+   - couple of fixes to xsltSaveTo()
+   - try to fix Docbook-xslt-1.4 and chunking, updated the regression test
+    with them
+   - fixed pattern compilation and priorities problems
+   - Patches for Windows and MSC project mostly contributed by Yon Derek
+   - update to the Tutorial by John Fleck
+   - William fixed bugs in templates and for-each functions
+   - added a new interface xsltRunStylesheet() for a more flexible output
+    (incomplete), added -o option to xsltproc
+
+
+0.12.0: June 18 2001:
+   - fixed a dozen of bugs reported
+   - HTML generation should be quite better (requires libxml-2.3.11 upgrade
+    too)
+   - William fixed some problems with document()
+   - Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade
+    too)
+   - John Fleck added a
+  tutorial
+   - Fixes for namespace handling when evaluating variables
+   - XInclude global flag added to process XInclude on document() if
+    requested
+   - made xsltproc --version more detailed
+
+
+0.11.0: June 1 2001:
+Mostly a bug fix release.   - integration of catalogs from xsltproc
+   - added --version to xsltproc for bug reporting
+   - fixed errors when handling ID in external parsed entities
+   - document() should hopefully work correctly but ...
+   - fixed bug with PI and comments processing
+   - William fixed the XPath string functions when using unicode
+
+
+0.10.0: May 19 2001:
+   - cleanups to make stylesheet read-only (not 100% complete)
+   - fixed URI resolution in document()
+   - force all XPath expression to be compiled at stylesheet parsing time,
+    even if unused ...
+   - Fixed HTML default output detection
+   - Fixed double attribute generation #54446
+   - Fixed {{ handling in attributes #54451
+   - More tests and speedups for DocBook document transformations
+   - Fixed a really bad race like bug in xsltCopyTreeList()
+   - added a documentation on the libxslt internals
+   - William Brack and Bjorn Reese improved format-number()
+   - Fixed multiple sort, it should really work now
+   - added a --docbook option for SGML DocBook input (hackish)
+   - a number of other bug fixes and regression test added as people were
+    submitting them
+
+
+0.9.0: May 3 2001:
+   - lot of various bugfixes, extended the regression suite
+   - xsltproc should work with multiple params
+   - added an option to use xsltproc with HTML input
+   - improved the stylesheet compilation, processing of complex stylesheets
+    should be faster
+   - using the same stylesheet for concurrent processing on multithreaded
+    programs should work now
+   - fixed another batch of namespace handling problems
+   - Implemented multiple level of sorting
+
+
+0.8.0: Apr 22 2001:
+   - fixed ansidecl.h problem
+   - fixed unparsed-entity-uri() and generate-id()
+   - sort semantic fixes and priority prob from William M. Brack
+   - fixed namespace handling problems in XPath expression computations
+    (requires libxml-2.3.7)
+   - fixes to current() and key()
+   - other, smaller fixes, lots of testing with N Walsh DocBook HTML
+    stylesheets
+
+
+0.7.0: Apr 10 2001:
+   - cleanup using stricter compiler flags
+   - command line parameter passing
+   - fix to xsltApplyTemplates from William M. Brack
+   - added the XSLTMark in the regression tests as well as document()
+
+
+0.6.0: Mar 22 2001:
+   - another beta
+   - requires 2.3.5, which provide XPath expression compilation support
+   - document() extension should function properly
+   - fixed a number or reported bugs
+
+
+0.5.0: Mar 10 2001:
+   - fifth beta
+   - some optimization work, for the moment 2 XSLT transform cannot use the
+    same stylesheet at the same time (to be fixed)
+   - fixed problems with handling of tree results
+   - fixed a reported strip-spaces problem
+   - added more reported/fixed bugs to the test suite
+   - incorporated William M. Brack fix for imports and global variables as
+    well as patch for with-param support in apply-templates
+   - a bug fix on for-each
+
+
+0.4.0: Mar 1 2001:
+   - fourth beta test, released at the same time of libxml2-2.3.3
+   - bug fixes
+   - some optimization
+   - started implement extension support, not finished
+   - implemented but not tested multiple file output
+
+
+0.3.0: Feb 24 2001:
+   - third beta test, released at the same time of libxml2-2.3.2
+   - lot of bug fixes
+   - some optimization
+   - added DocBook XSL based testsuite
+
+
+0.2.0: Feb 15 2001:
+   - second beta version, released at the same time as libxml2-2.3.1
+   - getting close to feature completion, lot of bug fixes, some in the HTML
+    and XPath support of libxml
+   - start becoming usable for real work. This version can now regenerate
+    the XML 2e HTML from the original XML sources and the associated
+    stylesheets (in section I of the XML
+    REC)
+   - Still misses extension element/function/prefixes support. Support of
+    key() and document() is not complete
+
+
+0.1.0: Feb 8 2001:
+   - first beta version, released at the same time as libxml2-2.3.0
+   - lots of bug fixes, first "testing" version, but incomplete
+
+
+0.0.1: Jan 25 2001:
+   - first alpha version released at the same time as libxml2-2.2.12
+   - Framework in place, should work on simple examples, but far from being
+    feature complete
+
+Daniel Veillard at 
+bugs.html
diff --git a/third_party/libxslt/README b/third_party/libxslt/README
new file mode 100644
index 0000000..f1e6455
--- /dev/null
+++ b/third_party/libxslt/README
@@ -0,0 +1,24 @@
+
+     XSLT support for libxml2 (XML toolkit from the GNOME project)
+
+Full documentation is available on-line at
+    http://xmlsoft.org/XSLT/
+
+This code is released under the MIT Licence see the Copyright file.
+ 
+To report bugs, follow the instructions at:
+  http://xmlsoft.org/XSLT/bugs.html
+
+A mailing-list xslt@gnome.org is available, to subscribe:
+    http://mail.gnome.org/mailman/listinfo/xslt
+
+The list archive is at:
+    http://mail.gnome.org/archives/xslt/
+
+All technical answers asked privately will be automatically answered on
+the list and archived for public access unless pricacy is explicitely
+required and justified.
+
+Daniel Veillard
+
+$Id: README,v 1.7 2003/02/04 17:20:01 veillard Exp $
diff --git a/third_party/libxslt/README.google b/third_party/libxslt/README.google
new file mode 100644
index 0000000..33d568d
--- /dev/null
+++ b/third_party/libxslt/README.google
@@ -0,0 +1,16 @@
+This directory contains a partial snapshot of the libxslt library from
+http://xmlsoft.org/XSLT, with the following modification:
+* Modified win32/configure.js to be able to clobber a read-only Makefile
+* Modified libxslt/security.c to use GetFileAttributesA instead of GetFileAttributes. 
+
+Current version: 1.1.24
+
+To import a new snapshot of libxslt:
+
+- Visit http://xmlsoft.org/XSLT/downloads.html and download the latest source
+  distribution.
+- Copy the files into this directory, omitting files which have been omitted
+  here.
+- Remove libxslt/xsltconfig.h and libexslt/exsltconfig.h.
+- Perform the modification above.
+- Update this README to reflect the new version number.
diff --git a/third_party/libxslt/SConscript b/third_party/libxslt/SConscript
new file mode 100644
index 0000000..2c070e3
--- /dev/null
+++ b/third_party/libxslt/SConscript
@@ -0,0 +1,116 @@
+# Copyright 2008, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Import('env')
+
+env = env.Clone()
+
+env.Prepend(
+    CPPPATH = [
+        '$LIBXML_DIR/scons/include',
+        '$LIBXML_DIR/include',
+        '$ICU38_DIR/public/common',
+        '$ICU38_DIR/public/18n',
+        '$ZLIB_DIR',
+        '.',
+        '../',
+    ],
+)
+
+env.Append(
+    CPPDEFINES = [
+        'U_STATIC_IMPLEMENTATION',
+        'LIBXML_STATIC',
+        'LIBXSLT_STATIC',
+    ],
+    CCFLAGS = [
+        '/TC',
+
+        '/wd4800',
+        '/wd4503',
+        '/wd4819',
+    ],
+)
+
+
+input_files = [
+    'libxslt/attributes.c',
+    'libxslt/attrvt.c',
+    'libxslt/documents.c',
+    'libxslt/extensions.c',
+    'libxslt/extra.c',
+    'libxslt/functions.c',
+    'libxslt/imports.c',
+    'libxslt/keys.c',
+    'libxslt/namespaces.c',
+    'libxslt/numbers.c',
+    'libxslt/pattern.c',
+    'libxslt/preproc.c',
+    'libxslt/security.c',
+    'libxslt/templates.c',
+    'libxslt/transform.c',
+    'libxslt/variables.c',
+    'libxslt/xslt.c',
+    'libxslt/xsltutils.c',
+]
+
+env.StaticLibrary('libxslt', input_files)
+
+
+config_files = [
+    # The configure.js script must be first in this list; the
+    # env.Command() call below executes the first list element.
+
+    'win32/configure.js',
+    'win32/Makefile.msvc',
+
+    'config.h.in',
+    'configure.in',
+    'libexslt.pc.in',
+    'libxslt.pc.in',
+    'libxslt.spec.in',
+    'xslt-config.in',
+    'xsltConf.sh.in',
+
+    'libexslt/exsltconfig.h.in',
+
+    'libxslt/xsltconfig.h.in',
+    'libxslt/xsltwin32config.h.in',
+    'libxslt/win32config.h',
+]
+
+copied_sources = []
+for cf in config_files:
+  result = env.Command('scons/' + cf, cf, Copy('$TARGET', '$SOURCE'))
+  copied_sources.extend(result)
+
+env.Command(['scons/config.h'],
+            copied_sources,
+            'cd ${SOURCE.dir} && $CSCRIPT ${SOURCE.file} $CONFIG_OPTIONS',
+            CONFIG_OPTIONS='compiler=msvc')
diff --git a/third_party/libxslt/TODO b/third_party/libxslt/TODO
new file mode 100644
index 0000000..2c671fa
--- /dev/null
+++ b/third_party/libxslt/TODO
@@ -0,0 +1,124 @@
+                  ********
+                 *        *
+                 *  TODO  *
+                 *        *
+                  ********
+
+Lifetime of result Value Tree, make sure we keep pointers. Exslt
+handling of node set values is especially nasty in this respect,
+lots of potential mem leaks...
+
+Pattern tester:
+  -> try to optimize for ID scan and tests.
+
+Pattern scanner:
+  -> add error checks on all returns
+
+Sorting:
+  -> add lang and case-order
+  -> add foreign sorting functions (interfaces ?).
+
+                  ********
+                 *        *
+                 *  DONE  *
+                 *        *
+                  ********
+
+Design:
+  - should transforms for a given stylesheet be thread clean,
+    -> the precompilation now occur only at stylesheet processing
+       time (except the binding for named templates and extension
+       functions which need to be computed once at run-time).
+       Multiple threads should be able to reuse the same stylesheet
+       now.
+
+Embedding Stylesheets:
+  - example in 2.7 would force to validate, we do it by default now
+
+ID and Key support:
+  -> Done
+
+Extra functions:
+  -> document() should not be a problem since Result Tree Fragments are
+     implemented
+  => Done
+
+Templates:
+  -> check the built-in template rule for attributes
+  -> make sure @xxx matches are applied
+
+Contextual error reporting:
+  -> provide a couple of functions providing context analysis, not urgent
+
+Validity:
+  -> should we add validation by default ? Make this an option
+  -> redirrect validity errors
+  => done added a special parsing mode
+
+Import:
+  -> parse them
+  -> provide functions to circulate in the import tree of stylesheets
+  -> make sure we use the cascade wherever it's needed
+
+Extra functions:
+  -> make a separate module.
+  => done functions.[ch]
+
+Support Attribute value templates:
+  -> starts to be urgent. Design it in flexible ways but try to optimize
+     to handle most of it at the stylesheet parse time ...
+  => Done for the most part need to check all attributes in XSLT constructs
+     using them and use the dedicated readin function.
+  -> optimization by checking their existence at stylesheet parse time.
+  => done when building the preproc function
+
+Sorting:
+  -> add support for imbricated sorts
+  => done but not well tested.
+
+Separate util module:
+  -> macros, config, verbosity ?
+  => xsltutils.[ch]
+
+Support for disable-output-escaping="yes":
+  -> looks problematic, libxml has no support for anything like this,
+     and unless adding a new node type :-( or tweaking text node and
+     output routines this is gonna be messy ... must be handled at libxml
+     level.
+  => Done with a trick, text node name is different, requires > 2.2.11
+
+Pattern scanner:
+  -> compute priority
+  -> handle unions
+  -> support for mode
+  => done
+
+Pattern tester:
+  -> also put fast lookup for "text()", "comment()", "node()"
+     based patterns lists.
+  => done
+
+Support Attribute value templates:
+  -> namespace support for attribute value templates is not done, need
+     a small API redesign
+
+Doc:
+  - put a page at http://xmlsoft.org/XSLT/
+  - generate/transform the DocBook to HTML
+  - add HTML to package
+  - manpage and doc for xsltproc
+
+
+Error handling:
+  -> check the version stuff, design a separate module for error interfacing
+     and default handling, parsing vs. runtime, fatal / compat / warning,
+     and lack of optionnal features.
+  -> reports context
+
+ID and Key support:
+  -> done but namespace support in keys is not defined
+  -> make sure keys are recomputed on new document input
+
+Profiler:
+  -> added looks good enough
+  -> autocorrection of initial calibration loop
diff --git a/third_party/libxslt/acconfig.h b/third_party/libxslt/acconfig.h
new file mode 100644
index 0000000..3900a67
--- /dev/null
+++ b/third_party/libxslt/acconfig.h
@@ -0,0 +1,6 @@
+#undef HAVE_ISINF
+#undef HAVE_ISNAN
+#undef HAVE_POW
+#undef HAVE_FLOOR
+#undef HAVE_FABS
+#undef WITH_DEBUGGER
diff --git a/third_party/libxslt/aclocal.m4 b/third_party/libxslt/aclocal.m4
new file mode 100644
index 0000000..6f16c9d
--- /dev/null
+++ b/third_party/libxslt/aclocal.m4
@@ -0,0 +1,7442 @@
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 51 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat </dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      libsuff=64
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <
+#endif
+
+#include 
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+m4_if($1,[],[
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  AC_LIBTOOL_LANG_CXX_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+	  AC_LIBTOOL_LANG_F77_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+	  AC_LIBTOOL_LANG_GCJ_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+	AC_LIBTOOL_LANG_RC_CONFIG
+	;;
+
+      *)
+	AC_MSG_ERROR([Unsupported tag name: $tagname])
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognize shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognize a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	_LT_AC_SYS_LIBPATH_AIX
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach  says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  interix[[3-9]]*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+	;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC*)
+        # Portland Group C++ compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit , 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat < conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II  reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach  says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix[[3-9]]*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 _LT_AC_SYS_LIBPATH_AIX
+	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include 
+# #undef WIN32_LEAN_AND_MEAN
+# #include 
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include 
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# ----------------
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+  as_executable_p='test -x'
+else
+  as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/third_party/libxslt/build/libxslt.vcproj b/third_party/libxslt/build/libxslt.vcproj
new file mode 100644
index 0000000..123b8b1
--- /dev/null
+++ b/third_party/libxslt/build/libxslt.vcproj
@@ -0,0 +1,219 @@
+
+
+	
+		
+	
+	
+		
+			
+			
+		
+		
+			
+			
+		
+	
+	
+		
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+		
+	
+
diff --git a/third_party/libxslt/build/libxslt_config.bat b/third_party/libxslt/build/libxslt_config.bat
new file mode 100644
index 0000000..00c4ff9
--- /dev/null
+++ b/third_party/libxslt/build/libxslt_config.bat
@@ -0,0 +1,13 @@
+:: %1 is the input file js file
+:: %2 is the solution directory
+
+:: Change to the directory of the input file
+cd %~p1
+
+:: Make config.h
+cscript //E:jscript %1 compiler=msvc
+if errorlevel 1 echo %1: error: The javascript file failed to run.
+
+:: Make sure the timestamp on config.h is current.
+%2..\third_party\cygwin\bin\touch.exe ..\config.h
+
diff --git a/third_party/libxslt/build/libxslt_config.rules b/third_party/libxslt/build/libxslt_config.rules
new file mode 100644
index 0000000..d603893
--- /dev/null
+++ b/third_party/libxslt/build/libxslt_config.rules
@@ -0,0 +1,17 @@
+
+
+	
+		
+		
+	
+
diff --git a/third_party/libxslt/build/libxslt_config.vcproj b/third_party/libxslt/build/libxslt_config.vcproj
new file mode 100644
index 0000000..8a8fa80
--- /dev/null
+++ b/third_party/libxslt/build/libxslt_config.vcproj
@@ -0,0 +1,74 @@
+
+
+	
+		
+	
+	
+		
+	
+	
+		
+			
+			
+			
+			
+			
+		
+		
+			
+			
+			
+			
+			
+		
+	
+	
+	
+	
+		
+		
+	
+	
+	
+
diff --git a/third_party/libxslt/build/using_libxslt.vsprops b/third_party/libxslt/build/using_libxslt.vsprops
new file mode 100644
index 0000000..1d55046
--- /dev/null
+++ b/third_party/libxslt/build/using_libxslt.vsprops
@@ -0,0 +1,12 @@
+
+
+	
+
diff --git a/third_party/libxslt/compile b/third_party/libxslt/compile
new file mode 100644
index 0000000..1b1d232
--- /dev/null
+++ b/third_party/libxslt/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey .
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to  or send patches to
+# .
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to .
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as `compile cc -o foo foo.c'.
+	# So we strip `-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/third_party/libxslt/config.guess b/third_party/libxslt/config.guess
new file mode 100644
index 0000000..951383e3
--- /dev/null
+++ b/third_party/libxslt/config.guess
@@ -0,0 +1,1516 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-05-17'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner .
+# Please send patches to .  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include   /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include 
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include 
+              #include 
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include 
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86) 
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa:Linux:*:*)
+    	echo xtensa-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include 
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says 
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes .
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <
+# include 
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include 
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include 
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 < in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+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`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/third_party/libxslt/config.h.in b/third_party/libxslt/config.h.in
new file mode 100644
index 0000000..1b61d2b
--- /dev/null
+++ b/third_party/libxslt/config.h.in
@@ -0,0 +1,160 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+#undef HAVE_ISINF
+#undef HAVE_ISNAN
+#undef HAVE_POW
+#undef HAVE_FLOOR
+#undef HAVE_FABS
+#undef WITH_DEBUGGER
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_ANSIDECL_H
+
+/* Define to 1 if you have the `asctime' function. */
+#undef HAVE_ASCTIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the `fprintf' function. */
+#undef HAVE_FPRINTF
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_FP_CLASS_H
+
+/* Define to 1 if you have the `ftime' function. */
+#undef HAVE_FTIME
+
+/* Define if gcrypt library is available. */
+#undef HAVE_GCRYPT
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_IEEEFP_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `localtime' function. */
+#undef HAVE_LOCALTIME
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_MATH_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mktime' function. */
+#undef HAVE_MKTIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_NAN_H
+
+/* Define to 1 if you have the `printf' function. */
+#undef HAVE_PRINTF
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the `sprintf' function. */
+#undef HAVE_SPRINTF
+
+/* Define to 1 if you have the `sscanf' function. */
+#undef HAVE_SSCANF
+
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDARG_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TIMEB_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `time' function. */
+#undef HAVE_TIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfprintf' function. */
+#undef HAVE_VFPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `vsprintf' function. */
+#undef HAVE_VSPRINTF
+
+/* Define to 1 if you have the `_stat' function. */
+#undef HAVE__STAT
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Using the Win32 Socket implementation */
+#undef _WINSOCKAPI_
+
+/* Win32 Std C name mangling work-around */
+#undef snprintf
+
+/* Win32 Std C name mangling work-around */
+#undef vsnprintf
diff --git a/third_party/libxslt/config.sub b/third_party/libxslt/config.sub
new file mode 100644
index 0000000..c060f448
--- /dev/null
+++ b/third_party/libxslt/config.sub
@@ -0,0 +1,1626 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-04-29'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to .  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/third_party/libxslt/configure b/third_party/libxslt/configure
new file mode 100644
index 0000000..1fbb5d1
--- /dev/null
+++ b/third_party/libxslt/configure
@@ -0,0 +1,24257 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 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=:
+  # Zsh 3.x and 4.x performs 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+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.)
+as_nl='
+'
+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
+  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.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# 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 ||
+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=:
+  # Zsh 3.x and 4.x performs 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=:
+  # Zsh 3.x and 4.x performs 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 autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  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" ||
+    { 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
+fi
+echo >conf$$.file
+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
+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
+
+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'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat </dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 &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
+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="libxslt/xslt.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include 
+#ifdef HAVE_SYS_TYPES_H
+# include 
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include 
+#endif
+#ifdef STDC_HEADERS
+# include 
+# include 
+#else
+# ifdef HAVE_STDLIB_H
+#  include 
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include 
+# endif
+# include 
+#endif
+#ifdef HAVE_STRINGS_H
+# include 
+#endif
+#ifdef HAVE_INTTYPES_H
+# include 
+#endif
+#ifdef HAVE_STDINT_H
+# include 
+#endif
+#ifdef HAVE_UNISTD_H
+# include 
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+LIBXSLT_MAJOR_VERSION
+LIBXSLT_MINOR_VERSION
+LIBXSLT_MICRO_VERSION
+LIBXSLT_VERSION
+LIBXSLT_VERSION_INFO
+LIBXSLT_VERSION_NUMBER
+LIBXSLT_VERSION_EXTRA
+LIBXSLT_MAJOR_MINOR_VERSION
+LIBEXSLT_MAJOR_VERSION
+LIBEXSLT_MINOR_VERSION
+LIBEXSLT_MICRO_VERSION
+LIBEXSLT_VERSION
+LIBEXSLT_VERSION_INFO
+LIBEXSLT_VERSION_NUMBER
+LIBEXSLT_VERSION_EXTRA
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+HTML_DIR
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+RM
+MV
+TAR
+GREP
+EGREP
+SED
+LN_S
+ECHO
+AR
+RANLIB
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+WITH_TRIO
+PERL
+WITH_PERL_TRUE
+WITH_PERL_FALSE
+PYTHON
+WITH_PYTHON_TRUE
+WITH_PYTHON_FALSE
+pythondir
+PYTHON_SUBDIR
+LIBGCRYPT_CONFIG
+WITH_CRYPTO
+LIBGCRYPT_CFLAGS
+LIBGCRYPT_LIBS
+STATIC_BINARIES
+WITH_XSLT_DEBUG
+WITH_MEM_DEBUG
+WITH_DEBUGGER
+LIBXML_SRC
+LIBXML_REQUIRED_VERSION
+WITH_MODULES
+WITH_MODULES_TRUE
+WITH_MODULES_FALSE
+LIBXSLT_DEFAULT_PLUGINS_PATH
+WIN32_EXTRA_LIBADD
+WIN32_EXTRA_LDFLAGS
+XSLTPROCDV
+PYTHONSODV
+XML_CONFIG
+LIBXML_LIBS
+LIBXML_CFLAGS
+PYTHON_VERSION
+PYTHON_INCLUDES
+PYTHON_SITE_PACKAGES
+XSLT_LIBDIR
+XSLT_INCLUDEDIR
+XSLT_LIBS
+EXSLT_LIBDIR
+EXSLT_INCLUDEDIR
+EXSLT_LIBS
+EXTRA_LIBS
+M_LIBS
+RELDATE
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+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'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+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
+    ac_prev=
+    continue
+  fi
+
+  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_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 ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    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 ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -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=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=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=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -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_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    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 ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    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 ;;
+
+  -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)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --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 ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    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-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-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    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)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    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 ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    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-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 ;;
+
+  -*) { 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 &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      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
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+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
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+done
+
+# 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
+    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 .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# 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 the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+    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
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { 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" || { 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
+
+#
+# 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
+
+Program names:
+  --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
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-html-dir=PATH path to installed docs
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-python=DIR    Build Python bindings if found
+  --with-crypto           Add crypto support to exslt (on)
+  --with-debug            Add the debugging code (on)
+  --with-mem-debug        Add the memory debugging module (off)
+  --with-debugger        Add the debugging support (on)
+  --with-libxml-prefix=PFX		Specify location of libxml config
+  --with-libxml-include-prefix=PFX	Specify location of libxml headers
+  --with-libxml-libs-prefix=PFX	Specify location of libxml libs
+  --with-libxml-src=DIR              For libxml thats not installed yet (sets all three above)
+  --with-plugins          Add plugin extension support (on)
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L if you have libraries in a
+              nonstandard directory 
+  LIBS        libraries to pass to the linker, e.g. -l
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I if
+              you have headers in a nonstandard directory 
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+
+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" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
+      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.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 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.61.  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=.
+  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=`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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $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=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      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=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	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 &&
+      echo "$as_me: caught signal $ac_signal"
+    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 explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+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
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`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
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+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 config.h"
+
+ac_aux_dir=
+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
+    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 "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# 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.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+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` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+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
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+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
+
+
+
+LIBXSLT_MAJOR_VERSION=1
+LIBXSLT_MINOR_VERSION=1
+LIBXSLT_MICRO_VERSION=24
+PACKAGE=libxslt
+LIBEXSLT_MAJOR_VERSION=0
+LIBEXSLT_MINOR_VERSION=8
+LIBEXSLT_MICRO_VERSION=13
+LIBXML_REQUIRED_VERSION=2.6.27
+
+
+LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
+LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
+
+LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
+LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
+
+if test -f CVS/Entries; then
+  extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-CVS$extra"
+  fi
+else if test -d .svn ; then
+  extra=`svn info | grep Revision | sed 's+Revision: ++'`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-SVN$extra"
+  fi
+fi
+fi
+
+
+
+
+
+
+
+
+
+
+
+LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
+LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
+
+LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
+
+if test -f CVS/Entries; then
+  LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+fi
+
+
+
+
+
+
+
+
+
+VERSION=${LIBXSLT_VERSION}
+
+am__api_version='1.10'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# 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 "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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 "$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="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # 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 value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+done
+IFS=$as_save_IFS
+
+fi
+
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+echo "${ECHO_T}$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=$PACKAGE
+ VERSION=$VERSION
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip"
+    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_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# AM_MAINTAINER_MODE
+
+
+# Check whether --with-html-dir was given.
+if test "${with_html_dir+set}" = set; then
+  withval=$with_html_dir;
+fi
+
+
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='$(prefix)/doc'
+else
+  HTML_DIR=$with_html_dir
+fi
+
+
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+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
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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}cc"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+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"
+    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 $# != 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
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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$ac_prog"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+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.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  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.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.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  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 | *.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_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+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.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  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
+	{ { 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
+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
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out 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.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  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 | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  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 ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+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 "echo \"\$as_me:$LINENO: $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
+  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
+  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
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 "echo \"\$as_me:$LINENO: $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
+  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
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	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 "echo \"\$as_me:$LINENO: $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
+  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 "$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 "echo \"\$as_me:$LINENO: $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
+  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
+  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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 
+#include 
+#include 
+#include 
+/* 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;
+}
+
+/* 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
+  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 "echo \"\$as_me:$LINENO: $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
+  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
+  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)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$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
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; }
+if test "${ac_cv_search_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+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 strerror ();
+int
+main ()
+{
+return strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' cposix; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_strerror=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_strerror+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_strerror+set}" = set; then
+  :
+else
+  ac_cv_search_strerror=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6; }
+ac_res=$ac_cv_search_strerror
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+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
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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}cc"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+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"
+    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 $# != 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
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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$ac_prog"
+    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
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+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.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+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 "echo \"\$as_me:$LINENO: $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
+  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
+  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
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 "echo \"\$as_me:$LINENO: $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
+  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
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	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 "echo \"\$as_me:$LINENO: $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
+  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 "$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 "echo \"\$as_me:$LINENO: $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
+  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
+  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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 
+#include 
+#include 
+#include 
+/* 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;
+}
+
+/* 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
+  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 "echo \"\$as_me:$LINENO: $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
+  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
+  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)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$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
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# 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 "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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 "$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="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # 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 value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+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
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer  to  if __STDC__ is defined, since
+  #  exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer  to  if __STDC__ is defined, since
+  #  exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&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
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_RM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $RM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RM="$RM" # Let the user override the test with a path.
+  ;;
+  *)
+  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_RM="$as_dir/$ac_word$ac_exec_ext"
+    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_RM" && ac_cv_path_RM="/bin/rm"
+  ;;
+esac
+fi
+RM=$ac_cv_path_RM
+if test -n "$RM"; then
+  { echo "$as_me:$LINENO: result: $RM" >&5
+echo "${ECHO_T}$RM" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+# Extract the first word of "mv", so it can be a program name with args.
+set dummy mv; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MV+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MV in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MV="$MV" # Let the user override the test with a path.
+  ;;
+  *)
+  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_MV="$as_dir/$ac_word$ac_exec_ext"
+    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_MV" && ac_cv_path_MV="/bin/mv"
+  ;;
+esac
+fi
+MV=$ac_cv_path_MV
+if test -n "$MV"; then
+  { echo "$as_me:$LINENO: result: $MV" >&5
+echo "${ECHO_T}$MV" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+# Extract the first word of "tar", so it can be a program name with args.
+set dummy tar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_TAR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $TAR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
+  ;;
+  *)
+  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_TAR="$as_dir/$ac_word$ac_exec_ext"
+    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_TAR" && ac_cv_path_TAR="/bin/tar"
+  ;;
+esac
+fi
+TAR=$ac_cv_path_TAR
+if test -n "$TAR"; then
+  { echo "$as_me:$LINENO: result: $TAR" >&5
+echo "${ECHO_T}$TAR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+#include 
+#include 
+#include 
+
+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 "echo \"\$as_me:$LINENO: $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
+  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_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+#include 
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 &5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 &5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5932 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      libsuff=64
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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
+
+     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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+     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
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_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 "echo \"\$as_me:$LINENO: $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
+  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
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_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 "echo \"\$as_me:$LINENO: $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
+  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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$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_CXX="$ac_tool_prefix$ac_prog"
+    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
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+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 "echo \"\$as_me:$LINENO: $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
+  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
+  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
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 "echo \"\$as_me:$LINENO: $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
+  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
+  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 ()
+{
+
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 "$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 "echo \"\$as_me:$LINENO: $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
+  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
+  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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+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
+
+depcc="$CXX"  am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  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
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer  to  if __STDC__ is defined, since
+  #  exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer  to  if __STDC__ is defined, since
+  #  exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include 
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+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
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # 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_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog"
+    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_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_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 "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  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_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_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 "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+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
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ 	]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat < conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+  { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar"
+    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_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$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_RANLIB="${ac_tool_prefix}ranlib"
+    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
+if test -n "$RANLIB"; then
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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"
+    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
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip"
+    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_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+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
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8265: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8269: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8555: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8559: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8659: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:8663: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II  reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach  says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L=yes
+  	  hardcode_libdir_flag_spec='-L$libdir'
+  	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	hardcode_direct=yes
+	export_dynamic_flag_spec='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld='+b $libdir'
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case  declares shl_load.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef shl_load
+
+/* 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 shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+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 shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case  declares dlopen.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef dlopen
+
+/* 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 dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+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 dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <
+#endif
+
+#include 
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <
+#endif
+
+#include 
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    fix_srcfile_path \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit , 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+  withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  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
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 &5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 &5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  hardcode_direct_CXX=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_CXX=yes
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  hardcode_libdir_separator_CXX=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag_CXX="-z nodefs"
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	no_undefined_flag_CXX=' ${wl}-bernotok'
+	allow_undefined_flag_CXX=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	whole_archive_flag_spec_CXX='$convenience'
+	archive_cmds_need_lc_CXX=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag_CXX=unsupported
+      # Joseph Beckenbach  says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC*)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_CXX=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  interix[3-9]*)
+    hardcode_direct_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	link_all_deplibs_CXX=yes
+	;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	archive_cmds_need_lc_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC*)
+        # Portland Group C++ compiler
+	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  no_undefined_flag_CXX=' -zdefs'
+	  archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' -expect_unresolved \*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
+	no_undefined_flag_CXX=' -zdefs'
+	archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-R$libdir'
+	hardcode_shlibpath_var_CXX=no
+	case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	link_all_deplibs_CXX=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+    no_undefined_flag_CXX='${wl}-z,text'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    no_undefined_flag_CXX='${wl}-z,text'
+    allow_undefined_flag_CXX='${wl}-z,nodefs'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+    export_dynamic_flag_spec_CXX='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13530: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:13534: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13634: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:13638: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    fix_srcfile_path_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      else
+	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_F77='-qnocommon'
+         lt_prog_compiler_wl_F77='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-KPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fpic'
+	lt_prog_compiler_static_F77='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_F77='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_F77='-Kconform_pic'
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:15198: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:15202: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_F77=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_F77=yes
+       fi
+     else
+       lt_prog_compiler_static_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+    :
+else
+    lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:15302: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:15306: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_F77=no
+	cat <&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II  reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_F77=unsupported
+	# Joseph Beckenbach  says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_F77='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_F77=no
+	cat <&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_F77=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_F77=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_F77=yes
+  	  hardcode_libdir_flag_spec_F77='-L$libdir'
+  	  hardcode_libdir_separator_F77=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_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 "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_F77="-z nodefs"
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_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 "echo \"\$as_me:$LINENO: $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
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_F77=' ${wl}-bernotok'
+	  allow_undefined_flag_F77=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_F77='$convenience'
+	  archive_cmds_need_lc_F77=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_F77=no
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77=''
+      link_all_deplibs_F77=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_F77=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	hardcode_direct_F77=yes
+	export_dynamic_flag_spec_F77='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_F77=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+	  ;;
+	*)
+	  hardcode_direct_F77=yes
+	  export_dynamic_flag_spec_F77='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_F77=yes
+	hardcode_shlibpath_var_F77=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_F77='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_F77='$CC -r -o $output$reload_objs'
+	  hardcode_direct_F77=no
+        ;;
+	motorola)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_F77=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_F77='${wl}-z,text'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_F77='${wl}-z,text'
+      allow_undefined_flag_F77='${wl}-z,nodefs'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+	pic_flag=$lt_prog_compiler_pic_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_F77=no
+        else
+	  archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var_F77" || \
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    fix_srcfile_path_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17491: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17495: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-KPIC'
+	lt_prog_compiler_static_GCJ='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-fpic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_GCJ='-Kconform_pic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17781: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17785: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_GCJ=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_GCJ=yes
+       fi
+     else
+       lt_prog_compiler_static_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+    :
+else
+    lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17885: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:17889: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_GCJ=no
+	cat <&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II  reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_GCJ=unsupported
+	# Joseph Beckenbach  says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_GCJ=no
+	cat <&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_GCJ=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_GCJ=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_GCJ=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_GCJ=yes
+  	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
+  	  hardcode_libdir_separator_GCJ=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_GCJ="-z nodefs"
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_GCJ=' ${wl}-bernotok'
+	  allow_undefined_flag_GCJ=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_GCJ='$convenience'
+	  archive_cmds_need_lc_GCJ=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_GCJ=no
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ=''
+      link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	hardcode_direct_GCJ=yes
+	export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_GCJ=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+	  hardcode_direct_GCJ=no
+	  hardcode_shlibpath_var_GCJ=no
+	  ;;
+	*)
+	  hardcode_direct_GCJ=yes
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_GCJ=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_GCJ=yes
+	hardcode_shlibpath_var_GCJ=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_GCJ='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+	  hardcode_direct_GCJ=no
+        ;;
+	motorola)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_GCJ=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_GCJ='${wl}-z,text'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_GCJ='${wl}-z,text'
+      allow_undefined_flag_GCJ='${wl}-z,nodefs'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+	pic_flag=$lt_prog_compiler_pic_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_GCJ=no
+        else
+	  archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib.so
+      # instead of lib.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    fix_srcfile_path_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    fix_srcfile_path_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+	;;
+
+      *)
+	{ { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/time.h stdlib.h unistd.h string.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_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 "echo \"\$as_me:$LINENO: $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
+  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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+for ac_header in ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_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 "echo \"\$as_me:$LINENO: $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
+  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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_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 "echo \"\$as_me:$LINENO: $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
+  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_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_func in stat _stat
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case  declares $ac_func.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef $ac_func
+
+/* 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 $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+{ echo "$as_me:$LINENO: checking for isnan" >&5
+echo $ECHO_N "checking for isnan... $ECHO_C" >&6; }
+if test "${ac_cv_func_isnan+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define isnan to an innocuous variant, in case  declares isnan.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define isnan innocuous_isnan
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char isnan (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef isnan
+
+/* 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 isnan ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_isnan || defined __stub___isnan
+choke me
+#endif
+
+int
+main ()
+{
+return isnan ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_isnan=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_isnan=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_isnan" >&5
+echo "${ECHO_T}$ac_cv_func_isnan" >&6; }
+if test $ac_cv_func_isnan = yes; then
+  :
+else
+  { echo "$as_me:$LINENO: checking for isnan in -lm" >&5
+echo $ECHO_N "checking for isnan in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_isnan+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+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 isnan ();
+int
+main ()
+{
+return isnan ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_isnan=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_isnan=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_isnan" >&5
+echo "${ECHO_T}$ac_cv_lib_m_isnan" >&6; }
+if test $ac_cv_lib_m_isnan = yes; then
+  M_LIBS="-lm"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_ISNAN 1
+_ACEOF
+
+fi
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for isinf" >&5
+echo $ECHO_N "checking for isinf... $ECHO_C" >&6; }
+if test "${ac_cv_func_isinf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define isinf to an innocuous variant, in case  declares isinf.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define isinf innocuous_isinf
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char isinf (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef isinf
+
+/* 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 isinf ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_isinf || defined __stub___isinf
+choke me
+#endif
+
+int
+main ()
+{
+return isinf ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_isinf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_isinf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_isinf" >&5
+echo "${ECHO_T}$ac_cv_func_isinf" >&6; }
+if test $ac_cv_func_isinf = yes; then
+  :
+else
+  { echo "$as_me:$LINENO: checking for isinf in -lm" >&5
+echo $ECHO_N "checking for isinf in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_isinf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+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 isinf ();
+int
+main ()
+{
+return isinf ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_isinf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_isinf=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_isinf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_isinf" >&6; }
+if test $ac_cv_lib_m_isinf = yes; then
+  M_LIBS="-lm"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_ISINF 1
+_ACEOF
+
+fi
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for pow" >&5
+echo $ECHO_N "checking for pow... $ECHO_C" >&6; }
+if test "${ac_cv_func_pow+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define pow to an innocuous variant, in case  declares pow.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define pow innocuous_pow
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char pow (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef pow
+
+/* 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 pow ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_pow || defined __stub___pow
+choke me
+#endif
+
+int
+main ()
+{
+return pow ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_pow=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_pow=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_pow" >&5
+echo "${ECHO_T}$ac_cv_func_pow" >&6; }
+if test $ac_cv_func_pow = yes; then
+  :
+else
+  { echo "$as_me:$LINENO: checking for pow in -lm" >&5
+echo $ECHO_N "checking for pow in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_pow+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+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 pow ();
+int
+main ()
+{
+return pow ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_pow=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_pow=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5
+echo "${ECHO_T}$ac_cv_lib_m_pow" >&6; }
+if test $ac_cv_lib_m_pow = yes; then
+  M_LIBS="-lm"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_POW 1
+_ACEOF
+
+fi
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for floor" >&5
+echo $ECHO_N "checking for floor... $ECHO_C" >&6; }
+if test "${ac_cv_func_floor+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define floor to an innocuous variant, in case  declares floor.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define floor innocuous_floor
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char floor (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef floor
+
+/* 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 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_floor || defined __stub___floor
+choke me
+#endif
+
+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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_floor=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_floor=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_floor" >&5
+echo "${ECHO_T}$ac_cv_func_floor" >&6; }
+if test $ac_cv_func_floor = yes; then
+  :
+else
+  { echo "$as_me:$LINENO: checking for floor in -lm" >&5
+echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_floor+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_floor=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_floor=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5
+echo "${ECHO_T}$ac_cv_lib_m_floor" >&6; }
+if test $ac_cv_lib_m_floor = yes; then
+  M_LIBS="-lm"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_FLOOR 1
+_ACEOF
+
+fi
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for fabs" >&5
+echo $ECHO_N "checking for fabs... $ECHO_C" >&6; }
+if test "${ac_cv_func_fabs+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define fabs to an innocuous variant, in case  declares fabs.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define fabs innocuous_fabs
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char fabs (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef fabs
+
+/* 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 fabs ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_fabs || defined __stub___fabs
+choke me
+#endif
+
+int
+main ()
+{
+return fabs ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_fabs=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_fabs=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_fabs" >&5
+echo "${ECHO_T}$ac_cv_func_fabs" >&6; }
+if test $ac_cv_func_fabs = yes; then
+  :
+else
+  { echo "$as_me:$LINENO: checking for fabs in -lm" >&5
+echo $ECHO_N "checking for fabs in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_fabs+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+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 fabs ();
+int
+main ()
+{
+return fabs ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_fabs=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_fabs=no
+fi
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_fabs" >&5
+echo "${ECHO_T}$ac_cv_lib_m_fabs" >&6; }
+if test $ac_cv_lib_m_fabs = yes; then
+  M_LIBS="-lm"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_FABS 1
+_ACEOF
+
+fi
+
+fi
+
+
+for ac_func in gettimeofday
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case  declares $ac_func.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef $ac_func
+
+/* 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 $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+for ac_func in mktime localtime localtime_r asctime time gmtime_r ftime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case  declares $ac_func.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef $ac_func
+
+/* 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 $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+for ac_func in printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case  declares $ac_func.
+   For example, HP-UX 11i  declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer  to  if __STDC__ is defined, since
+     exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include 
+#else
+# include 
+#endif
+
+#undef $ac_func
+
+/* 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 $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  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 "echo \"\$as_me:$LINENO: $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
+  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 &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  NEED_TRIO=1
+fi
+done
+
+
+
+if test "${NEED_TRIO}" = "1" ; then
+    echo Reusing trio library for string functions
+    WITH_TRIO=1
+else
+    WITH_TRIO=0
+fi
+
+
+
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_PERL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PERL"; then
+  ac_cv_prog_PERL="$PERL" # 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_PERL="perl"
+    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_PERL" && ac_cv_prog_PERL="false"
+fi
+fi
+PERL=$ac_cv_prog_PERL
+if test -n "$PERL"; then
+  { echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ if test "$PERL" != "false"; then
+  WITH_PERL_TRUE=
+  WITH_PERL_FALSE='#'
+else
+  WITH_PERL_TRUE='#'
+  WITH_PERL_FALSE=
+fi
+
+
+
+PYTHON_VERSION=
+PYTHON_INCLUDES=
+PYTHON_SITE_PACKAGES=
+pythondir=
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then
+  withval=$with_python;
+fi
+
+if test "$with_python" != "no" ; then
+    if test -x "$with_python/bin/python"
+    then
+        echo Found python in $with_python/bin/python
+        PYTHON="$with_python/bin/python"
+    else
+	if test -x "$with_python"
+	then
+	    echo Found python in $with_python
+	    PYTHON="$with_python"
+	else
+            if test -x "$PYTHON"
+            then
+                echo Found python in environment PYTHON=$PYTHON
+                with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+	    else
+	        # Extract the first word of "python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5", so it can be a program name with args.
+set dummy python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  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_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { echo "$as_me:$LINENO: result: $PYTHON" >&5
+echo "${ECHO_T}$PYTHON" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+	    fi
+	fi
+    fi
+    if test "$PYTHON" != ""
+    then
+        echo "PYTHON is pointing at $PYTHON"
+        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[0:3]"`
+	echo Found Python version $PYTHON_VERSION
+	LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
+except: print 0"`
+	if test "$LIBXML2_PYTHON" = "1"
+	then
+	    echo Found libxml2-python module
+	else
+	    echo Warning: Missing libxml2-python
+	fi
+    fi
+    if test "$PYTHON_VERSION" != ""
+    then
+	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
+	then
+	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
+	    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	else
+	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+	    then
+	        PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
+		PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	    else
+		if test -r /usr/include/python$PYTHON_VERSION/Python.h
+		then
+		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
+		    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+		else
+		    echo could not find python$PYTHON_VERSION/Python.h
+		fi
+	    fi
+	    if test ! -d "$PYTHON_SITE_PACKAGES"
+	    then
+		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
+	    fi
+	fi
+    fi
+    if test "$with_python" != ""
+    then
+        pythondir='$(PYTHON_SITE_PACKAGES)'
+    else
+        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+    fi
+fi
+ if test "$PYTHON_INCLUDES" != ""; then
+  WITH_PYTHON_TRUE=
+  WITH_PYTHON_FALSE='#'
+else
+  WITH_PYTHON_TRUE='#'
+  WITH_PYTHON_FALSE=
+fi
+
+if test "$PYTHON_INCLUDES" != ""
+then
+    PYTHON_SUBDIR=python
+else
+    PYTHON_SUBDIR=
+fi
+
+
+
+
+# Check whether --with-crypto was given.
+if test "${with_crypto+set}" = set; then
+  withval=$with_crypto;
+fi
+
+WITH_CRYPTO=0
+if test "$with_crypto" = "no" ; then
+    echo Disabling crypto support
+    LIBGCRYPT_CFLAGS=""
+    LIBGCRYPT_LIBS=""
+else
+    # Extract the first word of "libgcrypt-config", so it can be a program name with args.
+set dummy libgcrypt-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_LIBGCRYPT_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $LIBGCRYPT_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  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_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    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_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no"
+  ;;
+esac
+fi
+LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
+if test -n "$LIBGCRYPT_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $LIBGCRYPT_CONFIG" >&5
+echo "${ECHO_T}$LIBGCRYPT_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    if test "$LIBGCRYPT_CONFIG" != "no" ; then
+      LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
+      if test `echo $LIBGCRYPT_VERSION | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` -lt `echo "1.1.42" | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+      then
+        LIBGCRYPT_CFLAGS=""
+        LIBGCRYPT_LIBS=""
+        echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
+      else
+        LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
+        LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GCRYPT 1
+_ACEOF
+
+        echo 'Crypto extensions will be available.'
+		WITH_CRYPTO=1
+      fi
+    else
+      LIBGCRYPT_CFLAGS=""
+      LIBGCRYPT_LIBS=""
+      echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
+    fi
+fi
+
+
+
+
+if [ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ] || \
+   [ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]
+   then
+    if test "${with_mem_debug}" = "" ;
+    then
+	with_mem_debug="yes"
+    fi
+    CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
+    if test "`uname -m`" != "x86_64" ;
+    then
+	STATIC_BINARIES="-static"
+    else
+        STATIC_BINARIES=
+    fi
+    if test "$LOGNAME" = "veillard"
+    then
+        LIBXML_SRC="/u/veillard/XML"
+	EXTRA_LIBS="$EXTRA_LIBS -ldl"
+    fi
+else
+    STATIC_BINARIES=
+fi
+
+
+
+# Check whether --with-debug was given.
+if test "${with_debug+set}" = set; then
+  withval=$with_debug;
+fi
+
+if test "$with_debug" = "no" ; then
+    echo Disabling debug support
+    WITH_XSLT_DEBUG=0
+else
+    WITH_XSLT_DEBUG=1
+fi
+
+
+
+# Check whether --with-mem_debug was given.
+if test "${with_mem_debug+set}" = set; then
+  withval=$with_mem_debug;
+fi
+
+if test "$with_mem_debug" = "yes" ; then
+    echo Enabling memory debug support
+    WITH_MEM_DEBUG=1
+else
+    WITH_MEM_DEBUG=0
+fi
+
+
+
+# Check whether --with-with_debugger was given.
+if test "${with_with_debugger+set}" = set; then
+  withval=$with_with_debugger;
+fi
+
+if test "$with_debugger" = "no" ; then
+    echo Disabling debugger
+    WITH_DEBUGGER=0
+else
+    echo Enabling debugger
+    WITH_DEBUGGER=1
+    cat >>confdefs.h <<\_ACEOF
+#define WITH_DEBUGGER 1
+_ACEOF
+
+fi
+
+
+
+LIBXML_CONFIG_PREFIX=""
+LIBXML_SRC=""
+
+
+# Check whether --with-libxml-prefix was given.
+if test "${with_libxml_prefix+set}" = set; then
+  withval=$with_libxml_prefix; LIBXML_CONFIG_PREFIX=$withval
+
+fi
+
+
+
+# Check whether --with-libxml-include-prefix was given.
+if test "${with_libxml_include_prefix+set}" = set; then
+  withval=$with_libxml_include_prefix; LIBXML_CFLAGS="-I$withval"
+
+fi
+
+
+
+# Check whether --with-libxml-libs-prefix was given.
+if test "${with_libxml_libs_prefix+set}" = set; then
+  withval=$with_libxml_libs_prefix; LIBXML_LIBS="-L$withval"
+
+fi
+
+
+
+# Check whether --with-libxml-src was given.
+if test "${with_libxml_src+set}" = set; then
+  withval=$with_libxml_src; LIBXML_SRC="$withval"
+
+fi
+
+
+
+
+
+{ echo "$as_me:$LINENO: checking for libxml libraries >= $LIBXML_REQUIRED_VERSION" >&5
+echo $ECHO_N "checking for libxml libraries >= $LIBXML_REQUIRED_VERSION... $ECHO_C" >&6; }
+if test "x$LIBXML_CONFIG_PREFIX" != "x"
+then
+	XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
+else
+	XML_CONFIG=xml2-config
+fi
+
+if test "${GCC}" != "yes" ; then
+    case "${host}" in
+          *-*-hpux* )
+	       CFLAGS="${CFLAGS} -Wp,-H30000"
+	       ;;
+          *-dec-osf* )
+               CFLAGS="${CFLAGS} -ieee"
+               ;;
+    esac
+else
+    CFLAGS="${CFLAGS} -Wall"
+    case "${host}" in
+          alpha*-*-linux* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+	  alpha*-*-osf* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+    esac
+fi
+
+
+if test "x$LIBXML_SRC" != "x"
+then
+	CWD=`pwd`
+	if cd $LIBXML_SRC
+	then
+		SRC_DIR=`pwd`
+		XML_CONFIG=${SRC_DIR}/xml2-config
+		LIBXML_CFLAGS="-I${SRC_DIR}/include"
+		LIBXML_LIBS="-L${SRC_DIR}"
+		cd $CWD
+	else
+		{ { echo "$as_me:$LINENO: error: libxml source dir not found (${LIBXML_SRC}), typo?" >&5
+echo "$as_me: error: libxml source dir not found (${LIBXML_SRC}), typo?" >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+fi
+
+
+if ${XML_CONFIG} --libs print > /dev/null 2>&1
+then
+	XMLVERS=`$XML_CONFIG --version`
+	if test `echo $XMLVERS | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` -ge `echo $LIBXML_REQUIRED_VERSION | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+	then
+		LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
+		LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
+		{ echo "$as_me:$LINENO: result: $XMLVERS found" >&5
+echo "${ECHO_T}$XMLVERS found" >&6; }
+	else
+		{ { echo "$as_me:$LINENO: error: Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt" >&5
+echo "$as_me: error: Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt" >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+else
+	{ { echo "$as_me:$LINENO: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/." >&5
+echo "$as_me: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+# Check whether --with-plugins was given.
+if test "${with_plugins+set}" = set; then
+  withval=$with_plugins;
+fi
+
+if test "$with_plugins" = ""
+then
+    with_plugins=yes
+fi
+
+{ echo "$as_me:$LINENO: checking whether shared libraries will be built (required for plugins)" >&5
+echo $ECHO_N "checking whether shared libraries will be built (required for plugins)... $ECHO_C" >&6; }
+if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
+	 { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+	 { echo "$as_me:$LINENO: WARNING: Disabling plugin support." >&5
+echo "$as_me: WARNING: Disabling plugin support." >&2;}
+	 { echo "$as_me:$LINENO: WARNING: Plugins require that shared libraries be built." >&5
+echo "$as_me: WARNING: Plugins require that shared libraries be built." >&2;}
+	 with_plugins=no
+else
+	 { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+fi
+
+if test "$with_plugins" = "yes" ; then
+  { echo "$as_me:$LINENO: checking libxml2 module support" >&5
+echo $ECHO_N "checking libxml2 module support... $ECHO_C" >&6; }
+  WITH_MODULES="`$XML_CONFIG --modules`"
+  if test "${WITH_MODULES}" = "1"; then
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  else
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    WITH_MODULES="0"
+  fi
+else
+  WITH_MODULES="0"
+fi
+
+
+ if test "$WITH_MODULES" = "1"; then
+  WITH_MODULES_TRUE=
+  WITH_MODULES_FALSE='#'
+else
+  WITH_MODULES_TRUE='#'
+  WITH_MODULES_FALSE=
+fi
+
+
+module_prefix=$prefix
+test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
+LIBXSLT_DEFAULT_PLUGINS_PATH="$module_prefix/lib/libxslt-plugins"
+
+
+if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
+    if test "`uname -i`" != "x86_64" -a -e $HOME/XML/.libs/libxml2.a ;
+    then
+	LIBXML_LIBS="$HOME/XML/.libs/libxml2.a -lpthread -lz"
+    fi
+    DV_LINK="1"
+    XSLTPROCDV="xsltproc.dv"
+    INSTALLED_XSLT_LIB=""
+    LIBXML_SRC="$HOME/XML/"
+fi
+
+WIN32_EXTRA_LIBADD=
+WIN32_EXTRA_LDFLAGS=
+case "$host" in
+ *-*-mingw*)
+ WIN32_EXTRA_LIBADD="-lwsock32"
+ WIN32_EXTRA_LDFLAGS="-no-undefined"
+
+cat >>confdefs.h <<\_ACEOF
+#define _WINSOCKAPI_ 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define snprintf _snprintf
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define vsnprintf _vsnprintf
+_ACEOF
+
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+XSLT_LIBDIR='-L${libdir}'
+XSLT_INCLUDEDIR='-I${includedir}'
+XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
+
+
+
+
+EXSLT_LIBDIR='-L${libdir}'
+EXSLT_INCLUDEDIR='-I${includedir}'
+EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
+
+
+
+
+EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
+
+
+
+
+RELDATE=`date +'%a %b %e %Y'`
+
+
+( cd $srcdir
+rm -f COPYING.LIB COPYING
+$LN_S Copyright COPYING
+)
+
+
+ac_config_files="$ac_config_files Makefile libxslt.pc libexslt.pc libxslt/Makefile libxslt/xsltconfig.h libxslt/xsltwin32config.h libexslt/Makefile libexslt/exsltconfig.h xsltproc/Makefile python/Makefile python/tests/Makefile tests/Makefile tests/docs/Makefile tests/REC1/Makefile tests/REC2/Makefile tests/REC/Makefile tests/general/Makefile tests/reports/Makefile tests/extensions/Makefile tests/namespaces/Makefile tests/keys/Makefile tests/numbers/Makefile tests/documents/Makefile tests/xmlspec/Makefile tests/multiple/Makefile tests/xinclude/Makefile tests/XSLTMark/Makefile tests/docbook/Makefile tests/exslt/Makefile tests/exslt/common/Makefile tests/exslt/functions/Makefile tests/exslt/math/Makefile tests/exslt/sets/Makefile tests/exslt/strings/Makefile tests/exslt/date/Makefile tests/exslt/dynamic/Makefile tests/plugins/Makefile doc/Makefile xslt-config libxslt.spec"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_PERL_TRUE}" && test -z "${WITH_PERL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_PERL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_PERL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_PYTHON_TRUE}" && test -z "${WITH_PYTHON_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WITH_MODULES_TRUE}" && test -z "${WITH_MODULES_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WITH_MODULES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WITH_MODULES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## 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=:
+  # Zsh 3.x and 4.x performs 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+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.)
+as_nl='
+'
+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
+  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.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# 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 ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  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" ||
+    { 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
+fi
+echo >conf$$.file
+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
+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
+
+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 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to ."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "libxslt.pc") CONFIG_FILES="$CONFIG_FILES libxslt.pc" ;;
+    "libexslt.pc") CONFIG_FILES="$CONFIG_FILES libexslt.pc" ;;
+    "libxslt/Makefile") CONFIG_FILES="$CONFIG_FILES libxslt/Makefile" ;;
+    "libxslt/xsltconfig.h") CONFIG_FILES="$CONFIG_FILES libxslt/xsltconfig.h" ;;
+    "libxslt/xsltwin32config.h") CONFIG_FILES="$CONFIG_FILES libxslt/xsltwin32config.h" ;;
+    "libexslt/Makefile") CONFIG_FILES="$CONFIG_FILES libexslt/Makefile" ;;
+    "libexslt/exsltconfig.h") CONFIG_FILES="$CONFIG_FILES libexslt/exsltconfig.h" ;;
+    "xsltproc/Makefile") CONFIG_FILES="$CONFIG_FILES xsltproc/Makefile" ;;
+    "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;;
+    "python/tests/Makefile") CONFIG_FILES="$CONFIG_FILES python/tests/Makefile" ;;
+    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+    "tests/docs/Makefile") CONFIG_FILES="$CONFIG_FILES tests/docs/Makefile" ;;
+    "tests/REC1/Makefile") CONFIG_FILES="$CONFIG_FILES tests/REC1/Makefile" ;;
+    "tests/REC2/Makefile") CONFIG_FILES="$CONFIG_FILES tests/REC2/Makefile" ;;
+    "tests/REC/Makefile") CONFIG_FILES="$CONFIG_FILES tests/REC/Makefile" ;;
+    "tests/general/Makefile") CONFIG_FILES="$CONFIG_FILES tests/general/Makefile" ;;
+    "tests/reports/Makefile") CONFIG_FILES="$CONFIG_FILES tests/reports/Makefile" ;;
+    "tests/extensions/Makefile") CONFIG_FILES="$CONFIG_FILES tests/extensions/Makefile" ;;
+    "tests/namespaces/Makefile") CONFIG_FILES="$CONFIG_FILES tests/namespaces/Makefile" ;;
+    "tests/keys/Makefile") CONFIG_FILES="$CONFIG_FILES tests/keys/Makefile" ;;
+    "tests/numbers/Makefile") CONFIG_FILES="$CONFIG_FILES tests/numbers/Makefile" ;;
+    "tests/documents/Makefile") CONFIG_FILES="$CONFIG_FILES tests/documents/Makefile" ;;
+    "tests/xmlspec/Makefile") CONFIG_FILES="$CONFIG_FILES tests/xmlspec/Makefile" ;;
+    "tests/multiple/Makefile") CONFIG_FILES="$CONFIG_FILES tests/multiple/Makefile" ;;
+    "tests/xinclude/Makefile") CONFIG_FILES="$CONFIG_FILES tests/xinclude/Makefile" ;;
+    "tests/XSLTMark/Makefile") CONFIG_FILES="$CONFIG_FILES tests/XSLTMark/Makefile" ;;
+    "tests/docbook/Makefile") CONFIG_FILES="$CONFIG_FILES tests/docbook/Makefile" ;;
+    "tests/exslt/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/Makefile" ;;
+    "tests/exslt/common/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/common/Makefile" ;;
+    "tests/exslt/functions/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/functions/Makefile" ;;
+    "tests/exslt/math/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/math/Makefile" ;;
+    "tests/exslt/sets/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/sets/Makefile" ;;
+    "tests/exslt/strings/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/strings/Makefile" ;;
+    "tests/exslt/date/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/date/Makefile" ;;
+    "tests/exslt/dynamic/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exslt/dynamic/Makefile" ;;
+    "tests/plugins/Makefile") CONFIG_FILES="$CONFIG_FILES tests/plugins/Makefile" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+    "xslt-config") CONFIG_FILES="$CONFIG_FILES xslt-config" ;;
+    "libxslt.spec") CONFIG_FILES="$CONFIG_FILES libxslt.spec" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+LIBXSLT_MAJOR_VERSION!$LIBXSLT_MAJOR_VERSION$ac_delim
+LIBXSLT_MINOR_VERSION!$LIBXSLT_MINOR_VERSION$ac_delim
+LIBXSLT_MICRO_VERSION!$LIBXSLT_MICRO_VERSION$ac_delim
+LIBXSLT_VERSION!$LIBXSLT_VERSION$ac_delim
+LIBXSLT_VERSION_INFO!$LIBXSLT_VERSION_INFO$ac_delim
+LIBXSLT_VERSION_NUMBER!$LIBXSLT_VERSION_NUMBER$ac_delim
+LIBXSLT_VERSION_EXTRA!$LIBXSLT_VERSION_EXTRA$ac_delim
+LIBXSLT_MAJOR_MINOR_VERSION!$LIBXSLT_MAJOR_MINOR_VERSION$ac_delim
+LIBEXSLT_MAJOR_VERSION!$LIBEXSLT_MAJOR_VERSION$ac_delim
+LIBEXSLT_MINOR_VERSION!$LIBEXSLT_MINOR_VERSION$ac_delim
+LIBEXSLT_MICRO_VERSION!$LIBEXSLT_MICRO_VERSION$ac_delim
+LIBEXSLT_VERSION!$LIBEXSLT_VERSION$ac_delim
+LIBEXSLT_VERSION_INFO!$LIBEXSLT_VERSION_INFO$ac_delim
+LIBEXSLT_VERSION_NUMBER!$LIBEXSLT_VERSION_NUMBER$ac_delim
+LIBEXSLT_VERSION_EXTRA!$LIBEXSLT_VERSION_EXTRA$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+HTML_DIR!$HTML_DIR$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CPP!$CPP$ac_delim
+RM!$RM$ac_delim
+MV!$MV$ac_delim
+TAR!$TAR$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+SED!$SED$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+WITH_TRIO!$WITH_TRIO$ac_delim
+PERL!$PERL$ac_delim
+WITH_PERL_TRUE!$WITH_PERL_TRUE$ac_delim
+WITH_PERL_FALSE!$WITH_PERL_FALSE$ac_delim
+PYTHON!$PYTHON$ac_delim
+WITH_PYTHON_TRUE!$WITH_PYTHON_TRUE$ac_delim
+WITH_PYTHON_FALSE!$WITH_PYTHON_FALSE$ac_delim
+pythondir!$pythondir$ac_delim
+PYTHON_SUBDIR!$PYTHON_SUBDIR$ac_delim
+LIBGCRYPT_CONFIG!$LIBGCRYPT_CONFIG$ac_delim
+WITH_CRYPTO!$WITH_CRYPTO$ac_delim
+LIBGCRYPT_CFLAGS!$LIBGCRYPT_CFLAGS$ac_delim
+LIBGCRYPT_LIBS!$LIBGCRYPT_LIBS$ac_delim
+STATIC_BINARIES!$STATIC_BINARIES$ac_delim
+WITH_XSLT_DEBUG!$WITH_XSLT_DEBUG$ac_delim
+WITH_MEM_DEBUG!$WITH_MEM_DEBUG$ac_delim
+WITH_DEBUGGER!$WITH_DEBUGGER$ac_delim
+LIBXML_SRC!$LIBXML_SRC$ac_delim
+LIBXML_REQUIRED_VERSION!$LIBXML_REQUIRED_VERSION$ac_delim
+WITH_MODULES!$WITH_MODULES$ac_delim
+WITH_MODULES_TRUE!$WITH_MODULES_TRUE$ac_delim
+WITH_MODULES_FALSE!$WITH_MODULES_FALSE$ac_delim
+LIBXSLT_DEFAULT_PLUGINS_PATH!$LIBXSLT_DEFAULT_PLUGINS_PATH$ac_delim
+WIN32_EXTRA_LIBADD!$WIN32_EXTRA_LIBADD$ac_delim
+WIN32_EXTRA_LDFLAGS!$WIN32_EXTRA_LDFLAGS$ac_delim
+XSLTPROCDV!$XSLTPROCDV$ac_delim
+PYTHONSODV!$PYTHONSODV$ac_delim
+XML_CONFIG!$XML_CONFIG$ac_delim
+LIBXML_LIBS!$LIBXML_LIBS$ac_delim
+LIBXML_CFLAGS!$LIBXML_CFLAGS$ac_delim
+PYTHON_VERSION!$PYTHON_VERSION$ac_delim
+PYTHON_INCLUDES!$PYTHON_INCLUDES$ac_delim
+PYTHON_SITE_PACKAGES!$PYTHON_SITE_PACKAGES$ac_delim
+XSLT_LIBDIR!$XSLT_LIBDIR$ac_delim
+XSLT_INCLUDEDIR!$XSLT_INCLUDEDIR$ac_delim
+XSLT_LIBS!$XSLT_LIBS$ac_delim
+EXSLT_LIBDIR!$EXSLT_LIBDIR$ac_delim
+EXSLT_INCLUDEDIR!$EXSLT_INCLUDEDIR$ac_delim
+EXSLT_LIBS!$EXSLT_LIBS$ac_delim
+EXTRA_LIBS!$EXTRA_LIBS$ac_delim
+M_LIBS!$M_LIBS$ac_delim
+RELDATE!$RELDATE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
+ac_dB='\\)[	 (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+	t rset
+	:rset
+	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
+	t ok
+	d
+	:ok
+	s/[\\&,]/\\&/g
+	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[	 #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X$ac_file : 'X\(//\)[^/]' \| \
+	 X$ac_file : 'X\(//\)$' \| \
+	 X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/third_party/libxslt/configure.in b/third_party/libxslt/configure.in
new file mode 100644
index 0000000..a7edf2b
--- /dev/null
+++ b/third_party/libxslt/configure.in
@@ -0,0 +1,605 @@
+dnl Process this file with autoconf to produce a configuration script.
+AC_PREREQ(2.2)
+AC_INIT(libxslt/xslt.c)
+AM_CONFIG_HEADER(config.h)
+AC_CANONICAL_HOST
+
+dnl
+dnl libxslt is the main part of the package
+dnl libexslt is an extension
+dnl
+LIBXSLT_MAJOR_VERSION=1
+LIBXSLT_MINOR_VERSION=1
+LIBXSLT_MICRO_VERSION=24
+PACKAGE=libxslt
+LIBEXSLT_MAJOR_VERSION=0
+LIBEXSLT_MINOR_VERSION=8
+LIBEXSLT_MICRO_VERSION=13
+LIBXML_REQUIRED_VERSION=2.6.27
+
+
+LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
+LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
+
+LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
+LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
+
+if test -f CVS/Entries; then
+  extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-CVS$extra"
+  fi
+else if test -d .svn ; then
+  extra=`svn info | grep Revision | sed 's+Revision: ++'`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-SVN$extra"
+  fi
+fi
+fi
+
+AC_SUBST(LIBXSLT_MAJOR_VERSION)
+AC_SUBST(LIBXSLT_MINOR_VERSION)
+AC_SUBST(LIBXSLT_MICRO_VERSION)
+AC_SUBST(LIBXSLT_VERSION)
+AC_SUBST(LIBXSLT_VERSION_INFO)
+AC_SUBST(LIBXSLT_VERSION_NUMBER)
+AC_SUBST(LIBXSLT_VERSION_EXTRA)
+AC_SUBST(LIBXSLT_MAJOR_MINOR_VERSION)
+
+dnl
+dnl libexslt is an extension library
+dnl
+
+LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
+LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
+
+LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
+
+if test -f CVS/Entries; then
+  LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+fi
+
+AC_SUBST(LIBEXSLT_MAJOR_VERSION)
+AC_SUBST(LIBEXSLT_MINOR_VERSION)
+AC_SUBST(LIBEXSLT_MICRO_VERSION)
+AC_SUBST(LIBEXSLT_VERSION)
+AC_SUBST(LIBEXSLT_VERSION_INFO)
+AC_SUBST(LIBEXSLT_VERSION_NUMBER)
+AC_SUBST(LIBEXSLT_VERSION_EXTRA)
+
+VERSION=${LIBXSLT_VERSION}
+
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+
+# AM_MAINTAINER_MODE
+
+AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+
+dnl
+dnl Specific dir for HTML output ?
+dnl
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='$(prefix)/doc'
+else
+  HTML_DIR=$with_html_dir
+fi
+AC_SUBST(HTML_DIR)
+
+dnl
+dnl Check the environment
+dnl
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_CPP
+AC_PATH_PROG(RM, rm, /bin/rm)
+AC_PATH_PROG(MV, mv, /bin/mv)
+AC_PATH_PROG(TAR, tar, /bin/tar)
+
+AC_STDC_HEADERS
+AM_PROG_LIBTOOL
+
+dnl
+dnl Math detection
+dnl
+
+AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
+AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
+AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
+AC_CHECK_FUNCS(stat _stat)
+AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
+  [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))
+
+AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
+  [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
+
+AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
+  [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
+
+AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
+  [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
+
+AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
+  [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
+AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r ftime)
+
+dnl Checking the standard string functions availability
+AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
+               NEED_TRIO=1)
+
+dnl
+dnl Check for trio string functions
+dnl
+
+if test "${NEED_TRIO}" = "1" ; then
+    echo Reusing trio library for string functions
+    WITH_TRIO=1
+else    
+    WITH_TRIO=0
+fi
+AC_SUBST(WITH_TRIO)
+
+dnl
+dnl Some packages need to be checked against version numbers so we
+dnl define a function here for later use
+dnl
+AC_DEFUN([VERSION_TO_NUMBER],
+[`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
+
+dnl
+dnl Perl is just needed for generating some data for XSLtmark
+dnl
+
+AC_CHECK_PROG(PERL, perl, perl, false)
+AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
+
+dnl
+dnl check for python
+dnl
+
+PYTHON_VERSION=
+PYTHON_INCLUDES=
+PYTHON_SITE_PACKAGES=
+pythondir=
+AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
+if test "$with_python" != "no" ; then
+    if test -x "$with_python/bin/python"
+    then
+        echo Found python in $with_python/bin/python
+        PYTHON="$with_python/bin/python"
+    else
+	if test -x "$with_python"
+	then
+	    echo Found python in $with_python
+	    PYTHON="$with_python"
+	else
+            if test -x "$PYTHON"
+            then
+                echo Found python in environment PYTHON=$PYTHON
+                with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+	    else
+	        AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+	    fi
+	fi
+    fi
+    if test "$PYTHON" != ""
+    then
+        echo "PYTHON is pointing at $PYTHON"
+        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+	echo Found Python version $PYTHON_VERSION
+	LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
+except: print 0"`
+	if test "$LIBXML2_PYTHON" = "1"
+	then
+	    echo Found libxml2-python module
+	else
+	    echo Warning: Missing libxml2-python
+	fi
+    fi
+    if test "$PYTHON_VERSION" != ""
+    then
+	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
+	then
+	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
+	    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	else
+	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+	    then
+	        PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
+		PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	    else
+		if test -r /usr/include/python$PYTHON_VERSION/Python.h
+		then
+		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
+		    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+		else
+		    echo could not find python$PYTHON_VERSION/Python.h
+		fi
+	    fi
+	    if test ! -d "$PYTHON_SITE_PACKAGES"
+	    then
+		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
+	    fi
+	fi
+    fi
+    if test "$with_python" != ""
+    then
+        pythondir='$(PYTHON_SITE_PACKAGES)'
+    else
+        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+    fi
+fi
+AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
+if test "$PYTHON_INCLUDES" != ""
+then
+    PYTHON_SUBDIR=python
+else
+    PYTHON_SUBDIR=
+fi
+AC_SUBST(pythondir)
+AC_SUBST(PYTHON_SUBDIR)
+
+AC_ARG_WITH(crypto, [  --with-crypto           Add crypto support to exslt (on)])
+WITH_CRYPTO=0
+if test "$with_crypto" = "no" ; then
+    echo Disabling crypto support
+    LIBGCRYPT_CFLAGS=""
+    LIBGCRYPT_LIBS=""
+else
+    AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+    if test "$LIBGCRYPT_CONFIG" != "no" ; then
+      LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
+      if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
+      then
+        LIBGCRYPT_CFLAGS=""
+        LIBGCRYPT_LIBS=""
+        echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
+      else
+        LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
+        LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
+        AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
+        echo 'Crypto extensions will be available.'
+		WITH_CRYPTO=1
+      fi
+    else
+      LIBGCRYPT_CFLAGS=""
+      LIBGCRYPT_LIBS=""
+      echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
+    fi
+fi
+AC_SUBST(WITH_CRYPTO)
+AC_SUBST(LIBGCRYPT_CFLAGS)
+AC_SUBST(LIBGCRYPT_LIBS)
+
+dnl
+dnl Debug for DV (-Wunreachable-code)
+dnl
+if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
+   [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
+   then
+    if test "${with_mem_debug}" = "" ;
+    then
+	with_mem_debug="yes"
+    fi
+    CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
+    if test "`uname -m`" != "x86_64" ;
+    then
+	STATIC_BINARIES="-static"
+    else
+        STATIC_BINARIES=
+    fi
+    if test "$LOGNAME" = "veillard"
+    then
+        LIBXML_SRC="/u/veillard/XML"
+	EXTRA_LIBS="$EXTRA_LIBS -ldl"
+    fi
+else
+    STATIC_BINARIES=
+fi
+AC_SUBST(STATIC_BINARIES)
+
+AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
+if test "$with_debug" = "no" ; then
+    echo Disabling debug support
+    WITH_XSLT_DEBUG=0
+else    
+    WITH_XSLT_DEBUG=1
+fi
+AC_SUBST(WITH_XSLT_DEBUG)
+
+AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
+if test "$with_mem_debug" = "yes" ; then
+    echo Enabling memory debug support
+    WITH_MEM_DEBUG=1
+else    
+    WITH_MEM_DEBUG=0
+fi
+AC_SUBST(WITH_MEM_DEBUG)
+
+dnl 
+dnl Is debugger support requested
+dnl
+AC_ARG_WITH(with_debugger, [  --with-debugger        Add the debugging support (on)])
+if test "$with_debugger" = "no" ; then
+    echo Disabling debugger
+    WITH_DEBUGGER=0
+else
+    echo Enabling debugger
+    WITH_DEBUGGER=1
+    AC_DEFINE(WITH_DEBUGGER)
+fi
+AC_SUBST(WITH_DEBUGGER)
+
+dnl
+dnl The following new parameters were added to offer
+dnl the ability to specify the location of the libxml
+dnl library during linking and compilation.
+dnl
+dnl original work - Mathieu Lacage 30/03/2000
+dnl some tweaking - David Härdeman 30/10/2001
+dnl
+
+LIBXML_CONFIG_PREFIX=""
+LIBXML_SRC=""
+
+AC_ARG_WITH(libxml-prefix,
+        [  --with-libxml-prefix=[PFX]		Specify location of libxml config],
+	LIBXML_CONFIG_PREFIX=$withval
+)
+        
+AC_ARG_WITH(libxml-include-prefix,
+        [  --with-libxml-include-prefix=[PFX]	Specify location of libxml headers],
+        LIBXML_CFLAGS="-I$withval"
+)
+
+AC_ARG_WITH(libxml-libs-prefix,
+        [  --with-libxml-libs-prefix=[PFX]	Specify location of libxml libs],
+        LIBXML_LIBS="-L$withval"
+)
+
+AC_ARG_WITH(libxml-src,
+	[  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
+	LIBXML_SRC="$withval"
+)
+AC_SUBST(LIBXML_SRC)
+
+dnl
+dnl where is xml2-config
+dnl
+
+AC_SUBST(LIBXML_REQUIRED_VERSION)
+AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
+if test "x$LIBXML_CONFIG_PREFIX" != "x"
+then
+	XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
+else
+	XML_CONFIG=xml2-config
+fi
+
+dnl
+dnl imported from libxml2, c.f. #77827 
+dnl
+if test "${GCC}" != "yes" ; then
+    case "${host}" in
+          *-*-hpux* )
+	       CFLAGS="${CFLAGS} -Wp,-H30000"
+	       ;;
+          *-dec-osf* )
+               CFLAGS="${CFLAGS} -ieee"
+               ;;
+    esac
+else
+    CFLAGS="${CFLAGS} -Wall"
+    case "${host}" in
+          alpha*-*-linux* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+	  alpha*-*-osf* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+    esac
+fi
+
+dnl
+dnl Override other variables if LIBXML_SRC is set
+dnl
+
+if test "x$LIBXML_SRC" != "x"
+then
+	CWD=`pwd`
+	if cd $LIBXML_SRC
+	then
+		SRC_DIR=`pwd`
+		XML_CONFIG=${SRC_DIR}/xml2-config
+		LIBXML_CFLAGS="-I${SRC_DIR}/include"
+		LIBXML_LIBS="-L${SRC_DIR}"
+		cd $CWD
+	else
+		AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
+	fi
+fi
+
+dnl
+dnl make sure xml2-config is executable,
+dnl test version and init our variables
+dnl
+
+if ${XML_CONFIG} --libs print > /dev/null 2>&1
+then
+	XMLVERS=`$XML_CONFIG --version`
+	if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
+	then
+		LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
+		LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
+		AC_MSG_RESULT($XMLVERS found)
+	else
+		AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
+	fi
+else
+	AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
+fi
+
+
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+
+AC_ARG_WITH(plugins,
+[  --with-plugins          Add plugin extension support (on)])
+if test "$with_plugins" = ""
+then
+    with_plugins=yes
+fi
+
+AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
+if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
+	 AC_MSG_RESULT(no)
+	 AC_MSG_WARN([Disabling plugin support.])
+	 AC_MSG_WARN([Plugins require that shared libraries be built.])
+	 with_plugins=no
+else
+	 AC_MSG_RESULT(yes)
+fi
+
+if test "$with_plugins" = "yes" ; then
+  AC_MSG_CHECKING([libxml2 module support])
+  WITH_MODULES="`$XML_CONFIG --modules`"
+  if test "${WITH_MODULES}" = "1"; then
+    AC_MSG_RESULT(yes)
+  else
+    AC_MSG_RESULT(no)
+    WITH_MODULES="0"
+  fi
+else
+  WITH_MODULES="0"
+fi
+
+AC_SUBST(WITH_MODULES)
+AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
+
+dnl
+dnl setup default module path
+dnl
+module_prefix=$prefix
+test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
+LIBXSLT_DEFAULT_PLUGINS_PATH="$module_prefix/lib/libxslt-plugins"
+AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
+
+dnl
+dnl In build tree I use a static version with memory debug enabled
+dnl
+if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
+    if test "`uname -i`" != "x86_64" -a -e $HOME/XML/.libs/libxml2.a ;
+    then
+	LIBXML_LIBS="$HOME/XML/.libs/libxml2.a -lpthread -lz"
+    fi
+    DV_LINK="1"
+    XSLTPROCDV="xsltproc.dv"
+    INSTALLED_XSLT_LIB=""
+    LIBXML_SRC="$HOME/XML/"
+fi
+
+WIN32_EXTRA_LIBADD=
+WIN32_EXTRA_LDFLAGS=
+case "$host" in
+ *-*-mingw*)
+ WIN32_EXTRA_LIBADD="-lwsock32"
+ WIN32_EXTRA_LDFLAGS="-no-undefined"
+ AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
+ AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
+ AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
+ ;;
+esac
+AC_SUBST(WIN32_EXTRA_LIBADD)
+AC_SUBST(WIN32_EXTRA_LDFLAGS)
+
+
+AC_SUBST(XSLTPROCDV)
+AC_SUBST(PYTHONSODV)
+AC_SUBST(XML_CONFIG)
+AC_SUBST(LIBXML_LIBS)
+AC_SUBST(LIBXML_CFLAGS)
+AC_SUBST(PYTHON)
+AC_SUBST(PYTHON_VERSION)
+AC_SUBST(PYTHON_INCLUDES)
+AC_SUBST(PYTHON_SITE_PACKAGES)
+
+XSLT_LIBDIR='-L${libdir}'
+XSLT_INCLUDEDIR='-I${includedir}'
+XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
+AC_SUBST(XSLT_LIBDIR)
+AC_SUBST(XSLT_INCLUDEDIR)
+AC_SUBST(XSLT_LIBS)
+
+EXSLT_LIBDIR='-L${libdir}'
+EXSLT_INCLUDEDIR='-I${includedir}'
+EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
+AC_SUBST(EXSLT_LIBDIR)
+AC_SUBST(EXSLT_INCLUDEDIR)
+AC_SUBST(EXSLT_LIBS)
+
+EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
+AC_SUBST(EXTRA_LIBS)
+
+AC_SUBST(M_LIBS)
+
+dnl for the spec file
+RELDATE=`date +'%a %b %e %Y'`
+AC_SUBST(RELDATE)
+
+( cd $srcdir
+rm -f COPYING.LIB COPYING
+$LN_S Copyright COPYING
+)
+
+
+AC_OUTPUT([
+Makefile
+libxslt.pc
+libexslt.pc
+libxslt/Makefile
+libxslt/xsltconfig.h
+libxslt/xsltwin32config.h
+libexslt/Makefile
+libexslt/exsltconfig.h
+xsltproc/Makefile
+python/Makefile
+python/tests/Makefile
+tests/Makefile
+tests/docs/Makefile
+tests/REC1/Makefile
+tests/REC2/Makefile
+tests/REC/Makefile
+tests/general/Makefile
+tests/reports/Makefile
+tests/extensions/Makefile
+tests/namespaces/Makefile
+tests/keys/Makefile
+tests/numbers/Makefile
+tests/documents/Makefile
+tests/xmlspec/Makefile
+tests/multiple/Makefile
+tests/xinclude/Makefile
+tests/XSLTMark/Makefile
+tests/docbook/Makefile
+tests/exslt/Makefile
+tests/exslt/common/Makefile
+tests/exslt/functions/Makefile
+tests/exslt/math/Makefile
+tests/exslt/sets/Makefile
+tests/exslt/strings/Makefile
+tests/exslt/date/Makefile
+tests/exslt/dynamic/Makefile
+tests/plugins/Makefile
+doc/Makefile
+xslt-config
+libxslt.spec
+])
diff --git a/third_party/libxslt/depcomp b/third_party/libxslt/depcomp
new file mode 100644
index 0000000..ca5ea4e
--- /dev/null
+++ b/third_party/libxslt/depcomp
@@ -0,0 +1,584 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2006-10-15.18
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva .
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to .
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/third_party/libxslt/install-sh b/third_party/libxslt/install-sh
new file mode 100644
index 0000000..4fbbae7
--- /dev/null
+++ b/third_party/libxslt/install-sh
@@ -0,0 +1,507 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-10-14.15
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+        shift
+        shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dstarg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dstarg"
+      shift # fnord
+    fi
+    shift # arg
+    dstarg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
+      esac
+
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob && set -f
+      set fnord $dstdir
+      shift
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+	       || {
+		 echo "$0: cannot unlink or rename $dst" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dst"
+	 }
+    } || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/third_party/libxslt/libexslt.pc.in b/third_party/libxslt/libexslt.pc.in
new file mode 100644
index 0000000..16676ff
--- /dev/null
+++ b/third_party/libxslt/libexslt.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+
+Name: libexslt
+Version: @LIBEXSLT_VERSION@
+Description: EXSLT Extension library
+Requires: libxml-2.0
+Libs: @EXSLT_LIBDIR@ @EXSLT_LIBS@
+Cflags: @EXSLT_INCLUDEDIR@
diff --git a/third_party/libxslt/libexslt/common.c b/third_party/libxslt/libexslt/common.c
new file mode 100644
index 0000000..77f352e
--- /dev/null
+++ b/third_party/libxslt/libexslt/common.c
@@ -0,0 +1,137 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+static void
+exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    if (xmlXPathStackIsNodeSet (ctxt)) {
+	xsltFunctionNodeSet (ctxt, nargs);
+	return;
+    } else {
+	xmlDocPtr fragment;
+	xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
+	xmlNodePtr txt;
+	xmlChar *strval;
+	xmlXPathObjectPtr obj;
+	/*
+	* SPEC EXSLT:
+	* "You can also use this function to turn a string into a text
+	* node, which is helpful if you want to pass a string to a
+	* function that only accepts a node-set."
+	*/
+	fragment = xsltCreateRVT(tctxt);
+	if (fragment == NULL) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"exsltNodeSetFunction: Failed to create a tree fragment.\n");
+	    tctxt->state = XSLT_STATE_STOPPED; 
+	    return;
+	}
+	xsltRegisterLocalRVT(tctxt, fragment);
+
+	strval = xmlXPathPopString (ctxt);
+	
+	txt = xmlNewDocText (fragment, strval);
+	xmlAddChild((xmlNodePtr) fragment, txt);
+	obj = xmlXPathNewNodeSet(txt);	
+	if (obj == NULL) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"exsltNodeSetFunction: Failed to create a node set object.\n");
+	    tctxt->state = XSLT_STATE_STOPPED;
+	} else {
+	    /*
+	     * Mark it as a function result in order to avoid garbage
+	     * collecting of tree fragments
+	     */
+	    xsltExtensionInstructionResultRegister(tctxt, obj);
+	}
+	if (strval != NULL)
+	    xmlFree (strval);
+	
+	valuePush (ctxt, obj);
+    }
+}
+
+static void
+exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlXPathObjectPtr obj, ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    obj = valuePop(ctxt);
+
+    switch (obj->type) {
+    case XPATH_STRING:
+	ret = xmlXPathNewCString("string");
+	break;
+    case XPATH_NUMBER:
+	ret = xmlXPathNewCString("number");
+	break;
+    case XPATH_BOOLEAN:
+	ret = xmlXPathNewCString("boolean");
+	break;
+    case XPATH_NODESET:
+	ret = xmlXPathNewCString("node-set");
+	break;
+    case XPATH_XSLT_TREE:
+	ret = xmlXPathNewCString("RTF");
+	break;
+    case XPATH_USERS:
+	ret = xmlXPathNewCString("external");
+	break;
+    default:
+	xsltGenericError(xsltGenericErrorContext,
+		"object-type() invalid arg\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	xmlXPathFreeObject(obj);
+	return;
+    }
+    xmlXPathFreeObject(obj);
+    valuePush(ctxt, ret);
+}
+
+
+/**
+ * exsltCommonRegister:
+ *
+ * Registers the EXSLT - Common module
+ */
+
+void
+exsltCommonRegister (void) {
+    xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
+				  EXSLT_COMMON_NAMESPACE,
+				  exsltNodeSetFunction);
+    xsltRegisterExtModuleFunction((const xmlChar *) "object-type",
+				  EXSLT_COMMON_NAMESPACE,
+				  exsltObjectTypeFunction);
+    xsltRegisterExtModuleElement((const xmlChar *) "document",
+				 EXSLT_COMMON_NAMESPACE,
+				 (xsltPreComputeFunction) xsltDocumentComp,
+				 (xsltTransformFunction) xsltDocumentElem);
+}
diff --git a/third_party/libxslt/libexslt/crypto.c b/third_party/libxslt/libexslt/crypto.c
new file mode 100644
index 0000000..cef80e8
--- /dev/null
+++ b/third_party/libxslt/libexslt/crypto.c
@@ -0,0 +1,756 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+#ifdef EXSLT_CRYPTO_ENABLED
+
+#define HASH_DIGEST_LENGTH 32
+#define MD5_DIGEST_LENGTH 16
+#define SHA1_DIGEST_LENGTH 20
+
+/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit 
+   seems to be 128 for the default provider */
+#define RC4_KEY_LENGTH 128
+
+/* The following routines have been declared static - this should be
+   reviewed to consider whether we want to expose them to the API
+   exsltCryptoBin2Hex
+   exsltCryptoHex2Bin
+   exsltCryptoGcryptInit
+   exsltCryptoGcryptHash
+   exsltCryptoGcryptRc4Encrypt
+   exsltCryptoGcryptRC4Decrypt
+*/
+
+/**
+ * exsltCryptoBin2Hex:
+ * @bin: binary blob to convert
+ * @binlen: length of binary blob
+ * @hex: buffer to store hex version of blob
+ * @hexlen: length of buffer to store hex version of blob
+ *
+ * Helper function which encodes a binary blob as hex. 
+ */
+static void
+exsltCryptoBin2Hex (const unsigned char *bin, int binlen,
+		    unsigned char *hex, int hexlen) {
+    static const char bin2hex[] = { '0', '1', '2', '3',
+	'4', '5', '6', '7',
+	'8', '9', 'a', 'b',
+	'c', 'd', 'e', 'f'
+    };
+
+    unsigned char lo, hi;
+    int i, pos;
+    for (i = 0, pos = 0; (i < binlen && pos < hexlen); i++) {
+	lo = bin[i] & 0xf;
+	hi = bin[i] >> 4;
+	hex[pos++] = bin2hex[hi];
+	hex[pos++] = bin2hex[lo];
+    }
+
+    hex[pos] = '\0';
+}
+
+/**
+ * exsltCryptoHex2Bin:
+ * @hex: hex version of blob to convert
+ * @hexlen: length of hex buffer
+ * @bin: destination binary buffer
+ * @binlen: length of binary buffer
+ *
+ * Helper function which decodes a hex blob to binary
+ */
+static int
+exsltCryptoHex2Bin (const unsigned char *hex, int hexlen,
+		    unsigned char *bin, int binlen) {
+    int i = 0, j = 0;
+    unsigned char lo, hi, result, tmp;
+
+    while (i < hexlen && j < binlen) {
+	hi = lo = 0;
+
+	tmp = hex[i++];
+	if (tmp >= '0' && tmp <= '9')
+	    hi = tmp - '0';
+	else if (tmp >= 'a' && tmp <= 'f')
+	    hi = 10 + (tmp - 'a');
+
+	tmp = hex[i++];
+	if (tmp >= '0' && tmp <= '9')
+	    lo = tmp - '0';
+	else if (tmp >= 'a' && tmp <= 'f')
+	    lo = 10 + (tmp - 'a');
+
+	result = hi << 4;
+	result += lo;
+	bin[j++] = result;
+    }
+
+    return j;
+}
+
+#if defined(WIN32)
+
+#define HAVE_CRYPTO
+#define PLATFORM_HASH	exsltCryptoCryptoApiHash
+#define PLATFORM_RC4_ENCRYPT exsltCryptoCryptoApiRc4Encrypt
+#define PLATFORM_RC4_DECRYPT exsltCryptoCryptoApiRc4Decrypt
+#define PLATFORM_MD4 CALG_MD4
+#define PLATFORM_MD5 CALG_MD5
+#define PLATFORM_SHA1 CALG_SHA1
+
+#include 
+#include 
+#pragma comment(lib, "advapi32.lib")
+
+static void
+exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt,
+				 int line) {
+    LPVOID lpMsgBuf;
+    DWORD dw = GetLastError ();
+
+    FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+		   FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw,
+		   MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+		   (LPTSTR) & lpMsgBuf, 0, NULL);
+
+    xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL,
+			"exslt:crypto error (line %d). %s", line,
+			lpMsgBuf);
+    LocalFree (lpMsgBuf);
+}
+
+HCRYPTHASH
+exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt,
+				HCRYPTPROV hCryptProv, ALG_ID algorithm,
+				const char *msg, unsigned int msglen,
+				char *dest, unsigned int destlen)
+{
+    HCRYPTHASH hHash = 0;
+    DWORD dwHashLen = destlen;
+
+    if (!CryptCreateHash (hCryptProv, algorithm, 0, 0, &hHash)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	return 0;
+    }
+
+    if (!CryptHashData (hHash, (const BYTE *) msg, msglen, 0)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+
+    if (!CryptGetHashParam (hHash, HP_HASHVAL, dest, &dwHashLen, 0)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+
+  fail:
+    return hHash;
+}
+
+/**
+ * exsltCryptoCryptoApiHash:
+ * @ctxt: an XPath parser context
+ * @algorithm: hashing algorithm to use
+ * @msg: text to be hashed
+ * @msglen: length of text to be hashed
+ * @dest: buffer to place hash result
+ *
+ * Helper function which hashes a message using MD4, MD5, or SHA1.
+ * Uses Win32 CryptoAPI.
+ */
+static void
+exsltCryptoCryptoApiHash (xmlXPathParserContextPtr ctxt,
+			  ALG_ID algorithm, const char *msg,
+			  unsigned long msglen,
+			  char dest[HASH_DIGEST_LENGTH]) {
+    HCRYPTPROV hCryptProv;
+    HCRYPTHASH hHash;
+
+    if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+			      CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	return;
+    }
+
+    hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv,
+					    algorithm, msg, msglen,
+					    dest, HASH_DIGEST_LENGTH);
+    if (0 != hHash) {
+	CryptDestroyHash (hHash);
+    }
+
+    CryptReleaseContext (hCryptProv, 0);
+}
+
+void
+exsltCryptoCryptoApiRc4Encrypt (xmlXPathParserContextPtr ctxt,
+				const unsigned char *key,
+				const unsigned char *msg, int msglen,
+				unsigned char *dest, int destlen) {
+    HCRYPTPROV hCryptProv;
+    HCRYPTKEY hKey;
+    HCRYPTHASH hHash;
+    DWORD dwDataLen;
+    unsigned char hash[HASH_DIGEST_LENGTH];
+
+    if (msglen > destlen) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto : internal error exsltCryptoCryptoApiRc4Encrypt dest buffer too small.\n");
+	return;
+    }
+
+    if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+			      CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	return;
+    }
+
+    hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv,
+					    CALG_SHA1, key,
+					    RC4_KEY_LENGTH, hash,
+					    HASH_DIGEST_LENGTH);
+
+    if (!CryptDeriveKey
+	(hCryptProv, CALG_RC4, hHash, 0x00800000, &hKey)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+/* Now encrypt data. */
+    dwDataLen = msglen;
+    memcpy (dest, msg, msglen);
+    if (!CryptEncrypt (hKey, 0, TRUE, 0, dest, &dwDataLen, msglen)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+
+  fail:
+    if (0 != hHash) {
+	CryptDestroyHash (hHash);
+    }
+
+    CryptDestroyKey (hKey);
+    CryptReleaseContext (hCryptProv, 0);
+}
+
+void
+exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt,
+				const unsigned char *key,
+				const unsigned char *msg, int msglen,
+				unsigned char *dest, int destlen) {
+    HCRYPTPROV hCryptProv;
+    HCRYPTKEY hKey;
+    HCRYPTHASH hHash;
+    DWORD dwDataLen;
+    unsigned char hash[HASH_DIGEST_LENGTH];
+
+    if (msglen > destlen) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto : internal error exsltCryptoCryptoApiRc4Encrypt dest buffer too small.\n");
+	return;
+    }
+
+    if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+			      CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	return;
+    }
+
+    hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv,
+					    CALG_SHA1, key,
+					    RC4_KEY_LENGTH, hash,
+					    HASH_DIGEST_LENGTH);
+
+    if (!CryptDeriveKey
+	(hCryptProv, CALG_RC4, hHash, 0x00800000, &hKey)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+/* Now encrypt data. */
+    dwDataLen = msglen;
+    memcpy (dest, msg, msglen);
+    if (!CryptDecrypt (hKey, 0, TRUE, 0, dest, &dwDataLen)) {
+	exsltCryptoCryptoApiReportError (ctxt, __LINE__);
+	goto fail;
+    }
+
+  fail:
+    if (0 != hHash) {
+	CryptDestroyHash (hHash);
+    }
+
+    CryptDestroyKey (hKey);
+    CryptReleaseContext (hCryptProv, 0);
+}
+
+#endif /* defined(WIN32) */
+
+#if defined(HAVE_GCRYPT)
+
+#define HAVE_CRYPTO
+#define PLATFORM_HASH	exsltCryptoGcryptHash
+#define PLATFORM_RC4_ENCRYPT exsltCryptoGcryptRc4Encrypt
+#define PLATFORM_RC4_DECRYPT exsltCryptoGcryptRc4Decrypt
+#define PLATFORM_MD4 GCRY_MD_MD4
+#define PLATFORM_MD5 GCRY_MD_MD5
+#define PLATFORM_SHA1 GCRY_MD_SHA1
+
+#ifdef HAVE_SYS_TYPES_H                                                        
+# include                                                         
+#endif                                                                         
+#ifdef HAVE_STDINT_H                                                           
+# include                                                            
+#endif                                                                         
+  
+#ifdef HAVE_SYS_SELECT_H
+#include 		/* needed by gcrypt.h 4 Jul 04 */
+#endif
+#include 
+
+static void
+exsltCryptoGcryptInit (void) {
+    static int gcrypt_init;
+    xmlLockLibrary ();
+
+    if (!gcrypt_init) {
+/* The function `gcry_check_version' must be called before any other
+	 function in the library, because it initializes the thread support
+	 subsystem in Libgcrypt. To achieve this in all generality, it is
+	 necessary to synchronize the call to this function with all other calls
+	 to functions in the library, using the synchronization mechanisms
+	 available in your thread library. (from gcrypt.info)
+*/
+	gcry_check_version (GCRYPT_VERSION);
+	gcrypt_init = 1;
+    }
+
+    xmlUnlockLibrary ();
+}
+
+/**
+ * exsltCryptoGcryptHash:
+ * @ctxt: an XPath parser context
+ * @algorithm: hashing algorithm to use
+ * @msg: text to be hashed
+ * @msglen: length of text to be hashed
+ * @dest: buffer to place hash result
+ *
+ * Helper function which hashes a message using MD4, MD5, or SHA1. 
+ * using gcrypt
+ */
+static void
+exsltCryptoGcryptHash (xmlXPathParserContextPtr ctxt ATTRIBUTE_UNUSED,
+/* changed the enum to int */
+		       int algorithm, const char *msg,
+		       unsigned long msglen,
+		       char dest[HASH_DIGEST_LENGTH]) {
+    exsltCryptoGcryptInit ();
+    gcry_md_hash_buffer (algorithm, dest, msg, msglen);
+}
+
+static void
+exsltCryptoGcryptRc4Encrypt (xmlXPathParserContextPtr ctxt,
+			     const unsigned char *key,
+			     const unsigned char *msg, int msglen,
+			     unsigned char *dest, int destlen) {
+    gcry_cipher_hd_t cipher;
+    gcry_error_t rc = 0;
+
+    exsltCryptoGcryptInit ();
+
+    rc = gcry_cipher_open (&cipher, GCRY_CIPHER_ARCFOUR,
+			   GCRY_CIPHER_MODE_STREAM, 0);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_open)\n",
+			    gcry_strerror (rc));
+    }
+
+    rc = gcry_cipher_setkey (cipher, key, RC4_KEY_LENGTH);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_setkey)\n",
+			    gcry_strerror (rc));
+    }
+
+    rc = gcry_cipher_encrypt (cipher, (unsigned char *) dest, destlen,
+			      (const unsigned char *) msg, msglen);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_encrypt)\n",
+			    gcry_strerror (rc));
+    }
+
+    gcry_cipher_close (cipher);
+}
+
+static void
+exsltCryptoGcryptRc4Decrypt (xmlXPathParserContextPtr ctxt,
+			     const unsigned char *key,
+			     const unsigned char *msg, int msglen,
+			     unsigned char *dest, int destlen) {
+    gcry_cipher_hd_t cipher;
+    gcry_error_t rc = 0;
+
+    exsltCryptoGcryptInit ();
+
+    rc = gcry_cipher_open (&cipher, GCRY_CIPHER_ARCFOUR,
+			   GCRY_CIPHER_MODE_STREAM, 0);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_open)\n",
+			    gcry_strerror (rc));
+    }
+
+    rc = gcry_cipher_setkey (cipher, key, RC4_KEY_LENGTH);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_setkey)\n",
+			    gcry_strerror (rc));
+    }
+
+    rc = gcry_cipher_decrypt (cipher, (unsigned char *) dest, destlen,
+			      (const unsigned char *) msg, msglen);
+    if (rc) {
+	xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL,
+			    NULL,
+			    "exslt:crypto internal error %s (gcry_cipher_decrypt)\n",
+			    gcry_strerror (rc));
+    }
+
+    gcry_cipher_close (cipher);
+}
+
+#endif /* defined(HAVE_GCRYPT) */
+
+#if defined(HAVE_CRYPTO)
+
+/**
+ * exsltCryptoPopString:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Helper function which checks for and returns first string argument and its length
+ */
+static int
+exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs,
+		      xmlChar ** str) {
+
+    int str_len = 0;
+
+    if ((nargs < 1) || (nargs > 2)) {
+	xmlXPathSetArityError (ctxt);
+	return 0;
+    }
+
+    *str = xmlXPathPopString (ctxt);
+    str_len = xmlUTF8Strlen (*str);
+
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (*str);
+	return 0;
+    }
+
+    return str_len;
+}
+
+/**
+ * exsltCryptoMd4Function:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * computes the md4 hash of a string and returns as hex
+ */
+static void
+exsltCryptoMd4Function (xmlXPathParserContextPtr ctxt, int nargs) {
+
+    int str_len = 0;
+    xmlChar *str = NULL, *ret = NULL;
+    unsigned char hash[HASH_DIGEST_LENGTH];
+    unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
+
+    str_len = exsltCryptoPopString (ctxt, nargs, &str);
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (str);
+	return;
+    }
+
+    PLATFORM_HASH (ctxt, PLATFORM_MD4, (const char *) str, str_len,
+		   (char *) hash);
+    exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1);
+
+    ret = xmlStrdup ((xmlChar *) hex);
+    xmlXPathReturnString (ctxt, ret);
+
+    if (str != NULL)
+	xmlFree (str);
+}
+
+/**
+ * exsltCryptoMd5Function:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * computes the md5 hash of a string and returns as hex
+ */
+static void
+exsltCryptoMd5Function (xmlXPathParserContextPtr ctxt, int nargs) {
+
+    int str_len = 0;
+    xmlChar *str = NULL, *ret = NULL;
+    unsigned char hash[HASH_DIGEST_LENGTH];
+    unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
+
+    str_len = exsltCryptoPopString (ctxt, nargs, &str);
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (str);
+	return;
+    }
+
+    PLATFORM_HASH (ctxt, PLATFORM_MD5, (const char *) str, str_len,
+		   (char *) hash);
+    exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1);
+
+    ret = xmlStrdup ((xmlChar *) hex);
+    xmlXPathReturnString (ctxt, ret);
+
+    if (str != NULL)
+	xmlFree (str);
+}
+
+/**
+ * exsltCryptoSha1Function:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * computes the sha1 hash of a string and returns as hex
+ */
+static void
+exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) {
+
+    int str_len = 0;
+    xmlChar *str = NULL, *ret = NULL;
+    unsigned char hash[HASH_DIGEST_LENGTH];
+    unsigned char hex[SHA1_DIGEST_LENGTH * 2 + 1];
+
+    str_len = exsltCryptoPopString (ctxt, nargs, &str);
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (str);
+	return;
+    }
+
+    PLATFORM_HASH (ctxt, PLATFORM_SHA1, (const char *) str, str_len,
+		   (char *) hash);
+    exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1);
+
+    ret = xmlStrdup ((xmlChar *) hex);
+    xmlXPathReturnString (ctxt, ret);
+
+    if (str != NULL)
+	xmlFree (str);
+}
+
+/**
+ * exsltCryptoRc4EncryptFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * computes the sha1 hash of a string and returns as hex
+ */
+static void
+exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+
+    int key_len = 0, key_size = 0;
+    int str_len = 0, bin_len = 0, hex_len = 0;
+    xmlChar *key = NULL, *str = NULL, *padkey = NULL;
+    xmlChar *bin = NULL, *hex = NULL;
+
+    if ((nargs < 1) || (nargs > 3)) {
+	xmlXPathSetArityError (ctxt);
+	return;
+    }
+
+    str = xmlXPathPopString (ctxt);
+    str_len = xmlUTF8Strlen (str);
+
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (str);
+	return;
+    }
+
+    key = xmlXPathPopString (ctxt);
+    key_len = xmlUTF8Strlen (str);
+
+    if (key_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (key);
+	xmlFree (str);
+	return;
+    }
+
+    padkey = xmlMallocAtomic (RC4_KEY_LENGTH);
+    key_size = xmlUTF8Strsize (key, key_len);
+    memcpy (padkey, key, key_size);
+    memset (padkey + key_size, '\0', sizeof (padkey));
+
+/* encrypt it */
+    bin_len = str_len;
+    bin = xmlStrdup (str);
+    if (bin == NULL) {
+	xmlXPathReturnEmptyString (ctxt);
+	goto done;
+    }
+    PLATFORM_RC4_ENCRYPT (ctxt, padkey, str, str_len, bin, bin_len);
+
+/* encode it */
+    hex_len = str_len * 2 + 1;
+    hex = xmlMallocAtomic (hex_len);
+    if (hex == NULL) {
+	xmlXPathReturnEmptyString (ctxt);
+	goto done;
+    }
+
+    exsltCryptoBin2Hex (bin, str_len, hex, hex_len);
+    xmlXPathReturnString (ctxt, hex);
+
+done:
+    if (key != NULL)
+	xmlFree (key);
+    if (str != NULL)
+	xmlFree (str);
+    if (padkey != NULL)
+	xmlFree (padkey);
+    if (bin != NULL)
+	xmlFree (bin);
+}
+
+/**
+ * exsltCryptoRc4DecryptFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * computes the sha1 hash of a string and returns as hex
+ */
+static void
+exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+
+    int key_len = 0, key_size = 0;
+    int str_len = 0, bin_len = 0, ret_len = 0;
+    xmlChar *key = NULL, *str = NULL, *padkey = NULL, *bin =
+	NULL, *ret = NULL;
+
+    if ((nargs < 1) || (nargs > 3)) {
+	xmlXPathSetArityError (ctxt);
+	return;
+    }
+
+    str = xmlXPathPopString (ctxt);
+    str_len = xmlUTF8Strlen (str);
+
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (str);
+	return;
+    }
+
+    key = xmlXPathPopString (ctxt);
+    key_len = xmlUTF8Strlen (str);
+
+    if (key_len == 0) {
+	xmlXPathReturnEmptyString (ctxt);
+	xmlFree (key);
+	xmlFree (str);
+	return;
+    }
+
+    padkey = xmlMallocAtomic (RC4_KEY_LENGTH);
+    key_size = xmlUTF8Strsize (key, key_len);
+    memcpy (padkey, key, key_size);
+    memset (padkey + key_size, '\0', sizeof (padkey));
+
+/* decode hex to binary */
+    bin_len = str_len;
+    bin = xmlMallocAtomic (bin_len);
+    ret_len = exsltCryptoHex2Bin (str, str_len, bin, bin_len);
+
+/* decrypt the binary blob */
+    ret = xmlMallocAtomic (ret_len);
+    PLATFORM_RC4_DECRYPT (ctxt, padkey, bin, ret_len, ret, ret_len);
+
+    xmlXPathReturnString (ctxt, ret);
+
+    if (key != NULL)
+	xmlFree (key);
+    if (str != NULL)
+	xmlFree (str);
+    if (padkey != NULL)
+	xmlFree (padkey);
+    if (bin != NULL)
+	xmlFree (bin);
+}
+
+/**
+ * exsltCryptoRegister:
+ *
+ * Registers the EXSLT - Crypto module
+ */
+
+void
+exsltCryptoRegister (void) {
+    xsltRegisterExtModuleFunction ((const xmlChar *) "md4",
+				   EXSLT_CRYPTO_NAMESPACE,
+				   exsltCryptoMd4Function);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "md5",
+				   EXSLT_CRYPTO_NAMESPACE,
+				   exsltCryptoMd5Function);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "sha1",
+				   EXSLT_CRYPTO_NAMESPACE,
+				   exsltCryptoSha1Function);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "rc4_encrypt",
+				   EXSLT_CRYPTO_NAMESPACE,
+				   exsltCryptoRc4EncryptFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "rc4_decrypt",
+				   EXSLT_CRYPTO_NAMESPACE,
+				   exsltCryptoRc4DecryptFunction);
+}
+
+#else
+void
+exsltCryptoRegister (void) {
+}
+
+#endif /* defined(HAVE_CRYPTO) */
+
+#endif /* EXSLT_CRYPTO_ENABLED */
diff --git a/third_party/libxslt/libexslt/date.c b/third_party/libxslt/libexslt/date.c
new file mode 100644
index 0000000..fef6044
--- /dev/null
+++ b/third_party/libxslt/libexslt/date.c
@@ -0,0 +1,3794 @@
+/*
+ * date.c: Implementation of the EXSLT -- Dates and Times module
+ *
+ * References:
+ *   http://www.exslt.org/date/date.html
+ *
+ * See Copyright for the status of this software.
+ *
+ * Authors:
+ *   Charlie Bozeman 
+ *   Thomas Broyer 
+ *
+ * TODO:
+ * elements:
+ *   date-format
+ * functions:
+ *   format-date
+ *   parse-date
+ *   sum
+ */
+
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#if HAVE_LOCALTIME_R	/* _POSIX_SOURCE required by gnu libc */
+#ifndef _AIX51		/* but on AIX we're not using gnu libc */
+#define _POSIX_SOURCE
+#endif
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+#include 
+
+#ifdef HAVE_MATH_H
+#include 
+#endif
+
+/* needed to get localtime_r on Solaris */
+#ifdef __sun
+#ifndef __EXTENSIONS__
+#define __EXTENSIONS__
+#endif
+#endif
+
+#ifdef HAVE_TIME_H
+#include 
+#endif
+
+/*
+ * types of date and/or time (from schema datatypes)
+ *   somewhat ordered from least specific to most specific (i.e.
+ *   most truncated to least truncated).
+ */
+typedef enum {
+    EXSLT_UNKNOWN  =    0,
+    XS_TIME        =    1,       /* time is left-truncated */
+    XS_GDAY        = (XS_TIME   << 1),
+    XS_GMONTH      = (XS_GDAY   << 1),
+    XS_GMONTHDAY   = (XS_GMONTH | XS_GDAY),
+    XS_GYEAR       = (XS_GMONTH << 1),
+    XS_GYEARMONTH  = (XS_GYEAR  | XS_GMONTH),
+    XS_DATE        = (XS_GYEAR  | XS_GMONTH | XS_GDAY),
+    XS_DATETIME    = (XS_DATE   | XS_TIME),
+    XS_DURATION    = (XS_GYEAR  << 1)
+} exsltDateType;
+
+/* Date value */
+typedef struct _exsltDateValDate exsltDateValDate;
+typedef exsltDateValDate *exsltDateValDatePtr;
+struct _exsltDateValDate {
+    long		year;
+    unsigned int	mon	:4;	/* 1 <=  mon    <= 12   */
+    unsigned int	day	:5;	/* 1 <=  day    <= 31   */
+    unsigned int	hour	:5;	/* 0 <=  hour   <= 23   */
+    unsigned int	min	:6;	/* 0 <=  min    <= 59	*/
+    double		sec;
+    unsigned int	tz_flag	:1;	/* is tzo explicitely set? */
+    signed int		tzo	:12;	/* -1440 <= tzo <= 1440 currently only -840 to +840 are needed */
+};
+
+/* Duration value */
+typedef struct _exsltDateValDuration exsltDateValDuration;
+typedef exsltDateValDuration *exsltDateValDurationPtr;
+struct _exsltDateValDuration {
+    long	        mon;		/* mon stores years also */
+    long        	day;
+    double		sec;            /* sec stores min and hour also */
+};
+
+typedef struct _exsltDateVal exsltDateVal;
+typedef exsltDateVal *exsltDateValPtr;
+struct _exsltDateVal {
+    exsltDateType       type;
+    union {
+        exsltDateValDate        date;
+        exsltDateValDuration    dur;
+    } value;
+};
+
+/****************************************************************
+ *								*
+ *			Compat./Port. macros			*
+ *								*
+ ****************************************************************/
+
+#if defined(HAVE_TIME_H) 					\
+    && (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R))	\
+    && (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R))		\
+    && defined(HAVE_TIME)
+#define WITH_TIME
+#endif
+
+/****************************************************************
+ *								*
+ *		Convenience macros and functions		*
+ *								*
+ ****************************************************************/
+
+#define IS_TZO_CHAR(c)						\
+	((c == 0) || (c == 'Z') || (c == '+') || (c == '-'))
+
+#define VALID_ALWAYS(num)	(num >= 0)
+#define VALID_YEAR(yr)          (yr != 0)
+#define VALID_MONTH(mon)        ((mon >= 1) && (mon <= 12))
+/* VALID_DAY should only be used when month is unknown */
+#define VALID_DAY(day)          ((day >= 1) && (day <= 31))
+#define VALID_HOUR(hr)          ((hr >= 0) && (hr <= 23))
+#define VALID_MIN(min)          ((min >= 0) && (min <= 59))
+#define VALID_SEC(sec)          ((sec >= 0) && (sec < 60))
+#define VALID_TZO(tzo)          ((tzo > -1440) && (tzo < 1440))
+#define IS_LEAP(y)						\
+	(((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
+
+static const unsigned long daysInMonth[12] =
+	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static const unsigned long daysInMonthLeap[12] =
+	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+#define MAX_DAYINMONTH(yr,mon)                                  \
+        (IS_LEAP(yr) ? daysInMonthLeap[mon - 1] : daysInMonth[mon - 1])
+
+#define VALID_MDAY(dt)						\
+	(IS_LEAP(dt->year) ?				        \
+	    (dt->day <= daysInMonthLeap[dt->mon - 1]) :	        \
+	    (dt->day <= daysInMonth[dt->mon - 1]))
+
+#define VALID_DATE(dt)						\
+	(VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt))
+
+/*
+    hour and min structure vals are unsigned, so normal macros give
+    warnings on some compilers.
+*/
+#define VALID_TIME(dt)						\
+	((dt->hour <=23 ) && (dt->min <= 59) &&			\
+	 VALID_SEC(dt->sec) && VALID_TZO(dt->tzo))
+
+#define VALID_DATETIME(dt)					\
+	(VALID_DATE(dt) && VALID_TIME(dt))
+
+#define SECS_PER_MIN            (60)
+#define SECS_PER_HOUR           (60 * SECS_PER_MIN)
+#define SECS_PER_DAY            (24 * SECS_PER_HOUR)
+
+static const unsigned long dayInYearByMonth[12] =
+	{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+static const unsigned long dayInLeapYearByMonth[12] =
+	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
+
+#define DAY_IN_YEAR(day, month, year)				\
+        ((IS_LEAP(year) ?					\
+                dayInLeapYearByMonth[month - 1] :		\
+                dayInYearByMonth[month - 1]) + day)
+
+/**
+ * _exsltDateParseGYear:
+ * @dt:  pointer to a date structure
+ * @str: pointer to the string to analyze
+ *
+ * Parses a xs:gYear without time zone and fills in the appropriate
+ * field of the @dt structure. @str is updated to point just after the
+ * xs:gYear. It is supposed that @dt->year is big enough to contain
+ * the year.
+ *
+ * Returns 0 or the error code
+ */
+static int
+_exsltDateParseGYear (exsltDateValDatePtr dt, const xmlChar **str)
+{
+    const xmlChar *cur = *str, *firstChar;
+    int isneg = 0, digcnt = 0;
+
+    if (((*cur < '0') || (*cur > '9')) &&
+	(*cur != '-') && (*cur != '+'))
+	return -1;
+
+    if (*cur == '-') {
+	isneg = 1;
+	cur++;
+    }
+
+    firstChar = cur;
+
+    while ((*cur >= '0') && (*cur <= '9')) {
+	dt->year = dt->year * 10 + (*cur - '0');
+	cur++;
+	digcnt++;
+    }
+
+    /* year must be at least 4 digits (CCYY); over 4
+     * digits cannot have a leading zero. */
+    if ((digcnt < 4) || ((digcnt > 4) && (*firstChar == '0')))
+	return 1;
+
+    if (isneg)
+	dt->year = - dt->year;
+
+    if (!VALID_YEAR(dt->year))
+	return 2;
+
+    *str = cur;
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed year %04i\n", dt->year);
+#endif
+
+    return 0;
+}
+
+/**
+ * FORMAT_GYEAR:
+ * @yr:  the year to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @yr in xsl:gYear format. Result is appended to @cur and
+ * @cur is updated to point after the xsl:gYear.
+ */
+#define FORMAT_GYEAR(yr, cur)					\
+	if (yr < 0) {					        \
+	    *cur = '-';						\
+	    cur++;						\
+	}							\
+	{							\
+	    long year = (yr < 0) ? - yr : yr;                   \
+	    xmlChar tmp_buf[100], *tmp = tmp_buf;		\
+	    /* result is in reverse-order */			\
+	    while (year > 0) {					\
+		*tmp = '0' + (xmlChar)(year % 10);		\
+		year /= 10;					\
+		tmp++;						\
+	    }							\
+	    /* virtually adds leading zeros */			\
+	    while ((tmp - tmp_buf) < 4)				\
+		*tmp++ = '0';					\
+	    /* restore the correct order */			\
+	    while (tmp > tmp_buf) {				\
+		tmp--;						\
+		*cur = *tmp;					\
+		cur++;						\
+	    }							\
+	}
+
+/**
+ * PARSE_2_DIGITS:
+ * @num:  the integer to fill in
+ * @cur:  an #xmlChar *
+ * @func: validation function for the number
+ * @invalid: an integer
+ *
+ * Parses a 2-digits integer and updates @num with the value. @cur is
+ * updated to point just after the integer.
+ * In case of error, @invalid is set to %TRUE, values of @num and
+ * @cur are undefined.
+ */
+#define PARSE_2_DIGITS(num, cur, func, invalid)			\
+	if ((cur[0] < '0') || (cur[0] > '9') ||			\
+	    (cur[1] < '0') || (cur[1] > '9'))			\
+	    invalid = 1;					\
+	else {							\
+	    int val;						\
+	    val = (cur[0] - '0') * 10 + (cur[1] - '0');		\
+	    if (!func(val))					\
+	        invalid = 2;					\
+	    else						\
+	        num = val;					\
+	}							\
+	cur += 2;
+
+/**
+ * FORMAT_2_DIGITS:
+ * @num:  the integer to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats a 2-digits integer. Result is appended to @cur and
+ * @cur is updated to point after the integer.
+ */
+#define FORMAT_2_DIGITS(num, cur)				\
+	*cur = '0' + ((num / 10) % 10);				\
+	cur++;							\
+	*cur = '0' + (num % 10);				\
+	cur++;
+
+/**
+ * PARSE_FLOAT:
+ * @num:  the double to fill in
+ * @cur:  an #xmlChar *
+ * @invalid: an integer
+ *
+ * Parses a float and updates @num with the value. @cur is
+ * updated to point just after the float. The float must have a
+ * 2-digits integer part and may or may not have a decimal part.
+ * In case of error, @invalid is set to %TRUE, values of @num and
+ * @cur are undefined.
+ */
+#define PARSE_FLOAT(num, cur, invalid)				\
+	PARSE_2_DIGITS(num, cur, VALID_ALWAYS, invalid);	\
+	if (!invalid && (*cur == '.')) {			\
+	    double mult = 1;				        \
+	    cur++;						\
+	    if ((*cur < '0') || (*cur > '9'))			\
+		invalid = 1;					\
+	    while ((*cur >= '0') && (*cur <= '9')) {		\
+		mult /= 10;					\
+		num += (*cur - '0') * mult;			\
+		cur++;						\
+	    }							\
+	}
+
+/**
+ * FORMAT_FLOAT:
+ * @num:  the double to format
+ * @cur: a pointer to an allocated buffer
+ * @pad: a flag for padding to 2 integer digits
+ *
+ * Formats a float. Result is appended to @cur and @cur is updated to
+ * point after the integer. If the @pad flag is non-zero, then the
+ * float representation has a minimum 2-digits integer part. The
+ * fractional part is formatted if @num has a fractional value.
+ */
+#define FORMAT_FLOAT(num, cur, pad)				\
+	{							\
+            xmlChar *sav, *str;                                 \
+            if ((pad) && (num < 10.0))                          \
+                *cur++ = '0';                                   \
+            str = xmlXPathCastNumberToString(num);              \
+            sav = str;                                          \
+            while (*str != 0)                                   \
+                *cur++ = *str++;                                \
+            xmlFree(sav);                                       \
+	}
+
+/**
+ * _exsltDateParseGMonth:
+ * @dt:  pointer to a date structure
+ * @str: pointer to the string to analyze
+ *
+ * Parses a xs:gMonth without time zone and fills in the appropriate
+ * field of the @dt structure. @str is updated to point just after the
+ * xs:gMonth.
+ *
+ * Returns 0 or the error code
+ */
+static int
+_exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str)
+{
+    const xmlChar *cur = *str;
+    int ret = 0;
+
+    PARSE_2_DIGITS(dt->mon, cur, VALID_MONTH, ret);
+    if (ret != 0)
+	return ret;
+
+    *str = cur;
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed month %02i\n", dt->mon);
+#endif
+
+    return 0;
+}
+
+/**
+ * FORMAT_GMONTH:
+ * @mon:  the month to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @mon in xsl:gMonth format. Result is appended to @cur and
+ * @cur is updated to point after the xsl:gMonth.
+ */
+#define FORMAT_GMONTH(mon, cur)					\
+	FORMAT_2_DIGITS(mon, cur)
+
+/**
+ * _exsltDateParseGDay:
+ * @dt:  pointer to a date structure
+ * @str: pointer to the string to analyze
+ *
+ * Parses a xs:gDay without time zone and fills in the appropriate
+ * field of the @dt structure. @str is updated to point just after the
+ * xs:gDay.
+ *
+ * Returns 0 or the error code
+ */
+static int
+_exsltDateParseGDay (exsltDateValDatePtr dt, const xmlChar **str)
+{
+    const xmlChar *cur = *str;
+    int ret = 0;
+
+    PARSE_2_DIGITS(dt->day, cur, VALID_DAY, ret);
+    if (ret != 0)
+	return ret;
+
+    *str = cur;
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed day %02i\n", dt->day);
+#endif
+
+    return 0;
+}
+
+/**
+ * FORMAT_GDAY:
+ * @dt:  the #exsltDateValDate to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @dt in xsl:gDay format. Result is appended to @cur and
+ * @cur is updated to point after the xsl:gDay.
+ */
+#define FORMAT_GDAY(dt, cur)					\
+	FORMAT_2_DIGITS(dt->day, cur)
+
+/**
+ * FORMAT_DATE:
+ * @dt:  the #exsltDateValDate to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @dt in xsl:date format. Result is appended to @cur and
+ * @cur is updated to point after the xsl:date.
+ */
+#define FORMAT_DATE(dt, cur)					\
+	FORMAT_GYEAR(dt->year, cur);				\
+	*cur = '-';						\
+	cur++;							\
+	FORMAT_GMONTH(dt->mon, cur);				\
+	*cur = '-';						\
+	cur++;							\
+	FORMAT_GDAY(dt, cur);
+
+/**
+ * _exsltDateParseTime:
+ * @dt:  pointer to a date structure
+ * @str: pointer to the string to analyze
+ *
+ * Parses a xs:time without time zone and fills in the appropriate
+ * fields of the @dt structure. @str is updated to point just after the
+ * xs:time.
+ * In case of error, values of @dt fields are undefined.
+ *
+ * Returns 0 or the error code
+ */
+static int
+_exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str)
+{
+    const xmlChar *cur = *str;
+    unsigned int hour = 0; /* use temp var in case str is not xs:time */
+    int ret = 0;
+
+    PARSE_2_DIGITS(hour, cur, VALID_HOUR, ret);
+    if (ret != 0)
+	return ret;
+
+    if (*cur != ':')
+	return 1;
+    cur++;
+
+    /* the ':' insures this string is xs:time */
+    dt->hour = hour;
+
+    PARSE_2_DIGITS(dt->min, cur, VALID_MIN, ret);
+    if (ret != 0)
+	return ret;
+
+    if (*cur != ':')
+	return 1;
+    cur++;
+
+    PARSE_FLOAT(dt->sec, cur, ret);
+    if (ret != 0)
+	return ret;
+
+    if (!VALID_TIME(dt))
+	return 2;
+
+    *str = cur;
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed time %02i:%02i:%02.f\n",
+		     dt->hour, dt->min, dt->sec);
+#endif
+
+    return 0;
+}
+
+/**
+ * FORMAT_TIME:
+ * @dt:  the #exsltDateValDate to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @dt in xsl:time format. Result is appended to @cur and
+ * @cur is updated to point after the xsl:time.
+ */
+#define FORMAT_TIME(dt, cur)					\
+	FORMAT_2_DIGITS(dt->hour, cur);				\
+	*cur = ':';						\
+	cur++;							\
+	FORMAT_2_DIGITS(dt->min, cur);				\
+	*cur = ':';						\
+	cur++;							\
+	FORMAT_FLOAT(dt->sec, cur, 1);
+
+/**
+ * _exsltDateParseTimeZone:
+ * @dt:  pointer to a date structure
+ * @str: pointer to the string to analyze
+ *
+ * Parses a time zone without time zone and fills in the appropriate
+ * field of the @dt structure. @str is updated to point just after the
+ * time zone.
+ *
+ * Returns 0 or the error code
+ */
+static int
+_exsltDateParseTimeZone (exsltDateValDatePtr dt, const xmlChar **str)
+{
+    const xmlChar *cur;
+    int ret = 0;
+
+    if (str == NULL)
+	return -1;
+    cur = *str;
+    switch (*cur) {
+    case 0:
+	dt->tz_flag = 0;
+	dt->tzo = 0;
+	break;
+
+    case 'Z':
+	dt->tz_flag = 1;
+	dt->tzo = 0;
+	cur++;
+	break;
+
+    case '+':
+    case '-': {
+	int isneg = 0, tmp = 0;
+	isneg = (*cur == '-');
+
+	cur++;
+
+	PARSE_2_DIGITS(tmp, cur, VALID_HOUR, ret);
+	if (ret != 0)
+	    return ret;
+
+	if (*cur != ':')
+	    return 1;
+	cur++;
+
+	dt->tzo = tmp * 60;
+
+	PARSE_2_DIGITS(tmp, cur, VALID_MIN, ret);
+	if (ret != 0)
+	    return ret;
+
+	dt->tzo += tmp;
+	if (isneg)
+	    dt->tzo = - dt->tzo;
+
+	if (!VALID_TZO(dt->tzo))
+	    return 2;
+
+	break;
+      }
+    default:
+	return 1;
+    }
+
+    *str = cur;
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed time zone offset (%s) %i\n",
+		     dt->tz_flag ? "explicit" : "implicit", dt->tzo);
+#endif
+
+    return 0;
+}
+
+/**
+ * FORMAT_TZ:
+ * @tzo:  the timezone offset to format
+ * @cur: a pointer to an allocated buffer
+ *
+ * Formats @tzo timezone. Result is appended to @cur and
+ * @cur is updated to point after the timezone.
+ */
+#define FORMAT_TZ(tzo, cur)					\
+	if (tzo == 0) {					        \
+	    *cur = 'Z';						\
+	    cur++;						\
+	} else {						\
+	    int aTzo = (tzo < 0) ? - tzo : tzo;                 \
+	    int tzHh = aTzo / 60, tzMm = aTzo % 60;		\
+	    *cur = (tzo < 0) ? '-' : '+' ;			\
+	    cur++;						\
+	    FORMAT_2_DIGITS(tzHh, cur);				\
+	    *cur = ':';						\
+	    cur++;						\
+	    FORMAT_2_DIGITS(tzMm, cur);				\
+	}
+
+/****************************************************************
+ *								*
+ *	XML Schema Dates/Times Datatypes Handling		*
+ *								*
+ ****************************************************************/
+
+/**
+ * exsltDateCreateDate:
+ * @type:       type to create
+ *
+ * Creates a new #exsltDateVal, uninitialized.
+ *
+ * Returns the #exsltDateValPtr
+ */
+static exsltDateValPtr
+exsltDateCreateDate (exsltDateType type)
+{
+    exsltDateValPtr ret;
+
+    ret = (exsltDateValPtr) xmlMalloc(sizeof(exsltDateVal));
+    if (ret == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltDateCreateDate: out of memory\n");
+	return (NULL);
+    }
+    memset (ret, 0, sizeof(exsltDateVal));
+
+    if (type != EXSLT_UNKNOWN)
+        ret->type = type;
+
+    return ret;
+}
+
+/**
+ * exsltDateFreeDate:
+ * @date: an #exsltDateValPtr
+ *
+ * Frees up the @date
+ */
+static void
+exsltDateFreeDate (exsltDateValPtr date) {
+    if (date == NULL)
+	return;
+
+    xmlFree(date);
+}
+
+/**
+ * PARSE_DIGITS:
+ * @num:  the integer to fill in
+ * @cur:  an #xmlChar *
+ * @num_type: an integer flag
+ *
+ * Parses a digits integer and updates @num with the value. @cur is
+ * updated to point just after the integer.
+ * In case of error, @num_type is set to -1, values of @num and
+ * @cur are undefined.
+ */
+#define PARSE_DIGITS(num, cur, num_type)	                \
+	if ((*cur < '0') || (*cur > '9'))			\
+	    num_type = -1;					\
+        else                                                    \
+	    while ((*cur >= '0') && (*cur <= '9')) {		\
+	        num = num * 10 + (*cur - '0');		        \
+	        cur++;                                          \
+            }
+
+/**
+ * PARSE_NUM:
+ * @num:  the double to fill in
+ * @cur:  an #xmlChar *
+ * @num_type: an integer flag
+ *
+ * Parses a float or integer and updates @num with the value. @cur is
+ * updated to point just after the number. If the number is a float,
+ * then it must have an integer part and a decimal part; @num_type will
+ * be set to 1. If there is no decimal part, @num_type is set to zero.
+ * In case of error, @num_type is set to -1, values of @num and
+ * @cur are undefined.
+ */
+#define PARSE_NUM(num, cur, num_type)				\
+        num = 0;                                                \
+	PARSE_DIGITS(num, cur, num_type);	                \
+	if (!num_type && (*cur == '.')) {			\
+	    double mult = 1;				        \
+	    cur++;						\
+	    if ((*cur < '0') || (*cur > '9'))			\
+		num_type = -1;					\
+            else                                                \
+                num_type = 1;                                   \
+	    while ((*cur >= '0') && (*cur <= '9')) {		\
+		mult /= 10;					\
+		num += (*cur - '0') * mult;			\
+		cur++;						\
+	    }							\
+	}
+
+#ifdef WITH_TIME
+/**
+ * exsltDateCurrent:
+ *
+ * Returns the current date and time.
+ */
+static exsltDateValPtr
+exsltDateCurrent (void)
+{
+    struct tm localTm, gmTm;
+    time_t secs, gsecs;
+    int local_s, gm_s;
+    exsltDateValPtr ret;
+
+    ret = exsltDateCreateDate(XS_DATETIME);
+    if (ret == NULL)
+        return NULL;
+
+    /* get current time */
+    secs    = time(NULL);
+#if HAVE_LOCALTIME_R
+    localtime_r(&secs, &localTm);
+#else
+    localTm = *localtime(&secs);
+#endif
+
+    /* get real year, not years since 1900 */
+    ret->value.date.year = localTm.tm_year + 1900;
+
+    ret->value.date.mon  = localTm.tm_mon + 1;
+    ret->value.date.day  = localTm.tm_mday;
+    ret->value.date.hour = localTm.tm_hour;
+    ret->value.date.min  = localTm.tm_min;
+
+    /* floating point seconds */
+    ret->value.date.sec  = (double) localTm.tm_sec;
+
+    /* determine the time zone offset from local to gm time */
+#if HAVE_GMTIME_R
+    gmtime_r(&secs, &gmTm);
+#else
+    gmTm = *gmtime(&secs);
+#endif
+    ret->value.date.tz_flag = 0;
+#if 0
+    ret->value.date.tzo = (((ret->value.date.day * 1440) +
+                            (ret->value.date.hour * 60) +
+                             ret->value.date.min) -
+                           ((gmTm.tm_mday * 1440) + (gmTm.tm_hour * 60) +
+                             gmTm.tm_min));
+#endif
+    local_s = localTm.tm_hour * SECS_PER_HOUR +
+        localTm.tm_min * SECS_PER_MIN +
+        localTm.tm_sec;
+    
+    gm_s = gmTm.tm_hour * SECS_PER_HOUR +
+        gmTm.tm_min * SECS_PER_MIN +
+        gmTm.tm_sec;
+    
+    if (localTm.tm_year < gmTm.tm_year) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm.tm_year > gmTm.tm_year) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else if (localTm.tm_mon < gmTm.tm_mon) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm.tm_mon > gmTm.tm_mon) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else if (localTm.tm_mday < gmTm.tm_mday) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm.tm_mday > gmTm.tm_mday) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else  {
+ 	ret->value.date.tzo = (local_s - gm_s)/60;
+    }
+ 
+    return ret;
+}
+#endif
+
+/**
+ * exsltDateParse:
+ * @dateTime:  string to analyze
+ *
+ * Parses a date/time string
+ *
+ * Returns a newly built #exsltDateValPtr of NULL in case of error
+ */
+static exsltDateValPtr
+exsltDateParse (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    int ret;
+    const xmlChar *cur = dateTime;
+
+#define RETURN_TYPE_IF_VALID(t)					\
+    if (IS_TZO_CHAR(*cur)) {					\
+	ret = _exsltDateParseTimeZone(&(dt->value.date), &cur);	\
+	if (ret == 0) {						\
+	    if (*cur != 0)					\
+		goto error;					\
+	    dt->type = t;					\
+	    return dt;						\
+	}							\
+    }
+
+    if (dateTime == NULL)
+	return NULL;
+
+    if ((*cur != '-') && (*cur < '0') && (*cur > '9'))
+	return NULL;
+
+    dt = exsltDateCreateDate(EXSLT_UNKNOWN);
+    if (dt == NULL)
+	return NULL;
+
+    if ((cur[0] == '-') && (cur[1] == '-')) {
+	/*
+	 * It's an incomplete date (xs:gMonthDay, xs:gMonth or
+	 * xs:gDay)
+	 */
+	cur += 2;
+
+	/* is it an xs:gDay? */
+	if (*cur == '-') {
+	  ++cur;
+	    ret = _exsltDateParseGDay(&(dt->value.date), &cur);
+	    if (ret != 0)
+		goto error;
+
+	    RETURN_TYPE_IF_VALID(XS_GDAY);
+
+	    goto error;
+	}
+
+	/*
+	 * it should be an xs:gMonthDay or xs:gMonth
+	 */
+	ret = _exsltDateParseGMonth(&(dt->value.date), &cur);
+	if (ret != 0)
+	    goto error;
+
+	if (*cur != '-')
+	    goto error;
+	cur++;
+
+	/* is it an xs:gMonth? */
+	if (*cur == '-') {
+	    cur++;
+	    RETURN_TYPE_IF_VALID(XS_GMONTH);
+	    goto error;
+	}
+
+	/* it should be an xs:gMonthDay */
+	ret = _exsltDateParseGDay(&(dt->value.date), &cur);
+	if (ret != 0)
+	    goto error;
+
+	RETURN_TYPE_IF_VALID(XS_GMONTHDAY);
+
+	goto error;
+    }
+
+    /*
+     * It's a right-truncated date or an xs:time.
+     * Try to parse an xs:time then fallback on right-truncated dates.
+     */
+    if ((*cur >= '0') && (*cur <= '9')) {
+	ret = _exsltDateParseTime(&(dt->value.date), &cur);
+	if (ret == 0) {
+	    /* it's an xs:time */
+	    RETURN_TYPE_IF_VALID(XS_TIME);
+	}
+    }
+
+    /* fallback on date parsing */
+    cur = dateTime;
+
+    ret = _exsltDateParseGYear(&(dt->value.date), &cur);
+    if (ret != 0)
+	goto error;
+
+    /* is it an xs:gYear? */
+    RETURN_TYPE_IF_VALID(XS_GYEAR);
+
+    if (*cur != '-')
+	goto error;
+    cur++;
+
+    ret = _exsltDateParseGMonth(&(dt->value.date), &cur);
+    if (ret != 0)
+	goto error;
+
+    /* is it an xs:gYearMonth? */
+    RETURN_TYPE_IF_VALID(XS_GYEARMONTH);
+
+    if (*cur != '-')
+	goto error;
+    cur++;
+
+    ret = _exsltDateParseGDay(&(dt->value.date), &cur);
+    if ((ret != 0) || !VALID_DATE((&(dt->value.date))))
+	goto error;
+
+    /* is it an xs:date? */
+    RETURN_TYPE_IF_VALID(XS_DATE);
+
+    if (*cur != 'T')
+	goto error;
+    cur++;
+
+    /* it should be an xs:dateTime */
+    ret = _exsltDateParseTime(&(dt->value.date), &cur);
+    if (ret != 0)
+	goto error;
+
+    ret = _exsltDateParseTimeZone(&(dt->value.date), &cur);
+    if ((ret != 0) || (*cur != 0) || !VALID_DATETIME((&(dt->value.date))))
+	goto error;
+
+    dt->type = XS_DATETIME;
+
+    return dt;
+
+error:
+    if (dt != NULL)
+	exsltDateFreeDate(dt);
+    return NULL;
+}
+
+/**
+ * exsltDateParseDuration:
+ * @duration:  string to analyze
+ *
+ * Parses a duration string
+ *
+ * Returns a newly built #exsltDateValPtr of NULL in case of error
+ */
+static exsltDateValPtr
+exsltDateParseDuration (const xmlChar *duration)
+{
+    const xmlChar  *cur = duration;
+    exsltDateValPtr dur;
+    int isneg = 0;
+    unsigned int seq = 0;
+
+    if (duration == NULL)
+	return NULL;
+
+    if (*cur == '-') {
+        isneg = 1;
+        cur++;
+    }
+
+    /* duration must start with 'P' (after sign) */
+    if (*cur++ != 'P')
+	return NULL;
+
+    dur = exsltDateCreateDate(XS_DURATION);
+    if (dur == NULL)
+	return NULL;
+
+    while (*cur != 0) {
+        double         num;
+        int            num_type = 0;  /* -1 = invalid, 0 = int, 1 = floating */
+        const xmlChar  desig[] = {'Y', 'M', 'D', 'H', 'M', 'S'};
+        const double   multi[] = { 0.0, 0.0, 86400.0, 3600.0, 60.0, 1.0, 0.0};
+
+        /* input string should be empty or invalid date/time item */
+        if (seq >= sizeof(desig))
+            goto error;
+
+        /* T designator must be present for time items */
+        if (*cur == 'T') {
+            if (seq <= 3) {
+                seq = 3;
+                cur++;
+            } else
+                return NULL;
+        } else if (seq == 3)
+            goto error;
+
+        /* parse the number portion of the item */
+        PARSE_NUM(num, cur, num_type);
+
+        if ((num_type == -1) || (*cur == 0))
+            goto error;
+
+        /* update duration based on item type */
+        while (seq < sizeof(desig)) {
+            if (*cur == desig[seq]) {
+
+                /* verify numeric type; only seconds can be float */
+                if ((num_type != 0) && (seq < (sizeof(desig)-1)))
+                    goto error;
+
+                switch (seq) {
+                    case 0:
+                        dur->value.dur.mon = (long)num * 12;
+                        break;
+                    case 1:
+                        dur->value.dur.mon += (long)num;
+                        break;
+                    default:
+                        /* convert to seconds using multiplier */
+                        dur->value.dur.sec += num * multi[seq];
+                        seq++;
+                        break;
+                }
+
+                break;          /* exit loop */
+            }
+            /* no date designators found? */
+            if (++seq == 3)
+                goto error;
+        }
+        cur++;
+    }
+
+    if (isneg) {
+        dur->value.dur.mon = -dur->value.dur.mon;
+        dur->value.dur.day = -dur->value.dur.day;
+        dur->value.dur.sec = -dur->value.dur.sec;
+    }
+
+#ifdef DEBUG_EXSLT_DATE
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "Parsed duration %f\n", dur->value.dur.sec);
+#endif
+
+    return dur;
+
+error:
+    if (dur != NULL)
+	exsltDateFreeDate(dur);
+    return NULL;
+}
+
+/**
+ * FORMAT_ITEM:
+ * @num:        number to format
+ * @cur:        current location to convert number
+ * @limit:      max value
+ * @item:       char designator
+ *
+ */
+#define FORMAT_ITEM(num, cur, limit, item)                      \
+        if (num != 0) {                                         \
+            long comp = (long)num / limit;                      \
+            if (comp != 0) {                                    \
+                FORMAT_FLOAT((double)comp, cur, 0);             \
+                *cur++ = item;                                  \
+                num -= (double)(comp * limit);                  \
+            }                                                   \
+        }
+
+/**
+ * exsltDateFormatDuration:
+ * @dt: an #exsltDateValDurationPtr
+ *
+ * Formats @dt in xs:duration format.
+ *
+ * Returns a newly allocated string, or NULL in case of error
+ */
+static xmlChar *
+exsltDateFormatDuration (const exsltDateValDurationPtr dt)
+{
+    xmlChar buf[100], *cur = buf;
+    double secs, days;
+    double years, months;
+
+    if (dt == NULL)
+	return NULL;
+
+    /* quick and dirty check */
+    if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0)) 
+        return xmlStrdup((xmlChar*)"P0D");
+        
+    secs   = dt->sec;
+    days   = (double)dt->day;
+    years  = (double)(dt->mon / 12);
+    months = (double)(dt->mon % 12);
+
+    *cur = '\0';
+    if (secs < 0.0) {
+        secs = -secs;
+        *cur = '-';
+    } 
+    if (days < 0) {
+        days = -days;
+        *cur = '-';
+    } 
+    if (years < 0) {
+        years = -years;
+        *cur = '-';
+    } 
+    if (months < 0) {
+        months = -months;
+        *cur = '-';
+    }
+    if (*cur == '-')
+	cur++;
+
+    *cur++ = 'P';
+
+    if (years != 0.0) {
+        FORMAT_ITEM(years, cur, 1, 'Y');
+    }
+
+    if (months != 0.0) {
+        FORMAT_ITEM(months, cur, 1, 'M');
+    }
+
+    if (secs >= SECS_PER_DAY) {
+        double tmp = floor(secs / SECS_PER_DAY);
+        days += tmp;
+        secs -= (tmp * SECS_PER_DAY);
+    }
+
+    FORMAT_ITEM(days, cur, 1, 'D');
+    if (secs > 0.0) {
+        *cur++ = 'T';
+    }
+    FORMAT_ITEM(secs, cur, SECS_PER_HOUR, 'H');
+    FORMAT_ITEM(secs, cur, SECS_PER_MIN, 'M');
+    if (secs > 0.0) {
+        FORMAT_FLOAT(secs, cur, 0);
+        *cur++ = 'S';
+    }
+
+    *cur = 0;
+
+    return xmlStrdup(buf);
+}
+
+/**
+ * exsltDateFormatDateTime:
+ * @dt: an #exsltDateValDatePtr
+ *
+ * Formats @dt in xs:dateTime format.
+ *
+ * Returns a newly allocated string, or NULL in case of error
+ */
+static xmlChar *
+exsltDateFormatDateTime (const exsltDateValDatePtr dt)
+{
+    xmlChar buf[100], *cur = buf;
+
+    if ((dt == NULL) ||	!VALID_DATETIME(dt))
+	return NULL;
+
+    FORMAT_DATE(dt, cur);
+    *cur = 'T';
+    cur++;
+    FORMAT_TIME(dt, cur);
+    FORMAT_TZ(dt->tzo, cur);
+    *cur = 0;
+
+    return xmlStrdup(buf);
+}
+
+/**
+ * exsltDateFormatDate:
+ * @dt: an #exsltDateValDatePtr
+ *
+ * Formats @dt in xs:date format.
+ *
+ * Returns a newly allocated string, or NULL in case of error
+ */
+static xmlChar *
+exsltDateFormatDate (const exsltDateValDatePtr dt)
+{
+    xmlChar buf[100], *cur = buf;
+
+    if ((dt == NULL) || !VALID_DATETIME(dt))
+	return NULL;
+
+    FORMAT_DATE(dt, cur);
+    if (dt->tz_flag || (dt->tzo != 0)) {
+	FORMAT_TZ(dt->tzo, cur);
+    }
+    *cur = 0;
+
+    return xmlStrdup(buf);
+}
+
+/**
+ * exsltDateFormatTime:
+ * @dt: an #exsltDateValDatePtr
+ *
+ * Formats @dt in xs:time format.
+ *
+ * Returns a newly allocated string, or NULL in case of error
+ */
+static xmlChar *
+exsltDateFormatTime (const exsltDateValDatePtr dt)
+{
+    xmlChar buf[100], *cur = buf;
+
+    if ((dt == NULL) || !VALID_TIME(dt))
+	return NULL;
+
+    FORMAT_TIME(dt, cur);
+    if (dt->tz_flag || (dt->tzo != 0)) {
+	FORMAT_TZ(dt->tzo, cur);
+    }
+    *cur = 0;
+
+    return xmlStrdup(buf);
+}
+
+/**
+ * exsltDateFormat:
+ * @dt: an #exsltDateValPtr
+ *
+ * Formats @dt in the proper format.
+ * Note: xs:gmonth and xs:gday are not formatted as there are no
+ * routines that output them.
+ *
+ * Returns a newly allocated string, or NULL in case of error
+ */
+static xmlChar *
+exsltDateFormat (const exsltDateValPtr dt)
+{
+
+    if (dt == NULL)
+	return NULL;
+
+    switch (dt->type) {
+    case XS_DURATION:
+        return exsltDateFormatDuration(&(dt->value.dur));
+    case XS_DATETIME:
+        return exsltDateFormatDateTime(&(dt->value.date));
+    case XS_DATE:
+        return exsltDateFormatDate(&(dt->value.date));
+    case XS_TIME:
+        return exsltDateFormatTime(&(dt->value.date));
+    default:
+        break;
+    }
+
+    if (dt->type & XS_GYEAR) {
+        xmlChar buf[20], *cur = buf;
+
+        FORMAT_GYEAR(dt->value.date.year, cur);
+        if (dt->type == XS_GYEARMONTH) {
+	    *cur = '-';
+	    cur++;
+	    FORMAT_GMONTH(dt->value.date.mon, cur);
+        }
+
+        if (dt->value.date.tz_flag || (dt->value.date.tzo != 0)) {
+	    FORMAT_TZ(dt->value.date.tzo, cur);
+        }
+        *cur = 0;
+        return xmlStrdup(buf);
+    }
+
+    return NULL;
+}
+
+/**
+ * _exsltDateCastYMToDays:
+ * @dt: an #exsltDateValPtr
+ *
+ * Convert mon and year of @dt to total number of days. Take the 
+ * number of years since (or before) 1 AD and add the number of leap
+ * years. This is a function  because negative
+ * years must be handled a little differently and there is no zero year.
+ *
+ * Returns number of days.
+ */
+static long
+_exsltDateCastYMToDays (const exsltDateValPtr dt)
+{
+    long ret;
+
+    if (dt->value.date.year < 0)
+        ret = (dt->value.date.year * 365) +
+              (((dt->value.date.year+1)/4)-((dt->value.date.year+1)/100)+
+               ((dt->value.date.year+1)/400)) +
+              DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
+    else
+        ret = ((dt->value.date.year-1) * 365) +
+              (((dt->value.date.year-1)/4)-((dt->value.date.year-1)/100)+
+               ((dt->value.date.year-1)/400)) +
+              DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year);
+
+    return ret;
+}
+
+/**
+ * TIME_TO_NUMBER:
+ * @dt:  an #exsltDateValPtr
+ *
+ * Calculates the number of seconds in the time portion of @dt.
+ *
+ * Returns seconds.
+ */
+#define TIME_TO_NUMBER(dt)                              \
+    ((double)((dt->value.date.hour * SECS_PER_HOUR) +   \
+              (dt->value.date.min * SECS_PER_MIN)) + dt->value.date.sec)
+
+/**
+ * exsltDateCastDateToNumber:
+ * @dt:  an #exsltDateValPtr
+ *
+ * Calculates the number of seconds from year zero.
+ *
+ * Returns seconds from zero year.
+ */
+static double
+exsltDateCastDateToNumber (const exsltDateValPtr dt)
+{
+    double ret = 0.0;
+
+    if (dt == NULL)
+        return 0.0;
+
+    if ((dt->type & XS_GYEAR) == XS_GYEAR) {
+        ret = (double)_exsltDateCastYMToDays(dt) * SECS_PER_DAY;
+    }
+
+    /* add in days */
+    if (dt->type == XS_DURATION) {
+        ret += (double)dt->value.dur.day * SECS_PER_DAY;
+        ret += dt->value.dur.sec;
+    } else {
+        ret += (double)dt->value.date.day * SECS_PER_DAY;
+        /* add in time */
+        ret += TIME_TO_NUMBER(dt);
+    }
+
+
+    return ret;
+}
+
+/**
+ * _exsltDateTruncateDate:
+ * @dt: an #exsltDateValPtr
+ * @type: dateTime type to set to
+ *
+ * Set @dt to truncated @type.
+ *
+ * Returns 0 success, non-zero otherwise.
+ */
+static int
+_exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type)
+{
+    if (dt == NULL)
+        return 1;
+
+    if ((type & XS_TIME) != XS_TIME) {
+        dt->value.date.hour = 0;
+        dt->value.date.min  = 0;
+        dt->value.date.sec  = 0.0;
+    }
+
+    if ((type & XS_GDAY) != XS_GDAY)
+        dt->value.date.day = 0;
+
+    if ((type & XS_GMONTH) != XS_GMONTH)
+        dt->value.date.mon = 0;
+
+    if ((type & XS_GYEAR) != XS_GYEAR)
+        dt->value.date.year = 0;
+
+    dt->type = type;
+
+    return 0;
+}
+
+/**
+ * _exsltDayInWeek:
+ * @yday: year day (1-366)
+ * @yr: year
+ *
+ * Determine the day-in-week from @yday and @yr. 0001-01-01 was
+ * a Monday so all other days are calculated from there. Take the 
+ * number of years since (or before) add the number of leap years and
+ * the day-in-year and mod by 7. This is a function  because negative
+ * years must be handled a little differently and there is no zero year.
+ *
+ * Returns day in week (Sunday = 0).
+ */
+static long
+_exsltDateDayInWeek(long yday, long yr)
+{
+    long ret;
+
+    if (yr < 0) {
+        ret = ((yr + (((yr+1)/4)-((yr+1)/100)+((yr+1)/400)) + yday) % 7);
+        if (ret < 0) 
+            ret += 7;
+    } else
+        ret = (((yr-1) + (((yr-1)/4)-((yr-1)/100)+((yr-1)/400)) + yday) % 7);
+
+    return ret;
+}
+
+/*
+ * macros for adding date/times and durations
+ */
+#define FQUOTIENT(a,b)                  ((floor(((double)a/(double)b))))
+#define MODULO(a,b)                     ((a - FQUOTIENT(a,b) * b))
+#define FQUOTIENT_RANGE(a,low,high)     (FQUOTIENT((a-low),(high-low)))
+#define MODULO_RANGE(a,low,high)        ((MODULO((a-low),(high-low)))+low)
+
+/**
+ * _exsltDateAdd:
+ * @dt: an #exsltDateValPtr
+ * @dur: an #exsltDateValPtr of type #XS_DURATION
+ *
+ * Compute a new date/time from @dt and @dur. This function assumes @dt
+ * is either #XS_DATETIME, #XS_DATE, #XS_GYEARMONTH, or #XS_GYEAR.
+ *
+ * Returns date/time pointer or NULL.
+ */
+static exsltDateValPtr
+_exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur)
+{
+    exsltDateValPtr ret;
+    long carry, tempdays, temp;
+    exsltDateValDatePtr r, d;
+    exsltDateValDurationPtr u;
+
+    if ((dt == NULL) || (dur == NULL))
+        return NULL;
+
+    ret = exsltDateCreateDate(dt->type);
+    if (ret == NULL)
+        return NULL;
+
+    r = &(ret->value.date);
+    d = &(dt->value.date);
+    u = &(dur->value.dur);
+
+    /* normalization */
+    if (d->mon == 0)
+        d->mon = 1;
+
+    /* normalize for time zone offset */
+    u->sec -= (d->tzo * 60);	/* changed from + to - (bug 153000) */
+    d->tzo = 0;
+
+    /* normalization */
+    if (d->day == 0)
+        d->day = 1;
+
+    /* month */
+    carry  = d->mon + u->mon;
+    r->mon = (unsigned int)MODULO_RANGE(carry, 1, 13);
+    carry  = (long)FQUOTIENT_RANGE(carry, 1, 13);
+
+    /* year (may be modified later) */
+    r->year = d->year + carry;
+    if (r->year == 0) {
+        if (d->year > 0)
+            r->year--;
+        else
+            r->year++;
+    }
+
+    /* time zone */
+    r->tzo     = d->tzo;
+    r->tz_flag = d->tz_flag;
+
+    /* seconds */
+    r->sec = d->sec + u->sec;
+    carry  = (long)FQUOTIENT((long)r->sec, 60);
+    if (r->sec != 0.0) {
+        r->sec = MODULO(r->sec, 60.0);
+    }
+
+    /* minute */
+    carry += d->min;
+    r->min = (unsigned int)MODULO(carry, 60);
+    carry  = (long)FQUOTIENT(carry, 60);
+
+    /* hours */
+    carry  += d->hour;
+    r->hour = (unsigned int)MODULO(carry, 24);
+    carry   = (long)FQUOTIENT(carry, 24);
+
+    /*
+     * days
+     * Note we use tempdays because the temporary values may need more
+     * than 5 bits
+     */
+    if ((VALID_YEAR(r->year)) && (VALID_MONTH(r->mon)) &&
+                  (d->day > MAX_DAYINMONTH(r->year, r->mon)))
+        tempdays = MAX_DAYINMONTH(r->year, r->mon);
+    else if (d->day < 1)
+        tempdays = 1;
+    else
+        tempdays = d->day;
+
+    tempdays += u->day + carry;
+
+    while (1) {
+        if (tempdays < 1) {
+            long tmon = (long)MODULO_RANGE((int)r->mon-1, 1, 13);
+            long tyr  = r->year + (long)FQUOTIENT_RANGE((int)r->mon-1, 1, 13);
+            if (tyr == 0)
+                tyr--;
+	    /*
+	     * Coverity detected an overrun in daysInMonth 
+	     * of size 12 at position 12 with index variable "((r)->mon - 1)"
+	     */
+	    if (tmon < 0)
+	        tmon = 0;
+	    if (tmon > 12)
+	        tmon = 12;
+            tempdays += MAX_DAYINMONTH(tyr, tmon);
+            carry = -1;
+        } else if (tempdays > (long)MAX_DAYINMONTH(r->year, r->mon)) {
+            tempdays = tempdays - MAX_DAYINMONTH(r->year, r->mon);
+            carry = 1;
+        } else
+            break;
+
+        temp = r->mon + carry;
+        r->mon = (unsigned int)MODULO_RANGE(temp, 1, 13);
+        r->year = r->year + (long)FQUOTIENT_RANGE(temp, 1, 13);
+        if (r->year == 0) {
+            if (temp < 1)
+                r->year--;
+            else
+                r->year++;
+	}
+    }
+    
+    r->day = tempdays;
+
+    /*
+     * adjust the date/time type to the date values
+     */
+    if (ret->type != XS_DATETIME) {
+        if ((r->hour) || (r->min) || (r->sec))
+            ret->type = XS_DATETIME;
+        else if (ret->type != XS_DATE) {
+            if ((r->mon != 1) && (r->day != 1))
+                ret->type = XS_DATE;
+            else if ((ret->type != XS_GYEARMONTH) && (r->mon != 1))
+                ret->type = XS_GYEARMONTH;
+        }
+    }
+
+    return ret;
+}
+
+/**
+ * exsltDateNormalize:
+ * @dt: an #exsltDateValPtr
+ *
+ * Normalize @dt to GMT time.
+ *
+ */
+static void
+exsltDateNormalize (exsltDateValPtr dt)
+{
+    exsltDateValPtr dur, tmp;
+
+    if (dt == NULL)
+        return;
+
+    if (((dt->type & XS_TIME) != XS_TIME) || (dt->value.date.tzo == 0))
+        return;
+
+    dur = exsltDateCreateDate(XS_DURATION);
+    if (dur == NULL)
+        return;
+
+    tmp = _exsltDateAdd(dt, dur);
+    if (tmp == NULL)
+        return;
+
+    memcpy(dt, tmp, sizeof(exsltDateVal));
+
+    exsltDateFreeDate(tmp);
+    exsltDateFreeDate(dur);
+
+    dt->value.date.tzo = 0;
+}
+
+/**
+ * _exsltDateDifference:
+ * @x: an #exsltDateValPtr
+ * @y: an #exsltDateValPtr
+ * @flag: force difference in days
+ *
+ * Calculate the difference between @x and @y as a duration
+ * (i.e. y - x). If the @flag is set then even if the least specific
+ * format of @x or @y is xs:gYear or xs:gYearMonth.
+ *
+ * Returns date/time pointer or NULL.
+ */
+static exsltDateValPtr
+_exsltDateDifference (exsltDateValPtr x, exsltDateValPtr y, int flag)
+{
+    exsltDateValPtr ret;
+
+    if ((x == NULL) || (y == NULL))
+        return NULL;
+
+    if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) ||
+        ((y->type < XS_GYEAR) || (y->type > XS_DATETIME))) 
+        return NULL;
+
+    exsltDateNormalize(x);
+    exsltDateNormalize(y);
+
+    /*
+     * the operand with the most specific format must be converted to
+     * the same type as the operand with the least specific format.
+     */
+    if (x->type != y->type) {
+        if (x->type < y->type) {
+            _exsltDateTruncateDate(y, x->type);
+        } else {
+            _exsltDateTruncateDate(x, y->type);
+        }
+    }
+
+    ret = exsltDateCreateDate(XS_DURATION);
+    if (ret == NULL)
+        return NULL;
+
+    if (((x->type == XS_GYEAR) || (x->type == XS_GYEARMONTH)) && (!flag)) {
+        /* compute the difference in months */
+        ret->value.dur.mon = ((y->value.date.year * 12) + y->value.date.mon) -
+                             ((x->value.date.year * 12) + x->value.date.mon);
+	/* The above will give a wrong result if x and y are on different sides
+	 of the September 1752. Resolution is welcome :-) */
+    } else {
+        ret->value.dur.day  = _exsltDateCastYMToDays(y) -
+                              _exsltDateCastYMToDays(x);
+        ret->value.dur.day += y->value.date.day - x->value.date.day;
+        ret->value.dur.sec  = TIME_TO_NUMBER(y) - TIME_TO_NUMBER(x);
+	if (ret->value.dur.day > 0.0 && ret->value.dur.sec < 0.0) {
+	    ret->value.dur.day -= 1;
+	    ret->value.dur.sec = ret->value.dur.sec + SECS_PER_DAY;
+	} else if (ret->value.dur.day < 0.0 && ret->value.dur.sec > 0.0) {
+	    ret->value.dur.day += 1;
+	    ret->value.dur.sec = ret->value.dur.sec - SECS_PER_DAY;
+	}
+    }
+
+    return ret;
+}
+
+/**
+ * _exsltDateAddDurCalc
+ * @ret: an exsltDateValPtr for the return value:
+ * @x: an exsltDateValPtr for the first operand
+ * @y: an exsltDateValPtr for the second operand
+ *
+ * Add two durations, catering for possible negative values.
+ * The sum is placed in @ret.
+ *
+ * Returns 1 for success, 0 if error detected.
+ */
+static int
+_exsltDateAddDurCalc (exsltDateValPtr ret, exsltDateValPtr x,
+		      exsltDateValPtr y)
+{
+    long carry;
+
+    /* months */
+    ret->value.dur.mon = x->value.dur.mon + y->value.dur.mon;
+
+    /* seconds */
+    ret->value.dur.sec = x->value.dur.sec + y->value.dur.sec;
+    carry = (long)FQUOTIENT(ret->value.dur.sec, SECS_PER_DAY);
+    if (ret->value.dur.sec != 0.0) {
+        ret->value.dur.sec = MODULO(ret->value.dur.sec, SECS_PER_DAY);
+	/*
+	 * Our function MODULO always gives us a positive value, so
+	 * if we end up with a "-ve" carry we need to adjust it
+	 * appropriately (bug 154021)
+	 */
+	if ((carry < 0) && (ret->value.dur.sec != 0)) {
+	    /* change seconds to equiv negative modulus */
+	    ret->value.dur.sec = ret->value.dur.sec - SECS_PER_DAY;
+	    carry++;
+	}
+    }
+
+    /* days */
+    ret->value.dur.day = x->value.dur.day + y->value.dur.day + carry;
+
+    /*
+     * are the results indeterminate? i.e. how do you subtract days from
+     * months or years?
+     */
+    if ((((ret->value.dur.day > 0) || (ret->value.dur.sec > 0)) &&
+         (ret->value.dur.mon < 0)) ||
+        (((ret->value.dur.day < 0) || (ret->value.dur.sec < 0)) &&
+         (ret->value.dur.mon > 0))) {
+        return 0;
+    }
+    return 1;
+}
+
+/**
+ * _exsltDateAddDuration:
+ * @x: an #exsltDateValPtr of type #XS_DURATION
+ * @y: an #exsltDateValPtr of type #XS_DURATION
+ *
+ * Compute a new duration from @x and @y.
+ *
+ * Returns date/time pointer or NULL.
+ */
+static exsltDateValPtr
+_exsltDateAddDuration (exsltDateValPtr x, exsltDateValPtr y)
+{
+    exsltDateValPtr ret;
+
+    if ((x == NULL) || (y == NULL))
+        return NULL;
+
+    ret = exsltDateCreateDate(XS_DURATION);
+    if (ret == NULL)
+        return NULL;
+
+    if (_exsltDateAddDurCalc(ret, x, y))
+        return ret;
+
+    exsltDateFreeDate(ret);
+    return NULL;
+}
+
+/****************************************************************
+ *								*
+ *		EXSLT - Dates and Times functions		*
+ *								*
+ ****************************************************************/
+
+/**
+ * exsltDateDateTime:
+ *
+ * Implements the EXSLT - Dates and Times date-time() function:
+ *     string date:date-time()
+ * 
+ * Returns the current date and time as a date/time string.
+ */
+static xmlChar *
+exsltDateDateTime (void)
+{
+    xmlChar *ret = NULL;
+#ifdef WITH_TIME
+    exsltDateValPtr cur;
+
+    cur = exsltDateCurrent();
+    if (cur != NULL) {
+	ret = exsltDateFormatDateTime(&(cur->value.date));
+	exsltDateFreeDate(cur);
+    }
+#endif
+
+    return ret;
+}
+
+/**
+ * exsltDateDate:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times date() function:
+ *     string date:date (string?)
+ * 
+ * Returns the date specified in the date/time string given as the
+ * argument.  If no argument is given, then the current local
+ * date/time, as returned by date:date-time is used as a default
+ * argument.
+ * The date/time string specified as an argument must be a string in
+ * the format defined as the lexical representation of either
+ * xs:dateTime or xs:date.  If the argument is not in either of these
+ * formats, returns NULL.
+ */
+static xmlChar *
+exsltDateDate (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt = NULL;
+    xmlChar *ret = NULL;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return NULL;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return NULL;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return NULL;
+	}
+    }
+
+    ret = exsltDateFormatDate(&(dt->value.date));
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateTime:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times time() function:
+ *     string date:time (string?)
+ * 
+ * Returns the time specified in the date/time string given as the
+ * argument.  If no argument is given, then the current local
+ * date/time, as returned by date:date-time is used as a default
+ * argument.
+ * The date/time string specified as an argument must be a string in
+ * the format defined as the lexical representation of either
+ * xs:dateTime or xs:time.  If the argument is not in either of these
+ * formats, returns NULL.
+ */
+static xmlChar *
+exsltDateTime (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt = NULL;
+    xmlChar *ret = NULL;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return NULL;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return NULL;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) {
+	    exsltDateFreeDate(dt);
+	    return NULL;
+	}
+    }
+
+    ret = exsltDateFormatTime(&(dt->value.date));
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateYear:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times year() function
+ *    number date:year (string?)
+ * Returns the year of a date as a number.  If no argument is given,
+ * then the current local date/time, as returned by date:date-time is
+ * used as a default argument.
+ * The date/time string specified as the first argument must be a
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gYear (CCYY)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateYear (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) &&
+	    (dt->type != XS_GYEARMONTH) && (dt->type != XS_GYEAR)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = (double) dt->value.date.year;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateLeapYear:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times leap-year() function:
+ *    boolean date:leap-yea (string?)
+ * Returns true if the year given in a date is a leap year.  If no
+ * argument is given, then the current local date/time, as returned by
+ * date:date-time is used as a default argument.
+ * The date/time string specified as the first argument must be a
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gYear (CCYY)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static xmlXPathObjectPtr
+exsltDateLeapYear (const xmlChar *dateTime)
+{
+    double year;
+
+    year = exsltDateYear(dateTime);
+    if (xmlXPathIsNaN(year))
+	return xmlXPathNewFloat(xmlXPathNAN);
+
+    if (IS_LEAP((long)year))
+	return xmlXPathNewBoolean(1);
+
+    return xmlXPathNewBoolean(0);
+}
+
+/**
+ * exsltDateMonthInYear:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times month-in-year() function:
+ *    number date:month-in-year (string?)
+ * Returns the month of a date as a number.  If no argument is given,
+ * then the current local date/time, as returned by date:date-time is
+ * used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gMonth (--MM--)
+ *  - xs:gMonthDay (--MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateMonthInYear (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) &&
+	    (dt->type != XS_GYEARMONTH) && (dt->type != XS_GMONTH) &&
+	    (dt->type != XS_GMONTHDAY)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = (double) dt->value.date.mon;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateMonthName:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Time month-name() function
+ *    string date:month-name (string?)
+ * Returns the full name of the month of a date.  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gMonth (--MM--)
+ * If the date/time string is not in one of these formats, then an
+ * empty string ('') is returned.
+ * The result is an English month name: one of 'January', 'February',
+ * 'March', 'April', 'May', 'June', 'July', 'August', 'September',
+ * 'October', 'November' or 'December'.
+ */
+static const xmlChar *
+exsltDateMonthName (const xmlChar *dateTime)
+{
+    static const xmlChar monthNames[13][10] = {
+        { 0 },
+	{ 'J', 'a', 'n', 'u', 'a', 'r', 'y', 0 },
+	{ 'F', 'e', 'b', 'r', 'u', 'a', 'r', 'y', 0 },
+	{ 'M', 'a', 'r', 'c', 'h', 0 },
+	{ 'A', 'p', 'r', 'i', 'l', 0 },
+	{ 'M', 'a', 'y', 0 },
+	{ 'J', 'u', 'n', 'e', 0 },
+	{ 'J', 'u', 'l', 'y', 0 },
+	{ 'A', 'u', 'g', 'u', 's', 't', 0 },
+	{ 'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', 0 },
+	{ 'O', 'c', 't', 'o', 'b', 'e', 'r', 0 },
+	{ 'N', 'o', 'v', 'e', 'm', 'b', 'e', 'r', 0 },
+	{ 'D', 'e', 'c', 'e', 'm', 'b', 'e', 'r', 0 }
+    };
+    int month;
+    month = (int) exsltDateMonthInYear(dateTime);
+    if (!VALID_MONTH(month))
+      month = 0;
+    return monthNames[month];
+}
+
+/**
+ * exsltDateMonthAbbreviation:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Time month-abbreviation() function
+ *    string date:month-abbreviation (string?)
+ * Returns the abbreviation of the month of a date.  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gMonth (--MM--)
+ * If the date/time string is not in one of these formats, then an
+ * empty string ('') is returned.
+ * The result is an English month abbreviation: one of 'Jan', 'Feb',
+ * 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov' or
+ * 'Dec'.
+ */
+static const xmlChar *
+exsltDateMonthAbbreviation (const xmlChar *dateTime)
+{
+    static const xmlChar monthAbbreviations[13][4] = {
+        { 0 },
+	{ 'J', 'a', 'n', 0 },
+	{ 'F', 'e', 'b', 0 },
+	{ 'M', 'a', 'r', 0 },
+	{ 'A', 'p', 'r', 0 },
+	{ 'M', 'a', 'y', 0 },
+	{ 'J', 'u', 'n', 0 },
+	{ 'J', 'u', 'l', 0 },
+	{ 'A', 'u', 'g', 0 },
+	{ 'S', 'e', 'p', 0 },
+	{ 'O', 'c', 't', 0 },
+	{ 'N', 'o', 'v', 0 },
+	{ 'D', 'e', 'c', 0 }
+    };
+    int month;
+    month = (int) exsltDateMonthInYear(dateTime);
+    if(!VALID_MONTH(month))
+      month = 0;
+    return monthAbbreviations[month];
+}
+
+/**
+ * exsltDateWeekInYear:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times week-in-year() function
+ *    number date:week-in-year (string?)
+ * Returns the week of the year as a number.  If no argument is given,
+ * then the current local date/time, as returned by date:date-time is
+ * used as the default argument.  For the purposes of numbering,
+ * counting follows ISO 8601: week 1 in a year is the week containing
+ * the first Thursday of the year, with new weeks beginning on a
+ * Monday.
+ * The date/time string specified as the argument is a right-truncated
+ * string in the format defined as the lexical representation of
+ * xs:dateTime in one of the formats defined in [XML Schema Part 2:
+ * Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateWeekInYear (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    long diy, diw, year, ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
+                      dt->value.date.year);
+
+    /*
+     * Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday
+     * is the first day-in-week
+     */
+    diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7;
+
+    /* ISO 8601 adjustment, 3 is Thu */
+    diy += (3 - diw);
+    if(diy < 1) {
+	year = dt->value.date.year - 1;
+	if(year == 0) year--;
+	diy = DAY_IN_YEAR(31, 12, year) + diy;
+    } else if (diy > DAY_IN_YEAR(31, 12, dt->value.date.year)) {
+	diy -= DAY_IN_YEAR(31, 12, dt->value.date.year);
+    }
+
+    ret = ((diy - 1) / 7) + 1;
+
+    exsltDateFreeDate(dt);
+
+    return (double) ret;
+}
+
+/**
+ * exsltDateWeekInMonth:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times week-in-month() function
+ *    number date:week-in-month (string?)
+ * The date:week-in-month function returns the week in a month of a
+ * date as a number. If no argument is given, then the current local
+ * date/time, as returned by date:date-time is used the default
+ * argument. For the purposes of numbering, the first day of the month
+ * is in week 1 and new weeks begin on a Monday (so the first and last
+ * weeks in a month will often have less than 7 days in them).
+ * The date/time string specified as the argument is a right-truncated
+ * string in the format defined as the lexical representation of
+ * xs:dateTime in one of the formats defined in [XML Schema Part 2:
+ * Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateWeekInMonth (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    long fdiy, fdiw, ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    fdiy = DAY_IN_YEAR(1, dt->value.date.mon, dt->value.date.year);
+    /*
+     * Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday
+     * is the first day-in-week
+     */
+    fdiw = (_exsltDateDayInWeek(fdiy, dt->value.date.year) + 6) % 7;
+
+    ret = ((dt->value.date.day + fdiw - 1) / 7) + 1;
+
+    exsltDateFreeDate(dt);
+
+    return (double) ret;
+}
+
+/**
+ * exsltDateDayInYear:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-in-year() function
+ *    number date:day-in-year (string?)
+ * Returns the day of a date in a year as a number.  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a right-truncated
+ * string in the format defined as the lexical representation of
+ * xs:dateTime in one of the formats defined in [XML Schema Part 2:
+ * Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateDayInYear (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    long ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
+                      dt->value.date.year);
+
+    exsltDateFreeDate(dt);
+
+    return (double) ret;
+}
+
+/**
+ * exsltDateDayInMonth:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-in-month() function:
+ *    number date:day-in-month (string?)
+ * Returns the day of a date as a number.  If no argument is given,
+ * then the current local date/time, as returned by date:date-time is
+ * used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ *  - xs:gMonthDay (--MM-DD)
+ *  - xs:gDay (---DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateDayInMonth (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) &&
+	    (dt->type != XS_GMONTHDAY) && (dt->type != XS_GDAY)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = (double) dt->value.date.day;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateDayOfWeekInMonth:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-of-week-in-month() function:
+ *    number date:day-of-week-in-month (string?)
+ * Returns the day-of-the-week in a month of a date as a number
+ * (e.g. 3 for the 3rd Tuesday in May).  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a right-truncated
+ * string in the format defined as the lexical representation of
+ * xs:dateTime in one of the formats defined in [XML Schema Part 2:
+ * Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateDayOfWeekInMonth (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    long ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = ((dt->value.date.day -1) / 7) + 1;
+
+    exsltDateFreeDate(dt);
+
+    return (double) ret;
+}
+
+/**
+ * exsltDateDayInWeek:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-in-week() function:
+ *    number date:day-in-week (string?)
+ * Returns the day of the week given in a date as a number.  If no
+ * argument is given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ * The numbering of days of the week starts at 1 for Sunday, 2 for
+ * Monday and so on up to 7 for Saturday.
+ */
+static double
+exsltDateDayInWeek (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    long diy, ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
+                      dt->value.date.year);
+
+    ret = _exsltDateDayInWeek(diy, dt->value.date.year) + 1;
+
+    exsltDateFreeDate(dt);
+
+    return (double) ret;
+}
+
+/**
+ * exsltDateDayName:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Time day-name() function
+ *    string date:day-name (string?)
+ * Returns the full name of the day of the week of a date.  If no
+ * argument is given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then an
+ * empty string ('') is returned.
+ * The result is an English day name: one of 'Sunday', 'Monday',
+ * 'Tuesday', 'Wednesday', 'Thursday' or 'Friday'.
+ */
+static const xmlChar *
+exsltDateDayName (const xmlChar *dateTime)
+{
+    static const xmlChar dayNames[8][10] = {
+        { 0 },
+	{ 'S', 'u', 'n', 'd', 'a', 'y', 0 },
+	{ 'M', 'o', 'n', 'd', 'a', 'y', 0 },
+	{ 'T', 'u', 'e', 's', 'd', 'a', 'y', 0 },
+	{ 'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', 0 },
+	{ 'T', 'h', 'u', 'r', 's', 'd', 'a', 'y', 0 },
+	{ 'F', 'r', 'i', 'd', 'a', 'y', 0 },
+	{ 'S', 'a', 't', 'u', 'r', 'd', 'a', 'y', 0 }
+    };
+    int day;
+    day = (int) exsltDateDayInWeek(dateTime);
+    if((day < 1) || (day > 7))
+      day = 0;
+    return dayNames[day];
+}
+
+/**
+ * exsltDateDayAbbreviation:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Time day-abbreviation() function
+ *    string date:day-abbreviation (string?)
+ * Returns the abbreviation of the day of the week of a date.  If no
+ * argument is given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date (CCYY-MM-DD)
+ * If the date/time string is not in one of these formats, then an
+ * empty string ('') is returned.
+ * The result is a three-letter English day abbreviation: one of
+ * 'Sun', 'Mon', 'Tue', 'Wed', 'Thu' or 'Fri'.
+ */
+static const xmlChar *
+exsltDateDayAbbreviation (const xmlChar *dateTime)
+{
+    static const xmlChar dayAbbreviations[8][4] = {
+        { 0 },
+	{ 'S', 'u', 'n', 0 },
+	{ 'M', 'o', 'n', 0 },
+	{ 'T', 'u', 'e', 0 },
+	{ 'W', 'e', 'd', 0 },
+	{ 'T', 'h', 'u', 0 },
+	{ 'F', 'r', 'i', 0 },
+	{ 'S', 'a', 't', 0 }
+    };
+    int day;
+    day = (int) exsltDateDayInWeek(dateTime);
+    if((day < 1) || (day > 7))
+      day = 0;
+    return dayAbbreviations[day];
+}
+
+/**
+ * exsltDateHourInDay:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-in-month() function:
+ *    number date:day-in-month (string?)
+ * Returns the hour of the day as a number.  If no argument is given,
+ * then the current local date/time, as returned by date:date-time is
+ * used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:time (hh:mm:ss)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateHourInDay (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = (double) dt->value.date.hour;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateMinuteInHour:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times day-in-month() function:
+ *    number date:day-in-month (string?)
+ * Returns the minute of the hour as a number.  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:time (hh:mm:ss)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ */
+static double
+exsltDateMinuteInHour (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = (double) dt->value.date.min;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateSecondInMinute:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times second-in-minute() function:
+ *    number date:day-in-month (string?)
+ * Returns the second of the minute as a number.  If no argument is
+ * given, then the current local date/time, as returned by
+ * date:date-time is used the default argument.
+ * The date/time string specified as the argument is a left or
+ * right-truncated string in the format defined as the lexical
+ * representation of xs:dateTime in one of the formats defined in [XML
+ * Schema Part 2: Datatypes].  The permitted formats are as follows:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:time (hh:mm:ss)
+ * If the date/time string is not in one of these formats, then NaN is
+ * returned.
+ * 
+ * Returns the second or NaN.
+ */
+static double
+exsltDateSecondInMinute (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+	dt = exsltDateParse(dateTime);
+	if (dt == NULL)
+	    return xmlXPathNAN;
+	if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) {
+	    exsltDateFreeDate(dt);
+	    return xmlXPathNAN;
+	}
+    }
+
+    ret = dt->value.date.sec;
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateAdd:
+ * @xstr: date/time string
+ * @ystr: date/time string
+ *
+ * Implements the date:add (string,string) function which returns the
+ * date/time * resulting from adding a duration to a date/time. 
+ * The first argument (@xstr) must be right-truncated date/time
+ * strings in one of the formats defined in [XML Schema Part 2:
+ * Datatypes]. The permitted formats are as follows: 
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss) 
+ *  - xs:date (CCYY-MM-DD) 
+ *  - xs:gYearMonth (CCYY-MM) 
+ *  - xs:gYear (CCYY) 
+ * The second argument (@ystr) is a string in the format defined for
+ * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. 
+ * The return value is a right-truncated date/time strings in one of
+ * the formats defined in [XML Schema Part 2: Datatypes] and listed
+ * above. This value is calculated using the algorithm described in
+ * [Appendix E Adding durations to dateTimes] of [XML Schema Part 2:
+ * Datatypes]. 
+
+ * Returns date/time string or NULL.
+ */
+static xmlChar *
+exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr)
+{
+    exsltDateValPtr dt, dur, res;
+    xmlChar     *ret;   
+
+    if ((xstr == NULL) || (ystr == NULL))
+        return NULL;
+
+    dt = exsltDateParse(xstr);
+    if (dt == NULL)
+        return NULL;
+    else if ((dt->type < XS_GYEAR) || (dt->type > XS_DATETIME)) {
+        exsltDateFreeDate(dt);
+        return NULL;
+    }
+
+    dur = exsltDateParseDuration(ystr);
+    if (dur == NULL) {
+        exsltDateFreeDate(dt);
+        return NULL;
+    }
+
+    res = _exsltDateAdd(dt, dur);
+
+    exsltDateFreeDate(dt);
+    exsltDateFreeDate(dur);
+
+    if (res == NULL)
+        return NULL;
+
+    ret = exsltDateFormat(res);
+    exsltDateFreeDate(res);
+
+    return ret;
+}
+
+/**
+ * exsltDateAddDuration:
+ * @xstr:      first duration string
+ * @ystr:      second duration string
+ *
+ * Implements the date:add-duration (string,string) function which returns
+ * the duration resulting from adding two durations together. 
+ * Both arguments are strings in the format defined for xs:duration
+ * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either
+ * argument is not in this format, the function returns an empty string
+ * (''). 
+ * The return value is a string in the format defined for xs:duration
+ * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. 
+ * The durations can usually be added by summing the numbers given for
+ * each of the components in the durations. However, if the durations
+ * are differently signed, then this sometimes results in durations
+ * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
+ * In these cases, the function returns an empty string (''). 
+ *
+ * Returns duration string or NULL.
+ */
+static xmlChar *
+exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr)
+{
+    exsltDateValPtr x, y, res;
+    xmlChar     *ret;   
+
+    if ((xstr == NULL) || (ystr == NULL))
+        return NULL;
+
+    x = exsltDateParseDuration(xstr);
+    if (x == NULL)
+        return NULL;
+
+    y = exsltDateParseDuration(ystr);
+    if (y == NULL) {
+        exsltDateFreeDate(x);
+        return NULL;
+    }
+
+    res = _exsltDateAddDuration(x, y);
+
+    exsltDateFreeDate(x);
+    exsltDateFreeDate(y);
+
+    if (res == NULL)
+        return NULL;
+
+    ret = exsltDateFormatDuration(&(res->value.dur));
+    exsltDateFreeDate(res);
+
+    return ret;
+}
+
+/**
+ * exsltDateSumFunction:
+ * @ns:      a node set of duration strings
+ *
+ * The date:sum function adds a set of durations together. 
+ * The string values of the nodes in the node set passed as an argument 
+ * are interpreted as durations and added together as if using the 
+ * date:add-duration function. (from exslt.org)
+ *
+ * The return value is a string in the format defined for xs:duration
+ * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. 
+ * The durations can usually be added by summing the numbers given for
+ * each of the components in the durations. However, if the durations
+ * are differently signed, then this sometimes results in durations
+ * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
+ * In these cases, the function returns an empty string (''). 
+ *
+ * Returns duration string or NULL.
+ */
+static void
+exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlNodeSetPtr ns;
+    void *user = NULL;
+    xmlChar *tmp;
+    exsltDateValPtr x, total;
+    xmlChar *ret;
+    int i;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError (ctxt);
+	return;
+    }
+
+    /* We need to delay the freeing of value->user */
+    if ((ctxt->value != NULL) && ctxt->value->boolval != 0) {
+	user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = NULL;
+    }
+
+    ns = xmlXPathPopNodeSet (ctxt);
+    if (xmlXPathCheckError (ctxt))
+	return;
+
+    if ((ns == NULL) || (ns->nodeNr == 0)) {
+	xmlXPathReturnEmptyString (ctxt);
+	if (ns != NULL)
+	    xmlXPathFreeNodeSet (ns);
+	return;
+    }
+
+    total = exsltDateCreateDate (XS_DURATION);
+    if (total == NULL) {
+        xmlXPathFreeNodeSet (ns);
+        return;
+    }
+
+    for (i = 0; i < ns->nodeNr; i++) {
+    	int result;
+	tmp = xmlXPathCastNodeToString (ns->nodeTab[i]);
+	if (tmp == NULL) {
+	    xmlXPathFreeNodeSet (ns);
+	    exsltDateFreeDate (total);
+	    return;
+	}
+
+	x = exsltDateParseDuration (tmp);
+	if (x == NULL) {
+	    xmlFree (tmp);
+	    exsltDateFreeDate (total);
+	    xmlXPathFreeNodeSet (ns);
+	    xmlXPathReturnEmptyString (ctxt);
+	    return;
+	}
+
+	result = _exsltDateAddDurCalc(total, total, x);
+
+	exsltDateFreeDate (x);
+	xmlFree (tmp);
+	if (!result) {
+	    exsltDateFreeDate (total);
+	    xmlXPathFreeNodeSet (ns);
+	    xmlXPathReturnEmptyString (ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateFormatDuration (&(total->value.dur));
+    exsltDateFreeDate (total);
+
+    xmlXPathFreeNodeSet (ns);
+    if (user != NULL)
+	xmlFreeNodeList ((xmlNodePtr) user);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString (ctxt);
+    else
+	xmlXPathReturnString (ctxt, ret);
+}
+
+/**
+ * exsltDateSeconds:
+ * @dateTime: a date/time string
+ *
+ * Implements the EXSLT - Dates and Times seconds() function:
+ *    number date:seconds(string?)
+ * The date:seconds function returns the number of seconds specified
+ * by the argument string. If no argument is given, then the current
+ * local date/time, as returned by exsltDateCurrent() is used as the
+ * default argument. If the date/time string is a xs:duration, then the
+ * years and months must be zero (or not present). Parsing a duration
+ * converts the fields to seconds. If the date/time string is not a 
+ * duration (and not null), then the legal formats are:
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss)
+ *  - xs:date     (CCYY-MM-DD)
+ *  - xs:gYearMonth (CCYY-MM)
+ *  - xs:gYear      (CCYY)
+ * In these cases the difference between the @dateTime and 
+ * 1970-01-01T00:00:00Z is calculated and converted to seconds.
+ *
+ * Note that there was some confusion over whether "difference" meant
+ * that a dateTime of 1970-01-01T00:00:01Z should be a positive one or
+ * a negative one.  After correspondence with exslt.org, it was determined
+ * that the intent of the specification was to have it positive.  The
+ * coding was modified in July 2003 to reflect this.
+ *
+ * Returns seconds or Nan.
+ */
+static double
+exsltDateSeconds (const xmlChar *dateTime)
+{
+    exsltDateValPtr dt;
+    double ret = xmlXPathNAN;
+
+    if (dateTime == NULL) {
+#ifdef WITH_TIME
+	dt = exsltDateCurrent();
+	if (dt == NULL)
+#endif
+	    return xmlXPathNAN;
+    } else {
+        dt = exsltDateParseDuration(dateTime);
+        if (dt == NULL)
+            dt = exsltDateParse(dateTime);
+    }
+
+    if (dt == NULL)
+        return xmlXPathNAN;
+
+    if ((dt->type <= XS_DATETIME) && (dt->type >= XS_GYEAR)) {
+        exsltDateValPtr y, dur;
+
+        /*
+         * compute the difference between the given (or current) date
+         * and epoch date
+         */
+        y = exsltDateCreateDate(XS_DATETIME);
+        if (y != NULL) {
+            y->value.date.year = 1970;
+            y->value.date.mon  = 1;
+            y->value.date.day  = 1;
+            y->value.date.tz_flag = 1;
+
+            dur = _exsltDateDifference(y, dt, 1);
+            if (dur != NULL) {
+                ret = exsltDateCastDateToNumber(dur); 
+                exsltDateFreeDate(dur);
+            }
+            exsltDateFreeDate(y);
+        }
+
+    } else if ((dt->type == XS_DURATION) && (dt->value.dur.mon == 0))
+        ret = exsltDateCastDateToNumber(dt);
+
+    exsltDateFreeDate(dt);
+
+    return ret;
+}
+
+/**
+ * exsltDateDifference:
+ * @xstr: date/time string
+ * @ystr: date/time string
+ *
+ * Implements the date:difference (string,string) function which returns
+ * the duration between the first date and the second date. If the first
+ * date occurs before the second date, then the result is a positive
+ * duration; if it occurs after the second date, the result is a
+ * negative duration.  The two dates must both be right-truncated
+ * date/time strings in one of the formats defined in [XML Schema Part
+ * 2: Datatypes]. The date/time with the most specific format (i.e. the
+ * least truncation) is converted into the same format as the date with
+ * the least specific format (i.e. the most truncation). The permitted
+ * formats are as follows, from most specific to least specific: 
+ *  - xs:dateTime (CCYY-MM-DDThh:mm:ss) 
+ *  - xs:date (CCYY-MM-DD) 
+ *  - xs:gYearMonth (CCYY-MM) 
+ *  - xs:gYear (CCYY) 
+ * If either of the arguments is not in one of these formats,
+ * date:difference returns the empty string (''). 
+ * The difference between the date/times is returned as a string in the
+ * format defined for xs:duration in [3.2.6 duration] of [XML Schema
+ * Part 2: Datatypes]. 
+ * If the date/time string with the least specific format is in either
+ * xs:gYearMonth or xs:gYear format, then the number of days, hours,
+ * minutes and seconds in the duration string must be equal to zero.
+ * (The format of the string will be PnYnM.) The number of months
+ * specified in the duration must be less than 12. 
+ * Otherwise, the number of years and months in the duration string
+ * must be equal to zero. (The format of the string will be
+ * PnDTnHnMnS.) The number of seconds specified in the duration string
+ * must be less than 60; the number of minutes must be less than 60;
+ * the number of hours must be less than 24. 
+ *
+ * Returns duration string or NULL.
+ */
+static xmlChar *
+exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr)
+{
+    exsltDateValPtr x, y, dur;
+    xmlChar        *ret = NULL;   
+
+    if ((xstr == NULL) || (ystr == NULL))
+        return NULL;
+
+    x = exsltDateParse(xstr);
+    if (x == NULL)
+        return NULL;
+
+    y = exsltDateParse(ystr);
+    if (y == NULL) {
+        exsltDateFreeDate(x);
+        return NULL;
+    }
+
+    if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) ||
+        ((y->type < XS_GYEAR) || (y->type > XS_DATETIME)))  {
+	exsltDateFreeDate(x);
+	exsltDateFreeDate(y);
+        return NULL;
+    }
+
+    dur = _exsltDateDifference(x, y, 0);
+
+    exsltDateFreeDate(x);
+    exsltDateFreeDate(y);
+
+    if (dur == NULL)
+        return NULL;
+
+    ret = exsltDateFormatDuration(&(dur->value.dur));
+    exsltDateFreeDate(dur);
+
+    return ret;
+}
+
+/**
+ * exsltDateDuration:
+ * @number: a xmlChar string
+ *
+ * Implements the The date:duration function returns a duration string
+ * representing the number of seconds specified by the argument string.
+ * If no argument is given, then the result of calling date:seconds
+ * without any arguments is used as a default argument. 
+ * The duration is returned as a string in the format defined for
+ * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. 
+ * The number of years and months in the duration string must be equal
+ * to zero. (The format of the string will be PnDTnHnMnS.) The number
+ * of seconds specified in the duration string must be less than 60;
+ * the number of minutes must be less than 60; the number of hours must
+ * be less than 24. 
+ * If the argument is Infinity, -Infinity or NaN, then date:duration
+ * returns an empty string (''). 
+ *
+ * Returns duration string or NULL.
+ */
+static xmlChar *
+exsltDateDuration (const xmlChar *number)
+{
+    exsltDateValPtr dur;
+    double       secs;
+    xmlChar     *ret;
+
+    if (number == NULL)
+        secs = exsltDateSeconds(number);
+    else
+        secs = xmlXPathCastStringToNumber(number);
+
+    if ((xmlXPathIsNaN(secs)) || (xmlXPathIsInf(secs)))
+        return NULL;
+
+    dur = exsltDateCreateDate(XS_DURATION);
+    if (dur == NULL)
+        return NULL;
+
+    dur->value.dur.sec = secs;
+
+    ret = exsltDateFormatDuration(&(dur->value.dur));
+    exsltDateFreeDate(dur);
+
+    return ret;
+}
+
+/****************************************************************
+ *								*
+ *		Wrappers for use by the XPath engine		*
+ *								*
+ ****************************************************************/
+
+#ifdef WITH_TIME
+/**
+ * exsltDateDateTimeFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDateTime() for use by the XPath engine.
+ */
+static void
+exsltDateDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret;
+
+    if (nargs != 0) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    ret = exsltDateDateTime();
+    if (ret == NULL)
+        xmlXPathReturnEmptyString(ctxt);
+    else
+        xmlXPathReturnString(ctxt, ret);
+}
+#endif
+
+/**
+ * exsltDateDateFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDate() for use by the XPath engine.
+ */
+static void
+exsltDateDateFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret, *dt = NULL;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateDate(dt);
+
+    if (ret == NULL) {
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "{http://exslt.org/dates-and-times}date: "
+			 "invalid date or format %s\n", dt);
+	xmlXPathReturnEmptyString(ctxt);
+    } else {
+	xmlXPathReturnString(ctxt, ret);
+    }
+
+    if (dt != NULL)
+	xmlFree(dt);
+}
+
+/**
+ * exsltDateTimeFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateTime() for use by the XPath engine.
+ */
+static void
+exsltDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret, *dt = NULL;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateTime(dt);
+
+    if (ret == NULL) {
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "{http://exslt.org/dates-and-times}time: "
+			 "invalid date or format %s\n", dt);
+	xmlXPathReturnEmptyString(ctxt);
+    } else {
+	xmlXPathReturnString(ctxt, ret);
+    }
+
+    if (dt != NULL)
+	xmlFree(dt);
+}
+
+/**
+ * exsltDateYearFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateYear() for use by the XPath engine.
+ */
+static void
+exsltDateYearFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    double ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateYear(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltDateLeapYearFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateLeapYear() for use by the XPath engine.
+ */
+static void
+exsltDateLeapYearFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    xmlXPathObjectPtr ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateLeapYear(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    valuePush(ctxt, ret);
+}
+
+#define X_IN_Y(x, y)						\
+static void							\
+exsltDate##x##In##y##Function (xmlXPathParserContextPtr ctxt,	\
+			      int nargs) {			\
+    xmlChar *dt = NULL;						\
+    double ret;							\
+								\
+    if ((nargs < 0) || (nargs > 1)) {				\
+	xmlXPathSetArityError(ctxt);				\
+	return;							\
+    }								\
+								\
+    if (nargs == 1) {						\
+	dt = xmlXPathPopString(ctxt);				\
+	if (xmlXPathCheckError(ctxt)) {				\
+	    xmlXPathSetTypeError(ctxt);				\
+	    return;						\
+	}							\
+    }								\
+								\
+    ret = exsltDate##x##In##y(dt);				\
+								\
+    if (dt != NULL)						\
+	xmlFree(dt);						\
+								\
+    xmlXPathReturnNumber(ctxt, ret);				\
+}
+
+/**
+ * exsltDateMonthInYearFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateMonthInYear() for use by the XPath engine.
+ */
+X_IN_Y(Month,Year)
+
+/**
+ * exsltDateMonthNameFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateMonthName() for use by the XPath engine.
+ */
+static void
+exsltDateMonthNameFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    const xmlChar *ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateMonthName(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, xmlStrdup(ret));
+}
+
+/**
+ * exsltDateMonthAbbreviationFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateMonthAbbreviation() for use by the XPath engine.
+ */
+static void
+exsltDateMonthAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    const xmlChar *ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateMonthAbbreviation(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, xmlStrdup(ret));
+}
+
+/**
+ * exsltDateWeekInYearFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateWeekInYear() for use by the XPath engine.
+ */
+X_IN_Y(Week,Year)
+
+/**
+ * exsltDateWeekInMonthFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateWeekInMonthYear() for use by the XPath engine.
+ */
+X_IN_Y(Week,Month)
+
+/**
+ * exsltDateDayInYearFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDayInYear() for use by the XPath engine.
+ */
+X_IN_Y(Day,Year)
+
+/**
+ * exsltDateDayInMonthFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDayInMonth() for use by the XPath engine.
+ */
+X_IN_Y(Day,Month)
+
+/**
+ * exsltDateDayOfWeekInMonthFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDayOfWeekInMonth() for use by the XPath engine.
+ */
+X_IN_Y(DayOfWeek,Month)
+
+/**
+ * exsltDateDayInWeekFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDayInWeek() for use by the XPath engine.
+ */
+X_IN_Y(Day,Week)
+
+/**
+ * exsltDateDayNameFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDayName() for use by the XPath engine.
+ */
+static void
+exsltDateDayNameFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    const xmlChar *ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateDayName(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, xmlStrdup(ret));
+}
+
+/**
+ * exsltDateMonthDayFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDayAbbreviation() for use by the XPath engine.
+ */
+static void
+exsltDateDayAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *dt = NULL;
+    const xmlChar *ret;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	dt = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateDayAbbreviation(dt);
+
+    if (dt != NULL)
+	xmlFree(dt);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, xmlStrdup(ret));
+}
+
+
+/**
+ * exsltDateHourInDayFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateHourInDay() for use by the XPath engine.
+ */
+X_IN_Y(Hour,Day)
+
+/**
+ * exsltDateMinuteInHourFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateMinuteInHour() for use by the XPath engine.
+ */
+X_IN_Y(Minute,Hour)
+
+/**
+ * exsltDateSecondInMinuteFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateSecondInMinute() for use by the XPath engine.
+ */
+X_IN_Y(Second,Minute)
+
+/**
+ * exsltDateSecondsFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateSeconds() for use by the XPath engine.
+ */
+static void
+exsltDateSecondsFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *str = NULL;
+    double   ret;
+
+    if (nargs > 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	str = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateSeconds(str);
+    if (str != NULL)
+	xmlFree(str);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltDateAddFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps exsltDateAdd() for use by the XPath processor.
+ */
+static void
+exsltDateAddFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret, *xstr, *ystr;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ystr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    xstr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+        xmlFree(ystr);
+	return;
+    }
+
+    ret = exsltDateAdd(xstr, ystr);
+
+    xmlFree(ystr);
+    xmlFree(xstr);
+
+    if (ret == NULL)
+        xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, ret);
+}
+
+/**
+ * exsltDateAddDurationFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps exsltDateAddDuration() for use by the XPath processor.
+ */
+static void
+exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret, *xstr, *ystr;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ystr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    xstr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+        xmlFree(ystr);
+	return;
+    }
+
+    ret = exsltDateAddDuration(xstr, ystr);
+
+    xmlFree(ystr);
+    xmlFree(xstr);
+
+    if (ret == NULL)
+        xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, ret);
+}
+
+/**
+ * exsltDateDifferenceFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps exsltDateDifference() for use by the XPath processor.
+ */
+static void
+exsltDateDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret, *xstr, *ystr;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ystr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    xstr = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+        xmlFree(ystr);
+	return;
+    }
+
+    ret = exsltDateDifference(xstr, ystr);
+
+    xmlFree(ystr);
+    xmlFree(xstr);
+
+    if (ret == NULL)
+        xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, ret);
+}
+
+/**
+ * exsltDateDurationFunction:
+ * @ctxt: an XPath parser context
+ * @nargs : the number of arguments
+ *
+ * Wraps exsltDateDuration() for use by the XPath engine
+ */
+static void
+exsltDateDurationFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *ret;
+    xmlChar *number = NULL;
+
+    if ((nargs < 0) || (nargs > 1)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 1) {
+	number = xmlXPathPopString(ctxt);
+	if (xmlXPathCheckError(ctxt)) {
+	    xmlXPathSetTypeError(ctxt);
+	    return;
+	}
+    }
+
+    ret = exsltDateDuration(number);
+
+    if (number != NULL)
+	xmlFree(number);
+
+    if (ret == NULL)
+	xmlXPathReturnEmptyString(ctxt);
+    else
+	xmlXPathReturnString(ctxt, ret);
+}
+
+/**
+ * exsltDateRegister:
+ *
+ * Registers the EXSLT - Dates and Times module
+ */
+void
+exsltDateRegister (void)
+{
+    xsltRegisterExtModuleFunction ((const xmlChar *) "add",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateAddFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "add-duration",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateAddDurationFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "date",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDateFunction);
+#ifdef WITH_TIME
+    xsltRegisterExtModuleFunction ((const xmlChar *) "date-time",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDateTimeFunction);
+#endif
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-abbreviation",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayAbbreviationFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-month",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayInMonthFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-week",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayInWeekFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-year",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayInYearFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-name",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayNameFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "day-of-week-in-month",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDayOfWeekInMonthFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "difference",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDifferenceFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "duration",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateDurationFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "hour-in-day",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateHourInDayFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "leap-year",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateLeapYearFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "minute-in-hour",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateMinuteInHourFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "month-abbreviation",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateMonthAbbreviationFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "month-in-year",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateMonthInYearFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "month-name",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateMonthNameFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "second-in-minute",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateSecondInMinuteFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "seconds",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateSecondsFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "sum",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateSumFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "time",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateTimeFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-month",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateWeekInMonthFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-year",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateWeekInYearFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "year",
+				   (const xmlChar *) EXSLT_DATE_NAMESPACE,
+				   exsltDateYearFunction);
+}
diff --git a/third_party/libxslt/libexslt/dynamic.c b/third_party/libxslt/libexslt/dynamic.c
new file mode 100644
index 0000000..607860b
--- /dev/null
+++ b/third_party/libxslt/libexslt/dynamic.c
@@ -0,0 +1,287 @@
+/*
+ * dynamic.c: Implementation of the EXSLT -- Dynamic module
+ *
+ * References:
+ *   http://www.exslt.org/dyn/dyn.html
+ *
+ * See Copyright for the status of this software.
+ *
+ * Authors:
+ *   Mark Vakoc 
+ *   Thomas Broyer 
+ *
+ * TODO:
+ * elements:
+ * functions:
+ *    min
+ *    max
+ *    sum
+ *    map
+ *    closure
+ */
+
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+/**
+ * exsltDynEvaluateFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Evaluates the string as an XPath expression and returns the result
+ * value, which may be a boolean, number, string, node set, result tree
+ * fragment or external object.
+ */
+
+static void
+exsltDynEvaluateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+	xmlChar *str = NULL;
+	xmlXPathObjectPtr ret = NULL;
+
+	if (ctxt == NULL)
+		return;
+	if (nargs != 1) {
+		xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL);
+        xsltGenericError(xsltGenericErrorContext,
+			"dyn:evalute() : invalid number of args %d\n", nargs);
+		ctxt->error = XPATH_INVALID_ARITY;
+		return;
+	}
+	str = xmlXPathPopString(ctxt);
+	/* return an empty node-set if an empty string is passed in */
+	if (!str||!xmlStrlen(str)) {
+		if (str) xmlFree(str);
+		valuePush(ctxt,xmlXPathNewNodeSet(NULL));
+		return;
+	}
+	ret = xmlXPathEval(str,ctxt->context);
+	if (ret)
+		valuePush(ctxt,ret);
+ 	else {
+		xsltGenericError(xsltGenericErrorContext,
+			"dyn:evaluate() : unable to evaluate expression '%s'\n",str);
+		valuePush(ctxt,xmlXPathNewNodeSet(NULL));
+	}	
+	xmlFree(str);
+	return;
+}
+
+/**
+ * exsltDynMapFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Evaluates the string as an XPath expression and returns the result
+ * value, which may be a boolean, number, string, node set, result tree
+ * fragment or external object.
+ */
+
+static void
+exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlChar *str = NULL;
+    xmlNodeSetPtr nodeset = NULL;
+    xsltTransformContextPtr tctxt;
+    xmlXPathCompExprPtr comp = NULL;
+    xmlXPathObjectPtr ret = NULL;
+    xmlDocPtr oldDoc, container = NULL;
+    xmlNodePtr oldNode;
+    int oldContextSize;
+    int oldProximityPosition;
+    int i, j;
+
+
+    if (nargs != 2) {
+        xmlXPathSetArityError(ctxt);
+        return;
+    }
+    str = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+        xmlXPathSetTypeError(ctxt);
+        return;
+    }
+
+    nodeset = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+        xmlXPathSetTypeError(ctxt);
+        return;
+    }
+    if (str == NULL || !xmlStrlen(str) || !(comp = xmlXPathCompile(str))) {
+        if (nodeset != NULL)
+            xmlXPathFreeNodeSet(nodeset);
+        if (str != NULL)
+            xmlFree(str);
+        valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+        return;
+    }
+
+    ret = xmlXPathNewNodeSet(NULL);
+    if (ret == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+                         "exsltDynMapFunction: ret == NULL\n");
+        goto cleanup;
+    }
+
+    oldDoc = ctxt->context->doc;
+    oldNode = ctxt->context->node;
+    oldContextSize = ctxt->context->contextSize;
+    oldProximityPosition = ctxt->context->proximityPosition;
+
+        /** 
+	 * since we really don't know we're going to be adding node(s) 
+	 * down the road we create the RVT regardless 
+	 */
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	      "dyn:map : internal error tctxt == NULL\n");
+	goto cleanup;
+    }
+    container = xsltCreateRVT(tctxt);
+    if (container == NULL) {
+	xsltTransformError(tctxt, NULL, NULL,
+	      "dyn:map : internal error container == NULL\n");
+	goto cleanup;
+    }
+    xsltRegisterLocalRVT(tctxt, container);
+    if (nodeset && nodeset->nodeNr > 0) {
+        xmlXPathNodeSetSort(nodeset);
+        ctxt->context->contextSize = nodeset->nodeNr;
+        ctxt->context->proximityPosition = 0;
+        for (i = 0; i < nodeset->nodeNr; i++) {
+            xmlXPathObjectPtr subResult = NULL;
+
+            ctxt->context->proximityPosition++;
+            ctxt->context->node = nodeset->nodeTab[i];
+            ctxt->context->doc = nodeset->nodeTab[i]->doc;
+
+            subResult = xmlXPathCompiledEval(comp, ctxt->context);
+            if (subResult != NULL) {
+                switch (subResult->type) {
+                    case XPATH_NODESET:
+                        if (subResult->nodesetval != NULL)
+                            for (j = 0; j < subResult->nodesetval->nodeNr;
+                                 j++)
+                                xmlXPathNodeSetAdd(ret->nodesetval,
+                                                   subResult->nodesetval->
+                                                   nodeTab[j]);
+                        break;
+                    case XPATH_BOOLEAN:
+                        if (container != NULL) {
+                            xmlNodePtr cur =
+                                xmlNewChild((xmlNodePtr) container, NULL,
+                                            BAD_CAST "boolean",
+                                            BAD_CAST (subResult->
+                                            boolval ? "true" : ""));
+                            if (cur != NULL) {
+                                cur->ns =
+                                    xmlNewNs(cur,
+                                             BAD_CAST
+                                             "http://exslt.org/common",
+                                             BAD_CAST "exsl");
+                                xmlXPathNodeSetAddUnique(ret->nodesetval,
+                                                         cur);
+                            }
+			    xsltExtensionInstructionResultRegister(tctxt, ret);
+                        }
+                        break;
+                    case XPATH_NUMBER:
+                        if (container != NULL) {
+                            xmlChar *val =
+                                xmlXPathCastNumberToString(subResult->
+                                                           floatval);
+                            xmlNodePtr cur =
+                                xmlNewChild((xmlNodePtr) container, NULL,
+                                            BAD_CAST "number", val);
+                            if (val != NULL)
+                                xmlFree(val);
+
+                            if (cur != NULL) {
+                                cur->ns =
+                                    xmlNewNs(cur,
+                                             BAD_CAST
+                                             "http://exslt.org/common",
+                                             BAD_CAST "exsl");
+                                xmlXPathNodeSetAddUnique(ret->nodesetval,
+                                                         cur);
+                            }
+			    xsltExtensionInstructionResultRegister(tctxt, ret);
+                        }
+                        break;
+                    case XPATH_STRING:
+                        if (container != NULL) {
+                            xmlNodePtr cur =
+                                xmlNewChild((xmlNodePtr) container, NULL,
+                                            BAD_CAST "string",
+                                            subResult->stringval);
+                            if (cur != NULL) {
+                                cur->ns =
+                                    xmlNewNs(cur,
+                                             BAD_CAST
+                                             "http://exslt.org/common",
+                                             BAD_CAST "exsl");
+                                xmlXPathNodeSetAddUnique(ret->nodesetval,
+                                                         cur);
+                            }
+			    xsltExtensionInstructionResultRegister(tctxt, ret);
+                        }
+                        break;
+		    default:
+                        break;
+                }
+                xmlXPathFreeObject(subResult);
+            }
+        }
+    }
+    ctxt->context->doc = oldDoc;
+    ctxt->context->node = oldNode;
+    ctxt->context->contextSize = oldContextSize;
+    ctxt->context->proximityPosition = oldProximityPosition;
+
+
+  cleanup:
+    /* restore the xpath context */
+    if (comp != NULL)
+        xmlXPathFreeCompExpr(comp);
+    if (nodeset != NULL)
+        xmlXPathFreeNodeSet(nodeset);
+    if (str != NULL)
+        xmlFree(str);
+    valuePush(ctxt, ret);
+    return;
+}
+
+
+/**
+ * exsltDynRegister:
+ *
+ * Registers the EXSLT - Dynamic module
+ */
+
+void
+exsltDynRegister (void) {
+    xsltRegisterExtModuleFunction ((const xmlChar *) "evaluate",
+				   EXSLT_DYNAMIC_NAMESPACE,
+				   exsltDynEvaluateFunction);
+  xsltRegisterExtModuleFunction ((const xmlChar *) "map",
+				   EXSLT_DYNAMIC_NAMESPACE,
+				   exsltDynMapFunction);
+
+}
diff --git a/third_party/libxslt/libexslt/exslt.c b/third_party/libxslt/libexslt/exslt.c
new file mode 100644
index 0000000..c20ec5d
--- /dev/null
+++ b/third_party/libxslt/libexslt/exslt.c
@@ -0,0 +1,39 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#include 
+
+#include "config.h"
+
+#include 
+#include 
+
+#include "exsltconfig.h"
+#include "exslt.h"
+
+const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING 
+				LIBEXSLT_VERSION_EXTRA;
+const int exsltLibexsltVersion = LIBEXSLT_VERSION;
+const int exsltLibxsltVersion = LIBXSLT_VERSION;
+const int exsltLibxmlVersion = LIBXML_VERSION;
+
+/**
+ * exsltRegisterAll:
+ *
+ * Registers all available EXSLT extensions
+ */
+void
+exsltRegisterAll (void) {
+    exsltCommonRegister();
+#ifdef EXSLT_CRYPTO_ENABLED
+    exsltCryptoRegister();
+#endif
+    exsltMathRegister();
+    exsltSetsRegister();
+    exsltFuncRegister();
+    exsltStrRegister();
+    exsltDateRegister();
+    exsltSaxonRegister();
+    exsltDynRegister();
+}
+
diff --git a/third_party/libxslt/libexslt/exslt.h b/third_party/libxslt/libexslt/exslt.h
new file mode 100644
index 0000000..a50e95c
--- /dev/null
+++ b/third_party/libxslt/libexslt/exslt.h
@@ -0,0 +1,92 @@
+
+#ifndef __EXSLT_H__
+#define __EXSLT_H__
+
+#include 
+#include "exsltexports.h"
+#include "exsltconfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EXSLTPUBVAR const char *exsltLibraryVersion;
+EXSLTPUBVAR const int exsltLibexsltVersion;
+EXSLTPUBVAR const int exsltLibxsltVersion;
+EXSLTPUBVAR const int exsltLibxmlVersion;
+
+/**
+ * EXSLT_COMMON_NAMESPACE:
+ *
+ * Namespace for EXSLT common functions
+ */
+#define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common")
+/**
+ * EXSLT_CRYPTO_NAMESPACE:
+ *
+ * Namespace for EXSLT crypto functions
+ */
+#define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto")
+/**
+ * EXSLT_MATH_NAMESPACE:
+ *
+ * Namespace for EXSLT math functions
+ */
+#define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math")
+/**
+ * EXSLT_SETS_NAMESPACE:
+ *
+ * Namespace for EXSLT set functions
+ */
+#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets")
+/**
+ * EXSLT_FUNCTIONS_NAMESPACE:
+ *
+ * Namespace for EXSLT functions extension functions
+ */
+#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions")
+/**
+ * EXSLT_STRINGS_NAMESPACE:
+ *
+ * Namespace for EXSLT strings functions
+ */
+#define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings")
+/**
+ * EXSLT_DATE_NAMESPACE:
+ *
+ * Namespace for EXSLT date functions
+ */
+#define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times")
+/**
+ * EXSLT_DYNAMIC_NAMESPACE:
+ *
+ * Namespace for EXSLT dynamic functions
+ */
+#define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic")
+
+/**
+ * SAXON_NAMESPACE:
+ *
+ * Namespace for SAXON extensions functions
+ */
+#define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon")
+
+EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void);
+#ifdef EXSLT_CRYPTO_ENABLED
+EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void);
+#endif
+EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void);
+EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void);
+
+EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __EXSLT_H__ */
+
diff --git a/third_party/libxslt/libexslt/exsltconfig.h b/third_party/libxslt/libexslt/exsltconfig.h
new file mode 100644
index 0000000..ba527c8
--- /dev/null
+++ b/third_party/libxslt/libexslt/exsltconfig.h
@@ -0,0 +1,73 @@
+/*
+ * exsltconfig.h: compile-time version informations for the EXSLT library
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#ifndef __XML_EXSLTCONFIG_H__
+#define __XML_EXSLTCONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * LIBEXSLT_DOTTED_VERSION:
+ *
+ * the version string like "1.2.3"
+ */
+#define LIBEXSLT_DOTTED_VERSION "0.8.13"
+
+/**
+ * LIBEXSLT_VERSION:
+ *
+ * the version number: 1.2.3 value is 10203
+ */
+#define LIBEXSLT_VERSION 813
+
+/**
+ * LIBEXSLT_VERSION_STRING:
+ *
+ * the version number string, 1.2.3 value is "10203"
+ */
+#define LIBEXSLT_VERSION_STRING "813"
+
+/**
+ * LIBEXSLT_VERSION_EXTRA:
+ *
+ * extra version information, used to show a CVS compilation
+ */
+#define	LIBEXSLT_VERSION_EXTRA ""
+
+/**
+ * WITH_CRYPTO:
+ *
+ * Whether crypto support is configured into exslt
+ */
+#if 1
+#define EXSLT_CRYPTO_ENABLED
+#endif
+
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * This macro is used to flag unused function parameters to GCC
+ */
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include 
+#endif
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_EXSLTCONFIG_H__ */
diff --git a/third_party/libxslt/libexslt/exsltconfig.h.in b/third_party/libxslt/libexslt/exsltconfig.h.in
new file mode 100644
index 0000000..b46ffc0
--- /dev/null
+++ b/third_party/libxslt/libexslt/exsltconfig.h.in
@@ -0,0 +1,73 @@
+/*
+ * exsltconfig.h: compile-time version informations for the EXSLT library
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#ifndef __XML_EXSLTCONFIG_H__
+#define __XML_EXSLTCONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * LIBEXSLT_DOTTED_VERSION:
+ *
+ * the version string like "1.2.3"
+ */
+#define LIBEXSLT_DOTTED_VERSION "@VERSION@"
+
+/**
+ * LIBEXSLT_VERSION:
+ *
+ * the version number: 1.2.3 value is 10203
+ */
+#define LIBEXSLT_VERSION @LIBEXSLT_VERSION_NUMBER@
+
+/**
+ * LIBEXSLT_VERSION_STRING:
+ *
+ * the version number string, 1.2.3 value is "10203"
+ */
+#define LIBEXSLT_VERSION_STRING "@LIBEXSLT_VERSION_NUMBER@"
+
+/**
+ * LIBEXSLT_VERSION_EXTRA:
+ *
+ * extra version information, used to show a CVS compilation
+ */
+#define	LIBEXSLT_VERSION_EXTRA "@LIBEXSLT_VERSION_EXTRA@"
+
+/**
+ * WITH_CRYPTO:
+ *
+ * Whether crypto support is configured into exslt
+ */
+#if @WITH_CRYPTO@
+#define EXSLT_CRYPTO_ENABLED
+#endif
+
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * This macro is used to flag unused function parameters to GCC
+ */
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include 
+#endif
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_EXSLTCONFIG_H__ */
diff --git a/third_party/libxslt/libexslt/exsltexports.h b/third_party/libxslt/libexslt/exsltexports.h
new file mode 100644
index 0000000..bead915
--- /dev/null
+++ b/third_party/libxslt/libexslt/exsltexports.h
@@ -0,0 +1,140 @@
+/*
+ * exsltexports.h : macros for marking symbols as exportable/importable.
+ *
+ * See Copyright for the status of this software.
+ *
+ * igor@zlatkovic.com
+ */
+
+#ifndef __EXSLT_EXPORTS_H__
+#define __EXSLT_EXPORTS_H__
+
+/**
+ * EXSLTPUBFUN, EXSLTPUBVAR, EXSLTCALL
+ *
+ * Macros which declare an exportable function, an exportable variable and
+ * the calling convention used for functions.
+ *
+ * Please use an extra block for every platform/compiler combination when
+ * modifying this, rather than overlong #ifdef lines. This helps
+ * readability as well as the fact that different compilers on the same
+ * platform might need different definitions.
+ */
+
+/**
+ * EXSLTPUBFUN:
+ *
+ * Macros which declare an exportable function
+ */
+#define EXSLTPUBFUN
+/**
+ * EXSLTPUBVAR:
+ *
+ * Macros which declare an exportable variable
+ */
+#define EXSLTPUBVAR extern
+/**
+ * EXSLTCALL:
+ *
+ * Macros which declare the called convention for exported functions
+ */
+#define EXSLTCALL
+
+/** DOC_DISABLE */
+
+/* Windows platform with MS compiler */
+#if defined(_WIN32) && defined(_MSC_VER)
+  #undef EXSLTPUBFUN
+  #undef EXSLTPUBVAR
+  #undef EXSLTCALL
+  #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
+    #define EXSLTPUBFUN __declspec(dllexport)
+    #define EXSLTPUBVAR __declspec(dllexport)
+  #else
+    #define EXSLTPUBFUN
+    #if !defined(LIBEXSLT_STATIC)
+      #define EXSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define EXSLTPUBVAR extern
+    #endif
+  #endif
+  #define EXSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Windows platform with Borland compiler */
+#if defined(_WIN32) && defined(__BORLANDC__)
+  #undef EXSLTPUBFUN
+  #undef EXSLTPUBVAR
+  #undef EXSLTCALL
+  #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
+    #define EXSLTPUBFUN __declspec(dllexport)
+    #define EXSLTPUBVAR __declspec(dllexport) extern
+  #else
+    #define EXSLTPUBFUN
+    #if !defined(LIBEXSLT_STATIC)
+      #define EXSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define EXSLTPUBVAR extern
+    #endif
+  #endif
+  #define EXSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Windows platform with GNU compiler (Mingw) */
+#if defined(_WIN32) && defined(__MINGW32__)
+  #undef EXSLTPUBFUN
+  #undef EXSLTPUBVAR
+  #undef EXSLTCALL
+/*
+  #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
+*/
+  #if !defined(LIBEXSLT_STATIC)
+    #define EXSLTPUBFUN __declspec(dllexport)
+    #define EXSLTPUBVAR __declspec(dllexport) extern
+  #else
+    #define EXSLTPUBFUN
+    #if !defined(LIBEXSLT_STATIC)
+      #define EXSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define EXSLTPUBVAR extern
+    #endif
+  #endif
+  #define EXSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Cygwin platform, GNU compiler */
+#if defined(_WIN32) && defined(__CYGWIN__)
+  #undef EXSLTPUBFUN
+  #undef EXSLTPUBVAR
+  #undef EXSLTCALL
+  #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
+    #define EXSLTPUBFUN __declspec(dllexport)
+    #define EXSLTPUBVAR __declspec(dllexport)
+  #else
+    #define EXSLTPUBFUN
+    #if !defined(LIBEXSLT_STATIC)
+      #define EXSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define EXSLTPUBVAR
+    #endif
+  #endif
+  #define EXSLTCALL __cdecl
+#endif
+
+/* Compatibility */
+#if !defined(LIBEXSLT_PUBLIC)
+#define LIBEXSLT_PUBLIC EXSLTPUBVAR
+#endif
+
+#endif /* __EXSLT_EXPORTS_H__ */
+
+
diff --git a/third_party/libxslt/libexslt/functions.c b/third_party/libxslt/libexslt/functions.c
new file mode 100644
index 0000000..bef4a5a4a
--- /dev/null
+++ b/third_party/libxslt/libexslt/functions.c
@@ -0,0 +1,762 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+typedef struct _exsltFuncFunctionData exsltFuncFunctionData;
+struct _exsltFuncFunctionData {
+    int nargs;			/* number of arguments to the function */
+    xmlNodePtr content;		/* the func:fuction template content */
+};
+
+typedef struct _exsltFuncData exsltFuncData;
+struct _exsltFuncData {
+    xmlHashTablePtr funcs;	/* pointer to the stylesheet module data */
+    xmlXPathObjectPtr result;	/* returned by func:result */
+    int error;			/* did an error occur? */
+    xmlDocPtr RVT;   /* result tree fragment */
+};
+
+typedef struct _exsltFuncResultPreComp exsltFuncResultPreComp;
+struct _exsltFuncResultPreComp {
+    xsltElemPreComp comp;
+    xmlXPathCompExprPtr select;
+    xmlNsPtr *nsList;
+    int nsNr;
+};
+
+/* Used for callback function in exsltInitFunc */
+typedef struct _exsltFuncImportRegData exsltFuncImportRegData;
+struct _exsltFuncImportRegData {
+    xsltTransformContextPtr ctxt;
+    xmlHashTablePtr hash;
+};
+
+static void exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt,
+				       int nargs);
+static exsltFuncFunctionData *exsltFuncNewFunctionData(void);
+
+/*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/
+
+/**
+ * exsltFuncRegisterFunc:
+ * @func:  the #exsltFuncFunctionData for the function
+ * @ctxt:  an XSLT transformation context
+ * @URI:  the function namespace URI
+ * @name: the function name
+ *
+ * Registers a function declared by a func:function element
+ */
+static void
+exsltFuncRegisterFunc (exsltFuncFunctionData *data,
+		       xsltTransformContextPtr ctxt,
+		       const xmlChar *URI, const xmlChar *name,
+		       ATTRIBUTE_UNUSED const xmlChar *ignored) {
+    if ((data == NULL) || (ctxt == NULL) || (URI == NULL) || (name == NULL))
+	return;
+
+    xsltGenericDebug(xsltGenericDebugContext,
+		     "exsltFuncRegisterFunc: register {%s}%s\n",
+		     URI, name);
+    xsltRegisterExtFunction(ctxt, name, URI,
+			    exsltFuncFunctionFunction);
+}
+
+/*
+ * exsltFuncRegisterImportFunc
+ * @data:    the exsltFuncFunctionData for the function
+ * @ch:	     structure containing context and hash table
+ * @URI:     the function namespace URI
+ * @name:    the function name
+ *
+ * Checks if imported function is already registered in top-level
+ * stylesheet.  If not, copies function data and registers function
+ */
+static void
+exsltFuncRegisterImportFunc (exsltFuncFunctionData *data,
+			     exsltFuncImportRegData *ch,
+			     const xmlChar *URI, const xmlChar *name,
+			     ATTRIBUTE_UNUSED const xmlChar *ignored) {
+    exsltFuncFunctionData *func=NULL;
+
+    if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL))
+            return;
+
+    if (ch->ctxt == NULL || ch->hash == NULL)
+    	return;
+
+    /* Check if already present */
+    func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name);
+    if (func == NULL) {		/* Not yet present - copy it in */
+    	func = exsltFuncNewFunctionData();
+	memcpy(func, data, sizeof(exsltFuncFunctionData));
+	if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) {
+	    xsltGenericError(xsltGenericErrorContext,
+	    	    "Failed to register function {%s}%s\n",
+		    URI, name);
+	} else {		/* Do the registration */
+	    xsltGenericDebug(xsltGenericDebugContext,
+	            "exsltFuncRegisterImportFunc: register {%s}%s\n",
+		    URI, name);
+	    xsltRegisterExtFunction(ch->ctxt, name, URI,
+		    exsltFuncFunctionFunction);
+	}
+    }
+}
+
+/**
+ * exsltFuncInit:
+ * @ctxt: an XSLT transformation context
+ * @URI: the namespace URI for the extension
+ *
+ * Initializes the EXSLT - Functions module.
+ * Called at transformation-time; merges all
+ * functions declared in the import tree taking
+ * import precedence into account, i.e. overriding
+ * functions with lower import precedence.
+ *
+ * Returns the data for this transformation
+ */
+static exsltFuncData *
+exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
+    exsltFuncData *ret;
+    xsltStylesheetPtr tmp;
+    exsltFuncImportRegData ch;
+    xmlHashTablePtr hash;
+    
+    ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
+    if (ret == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncInit: not enough memory\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(exsltFuncData));
+
+    ret->result = NULL;
+    ret->error = 0;
+
+    ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI);
+    ret->funcs = ch.hash;
+    xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt);
+    tmp = ctxt->style;
+    ch.ctxt = ctxt;
+    while ((tmp=xsltNextImport(tmp))!=NULL) {
+	hash = xsltGetExtInfo(tmp, URI);
+	if (hash != NULL) {
+	    xmlHashScanFull(hash, 
+		    (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch);
+	}
+    }
+
+    return(ret);
+}
+
+/**
+ * exsltFuncShutdown:
+ * @ctxt: an XSLT transformation context
+ * @URI: the namespace URI for the extension
+ * @data: the module data to free up
+ *  
+ * Shutdown the EXSLT - Functions module
+ * Called at transformation-time.
+ */
+static void
+exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		   const xmlChar *URI ATTRIBUTE_UNUSED,
+		   exsltFuncData *data) {
+    if (data->result != NULL)
+	xmlXPathFreeObject(data->result);
+    xmlFree(data);
+}
+
+/**
+ * exsltFuncStyleInit:
+ * @style: an XSLT stylesheet
+ * @URI: the namespace URI for the extension
+ *
+ * Allocates the stylesheet data for EXSLT - Function
+ * Called at compile-time.
+ *
+ * Returns the allocated data
+ */
+static xmlHashTablePtr
+exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
+		    const xmlChar *URI ATTRIBUTE_UNUSED) {
+    return xmlHashCreate(1);
+}
+
+/**
+ * exsltFuncStyleShutdown:
+ * @style: an XSLT stylesheet
+ * @URI: the namespace URI for the extension
+ * @data: the stylesheet data to free up 
+ *
+ * Shutdown the EXSLT - Function module
+ * Called at compile-time.
+ */
+static void
+exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
+			const xmlChar *URI ATTRIBUTE_UNUSED,
+			xmlHashTablePtr data) {
+    xmlHashFree(data, (xmlHashDeallocator) xmlFree);
+}
+
+/**
+ * exsltFuncNewFunctionData:
+ *
+ * Allocates an #exslFuncFunctionData object
+ *
+ * Returns the new structure
+ */
+static exsltFuncFunctionData *
+exsltFuncNewFunctionData (void) {
+    exsltFuncFunctionData *ret;
+
+    ret = (exsltFuncFunctionData *) xmlMalloc (sizeof(exsltFuncFunctionData));
+    if (ret == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncNewFunctionData: not enough memory\n");
+	return (NULL);
+    }
+    memset(ret, 0, sizeof(exsltFuncFunctionData));
+
+    ret->nargs = 0;
+    ret->content = NULL;
+
+    return(ret);
+}
+
+/**
+ * exsltFreeFuncResultPreComp:
+ * @comp:  the #exsltFuncResultPreComp to free up
+ *
+ * Deallocates an #exsltFuncResultPreComp
+ */
+static void
+exsltFreeFuncResultPreComp (exsltFuncResultPreComp *comp) {
+    if (comp == NULL)
+	return;
+
+    if (comp->select != NULL)
+	xmlXPathFreeCompExpr (comp->select);
+    if (comp->nsList != NULL)
+        xmlFree(comp->nsList);
+    xmlFree(comp);
+}
+
+/**
+ * exsltFuncFunctionFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Evaluates the func:function element that defines the called function.
+ */
+static void
+exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlXPathObjectPtr oldResult, ret;
+    exsltFuncData *data;
+    exsltFuncFunctionData *func;
+    xmlNodePtr paramNode, oldInsert, fake;
+    int oldBase;
+    xsltStackElemPtr params = NULL, param;
+    xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
+    int i, notSet;
+    struct objChain {
+	struct objChain *next;
+	xmlXPathObjectPtr obj;
+    };
+    struct objChain	*savedObjChain = NULL, *savedObj;
+
+    /*
+     * retrieve func:function template
+     */
+    data = (exsltFuncData *) xsltGetExtData (tctxt,
+					     EXSLT_FUNCTIONS_NAMESPACE);
+    oldResult = data->result;
+    data->result = NULL;
+
+    func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs,
+						    ctxt->context->functionURI,
+						    ctxt->context->function);
+
+    /*
+     * params handling
+     */
+    if (nargs > func->nargs) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "{%s}%s: called with too many arguments\n",
+			 ctxt->context->functionURI, ctxt->context->function);
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    if (func->content != NULL) {
+	paramNode = func->content->prev;
+    }
+    else
+	paramNode = NULL;
+    if ((paramNode == NULL) && (func->nargs != 0)) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncFunctionFunction: nargs != 0 and "
+			 "param == NULL\n");
+	return;
+    }
+    /*
+     * We have a problem with the evaluation of function parameters.
+     * The original library code did not evaluate XPath expressions until
+     * the last moment.  After version 1.1.17 of the libxslt, the logic
+     * of other parts of the library was changed, and the evaluation of
+     * XPath expressions within parameters now takes place as soon as the
+     * parameter is parsed/evaluated (xsltParseStylesheetCallerParam).
+     * This means that the parameters need to be evaluated in lexical
+     * order (since a variable is "in scope" as soon as it is declared).
+     * However, on entry to this routine, the values (from the caller) are
+     * in reverse order (held on the XPath context variable stack).  To
+     * accomplish what is required, I have added code to pop the XPath
+     * objects off of the stack at the beginning and save them, then use
+     * them (in the reverse order) as the params are evaluated.  This
+     * requires an xmlMalloc/xmlFree for each param set by the caller,
+     * which is not very nice.  There is probably a much better solution
+     * (like change other code to delay the evaluation).
+     */
+    /* 
+     * In order to give the function params and variables a new 'scope'
+     * we change varsBase in the context.
+     */
+    oldBase = tctxt->varsBase;
+    tctxt->varsBase = tctxt->varsNr;
+    /* If there are any parameters */
+    if (paramNode != NULL) {
+        /* Fetch the stored argument values from the caller */
+	for (i = 0; i < nargs; i++) {
+	    savedObj = xmlMalloc(sizeof(struct objChain));
+	    savedObj->next = savedObjChain;
+	    savedObj->obj = valuePop(ctxt);
+	    savedObjChain = savedObj;
+	}
+
+	/*
+	 * Prepare to process params in reverse order.  First, go to
+	 * the beginning of the param chain.
+	 */
+	for (i = 1; i <= func->nargs; i++) {
+	    if (paramNode->prev == NULL)
+	        break;
+	    paramNode = paramNode->prev;
+	}
+	/*
+	 * i has total # params found, nargs is number which are present
+	 * as arguments from the caller
+	 * Calculate the number of un-set parameters
+	 */
+	notSet = func->nargs - nargs;
+	for (; i > 0; i--) {
+	    param = xsltParseStylesheetCallerParam (tctxt, paramNode);
+	    if (i > notSet) {	/* if parameter value set */
+		param->computed = 1;
+		if (param->value != NULL)
+		    xmlXPathFreeObject(param->value);
+		savedObj = savedObjChain;	/* get next val from chain */
+		param->value = savedObj->obj;
+		savedObjChain = savedObjChain->next;
+		xmlFree(savedObj);
+	    }
+	    xsltLocalVariablePush(tctxt, param, -1);
+	    param->next = params;
+	    params = param;
+	    paramNode = paramNode->next;
+	}
+    }
+    /*
+     * actual processing
+     */
+    fake = xmlNewDocNode(tctxt->output, NULL,
+			 (const xmlChar *)"fake", NULL);
+    oldInsert = tctxt->insert;
+    tctxt->insert = fake;
+    xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt),
+			  func->content, NULL, NULL);
+    xsltLocalVariablePop(tctxt, tctxt->varsBase, -2);
+    tctxt->insert = oldInsert;
+    tctxt->varsBase = oldBase;	/* restore original scope */
+    if (params != NULL)
+	xsltFreeStackElemList(params);    
+
+    if (data->error != 0)
+	goto error;
+
+    if (data->result != NULL) {
+	ret = data->result;
+    } else
+	ret = xmlXPathNewCString("");
+
+    data->result = oldResult;
+
+    /*
+     * It is an error if the instantiation of the template results in
+     * the generation of result nodes.
+     */
+    if (fake->children != NULL) {
+#ifdef LIBXML_DEBUG_ENABLED
+	xmlDebugDumpNode (stderr, fake, 1);
+#endif
+	xsltGenericError(xsltGenericErrorContext,
+			 "{%s}%s: cannot write to result tree while "
+			 "executing a function\n",
+			 ctxt->context->functionURI, ctxt->context->function);
+	xmlFreeNode(fake);
+	goto error;
+    }
+    xmlFreeNode(fake);
+    valuePush(ctxt, ret);
+
+error:
+    /*
+    * IMPORTANT: This enables previously tree fragments marked as
+    * being results of a function, to be garbage-collected after
+    * the calling process exits.
+    */
+    xsltExtensionInstructionResultFinalize(tctxt);
+}
+
+
+static void
+exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
+    xmlChar *name, *prefix;
+    xmlNsPtr ns;
+    xmlHashTablePtr data;
+    exsltFuncFunctionData *func;
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+
+    {
+	xmlChar *qname;
+
+	qname = xmlGetProp(inst, (const xmlChar *) "name");
+	name = xmlSplitQName2 (qname, &prefix);
+	xmlFree(qname);
+    }
+    if ((name == NULL) || (prefix == NULL)) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "func:function: not a QName\n");
+	if (name != NULL)
+	    xmlFree(name);
+	return;
+    }
+    /* namespace lookup */
+    ns = xmlSearchNs (inst->doc, inst, prefix);
+    if (ns == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "func:function: undeclared prefix %s\n",
+			 prefix);
+	xmlFree(name);
+	xmlFree(prefix);
+	return;
+    }
+    xmlFree(prefix);
+
+    /*
+     * Create function data
+     */
+    func = exsltFuncNewFunctionData();
+    func->content = inst->children;
+    while (IS_XSLT_ELEM(func->content) &&
+	   IS_XSLT_NAME(func->content, "param")) {
+	func->content = func->content->next;
+	func->nargs++;
+    }
+
+    xsltParseTemplateContent(style, inst);
+
+    /*
+     * Register the function data such that it can be retrieved
+     * by exslFuncFunctionFunction
+     */
+#ifdef XSLT_REFACTORED
+    /*
+    * Ensure that the hash table will be stored in the *current*
+    * stylesheet level in order to correctly evaluate the
+    * import precedence.
+    */
+    data = (xmlHashTablePtr)
+	xsltStyleStylesheetLevelGetExtData(style,
+	    EXSLT_FUNCTIONS_NAMESPACE);
+#else
+    data = (xmlHashTablePtr)
+	xsltStyleGetExtData (style, EXSLT_FUNCTIONS_NAMESPACE);
+#endif
+    if (data == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncFunctionComp: no stylesheet data\n");
+	xmlFree(name);
+	return;
+    }
+
+    if (xmlHashAddEntry2 (data, ns->href, name, func) < 0) {
+	xsltTransformError(NULL, style, inst,
+	    "Failed to register function {%s}%s\n",
+			 ns->href, name);
+	style->errors++;
+    } else {
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "exsltFuncFunctionComp: register {%s}%s\n",
+			 ns->href, name);
+    }
+    xmlFree(name);
+}
+
+static xsltElemPreCompPtr
+exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
+		     xsltTransformFunction function) {
+    xmlNodePtr test;
+    xmlChar *sel;
+    exsltFuncResultPreComp *ret;
+
+    /*
+     * "Validity" checking
+     */
+    /* it is an error to have any following sibling elements aside
+     * from the xsl:fallback element.
+     */
+    for (test = inst->next; test != NULL; test = test->next) {
+	if (test->type != XML_ELEMENT_NODE)
+	    continue;
+	if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback"))
+	    continue;
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncResultElem: only xsl:fallback is "
+			 "allowed to follow func:result\n");
+	return (NULL);
+    }
+    /* it is an error for a func:result element to not be a descendant
+     * of func:function.
+     * it is an error if a func:result occurs within a func:result
+     * element.
+     * it is an error if instanciating the content of a variable
+     * binding element (i.e. xsl:variable, xsl:param) results in the 
+     * instanciation of a func:result element.
+     */
+    for (test = inst->parent; test != NULL; test = test->parent) {
+	if (IS_XSLT_ELEM(test) &&
+	    IS_XSLT_NAME(test, "stylesheet")) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "func:result element not a descendant "
+			     "of a func:function\n");
+	    return (NULL);
+	}
+	if ((test->ns != NULL) &&
+	    (xmlStrEqual(test->ns->href, EXSLT_FUNCTIONS_NAMESPACE))) {
+	    if (xmlStrEqual(test->name, (const xmlChar *) "function")) {
+		break;
+	    }
+	    if (xmlStrEqual(test->name, (const xmlChar *) "result")) {
+		xsltGenericError(xsltGenericErrorContext,
+				 "func:result element not allowed within"
+				 " another func:result element\n");
+		return (NULL);
+	    }
+	}
+	if (IS_XSLT_ELEM(test) &&
+	    (IS_XSLT_NAME(test, "variable") ||
+	     IS_XSLT_NAME(test, "param"))) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "func:result element not allowed within"
+			     " a variable binding element\n");
+	    return (NULL);
+	}
+    }
+
+    /*
+     * Precomputation
+     */
+    ret = (exsltFuncResultPreComp *)
+	xmlMalloc (sizeof(exsltFuncResultPreComp));
+    if (ret == NULL) {
+	xsltPrintErrorContext(NULL, NULL, NULL);
+        xsltGenericError(xsltGenericErrorContext,
+                         "exsltFuncResultComp : malloc failed\n");
+        return (NULL);
+    }
+    memset(ret, 0, sizeof(exsltFuncResultPreComp));
+
+    xsltInitElemPreComp ((xsltElemPreCompPtr) ret, style, inst, function,
+		 (xsltElemPreCompDeallocator) exsltFreeFuncResultPreComp);
+    ret->select = NULL;
+
+    /*
+     * Precompute the select attribute
+     */
+    sel = xmlGetNsProp(inst, (const xmlChar *) "select", NULL);
+    if (sel != NULL) {
+	ret->select = xmlXPathCompile (sel);
+	xmlFree(sel);
+    }
+    /*
+     * Precompute the namespace list
+     */
+    ret->nsList = xmlGetNsList(inst->doc, inst);
+    if (ret->nsList != NULL) {
+        int i = 0;
+        while (ret->nsList[i] != NULL)
+	    i++;
+	ret->nsNr = i;
+    }
+    return ((xsltElemPreCompPtr) ret);
+}
+
+static void
+exsltFuncResultElem (xsltTransformContextPtr ctxt,
+	             xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst,
+		     exsltFuncResultPreComp *comp) {
+    exsltFuncData *data;
+    xmlXPathObjectPtr ret;
+    
+
+    /* It is an error if instantiating the content of the
+     * func:function element results in the instantiation of more than
+     * one func:result elements.
+     */
+    data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
+    if (data == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "exsltFuncReturnElem: data == NULL\n");
+	return;
+    }
+    if (data->result != NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "func:result already instanciated\n");
+	data->error = 1;
+	return;
+    }
+    /*
+     * Processing
+     */
+    if (comp->select != NULL) {
+	xmlNsPtr *oldXPNsList;
+	int oldXPNsNr;
+	xmlNodePtr oldXPContextNode;
+	/* If the func:result element has a select attribute, then the
+	 * value of the attribute must be an expression and the
+	 * returned value is the object that results from evaluating
+	 * the expression. In this case, the content must be empty.
+	 */
+	if (inst->children != NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "func:result content must be empty if"
+			     " the function has a select attribute\n");
+	    data->error = 1;
+	    return;
+	}
+	oldXPNsList = ctxt->xpathCtxt->namespaces;
+	oldXPNsNr = ctxt->xpathCtxt->nsNr;
+	oldXPContextNode = ctxt->xpathCtxt->node;
+
+	ctxt->xpathCtxt->namespaces = comp->nsList;
+	ctxt->xpathCtxt->nsNr = comp->nsNr;
+
+	ret = xmlXPathCompiledEval(comp->select, ctxt->xpathCtxt);
+
+	ctxt->xpathCtxt->node = oldXPContextNode;
+	ctxt->xpathCtxt->nsNr = oldXPNsNr;
+	ctxt->xpathCtxt->namespaces = oldXPNsList;
+
+	if (ret == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "exsltFuncResultElem: ret == NULL\n");
+	    return;
+	}
+	/*
+	* Mark it as a function result in order to avoid garbage
+	* collecting of tree fragments before the function exits.
+	*/
+	xsltExtensionInstructionResultRegister(ctxt, ret);
+    } else if (inst->children != NULL) {
+	/* If the func:result element does not have a select attribute
+	 * and has non-empty content (i.e. the func:result element has
+	 * one or more child nodes), then the content of the
+	 * func:result element specifies the value.
+	 */
+	xmlNodePtr oldInsert;
+	xmlDocPtr container;
+
+	container = xsltCreateRVT(ctxt);
+	if (container == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "exsltFuncResultElem: out of memory\n");
+	    data->error = 1;
+	    return;
+	}
+	xsltRegisterLocalRVT(ctxt, container);	
+
+	oldInsert = ctxt->insert;
+	ctxt->insert = (xmlNodePtr) container;
+	xsltApplyOneTemplate (ctxt, ctxt->xpathCtxt->node,
+			      inst->children, NULL, NULL);
+	ctxt->insert = oldInsert;
+
+	ret = xmlXPathNewValueTree((xmlNodePtr) container);
+	if (ret == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+			     "exsltFuncResultElem: ret == NULL\n");
+	    data->error = 1;
+	} else {
+	    ret->boolval = 0; /* Freeing is not handled there anymore */
+	    /*
+	    * Mark it as a function result in order to avoid garbage
+	    * collecting of tree fragments before the function exits.
+	    */
+	    xsltExtensionInstructionResultRegister(ctxt, ret);
+	}
+    } else {
+	/* If the func:result element has empty content and does not
+	 * have a select attribute, then the returned value is an
+	 * empty string.
+	 */
+	ret = xmlXPathNewCString("");
+    }
+    data->result = ret;
+}
+
+/**
+ * exsltFuncRegister:
+ *
+ * Registers the EXSLT - Functions module
+ */
+void
+exsltFuncRegister (void) {
+    xsltRegisterExtModuleFull (EXSLT_FUNCTIONS_NAMESPACE,
+		       (xsltExtInitFunction) exsltFuncInit,
+		       (xsltExtShutdownFunction) exsltFuncShutdown,
+		       (xsltStyleExtInitFunction) exsltFuncStyleInit,
+		       (xsltStyleExtShutdownFunction) exsltFuncStyleShutdown);
+
+    xsltRegisterExtModuleTopLevel ((const xmlChar *) "function",
+				   EXSLT_FUNCTIONS_NAMESPACE,
+				   exsltFuncFunctionComp);
+    xsltRegisterExtModuleElement ((const xmlChar *) "result",
+			  EXSLT_FUNCTIONS_NAMESPACE,
+			  (xsltPreComputeFunction)exsltFuncResultComp,
+			  (xsltTransformFunction) exsltFuncResultElem);
+}
diff --git a/third_party/libxslt/libexslt/libexslt.h b/third_party/libxslt/libexslt/libexslt.h
new file mode 100644
index 0000000..4bdc047
--- /dev/null
+++ b/third_party/libxslt/libexslt/libexslt.h
@@ -0,0 +1,29 @@
+/*
+ * libexslt.h: internal header only used during the compilation of libexslt
+ *
+ * See COPYRIGHT for the status of this software
+ *
+ * Author: daniel@veillard.com
+ */
+
+#ifndef __XSLT_LIBEXSLT_H__
+#define __XSLT_LIBEXSLT_H__
+
+#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include "xsltconfig.h"
+#include 
+
+#if !defined LIBEXSLT_PUBLIC
+#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC
+#define LIBEXSLT_PUBLIC __declspec(dllimport)
+#else
+#define LIBEXSLT_PUBLIC 
+#endif
+#endif
+
+#endif /* ! __XSLT_LIBEXSLT_H__ */
diff --git a/third_party/libxslt/libexslt/math.c b/third_party/libxslt/libexslt/math.c
new file mode 100644
index 0000000..5c5720d
--- /dev/null
+++ b/third_party/libxslt/libexslt/math.c
@@ -0,0 +1,1108 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef HAVE_MATH_H
+#include 
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include 
+#endif
+
+#include "exslt.h"
+
+/**
+ * exsltMathMin:
+ * @ns:  a node-set
+ *
+ * Implements the EXSLT - Math min() function:
+ *    number math:min (node-set)
+ *
+ * Returns the minimum value of the nodes passed as the argument, or
+ *         xmlXPathNAN if @ns is NULL or empty or if one of the nodes
+ *         turns into NaN.
+ */
+static double
+exsltMathMin (xmlNodeSetPtr ns) {
+    double ret, cur;
+    int i;
+
+    if ((ns == NULL) || (ns->nodeNr == 0))
+	return(xmlXPathNAN);
+    ret = xmlXPathCastNodeToNumber(ns->nodeTab[0]);
+    if (xmlXPathIsNaN(ret))
+	return(xmlXPathNAN);
+    for (i = 1; i < ns->nodeNr; i++) {
+	cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]);
+	if (xmlXPathIsNaN(cur))
+	    return(xmlXPathNAN);
+	if (cur < ret)
+	    ret = cur;
+    }
+    return(ret);
+}
+
+/**
+ * exsltMathMinFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathMin for use by the XPath processor.
+ */
+static void
+exsltMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr ns;
+    double ret;
+    void *user = NULL;
+
+    if (nargs != 1) {
+	xsltGenericError(xsltGenericErrorContext,
+			 "math:min: invalid number of arguments\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    /* We need to delay the freeing of value->user */
+    if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+        user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = NULL;
+    }
+    ns = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathMin(ns);
+
+    xmlXPathFreeNodeSet(ns);
+    if (user != NULL)
+        xmlFreeNodeList((xmlNodePtr)user);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathMax:
+ * @ns:  a node-set
+ *
+ * Implements the EXSLT - Math max() function:
+ *    number math:max (node-set)
+ *
+ * Returns the maximum value of the nodes passed as arguments, or
+ *         xmlXPathNAN if @ns is NULL or empty or if one of the nodes
+ *         turns into NaN.
+ */
+static double
+exsltMathMax (xmlNodeSetPtr ns) {
+    double ret, cur;
+    int i;
+
+    if ((ns == NULL) || (ns->nodeNr == 0))
+	return(xmlXPathNAN);
+    ret = xmlXPathCastNodeToNumber(ns->nodeTab[0]);
+    if (xmlXPathIsNaN(ret))
+	return(xmlXPathNAN);
+    for (i = 1; i < ns->nodeNr; i++) {
+	cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]);
+	if (xmlXPathIsNaN(cur))
+	    return(xmlXPathNAN);
+	if (cur > ret)
+	    ret = cur;
+    }
+    return(ret);
+}
+
+/**
+ * exsltMathMaxFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathMax for use by the XPath processor.
+ */
+static void
+exsltMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr ns;
+    double ret;
+    void *user = NULL;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    /* We need to delay the freeing of value->user */
+    if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+	user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = 0;
+    }
+    ns = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathMax(ns);
+
+    xmlXPathFreeNodeSet(ns);
+
+    if (user != NULL)
+        xmlFreeNodeList((xmlNodePtr)user);
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathHighest:
+ * @ns:  a node-set
+ *
+ * Implements the EXSLT - Math highest() function:
+ *    node-set math:highest (node-set)
+ *
+ * Returns the nodes in the node-set whose value is the maximum value
+ *         for the node-set.
+ */
+static xmlNodeSetPtr
+exsltMathHighest (xmlNodeSetPtr ns) {
+    xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
+    double max, cur;
+    int i;
+
+    if ((ns == NULL) || (ns->nodeNr == 0))
+	return(ret);
+
+    max = xmlXPathCastNodeToNumber(ns->nodeTab[0]);
+    if (xmlXPathIsNaN(max))
+	return(ret);
+    else
+	xmlXPathNodeSetAddUnique(ret, ns->nodeTab[0]);
+
+    for (i = 1; i < ns->nodeNr; i++) {
+	cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]);
+	if (xmlXPathIsNaN(cur)) {
+	    xmlXPathEmptyNodeSet(ret);
+	    return(ret);
+	}
+	if (cur < max)
+	    continue;
+	if (cur > max) {
+	    max = cur;
+	    xmlXPathEmptyNodeSet(ret);
+	    xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]);
+	    continue;
+	}
+	xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]);
+    }
+    return(ret);
+}
+
+/**
+ * exsltMathHighestFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathHighest for use by the XPath processor
+ */
+static void
+exsltMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr ns, ret;
+    void *user = NULL;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    /* We need to delay the freeing of value->user */
+    if ((ctxt->value != NULL) && ctxt->value->boolval != 0) {
+        user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = NULL;
+    }
+    ns = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathHighest(ns);
+
+    xmlXPathFreeNodeSet(ns);
+    if (user != NULL)
+        xmlFreeNodeList((xmlNodePtr)user);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/**
+ * exsltMathLowest:
+ * @ns:  a node-set
+ *
+ * Implements the EXSLT - Math lowest() function
+ *    node-set math:lowest (node-set)
+ *
+ * Returns the nodes in the node-set whose value is the minimum value
+ *         for the node-set.
+ */
+static xmlNodeSetPtr
+exsltMathLowest (xmlNodeSetPtr ns) {
+    xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
+    double min, cur;
+    int i;
+
+    if ((ns == NULL) || (ns->nodeNr == 0))
+	return(ret);
+
+    min = xmlXPathCastNodeToNumber(ns->nodeTab[0]);
+    if (xmlXPathIsNaN(min))
+	return(ret);
+    else
+	xmlXPathNodeSetAddUnique(ret, ns->nodeTab[0]);
+
+    for (i = 1; i < ns->nodeNr; i++) {
+	cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]);
+	if (xmlXPathIsNaN(cur)) {
+	    xmlXPathEmptyNodeSet(ret);
+	    return(ret);
+	}
+        if (cur > min)
+	    continue;
+	if (cur < min) {
+	    min = cur;
+	    xmlXPathEmptyNodeSet(ret);
+	    xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]);
+            continue;
+	}
+	xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]);
+    }
+    return(ret);
+}
+
+/**
+ * exsltMathLowestFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathLowest for use by the XPath processor
+ */
+static void
+exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr ns, ret;
+    void *user = NULL;
+    
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    /* We need to delay the freeing of value->user */
+    if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+        user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = NULL;
+    }
+    ns = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathLowest(ns);
+
+    xmlXPathFreeNodeSet(ns);
+    if (user != NULL)
+        xmlFreeNodeList((xmlNodePtr)user);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/* math other functions */
+
+/* constant values */
+#define EXSLT_PI        (const xmlChar *) \
+			"3.1415926535897932384626433832795028841971693993751"
+#define EXSLT_E         (const xmlChar *) \
+			"2.71828182845904523536028747135266249775724709369996"
+#define EXSLT_SQRRT2    (const xmlChar *) \
+			"1.41421356237309504880168872420969807856967187537694"
+#define EXSLT_LN2       (const xmlChar *) \
+			"0.69314718055994530941723212145817656807550013436025"
+#define EXSLT_LN10      (const xmlChar *) \
+			"2.30258509299404568402"
+#define EXSLT_LOG2E     (const xmlChar *) \
+			"1.4426950408889634074"
+#define EXSLT_SQRT1_2   (const xmlChar *) \
+			"0.70710678118654752440"
+
+/**
+ * exsltMathConstant
+ * @name: string
+ * @precision:  number
+ *
+ * Implements the EXSLT - Math constant function:
+ *     number math:constant(string, number)
+ *
+ * Returns a number value of the given constant with the given precision or
+ * xmlXPathNAN if name is unknown.
+ * The constants are PI, E, SQRRT2, LN2, LN10, LOG2E, and SQRT1_2
+ */
+static double
+exsltMathConstant (xmlChar *name, double precision) {
+    xmlChar *str;
+    double ret;
+
+    if ((name == NULL) || (xmlXPathIsNaN(precision)) || (precision < 1.0)) {
+        return xmlXPathNAN;
+    }
+
+    if (xmlStrEqual(name, BAD_CAST "PI")) {
+        int len = xmlStrlen(EXSLT_PI);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_PI, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "E")) {
+        int len = xmlStrlen(EXSLT_E);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_E, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) {
+        int len = xmlStrlen(EXSLT_SQRRT2);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_SQRRT2, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "LN2")) {
+        int len = xmlStrlen(EXSLT_LN2);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_LN2, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "LN10")) {
+        int len = xmlStrlen(EXSLT_LN10);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_LN10, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "LOG2E")) {
+        int len = xmlStrlen(EXSLT_LOG2E);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_LOG2E, 0, len);
+
+    } else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) {
+        int len = xmlStrlen(EXSLT_SQRT1_2);
+
+        if (precision <= len)
+            len = (int)precision;
+        
+        str = xmlStrsub(EXSLT_SQRT1_2, 0, len);
+
+    } else {
+	str = NULL;
+    }
+    if (str == NULL)
+        return xmlXPathNAN;
+    ret = xmlXPathCastStringToNumber(str);
+    xmlFree(str);
+    return ret;
+}
+
+/**
+ * exsltMathConstantFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathConstant for use by the XPath processor.
+ */
+static void
+exsltMathConstantFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double   ret;
+    xmlChar *name;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    name = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathConstant(name, ret);
+    if (name != NULL)
+	xmlFree(name);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+#if defined(HAVE_STDLIB_H) && defined(RAND_MAX)
+
+/**
+ * exsltMathRandom:
+ *
+ * Implements the EXSLT - Math random() function:
+ *    number math:random ()
+ *
+ * Returns a random number between 0 and 1 inclusive.
+ */
+static double
+exsltMathRandom (void) {
+    double ret;
+    int num;
+
+    num = rand();
+    ret = (double)num / (double)RAND_MAX;
+    return(ret);
+}
+
+/**
+ * exsltMathRandomFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathRandom for use by the XPath processor.
+ */
+static void
+exsltMathRandomFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 0) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    ret = exsltMathRandom();
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+#endif /* defined(HAVE_STDLIB_H) && defined(RAND_MAX) */
+
+#if HAVE_MATH_H
+
+/**
+ * exsltMathAbs:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math abs() function:
+ *    number math:abs (number)
+ *
+ * Returns the absolute value of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathAbs (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = fabs(num);
+    return(ret);
+}
+
+/**
+ * exsltMathAbsFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathAbs for use by the XPath processor.
+ */
+static void
+exsltMathAbsFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathAbs(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathSqrt:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math sqrt() function:
+ *    number math:sqrt (number)
+ *
+ * Returns the square root of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathSqrt (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = sqrt(num);
+    return(ret);
+}
+
+/**
+ * exsltMathSqrtFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathSqrt for use by the XPath processor.
+ */
+static void
+exsltMathSqrtFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathSqrt(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathPower:
+ * @base:  a double
+ * @power:  a double
+ *
+ * Implements the EXSLT - Math power() function:
+ *    number math:power (number, number)
+ *
+ * Returns the power base and power arguments, or xmlXPathNAN
+ * if either @base or @power is Nan.
+ */
+static double
+exsltMathPower (double base, double power) {
+    double ret;
+
+    if ((xmlXPathIsNaN(base) || xmlXPathIsNaN(power)))
+	return(xmlXPathNAN);
+    ret = pow(base, power);
+    return(ret);
+}
+
+/**
+ * exsltMathPower:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathPower for use by the XPath processor.
+ */
+static void
+exsltMathPowerFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret, base;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    /* power */
+    base = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathPower(base, ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathLog:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math log() function:
+ *    number math:log (number)
+ *
+ * Returns the natural log of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathLog (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = log(num);
+    return(ret);
+}
+
+/**
+ * exsltMathLogFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathLog for use by the XPath processor.
+ */
+static void
+exsltMathLogFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathLog(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathSin:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math sin() function:
+ *    number math:sin (number)
+ *
+ * Returns the sine of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathSin (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = sin(num);
+    return(ret);
+}
+
+/**
+ * exsltMathSinFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathSin for use by the XPath processor.
+ */
+static void
+exsltMathSinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathSin(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathCos:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math cos() function:
+ *    number math:cos (number)
+ *
+ * Returns the cosine of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathCos (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = cos(num);
+    return(ret);
+}
+
+/**
+ * exsltMathCosFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathCos for use by the XPath processor.
+ */
+static void
+exsltMathCosFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathCos(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathTan:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math tan() function:
+ *    number math:tan (number)
+ *
+ * Returns the tangent of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathTan (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = tan(num);
+    return(ret);
+}
+
+/**
+ * exsltMathTanFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathTan for use by the XPath processor.
+ */
+static void
+exsltMathTanFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathTan(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathAsin:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math asin() function:
+ *    number math:asin (number)
+ *
+ * Returns the arc sine of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathAsin (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = asin(num);
+    return(ret);
+}
+
+/**
+ * exsltMathAsinFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathAsin for use by the XPath processor.
+ */
+static void
+exsltMathAsinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathAsin(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathAcos:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math acos() function:
+ *    number math:acos (number)
+ *
+ * Returns the arc cosine of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathAcos (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = acos(num);
+    return(ret);
+}
+
+/**
+ * exsltMathAcosFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathAcos for use by the XPath processor.
+ */
+static void
+exsltMathAcosFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathAcos(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathAtan:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math atan() function:
+ *    number math:atan (number)
+ *
+ * Returns the arc tangent of the argument, or xmlXPathNAN if @num is Nan.
+ */
+static double
+exsltMathAtan (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = atan(num);
+    return(ret);
+}
+
+/**
+ * exsltMathAtanFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathAtan for use by the XPath processor.
+ */
+static void
+exsltMathAtanFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathAtan(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathAtan2:
+ * @y:  a double
+ * @x:  a double
+ *
+ * Implements the EXSLT - Math atan2() function:
+ *    number math:atan2 (number, number)
+ *
+ * Returns the arc tangent function of the y/x arguments, or xmlXPathNAN
+ * if either @y or @x is Nan.
+ */
+static double
+exsltMathAtan2 (double y, double x) {
+    double ret;
+
+    if ((xmlXPathIsNaN(y) || xmlXPathIsNaN(x)))
+	return(xmlXPathNAN);
+    ret = atan2(y, x);
+    return(ret);
+}
+
+/**
+ * exsltMathAtan2Function:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathAtan2 for use by the XPath processor.
+ */
+static void
+exsltMathAtan2Function (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret, y;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    y = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    /* x */
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathAtan2(y, ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+/**
+ * exsltMathExp:
+ * @num:  a double
+ *
+ * Implements the EXSLT - Math exp() function:
+ *    number math:exp (number)
+ *
+ * Returns the exponential function of the argument, or xmlXPathNAN if
+ * @num is Nan.
+ */
+static double
+exsltMathExp (double num) {
+    double ret;
+
+    if (xmlXPathIsNaN(num))
+	return(xmlXPathNAN);
+    ret = exp(num);
+    return(ret);
+}
+
+/**
+ * exsltMathExpFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #exsltMathExp for use by the XPath processor.
+ */
+static void
+exsltMathExpFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    double ret;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+    ret = xmlXPathPopNumber(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    ret = exsltMathExp(ret);
+
+    xmlXPathReturnNumber(ctxt, ret);
+}
+
+#endif /* HAVE_MATH_H */
+
+/**
+ * exsltMathRegister:
+ *
+ * Registers the EXSLT - Math module
+ */
+
+void
+exsltMathRegister (void) {
+    xsltRegisterExtModuleFunction ((const xmlChar *) "min",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathMinFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "max",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathMaxFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "highest",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathHighestFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "lowest",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathLowestFunction);
+    /* register other math functions */
+    xsltRegisterExtModuleFunction ((const xmlChar *) "constant",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathConstantFunction);
+#ifdef HAVE_STDLIB_H
+    xsltRegisterExtModuleFunction ((const xmlChar *) "random",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathRandomFunction);
+#endif
+#if HAVE_MATH_H
+    xsltRegisterExtModuleFunction ((const xmlChar *) "abs",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathAbsFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "sqrt",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathSqrtFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "power",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathPowerFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "log",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathLogFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "sin",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathSinFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "cos",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathCosFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "tan",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathTanFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "asin",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathAsinFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "acos",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathAcosFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "atan",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathAtanFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "atan2",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathAtan2Function);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "exp",
+				   EXSLT_MATH_NAMESPACE,
+				   exsltMathExpFunction);
+#endif
+}
diff --git a/third_party/libxslt/libexslt/saxon.c b/third_party/libxslt/libexslt/saxon.c
new file mode 100644
index 0000000..fcb1547
--- /dev/null
+++ b/third_party/libxslt/libexslt/saxon.c
@@ -0,0 +1,267 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+/**
+ * exsltSaxonInit:
+ * @ctxt: an XSLT transformation context
+ * @URI: the namespace URI for the extension
+ *
+ * Initializes the SAXON module.
+ *
+ * Returns the data for this transformation
+ */
+static xmlHashTablePtr
+exsltSaxonInit (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		const xmlChar *URI ATTRIBUTE_UNUSED) {
+    return xmlHashCreate(1);
+}
+
+/**
+ * exsltSaxonShutdown:
+ * @ctxt: an XSLT transformation context
+ * @URI: the namespace URI for the extension
+ * @data: the module data to free up
+ *
+ * Shutdown the SAXON extension module
+ */
+static void
+exsltSaxonShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		    const xmlChar *URI ATTRIBUTE_UNUSED,
+		    xmlHashTablePtr data) {
+    xmlHashFree(data, (xmlHashDeallocator) xmlXPathFreeCompExpr);
+}
+
+
+/**
+ * exsltSaxonExpressionFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * The supplied string must contain an XPath expression. The result of
+ * the function is a stored expression, which may be supplied as an
+ * argument to other extension functions such as saxon:eval(),
+ * saxon:sum() and saxon:distinct(). The result of the expression will
+ * usually depend on the current node. The expression may contain
+ * references to variables that are in scope at the point where
+ * saxon:expression() is called: these variables will be replaced in
+ * the stored expression with the values they take at the time
+ * saxon:expression() is called, not the values of the variables at
+ * the time the stored expression is evaluated.  Similarly, if the
+ * expression contains namespace prefixes, these are interpreted in
+ * terms of the namespace declarations in scope at the point where the
+ * saxon:expression() function is called, not those in scope where the
+ * stored expression is evaluated.
+ *
+ * TODO: current implementation doesn't conform to SAXON behaviour
+ * regarding context and namespaces.
+ */
+static void
+exsltSaxonExpressionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlChar *arg;
+    xmlXPathCompExprPtr ret;
+    xmlHashTablePtr hash;
+    xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt) || (arg == NULL)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    hash = (xmlHashTablePtr) xsltGetExtData(tctxt,
+					    ctxt->context->functionURI);
+
+    ret = xmlHashLookup(hash, arg);
+
+    if (ret == NULL) {
+	 ret = xmlXPathCompile(arg);
+	 if (ret == NULL) {
+	      xmlFree(arg);
+	      xsltGenericError(xsltGenericErrorContext,
+			"{%s}:%s: argument is not an XPath expression\n",
+			ctxt->context->functionURI, ctxt->context->function);
+	      return;
+	 }
+	 xmlHashAddEntry(hash, arg, (void *) ret);
+    }
+
+    xmlFree(arg);
+
+    xmlXPathReturnExternal(ctxt, ret);
+}
+
+/**
+ * exsltSaxonEvalFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  number of arguments
+ *
+ * Implements de SAXON eval() function:
+ *    object saxon:eval (saxon:stored-expression)
+ * Returns the result of evaluating the supplied stored expression.
+ * A stored expression may be obtained as the result of calling
+ * the saxon:expression() function.
+ * The stored expression is evaluated in the current context, that
+ * is, the context node is the current node, and the context position
+ * and context size are the same as the result of calling position()
+ * or last() respectively.
+ */
+static void
+exsltSaxonEvalFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+     xmlXPathCompExprPtr expr;
+     xmlXPathObjectPtr ret;
+
+     if (nargs != 1) {
+	  xmlXPathSetArityError(ctxt);
+	  return;
+     }
+
+     if (!xmlXPathStackIsExternal(ctxt)) {
+	  xmlXPathSetTypeError(ctxt);
+	  return;
+     }
+
+     expr = (xmlXPathCompExprPtr) xmlXPathPopExternal(ctxt);
+
+     ret = xmlXPathCompiledEval(expr, ctxt->context);
+
+     valuePush(ctxt, ret);
+}
+
+/**
+ * exsltSaxonEvaluateFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs: number of arguments
+ *
+ * Implements the SAXON evaluate() function
+ *     object saxon:evaluate (string)
+ * The supplied string must contain an XPath expression. The result of
+ * the function is the result of evaluating the XPath expression. This
+ * is useful where an expression needs to be constructed at run-time or
+ * passed to the stylesheet as a parameter, for example where the sort
+ * key is determined dynamically. The context for the expression (e.g.
+ * which variables and namespaces are available) is exactly the same as
+ * if the expression were written explicitly at this point in the
+ * stylesheet. The function saxon:evaluate(string) is shorthand for
+ * saxon:eval(saxon:expression(string)).
+ */
+static void
+exsltSaxonEvaluateFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+     if (nargs != 1) {
+	  xmlXPathSetArityError(ctxt);
+	  return;
+     }
+
+     exsltSaxonExpressionFunction(ctxt, 1);
+     exsltSaxonEvalFunction(ctxt, 1);
+}
+
+/**
+ * exsltSaxonLineNumberFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs: number of arguments
+ * 
+ * Implements the SAXON line-number() function
+ *     integer saxon:line-number()
+ *
+ * This returns the line number of the context node in the source document
+ * within the entity that contains it. There are no arguments. If line numbers
+ * are not maintained for the current document, the function returns -1. (To
+ * ensure that line numbers are maintained, use the -l option on the command
+ * line)
+ *
+ * The extension has been extended to have the following form:
+ *     integer saxon:line-number([node-set-1])
+ * If a node-set is given, this extension will return the line number of the
+ * node in the argument node-set that is first in document order.
+ */
+static void
+exsltSaxonLineNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodePtr cur = NULL;
+
+    if (nargs == 0) {
+	cur = ctxt->context->node;
+    } else if (nargs == 1) {
+	xmlXPathObjectPtr obj;
+	xmlNodeSetPtr nodelist;
+	int i;
+
+	if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) {
+	    xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"saxon:line-number() : invalid arg expecting a node-set\n");
+	    ctxt->error = XPATH_INVALID_TYPE;
+	    return;
+	}
+
+	obj = valuePop(ctxt);
+	nodelist = obj->nodesetval;
+	if ((nodelist == NULL) || (nodelist->nodeNr <= 0)) {
+	    xmlXPathFreeObject(obj);
+	    valuePush(ctxt, xmlXPathNewFloat(-1));
+	    return;
+	}
+	cur = nodelist->nodeTab[0];
+	for (i = 1;i < nodelist->nodeNr;i++) {
+	    int ret = xmlXPathCmpNodes(cur, nodelist->nodeTab[i]);
+	    if (ret == -1)
+		cur = nodelist->nodeTab[i];
+	}
+	xmlXPathFreeObject(obj);
+    } else {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"saxon:line-number() : invalid number of args %d\n",
+		nargs);
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+
+    valuePush(ctxt, xmlXPathNewFloat(xmlGetLineNo(cur)));
+    return;
+}
+
+/**
+ * exsltSaxonRegister:
+ *
+ * Registers the SAXON extension module
+ */
+void
+exsltSaxonRegister (void) {
+     xsltRegisterExtModule (SAXON_NAMESPACE,
+			    (xsltExtInitFunction) exsltSaxonInit,
+			    (xsltExtShutdownFunction) exsltSaxonShutdown);
+     xsltRegisterExtModuleFunction((const xmlChar *) "expression",
+				   SAXON_NAMESPACE,
+				   exsltSaxonExpressionFunction);
+     xsltRegisterExtModuleFunction((const xmlChar *) "eval",
+				   SAXON_NAMESPACE,
+				   exsltSaxonEvalFunction);
+     xsltRegisterExtModuleFunction((const xmlChar *) "evaluate",
+				   SAXON_NAMESPACE,
+				   exsltSaxonEvaluateFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "line-number",
+				   SAXON_NAMESPACE,
+				   exsltSaxonLineNumberFunction);
+}
diff --git a/third_party/libxslt/libexslt/sets.c b/third_party/libxslt/libexslt/sets.c
new file mode 100644
index 0000000..6739b5d
--- /dev/null
+++ b/third_party/libxslt/libexslt/sets.c
@@ -0,0 +1,292 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+/**
+ * exsltSetsDifferenceFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathDifference for use by the XPath processor
+ */
+static void
+exsltSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr arg1, arg2, ret;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg2 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    arg1 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    ret = xmlXPathDifference(arg1, arg2);
+
+    if (ret != arg1)
+	xmlXPathFreeNodeSet(arg1);
+    xmlXPathFreeNodeSet(arg2);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/**
+ * exsltSetsIntersectionFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathIntersection for use by the XPath processor
+ */
+static void
+exsltSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr arg1, arg2, ret;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg2 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    arg1 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    ret = xmlXPathIntersection(arg1, arg2);
+
+    xmlXPathFreeNodeSet(arg1);
+    xmlXPathFreeNodeSet(arg2);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/**
+ * exsltSetsDistinctFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathDistinct for use by the XPath processor
+ */
+static void
+exsltSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlXPathObjectPtr obj;
+    xmlNodeSetPtr ns, ret;
+    int boolval = 0;
+    void *user = NULL;
+
+    if (nargs != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (ctxt->value != NULL) {
+        boolval = ctxt->value->boolval;
+	user = ctxt->value->user;
+	ctxt->value->boolval = 0;
+	ctxt->value->user = NULL;
+    }
+    ns = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt))
+	return;
+
+    /* !!! must be sorted !!! */
+    ret = xmlXPathDistinctSorted(ns);
+
+	if (ret != ns)
+		xmlXPathFreeNodeSet(ns);
+
+    obj = xmlXPathWrapNodeSet(ret);
+    obj->user = user;
+    obj->boolval = boolval;
+    valuePush((ctxt), obj);
+}
+
+/**
+ * exsltSetsHasSameNodesFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathHasSameNodes for use by the XPath processor
+ */
+static void
+exsltSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
+			      int nargs) {
+    xmlNodeSetPtr arg1, arg2;
+    int ret;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg2 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    arg1 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    ret = xmlXPathHasSameNodes(arg1, arg2);
+
+    xmlXPathFreeNodeSet(arg1);
+    xmlXPathFreeNodeSet(arg2);
+
+    xmlXPathReturnBoolean(ctxt, ret);
+}
+
+/**
+ * exsltSetsLeadingFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathLeading for use by the XPath processor
+ */
+static void
+exsltSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr arg1, arg2, ret;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg2 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    arg1 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    /*  If the second node set is empty, then the first node set is
+     * returned.
+     */
+    if (xmlXPathNodeSetIsEmpty(arg2)) {
+	xmlXPathReturnNodeSet(ctxt, arg1);
+
+	xmlXPathFreeNodeSet(arg2);
+
+	return;
+    }
+    /* !!! must be sorted */
+    ret = xmlXPathNodeLeadingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
+
+    xmlXPathFreeNodeSet(arg1);
+    xmlXPathFreeNodeSet(arg2);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/**
+ * exsltSetsTrailingFunction:
+ * @ctxt:  an XPath parser context
+ * @nargs:  the number of arguments
+ *
+ * Wraps #xmlXPathTrailing for use by the XPath processor
+ */
+static void
+exsltSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlNodeSetPtr arg1, arg2, ret;
+
+    if (nargs != 2) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    arg2 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    arg1 = xmlXPathPopNodeSet(ctxt);
+    if (xmlXPathCheckError(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    /*  If the second node set is empty, then the first node set is
+     * returned.
+     */
+    if (xmlXPathNodeSetIsEmpty(arg2)) {
+	xmlXPathReturnNodeSet(ctxt, arg1);
+
+	xmlXPathFreeNodeSet(arg2);
+
+	return;
+    }
+    /* !!! mist be sorted */
+    ret = xmlXPathNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
+
+    xmlXPathFreeNodeSet(arg1);
+    xmlXPathFreeNodeSet(arg2);
+
+    xmlXPathReturnNodeSet(ctxt, ret);
+}
+
+/**
+ * exsltSetsRegister:
+ *
+ * Registers the EXSLT - Sets module
+ */
+
+void
+exsltSetsRegister (void) {
+    xsltRegisterExtModuleFunction ((const xmlChar *) "difference",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsDifferenceFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "intersection",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsIntersectionFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "distinct",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsDistinctFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "has-same-node",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsHasSameNodesFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "leading",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsLeadingFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "trailing",
+				   EXSLT_SETS_NAMESPACE,
+				   exsltSetsTrailingFunction);
+}
diff --git a/third_party/libxslt/libexslt/strings.c b/third_party/libxslt/libexslt/strings.c
new file mode 100644
index 0000000..e4eb3ea
--- /dev/null
+++ b/third_party/libxslt/libexslt/strings.c
@@ -0,0 +1,676 @@
+#define IN_LIBEXSLT
+#include "libexslt/libexslt.h"
+
+#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "exslt.h"
+
+/**
+ * exsltStrTokenizeFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Splits up a string on the characters of the delimiter string and returns a
+ * node set of token elements, each containing one token from the string. 
+ */
+static void
+exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xsltTransformContextPtr tctxt;
+    xmlChar *str, *delimiters, *cur;
+    const xmlChar *token, *delimiter;
+    xmlNodePtr node;
+    xmlDocPtr container;
+    xmlXPathObjectPtr ret = NULL;
+    int clen;
+
+    if ((nargs < 1) || (nargs > 2)) {
+        xmlXPathSetArityError(ctxt);
+        return;
+    }
+
+    if (nargs == 2) {
+        delimiters = xmlXPathPopString(ctxt);
+        if (xmlXPathCheckError(ctxt))
+            return;
+    } else {
+        delimiters = xmlStrdup((const xmlChar *) "\t\r\n ");
+    }
+    if (delimiters == NULL)
+        return;
+
+    str = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt) || (str == NULL)) {
+        xmlFree(delimiters);
+        return;
+    }
+
+    /* Return a result tree fragment */
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	      "exslt:tokenize : internal error tctxt == NULL\n");
+	goto fail;
+    }
+
+    container = xsltCreateRVT(tctxt);
+    if (container != NULL) {
+        xsltRegisterLocalRVT(tctxt, container);
+        ret = xmlXPathNewNodeSet(NULL);
+        if (ret != NULL) {
+            for (cur = str, token = str; *cur != 0; cur += clen) {
+	        clen = xmlUTF8Size(cur);
+		if (*delimiters == 0) {	/* empty string case */
+		    xmlChar ctmp;
+		    ctmp = *(cur+clen);
+		    *(cur+clen) = 0;
+                    node = xmlNewDocRawNode(container, NULL,
+                                       (const xmlChar *) "token", cur);
+		    xmlAddChild((xmlNodePtr) container, node);
+		    xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+                    *(cur+clen) = ctmp; /* restore the changed byte */
+                    token = cur + clen;
+                } else for (delimiter = delimiters; *delimiter != 0;
+				delimiter += xmlUTF8Size(delimiter)) {
+                    if (!xmlUTF8Charcmp(cur, delimiter)) {
+                        if (cur == token) {
+                            /* discard empty tokens */
+                            token = cur + clen;
+                            break;
+                        }
+                        *cur = 0;	/* terminate the token */
+                        node = xmlNewDocRawNode(container, NULL,
+                                           (const xmlChar *) "token", token);
+			xmlAddChild((xmlNodePtr) container, node);
+			xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+                        *cur = *delimiter; /* restore the changed byte */
+                        token = cur + clen;
+                        break;
+                    }
+                }
+            }
+            if (token != cur) {
+	    	node = xmlNewDocRawNode(container, NULL,
+				    (const xmlChar *) "token", token);
+                xmlAddChild((xmlNodePtr) container, node);
+	        xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+            }
+	    /*
+	     * Mark it as a function result in order to avoid garbage
+	     * collecting of tree fragments
+	     */
+	    xsltExtensionInstructionResultRegister(tctxt, ret);
+        }
+    }
+
+fail:
+    if (str != NULL)
+        xmlFree(str);
+    if (delimiters != NULL)
+        xmlFree(delimiters);
+    if (ret != NULL)
+        valuePush(ctxt, ret);
+    else
+        valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+}
+
+/**
+ * exsltStrSplitFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Splits up a string on a delimiting string and returns a node set of token
+ * elements, each containing one token from the string. 
+ */
+static void
+exsltStrSplitFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+    xsltTransformContextPtr tctxt;
+    xmlChar *str, *delimiter, *cur;
+    const xmlChar *token;
+    xmlNodePtr node;
+    xmlDocPtr container;
+    xmlXPathObjectPtr ret = NULL;
+    int delimiterLength;
+
+    if ((nargs < 1) || (nargs > 2)) {
+        xmlXPathSetArityError(ctxt);
+        return;
+    }
+
+    if (nargs == 2) {
+        delimiter = xmlXPathPopString(ctxt);
+        if (xmlXPathCheckError(ctxt))
+            return;
+    } else {
+        delimiter = xmlStrdup((const xmlChar *) " ");
+    }
+    if (delimiter == NULL)
+        return;
+    delimiterLength = xmlStrlen (delimiter);
+
+    str = xmlXPathPopString(ctxt);
+    if (xmlXPathCheckError(ctxt) || (str == NULL)) {
+        xmlFree(delimiter);
+        return;
+    }
+
+    /* Return a result tree fragment */
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	      "exslt:tokenize : internal error tctxt == NULL\n");
+	goto fail;
+    }
+
+    /*
+    * OPTIMIZE TODO: We are creating an xmlDoc for every split!
+    */
+    container = xsltCreateRVT(tctxt);
+    if (container != NULL) {
+        xsltRegisterLocalRVT(tctxt, container);
+        ret = xmlXPathNewNodeSet(NULL);
+        if (ret != NULL) {
+            for (cur = str, token = str; *cur != 0; cur++) {
+		if (delimiterLength == 0) {
+		    if (cur != token) {
+			xmlChar tmp = *cur;
+			*cur = 0;
+                        node = xmlNewDocRawNode(container, NULL,
+                                           (const xmlChar *) "token", token);
+			xmlAddChild((xmlNodePtr) container, node);
+			xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+			*cur = tmp;
+			token++;
+		    }
+		}
+		else if (!xmlStrncasecmp(cur, delimiter, delimiterLength)) {
+		    if (cur == token) {
+			/* discard empty tokens */
+			cur = cur + delimiterLength - 1;
+			token = cur + 1;
+			continue;
+		    }
+		    *cur = 0;
+		    node = xmlNewDocRawNode(container, NULL,
+				       (const xmlChar *) "token", token);
+		    xmlAddChild((xmlNodePtr) container, node);
+		    xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+		    *cur = *delimiter;
+		    cur = cur + delimiterLength - 1;
+		    token = cur + 1;
+                }
+            }
+	    if (token != cur) {
+		node = xmlNewDocRawNode(container, NULL,
+				   (const xmlChar *) "token", token);
+		xmlAddChild((xmlNodePtr) container, node);
+		xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+	    }
+	    /*
+	     * Mark it as a function result in order to avoid garbage
+	     * collecting of tree fragments
+	     */
+	    xsltExtensionInstructionResultRegister(tctxt, ret);
+        }
+    }
+
+fail:
+    if (str != NULL)
+        xmlFree(str);
+    if (delimiter != NULL)
+        xmlFree(delimiter);
+    if (ret != NULL)
+        valuePush(ctxt, ret);
+    else
+        valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+}
+
+/**
+ * exsltStrEncodeUriFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * URI-Escapes a string
+ */
+static void
+exsltStrEncodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    int escape_all = 1, str_len = 0;
+    xmlChar *str = NULL, *ret = NULL, *tmp;
+
+    if ((nargs < 2) || (nargs > 3)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs >= 3) {
+        /* check for UTF-8 if encoding was explicitly given;
+           we don't support anything else yet */
+        tmp = xmlXPathPopString(ctxt);
+        if (xmlUTF8Strlen(tmp) != 5 || xmlStrcmp((const xmlChar *)"UTF-8",tmp)) {
+	    xmlXPathReturnEmptyString(ctxt);
+	    xmlFree(tmp);
+	    return;
+	}
+	xmlFree(tmp);
+    }
+
+    escape_all = xmlXPathPopBoolean(ctxt);
+
+    str = xmlXPathPopString(ctxt);
+    str_len = xmlUTF8Strlen(str);
+
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString(ctxt);
+	xmlFree(str);
+	return;
+    }
+
+    ret = xmlURIEscapeStr(str,(const xmlChar *)(escape_all?"-_.!~*'()":"-_.!~*'();/?:@&=+$,[]"));
+    xmlXPathReturnString(ctxt, ret);
+
+    if (str != NULL)
+	xmlFree(str);
+}
+
+/**
+ * exsltStrDecodeUriFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * reverses URI-Escaping of a string
+ */
+static void
+exsltStrDecodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    int str_len = 0;
+    xmlChar *str = NULL, *ret = NULL, *tmp;
+
+    if ((nargs < 1) || (nargs > 2)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs >= 2) {
+        /* check for UTF-8 if encoding was explicitly given;
+           we don't support anything else yet */
+        tmp = xmlXPathPopString(ctxt);
+        if (xmlUTF8Strlen(tmp) != 5 || xmlStrcmp((const xmlChar *)"UTF-8",tmp)) {
+	    xmlXPathReturnEmptyString(ctxt);
+	    xmlFree(tmp);
+	    return;
+	}
+	xmlFree(tmp);
+    }
+
+    str = xmlXPathPopString(ctxt);
+    str_len = xmlUTF8Strlen(str);
+
+    if (str_len == 0) {
+	xmlXPathReturnEmptyString(ctxt);
+	xmlFree(str);
+	return;
+    }
+
+    ret = (xmlChar *) xmlURIUnescapeString((const char *)str,0,NULL);
+    if (!xmlCheckUTF8(ret)) {
+	/* FIXME: instead of throwing away the whole URI, we should
+        only discard the invalid sequence(s). How to do that? */
+	xmlXPathReturnEmptyString(ctxt);
+	xmlFree(str);
+	xmlFree(ret);
+	return;
+    }
+    
+    xmlXPathReturnString(ctxt, ret);
+
+    if (str != NULL)
+	xmlFree(str);
+}
+
+/**
+ * exsltStrPaddingFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Creates a padding string of a certain length.
+ */
+static void
+exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    int number, str_len = 0;
+    xmlChar *str = NULL, *ret = NULL, *tmp;
+
+    if ((nargs < 1) || (nargs > 2)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 2) {
+	str = xmlXPathPopString(ctxt);
+	str_len = xmlUTF8Strlen(str);
+    }
+    if (str_len == 0) {
+	if (str != NULL) xmlFree(str);
+	str = xmlStrdup((const xmlChar *) " ");
+	str_len = 1;
+    }
+
+    number = (int) xmlXPathPopNumber(ctxt);
+
+    if (number <= 0) {
+	xmlXPathReturnEmptyString(ctxt);
+	xmlFree(str);
+	return;
+    }
+
+    while (number >= str_len) {
+	ret = xmlStrncat(ret, str, str_len);
+	number -= str_len;
+    }
+    tmp = xmlUTF8Strndup (str, number);
+    ret = xmlStrcat(ret, tmp);
+    if (tmp != NULL)
+	xmlFree (tmp);
+
+    xmlXPathReturnString(ctxt, ret);
+
+    if (str != NULL)
+	xmlFree(str);
+}
+
+/**
+ * exsltStrAlignFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Aligns a string within another string.
+ */
+static void
+exsltStrAlignFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlChar *str, *padding, *alignment, *ret;
+    int str_l, padding_l;
+
+    if ((nargs < 2) || (nargs > 3)) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (nargs == 3)
+	alignment = xmlXPathPopString(ctxt);
+    else
+	alignment = NULL;
+
+    padding = xmlXPathPopString(ctxt);
+    str = xmlXPathPopString(ctxt);
+
+    str_l = xmlUTF8Strlen (str);
+    padding_l = xmlUTF8Strlen (padding);
+
+    if (str_l == padding_l) {
+	xmlXPathReturnString (ctxt, str);
+	xmlFree(padding);
+	xmlFree(alignment);
+	return;
+    }
+
+    if (str_l > padding_l) {
+	ret = xmlUTF8Strndup (str, padding_l);
+    } else {
+	if (xmlStrEqual(alignment, (const xmlChar *) "right")) {
+	    ret = xmlUTF8Strndup (padding, padding_l - str_l);
+	    ret = xmlStrcat (ret, str);
+	} else if (xmlStrEqual(alignment, (const xmlChar *) "center")) {
+	    int left = (padding_l - str_l) / 2;
+	    int right_start;
+
+	    ret = xmlUTF8Strndup (padding, left);
+	    ret = xmlStrcat (ret, str);
+
+	    right_start = xmlUTF8Strsize (padding, left + str_l);
+	    ret = xmlStrcat (ret, padding + right_start);
+	} else {
+	    int str_s;
+
+	    str_s = xmlStrlen (str);
+	    ret = xmlStrdup (str);
+	    ret = xmlStrcat (ret, padding + str_s);
+	}
+    }
+
+    xmlXPathReturnString (ctxt, ret);
+
+    xmlFree(str);
+    xmlFree(padding);
+    xmlFree(alignment);
+}
+
+/**
+ * exsltStrConcatFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Takes a node set and returns the concatenation of the string values
+ * of the nodes in that node set.  If the node set is empty, it
+ * returns an empty string.
+ */
+static void
+exsltStrConcatFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlXPathObjectPtr obj;
+    xmlChar *ret = NULL;
+    int i;
+
+    if (nargs  != 1) {
+	xmlXPathSetArityError(ctxt);
+	return;
+    }
+
+    if (!xmlXPathStackIsNodeSet(ctxt)) {
+	xmlXPathSetTypeError(ctxt);
+	return;
+    }
+
+    obj = valuePop (ctxt);
+
+    if (xmlXPathNodeSetIsEmpty(obj->nodesetval)) {
+	xmlXPathReturnEmptyString(ctxt);
+	return;
+    }
+
+    for (i = 0; i < obj->nodesetval->nodeNr; i++) {
+	xmlChar *tmp;
+	tmp = xmlXPathCastNodeToString(obj->nodesetval->nodeTab[i]);
+
+	ret = xmlStrcat (ret, tmp);
+
+	xmlFree(tmp);
+    }
+
+    xmlXPathFreeObject (obj);
+
+    xmlXPathReturnString(ctxt, ret);
+}
+
+/**
+ * exsltStrReplaceInternal:
+ * @str: string to modify
+ * @searchStr: string to find
+ * @replaceStr: string to replace occurrences of searchStr
+ *
+ * Search and replace string function used by exsltStrReplaceFunction
+ */
+static xmlChar*
+exsltStrReplaceInternal(const xmlChar* str, const xmlChar* searchStr, 
+                        const xmlChar* replaceStr)
+{
+    const xmlChar *curr, *next;
+    xmlChar *ret = NULL;
+    int searchStrSize;
+
+    curr = str;
+    searchStrSize = xmlStrlen(searchStr);
+
+    do {
+      next = xmlStrstr(curr, searchStr);
+      if (next == NULL) {
+        ret = xmlStrcat (ret, curr);
+        break;
+      }
+
+      ret = xmlStrncat (ret, curr, next - curr);
+      ret = xmlStrcat (ret, replaceStr);
+      curr = next + searchStrSize;
+    } while (*curr != 0);
+
+    return ret;
+}
+/**
+ * exsltStrReplaceFunction:
+ * @ctxt: an XPath parser context
+ * @nargs: the number of arguments
+ *
+ * Takes a string, and two node sets and returns the string with all strings in 
+ * the first node set replaced by all strings in the second node set.
+ */
+static void
+exsltStrReplaceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlChar *str = NULL, *searchStr = NULL, *replaceStr = NULL;
+    xmlNodeSetPtr replaceSet = NULL, searchSet = NULL;
+    xmlChar *ret = NULL, *retSwap = NULL;
+    int i;
+
+    if (nargs  != 3) {
+      xmlXPathSetArityError(ctxt);
+      return;
+    }
+
+    /* pull out replace argument */
+    if (!xmlXPathStackIsNodeSet(ctxt)) {
+      replaceStr = xmlXPathPopString(ctxt);
+    }
+		else {
+      replaceSet = xmlXPathPopNodeSet(ctxt);
+      if (xmlXPathCheckError(ctxt)) {
+        xmlXPathSetTypeError(ctxt);
+        goto fail;
+      }
+    }
+
+    /* behavior driven by search argument from here on */
+    if (!xmlXPathStackIsNodeSet(ctxt)) {
+      searchStr = xmlXPathPopString(ctxt);
+      str = xmlXPathPopString(ctxt);
+
+      if (replaceStr == NULL) {
+        xmlXPathSetTypeError(ctxt);
+        goto fail;
+      }
+
+      ret = exsltStrReplaceInternal(str, searchStr, replaceStr);
+    }
+		else {
+      searchSet = xmlXPathPopNodeSet(ctxt);
+      if (searchSet == NULL || xmlXPathCheckError(ctxt)) {
+        xmlXPathSetTypeError(ctxt);
+        goto fail;
+      }
+
+      str = xmlXPathPopString(ctxt);
+			ret = xmlStrdup(str);
+
+			for (i = 0; i < searchSet->nodeNr; i++) {
+
+				searchStr = xmlXPathCastNodeToString(searchSet->nodeTab[i]);
+
+        if (replaceSet != NULL) {
+          replaceStr = NULL;
+          if (i <= replaceSet->nodeNr) {
+            replaceStr = xmlXPathCastNodeToString(replaceSet->nodeTab[i]);
+          }
+
+          retSwap = exsltStrReplaceInternal(ret, searchStr, replaceStr);
+          
+          if (replaceStr != NULL) {
+            xmlFree(replaceStr);
+            replaceStr = NULL;
+          }
+        }
+        else {
+          retSwap = exsltStrReplaceInternal(ret, searchStr, replaceStr);
+        }
+
+				xmlFree(ret);
+        if (searchStr != NULL) {
+          xmlFree(searchStr);
+          searchStr = NULL;
+        }
+
+				ret = retSwap;
+			}
+
+      if (replaceSet != NULL)
+        xmlXPathFreeNodeSet(replaceSet);
+
+      if (searchSet != NULL)
+        xmlXPathFreeNodeSet(searchSet);
+		}
+
+    xmlXPathReturnString(ctxt, ret);
+
+ fail:
+    if (replaceStr != NULL)
+      xmlFree(replaceStr);
+
+    if (searchStr != NULL)
+      xmlFree(searchStr);
+
+    if (str != NULL)
+      xmlFree(str);
+}
+
+/**
+ * exsltStrRegister:
+ *
+ * Registers the EXSLT - Strings module
+ */
+
+void
+exsltStrRegister (void) {
+    xsltRegisterExtModuleFunction ((const xmlChar *) "tokenize",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrTokenizeFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "split",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrSplitFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "encode-uri",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrEncodeUriFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "decode-uri",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrDecodeUriFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "padding",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrPaddingFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "align",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrAlignFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "concat",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrConcatFunction);
+    xsltRegisterExtModuleFunction ((const xmlChar *) "replace",
+				   EXSLT_STRINGS_NAMESPACE,
+				   exsltStrReplaceFunction);
+}
diff --git a/third_party/libxslt/libxslt.m4 b/third_party/libxslt/libxslt.m4
new file mode 100644
index 0000000..c03ec4f
--- /dev/null
+++ b/third_party/libxslt/libxslt.m4
@@ -0,0 +1,191 @@
+# Based on:
+# Configure paths for LIBXML2
+# Toshio Kuratomi 2001-04-21
+# Adapted from:
+# Configure paths for GLIB
+# Owen Taylor     97-11-3
+#
+# Modified to work with libxslt by Thomas Schraitle 2002/10/25
+# Fixed by Edward Rudd 2004/05/12
+
+dnl AM_PATH_XSLT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for XML, and define XML_CFLAGS and XML_LIBS
+dnl
+AC_DEFUN([AM_PATH_XSLT],[
+AC_ARG_WITH(xslt-prefix,
+            [  --with-xslt-prefix=PFX   Prefix where libxslt is installed (optional)],
+            xslt_config_prefix="$withval", xslt_config_prefix="")
+AC_ARG_WITH(xslt-exec-prefix,
+            [  --with-xslt-exec-prefix=PFX Exec prefix where libxslt is installed (optional)],
+            xslt_config_exec_prefix="$withval", xslt_config_exec_prefix="")
+AC_ARG_ENABLE(xslttest,
+              [  --disable-xslttest       Do not try to compile and run a test LIBXSLT program],,
+              enable_xslttest=yes)
+
+  if test x$xslt_config_exec_prefix != x ; then
+     xslt_config_args="$xslt_config_args --exec-prefix=$xslt_config_exec_prefix"
+     if test x${XSLT_CONFIG+set} != xset ; then
+        XSLT_CONFIG=$xslt_config_exec_prefix/bin/xslt-config
+     fi
+  fi
+  if test x$xslt_config_prefix != x ; then
+     xslt_config_args="$xslt_config_args --prefix=$xslt_config_prefix"
+     if test x${XSLT_CONFIG+set} != xset ; then
+        XSLT_CONFIG=$xslt_config_prefix/bin/xslt-config
+     fi
+  fi
+
+  AC_PATH_PROG(XSLT_CONFIG, xslt-config, no)
+  min_xslt_version=ifelse([$1], ,1.0.0,[$1])
+  AC_MSG_CHECKING(for libxslt - version >= $min_xslt_version)
+  no_xslt=""
+  if test "$XSLT_CONFIG" = "no" ; then
+    no_xslt=yes
+  else
+    XSLT_CFLAGS=`$XSLT_CONFIG $xslt_config_args --cflags`
+    XSLT_LIBS=`$XSLT_CONFIG $xslt_config_args --libs`
+    xslt_config_major_version=`$XSLT_CONFIG $xslt_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    xslt_config_minor_version=`$XSLT_CONFIG $xslt_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    xslt_config_micro_version=`$XSLT_CONFIG $xslt_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_xslttest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $XSLT_CFLAGS"
+      LIBS="$XSLT_LIBS $LIBS"
+dnl
+dnl Now check if the installed libxslt is sufficiently new.
+dnl (Also sanity checks the results of xslt-config to some extent)
+dnl
+      rm -f conf.xslttest
+      AC_TRY_RUN([
+#include 
+#include 
+#include 
+#include 
+#include 
+int 
+main()
+{
+  int xslt_major_version, xslt_minor_version, xslt_micro_version;
+  int major, minor, micro;
+  char *tmp_version;
+
+  system("touch conf.xslttest");
+
+  /* Capture xslt-config output via autoconf/configure variables */
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = (char *)strdup("$min_xslt_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+     printf("%s, bad version string from xslt-config\n", "$min_xslt_version");
+     exit(1);
+   }
+   free(tmp_version);
+
+   /* Capture the version information from the header files */
+   tmp_version = (char *)strdup(LIBXSLT_DOTTED_VERSION);
+   if (sscanf(tmp_version, "%d.%d.%d", &xslt_major_version, &xslt_minor_version, &xslt_micro_version) != 3) {
+     printf("%s, bad version string from libxslt includes\n", "LIBXSLT_DOTTED_VERSION");
+     exit(1);
+   }
+   free(tmp_version);
+
+ /* Compare xslt-config output to the libxslt headers */
+  if ((xslt_major_version != $xslt_config_major_version) ||
+      (xslt_minor_version != $xslt_config_minor_version) ||
+      (xslt_micro_version != $xslt_config_micro_version))
+    {
+      printf("*** libxslt header files (version %d.%d.%d) do not match\n",
+         xslt_major_version, xslt_minor_version, xslt_micro_version);
+      printf("*** xslt-config (version %d.%d.%d)\n",
+         $xslt_config_major_version, $xslt_config_minor_version, $xslt_config_micro_version);
+      return 1;
+    } 
+/* Compare the headers to the library to make sure we match */
+  /* Less than ideal -- doesn't provide us with return value feedback, 
+   * only exits if there's a serious mismatch between header and library.
+   */
+    /* copied from LIBXML_TEST_VERSION; */
+    xmlCheckVersion(LIBXML_VERSION);
+
+    /* Test that the library is greater than our minimum version */
+    if ((xslt_major_version > major) ||
+        ((xslt_major_version == major) && (xslt_minor_version > minor)) ||
+        ((xslt_major_version == major) && (xslt_minor_version == minor) &&
+        (xslt_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of libxslt (%d.%d.%d) was found.\n",
+               xslt_major_version, xslt_minor_version, xslt_micro_version);
+        printf("*** You need a version of libxslt newer than %d.%d.%d. The latest version of\n",
+           major, minor, micro);
+        printf("*** libxslt is always available from ftp://ftp.xmlsoft.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the xslt-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of LIBXSLT, but you can also set the XSLT_CONFIG environment to point to the\n");
+        printf("*** correct copy of xslt-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+    }
+  return 1;
+}
+],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+
+  if test "x$no_xslt" = x ; then
+     AC_MSG_RESULT(yes (version $xslt_config_major_version.$xslt_config_minor_version.$xslt_config_micro_version))
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$XSLT_CONFIG" = "no" ; then
+       echo "*** The xslt-config script installed by LIBXSLT could not be found"
+       echo "*** If libxslt was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the XSLT_CONFIG environment variable to the"
+       echo "*** full path to xslt-config."
+     else
+       if test -f conf.xslttest ; then
+        :
+       else
+          echo "*** Could not run libxslt test program, checking why..."
+          CFLAGS="$CFLAGS $XSLT_CFLAGS"
+          LIBS="$LIBS $XSLT_LIBS"
+          AC_TRY_LINK([
+#include 
+#include 
+],      [ LIBXSLT_TEST_VERSION; return 0;],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding LIBXSLT or finding the wrong"
+          echo "*** version of LIBXSLT. If it is not finding LIBXSLT, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+          echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means LIBXSLT was incorrectly installed"
+          echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you"
+          echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+
+     XSLT_CFLAGS=""
+     XSLT_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(XSLT_CFLAGS)
+  AC_SUBST(XSLT_LIBS)
+  rm -f conf.xslttest
+])
diff --git a/third_party/libxslt/libxslt.pc.in b/third_party/libxslt/libxslt.pc.in
new file mode 100644
index 0000000..07304b2
--- /dev/null
+++ b/third_party/libxslt/libxslt.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+
+Name: libxslt
+Version: @VERSION@
+Description: XSLT library version 2.
+Requires: libxml-2.0
+Libs: @XSLT_LIBDIR@ @XSLT_LIBS@
+Cflags: @XSLT_INCLUDEDIR@
diff --git a/third_party/libxslt/libxslt.spec b/third_party/libxslt/libxslt.spec
new file mode 100644
index 0000000..ce34f53
--- /dev/null
+++ b/third_party/libxslt/libxslt.spec
@@ -0,0 +1,125 @@
+Summary: Library providing the GNOME XSLT engine
+Name: libxslt
+Version: 1.1.24
+Release: 1
+License: MIT
+Group: Development/Libraries
+Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+URL: http://xmlsoft.org/XSLT/
+Requires: libxml2 >= 2.6.27
+BuildRequires: libxml2-devel >= 2.6.27
+BuildRequires: python python-devel
+BuildRequires: libxml2-python
+BuildRequires: libgcrypt-devel
+Prefix: %{_prefix}
+Docdir: %{_docdir}
+
+%description
+This C library allows to transform XML files into other XML files
+(or HTML, text, ...) using the standard XSLT stylesheet transformation
+mechanism. To use it you need to have a version of libxml2 >= 2.6.27
+installed. The xsltproc command is a command line interface to the XSLT engine
+
+%package devel
+Summary: Libraries, includes, etc. to embed the GNOME XSLT engine
+Group: Development/Libraries
+Requires: libxslt = %{version}-%{release}
+Requires: libxml2-devel >= 2.6.27
+Requires: libgcrypt-devel
+Requires: pkgconfig
+
+%description devel
+This C library allows to transform XML files into other XML files
+(or HTML, text, ...) using the standard XSLT stylesheet transformation
+mechanism. To use it you need to have a version of libxml2 >= 2.6.27
+installed.
+
+%package python
+Summary: Python bindings for the libxslt library
+Group: Development/Libraries
+Requires: libxslt = %{version}-%{release}
+Requires: libxml2 >= 2.6.27
+Requires: libxml2-python >= 2.6.27
+Requires: python
+
+%description python
+The libxslt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libxslt library to apply XSLT transformations.
+
+This library allows to parse sytlesheets, uses the libxml2-python
+to load and save XML and HTML files. Direct access to XPath and
+the XSLT transformation context are possible to extend the XSLT language
+with XPath functions written in Python.
+
+%prep
+%setup -q
+
+%build
+%configure
+make
+gzip -9 ChangeLog
+
+%install
+rm -fr %{buildroot}
+
+%makeinstall
+
+rm -fr $RPM_BUILD_ROOT%{_libdir}/*.la \
+       $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/libxsltmod*a
+
+%clean
+rm -fr %{buildroot}
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES
+%doc doc/*.html doc/html doc/tutorial doc/tutorial2 doc/*.gif
+%doc doc/EXSLT
+%doc %{_mandir}/man1/xsltproc.1*
+%{_libdir}/lib*.so.*
+%{_libdir}/libxslt-plugins
+%{prefix}/bin/xsltproc
+
+%files devel
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES
+%doc doc/libxslt-api.xml
+%doc doc/libxslt-refs.xml
+%doc doc/EXSLT/libexslt-api.xml
+%doc doc/EXSLT/libexslt-refs.xml
+%doc %{_mandir}/man3/libxslt.3*
+%doc %{_mandir}/man3/libexslt.3*
+%{_libdir}/lib*.so
+%{_libdir}/*a
+%{_libdir}/*.sh
+%{prefix}/share/aclocal/libxslt.m4
+%{prefix}/include/*
+%{prefix}/bin/xslt-config
+%{_libdir}/pkgconfig/libxslt.pc
+%{_libdir}/pkgconfig/libexslt.pc
+
+%files python
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright FEATURES
+%{_libdir}/python*/site-packages/libxslt.py*
+%{_libdir}/python*/site-packages/libxsltmod*
+%doc python/TODO
+%doc python/libxsltclass.txt
+%doc python/tests/*.py
+%doc python/tests/*.xml
+%doc python/tests/*.xsl
+
+%changelog
+* Tue May 13 2008 Daniel Veillard 
+- upstream release 1.1.24 see http://xmlsoft.org/XSLT/news.html
diff --git a/third_party/libxslt/libxslt.spec.in b/third_party/libxslt/libxslt.spec.in
new file mode 100644
index 0000000..f5b7878
--- /dev/null
+++ b/third_party/libxslt/libxslt.spec.in
@@ -0,0 +1,125 @@
+Summary: Library providing the GNOME XSLT engine
+Name: libxslt
+Version: @VERSION@
+Release: 1
+License: MIT
+Group: Development/Libraries
+Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+URL: http://xmlsoft.org/XSLT/
+Requires: libxml2 >= @LIBXML_REQUIRED_VERSION@
+BuildRequires: libxml2-devel >= @LIBXML_REQUIRED_VERSION@
+BuildRequires: python python-devel
+BuildRequires: libxml2-python
+BuildRequires: libgcrypt-devel
+Prefix: %{_prefix}
+Docdir: %{_docdir}
+
+%description
+This C library allows to transform XML files into other XML files
+(or HTML, text, ...) using the standard XSLT stylesheet transformation
+mechanism. To use it you need to have a version of libxml2 >= @LIBXML_REQUIRED_VERSION@
+installed. The xsltproc command is a command line interface to the XSLT engine
+
+%package devel
+Summary: Libraries, includes, etc. to embed the GNOME XSLT engine
+Group: Development/Libraries
+Requires: libxslt = %{version}-%{release}
+Requires: libxml2-devel >= @LIBXML_REQUIRED_VERSION@
+Requires: libgcrypt-devel
+Requires: pkgconfig
+
+%description devel
+This C library allows to transform XML files into other XML files
+(or HTML, text, ...) using the standard XSLT stylesheet transformation
+mechanism. To use it you need to have a version of libxml2 >= @LIBXML_REQUIRED_VERSION@
+installed.
+
+%package python
+Summary: Python bindings for the libxslt library
+Group: Development/Libraries
+Requires: libxslt = %{version}-%{release}
+Requires: libxml2 >= @LIBXML_REQUIRED_VERSION@
+Requires: libxml2-python >= @LIBXML_REQUIRED_VERSION@
+Requires: python
+
+%description python
+The libxslt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libxslt library to apply XSLT transformations.
+
+This library allows to parse sytlesheets, uses the libxml2-python
+to load and save XML and HTML files. Direct access to XPath and
+the XSLT transformation context are possible to extend the XSLT language
+with XPath functions written in Python.
+
+%prep
+%setup -q
+
+%build
+%configure
+make
+gzip -9 ChangeLog
+
+%install
+rm -fr %{buildroot}
+
+%makeinstall
+
+rm -fr $RPM_BUILD_ROOT%{_libdir}/*.la \
+       $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/libxsltmod*a
+
+%clean
+rm -fr %{buildroot}
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES
+%doc doc/*.html doc/html doc/tutorial doc/tutorial2 doc/*.gif
+%doc doc/EXSLT
+%doc %{_mandir}/man1/xsltproc.1*
+%{_libdir}/lib*.so.*
+%{_libdir}/libxslt-plugins
+%{prefix}/bin/xsltproc
+
+%files devel
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES
+%doc doc/libxslt-api.xml
+%doc doc/libxslt-refs.xml
+%doc doc/EXSLT/libexslt-api.xml
+%doc doc/EXSLT/libexslt-refs.xml
+%doc %{_mandir}/man3/libxslt.3*
+%doc %{_mandir}/man3/libexslt.3*
+%{_libdir}/lib*.so
+%{_libdir}/*a
+%{_libdir}/*.sh
+%{prefix}/share/aclocal/libxslt.m4
+%{prefix}/include/*
+%{prefix}/bin/xslt-config
+%{_libdir}/pkgconfig/libxslt.pc
+%{_libdir}/pkgconfig/libexslt.pc
+
+%files python
+%defattr(-, root, root)
+
+%doc AUTHORS ChangeLog.gz NEWS README Copyright FEATURES
+%{_libdir}/python*/site-packages/libxslt.py*
+%{_libdir}/python*/site-packages/libxsltmod*
+%doc python/TODO
+%doc python/libxsltclass.txt
+%doc python/tests/*.py
+%doc python/tests/*.xml
+%doc python/tests/*.xsl
+
+%changelog
+* @RELDATE@ Daniel Veillard 
+- upstream release @VERSION@ see http://xmlsoft.org/XSLT/news.html
diff --git a/third_party/libxslt/libxslt/attributes.c b/third_party/libxslt/libxslt/attributes.c
new file mode 100644
index 0000000..168dae6a
--- /dev/null
+++ b/third_party/libxslt/libxslt/attributes.c
@@ -0,0 +1,1132 @@
+/*
+ * attributes.c: Implementation of the XSLT attributes handling
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#ifdef HAVE_SYS_TYPES_H
+#include 
+#endif
+#ifdef HAVE_MATH_H
+#include 
+#endif
+#ifdef HAVE_FLOAT_H
+#include 
+#endif
+#ifdef HAVE_IEEEFP_H
+#include 
+#endif
+#ifdef HAVE_NAN_H
+#include 
+#endif
+#ifdef HAVE_CTYPE_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "attributes.h"
+#include "namespaces.h"
+#include "templates.h"
+#include "imports.h"
+#include "transform.h"
+#include "preproc.h"
+
+#define WITH_XSLT_DEBUG_ATTRIBUTES
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_ATTRIBUTES
+#endif
+
+/*
+ * TODO: merge attribute sets from different import precedence.
+ *       all this should be precomputed just before the transformation
+ *       starts or at first hit with a cache in the context.
+ *       The simple way for now would be to not allow redefinition of
+ *       attributes once generated in the output tree, possibly costlier.
+ */
+
+/*
+ * Useful macros
+ */
+#ifdef IS_BLANK
+#undef IS_BLANK
+#endif
+
+#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) ||	\
+                     ((c) == 0x0D))
+
+#define IS_BLANK_NODE(n)						\
+    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
+
+
+/*
+ * The in-memory structure corresponding to an XSLT Attribute in
+ * an attribute set
+ */
+
+
+typedef struct _xsltAttrElem xsltAttrElem;
+typedef xsltAttrElem *xsltAttrElemPtr;
+struct _xsltAttrElem {
+    struct _xsltAttrElem *next;/* chained list */
+    xmlNodePtr attr;	/* the xsl:attribute definition */
+    const xmlChar *set; /* or the attribute set */
+    const xmlChar *ns;  /* and its namespace */
+};
+
+/************************************************************************
+ *									*
+ *			XSLT Attribute handling				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltNewAttrElem:
+ * @attr:  the new xsl:attribute node
+ *
+ * Create a new XSLT AttrElem
+ *
+ * Returns the newly allocated xsltAttrElemPtr or NULL in case of error
+ */
+static xsltAttrElemPtr
+xsltNewAttrElem(xmlNodePtr attr) {
+    xsltAttrElemPtr cur;
+
+    cur = (xsltAttrElemPtr) xmlMalloc(sizeof(xsltAttrElem));
+    if (cur == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+		"xsltNewAttrElem : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltAttrElem));
+    cur->attr = attr;
+    return(cur);
+}
+
+/**
+ * xsltFreeAttrElem:
+ * @attr:  an XSLT AttrElem
+ *
+ * Free up the memory allocated by @attr
+ */
+static void
+xsltFreeAttrElem(xsltAttrElemPtr attr) {
+    xmlFree(attr);
+}
+
+/**
+ * xsltFreeAttrElemList:
+ * @list:  an XSLT AttrElem list
+ *
+ * Free up the memory allocated by @list
+ */
+static void
+xsltFreeAttrElemList(xsltAttrElemPtr list) {
+    xsltAttrElemPtr next;
+    
+    while (list != NULL) {
+	next = list->next;
+	xsltFreeAttrElem(list);
+	list = next;
+    }
+}
+
+#ifdef XSLT_REFACTORED
+    /*
+    * This was moved to xsltParseStylesheetAttributeSet().
+    */
+#else
+/**
+ * xsltAddAttrElemList:
+ * @list:  an XSLT AttrElem list
+ * @attr:  the new xsl:attribute node
+ *
+ * Add the new attribute to the list.
+ *
+ * Returns the new list pointer
+ */
+static xsltAttrElemPtr
+xsltAddAttrElemList(xsltAttrElemPtr list, xmlNodePtr attr) {
+    xsltAttrElemPtr next, cur;
+
+    if (attr == NULL)
+	return(list);
+    if (list == NULL)
+	return(xsltNewAttrElem(attr));
+    cur = list;
+    while (cur != NULL) {	
+	next = cur->next;
+	if (cur->attr == attr)
+	    return(cur);
+	if (cur->next == NULL) {
+	    cur->next = xsltNewAttrElem(attr);
+	    return(list);
+	}
+	cur = next;
+    }
+    return(list);
+}
+#endif /* XSLT_REFACTORED */
+
+/**
+ * xsltMergeAttrElemList:
+ * @list:  an XSLT AttrElem list
+ * @old:  another XSLT AttrElem list
+ *
+ * Add all the attributes from list @old to list @list,
+ * but drop redefinition of existing values.
+ *
+ * Returns the new list pointer
+ */
+static xsltAttrElemPtr
+xsltMergeAttrElemList(xsltStylesheetPtr style,
+		      xsltAttrElemPtr list, xsltAttrElemPtr old) {
+    xsltAttrElemPtr cur;
+    int add;
+
+    while (old != NULL) {
+	if ((old->attr == NULL) && (old->set == NULL)) {
+	    old = old->next;
+	    continue;
+	}
+	/*
+	 * Check that the attribute is not yet in the list
+	 */
+	cur = list;
+	add = 1;
+	while (cur != NULL) {
+	    if ((cur->attr == NULL) && (cur->set == NULL)) {
+		if (cur->next == NULL)
+		    break;
+		cur = cur->next;
+		continue;
+	    }
+	    if ((cur->set != NULL) && (cur->set == old->set)) {
+		add = 0;
+		break;
+	    }
+	    if (cur->set != NULL) {
+		if (cur->next == NULL)
+		    break;
+		cur = cur->next;
+		continue;
+	    }
+	    if (old->set != NULL) {
+		if (cur->next == NULL)
+		    break;
+		cur = cur->next;
+		continue;
+	    }
+	    if (cur->attr == old->attr) {
+		xsltGenericError(xsltGenericErrorContext,
+	     "xsl:attribute-set : use-attribute-sets recursion detected\n");
+		return(list);
+	    }
+	    if (cur->next == NULL)
+		break;
+            cur = cur->next;
+	}
+
+	if (add == 1) {
+	    /*
+	    * Changed to use the string-dict, rather than duplicating
+	    * @set and @ns; this fixes bug #340400.
+	    */
+	    if (cur == NULL) {
+		list = xsltNewAttrElem(old->attr);
+		if (old->set != NULL) {
+		    list->set = xmlDictLookup(style->dict, old->set, -1);
+		    if (old->ns != NULL)
+			list->ns = xmlDictLookup(style->dict, old->ns, -1);
+		}
+	    } else if (add) {
+		cur->next = xsltNewAttrElem(old->attr);
+		if (old->set != NULL) {
+		    cur->next->set = xmlDictLookup(style->dict, old->set, -1);
+		    if (old->ns != NULL)
+			cur->next->ns = xmlDictLookup(style->dict, old->ns, -1);
+		}
+	    }
+	}
+
+	old = old->next;
+    }
+    return(list);
+}
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltParseStylesheetAttributeSet:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "attribute-set" element
+ *
+ * parse an XSLT stylesheet attribute-set element
+ */
+
+void
+xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
+    const xmlChar *ncname;
+    const xmlChar *prefix;
+    xmlChar *value;
+    xmlNodePtr child;
+    xsltAttrElemPtr attrItems;
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+
+    value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL);
+    if (value == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsl:attribute-set : name is missing\n");
+	return;
+    }
+
+    ncname = xsltSplitQName(style->dict, value, &prefix);
+    xmlFree(value);
+    value = NULL;
+
+    if (style->attributeSets == NULL) {
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "creating attribute set table\n");
+#endif
+	style->attributeSets = xmlHashCreate(10);
+    }
+    if (style->attributeSets == NULL)
+	return;
+
+    attrItems = xmlHashLookup2(style->attributeSets, ncname, prefix);
+
+    /*
+    * Parse the content. Only xsl:attribute elements are allowed.
+    */
+    child = cur->children;
+    while (child != NULL) {
+	/*
+	* Report invalid nodes.
+	*/
+	if ((child->type != XML_ELEMENT_NODE) ||
+	    (child->ns == NULL) ||
+	    (! IS_XSLT_ELEM(child)))
+	{
+	    if (child->type == XML_ELEMENT_NODE)
+		xsltTransformError(NULL, style, child,
+			"xsl:attribute-set : unexpected child %s\n",
+		                 child->name);
+	    else
+		xsltTransformError(NULL, style, child,
+			"xsl:attribute-set : child of unexpected type\n");
+	} else if (!IS_XSLT_NAME(child, "attribute")) {
+	    xsltTransformError(NULL, style, child,
+		"xsl:attribute-set : unexpected child xsl:%s\n",
+		child->name);
+	} else {
+#ifdef XSLT_REFACTORED
+	    xsltAttrElemPtr nextAttr, curAttr;
+
+	    /*
+	    * Process xsl:attribute
+	    * ---------------------
+	    */
+
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add attribute to list %s\n", ncname);
+#endif
+	    /*
+	    * The following was taken over from
+	    * xsltAddAttrElemList().
+	    */
+	    if (attrItems == NULL) {
+		attrItems = xsltNewAttrElem(child);
+	    } else {
+		curAttr = attrItems;
+		while (curAttr != NULL) {
+		    nextAttr = curAttr->next;
+		    if (curAttr->attr == child) {
+			/*
+			* URGENT TODO: Can somebody explain
+			*  why attrItems is set to curAttr
+			*  here? Is this somehow related to
+			*  avoidance of recursions?
+			*/
+			attrItems = curAttr;
+			goto next_child;
+		    }
+		    if (curAttr->next == NULL)			
+			curAttr->next = xsltNewAttrElem(child);
+		    curAttr = nextAttr;
+		}
+	    }
+	    /*
+	    * Parse the xsl:attribute and its content.
+	    */
+	    xsltParseAnyXSLTElem(XSLT_CCTXT(style), child);
+#else
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add attribute to list %s\n", ncname);
+#endif
+	    /*
+	    * OLD behaviour:
+	    */
+	    attrItems = xsltAddAttrElemList(attrItems, child);
+#endif
+	}
+
+#ifdef XSLT_REFACTORED
+next_child:
+#endif
+	child = child->next;
+    }
+
+    /*
+    * Process attribue "use-attribute-sets".
+    */
+    /* TODO check recursion */    
+    value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
+	NULL);
+    if (value != NULL) {
+	const xmlChar *curval, *endval;
+	curval = value;
+	while (*curval != 0) {
+	    while (IS_BLANK(*curval)) curval++;
+	    if (*curval == 0)
+		break;
+	    endval = curval;
+	    while ((*endval != 0) && (!IS_BLANK(*endval))) endval++;
+	    curval = xmlDictLookup(style->dict, curval, endval - curval);
+	    if (curval) {
+		const xmlChar *ncname2 = NULL;
+		const xmlChar *prefix2 = NULL;
+		xsltAttrElemPtr refAttrItems;
+		
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "xsl:attribute-set : %s adds use %s\n", ncname, curval);
+#endif
+		ncname2 = xsltSplitQName(style->dict, curval, &prefix2);
+		refAttrItems = xsltNewAttrElem(NULL);
+		if (refAttrItems != NULL) {
+		    refAttrItems->set = ncname2;
+		    refAttrItems->ns = prefix2;
+		    attrItems = xsltMergeAttrElemList(style,
+			attrItems, refAttrItems);
+		    xsltFreeAttrElem(refAttrItems);
+		}
+	    }
+	    curval = endval;
+	}
+	xmlFree(value);
+	value = NULL;
+    }
+
+    /*
+     * Update the value
+     */
+    /*
+    * TODO: Why is this dummy entry needed.?
+    */
+    if (attrItems == NULL)
+	attrItems = xsltNewAttrElem(NULL);
+    xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, attrItems, NULL);
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+    xsltGenericDebug(xsltGenericDebugContext,
+	"updated attribute list %s\n", ncname);
+#endif
+}
+
+/**
+ * xsltGetSAS:
+ * @style:  the XSLT stylesheet
+ * @name:  the attribute list name
+ * @ns:  the attribute list namespace
+ *
+ * lookup an attribute set based on the style cascade
+ *
+ * Returns the attribute set or NULL
+ */
+static xsltAttrElemPtr
+xsltGetSAS(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns) {
+    xsltAttrElemPtr values;
+
+    while (style != NULL) {
+	values = xmlHashLookup2(style->attributeSets, name, ns);
+	if (values != NULL)
+	    return(values);
+	style = xsltNextImport(style);
+    }
+    return(NULL);
+}
+
+/**
+ * xsltResolveSASCallback,:
+ * @style:  the XSLT stylesheet
+ *
+ * resolve the references in an attribute set.
+ */
+static void
+xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style,
+	               const xmlChar *name, const xmlChar *ns,
+		       ATTRIBUTE_UNUSED const xmlChar *ignored) {
+    xsltAttrElemPtr tmp;
+    xsltAttrElemPtr refs;
+
+    tmp = values;
+    while (tmp != NULL) {
+	if (tmp->set != NULL) {
+	    /*
+	     * Check against cycles !
+	     */
+	    if ((xmlStrEqual(name, tmp->set)) && (xmlStrEqual(ns, tmp->ns))) {
+		xsltGenericError(xsltGenericErrorContext,
+     "xsl:attribute-set : use-attribute-sets recursion detected on %s\n",
+                                 name);
+	    } else {
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+		xsltGenericDebug(xsltGenericDebugContext,
+			"Importing attribute list %s\n", tmp->set);
+#endif
+
+		refs = xsltGetSAS(style, tmp->set, tmp->ns);
+		if (refs == NULL) {
+		    xsltGenericError(xsltGenericErrorContext,
+     "xsl:attribute-set : use-attribute-sets %s reference missing %s\n",
+				     name, tmp->set);
+		} else {
+		    /*
+		     * recurse first for cleanup
+		     */
+		    xsltResolveSASCallback(refs, style, name, ns, NULL);
+		    /*
+		     * Then merge
+		     */
+		    xsltMergeAttrElemList(style, values, refs);
+		    /*
+		     * Then suppress the reference
+		     */
+		    tmp->set = NULL;
+		    tmp->ns = NULL;
+		}
+	    }
+	}
+	tmp = tmp->next;
+    }
+}
+
+/**
+ * xsltMergeSASCallback,:
+ * @style:  the XSLT stylesheet
+ *
+ * Merge an attribute set from an imported stylesheet.
+ */
+static void
+xsltMergeSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style,
+	               const xmlChar *name, const xmlChar *ns,
+		       ATTRIBUTE_UNUSED const xmlChar *ignored) {
+    int ret;
+    xsltAttrElemPtr topSet;
+
+    ret = xmlHashAddEntry2(style->attributeSets, name, ns, values);
+    if (ret < 0) {
+	/*
+	 * Add failed, this attribute set can be removed.
+	 */
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	xsltGenericDebug(xsltGenericDebugContext,
+		"attribute set %s present already in top stylesheet"
+		" - merging\n", name);
+#endif
+	topSet = xmlHashLookup2(style->attributeSets, name, ns);
+	if (topSet==NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	        "xsl:attribute-set : logic error merging from imports for"
+		" attribute-set %s\n", name);
+	} else {
+	    topSet = xsltMergeAttrElemList(style, topSet, values);
+	    xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL);
+	}
+	xsltFreeAttrElemList(values);
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+    } else {
+	xsltGenericDebug(xsltGenericDebugContext,
+		"attribute set %s moved to top stylesheet\n",
+		         name);
+#endif
+    }
+}
+
+/**
+ * xsltResolveStylesheetAttributeSet:
+ * @style:  the XSLT stylesheet
+ *
+ * resolve the references between attribute sets.
+ */
+void
+xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) {
+    xsltStylesheetPtr cur;
+
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+    xsltGenericDebug(xsltGenericDebugContext,
+	    "Resolving attribute sets references\n");
+#endif
+    /*
+     * First aggregate all the attribute sets definitions from the imports
+     */
+    cur = xsltNextImport(style);
+    while (cur != NULL) {
+	if (cur->attributeSets != NULL) {
+	    if (style->attributeSets == NULL) {
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "creating attribute set table\n");
+#endif
+		style->attributeSets = xmlHashCreate(10);
+	    }
+	    xmlHashScanFull(cur->attributeSets, 
+		(xmlHashScannerFull) xsltMergeSASCallback, style);
+	    /*
+	     * the attribute lists have either been migrated to style
+	     * or freed directly in xsltMergeSASCallback()
+	     */
+	    xmlHashFree(cur->attributeSets, NULL);
+	    cur->attributeSets = NULL;
+	}
+	cur = xsltNextImport(cur);
+    }
+
+    /*
+     * Then resolve all the references and computes the resulting sets
+     */
+    if (style->attributeSets != NULL) {
+	xmlHashScanFull(style->attributeSets, 
+		(xmlHashScannerFull) xsltResolveSASCallback, style);
+    }
+}
+
+/**
+ * xsltAttributeInternal:
+ * @ctxt:  a XSLT process context
+ * @node:  the current node in the source tree
+ * @inst:  the xsl:attribute element
+ * @comp:  precomputed information
+ * @fromAttributeSet:  the attribute comes from an attribute-set
+ *
+ * Process the xslt attribute node on the source node
+ */
+static void
+xsltAttributeInternal(xsltTransformContextPtr ctxt,
+		      xmlNodePtr contextNode,
+                      xmlNodePtr inst,
+		      xsltStylePreCompPtr castedComp,
+                      int fromAttributeSet)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemAttributePtr comp =
+	(xsltStyleItemAttributePtr) castedComp;   
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xmlNodePtr targetElem;
+    xmlChar *prop = NULL;    
+    const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL;
+    xmlChar *value = NULL;
+    xmlNsPtr ns = NULL;
+    xmlAttrPtr attr;    
+
+    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
+        return;
+
+    /* 
+    * A comp->has_name == 0 indicates that we need to skip this instruction,
+    * since it was evaluated to be invalid already during compilation.
+    */
+    if (!comp->has_name)
+        return;
+    /*
+    * BIG NOTE: This previously used xsltGetSpecialNamespace() and
+    *  xsltGetNamespace(), but since both are not appropriate, we
+    *  will process namespace lookup here to avoid adding yet another
+    *  ns-lookup function to namespaces.c.
+    */
+    /*
+    * SPEC XSLT 1.0: Error cases:
+    * - Creating nodes other than text nodes during the instantiation of
+    *   the content of the xsl:attribute element; implementations may
+    *   either signal the error or ignore the offending nodes."
+    */
+
+    if (comp == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltAttributeInternal(): "
+	    "The XSLT 'attribute' instruction was not compiled.\n");
+        return;
+    }
+    /*
+    * TODO: Shouldn't ctxt->insert == NULL be treated as an internal error?
+    *   So report an internal error?
+    */
+    if (ctxt->insert == NULL)
+        return;    
+    /*
+    * SPEC XSLT 1.0:
+    *  "Adding an attribute to a node that is not an element;
+    *  implementations may either signal the error or ignore the attribute."
+    *
+    * TODO: I think we should signal such errors in the future, and maybe
+    *  provide an option to ignore such errors.
+    */
+    targetElem = ctxt->insert;
+    if (targetElem->type != XML_ELEMENT_NODE)
+	return;
+    
+    /*
+    * SPEC XSLT 1.0:
+    * "Adding an attribute to an element after children have been added
+    *  to it; implementations may either signal the error or ignore the
+    *  attribute."
+    *
+    * TODO: We should decide whether not to report such errors or
+    *  to ignore them; note that we *ignore* if the parent is not an
+    *  element, but here we report an error.
+    */
+    if (targetElem->children != NULL) {
+	/*
+	* NOTE: Ah! This seems to be intended to support streamed
+	*  result generation!.
+	*/
+        xsltTransformError(ctxt, NULL, inst,
+	    "xsl:attribute: Cannot add attributes to an "
+	    "element if children have been already added "
+	    "to the element.\n");
+        return;
+    }
+
+    /*
+    * Process the name
+    * ----------------
+    */    
+
+#ifdef WITH_DEBUGGER
+    if (ctxt->debugStatus != XSLT_DEBUG_NONE)
+        xslHandleDebugger(inst, contextNode, NULL, ctxt);
+#endif
+
+    if (comp->name == NULL) {
+	/* TODO: fix attr acquisition wrt to the XSLT namespace */
+        prop = xsltEvalAttrValueTemplate(ctxt, inst,
+	    (const xmlChar *) "name", XSLT_NAMESPACE);
+        if (prop == NULL) {
+            xsltTransformError(ctxt, NULL, inst,
+		"xsl:attribute: The attribute 'name' is missing.\n");
+            goto error;
+        }
+	if (xmlValidateQName(prop, 0)) {
+	    xsltTransformError(ctxt, NULL, inst,
+		"xsl:attribute: The effective name '%s' is not a "
+		"valid QName.\n", prop);
+	    /* we fall through to catch any further errors, if possible */
+	}
+	name = xsltSplitQName(ctxt->dict, prop, &prefix);
+	xmlFree(prop);
+
+	/*
+	* Reject a prefix of "xmlns".
+	*/
+	if ((prefix != NULL) &&
+	    (!xmlStrncasecmp(prefix, (xmlChar *) "xmlns", 5)))
+	{
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"xsltAttribute: xmlns prefix forbidden\n");
+#endif
+	    /*
+	    * SPEC XSLT 1.0:
+	    *  "It is an error if the string that results from instantiating
+	    *  the attribute value template is not a QName or is the string
+	    *  xmlns. An XSLT processor may signal the error; if it does not
+	    *  signal the error, it must recover by not adding the attribute
+	    *  to the result tree."
+	    * TODO: Decide which way to go here.
+	    */
+	    goto error;
+	}
+
+    } else {
+	/*
+	* The "name" value was static.
+	*/
+#ifdef XSLT_REFACTORED
+	prefix = comp->nsPrefix;
+	name = comp->name;
+#else
+	name = xsltSplitQName(ctxt->dict, comp->name, &prefix);
+#endif
+    }
+    
+    /*
+    * Process namespace semantics
+    * ---------------------------
+    *
+    * Evaluate the namespace name.
+    */
+    if (comp->has_ns) {
+	/*
+	* The "namespace" attribute was existent.
+	*/
+	if (comp->ns != NULL) {
+	    /*
+	    * No AVT; just plain text for the namespace name.
+	    */
+	    if (comp->ns[0] != 0)
+		nsName = comp->ns;
+	} else {
+	    xmlChar *tmpNsName;
+	    /*
+	    * Eval the AVT.
+	    */
+	    /* TODO: check attr acquisition wrt to the XSLT namespace */
+	    tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst,
+		(const xmlChar *) "namespace", XSLT_NAMESPACE);	
+	    /*
+	    * This fixes bug #302020: The AVT might also evaluate to the 
+	    * empty string; this means that the empty string also indicates
+	    * "no namespace".
+	    * SPEC XSLT 1.0:
+	    *  "If the string is empty, then the expanded-name of the
+	    *  attribute has a null namespace URI."
+	    */
+	    if ((tmpNsName != NULL) && (tmpNsName[0] != 0))
+		nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1);
+	    xmlFree(tmpNsName);		
+	};	    
+    } else if (prefix != NULL) {
+	/*
+	* SPEC XSLT 1.0:
+	*  "If the namespace attribute is not present, then the QName is
+	*  expanded into an expanded-name using the namespace declarations
+	*  in effect for the xsl:attribute element, *not* including any
+	*  default namespace declaration."
+	*/	
+	ns = xmlSearchNs(inst->doc, inst, prefix);
+	if (ns == NULL) {
+	    /*
+	    * Note that this is treated as an error now (checked with
+	    *  Saxon, Xalan-J and MSXML).
+	    */
+	    xsltTransformError(ctxt, NULL, inst,
+		"xsl:attribute: The QName '%s:%s' has no "
+		"namespace binding in scope in the stylesheet; "
+		"this is an error, since the namespace was not "
+		"specified by the instruction itself.\n", prefix, name);
+	} else
+	    nsName = ns->href;	
+    }
+
+    if (fromAttributeSet) {
+	/*
+	* This tries to ensure that xsl:attribute(s) coming
+	* from an xsl:attribute-set won't override attribute of
+	* literal result elements or of explicit xsl:attribute(s).
+	* URGENT TODO: This might be buggy, since it will miss to
+	*  overwrite two equal attributes both from attribute sets.
+	*/
+	attr = xmlHasNsProp(targetElem, name, nsName);
+	if (attr != NULL)
+	    return;
+    }
+
+    /*
+    * Find/create a matching ns-decl in the result tree.
+    */
+    ns = NULL;
+    
+#if 0
+    if (0) {	
+	/*
+	* OPTIMIZE TODO: How do we know if we are adding to a
+	*  fragment or to the result tree?
+	*
+	* If we are adding to a result tree fragment (i.e., not to the
+	* actual result tree), we'll don't bother searching for the
+	* ns-decl, but just store it in the dummy-doc of the result
+	* tree fragment.
+	*/
+	if (nsName != NULL) {
+	    /*
+	    * TODO: Get the doc of @targetElem.
+	    */
+	    ns = xsltTreeAcquireStoredNs(some doc, nsName, prefix);
+	}
+    }
+#endif
+
+    if (nsName != NULL) {	
+	/*
+	* Something about ns-prefixes:
+	* SPEC XSLT 1.0:
+	*  "XSLT processors may make use of the prefix of the QName specified
+	*  in the name attribute when selecting the prefix used for outputting
+	*  the created attribute as XML; however, they are not required to do
+	*  so and, if the prefix is xmlns, they must not do so"
+	*/
+	/*
+	* xsl:attribute can produce a scenario where the prefix is NULL,
+	* so generate a prefix.
+	*/
+	if (prefix == NULL) {
+	    xmlChar *pref = xmlStrdup(BAD_CAST "ns_1");
+
+	    ns = xsltGetSpecialNamespace(ctxt, inst, nsName, BAD_CAST pref,
+		targetElem);
+
+	    xmlFree(pref);
+	} else {
+	    ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix,
+		targetElem);
+	}
+	if (ns == NULL) {
+	    xsltTransformError(ctxt, NULL, inst,
+		"Namespace fixup error: Failed to acquire an in-scope "
+		"namespace binding for the generated attribute '{%s}%s'.\n",
+		nsName, name);
+	    goto error;
+	}
+    }
+    /*
+    * Construction of the value
+    * -------------------------
+    */
+    if (inst->children == NULL) {
+	/*
+	* No content.
+	* TODO: Do we need to put the empty string in ?
+	*/
+	attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) "");
+    } else if ((inst->children->next == NULL) && 
+	    ((inst->children->type == XML_TEXT_NODE) ||
+	     (inst->children->type == XML_CDATA_SECTION_NODE)))
+    {
+	xmlNodePtr copyTxt;
+	
+	/*
+	* xmlSetNsProp() will take care of duplicates.
+	*/
+	attr = xmlSetNsProp(ctxt->insert, ns, name, NULL);
+	if (attr == NULL) /* TODO: report error ? */
+	    goto error;
+	/*
+	* This was taken over from xsltCopyText() (transform.c).
+	*/
+	if (ctxt->internalized &&
+	    (ctxt->insert->doc != NULL) &&
+	    (ctxt->insert->doc->dict == ctxt->dict))
+	{
+	    copyTxt = xmlNewText(NULL);
+	    if (copyTxt == NULL) /* TODO: report error */
+		goto error;
+	    /*
+	    * This is a safe scenario where we don't need to lookup
+	    * the dict.
+	    */
+	    copyTxt->content = inst->children->content;
+	    /*
+	    * Copy "disable-output-escaping" information.
+	    * TODO: Does this have any effect for attribute values
+	    *  anyway?
+	    */
+	    if (inst->children->name == xmlStringTextNoenc)
+		copyTxt->name = xmlStringTextNoenc;
+	} else {
+	    /*
+	    * Copy the value.
+	    */
+	    copyTxt = xmlNewText(inst->children->content);
+	    if (copyTxt == NULL) /* TODO: report error */
+		goto error;	    	    
+	}
+	attr->children = attr->last = copyTxt;
+	copyTxt->parent = (xmlNodePtr) attr;
+	copyTxt->doc = attr->doc;
+	/*
+	* Copy "disable-output-escaping" information.
+	* TODO: Does this have any effect for attribute values
+	*  anyway?
+	*/
+	if (inst->children->name == xmlStringTextNoenc)
+	    copyTxt->name = xmlStringTextNoenc;	
+
+    } else {
+	/*
+	* The sequence constructor might be complex, so instantiate it.
+	*/
+	value = xsltEvalTemplateString(ctxt, contextNode, inst);
+	if (value != NULL) {
+	    attr = xmlSetNsProp(ctxt->insert, ns, name, value);
+	    xmlFree(value);
+	} else {
+	    /*
+	    * TODO: Do we have to add the empty string to the attr?
+	    * TODO: Does a  value of NULL indicate an
+	    *  error in xsltEvalTemplateString() ?
+	    */
+	    attr = xmlSetNsProp(ctxt->insert, ns, name,
+		(const xmlChar *) "");
+	}
+    }
+
+error:
+    return;    
+}
+
+/**
+ * xsltAttribute:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt attribute node
+ * @comp:  precomputed information
+ *
+ * Process the xslt attribute node on the source node
+ */
+void
+xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	      xmlNodePtr inst, xsltStylePreCompPtr comp) {
+    xsltAttributeInternal(ctxt, node, inst, comp, 0);
+}
+
+/**
+ * xsltApplyAttributeSet:
+ * @ctxt:  the XSLT stylesheet
+ * @node:  the node in the source tree.
+ * @inst:  the attribute node "xsl:use-attribute-sets"
+ * @attrSets:  the list of QNames of the attribute-sets to be applied
+ *
+ * Apply the xsl:use-attribute-sets.
+ * If @attrSets is NULL, then @inst will be used to exctract this
+ * value.
+ * If both, @attrSets and @inst, are NULL, then this will do nothing.
+ */
+void
+xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
+                      xmlNodePtr inst,
+                      const xmlChar *attrSets)
+{
+    const xmlChar *ncname = NULL;
+    const xmlChar *prefix = NULL;    
+    const xmlChar *curstr, *endstr;
+    xsltAttrElemPtr attrs;
+    xsltStylesheetPtr style;    
+
+    if (attrSets == NULL) {
+	if (inst == NULL)
+	    return;
+	else {
+	    /*
+	    * Extract the value from @inst.
+	    */
+	    if (inst->type == XML_ATTRIBUTE_NODE) {
+		if ( ((xmlAttrPtr) inst)->children != NULL)
+		    attrSets = ((xmlAttrPtr) inst)->children->content;
+		
+	    }
+	    if (attrSets == NULL) {
+		/*
+		* TODO: Return an error?
+		*/
+		return;
+	    }
+	}
+    }
+    /*
+    * Parse/apply the list of QNames.
+    */
+    curstr = attrSets;
+    while (*curstr != 0) {
+        while (IS_BLANK(*curstr))
+            curstr++;
+        if (*curstr == 0)
+            break;
+        endstr = curstr;
+        while ((*endstr != 0) && (!IS_BLANK(*endstr)))
+            endstr++;
+        curstr = xmlDictLookup(ctxt->dict, curstr, endstr - curstr);
+        if (curstr) {
+	    /*
+	    * TODO: Validate the QName.
+	    */
+
+#ifdef WITH_XSLT_DEBUG_curstrUTES
+            xsltGenericDebug(xsltGenericDebugContext,
+                             "apply curstrute set %s\n", curstr);
+#endif
+            ncname = xsltSplitQName(ctxt->dict, curstr, &prefix);
+
+            style = ctxt->style;
+
+#ifdef WITH_DEBUGGER
+            if ((style != NULL) &&
+		(style->attributeSets != NULL) &&
+		(ctxt->debugStatus != XSLT_DEBUG_NONE))
+	    {
+                attrs =
+                    xmlHashLookup2(style->attributeSets, ncname, prefix);
+                if ((attrs != NULL) && (attrs->attr != NULL))
+                    xslHandleDebugger(attrs->attr->parent, node, NULL,
+			ctxt);
+            }
+#endif
+	    /*
+	    * Lookup the referenced curstrute-set.
+	    */
+            while (style != NULL) {
+                attrs =
+                    xmlHashLookup2(style->attributeSets, ncname, prefix);
+                while (attrs != NULL) {
+                    if (attrs->attr != NULL) {
+                        xsltAttributeInternal(ctxt, node, attrs->attr,
+			    attrs->attr->psvi, 1);
+                    }
+                    attrs = attrs->next;
+                }
+                style = xsltNextImport(style);
+            }
+        }
+        curstr = endstr;
+    }
+}
+
+/**
+ * xsltFreeAttributeSetsHashes:
+ * @style: an XSLT stylesheet
+ *
+ * Free up the memory used by attribute sets
+ */
+void
+xsltFreeAttributeSetsHashes(xsltStylesheetPtr style) {
+    if (style->attributeSets != NULL)
+	xmlHashFree((xmlHashTablePtr) style->attributeSets,
+		    (xmlHashDeallocator) xsltFreeAttrElemList);
+    style->attributeSets = NULL;
+}
diff --git a/third_party/libxslt/libxslt/attributes.h b/third_party/libxslt/libxslt/attributes.h
new file mode 100644
index 0000000..d61ebb0
--- /dev/null
+++ b/third_party/libxslt/libxslt/attributes.h
@@ -0,0 +1,38 @@
+/*
+ * Summary: interface for the XSLT attribute handling
+ * Description: this module handles the specificities of attribute
+ *              and attribute groups processing.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_ATTRIBUTES_H__
+#define __XML_XSLT_ATTRIBUTES_H__
+
+#include 
+#include "xsltexports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+XSLTPUBFUN void XSLTCALL
+	xsltParseStylesheetAttributeSet	(xsltStylesheetPtr style,
+					 xmlNodePtr cur);
+XSLTPUBFUN void XSLTCALL    
+	xsltFreeAttributeSetsHashes	(xsltStylesheetPtr style);
+XSLTPUBFUN void XSLTCALL	
+	xsltApplyAttributeSet		(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 const xmlChar *attributes);
+XSLTPUBFUN void XSLTCALL	
+	xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_ATTRIBUTES_H__ */
+
diff --git a/third_party/libxslt/libxslt/attrvt.c b/third_party/libxslt/libxslt/attrvt.c
new file mode 100644
index 0000000..b63b77b
--- /dev/null
+++ b/third_party/libxslt/libxslt/attrvt.c
@@ -0,0 +1,377 @@
+/*
+ * attrvt.c: Implementation of the XSL Transformation 1.0 engine
+ *           attribute value template handling part.
+ *
+ * References:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ *   Michael Kay "XSLT Programmer's Reference" pp 637-643
+ *   Writing Multiple Output Files
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltutils.h"
+#include "xsltInternals.h"
+#include "templates.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_AVT
+#endif
+
+#define MAX_AVT_SEG 10
+
+typedef struct _xsltAttrVT xsltAttrVT;
+typedef xsltAttrVT *xsltAttrVTPtr;
+struct _xsltAttrVT {
+    struct _xsltAttrVT *next; /* next xsltAttrVT */
+    int nb_seg;		/* Number of segments */
+    int max_seg;	/* max capacity before re-alloc needed */
+    int strstart;	/* is the start a string */
+    /*
+     * the namespaces in scope
+     */
+    xmlNsPtr *nsList;
+    int nsNr;
+    /*
+     * the content is an alternate of string and xmlXPathCompExprPtr
+     */
+    void *segments[MAX_AVT_SEG];
+};
+
+/**
+ * xsltNewAttrVT:
+ * @style:  a XSLT process context
+ *
+ * Build a new xsltAttrVT structure
+ *
+ * Returns the structure or NULL in case of error
+ */
+static xsltAttrVTPtr
+xsltNewAttrVT(xsltStylesheetPtr style) {
+    xsltAttrVTPtr cur;
+
+    cur = (xsltAttrVTPtr) xmlMalloc(sizeof(xsltAttrVT));
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, NULL,
+		"xsltNewAttrVTPtr : malloc failed\n");
+	if (style != NULL) style->errors++;
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltAttrVT));
+
+    cur->nb_seg = 0;
+    cur->max_seg = MAX_AVT_SEG;
+    cur->strstart = 0;
+    cur->next = style->attVTs;
+    /*
+     * Note: this pointer may be changed by a re-alloc within xsltCompileAttr,
+     * so that code may change the stylesheet pointer also!
+     */
+    style->attVTs = (xsltAttrVTPtr) cur;
+
+    return(cur);
+}
+
+/**
+ * xsltFreeAttrVT:
+ * @avt: pointer to an xsltAttrVT structure
+ *
+ * Free up the memory associated to the attribute value template
+ */
+static void
+xsltFreeAttrVT(xsltAttrVTPtr avt) {
+    int i;
+
+    if (avt == NULL) return;
+
+    if (avt->strstart == 1) {
+	for (i = 0;i < avt->nb_seg; i += 2)
+	    if (avt->segments[i] != NULL)
+		xmlFree((xmlChar *) avt->segments[i]);
+	for (i = 1;i < avt->nb_seg; i += 2)
+	    xmlXPathFreeCompExpr((xmlXPathCompExprPtr) avt->segments[i]);
+    } else {
+	for (i = 0;i < avt->nb_seg; i += 2)
+	    xmlXPathFreeCompExpr((xmlXPathCompExprPtr) avt->segments[i]);
+	for (i = 1;i < avt->nb_seg; i += 2)
+	    if (avt->segments[i] != NULL)
+		xmlFree((xmlChar *) avt->segments[i]);
+    }
+    if (avt->nsList != NULL)
+        xmlFree(avt->nsList);
+    xmlFree(avt);
+}
+
+/**
+ * xsltFreeAVTList:
+ * @avt: pointer to an list of AVT structures
+ *
+ * Free up the memory associated to the attribute value templates
+ */
+void
+xsltFreeAVTList(void *avt) {
+    xsltAttrVTPtr cur = (xsltAttrVTPtr) avt, next;
+
+    while (cur != NULL) {
+        next = cur->next;
+	xsltFreeAttrVT(cur);
+	cur = next;
+    }
+}
+/**
+ * xsltSetAttrVTsegment:
+ * @ avt: pointer to an xsltAttrVT structure
+ * @ val: the value to be set to the next available segment
+ *
+ * Within xsltCompileAttr there are several places where a value
+ * needs to be added to the 'segments' array within the xsltAttrVT
+ * structure, and at each place the allocated size may have to be
+ * re-allocated.  This routine takes care of that situation.
+ *
+ * Returns the avt pointer, which may have been changed by a re-alloc
+ */
+static xsltAttrVTPtr
+xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) {
+    if (avt->nb_seg >= avt->max_seg) {
+	avt = (xsltAttrVTPtr) xmlRealloc(avt, sizeof(xsltAttrVT) +
+	    		avt->max_seg * sizeof(void *));
+	if (avt == NULL) {
+	    return NULL;
+	}
+	memset(&avt->segments[avt->nb_seg], 0, MAX_AVT_SEG*sizeof(void *));
+	avt->max_seg += MAX_AVT_SEG;
+    }
+    avt->segments[avt->nb_seg++] = val;
+    return avt;
+}
+
+/**
+ * xsltCompileAttr:
+ * @style:  a XSLT process context
+ * @attr: the attribute coming from the stylesheet.
+ *
+ * Precompile an attribute in a stylesheet, basically it checks if it is
+ * an attrubute value template, and if yes establish some structures needed
+ * to process it at transformation time.
+ */
+void
+xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) {
+    const xmlChar *str;
+    const xmlChar *cur;
+    xmlChar *ret = NULL;
+    xmlChar *expr = NULL;
+    xsltAttrVTPtr avt;
+    int i = 0, lastavt = 0;
+
+    if ((style == NULL) || (attr == NULL) || (attr->children == NULL))
+        return;
+    if ((attr->children->type != XML_TEXT_NODE) || 
+        (attr->children->next != NULL)) {
+        xsltTransformError(NULL, style, attr->parent,
+	    "Attribute '%s': The content is expected to be a single text "
+	    "node when compiling an AVT.\n", attr->name);
+	style->errors++;
+	return;
+    }
+    str = attr->children->content;
+    if ((xmlStrchr(str, '{') == NULL) &&
+        (xmlStrchr(str, '}') == NULL)) return;
+
+#ifdef WITH_XSLT_DEBUG_AVT
+    xsltGenericDebug(xsltGenericDebugContext,
+		    "Found AVT %s: %s\n", attr->name, str);
+#endif
+    if (attr->psvi != NULL) {
+#ifdef WITH_XSLT_DEBUG_AVT
+	xsltGenericDebug(xsltGenericDebugContext,
+			"AVT %s: already compiled\n", attr->name);
+#endif
+        return;
+    }
+    /*
+    * Create a new AVT object.
+    */
+    avt = xsltNewAttrVT(style);
+    if (avt == NULL)
+	return;
+    attr->psvi = avt;
+
+    avt->nsList = xmlGetNsList(attr->doc, attr->parent);
+    if (avt->nsList != NULL) {
+	while (avt->nsList[i] != NULL)
+	    i++;
+    }
+    avt->nsNr = i;
+
+    cur = str;
+    while (*cur != 0) {
+	if (*cur == '{') {
+	    if (*(cur+1) == '{') {	/* escaped '{' */
+	        cur++;
+		ret = xmlStrncat(ret, str, cur - str);
+		cur++;
+		str = cur;
+		continue;
+	    }
+	    if (*(cur+1) == '}') {	/* skip empty AVT */
+		ret = xmlStrncat(ret, str, cur - str);
+	        cur += 2;
+		str = cur;
+		continue;
+	    }
+	    if ((ret != NULL) || (cur - str > 0)) {
+		ret = xmlStrncat(ret, str, cur - str);
+		str = cur;
+		if (avt->nb_seg == 0)
+		    avt->strstart = 1;
+		if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL)
+		    goto error;
+		ret = NULL;
+		lastavt = 0;
+	    }
+
+	    cur++;
+	    while ((*cur != 0) && (*cur != '}')) cur++;
+	    if (*cur == 0) {
+	        xsltTransformError(NULL, style, attr->parent,
+		     "Attribute '%s': The AVT has an unmatched '{'.\n",
+		     attr->name);
+		style->errors++;
+		goto error;
+	    }
+	    str++;
+	    expr = xmlStrndup(str, cur - str);
+	    if (expr == NULL) {
+		/*
+		* TODO: What needs to be done here?
+		*/
+	        XSLT_TODO
+		goto error;
+	    } else {
+		xmlXPathCompExprPtr comp;
+
+		comp = xsltXPathCompile(style, expr);
+		if (comp == NULL) {
+		    xsltTransformError(NULL, style, attr->parent,
+			 "Attribute '%s': Failed to compile the expression "
+			 "'%s' in the AVT.\n", attr->name, expr);
+		    style->errors++;
+		    goto error;
+		}
+		if (avt->nb_seg == 0)
+		    avt->strstart = 0;
+		if (lastavt == 1) {
+		    if ((avt = xsltSetAttrVTsegment(avt, NULL)) == NULL)
+		        goto error;
+		}
+		if ((avt = xsltSetAttrVTsegment(avt, (void *) comp)) == NULL)
+		    goto error;
+		lastavt = 1;
+		xmlFree(expr);
+		expr = NULL;
+	    }
+	    cur++;
+	    str = cur;
+	} else if (*cur == '}') {
+	    cur++;
+	    if (*cur == '}') {	/* escaped '}' */
+		ret = xmlStrncat(ret, str, cur - str);
+		cur++;
+		str = cur;
+		continue;
+	    } else {
+	        xsltTransformError(NULL, style, attr->parent,
+		     "Attribute '%s': The AVT has an unmatched '}'.\n",
+		     attr->name);
+		goto error;
+	    }
+	} else
+	    cur++;
+    }
+    if ((ret != NULL) || (cur - str > 0)) {
+	ret = xmlStrncat(ret, str, cur - str);
+	str = cur;
+	if (avt->nb_seg == 0)
+	    avt->strstart = 1;
+	if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL)
+	    goto error;
+	ret = NULL;
+    }
+
+error:
+    if (avt == NULL) {
+        xsltTransformError(NULL, style, attr->parent,
+		"xsltCompileAttr: malloc problem\n");
+    } else {
+        if (attr->psvi != avt) {  /* may have changed from realloc */
+            attr->psvi = avt;
+	    /*
+	     * This is a "hack", but I can't see any clean method of
+	     * doing it.  If a re-alloc has taken place, then the pointer
+	     * for this AVT may have changed.  style->attVTs was set by
+	     * xsltNewAttrVT, so it needs to be re-set to the new value!
+	     */
+	    style->attVTs = avt;
+	}
+    }
+    if (ret != NULL)
+	xmlFree(ret);
+    if (expr != NULL)
+	xmlFree(expr);
+}
+
+
+/**
+ * xsltEvalAVT:
+ * @ctxt: the XSLT transformation context
+ * @avt: the prevompiled attribute value template info
+ * @node: the node hosting the attribute
+ *
+ * Process the given AVT, and return the new string value.
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *         caller.
+ */
+xmlChar *
+xsltEvalAVT(xsltTransformContextPtr ctxt, void *avt, xmlNodePtr node) {
+    xmlChar *ret = NULL, *tmp;
+    xmlXPathCompExprPtr comp;
+    xsltAttrVTPtr cur = (xsltAttrVTPtr) avt;
+    int i;
+    int str;
+
+    if ((ctxt == NULL) || (avt == NULL) || (node == NULL))
+        return(NULL);
+    str = cur->strstart;
+    for (i = 0;i < cur->nb_seg;i++) {
+        if (str) {
+	    ret = xmlStrcat(ret, (const xmlChar *) cur->segments[i]);
+	} else {
+	    comp = (xmlXPathCompExprPtr) cur->segments[i];
+	    tmp = xsltEvalXPathStringNs(ctxt, comp, cur->nsNr, cur->nsList);
+	    if (tmp != NULL) {
+	        if (ret != NULL) {
+		    ret = xmlStrcat(ret, tmp);
+		    xmlFree(tmp);
+		} else {
+		    ret = tmp;
+		}
+	    }
+	}
+	str = !str;
+    }
+    return(ret);
+}
diff --git a/third_party/libxslt/libxslt/documents.c b/third_party/libxslt/libxslt/documents.c
new file mode 100644
index 0000000..128cefe
--- /dev/null
+++ b/third_party/libxslt/libxslt/documents.c
@@ -0,0 +1,434 @@
+/*
+ * documents.c: Implementation of the documents handling
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "documents.h"
+#include "transform.h"
+#include "imports.h"
+#include "keys.h"
+#include "security.h"
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+#include 
+#endif
+
+#define WITH_XSLT_DEBUG_DOCUMENTS
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_DOCUMENTS
+#endif
+
+/************************************************************************
+ * 									*
+ * 		Hooks for the document loader				*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltDocDefaultLoaderFunc:
+ * @URI: the URI of the document to load
+ * @dict: the dictionary to use when parsing that document
+ * @options: parsing options, a set of xmlParserOption
+ * @ctxt: the context, either a stylesheet or a transformation context
+ * @type: the xsltLoadType indicating the kind of loading required
+ *
+ * Default function to load document not provided by the compilation or
+ * transformation API themselve, for example when an xsl:import,
+ * xsl:include is found at compilation time or when a document()
+ * call is made at runtime.
+ *
+ * Returns the pointer to the document (which will be modified and
+ * freed by the engine later), or NULL in case of error.
+ */
+static xmlDocPtr
+xsltDocDefaultLoaderFunc(const xmlChar * URI, xmlDictPtr dict, int options,
+                         void *ctxt ATTRIBUTE_UNUSED,
+			 xsltLoadType type ATTRIBUTE_UNUSED)
+{
+    xmlParserCtxtPtr pctxt;
+    xmlParserInputPtr inputStream;
+    xmlDocPtr doc;
+
+    pctxt = xmlNewParserCtxt();
+    if (pctxt == NULL)
+        return(NULL);
+    if ((dict != NULL) && (pctxt->dict != NULL)) {
+        xmlDictFree(pctxt->dict);
+	pctxt->dict = NULL;
+    }
+    if (dict != NULL) {
+	pctxt->dict = dict;
+	xmlDictReference(pctxt->dict);
+#ifdef WITH_XSLT_DEBUG
+	xsltGenericDebug(xsltGenericDebugContext,
+                     "Reusing dictionary for document\n");
+#endif
+    }
+    xmlCtxtUseOptions(pctxt, options);
+    inputStream = xmlLoadExternalEntity((const char *) URI, NULL, pctxt);
+    if (inputStream == NULL) {
+        xmlFreeParserCtxt(pctxt);
+	return(NULL);
+    }
+    inputPush(pctxt, inputStream);
+    if (pctxt->directory == NULL)
+        pctxt->directory = xmlParserGetDirectory((const char *) URI);
+
+    xmlParseDocument(pctxt);
+
+    if (pctxt->wellFormed) {
+        doc = pctxt->myDoc;
+    }
+    else {
+        doc = NULL;
+        xmlFreeDoc(pctxt->myDoc);
+        pctxt->myDoc = NULL;
+    }
+    xmlFreeParserCtxt(pctxt);
+
+    return(doc);
+}
+
+
+xsltDocLoaderFunc xsltDocDefaultLoader = xsltDocDefaultLoaderFunc;
+
+/**
+ * xsltSetLoaderFunc:
+ * @f: the new function to handle document loading.
+ *
+ * Set the new function to load document, if NULL it resets it to the
+ * default function.
+ */
+ 
+void
+xsltSetLoaderFunc(xsltDocLoaderFunc f) {
+    if (f == NULL)
+        xsltDocDefaultLoader = xsltDocDefaultLoaderFunc;
+    else
+        xsltDocDefaultLoader = f;
+}
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltNewDocument:
+ * @ctxt: an XSLT transformation context (or NULL)
+ * @doc:  a parsed XML document
+ *
+ * Register a new document, apply key computations
+ *
+ * Returns a handler to the document
+ */
+xsltDocumentPtr	
+xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) {
+    xsltDocumentPtr cur;
+
+    cur = (xsltDocumentPtr) xmlMalloc(sizeof(xsltDocument));
+    if (cur == NULL) {
+	xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
+		"xsltNewDocument : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltDocument));
+    cur->doc = doc;
+    if (ctxt != NULL) {
+        if (! XSLT_IS_RES_TREE_FRAG(doc)) {
+	    cur->next = ctxt->docList;
+	    ctxt->docList = cur;
+	}
+	/*
+	* A key with a specific name for a specific document
+	* will only be computed if there's a call to the key()
+	* function using that specific name for that specific
+	* document. I.e. computation of keys will be done in
+	* xsltGetKey() (keys.c) on an on-demand basis.
+	*
+	* xsltInitCtxtKeys(ctxt, cur); not called here anymore
+	*/
+    }
+    return(cur);
+}
+
+/**
+ * xsltNewStyleDocument:
+ * @style: an XSLT style sheet
+ * @doc:  a parsed XML document
+ *
+ * Register a new document, apply key computations
+ *
+ * Returns a handler to the document
+ */
+xsltDocumentPtr	
+xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) {
+    xsltDocumentPtr cur;
+
+    cur = (xsltDocumentPtr) xmlMalloc(sizeof(xsltDocument));
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, (xmlNodePtr) doc,
+		"xsltNewStyleDocument : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltDocument));
+    cur->doc = doc;
+    if (style != NULL) {
+	cur->next = style->docList;
+	style->docList = cur;
+    }
+    return(cur);
+}
+
+/**
+ * xsltFreeStyleDocuments:
+ * @style: an XSLT stylesheet (representing a stylesheet-level)
+ *
+ * Frees the node-trees (and xsltDocument structures) of all
+ * stylesheet-modules of the stylesheet-level represented by
+ * the given @style. 
+ */
+void	
+xsltFreeStyleDocuments(xsltStylesheetPtr style) {
+    xsltDocumentPtr doc, cur;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltNsMapPtr nsMap;
+#endif
+    
+    if (style == NULL)
+	return;
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    if (XSLT_HAS_INTERNAL_NSMAP(style))
+	nsMap = XSLT_GET_INTERNAL_NSMAP(style);
+    else
+	nsMap = NULL;    
+#endif   
+
+    cur = style->docList;
+    while (cur != NULL) {
+	doc = cur;
+	cur = cur->next;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+	/*
+	* Restore all changed namespace URIs of ns-decls.
+	*/
+	if (nsMap)
+	    xsltRestoreDocumentNamespaces(nsMap, doc->doc);
+#endif
+	xsltFreeDocumentKeys(doc);
+	if (!doc->main)
+	    xmlFreeDoc(doc->doc);
+        xmlFree(doc);
+    }
+}
+
+/**
+ * xsltFreeDocuments:
+ * @ctxt: an XSLT transformation context
+ *
+ * Free up all the space used by the loaded documents
+ */
+void	
+xsltFreeDocuments(xsltTransformContextPtr ctxt) {
+    xsltDocumentPtr doc, cur;
+
+    cur = ctxt->docList;
+    while (cur != NULL) {
+	doc = cur;
+	cur = cur->next;
+	xsltFreeDocumentKeys(doc);
+	if (!doc->main)
+	    xmlFreeDoc(doc->doc);
+        xmlFree(doc);
+    }
+    cur = ctxt->styleList;
+    while (cur != NULL) {
+	doc = cur;
+	cur = cur->next;
+	xsltFreeDocumentKeys(doc);
+	if (!doc->main)
+	    xmlFreeDoc(doc->doc);
+        xmlFree(doc);
+    }
+}
+
+/**
+ * xsltLoadDocument:
+ * @ctxt: an XSLT transformation context
+ * @URI:  the computed URI of the document
+ *
+ * Try to load a document (not a stylesheet)
+ * within the XSLT transformation context
+ *
+ * Returns the new xsltDocumentPtr or NULL in case of error
+ */
+xsltDocumentPtr	
+xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
+    xsltDocumentPtr ret;
+    xmlDocPtr doc;
+
+    if ((ctxt == NULL) || (URI == NULL))
+	return(NULL);
+
+    /*
+     * Security framework check
+     */
+    if (ctxt->sec != NULL) {
+	int res;
+	
+	res = xsltCheckRead(ctxt->sec, ctxt, URI);
+	if (res == 0) {
+	    xsltTransformError(ctxt, NULL, NULL,
+		 "xsltLoadDocument: read rights for %s denied\n",
+			     URI);
+	    return(NULL);
+	}
+    }
+
+    /*
+     * Walk the context list to find the document if preparsed
+     */
+    ret = ctxt->docList;
+    while (ret != NULL) {
+	if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
+	    (xmlStrEqual(ret->doc->URL, URI)))
+	    return(ret);
+	ret = ret->next;
+    }
+
+    doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions,
+                               (void *) ctxt, XSLT_LOAD_DOCUMENT);
+
+    if (doc == NULL)
+	return(NULL);
+
+    if (ctxt->xinclude != 0) {
+#ifdef LIBXML_XINCLUDE_ENABLED
+#if LIBXML_VERSION >= 20603
+	xmlXIncludeProcessFlags(doc, ctxt->parserOptions);
+#else
+	xmlXIncludeProcess(doc);
+#endif
+#else
+	xsltTransformError(ctxt, NULL, NULL,
+	    "xsltLoadDocument(%s) : XInclude processing not compiled in\n",
+	                 URI);
+#endif
+    }
+    /*
+     * Apply white-space stripping if asked for
+     */
+    if (xsltNeedElemSpaceHandling(ctxt))
+	xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc));
+    if (ctxt->debugStatus == XSLT_DEBUG_NONE)
+	xmlXPathOrderDocElems(doc);
+
+    ret = xsltNewDocument(ctxt, doc);
+    return(ret);
+}
+
+/**
+ * xsltLoadStyleDocument:
+ * @style: an XSLT style sheet
+ * @URI:  the computed URI of the document
+ *
+ * Try to load a stylesheet document within the XSLT transformation context
+ *
+ * Returns the new xsltDocumentPtr or NULL in case of error
+ */
+xsltDocumentPtr	
+xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
+    xsltDocumentPtr ret;
+    xmlDocPtr doc;
+    xsltSecurityPrefsPtr sec;
+
+    if ((style == NULL) || (URI == NULL))
+	return(NULL);
+
+    /*
+     * Security framework check
+     */
+    sec = xsltGetDefaultSecurityPrefs();
+    if (sec != NULL) {
+	int res;
+
+	res = xsltCheckRead(sec, NULL, URI);
+	if (res == 0) {
+	    xsltTransformError(NULL, NULL, NULL,
+		 "xsltLoadStyleDocument: read rights for %s denied\n",
+			     URI);
+	    return(NULL);
+	}
+    }
+
+    /*
+     * Walk the context list to find the document if preparsed
+     */
+    ret = style->docList;
+    while (ret != NULL) {
+	if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
+	    (xmlStrEqual(ret->doc->URL, URI)))
+	    return(ret);
+	ret = ret->next;
+    }
+
+    doc = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS,
+                               (void *) style, XSLT_LOAD_STYLESHEET);
+    if (doc == NULL)
+	return(NULL);
+
+    ret = xsltNewStyleDocument(style, doc);
+    return(ret);
+}
+
+/**
+ * xsltFindDocument:
+ * @ctxt: an XSLT transformation context
+ * @doc: a parsed XML document
+ *
+ * Try to find a document within the XSLT transformation context.
+ * This will not find document infos for temporary
+ * Result Tree Fragments.
+ *
+ * Returns the desired xsltDocumentPtr or NULL in case of error
+ */
+xsltDocumentPtr
+xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc) {
+    xsltDocumentPtr ret;
+
+    if ((ctxt == NULL) || (doc == NULL))
+	return(NULL);
+
+    /*
+     * Walk the context list to find the document
+     */
+    ret = ctxt->docList;
+    while (ret != NULL) {
+	if (ret->doc == doc)
+	    return(ret);
+	ret = ret->next;
+    }
+    if (doc == ctxt->style->doc)
+	return(ctxt->document);
+    return(NULL);
+}
+
diff --git a/third_party/libxslt/libxslt/documents.h b/third_party/libxslt/libxslt/documents.h
new file mode 100644
index 0000000..2eb1f2a
--- /dev/null
+++ b/third_party/libxslt/libxslt/documents.h
@@ -0,0 +1,93 @@
+/*
+ * Summary: interface for the document handling
+ * Description: implements document loading and cache (multiple
+ *              document() reference for the same resources must
+ *              be equal.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_DOCUMENTS_H__
+#define __XML_XSLT_DOCUMENTS_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+XSLTPUBFUN xsltDocumentPtr XSLTCALL	
+		xsltNewDocument		(xsltTransformContextPtr ctxt,
+					 xmlDocPtr doc);
+XSLTPUBFUN xsltDocumentPtr XSLTCALL	
+    		xsltLoadDocument	(xsltTransformContextPtr ctxt,
+					 const xmlChar *URI);
+XSLTPUBFUN xsltDocumentPtr XSLTCALL	
+    		xsltFindDocument	(xsltTransformContextPtr ctxt,
+					 xmlDocPtr doc);
+XSLTPUBFUN void XSLTCALL		
+    		xsltFreeDocuments	(xsltTransformContextPtr ctxt);
+
+XSLTPUBFUN xsltDocumentPtr XSLTCALL	
+    		xsltLoadStyleDocument	(xsltStylesheetPtr style,
+					 const xmlChar *URI);
+XSLTPUBFUN xsltDocumentPtr XSLTCALL	
+    		xsltNewStyleDocument	(xsltStylesheetPtr style,
+					 xmlDocPtr doc);
+XSLTPUBFUN void XSLTCALL		
+    		xsltFreeStyleDocuments	(xsltStylesheetPtr style);
+
+/*
+ * Hooks for document loading
+ */
+
+/**
+ * xsltLoadType:
+ *
+ * Enum defining the kind of loader requirement.
+ */
+typedef enum {
+    XSLT_LOAD_START = 0,	/* loading for a top stylesheet */
+    XSLT_LOAD_STYLESHEET = 1,	/* loading for a stylesheet include/import */
+    XSLT_LOAD_DOCUMENT = 2	/* loading document at transformation time */
+} xsltLoadType;
+
+/**
+ * xsltDocLoaderFunc:
+ * @URI: the URI of the document to load
+ * @dict: the dictionary to use when parsing that document
+ * @options: parsing options, a set of xmlParserOption
+ * @ctxt: the context, either a stylesheet or a transformation context
+ * @type: the xsltLoadType indicating the kind of loading required
+ *
+ * An xsltDocLoaderFunc is a signature for a function which can be
+ * registered to load document not provided by the compilation or
+ * transformation API themselve, for example when an xsl:import,
+ * xsl:include is found at compilation time or when a document()
+ * call is made at runtime.
+ *
+ * Returns the pointer to the document (which will be modified and
+ * freed by the engine later), or NULL in case of error.
+ */
+typedef xmlDocPtr (*xsltDocLoaderFunc)		(const xmlChar *URI,
+						 xmlDictPtr dict,
+						 int options,
+						 void *ctxt,
+						 xsltLoadType type);
+
+XSLTPUBFUN void XSLTCALL
+		xsltSetLoaderFunc		(xsltDocLoaderFunc f);
+
+/* the loader may be needed by extension libraries so it is exported */
+XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_DOCUMENTS_H__ */
+
diff --git a/third_party/libxslt/libxslt/extensions.c b/third_party/libxslt/libxslt/extensions.c
new file mode 100644
index 0000000..2c1b239
--- /dev/null
+++ b/third_party/libxslt/libxslt/extensions.c
@@ -0,0 +1,2194 @@
+/*
+ * extensions.c: Implemetation of the extensions support
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifdef WITH_MODULES
+#include 
+#endif
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "imports.h"
+#include "extensions.h"
+
+#ifdef _WIN32
+#include              /* for _MAX_PATH */
+#define PATH_MAX _MAX_PATH
+#endif
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_EXTENSIONS
+#endif
+
+/************************************************************************
+ * 									*
+ * 			Private Types and Globals			*
+ * 									*
+ ************************************************************************/
+
+typedef struct _xsltExtDef xsltExtDef;
+typedef xsltExtDef *xsltExtDefPtr;
+struct _xsltExtDef {
+    struct _xsltExtDef *next;
+    xmlChar *prefix;
+    xmlChar *URI;
+    void *data;
+};
+
+typedef struct _xsltExtModule xsltExtModule;
+typedef xsltExtModule *xsltExtModulePtr;
+struct _xsltExtModule {
+    xsltExtInitFunction initFunc;
+    xsltExtShutdownFunction shutdownFunc;
+    xsltStyleExtInitFunction styleInitFunc;
+    xsltStyleExtShutdownFunction styleShutdownFunc;
+};
+
+typedef struct _xsltExtData xsltExtData;
+typedef xsltExtData *xsltExtDataPtr;
+struct _xsltExtData {
+    xsltExtModulePtr extModule;
+    void *extData;
+};
+
+typedef struct _xsltExtElement xsltExtElement;
+typedef xsltExtElement *xsltExtElementPtr;
+struct _xsltExtElement {
+    xsltPreComputeFunction precomp;
+    xsltTransformFunction transform;
+};
+
+static xmlHashTablePtr xsltExtensionsHash = NULL;
+static xmlHashTablePtr xsltFunctionsHash = NULL;
+static xmlHashTablePtr xsltElementsHash = NULL;
+static xmlHashTablePtr xsltTopLevelsHash = NULL;
+static xmlHashTablePtr xsltModuleHash = NULL;
+
+/************************************************************************
+ * 									*
+ * 			Type functions 					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltNewExtDef:
+ * @prefix:  the extension prefix
+ * @URI:  the namespace URI
+ *
+ * Create a new XSLT ExtDef
+ *
+ * Returns the newly allocated xsltExtDefPtr or NULL in case of error
+ */
+static xsltExtDefPtr
+xsltNewExtDef(const xmlChar * prefix, const xmlChar * URI)
+{
+    xsltExtDefPtr cur;
+
+    cur = (xsltExtDefPtr) xmlMalloc(sizeof(xsltExtDef));
+    if (cur == NULL) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltNewExtDef : malloc failed\n");
+        return (NULL);
+    }
+    memset(cur, 0, sizeof(xsltExtDef));
+    if (prefix != NULL)
+        cur->prefix = xmlStrdup(prefix);
+    if (URI != NULL)
+        cur->URI = xmlStrdup(URI);
+    return (cur);
+}
+
+/**
+ * xsltFreeExtDef:
+ * @extensiond:  an XSLT extension definition
+ *
+ * Free up the memory allocated by @extensiond
+ */
+static void
+xsltFreeExtDef(xsltExtDefPtr extensiond)
+{
+    if (extensiond == NULL)
+        return;
+    if (extensiond->prefix != NULL)
+        xmlFree(extensiond->prefix);
+    if (extensiond->URI != NULL)
+        xmlFree(extensiond->URI);
+    xmlFree(extensiond);
+}
+
+/**
+ * xsltFreeExtDefList:
+ * @extensiond:  an XSLT extension definition list
+ *
+ * Free up the memory allocated by all the elements of @extensiond
+ */
+static void
+xsltFreeExtDefList(xsltExtDefPtr extensiond)
+{
+    xsltExtDefPtr cur;
+
+    while (extensiond != NULL) {
+        cur = extensiond;
+        extensiond = extensiond->next;
+        xsltFreeExtDef(cur);
+    }
+}
+
+/**
+ * xsltNewExtModule:
+ * @initFunc:  the module initialization function
+ * @shutdownFunc:  the module shutdown function
+ * @styleInitFunc:  the stylesheet module data allocator function
+ * @styleShutdownFunc:  the stylesheet module data free function
+ *
+ * Create a new XSLT extension module
+ *
+ * Returns the newly allocated xsltExtModulePtr or NULL in case of error
+ */
+static xsltExtModulePtr
+xsltNewExtModule(xsltExtInitFunction initFunc,
+                 xsltExtShutdownFunction shutdownFunc,
+                 xsltStyleExtInitFunction styleInitFunc,
+                 xsltStyleExtShutdownFunction styleShutdownFunc)
+{
+    xsltExtModulePtr cur;
+
+    cur = (xsltExtModulePtr) xmlMalloc(sizeof(xsltExtModule));
+    if (cur == NULL) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltNewExtModule : malloc failed\n");
+        return (NULL);
+    }
+    cur->initFunc = initFunc;
+    cur->shutdownFunc = shutdownFunc;
+    cur->styleInitFunc = styleInitFunc;
+    cur->styleShutdownFunc = styleShutdownFunc;
+    return (cur);
+}
+
+/**
+ * xsltFreeExtModule:
+ * @ext:  an XSLT extension module
+ *
+ * Free up the memory allocated by @ext
+ */
+static void
+xsltFreeExtModule(xsltExtModulePtr ext)
+{
+    if (ext == NULL)
+        return;
+    xmlFree(ext);
+}
+
+/**
+ * xsltNewExtData:
+ * @extModule:  the module
+ * @extData:  the associated data
+ *
+ * Create a new XSLT extension module data wrapper
+ *
+ * Returns the newly allocated xsltExtDataPtr or NULL in case of error
+ */
+static xsltExtDataPtr
+xsltNewExtData(xsltExtModulePtr extModule, void *extData)
+{
+    xsltExtDataPtr cur;
+
+    if (extModule == NULL)
+        return (NULL);
+    cur = (xsltExtDataPtr) xmlMalloc(sizeof(xsltExtData));
+    if (cur == NULL) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltNewExtData : malloc failed\n");
+        return (NULL);
+    }
+    cur->extModule = extModule;
+    cur->extData = extData;
+    return (cur);
+}
+
+/**
+ * xsltFreeExtData:
+ * @ext:  an XSLT extension module data wrapper
+ *
+ * Free up the memory allocated by @ext
+ */
+static void
+xsltFreeExtData(xsltExtDataPtr ext)
+{
+    if (ext == NULL)
+        return;
+    xmlFree(ext);
+}
+
+/**
+ * xsltNewExtElement:
+ * @precomp:  the pre-computation function
+ * @transform:  the transformation function
+ *
+ * Create a new XSLT extension element
+ *
+ * Returns the newly allocated xsltExtElementPtr or NULL in case of
+ * error
+ */
+static xsltExtElementPtr
+xsltNewExtElement(xsltPreComputeFunction precomp,
+                  xsltTransformFunction transform)
+{
+    xsltExtElementPtr cur;
+
+    if (transform == NULL)
+        return (NULL);
+
+    cur = (xsltExtElementPtr) xmlMalloc(sizeof(xsltExtElement));
+    if (cur == NULL) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltNewExtElement : malloc failed\n");
+        return (NULL);
+    }
+    cur->precomp = precomp;
+    cur->transform = transform;
+    return (cur);
+}
+
+/**
+ * xsltFreeExtElement:
+ * @ext: an XSLT extension element
+ *
+ * Frees up the memory allocated by @ext
+ */
+static void
+xsltFreeExtElement(xsltExtElementPtr ext)
+{
+    if (ext == NULL)
+        return;
+    xmlFree(ext);
+}
+
+
+#ifdef WITH_MODULES
+typedef void (*exsltRegisterFunction) (void);
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+/**
+ * xsltExtModuleRegisterDynamic:
+ * @URI:  the function or element namespace URI
+ *
+ * Dynamically loads an extension plugin when available.
+ * 
+ * The plugin name is derived from the URI by removing the 
+ * initial protocol designation, e.g. "http://", then converting
+ * the characters ".", "-", "/", and "\" into "_", the removing
+ * any trailing "/", then concatenating LIBXML_MODULE_EXTENSION.
+ * 
+ * Plugins are loaded from the directory specified by the 
+ * environment variable LIBXSLT_PLUGINS_PATH, or if NULL, 
+ * by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at
+ * compile time.
+ *
+ * Returns 0 if successful, -1 in case of error. 
+ */
+
+static int
+xsltExtModuleRegisterDynamic(const xmlChar * URI)
+{
+
+    xmlModulePtr m;
+    exsltRegisterFunction regfunc;
+    xmlChar *ext_name;
+    char module_filename[PATH_MAX];
+    const xmlChar *ext_directory = NULL;
+    const xmlChar *protocol = NULL;
+    xmlChar *i, *regfunc_name;
+    void *vregfunc;
+    int rc;
+
+    /* check for bad inputs */
+    if (URI == NULL)
+        return (-1);
+
+    if (NULL == xsltModuleHash) {
+        xsltModuleHash = xmlHashCreate(5);
+        if (xsltModuleHash == NULL)
+            return (-1);
+    }
+
+    /* have we attempted to register this module already? */
+    if (xmlHashLookup(xsltModuleHash, URI) != NULL) {
+        return (-1);
+    }
+
+    /* transform extension namespace into a module name */
+    protocol = xmlStrstr(URI, BAD_CAST "://");
+    if (protocol == NULL) {
+        ext_name = xmlStrdup(URI);
+    } else {
+        ext_name = xmlStrdup(protocol + 3);
+    }
+    if (ext_name == NULL) {
+        return (-1);
+    }
+
+    i = ext_name;
+    while ('\0' != *i) {
+        if (('/' == *i) || ('\\' == *i) || ('.' == *i) || ('-' == *i))
+            *i = '_';
+        i++;
+    }
+
+    if (*(i - 1) == '_')
+        *i = '\0';
+
+    /* determine module directory */
+    ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
+#endif
+
+    if (NULL == ext_directory)
+        ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH();
+    if (NULL == ext_directory)
+        return (-1);
+
+    /* build the module filename, and confirm the module exists */
+    xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename),
+                 BAD_CAST "%s/%s%s",
+                 ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Attempting to load plugin: %s for URI: %s\n", 
+                     module_filename, URI);
+#endif
+
+    if (1 != xmlCheckFilename(module_filename)) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlCheckFilename failed for plugin: %s\n", module_filename);
+#endif
+
+        xmlFree(ext_name);
+        return (-1);
+    }
+
+    /* attempt to open the module */
+    m = xmlModuleOpen(module_filename, 0);
+    if (NULL == m) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlModuleOpen failed for plugin: %s\n", module_filename);
+#endif
+
+        xmlFree(ext_name);
+        return (-1);
+    }
+
+    /* construct initialization func name */
+    regfunc_name = xmlStrdup(ext_name);
+    regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init");
+
+    vregfunc = NULL;
+    rc = xmlModuleSymbol(m, (const char *) regfunc_name, &vregfunc);
+    regfunc = vregfunc;
+    if (0 == rc) {
+        /*
+	 * Call the module's init function.  Note that this function
+	 * calls xsltRegisterExtModuleFull which will add the module
+	 * to xsltExtensionsHash (together with it's entry points).
+	 */
+        (*regfunc) ();
+
+        /* register this module in our hash */
+        xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
+    } else {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n", 
+                     module_filename, regfunc_name);
+#endif
+
+        /* if regfunc not found unload the module immediately */
+        xmlModuleClose(m);
+    }
+
+    xmlFree(ext_name);
+    xmlFree(regfunc_name);
+    return (NULL == regfunc) ? -1 : 0;
+}
+#else
+static int
+xsltExtModuleRegisterDynamic(const xmlChar * ATTRIBUTE_UNUSED URI)
+{
+  return -1;
+}
+#endif
+
+/************************************************************************
+ * 									*
+ * 		The stylesheet extension prefixes handling		*
+ * 									*
+ ************************************************************************/
+
+
+/**
+ * xsltFreeExts:
+ * @style: an XSLT stylesheet
+ *
+ * Free up the memory used by XSLT extensions in a stylesheet
+ */
+void
+xsltFreeExts(xsltStylesheetPtr style)
+{
+    if (style->nsDefs != NULL)
+        xsltFreeExtDefList((xsltExtDefPtr) style->nsDefs);
+}
+
+/**
+ * xsltRegisterExtPrefix:
+ * @style: an XSLT stylesheet
+ * @prefix: the prefix used (optional)
+ * @URI: the URI associated to the extension
+ * 
+ * Registers an extension namespace
+ * This is called from xslt.c during compile-time.
+ * The given prefix is not needed.
+ * Called by:
+ *   xsltParseExtElemPrefixes() (new function)
+ *   xsltRegisterExtPrefix() (old function)
+ *
+ * Returns 0 in case of success, 1 if the @URI was already
+ *         registered as an extension namespace and
+ *         -1 in case of failure
+ */
+int
+xsltRegisterExtPrefix(xsltStylesheetPtr style,
+                      const xmlChar * prefix, const xmlChar * URI)
+{
+    xsltExtDefPtr def, ret;
+
+    if ((style == NULL) || (URI == NULL))
+        return (-1);
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Registering extension namespace '%s'.\n", URI);
+#endif
+    def = (xsltExtDefPtr) style->nsDefs;
+#ifdef XSLT_REFACTORED
+    /*
+    * The extension is associated with a namespace name.
+    */
+    while (def != NULL) {
+        if (xmlStrEqual(URI, def->URI))
+            return (1);
+        def = def->next;
+    }
+#else
+    while (def != NULL) {
+        if (xmlStrEqual(prefix, def->prefix))
+            return (-1);
+        def = def->next;
+    }
+#endif
+    ret = xsltNewExtDef(prefix, URI);
+    if (ret == NULL)
+        return (-1);
+    ret->next = (xsltExtDefPtr) style->nsDefs;
+    style->nsDefs = ret;
+
+    /*
+     * check whether there is an extension module with a stylesheet
+     * initialization function.
+     */
+#ifdef XSLT_REFACTORED
+    /*
+    * Don't initialize modules based on specified namespaces via
+    * the attribute "[xsl:]extension-element-prefixes".
+    */
+#else
+    if (xsltExtensionsHash != NULL) {
+        xsltExtModulePtr module;
+
+        module = xmlHashLookup(xsltExtensionsHash, URI);
+        if (NULL == module) {
+            if (!xsltExtModuleRegisterDynamic(URI)) {
+                module = xmlHashLookup(xsltExtensionsHash, URI);
+            }
+        }
+        if (module != NULL) {
+            xsltStyleGetExtData(style, URI);
+        }
+    }
+#endif
+    return (0);
+}
+
+/************************************************************************
+ * 									*
+ * 		The extensions modules interfaces			*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltRegisterExtFunction:
+ * @ctxt: an XSLT transformation context
+ * @name: the name of the element
+ * @URI: the URI associated to the element
+ * @function: the actual implementation which should be called 
+ *
+ * Registers an extension function
+ *
+ * Returns 0 in case of success, -1 in case of failure
+ */
+int
+xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name,
+                        const xmlChar * URI, xmlXPathFunction function)
+{
+    if ((ctxt == NULL) || (name == NULL) ||
+        (URI == NULL) || (function == NULL))
+        return (-1);
+    if (ctxt->xpathCtxt != NULL) {
+        xmlXPathRegisterFuncNS(ctxt->xpathCtxt, name, URI, function);
+    }
+    if (ctxt->extFunctions == NULL)
+        ctxt->extFunctions = xmlHashCreate(10);
+    if (ctxt->extFunctions == NULL)
+        return (-1);
+    return (xmlHashAddEntry2
+            (ctxt->extFunctions, name, URI, XML_CAST_FPTR(function)));
+}
+
+/**
+ * xsltRegisterExtElement:
+ * @ctxt: an XSLT transformation context
+ * @name: the name of the element
+ * @URI: the URI associated to the element
+ * @function: the actual implementation which should be called 
+ *
+ * Registers an extension element
+ *
+ * Returns 0 in case of success, -1 in case of failure
+ */
+int
+xsltRegisterExtElement(xsltTransformContextPtr ctxt, const xmlChar * name,
+                       const xmlChar * URI, xsltTransformFunction function)
+{
+    if ((ctxt == NULL) || (name == NULL) ||
+        (URI == NULL) || (function == NULL))
+        return (-1);
+    if (ctxt->extElements == NULL)
+        ctxt->extElements = xmlHashCreate(10);
+    if (ctxt->extElements == NULL)
+        return (-1);
+    return (xmlHashAddEntry2
+            (ctxt->extElements, name, URI, XML_CAST_FPTR(function)));
+}
+
+/**
+ * xsltFreeCtxtExts:
+ * @ctxt: an XSLT transformation context
+ *
+ * Free the XSLT extension data
+ */
+void
+xsltFreeCtxtExts(xsltTransformContextPtr ctxt)
+{
+    if (ctxt->extElements != NULL)
+        xmlHashFree(ctxt->extElements, NULL);
+    if (ctxt->extFunctions != NULL)
+        xmlHashFree(ctxt->extFunctions, NULL);
+}
+
+/**
+ * xsltStyleGetStylesheetExtData:
+ * @style: an XSLT stylesheet
+ * @URI:  the URI associated to the exension module
+ *
+ * Fires the compile-time initialization callback
+ * of an extension module and returns a container
+ * holding the user-data (retrieved via the callback).
+ *
+ * Returns the create module-data container
+ *         or NULL if such a module was not registered.
+ */
+static xsltExtDataPtr
+xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style,
+				     const xmlChar * URI)
+{
+    xsltExtDataPtr dataContainer;
+    void *userData = NULL;
+    xsltExtModulePtr module;
+    
+    if ((style == NULL) || (URI == NULL))	
+	return(NULL);
+
+    if (xsltExtensionsHash == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Not registered extension module: %s\n", URI);
+#endif
+	return(NULL);
+    }
+
+    module = xmlHashLookup(xsltExtensionsHash, URI);
+    if (module == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Not registered extension module: %s\n", URI);
+#endif
+	return (NULL);
+    }
+    /*
+    * The specified module was registered so initialize it.
+    */
+    if (style->extInfos == NULL) {
+	style->extInfos = xmlHashCreate(10);
+	if (style->extInfos == NULL)
+	    return (NULL);
+    }
+    /*
+    * Fire the initialization callback if available.
+    */
+    if (module->styleInitFunc == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Initializing module with *no* callback: %s\n", URI);
+#endif
+    } else {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Initializing module with callback: %s\n", URI);
+#endif
+	/*
+	* Fire the initialization callback.
+	*/
+	userData = module->styleInitFunc(style, URI);
+    }    
+    /*
+    * Store the user-data in the context of the given stylesheet.
+    */
+    dataContainer = xsltNewExtData(module, userData);
+    if (dataContainer == NULL)
+	return (NULL);
+
+    if (xmlHashAddEntry(style->extInfos, URI,
+	(void *) dataContainer) < 0)
+    {
+	xsltTransformError(NULL, style, NULL,	    
+	    "Failed to register module '%s'.\n", URI);
+	style->errors++;
+	if (module->styleShutdownFunc)
+	    module->styleShutdownFunc(style, URI, userData);
+	xsltFreeExtData(dataContainer);
+	return (NULL);
+    }
+
+    return(dataContainer);
+}
+
+/**
+ * xsltStyleGetExtData:
+ * @style: an XSLT stylesheet
+ * @URI:  the URI associated to the exension module
+ *
+ * Retrieve the data associated to the extension module
+ * in this given stylesheet.
+ * Called by:
+ *   xsltRegisterExtPrefix(),
+ *   ( xsltExtElementPreCompTest(), xsltExtInitTest )
+ *
+ * Returns the pointer or NULL if not present
+ */
+void *
+xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI)
+{
+    xsltExtDataPtr dataContainer = NULL;
+    xsltStylesheetPtr tmpStyle;
+
+    if ((style == NULL) || (URI == NULL) ||
+	(xsltExtensionsHash == NULL))
+	return (NULL);
+
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * This is intended for global storage, so only the main
+    * stylesheet will hold the data.
+    */
+    tmpStyle = style;
+    while (tmpStyle->parent != NULL)
+	tmpStyle = tmpStyle->parent;
+    if (tmpStyle->extInfos != NULL) {
+	dataContainer =
+	    (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
+	if (dataContainer != NULL) {
+	    /*
+	    * The module was already initialized in the context
+	    * of this stylesheet; just return the user-data that
+	    * comes with it.
+	    */
+	    return(dataContainer->extData);
+	}
+    }
+#else
+    /*
+    * Old behaviour.
+    */
+    tmpStyle = style;
+    while (tmpStyle != NULL) {
+	if (tmpStyle->extInfos != NULL) {
+	    dataContainer =
+		(xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
+	    if (dataContainer != NULL) {
+		return(dataContainer->extData);
+	    }
+	}
+	tmpStyle = xsltNextImport(tmpStyle);
+    }
+    tmpStyle = style;
+#endif
+
+    dataContainer =
+        xsltStyleInitializeStylesheetModule(tmpStyle, URI);
+    if (dataContainer != NULL)
+	return (dataContainer->extData);
+    return(NULL);
+}
+
+#ifdef XSLT_REFACTORED
+/**
+ * xsltStyleStylesheetLevelGetExtData:
+ * @style: an XSLT stylesheet
+ * @URI:  the URI associated to the exension module
+ *
+ * Retrieve the data associated to the extension module in this given
+ * stylesheet.
+ *
+ * Returns the pointer or NULL if not present
+ */
+void *
+xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
+				   const xmlChar * URI)
+{
+    xsltExtDataPtr dataContainer = NULL;
+
+    if ((style == NULL) || (URI == NULL) ||
+	(xsltExtensionsHash == NULL))
+	return (NULL);
+
+    if (style->extInfos != NULL) {
+	dataContainer = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI);
+	/*
+	* The module was already initialized in the context
+	* of this stylesheet; just return the user-data that
+	* comes with it.
+	*/
+	if (dataContainer)
+	    return(dataContainer->extData);
+    }  
+
+    dataContainer =
+        xsltStyleInitializeStylesheetModule(style, URI);
+    if (dataContainer != NULL)
+	return (dataContainer->extData);
+    return(NULL);
+}
+#endif
+
+/**
+ * xsltGetExtData:
+ * @ctxt: an XSLT transformation context
+ * @URI:  the URI associated to the exension module
+ *
+ * Retrieve the data associated to the extension module in this given
+ * transformation.
+ *
+ * Returns the pointer or NULL if not present
+ */
+void *
+xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar * URI)
+{
+    xsltExtDataPtr data;
+
+    if ((ctxt == NULL) || (URI == NULL))
+        return (NULL);
+    if (ctxt->extInfos == NULL) {
+        ctxt->extInfos = xmlHashCreate(10);
+        if (ctxt->extInfos == NULL)
+            return (NULL);
+        data = NULL;
+    } else {
+        data = (xsltExtDataPtr) xmlHashLookup(ctxt->extInfos, URI);
+    }
+    if (data == NULL) {
+        void *extData;
+        xsltExtModulePtr module;
+
+        module = xmlHashLookup(xsltExtensionsHash, URI);
+        if (module == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+            xsltGenericDebug(xsltGenericDebugContext,
+                             "Not registered extension module: %s\n", URI);
+#endif
+            return (NULL);
+        } else {
+            if (module->initFunc == NULL)
+                return (NULL);
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+            xsltGenericDebug(xsltGenericDebugContext,
+                             "Initializing module: %s\n", URI);
+#endif
+
+            extData = module->initFunc(ctxt, URI);
+            if (extData == NULL)
+                return (NULL);
+
+            data = xsltNewExtData(module, extData);
+            if (data == NULL)
+                return (NULL);
+            if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) {
+                xsltTransformError(ctxt, NULL, NULL,
+                                   "Failed to register module data: %s\n",
+                                   URI);
+                if (module->shutdownFunc)
+                    module->shutdownFunc(ctxt, URI, extData);
+                xsltFreeExtData(data);
+                return (NULL);
+            }
+        }
+    }
+    return (data->extData);
+}
+
+typedef struct _xsltInitExtCtxt xsltInitExtCtxt;
+struct _xsltInitExtCtxt {
+    xsltTransformContextPtr ctxt;
+    int ret;
+};
+
+/**
+ * xsltInitCtxtExt:
+ * @styleData:  the registered stylesheet data for the module
+ * @ctxt:  the XSLT transformation context + the return value
+ * @URI:  the extension URI
+ *
+ * Initializes an extension module
+ */
+static void
+xsltInitCtxtExt(xsltExtDataPtr styleData, xsltInitExtCtxt * ctxt,
+                const xmlChar * URI)
+{
+    xsltExtModulePtr module;
+    xsltExtDataPtr ctxtData;
+    void *extData;
+
+    if ((styleData == NULL) || (ctxt == NULL) || (URI == NULL) ||
+        (ctxt->ret == -1)) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltInitCtxtExt: NULL param or error\n");
+#endif
+        return;
+    }
+    module = styleData->extModule;
+    if ((module == NULL) || (module->initFunc == NULL)) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltInitCtxtExt: no module or no initFunc\n");
+#endif
+        return;
+    }
+
+    ctxtData = (xsltExtDataPtr) xmlHashLookup(ctxt->ctxt->extInfos, URI);
+    if (ctxtData != NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltInitCtxtExt: already initialized\n");
+#endif
+        return;
+    }
+
+    extData = module->initFunc(ctxt->ctxt, URI);
+    if (extData == NULL) {
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltInitCtxtExt: no extData\n");
+#endif
+    }
+    ctxtData = xsltNewExtData(module, extData);
+    if (ctxtData == NULL) {
+        ctxt->ret = -1;
+        return;
+    }
+
+    if (ctxt->ctxt->extInfos == NULL)
+        ctxt->ctxt->extInfos = xmlHashCreate(10);
+    if (ctxt->ctxt->extInfos == NULL) {
+        ctxt->ret = -1;
+        return;
+    }
+
+    if (xmlHashAddEntry(ctxt->ctxt->extInfos, URI, ctxtData) < 0) {
+        xsltGenericError(xsltGenericErrorContext,
+                         "Failed to register module data: %s\n", URI);
+        if (module->shutdownFunc)
+            module->shutdownFunc(ctxt->ctxt, URI, extData);
+        xsltFreeExtData(ctxtData);
+        ctxt->ret = -1;
+        return;
+    }
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext, "Registered module %s\n",
+                     URI);
+#endif
+    ctxt->ret++;
+}
+
+/**
+ * xsltInitCtxtExts:
+ * @ctxt: an XSLT transformation context
+ *
+ * Initialize the set of modules with registered stylesheet data
+ *
+ * Returns the number of modules initialized or -1 in case of error
+ */
+int
+xsltInitCtxtExts(xsltTransformContextPtr ctxt)
+{
+    xsltStylesheetPtr style;
+    xsltInitExtCtxt ctx;
+
+    if (ctxt == NULL)
+        return (-1);
+
+    style = ctxt->style;
+    if (style == NULL)
+        return (-1);
+
+    ctx.ctxt = ctxt;
+    ctx.ret = 0;
+
+    while (style != NULL) {
+        if (style->extInfos != NULL) {
+            xmlHashScan(style->extInfos,
+                        (xmlHashScanner) xsltInitCtxtExt, &ctx);
+            if (ctx.ret == -1)
+                return (-1);
+        }
+        style = xsltNextImport(style);
+    }
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext, "Registered %d modules\n",
+                     ctx.ret);
+#endif
+    return (ctx.ret);
+}
+
+/**
+ * xsltShutdownCtxtExt:
+ * @data:  the registered data for the module
+ * @ctxt:  the XSLT transformation context
+ * @URI:  the extension URI
+ *
+ * Shutdown an extension module loaded
+ */
+static void
+xsltShutdownCtxtExt(xsltExtDataPtr data, xsltTransformContextPtr ctxt,
+                    const xmlChar * URI)
+{
+    xsltExtModulePtr module;
+
+    if ((data == NULL) || (ctxt == NULL) || (URI == NULL))
+        return;
+    module = data->extModule;
+    if ((module == NULL) || (module->shutdownFunc == NULL))
+        return;
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Shutting down module : %s\n", URI);
+#endif
+    module->shutdownFunc(ctxt, URI, data->extData);
+}
+
+/**
+ * xsltShutdownCtxtExts:
+ * @ctxt: an XSLT transformation context
+ *
+ * Shutdown the set of modules loaded
+ */
+void
+xsltShutdownCtxtExts(xsltTransformContextPtr ctxt)
+{
+    if (ctxt == NULL)
+        return;
+    if (ctxt->extInfos == NULL)
+        return;
+    xmlHashScan(ctxt->extInfos, (xmlHashScanner) xsltShutdownCtxtExt,
+                ctxt);
+    xmlHashFree(ctxt->extInfos, (xmlHashDeallocator) xsltFreeExtData);
+    ctxt->extInfos = NULL;
+}
+
+/**
+ * xsltShutdownExt:
+ * @data:  the registered data for the module
+ * @ctxt:  the XSLT stylesheet
+ * @URI:  the extension URI
+ *
+ * Shutdown an extension module loaded
+ */
+static void
+xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style,
+                const xmlChar * URI)
+{
+    xsltExtModulePtr module;
+
+    if ((data == NULL) || (style == NULL) || (URI == NULL))
+        return;
+    module = data->extModule;
+    if ((module == NULL) || (module->styleShutdownFunc == NULL))
+        return;
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Shutting down module : %s\n", URI);
+#endif
+    module->styleShutdownFunc(style, URI, data->extData);
+    /*
+    * Don't remove the entry from the hash table here, since
+    * this will produce segfaults - this fixes bug #340624.
+    *
+    * xmlHashRemoveEntry(style->extInfos, URI,
+    *   (xmlHashDeallocator) xsltFreeExtData);
+    */    
+}
+
+/**
+ * xsltShutdownExts:
+ * @style: an XSLT stylesheet
+ *
+ * Shutdown the set of modules loaded
+ */
+void
+xsltShutdownExts(xsltStylesheetPtr style)
+{
+    if (style == NULL)
+        return;
+    if (style->extInfos == NULL)
+        return;
+    xmlHashScan(style->extInfos, (xmlHashScanner) xsltShutdownExt, style);
+    xmlHashFree(style->extInfos, (xmlHashDeallocator) xsltFreeExtData);
+    style->extInfos = NULL;
+}
+
+/**
+ * xsltCheckExtPrefix:
+ * @style: the stylesheet
+ * @URI: the namespace prefix (possibly NULL)
+ *
+ * Check if the given prefix is one of the declared extensions.
+ * This is intended to be called only at compile-time.
+ * Called by:
+ *  xsltGetInheritedNsList() (xslt.c)
+ *  xsltParseTemplateContent (xslt.c)
+ *
+ * Returns 1 if this is an extension, 0 otherwise
+ */
+int
+xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI)
+{    
+#ifdef XSLT_REFACTORED
+    if ((style == NULL) || (style->compCtxt == NULL) ||
+	(XSLT_CCTXT(style)->inode == NULL) ||
+	(XSLT_CCTXT(style)->inode->extElemNs == NULL))
+        return (0);    
+    /*
+    * Lookup the extension namespaces registered
+    * at the current node in the stylesheet's tree.
+    */
+    if (XSLT_CCTXT(style)->inode->extElemNs != NULL) {
+	int i;
+	xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs;
+
+	for (i = 0; i < list->number; i++) {
+	    if (xmlStrEqual((const xmlChar *) list->items[i],
+		URI))
+	    {
+		return(1);
+	    }	    
+	}
+    }
+#else
+    xsltExtDefPtr cur;
+
+    if ((style == NULL) || (style->nsDefs == NULL))
+        return (0);
+    if (URI == NULL)
+        URI = BAD_CAST "#default";
+    cur = (xsltExtDefPtr) style->nsDefs;
+    while (cur != NULL) {
+	/*
+	* NOTE: This was change to work on namespace names rather
+	* than namespace prefixes. This fixes bug #339583.
+	* TODO: Consider renaming the field "prefix" of xsltExtDef
+	*  to "href".
+	*/
+        if (xmlStrEqual(URI, cur->prefix))
+            return (1);
+        cur = cur->next;
+    }
+#endif
+    return (0);
+}
+
+/**
+ * xsltCheckExtURI:
+ * @style: the stylesheet
+ * @URI: the namespace URI (possibly NULL)
+ *
+ * Check if the given prefix is one of the declared extensions.
+ * This is intended to be called only at compile-time.
+ * Called by:
+ *  xsltPrecomputeStylesheet() (xslt.c)
+ *  xsltParseTemplateContent (xslt.c)
+ *
+ * Returns 1 if this is an extension, 0 otherwise
+ */
+int
+xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar * URI)
+{
+    xsltExtDefPtr cur;
+
+    if ((style == NULL) || (style->nsDefs == NULL))
+        return (0);
+    if (URI == NULL)
+        return (0);
+    cur = (xsltExtDefPtr) style->nsDefs;
+    while (cur != NULL) {
+        if (xmlStrEqual(URI, cur->URI))
+            return (1);
+        cur = cur->next;
+    }
+    return (0);
+}
+
+/**
+ * xsltRegisterExtModuleFull:
+ * @URI:  URI associated to this module
+ * @initFunc:  the module initialization function
+ * @shutdownFunc:  the module shutdown function
+ * @styleInitFunc:  the module initialization function
+ * @styleShutdownFunc:  the module shutdown function
+ *
+ * Register an XSLT extension module to the library.
+ *
+ * Returns 0 if sucessful, -1 in case of error
+ */
+int
+xsltRegisterExtModuleFull(const xmlChar * URI,
+                          xsltExtInitFunction initFunc,
+                          xsltExtShutdownFunction shutdownFunc,
+                          xsltStyleExtInitFunction styleInitFunc,
+                          xsltStyleExtShutdownFunction styleShutdownFunc)
+{
+    int ret;
+    xsltExtModulePtr module;
+
+    if ((URI == NULL) || (initFunc == NULL))
+        return (-1);
+    if (xsltExtensionsHash == NULL)
+        xsltExtensionsHash = xmlHashCreate(10);
+
+    if (xsltExtensionsHash == NULL)
+        return (-1);
+
+    module = xmlHashLookup(xsltExtensionsHash, URI);
+    if (module != NULL) {
+        if ((module->initFunc == initFunc) &&
+            (module->shutdownFunc == shutdownFunc))
+            return (0);
+        return (-1);
+    }
+    module = xsltNewExtModule(initFunc, shutdownFunc,
+                              styleInitFunc, styleShutdownFunc);
+    if (module == NULL)
+        return (-1);
+    ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module);
+    return (ret);
+}
+
+/**
+ * xsltRegisterExtModule:
+ * @URI:  URI associated to this module
+ * @initFunc:  the module initialization function
+ * @shutdownFunc:  the module shutdown function
+ *
+ * Register an XSLT extension module to the library.
+ *
+ * Returns 0 if sucessful, -1 in case of error
+ */
+int
+xsltRegisterExtModule(const xmlChar * URI,
+                      xsltExtInitFunction initFunc,
+                      xsltExtShutdownFunction shutdownFunc)
+{
+    return xsltRegisterExtModuleFull(URI, initFunc, shutdownFunc,
+                                     NULL, NULL);
+}
+
+/**
+ * xsltUnregisterExtModule:
+ * @URI:  URI associated to this module
+ *
+ * Unregister an XSLT extension module from the library.
+ *
+ * Returns 0 if sucessful, -1 in case of error
+ */
+int
+xsltUnregisterExtModule(const xmlChar * URI)
+{
+    int ret;
+
+    if (URI == NULL)
+        return (-1);
+    if (xsltExtensionsHash == NULL)
+        return (-1);
+
+    ret =
+        xmlHashRemoveEntry(xsltExtensionsHash, URI,
+                           (xmlHashDeallocator) xsltFreeExtModule);
+    return (ret);
+}
+
+/**
+ * xsltUnregisterAllExtModules:
+ *
+ * Unregister all the XSLT extension module from the library.
+ */
+static void
+xsltUnregisterAllExtModules(void)
+{
+    if (xsltExtensionsHash == NULL)
+        return;
+
+    xmlHashFree(xsltExtensionsHash,
+                (xmlHashDeallocator) xsltFreeExtModule);
+    xsltExtensionsHash = NULL;
+}
+
+/**
+ * xsltXPathGetTransformContext:
+ * @ctxt:  an XPath transformation context
+ *
+ * Provides the XSLT transformation context from the XPath transformation
+ * context. This is useful when an XPath function in the extension module
+ * is called by the XPath interpreter and that the XSLT context is needed
+ * for example to retrieve the associated data pertaining to this XSLT
+ * transformation.
+ *
+ * Returns the XSLT transformation context or NULL in case of error.
+ */
+xsltTransformContextPtr
+xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
+{
+    if ((ctxt == NULL) || (ctxt->context == NULL))
+        return (NULL);
+    return (ctxt->context->extra);
+}
+
+/**
+ * xsltRegisterExtModuleFunction:
+ * @name:  the function name
+ * @URI:  the function namespace URI
+ * @function:  the function callback
+ *
+ * Registers an extension module function.
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltRegisterExtModuleFunction(const xmlChar * name, const xmlChar * URI,
+                              xmlXPathFunction function)
+{
+    if ((name == NULL) || (URI == NULL) || (function == NULL))
+        return (-1);
+
+    if (xsltFunctionsHash == NULL)
+        xsltFunctionsHash = xmlHashCreate(10);
+    if (xsltFunctionsHash == NULL)
+        return (-1);
+
+    xmlHashUpdateEntry2(xsltFunctionsHash, name, URI,
+                        XML_CAST_FPTR(function), NULL);
+
+    return (0);
+}
+
+/**
+ * xsltExtModuleFunctionLookup:
+ * @name:  the function name
+ * @URI:  the function namespace URI
+ *
+ * Looks up an extension module function
+ *
+ * Returns the function if found, NULL otherwise.
+ */
+xmlXPathFunction
+xsltExtModuleFunctionLookup(const xmlChar * name, const xmlChar * URI)
+{
+    xmlXPathFunction ret;
+
+    if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (NULL);
+
+    XML_CAST_FPTR(ret) = xmlHashLookup2(xsltFunctionsHash, name, URI);
+
+    /* if lookup fails, attempt a dynamic load on supported platforms */
+    if (NULL == ret) {
+        if (!xsltExtModuleRegisterDynamic(URI)) {
+            XML_CAST_FPTR(ret) =
+                xmlHashLookup2(xsltFunctionsHash, name, URI);
+        }
+    }
+
+    return ret;
+}
+
+/**
+ * xsltUnregisterExtModuleFunction:
+ * @name:  the function name
+ * @URI:  the function namespace URI
+ *
+ * Unregisters an extension module function
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltUnregisterExtModuleFunction(const xmlChar * name, const xmlChar * URI)
+{
+    if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (-1);
+
+    return xmlHashRemoveEntry2(xsltFunctionsHash, name, URI, NULL);
+}
+
+/**
+ * xsltUnregisterAllExtModuleFunction:
+ *
+ * Unregisters all extension module function
+ */
+static void
+xsltUnregisterAllExtModuleFunction(void)
+{
+    xmlHashFree(xsltFunctionsHash, NULL);
+    xsltFunctionsHash = NULL;
+}
+
+
+/**
+ * xsltNewElemPreComp:
+ * @style:  the XSLT stylesheet
+ * @inst:  the element node
+ * @function: the transform function
+ *
+ * Creates and initializes an #xsltElemPreComp
+ *
+ * Returns the new and initialized #xsltElemPreComp
+ */
+xsltElemPreCompPtr
+xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst,
+                   xsltTransformFunction function)
+{
+    xsltElemPreCompPtr cur;
+
+    cur = (xsltElemPreCompPtr) xmlMalloc(sizeof(xsltElemPreComp));
+    if (cur == NULL) {
+        xsltTransformError(NULL, style, NULL,
+                           "xsltNewExtElement : malloc failed\n");
+        return (NULL);
+    }
+    memset(cur, 0, sizeof(xsltElemPreComp));
+
+    xsltInitElemPreComp(cur, style, inst, function,
+                        (xsltElemPreCompDeallocator) xmlFree);
+
+    return (cur);
+}
+
+/**
+ * xsltInitElemPreComp:
+ * @comp:  an #xsltElemPreComp (or generally a derived structure)
+ * @style:  the XSLT stylesheet
+ * @inst:  the element node
+ * @function:  the transform function
+ * @freeFunc:  the @comp deallocator
+ *
+ * Initializes an existing #xsltElemPreComp structure. This is usefull
+ * when extending an #xsltElemPreComp to store precomputed data.
+ * This function MUST be called on any extension element precomputed
+ * data struct.
+ */
+void
+xsltInitElemPreComp(xsltElemPreCompPtr comp, xsltStylesheetPtr style,
+                    xmlNodePtr inst, xsltTransformFunction function,
+                    xsltElemPreCompDeallocator freeFunc)
+{
+    comp->type = XSLT_FUNC_EXTENSION;
+    comp->func = function;
+    comp->inst = inst;
+    comp->free = freeFunc;
+
+    comp->next = style->preComps;
+    style->preComps = comp;
+}
+
+/**
+ * xsltPreComputeExtModuleElement:
+ * @style:  the stylesheet
+ * @inst:  the element node
+ *
+ * Precomputes an extension module element
+ *
+ * Returns the precomputed data
+ */
+xsltElemPreCompPtr
+xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst)
+{
+    xsltExtElementPtr ext;
+    xsltElemPreCompPtr comp = NULL;
+
+    if ((style == NULL) || (inst == NULL) ||
+        (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL))
+        return (NULL);
+
+    ext = (xsltExtElementPtr)
+        xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href);
+    /*
+    * EXT TODO: Now what?
+    */
+    if (ext == NULL)
+        return (NULL);
+
+    if (ext->precomp != NULL) {
+	/*
+	* REVISIT TODO: Check if the text below is correct.
+	* This will return a xsltElemPreComp structure or NULL.
+	* 1) If the the author of the extension needs a
+	*  custom structure to hold the specific values of
+	*  this extension, he will derive a structure based on
+	*  xsltElemPreComp; thus we obviously *cannot* refactor
+	*  the xsltElemPreComp structure, since all already derived
+	*  user-defined strucures will break.
+	*  Example: For the extension xsl:document,
+	*   in xsltDocumentComp() (preproc.c), the structure
+	*   xsltStyleItemDocument is allocated, filled with
+	*   specific values and returned.
+	* 2) If the author needs no values to be stored in
+	*  this structure, then he'll return NULL;
+	*/
+        comp = ext->precomp(style, inst, ext->transform);
+    }
+    if (comp == NULL) {
+	/*
+	* Default creation of a xsltElemPreComp structure, if
+	* the author of this extension did not create a custom
+	* structure.
+	*/
+        comp = xsltNewElemPreComp(style, inst, ext->transform);
+    }
+
+    return (comp);
+}
+
+/**
+ * xsltRegisterExtModuleElement:
+ * @name:  the element name
+ * @URI:  the element namespace URI
+ * @precomp:  the pre-computation callback
+ * @transform:  the transformation callback
+ *
+ * Registers an extension module element.
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI,
+                             xsltPreComputeFunction precomp,
+                             xsltTransformFunction transform)
+{
+    xsltExtElementPtr ext;
+
+    if ((name == NULL) || (URI == NULL) || (transform == NULL))
+        return (-1);
+
+    if (xsltElementsHash == NULL)
+        xsltElementsHash = xmlHashCreate(10);
+    if (xsltElementsHash == NULL)
+        return (-1);
+
+    ext = xsltNewExtElement(precomp, transform);
+    if (ext == NULL)
+        return (-1);
+
+    xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext,
+                        (xmlHashDeallocator) xsltFreeExtElement);
+
+    return (0);
+}
+
+/**
+ * xsltExtElementLookup:
+ * @ctxt:  an XSLT process context
+ * @name:  the element name
+ * @URI:  the element namespace URI
+ *
+ * Looks up an extension element. @ctxt can be NULL to search only in
+ * module elements.
+ *
+ * Returns the element callback or NULL if not found
+ */
+xsltTransformFunction
+xsltExtElementLookup(xsltTransformContextPtr ctxt,
+                     const xmlChar * name, const xmlChar * URI)
+{
+    xsltTransformFunction ret;
+
+    if ((name == NULL) || (URI == NULL))
+        return (NULL);
+
+    if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
+        XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->extElements, name, URI);
+        if (ret != NULL)
+            return (ret);
+    }
+    return xsltExtModuleElementLookup(name, URI);
+}
+
+/**
+ * xsltExtModuleElementLookup:
+ * @name:  the element name
+ * @URI:  the element namespace URI
+ *
+ * Looks up an extension module element
+ *
+ * Returns the callback function if found, NULL otherwise.
+ */
+xsltTransformFunction
+xsltExtModuleElementLookup(const xmlChar * name, const xmlChar * URI)
+{
+    xsltExtElementPtr ext;
+
+    if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (NULL);
+
+    ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI);
+
+    /* if function lookup fails, attempt a dynamic load on supported platforms */
+    ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI);
+    if (NULL == ext) {
+        if (!xsltExtModuleRegisterDynamic(URI)) {
+            ext = (xsltExtElementPtr)
+	          xmlHashLookup2(xsltElementsHash, name, URI);
+        }
+    }
+
+    if (ext == NULL)
+        return (NULL);
+    return (ext->transform);
+}
+
+/**
+ * xsltExtModuleElementPreComputeLookup:
+ * @name:  the element name
+ * @URI:  the element namespace URI
+ *
+ * Looks up an extension module element pre-computation function
+ *
+ * Returns the callback function if found, NULL otherwise.
+ */
+xsltPreComputeFunction
+xsltExtModuleElementPreComputeLookup(const xmlChar * name,
+                                     const xmlChar * URI)
+{
+    xsltExtElementPtr ext;
+
+    if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (NULL);
+
+    ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI);
+
+    if (ext == NULL) {
+        if (!xsltExtModuleRegisterDynamic(URI)) {
+            ext = (xsltExtElementPtr)
+	          xmlHashLookup2(xsltElementsHash, name, URI);
+        }
+    }
+
+    if (ext == NULL)
+        return (NULL);
+    return (ext->precomp);
+}
+
+/**
+ * xsltUnregisterExtModuleElement:
+ * @name:  the element name
+ * @URI:  the element namespace URI
+ *
+ * Unregisters an extension module element
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltUnregisterExtModuleElement(const xmlChar * name, const xmlChar * URI)
+{
+    if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (-1);
+
+    return xmlHashRemoveEntry2(xsltElementsHash, name, URI,
+                               (xmlHashDeallocator) xsltFreeExtElement);
+}
+
+/**
+ * xsltUnregisterAllExtModuleElement:
+ *
+ * Unregisters all extension module element
+ */
+static void
+xsltUnregisterAllExtModuleElement(void)
+{
+    xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement);
+    xsltElementsHash = NULL;
+}
+
+/**
+ * xsltRegisterExtModuleTopLevel:
+ * @name:  the top-level element name
+ * @URI:  the top-level element namespace URI
+ * @function:  the top-level element callback
+ *
+ * Registers an extension module top-level element.
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltRegisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI,
+                              xsltTopLevelFunction function)
+{
+    if ((name == NULL) || (URI == NULL) || (function == NULL))
+        return (-1);
+
+    if (xsltTopLevelsHash == NULL)
+        xsltTopLevelsHash = xmlHashCreate(10);
+    if (xsltTopLevelsHash == NULL)
+        return (-1);
+
+    xmlHashUpdateEntry2(xsltTopLevelsHash, name, URI,
+                        XML_CAST_FPTR(function), NULL);
+
+    return (0);
+}
+
+/**
+ * xsltExtModuleTopLevelLookup:
+ * @name:  the top-level element name
+ * @URI:  the top-level element namespace URI
+ *
+ * Looks up an extension module top-level element
+ *
+ * Returns the callback function if found, NULL otherwise.
+ */
+xsltTopLevelFunction
+xsltExtModuleTopLevelLookup(const xmlChar * name, const xmlChar * URI)
+{
+    xsltTopLevelFunction ret;
+
+    if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (NULL);
+
+    XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI);
+
+    /* if lookup fails, attempt a dynamic load on supported platforms */
+    if (NULL == ret) {
+        if (!xsltExtModuleRegisterDynamic(URI)) {
+            XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI);
+        }
+    }
+
+    return (ret);
+}
+
+/**
+ * xsltUnregisterExtModuleTopLevel:
+ * @name:  the top-level element name
+ * @URI:  the top-level element namespace URI
+ *
+ * Unregisters an extension module top-level element
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+xsltUnregisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI)
+{
+    if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
+        return (-1);
+
+    return xmlHashRemoveEntry2(xsltTopLevelsHash, name, URI, NULL);
+}
+
+/**
+ * xsltUnregisterAllExtModuleTopLevel:
+ *
+ * Unregisters all extension module function
+ */
+static void
+xsltUnregisterAllExtModuleTopLevel(void)
+{
+    xmlHashFree(xsltTopLevelsHash, NULL);
+    xsltTopLevelsHash = NULL;
+}
+
+/**
+ * xsltGetExtInfo:
+ * @style:  pointer to a stylesheet
+ * @URI:    the namespace URI desired
+ *
+ * looks up URI in extInfos of the stylesheet
+ *
+ * returns a pointer to the hash table if found, else NULL
+ */
+xmlHashTablePtr
+xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar * URI)
+{
+    xsltExtDataPtr data;
+
+    /*
+    * TODO: Why do we have a return type of xmlHashTablePtr?
+    *   Is the user-allocated data for extension modules expected
+    *   to be a xmlHashTablePtr only? Or is this intended for
+    *   the EXSLT module only?
+    */
+
+    if (style != NULL && style->extInfos != NULL) {
+        data = xmlHashLookup(style->extInfos, URI);
+        if (data != NULL && data->extData != NULL)
+            return data->extData;
+    }
+    return NULL;
+}
+
+/************************************************************************
+ * 									*
+ * 		Test module http://xmlsoft.org/XSLT/			*
+ * 									*
+ ************************************************************************/
+
+/************************************************************************
+ * 									*
+ * 		Test of the extension module API			*
+ * 									*
+ ************************************************************************/
+
+static xmlChar *testData = NULL;
+static xmlChar *testStyleData = NULL;
+
+/**
+ * xsltExtFunctionTest:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * function libxslt:test() for testing the extensions support.
+ */
+static void
+xsltExtFunctionTest(xmlXPathParserContextPtr ctxt,
+                    int nargs ATTRIBUTE_UNUSED)
+{
+    xsltTransformContextPtr tctxt;
+    void *data = NULL;
+
+    tctxt = xsltXPathGetTransformContext(ctxt);
+
+    if (testData == NULL) {
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltExtFunctionTest: not initialized,"
+                         " calling xsltGetExtData\n");
+        data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
+        if (data == NULL) {
+            xsltTransformError(tctxt, NULL, NULL,
+                               "xsltExtElementTest: not initialized\n");
+            return;
+        }
+    }
+    if (tctxt == NULL) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                           "xsltExtFunctionTest: failed to get the transformation context\n");
+        return;
+    }
+    if (data == NULL)
+        data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
+    if (data == NULL) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                           "xsltExtFunctionTest: failed to get module data\n");
+        return;
+    }
+    if (data != testData) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                           "xsltExtFunctionTest: got wrong module data\n");
+        return;
+    }
+#ifdef WITH_XSLT_DEBUG_FUNCTION
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "libxslt:test() called with %d args\n", nargs);
+#endif
+}
+
+/**
+ * xsltExtElementPreCompTest:
+ * @style:  the stylesheet
+ * @inst:  the instruction in the stylesheet
+ *
+ * Process a libxslt:test node
+ */
+static xsltElemPreCompPtr
+xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst,
+                          xsltTransformFunction function)
+{
+    xsltElemPreCompPtr ret;
+
+    if (style == NULL) {
+        xsltTransformError(NULL, NULL, inst,
+                           "xsltExtElementTest: no transformation context\n");
+        return (NULL);
+    }
+    if (testStyleData == NULL) {
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltExtElementPreCompTest: not initialized,"
+                         " calling xsltStyleGetExtData\n");
+        xsltStyleGetExtData(style, (const xmlChar *) XSLT_DEFAULT_URL);
+        if (testStyleData == NULL) {
+            xsltTransformError(NULL, style, inst,
+                               "xsltExtElementPreCompTest: not initialized\n");
+            if (style != NULL)
+                style->errors++;
+            return (NULL);
+        }
+    }
+    if (inst == NULL) {
+        xsltTransformError(NULL, style, inst,
+                           "xsltExtElementPreCompTest: no instruction\n");
+        if (style != NULL)
+            style->errors++;
+        return (NULL);
+    }
+    ret = xsltNewElemPreComp(style, inst, function);
+    return (ret);
+}
+
+/**
+ * xsltExtElementTest:
+ * @ctxt:  an XSLT processing context
+ * @node:  The current node
+ * @inst:  the instruction in the stylesheet
+ * @comp:  precomputed informations
+ *
+ * Process a libxslt:test node
+ */
+static void
+xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node,
+                   xmlNodePtr inst,
+                   xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
+{
+    xmlNodePtr commentNode;
+
+    if (testData == NULL) {
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "xsltExtElementTest: not initialized,"
+                         " calling xsltGetExtData\n");
+        xsltGetExtData(ctxt, (const xmlChar *) XSLT_DEFAULT_URL);
+        if (testData == NULL) {
+            xsltTransformError(ctxt, NULL, inst,
+                               "xsltExtElementTest: not initialized\n");
+            return;
+        }
+    }
+    if (ctxt == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+                           "xsltExtElementTest: no transformation context\n");
+        return;
+    }
+    if (node == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+                           "xsltExtElementTest: no current node\n");
+        return;
+    }
+    if (inst == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+                           "xsltExtElementTest: no instruction\n");
+        return;
+    }
+    if (ctxt->insert == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+                           "xsltExtElementTest: no insertion point\n");
+        return;
+    }
+    commentNode = xmlNewComment((const xmlChar *)
+                                "libxslt:test element test worked");
+    xmlAddChild(ctxt->insert, commentNode);
+}
+
+/**
+ * xsltExtInitTest:
+ * @ctxt:  an XSLT transformation context
+ * @URI:  the namespace URI for the extension
+ *
+ * A function called at initialization time of an XSLT extension module
+ *
+ * Returns a pointer to the module specific data for this transformation
+ */
+static void *
+xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar * URI)
+{
+    if (testStyleData == NULL) {
+        xsltGenericDebug(xsltGenericErrorContext,
+                         "xsltExtInitTest: not initialized,"
+                         " calling xsltStyleGetExtData\n");
+        testStyleData = xsltStyleGetExtData(ctxt->style, URI);
+        if (testStyleData == NULL) {
+            xsltTransformError(ctxt, NULL, NULL,
+                               "xsltExtInitTest: not initialized\n");
+            return (NULL);
+        }
+    }
+    if (testData != NULL) {
+        xsltTransformError(ctxt, NULL, NULL,
+                           "xsltExtInitTest: already initialized\n");
+        return (NULL);
+    }
+    testData = (void *) "test data";
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Registered test module : %s\n", URI);
+    return (testData);
+}
+
+
+/**
+ * xsltExtShutdownTest:
+ * @ctxt:  an XSLT transformation context
+ * @URI:  the namespace URI for the extension
+ * @data:  the data associated to this module
+ *
+ * A function called at shutdown time of an XSLT extension module
+ */
+static void
+xsltExtShutdownTest(xsltTransformContextPtr ctxt,
+                    const xmlChar * URI, void *data)
+{
+    if (testData == NULL) {
+        xsltTransformError(ctxt, NULL, NULL,
+                           "xsltExtShutdownTest: not initialized\n");
+        return;
+    }
+    if (data != testData) {
+        xsltTransformError(ctxt, NULL, NULL,
+                           "xsltExtShutdownTest: wrong data\n");
+    }
+    testData = NULL;
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Unregistered test module : %s\n", URI);
+}
+
+/**
+ * xsltExtStyleInitTest:
+ * @style:  an XSLT stylesheet
+ * @URI:  the namespace URI for the extension
+ *
+ * A function called at initialization time of an XSLT extension module
+ *
+ * Returns a pointer to the module specific data for this transformation
+ */
+static void *
+xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED,
+                     const xmlChar * URI)
+{
+    if (testStyleData != NULL) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltExtInitTest: already initialized\n");
+        return (NULL);
+    }
+    testStyleData = (void *) "test data";
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Registered test module : %s\n", URI);
+    return (testStyleData);
+}
+
+
+/**
+ * xsltExtStyleShutdownTest:
+ * @style:  an XSLT stylesheet
+ * @URI:  the namespace URI for the extension
+ * @data:  the data associated to this module
+ *
+ * A function called at shutdown time of an XSLT extension module
+ */
+static void
+xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED,
+                         const xmlChar * URI, void *data)
+{
+    if (testStyleData == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+                         "xsltExtShutdownTest: not initialized\n");
+        return;
+    }
+    if (data != testStyleData) {
+        xsltTransformError(NULL, NULL, NULL,
+                           "xsltExtShutdownTest: wrong data\n");
+    }
+    testStyleData = NULL;
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Unregistered test module : %s\n", URI);
+}
+
+/**
+ * xsltRegisterTestModule:
+ *
+ * Registers the test module
+ */
+void
+xsltRegisterTestModule(void)
+{
+    xsltRegisterExtModuleFull((const xmlChar *) XSLT_DEFAULT_URL,
+                              xsltExtInitTest, xsltExtShutdownTest,
+                              xsltExtStyleInitTest,
+                              xsltExtStyleShutdownTest);
+    xsltRegisterExtModuleFunction((const xmlChar *) "test",
+                                  (const xmlChar *) XSLT_DEFAULT_URL,
+                                  xsltExtFunctionTest);
+    xsltRegisterExtModuleElement((const xmlChar *) "test",
+                                 (const xmlChar *) XSLT_DEFAULT_URL,
+                                 xsltExtElementPreCompTest,
+                                 xsltExtElementTest);
+}
+
+static void
+xsltHashScannerModuleFree(void *payload, void *data ATTRIBUTE_UNUSED,
+                          xmlChar * name ATTRIBUTE_UNUSED)
+{
+#ifdef WITH_MODULES
+    xmlModuleClose(payload);
+#endif
+}
+
+/**
+ * xsltCleanupGlobals:
+ *
+ * Unregister all global variables set up by the XSLT library
+ */
+void
+xsltCleanupGlobals(void)
+{
+    xsltUnregisterAllExtModules();
+    xsltUnregisterAllExtModuleFunction();
+    xsltUnregisterAllExtModuleElement();
+    xsltUnregisterAllExtModuleTopLevel();
+
+    /* cleanup dynamic module hash */
+    if (NULL != xsltModuleHash) {
+        xmlHashScan(xsltModuleHash, xsltHashScannerModuleFree, 0);
+        xmlHashFree(xsltModuleHash, NULL);
+        xsltModuleHash = NULL;
+    }
+
+    xsltUninit();
+}
+
+static void
+xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED,
+                                FILE * output, const xmlChar * name,
+                                const xmlChar * URI,
+                                const xmlChar * not_used ATTRIBUTE_UNUSED)
+{
+    if (!name || !URI)
+        return;
+    fprintf(output, "{%s}%s\n", URI, name);
+}
+
+static void
+xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED,
+                                FILE * output, const xmlChar * URI,
+                                const xmlChar * not_used ATTRIBUTE_UNUSED,
+                                const xmlChar * not_used2 ATTRIBUTE_UNUSED)
+{
+    if (!URI)
+        return;
+    fprintf(output, "%s\n", URI);
+}
+
+/**
+ * xsltDebugDumpExtensions:
+ * @output:  the FILE * for the output, if NULL stdout is used
+ *
+ * Dumps a list of the registered XSLT extension functions and elements
+ */
+void
+xsltDebugDumpExtensions(FILE * output)
+{
+    if (output == NULL)
+        output = stdout;
+    fprintf(output,
+            "Registered XSLT Extensions\n--------------------------\n");
+    if (!xsltFunctionsHash)
+        fprintf(output, "No registered extension functions\n");
+    else {
+        fprintf(output, "Registered Extension Functions:\n");
+        xmlHashScanFull(xsltFunctionsHash,
+                        (xmlHashScannerFull)
+                        xsltDebugDumpExtensionsCallback, output);
+    }
+    if (!xsltElementsHash)
+        fprintf(output, "\nNo registered extension elements\n");
+    else {
+        fprintf(output, "\nRegistered Extension Elements:\n");
+        xmlHashScanFull(xsltElementsHash,
+                        (xmlHashScannerFull)
+                        xsltDebugDumpExtensionsCallback, output);
+    }
+    if (!xsltExtensionsHash)
+        fprintf(output, "\nNo registered extension modules\n");
+    else {
+        fprintf(output, "\nRegistered Extension Modules:\n");
+        xmlHashScanFull(xsltExtensionsHash,
+                        (xmlHashScannerFull)
+                        xsltDebugDumpExtModulesCallback, output);
+    }
+
+}
diff --git a/third_party/libxslt/libxslt/extensions.h b/third_party/libxslt/libxslt/extensions.h
new file mode 100644
index 0000000..30b7d4c
--- /dev/null
+++ b/third_party/libxslt/libxslt/extensions.h
@@ -0,0 +1,256 @@
+/*
+ * Summary: interface for the extension support
+ * Description: This provide the API needed for simple and module
+ *              extension support.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_EXTENSION_H__
+#define __XML_XSLT_EXTENSION_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Extension Modules API.
+ */
+
+/**
+ * xsltStyleExtInitFunction:
+ * @ctxt:  an XSLT stylesheet
+ * @URI:  the namespace URI for the extension
+ *
+ * A function called at initialization time of an XSLT extension module.
+ *
+ * Returns a pointer to the module specific data for this transformation.
+ */
+typedef void * (*xsltStyleExtInitFunction)	(xsltStylesheetPtr style,
+						 const xmlChar *URI);
+
+/**
+ * xsltStyleExtShutdownFunction:
+ * @ctxt:  an XSLT stylesheet
+ * @URI:  the namespace URI for the extension
+ * @data:  the data associated to this module
+ *
+ * A function called at shutdown time of an XSLT extension module.
+ */
+typedef void (*xsltStyleExtShutdownFunction)	(xsltStylesheetPtr style,
+						 const xmlChar *URI,
+						 void *data);
+
+/**
+ * xsltExtInitFunction:
+ * @ctxt:  an XSLT transformation context
+ * @URI:  the namespace URI for the extension
+ *
+ * A function called at initialization time of an XSLT extension module.
+ *
+ * Returns a pointer to the module specific data for this transformation.
+ */
+typedef void * (*xsltExtInitFunction)	(xsltTransformContextPtr ctxt,
+					 const xmlChar *URI);
+
+/**
+ * xsltExtShutdownFunction:
+ * @ctxt:  an XSLT transformation context
+ * @URI:  the namespace URI for the extension
+ * @data:  the data associated to this module
+ *
+ * A function called at shutdown time of an XSLT extension module.
+ */
+typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
+					 const xmlChar *URI,
+					 void *data);
+
+XSLTPUBFUN int XSLTCALL
+		xsltRegisterExtModule	(const xmlChar *URI,
+					 xsltExtInitFunction initFunc,
+					 xsltExtShutdownFunction shutdownFunc);
+XSLTPUBFUN int XSLTCALL
+		xsltRegisterExtModuleFull
+					(const xmlChar * URI,
+					 xsltExtInitFunction initFunc,
+					 xsltExtShutdownFunction shutdownFunc,
+					 xsltStyleExtInitFunction styleInitFunc,
+					 xsltStyleExtShutdownFunction styleShutdownFunc);
+
+XSLTPUBFUN int XSLTCALL
+		xsltUnregisterExtModule	(const xmlChar * URI);
+
+XSLTPUBFUN void * XSLTCALL		
+		xsltGetExtData		(xsltTransformContextPtr ctxt,
+					 const xmlChar *URI);
+
+XSLTPUBFUN void * XSLTCALL		
+		xsltStyleGetExtData	(xsltStylesheetPtr style,
+					 const xmlChar *URI);
+#ifdef XSLT_REFACTORED
+XSLTPUBFUN void * XSLTCALL
+		xsltStyleStylesheetLevelGetExtData(
+					 xsltStylesheetPtr style,
+					 const xmlChar * URI);
+#endif
+XSLTPUBFUN void XSLTCALL		
+    		xsltShutdownCtxtExts	(xsltTransformContextPtr ctxt);
+
+XSLTPUBFUN void XSLTCALL		
+    		xsltShutdownExts	(xsltStylesheetPtr style);
+
+XSLTPUBFUN xsltTransformContextPtr XSLTCALL 
+    		xsltXPathGetTransformContext
+					(xmlXPathParserContextPtr ctxt);
+
+/*
+ * extension functions
+*/
+XSLTPUBFUN int XSLTCALL	
+		xsltRegisterExtModuleFunction	
+					(const xmlChar *name,
+					 const xmlChar *URI,
+					 xmlXPathFunction function);
+XSLTPUBFUN xmlXPathFunction XSLTCALL
+	xsltExtFunctionLookup		(xsltTransformContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN xmlXPathFunction XSLTCALL
+	xsltExtModuleFunctionLookup	(const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL	
+		xsltUnregisterExtModuleFunction	
+					(const xmlChar *name,
+					 const xmlChar *URI);
+
+/*
+ * extension elements
+ */
+typedef xsltElemPreCompPtr (*xsltPreComputeFunction)
+    					(xsltStylesheetPtr style,
+					 xmlNodePtr inst,
+					 xsltTransformFunction function);
+
+XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
+		xsltNewElemPreComp	(xsltStylesheetPtr style,
+					 xmlNodePtr inst,
+					 xsltTransformFunction function);
+XSLTPUBFUN void XSLTCALL	
+		xsltInitElemPreComp	(xsltElemPreCompPtr comp,
+					 xsltStylesheetPtr style,
+					 xmlNodePtr inst,
+					 xsltTransformFunction function,
+					 xsltElemPreCompDeallocator freeFunc);
+
+XSLTPUBFUN int XSLTCALL	
+		xsltRegisterExtModuleElement	
+					(const xmlChar *name,
+					 const xmlChar *URI,
+					 xsltPreComputeFunction precomp,
+					 xsltTransformFunction transform);
+XSLTPUBFUN xsltTransformFunction XSLTCALL 
+		xsltExtElementLookup	(xsltTransformContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN xsltTransformFunction XSLTCALL 
+		xsltExtModuleElementLookup
+					(const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN xsltPreComputeFunction XSLTCALL 
+		xsltExtModuleElementPreComputeLookup 
+					(const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL	
+		xsltUnregisterExtModuleElement	
+					(const xmlChar *name,
+					 const xmlChar *URI);
+
+/*
+ * top-level elements
+ */
+typedef void (*xsltTopLevelFunction)	(xsltStylesheetPtr style,
+					 xmlNodePtr inst);
+
+XSLTPUBFUN int XSLTCALL	
+		xsltRegisterExtModuleTopLevel
+					(const xmlChar *name,
+					 const xmlChar *URI,
+					 xsltTopLevelFunction function);
+XSLTPUBFUN xsltTopLevelFunction XSLTCALL 
+		xsltExtModuleTopLevelLookup 
+					(const xmlChar *name,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL	
+		xsltUnregisterExtModuleTopLevel	
+					(const xmlChar *name,
+					 const xmlChar *URI);
+
+
+/* These 2 functions are deprecated for use within modules. */
+XSLTPUBFUN int XSLTCALL		
+		xsltRegisterExtFunction	(xsltTransformContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *URI,
+					 xmlXPathFunction function);
+XSLTPUBFUN int XSLTCALL		
+		xsltRegisterExtElement	(xsltTransformContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *URI,
+					 xsltTransformFunction function);
+
+/*
+ * Extension Prefix handling API.
+ * Those are used by the XSLT (pre)processor.
+ */
+
+XSLTPUBFUN int XSLTCALL		
+		xsltRegisterExtPrefix	(xsltStylesheetPtr style,
+					 const xmlChar *prefix,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL		
+		xsltCheckExtPrefix	(xsltStylesheetPtr style,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL
+		xsltCheckExtURI		(xsltStylesheetPtr style,
+					 const xmlChar *URI);
+XSLTPUBFUN int XSLTCALL		
+		xsltInitCtxtExts	(xsltTransformContextPtr ctxt);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeCtxtExts	(xsltTransformContextPtr ctxt);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeExts		(xsltStylesheetPtr style);
+
+XSLTPUBFUN xsltElemPreCompPtr XSLTCALL 
+		xsltPreComputeExtModuleElement
+					(xsltStylesheetPtr style,
+					 xmlNodePtr inst);
+/*
+ * Extension Infos access.
+ * Used by exslt initialisation
+ */
+
+XSLTPUBFUN xmlHashTablePtr XSLTCALL 
+		xsltGetExtInfo		(xsltStylesheetPtr style, 
+					 const xmlChar *URI);
+
+/**
+ * Test module http://xmlsoft.org/XSLT/
+ */
+XSLTPUBFUN void XSLTCALL	
+		xsltRegisterTestModule	(void);
+XSLTPUBFUN void XSLTCALL	
+		xsltDebugDumpExtensions	(FILE * output);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_EXTENSION_H__ */
+
diff --git a/third_party/libxslt/libxslt/extra.c b/third_party/libxslt/libxslt/extra.c
new file mode 100644
index 0000000..9128ab4
--- /dev/null
+++ b/third_party/libxslt/libxslt/extra.c
@@ -0,0 +1,330 @@
+/*
+ * extra.c: Implementation of non-standard features
+ *
+ * Reference:
+ *   Michael Kay "XSLT Programmer's Reference" pp 637-643
+ *   The node-set() extension function
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+#ifdef HAVE_TIME_H
+#define __USE_XOPEN
+#include 
+#endif
+#ifdef HAVE_STDLIB_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "extensions.h"
+#include "variables.h"
+#include "transform.h"
+#include "extra.h"
+#include "preproc.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_EXTRA
+#endif
+
+/************************************************************************
+ * 									*
+ * 		Handling of XSLT debugging				*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltDebug:
+ * @ctxt:  an XSLT processing context
+ * @node:  The current node
+ * @inst:  the instruction in the stylesheet
+ * @comp:  precomputed informations
+ *
+ * Process an debug node
+ */
+void
+xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED,
+          xmlNodePtr inst ATTRIBUTE_UNUSED,
+          xsltStylePreCompPtr comp ATTRIBUTE_UNUSED)
+{
+    int i, j;
+
+    xsltGenericError(xsltGenericErrorContext, "Templates:\n");
+    for (i = 0, j = ctxt->templNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
+        xsltGenericError(xsltGenericErrorContext, "#%d ", i);
+        if (ctxt->templTab[j]->name != NULL)
+            xsltGenericError(xsltGenericErrorContext, "name %s ",
+                             ctxt->templTab[j]->name);
+        if (ctxt->templTab[j]->match != NULL)
+            xsltGenericError(xsltGenericErrorContext, "name %s ",
+                             ctxt->templTab[j]->match);
+        if (ctxt->templTab[j]->mode != NULL)
+            xsltGenericError(xsltGenericErrorContext, "name %s ",
+                             ctxt->templTab[j]->mode);
+        xsltGenericError(xsltGenericErrorContext, "\n");
+    }
+    xsltGenericError(xsltGenericErrorContext, "Variables:\n");
+    for (i = 0, j = ctxt->varsNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
+        xsltStackElemPtr cur;
+
+        if (ctxt->varsTab[j] == NULL)
+            continue;
+        xsltGenericError(xsltGenericErrorContext, "#%d\n", i);
+        cur = ctxt->varsTab[j];
+        while (cur != NULL) {
+            if (cur->comp == NULL) {
+                xsltGenericError(xsltGenericErrorContext,
+                                 "corrupted !!!\n");
+            } else if (cur->comp->type == XSLT_FUNC_PARAM) {
+                xsltGenericError(xsltGenericErrorContext, "param ");
+            } else if (cur->comp->type == XSLT_FUNC_VARIABLE) {
+                xsltGenericError(xsltGenericErrorContext, "var ");
+            }
+            if (cur->name != NULL)
+                xsltGenericError(xsltGenericErrorContext, "%s ",
+                                 cur->name);
+            else
+                xsltGenericError(xsltGenericErrorContext, "noname !!!!");
+#ifdef LIBXML_DEBUG_ENABLED
+            if (cur->value != NULL) {
+                xmlXPathDebugDumpObject(stdout, cur->value, 1);
+            } else {
+                xsltGenericError(xsltGenericErrorContext, "NULL !!!!");
+            }
+#endif
+            xsltGenericError(xsltGenericErrorContext, "\n");
+            cur = cur->next;
+        }
+
+    }
+}
+
+/************************************************************************
+ * 									*
+ * 		Classic extensions as described by M. Kay		*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltFunctionNodeSet:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the node-set() XSLT function
+ *   node-set node-set(result-tree)
+ *
+ * This function is available in libxslt, saxon or xt namespace.
+ */
+void
+xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
+    if (nargs != 1) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"node-set() : expects one result-tree arg\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    if ((ctxt->value == NULL) ||
+	((ctxt->value->type != XPATH_XSLT_TREE) &&
+	 (ctxt->value->type != XPATH_NODESET))) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	    "node-set() invalid arg expecting a result tree\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	return;
+    }
+    if (ctxt->value->type == XPATH_XSLT_TREE) {
+	ctxt->value->type = XPATH_NODESET;
+    }
+}
+
+
+/*
+ * Okay the following really seems unportable and since it's not
+ * part of any standard I'm not too ashamed to do this
+ */
+#if defined(linux) || defined(__sun)
+#if defined(HAVE_MKTIME) && defined(HAVE_LOCALTIME) && defined(HAVE_ASCTIME)
+#define WITH_LOCALTIME
+
+/**
+ * xsltFunctionLocalTime:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the localTime XSLT function used by NORM
+ *   string localTime(???)
+ *
+ * This function is available in Norm's extension namespace
+ * Code (and comments) contributed by Norm
+ */
+static void
+xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
+    xmlXPathObjectPtr obj;
+    char *str;
+    char digits[5];
+    char result[29];
+    long int field;
+    time_t gmt, lmt;
+    struct tm gmt_tm;
+    struct tm *local_tm;
+ 
+    if (nargs != 1) {
+       xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                      "localTime() : invalid number of args %d\n", nargs);
+       ctxt->error = XPATH_INVALID_ARITY;
+       return;
+    }
+ 
+    obj = valuePop(ctxt);
+
+    if (obj->type != XPATH_STRING) {
+	obj = xmlXPathConvertString(obj);
+    }
+    if (obj == NULL) {
+	valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+	return;
+    }
+    
+    str = (char *) obj->stringval;
+
+    /* str = "$Date: 2002-10-15 18:06:47 +0200 (Tue, 15 Oct 2002) $" */
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+7, 4);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_year = field - 1900;
+
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+12, 2);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_mon = field - 1;
+
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+15, 2);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_mday = field;
+
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+18, 2);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_hour = field;
+
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+21, 2);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_min = field;
+
+    memset(digits, 0, sizeof(digits));
+    strncpy(digits, str+24, 2);
+    field = strtol(digits, NULL, 10);
+    gmt_tm.tm_sec = field;
+
+    /* Now turn gmt_tm into a time. */
+    gmt = mktime(&gmt_tm);
+
+
+    /*
+     * FIXME: it's been too long since I did manual memory management.
+     * (I swore never to do it again.) Does this introduce a memory leak?
+     */
+    local_tm = localtime(&gmt);
+
+    /*
+     * Calling localtime() has the side-effect of setting timezone.
+     * After we know the timezone, we can adjust for it
+     */
+    lmt = gmt - timezone;
+
+    /*
+     * FIXME: it's been too long since I did manual memory management.
+     * (I swore never to do it again.) Does this introduce a memory leak?
+     */
+    local_tm = localtime(&lmt);
+
+    /*
+     * Now convert local_tm back into a string. This doesn't introduce
+     * a memory leak, so says asctime(3).
+     */
+
+    str = asctime(local_tm);           /* "Tue Jun 26 05:02:16 2001" */
+                                       /*  0123456789 123456789 123 */
+
+    memset(result, 0, sizeof(result)); /* "Thu, 26 Jun 2001" */
+                                       /*  0123456789 12345 */
+
+    strncpy(result, str, 20);
+    strcpy(result+20, "???");          /* tzname doesn't work, fake it */
+    strncpy(result+23, str+19, 5);
+
+    /* Ok, now result contains the string I want to send back. */
+    valuePush(ctxt, xmlXPathNewString((xmlChar *)result));
+}
+#endif
+#endif /* linux or sun */
+
+
+/**
+ * xsltRegisterExtras:
+ * @ctxt:  a XSLT process context
+ *
+ * Registers the built-in extensions. This function is deprecated, use
+ * xsltRegisterAllExtras instead.
+ */
+void
+xsltRegisterExtras(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED) {
+    xsltRegisterAllExtras();
+}
+
+/**
+ * xsltRegisterAllExtras:
+ *
+ * Registers the built-in extensions
+ */
+void
+xsltRegisterAllExtras (void) {
+    xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
+				  XSLT_LIBXSLT_NAMESPACE,
+				  xsltFunctionNodeSet);
+    xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
+				  XSLT_SAXON_NAMESPACE,
+				  xsltFunctionNodeSet);
+    xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
+				  XSLT_XT_NAMESPACE,
+				  xsltFunctionNodeSet);
+#ifdef WITH_LOCALTIME
+    xsltRegisterExtModuleFunction((const xmlChar *) "localTime",
+				  XSLT_NORM_SAXON_NAMESPACE,
+				  xsltFunctionLocalTime);
+#endif
+    xsltRegisterExtModuleElement((const xmlChar *) "debug",
+				 XSLT_LIBXSLT_NAMESPACE,
+				 NULL,
+				 (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtModuleElement((const xmlChar *) "output",
+				 XSLT_SAXON_NAMESPACE,
+				 xsltDocumentComp,
+				 (xsltTransformFunction) xsltDocumentElem);
+    xsltRegisterExtModuleElement((const xmlChar *) "write",
+				 XSLT_XALAN_NAMESPACE,
+				 xsltDocumentComp,
+				 (xsltTransformFunction) xsltDocumentElem);
+    xsltRegisterExtModuleElement((const xmlChar *) "document",
+				 XSLT_XT_NAMESPACE,
+				 xsltDocumentComp,
+				 (xsltTransformFunction) xsltDocumentElem);
+    xsltRegisterExtModuleElement((const xmlChar *) "document",
+				 XSLT_NAMESPACE,
+				 xsltDocumentComp,
+				 (xsltTransformFunction) xsltDocumentElem);
+}
diff --git a/third_party/libxslt/libxslt/extra.h b/third_party/libxslt/libxslt/extra.h
new file mode 100644
index 0000000..59e932b
--- /dev/null
+++ b/third_party/libxslt/libxslt/extra.h
@@ -0,0 +1,80 @@
+/*
+ * Summary: interface for the non-standard features
+ * Description: implement some extension outside the XSLT namespace
+ *              but not EXSLT with is in a different library.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_EXTRA_H__
+#define __XML_XSLT_EXTRA_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XSLT_LIBXSLT_NAMESPACE:
+ *
+ * This is the libxslt namespace for specific extensions.
+ */
+#define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace")
+
+/**
+ * XSLT_SAXON_NAMESPACE:
+ *
+ * This is Michael Kay's Saxon processor namespace for extensions.
+ */
+#define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon")
+
+/**
+ * XSLT_XT_NAMESPACE:
+ *
+ * This is James Clark's XT processor namespace for extensions.
+ */
+#define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt")
+
+/**
+ * XSLT_XALAN_NAMESPACE:
+ *
+ * This is the Apache project XALAN processor namespace for extensions.
+ */
+#define XSLT_XALAN_NAMESPACE ((xmlChar *)	\
+	                        "org.apache.xalan.xslt.extensions.Redirect")
+
+/**
+ * XSLT_NORM_SAXON_NAMESPACE:
+ *
+ * This is Norm's namespace for SAXON extensions.
+ */
+#define XSLT_NORM_SAXON_NAMESPACE ((xmlChar *)	\
+	"http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS")
+
+
+XSLTPUBFUN void XSLTCALL
+		xsltFunctionNodeSet	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL		
+		xsltDebug		(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+
+
+XSLTPUBFUN void XSLTCALL		
+		xsltRegisterExtras	(xsltTransformContextPtr ctxt);
+XSLTPUBFUN void XSLTCALL		
+		xsltRegisterAllExtras	(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_EXTRA_H__ */
+
diff --git a/third_party/libxslt/libxslt/functions.c b/third_party/libxslt/libxslt/functions.c
new file mode 100644
index 0000000..7ae2499
--- /dev/null
+++ b/third_party/libxslt/libxslt/functions.c
@@ -0,0 +1,973 @@
+/*
+ * functions.c: Implementation of the XSLT extra functions
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ * Bjorn Reese  for number formatting
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#ifdef HAVE_SYS_TYPES_H
+#include 
+#endif
+#ifdef HAVE_CTYPE_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "functions.h"
+#include "extensions.h"
+#include "numbersInternals.h"
+#include "keys.h"
+#include "documents.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_FUNCTION
+#endif
+
+/*
+ * Some versions of DocBook XSL use the vendor string to detect
+ * supporting chunking, this is a workaround to be considered
+ * in the list of decent XSLT processors 
+ */
+#define DOCBOOK_XSL_HACK
+
+/**
+ * xsltXPathFunctionLookup:
+ * @ctxt:  a void * but the XSLT transformation context actually
+ * @name:  the function name
+ * @ns_uri:  the function namespace URI
+ *
+ * This is the entry point when a function is needed by the XPath
+ * interpretor.
+ *
+ * Returns the callback function or NULL if not found
+ */
+xmlXPathFunction
+xsltXPathFunctionLookup (xmlXPathContextPtr ctxt,
+			 const xmlChar *name, const xmlChar *ns_uri) {
+    xmlXPathFunction ret;
+
+    if ((ctxt == NULL) || (name == NULL) || (ns_uri == NULL))
+	return (NULL);
+
+#ifdef WITH_XSLT_DEBUG_FUNCTION
+    xsltGenericDebug(xsltGenericDebugContext,
+            "Lookup function {%s}%s\n", ns_uri, name);
+#endif
+
+    /* give priority to context-level functions */
+    /*
+    ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri);
+    */
+    XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri);
+
+    if (ret == NULL)
+	ret = xsltExtModuleFunctionLookup(name, ns_uri);
+
+#ifdef WITH_XSLT_DEBUG_FUNCTION
+    if (ret != NULL)
+        xsltGenericDebug(xsltGenericDebugContext,
+            "found function %s\n", name);
+#endif
+    return(ret);
+}
+
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+static void
+xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
+{
+    xsltTransformContextPtr tctxt;
+    xmlURIPtr uri;
+    xmlChar *fragment;
+    xsltDocumentPtr idoc; /* document info */
+    xmlDocPtr doc;
+    xmlXPathContextPtr xptrctxt = NULL;
+    xmlXPathObjectPtr resObj = NULL;
+
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+	    "document() : internal error tctxt == NULL\n");
+	valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+	return;
+    } 
+	
+    uri = xmlParseURI((const char *) URI);
+    if (uri == NULL) {
+	xsltTransformError(tctxt, NULL, NULL,
+	    "document() : failed to parse URI\n");
+	valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+	return;
+    } 
+    
+    /*
+     * check for and remove fragment identifier
+     */
+    fragment = (xmlChar *)uri->fragment;
+    if (fragment != NULL) {
+        xmlChar *newURI;
+	uri->fragment = NULL;
+	newURI = xmlSaveUri(uri);
+	idoc = xsltLoadDocument(tctxt, newURI);
+	xmlFree(newURI);
+    } else
+	idoc = xsltLoadDocument(tctxt, URI);
+    xmlFreeURI(uri);
+    
+    if (idoc == NULL) {
+	if ((URI == NULL) ||
+	    (URI[0] == '#') ||
+	    ((tctxt->style->doc != NULL) &&
+	    (xmlStrEqual(tctxt->style->doc->URL, URI)))) 
+	{
+	    /*
+	    * This selects the stylesheet's doc itself.
+	    */
+	    doc = tctxt->style->doc;
+	} else {
+	    valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+
+	    if (fragment != NULL)
+		xmlFree(fragment);
+
+	    return;
+	}
+    } else
+	doc = idoc->doc;
+
+    if (fragment == NULL) {
+	valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc));
+	return;
+    }
+	
+    /* use XPointer of HTML location for fragment ID */
+#ifdef LIBXML_XPTR_ENABLED
+    xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
+    if (xptrctxt == NULL) {
+	xsltTransformError(tctxt, NULL, NULL,
+	    "document() : internal error xptrctxt == NULL\n");
+	goto out_fragment;
+    }
+
+    resObj = xmlXPtrEval(fragment, xptrctxt);
+    xmlXPathFreeContext(xptrctxt);
+#endif
+    xmlFree(fragment);	
+
+    if (resObj == NULL)
+	goto out_fragment;
+	
+    switch (resObj->type) {
+	case XPATH_NODESET:
+	    break;
+	case XPATH_UNDEFINED:
+	case XPATH_BOOLEAN:
+	case XPATH_NUMBER:
+	case XPATH_STRING:
+	case XPATH_POINT:
+	case XPATH_USERS:
+	case XPATH_XSLT_TREE:
+	case XPATH_RANGE:
+	case XPATH_LOCATIONSET:
+	    xsltTransformError(tctxt, NULL, NULL,
+		"document() : XPointer does not select a node set: #%s\n", 
+		fragment);
+	goto out_object;
+    }
+    
+    valuePush(ctxt, resObj);
+    return;
+
+out_object:
+    xmlXPathFreeObject(resObj);
+
+out_fragment:
+    valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+}
+
+/**
+ * xsltDocumentFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the document() XSLT function
+ *   node-set document(object, node-set?)
+ */
+void
+xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlXPathObjectPtr obj, obj2 = NULL;
+    xmlChar *base = NULL, *URI;
+
+
+    if ((nargs < 1) || (nargs > 2)) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                         "document() : invalid number of args %d\n",
+                         nargs);
+        ctxt->error = XPATH_INVALID_ARITY;
+        return;
+    }
+    if (ctxt->value == NULL) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                         "document() : invalid arg value\n");
+        ctxt->error = XPATH_INVALID_TYPE;
+        return;
+    }
+
+    if (nargs == 2) {
+        if (ctxt->value->type != XPATH_NODESET) {
+            xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                             "document() : invalid arg expecting a nodeset\n");
+            ctxt->error = XPATH_INVALID_TYPE;
+            return;
+        }
+
+        obj2 = valuePop(ctxt);
+    }
+
+    if (ctxt->value->type == XPATH_NODESET) {
+        int i;
+        xmlXPathObjectPtr newobj, ret;
+
+        obj = valuePop(ctxt);
+        ret = xmlXPathNewNodeSet(NULL);
+
+        if (obj->nodesetval) {
+            for (i = 0; i < obj->nodesetval->nodeNr; i++) {
+                valuePush(ctxt,
+                          xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i]));
+                xmlXPathStringFunction(ctxt, 1);
+                if (nargs == 2) {
+                    valuePush(ctxt, xmlXPathObjectCopy(obj2));
+                } else {
+                    valuePush(ctxt,
+                              xmlXPathNewNodeSet(obj->nodesetval->
+                                                 nodeTab[i]));
+                }
+                xsltDocumentFunction(ctxt, 2);
+                newobj = valuePop(ctxt);
+                ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval,
+                                                       newobj->nodesetval);
+                xmlXPathFreeObject(newobj);
+            }
+        }
+
+        xmlXPathFreeObject(obj);
+        if (obj2 != NULL)
+            xmlXPathFreeObject(obj2);
+        valuePush(ctxt, ret);
+        return;
+    }
+    /*
+     * Make sure it's converted to a string
+     */
+    xmlXPathStringFunction(ctxt, 1);
+    if (ctxt->value->type != XPATH_STRING) {
+        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+                         "document() : invalid arg expecting a string\n");
+        ctxt->error = XPATH_INVALID_TYPE;
+        if (obj2 != NULL)
+            xmlXPathFreeObject(obj2);
+        return;
+    }
+    obj = valuePop(ctxt);
+    if (obj->stringval == NULL) {
+        valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+    } else {
+        if ((obj2 != NULL) && (obj2->nodesetval != NULL) &&
+            (obj2->nodesetval->nodeNr > 0) &&
+            IS_XSLT_REAL_NODE(obj2->nodesetval->nodeTab[0])) {
+            xmlNodePtr target;
+
+            target = obj2->nodesetval->nodeTab[0];
+            if ((target->type == XML_ATTRIBUTE_NODE) ||
+	        (target->type == XML_PI_NODE)) {
+                target = ((xmlAttrPtr) target)->parent;
+            }
+            base = xmlNodeGetBase(target->doc, target);
+        } else {
+            xsltTransformContextPtr tctxt;
+
+            tctxt = xsltXPathGetTransformContext(ctxt);
+            if ((tctxt != NULL) && (tctxt->inst != NULL)) {
+                base = xmlNodeGetBase(tctxt->inst->doc, tctxt->inst);
+            } else if ((tctxt != NULL) && (tctxt->style != NULL) &&
+                       (tctxt->style->doc != NULL)) {
+                base = xmlNodeGetBase(tctxt->style->doc,
+                                      (xmlNodePtr) tctxt->style->doc);
+            }
+        }
+        URI = xmlBuildURI(obj->stringval, base);
+        if (base != NULL)
+            xmlFree(base);
+        if (URI == NULL) {
+            valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+        } else {
+	    xsltDocumentFunctionLoadDocument( ctxt, URI );
+	    xmlFree(URI);
+	}
+    }
+    xmlXPathFreeObject(obj);
+    if (obj2 != NULL)
+        xmlXPathFreeObject(obj2);
+}
+
+/**
+ * xsltKeyFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the key() XSLT function
+ *   node-set key(string, object)
+ */
+void
+xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){    
+    xmlXPathObjectPtr obj1, obj2;    
+    
+    if (nargs != 2) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"key() : expects two arguments\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }    
+
+    /*
+    * Get the key's value.
+    */
+    obj2 = valuePop(ctxt);
+    xmlXPathStringFunction(ctxt, 1);
+    if ((obj2 == NULL) ||
+	(ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	    "key() : invalid arg expecting a string\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	xmlXPathFreeObject(obj2);
+
+	return;
+    }
+    /*
+    * Get the key's name.
+    */
+    obj1 = valuePop(ctxt);    
+
+    if ((obj2->type == XPATH_NODESET) || (obj2->type == XPATH_XSLT_TREE)) {
+	int i;
+	xmlXPathObjectPtr newobj, ret;
+
+	ret = xmlXPathNewNodeSet(NULL);
+
+	if (obj2->nodesetval != NULL) {
+	    for (i = 0; i < obj2->nodesetval->nodeNr; i++) {
+		valuePush(ctxt, xmlXPathObjectCopy(obj1));
+		valuePush(ctxt,
+			  xmlXPathNewNodeSet(obj2->nodesetval->nodeTab[i]));
+		xmlXPathStringFunction(ctxt, 1);
+		xsltKeyFunction(ctxt, 2);
+		newobj = valuePop(ctxt);
+		ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval,
+						       newobj->nodesetval);
+		xmlXPathFreeObject(newobj);
+	    }
+	}
+	valuePush(ctxt, ret);
+    } else {
+	xmlNodeSetPtr nodelist = NULL;
+	xmlChar *key = NULL, *value;
+	const xmlChar *keyURI;
+	xsltTransformContextPtr tctxt;   
+	xmlChar *qname, *prefix;
+	xmlXPathContextPtr xpctxt = ctxt->context;
+	xmlNodePtr tmpNode = NULL;
+	xsltDocumentPtr oldDocInfo;
+
+	tctxt = xsltXPathGetTransformContext(ctxt);
+
+	oldDocInfo = tctxt->document;
+
+	if (xpctxt->node == NULL) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"Internal error in xsltKeyFunction(): "
+		"The context node is not set on the XPath context.\n");
+	    tctxt->state = XSLT_STATE_STOPPED;
+	    goto error;
+	}	
+	/*
+	 * Get the associated namespace URI if qualified name
+	 */
+	qname = obj1->stringval;
+	key = xmlSplitQName2(qname, &prefix);
+	if (key == NULL) {
+	    key = xmlStrdup(obj1->stringval);
+	    keyURI = NULL;
+	    if (prefix != NULL)
+		xmlFree(prefix);
+	} else {
+	    if (prefix != NULL) {
+		keyURI = xmlXPathNsLookup(xpctxt, prefix);
+		if (keyURI == NULL) {
+		    xsltTransformError(tctxt, NULL, tctxt->inst,
+			"key() : prefix %s is not bound\n", prefix);
+		    /*
+		    * TODO: Shouldn't we stop here?
+		    */
+		}
+		xmlFree(prefix);
+	    } else {
+		keyURI = NULL;
+	    }
+	}
+
+	/*
+	 * Force conversion of first arg to string
+	 */
+	valuePush(ctxt, obj2);
+	xmlXPathStringFunction(ctxt, 1);
+	if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"key() : invalid arg expecting a string\n");
+	    ctxt->error = XPATH_INVALID_TYPE;
+	    goto error;
+	}
+	obj2 = valuePop(ctxt);
+	value = obj2->stringval;
+	
+	/*
+	* We need to ensure that ctxt->document is available for
+	* xsltGetKey().
+	* First find the relevant doc, which is the context node's
+	* owner doc; using context->doc is not safe, since
+	* the doc could have been acquired via the document() function,
+	* or the doc might be a Result Tree Fragment.
+	* FUTURE INFO: In XSLT 2.0 the key() function takes an additional
+	* argument indicating the doc to use.
+	*/	
+	if (xpctxt->node->type == XML_NAMESPACE_DECL) {
+	    /*
+	    * REVISIT: This is a libxml hack! Check xpath.c for details.
+	    * The XPath module sets the owner element of a ns-node on
+	    * the ns->next field.
+	    */
+	    if ((((xmlNsPtr) xpctxt->node)->next != NULL) &&
+		(((xmlNsPtr) xpctxt->node)->next->type == XML_ELEMENT_NODE))
+	    {
+		tmpNode = (xmlNodePtr) ((xmlNsPtr) xpctxt->node)->next;
+	    }
+	} else
+	    tmpNode = xpctxt->node;
+
+	if ((tmpNode == NULL) || (tmpNode->doc == NULL)) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"Internal error in xsltKeyFunction(): "
+		"Couldn't get the doc of the XPath context node.\n");
+	    goto error;
+	}
+
+	if ((tctxt->document == NULL) ||
+	    (tctxt->document->doc != tmpNode->doc))
+	{	   
+	    if (tmpNode->doc->name && (tmpNode->doc->name[0] == ' ')) {
+		/*
+		* This is a Result Tree Fragment.
+		*/
+		if (tmpNode->doc->_private == NULL) {
+		    tmpNode->doc->_private = xsltNewDocument(tctxt, tmpNode->doc);
+		    if (tmpNode->doc->_private == NULL)
+			goto error;
+		}
+		tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private;		
+	    } else {
+		/*
+		* May be the initial source doc or a doc acquired via the
+		* document() function.
+		*/
+		tctxt->document = xsltFindDocument(tctxt, tmpNode->doc);
+	    }
+	    if (tctxt->document == NULL) {
+		xsltTransformError(tctxt, NULL, tctxt->inst,
+		    "Internal error in xsltKeyFunction(): "
+		    "Could not get the document info of a context doc.\n");
+		tctxt->state = XSLT_STATE_STOPPED;
+		goto error;
+	    }
+	}
+	/*
+	* Get/compute the key value.
+	*/
+	nodelist = xsltGetKey(tctxt, key, keyURI, value);
+
+error:	
+	tctxt->document = oldDocInfo;
+	valuePush(ctxt, xmlXPathWrapNodeSet(
+	    xmlXPathNodeSetMerge(NULL, nodelist)));
+	if (key != NULL)
+	    xmlFree(key);
+    }    
+
+    if (obj1 != NULL)
+	xmlXPathFreeObject(obj1);
+    if (obj2 != NULL)
+	xmlXPathFreeObject(obj2);    
+}
+
+/**
+ * xsltUnparsedEntityURIFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the unparsed-entity-uri() XSLT function
+ *   string unparsed-entity-uri(string)
+ */
+void
+xsltUnparsedEntityURIFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xmlXPathObjectPtr obj;
+    xmlChar *str;
+
+    if ((nargs != 1) || (ctxt->value == NULL)) {
+        xsltGenericError(xsltGenericErrorContext,
+		"unparsed-entity-uri() : expects one string arg\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    obj = valuePop(ctxt);
+    if (obj->type != XPATH_STRING) {
+	obj = xmlXPathConvertString(obj);
+    }
+
+    str = obj->stringval;
+    if (str == NULL) {
+	valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+    } else {
+	xmlEntityPtr entity;
+
+	entity = xmlGetDocEntity(ctxt->context->doc, str);
+	if (entity == NULL) {
+	    valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+	} else {
+	    if (entity->URI != NULL)
+		valuePush(ctxt, xmlXPathNewString(entity->URI));
+	    else
+		valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+	}
+    }
+    xmlXPathFreeObject(obj);
+}
+
+/**
+ * xsltFormatNumberFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the format-number() XSLT function
+ *   string format-number(number, string, string?)
+ */
+void
+xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
+{
+    xmlXPathObjectPtr numberObj = NULL;
+    xmlXPathObjectPtr formatObj = NULL;
+    xmlXPathObjectPtr decimalObj = NULL;
+    xsltStylesheetPtr sheet;
+    xsltDecimalFormatPtr formatValues;
+    xmlChar *result;
+    xsltTransformContextPtr tctxt;
+
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL)
+	return;
+    sheet = tctxt->style;
+    if (sheet == NULL)
+	return;
+    formatValues = sheet->decimalFormat;
+    
+    switch (nargs) {
+    case 3:
+	CAST_TO_STRING;
+	decimalObj = valuePop(ctxt);
+	formatValues = xsltDecimalFormatGetByName(sheet, decimalObj->stringval);
+	if (formatValues == NULL) {
+	    xsltTransformError(tctxt, NULL, NULL,
+		    "format-number() : undeclared decimal format '%s'\n", 
+		    decimalObj->stringval);
+	}
+	/* Intentional fall-through */
+    case 2:
+	CAST_TO_STRING;
+	formatObj = valuePop(ctxt);
+	CAST_TO_NUMBER;
+	numberObj = valuePop(ctxt);
+	break;
+    default:
+	XP_ERROR(XPATH_INVALID_ARITY);
+    }
+
+    if (formatValues != NULL) {
+	if (xsltFormatNumberConversion(formatValues,
+				       formatObj->stringval,
+				       numberObj->floatval,
+				       &result) == XPATH_EXPRESSION_OK) {
+	    valuePush(ctxt, xmlXPathNewString(result));
+	    xmlFree(result);
+	}
+    }
+
+    xmlXPathFreeObject(numberObj);
+    xmlXPathFreeObject(formatObj);
+    xmlXPathFreeObject(decimalObj);
+}
+
+/**
+ * xsltGenerateIdFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the generate-id() XSLT function
+ *   string generate-id(node-set?)
+ */
+void
+xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xmlNodePtr cur = NULL;
+    unsigned long val;
+    xmlChar str[20];
+
+    if (nargs == 0) {
+	cur = ctxt->context->node;
+    } else if (nargs == 1) {
+	xmlXPathObjectPtr obj;
+	xmlNodeSetPtr nodelist;
+	int i, ret;
+
+	if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) {
+	    ctxt->error = XPATH_INVALID_TYPE;
+	    xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"generate-id() : invalid arg expecting a node-set\n");
+	    return;
+	}
+	obj = valuePop(ctxt);
+	nodelist = obj->nodesetval;
+	if ((nodelist == NULL) || (nodelist->nodeNr <= 0)) {
+	    xmlXPathFreeObject(obj);
+	    valuePush(ctxt, xmlXPathNewCString(""));
+	    return;
+	}
+	cur = nodelist->nodeTab[0];
+	for (i = 1;i < nodelist->nodeNr;i++) {
+	    ret = xmlXPathCmpNodes(cur, nodelist->nodeTab[i]);
+	    if (ret == -1)
+	        cur = nodelist->nodeTab[i];
+	}
+	xmlXPathFreeObject(obj);
+    } else {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"generate-id() : invalid number of args %d\n", nargs);
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    /*
+     * Okay this is ugly but should work, use the NodePtr address
+     * to forge the ID
+     */
+    val = (unsigned long)((char *)cur - (char *)0);
+    val /= sizeof(xmlNode);
+    sprintf((char *)str, "id%ld", val);
+    valuePush(ctxt, xmlXPathNewString(str));
+}
+
+/**
+ * xsltSystemPropertyFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the system-property() XSLT function
+ *   object system-property(string)
+ */
+void
+xsltSystemPropertyFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xmlXPathObjectPtr obj;
+    xmlChar *prefix, *name;
+    const xmlChar *nsURI = NULL;
+
+    if (nargs != 1) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"system-property() : expects one string arg\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	    "system-property() : invalid arg expecting a string\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	return;
+    }
+    obj = valuePop(ctxt);
+    if (obj->stringval == NULL) {
+	valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+    } else {
+	name = xmlSplitQName2(obj->stringval, &prefix);
+	if (name == NULL) {
+	    name = xmlStrdup(obj->stringval);
+	} else {
+	    nsURI = xmlXPathNsLookup(ctxt->context, prefix);
+	    if (nsURI == NULL) {
+		xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		    "system-property() : prefix %s is not bound\n", prefix);
+	    }
+	}
+
+	if (xmlStrEqual(nsURI, XSLT_NAMESPACE)) {
+#ifdef DOCBOOK_XSL_HACK
+	    if (xmlStrEqual(name, (const xmlChar *)"vendor")) {
+		xsltStylesheetPtr sheet;
+		xsltTransformContextPtr tctxt;
+
+		tctxt = xsltXPathGetTransformContext(ctxt);
+		if ((tctxt != NULL) && (tctxt->inst != NULL) &&
+		    (xmlStrEqual(tctxt->inst->name, BAD_CAST "variable")) &&
+		    (tctxt->inst->parent != NULL) &&
+		    (xmlStrEqual(tctxt->inst->parent->name,
+				 BAD_CAST "template")))
+		    sheet = tctxt->style;
+		else
+		    sheet = NULL;
+		if ((sheet != NULL) && (sheet->doc != NULL) &&
+		    (sheet->doc->URL != NULL) &&
+		    (xmlStrstr(sheet->doc->URL,
+			       (const xmlChar *)"chunk") != NULL)) {
+		    valuePush(ctxt, xmlXPathNewString(
+			(const xmlChar *)"libxslt (SAXON 6.2 compatible)"));
+
+		} else {
+		    valuePush(ctxt, xmlXPathNewString(
+			(const xmlChar *)XSLT_DEFAULT_VENDOR));
+		}
+	    } else
+#else
+	    if (xmlStrEqual(name, (const xmlChar *)"vendor")) {
+		valuePush(ctxt, xmlXPathNewString(
+			  (const xmlChar *)XSLT_DEFAULT_VENDOR));
+	    } else
+#endif
+	    if (xmlStrEqual(name, (const xmlChar *)"version")) {
+		valuePush(ctxt, xmlXPathNewString(
+		    (const xmlChar *)XSLT_DEFAULT_VERSION));
+	    } else if (xmlStrEqual(name, (const xmlChar *)"vendor-url")) {
+		valuePush(ctxt, xmlXPathNewString(
+		    (const xmlChar *)XSLT_DEFAULT_URL));
+	    } else {
+		valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
+	    }
+	}
+	if (name != NULL)
+	    xmlFree(name);
+	if (prefix != NULL)
+	    xmlFree(prefix);
+    }
+    xmlXPathFreeObject(obj);
+}
+
+/**
+ * xsltElementAvailableFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the element-available() XSLT function
+ *   boolean element-available(string)
+ */
+void
+xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xmlXPathObjectPtr obj;
+    xmlChar *prefix, *name;
+    const xmlChar *nsURI = NULL;
+    xsltTransformContextPtr tctxt;
+
+    if (nargs != 1) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"element-available() : expects one string arg\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	    "element-available() : invalid arg expecting a string\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	return;
+    }
+    obj = valuePop(ctxt);
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"element-available() : internal error tctxt == NULL\n");
+	xmlXPathFreeObject(obj);
+	valuePush(ctxt, xmlXPathNewBoolean(0));
+	return;
+    }
+
+
+    name = xmlSplitQName2(obj->stringval, &prefix);
+    if (name == NULL) {
+	xmlNsPtr ns;
+
+	name = xmlStrdup(obj->stringval);
+	ns = xmlSearchNs(tctxt->inst->doc, tctxt->inst, NULL);
+	if (ns != NULL) nsURI = xmlStrdup(ns->href);
+    } else {
+	nsURI = xmlXPathNsLookup(ctxt->context, prefix);
+	if (nsURI == NULL) {
+	    xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"element-available() : prefix %s is not bound\n", prefix);
+	}
+    }
+
+    if (xsltExtElementLookup(tctxt, name, nsURI) != NULL) {
+	valuePush(ctxt, xmlXPathNewBoolean(1));
+    } else {
+	valuePush(ctxt, xmlXPathNewBoolean(0));
+    }
+
+    xmlXPathFreeObject(obj);
+    if (name != NULL)
+	xmlFree(name);
+    if (prefix != NULL)
+	xmlFree(prefix);
+}
+
+/**
+ * xsltFunctionAvailableFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the function-available() XSLT function
+ *   boolean function-available(string)
+ */
+void
+xsltFunctionAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xmlXPathObjectPtr obj;
+    xmlChar *prefix, *name;
+    const xmlChar *nsURI = NULL;
+
+    if (nargs != 1) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"function-available() : expects one string arg\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+	    "function-available() : invalid arg expecting a string\n");
+	ctxt->error = XPATH_INVALID_TYPE;
+	return;
+    }
+    obj = valuePop(ctxt);
+
+    name = xmlSplitQName2(obj->stringval, &prefix);
+    if (name == NULL) {
+	name = xmlStrdup(obj->stringval);
+    } else {
+	nsURI = xmlXPathNsLookup(ctxt->context, prefix);
+	if (nsURI == NULL) {
+	    xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"function-available() : prefix %s is not bound\n", prefix);
+	}
+    }
+
+    if (xmlXPathFunctionLookupNS(ctxt->context, name, nsURI) != NULL) {
+	valuePush(ctxt, xmlXPathNewBoolean(1));
+    } else {
+	valuePush(ctxt, xmlXPathNewBoolean(0));
+    }
+
+    xmlXPathFreeObject(obj);
+    if (name != NULL)
+	xmlFree(name);
+    if (prefix != NULL)
+	xmlFree(prefix);
+}
+
+/**
+ * xsltCurrentFunction:
+ * @ctxt:  the XPath Parser context
+ * @nargs:  the number of arguments
+ *
+ * Implement the current() XSLT function
+ *   node-set current()
+ */
+static void
+xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){
+    xsltTransformContextPtr tctxt;
+
+    if (nargs != 0) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"current() : function uses no argument\n");
+	ctxt->error = XPATH_INVALID_ARITY;
+	return;
+    }
+    tctxt = xsltXPathGetTransformContext(ctxt);
+    if (tctxt == NULL) {
+	xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+		"current() : internal error tctxt == NULL\n");
+	valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+    } else {
+	valuePush(ctxt, xmlXPathNewNodeSet(tctxt->node)); /* current */
+    }
+}
+
+/************************************************************************
+ * 									*
+ * 		Registration of XSLT and libxslt functions		*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltRegisterAllFunctions:
+ * @ctxt:  the XPath context
+ *
+ * Registers all default XSLT functions in this context
+ */
+void
+xsltRegisterAllFunctions(xmlXPathContextPtr ctxt)
+{
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "current",
+                         xsltCurrentFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "document",
+                         xsltDocumentFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "key", xsltKeyFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "unparsed-entity-uri",
+                         xsltUnparsedEntityURIFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "format-number",
+                         xsltFormatNumberFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "generate-id",
+                         xsltGenerateIdFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "system-property",
+                         xsltSystemPropertyFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "element-available",
+                         xsltElementAvailableFunction);
+    xmlXPathRegisterFunc(ctxt, (const xmlChar *) "function-available",
+                         xsltFunctionAvailableFunction);
+}
diff --git a/third_party/libxslt/libxslt/functions.h b/third_party/libxslt/libxslt/functions.h
new file mode 100644
index 0000000..caa4941c
--- /dev/null
+++ b/third_party/libxslt/libxslt/functions.h
@@ -0,0 +1,78 @@
+/*
+ * Summary: interface for the XSLT functions not from XPath
+ * Description: a set of extra functions coming from XSLT but not in XPath
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard and Bjorn Reese 
+ */
+
+#ifndef __XML_XSLT_FUNCTIONS_H__
+#define __XML_XSLT_FUNCTIONS_H__
+
+#include 
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XSLT_REGISTER_FUNCTION_LOOKUP:
+ *
+ * Registering macro, not general purpose at all but used in different modules.
+ */
+#define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt)			\
+    xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt,		\
+	(xmlXPathFuncLookupFunc) xsltXPathFunctionLookup,	\
+	(void *)(ctxt->xpathCtxt));
+
+XSLTPUBFUN xmlXPathFunction XSLTCALL
+	xsltXPathFunctionLookup		(xmlXPathContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *ns_uri);
+
+/*
+ * Interfaces for the functions implementations.
+ */
+
+XSLTPUBFUN void XSLTCALL	
+	xsltDocumentFunction		(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltKeyFunction			(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltUnparsedEntityURIFunction	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltFormatNumberFunction	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltGenerateIdFunction		(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltSystemPropertyFunction	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltElementAvailableFunction	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+XSLTPUBFUN void XSLTCALL	
+	xsltFunctionAvailableFunction	(xmlXPathParserContextPtr ctxt,
+					 int nargs);
+
+/*
+ * And the registration
+ */
+
+XSLTPUBFUN void XSLTCALL	
+	xsltRegisterAllFunctions	(xmlXPathContextPtr ctxt);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_FUNCTIONS_H__ */
+
diff --git a/third_party/libxslt/libxslt/imports.c b/third_party/libxslt/libxslt/imports.c
new file mode 100644
index 0000000..8ff9f3d
--- /dev/null
+++ b/third_party/libxslt/libxslt/imports.c
@@ -0,0 +1,414 @@
+/*
+ * imports.c: Implementation of the XSLT imports
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#ifdef HAVE_SYS_TYPES_H
+#include 
+#endif
+#ifdef HAVE_MATH_H
+#include 
+#endif
+#ifdef HAVE_FLOAT_H
+#include 
+#endif
+#ifdef HAVE_IEEEFP_H
+#include 
+#endif
+#ifdef HAVE_NAN_H
+#include 
+#endif
+#ifdef HAVE_CTYPE_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "preproc.h"
+#include "imports.h"
+#include "documents.h"
+#include "security.h"
+#include "pattern.h"
+
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+/**
+ * xsltFixImportedCompSteps:
+ * @master: the "master" stylesheet
+ * @style: the stylesheet being imported by the master
+ *
+ * normalize the comp steps for the stylesheet being imported
+ * by the master, together with any imports within that. 
+ *
+ */
+static void xsltFixImportedCompSteps(xsltStylesheetPtr master, 
+			xsltStylesheetPtr style) {
+    xsltStylesheetPtr res;
+    xmlHashScan(style->templatesHash,
+	            (xmlHashScanner) xsltNormalizeCompSteps, master);
+    master->extrasNr += style->extrasNr;
+    for (res = style->imports; res != NULL; res = res->next) {
+        xsltFixImportedCompSteps(master, res);
+    }
+}
+
+/**
+ * xsltParseStylesheetImport:
+ * @style:  the XSLT stylesheet
+ * @cur:  the import element
+ *
+ * parse an XSLT stylesheet import element
+ *
+ * Returns 0 in case of success -1 in case of failure.
+ */
+
+int
+xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
+    int ret = -1;
+    xmlDocPtr import = NULL;
+    xmlChar *base = NULL;
+    xmlChar *uriRef = NULL;
+    xmlChar *URI = NULL;
+    xsltStylesheetPtr res;
+    xsltSecurityPrefsPtr sec;
+
+    if ((cur == NULL) || (style == NULL))
+	return (ret);
+
+    uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", NULL);
+    if (uriRef == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:import : missing href attribute\n");
+	goto error;
+    }
+
+    base = xmlNodeGetBase(style->doc, cur);
+    URI = xmlBuildURI(uriRef, base);
+    if (URI == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:import : invalid URI reference %s\n", uriRef);
+	goto error;
+    }
+
+    res = style;
+    while (res != NULL) {
+        if (res->doc == NULL)
+	    break;
+	if (xmlStrEqual(res->doc->URL, URI)) {
+	    xsltTransformError(NULL, style, cur,
+	       "xsl:import : recursion detected on imported URL %s\n", URI);
+	    goto error;
+	}
+	res = res->parent;
+    }
+
+    /*
+     * Security framework check
+     */
+    sec = xsltGetDefaultSecurityPrefs();
+    if (sec != NULL) {
+	int secres;
+
+	secres = xsltCheckRead(sec, NULL, URI);
+	if (secres == 0) {
+	    xsltTransformError(NULL, NULL, NULL,
+		 "xsl:import: read rights for %s denied\n",
+			     URI);
+	    goto error;
+	}
+    }
+
+    import = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS,
+                                  (void *) style, XSLT_LOAD_STYLESHEET);
+    if (import == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:import : unable to load %s\n", URI);
+	goto error;
+    }
+
+    res = xsltParseStylesheetImportedDoc(import, style);
+    if (res != NULL) {
+	res->next = style->imports;
+	style->imports = res;
+	if (style->parent == NULL) {
+	    xsltFixImportedCompSteps(style, res);
+	}
+	ret = 0;
+    } else {
+	xmlFreeDoc(import);
+	}
+
+error:
+    if (uriRef != NULL)
+	xmlFree(uriRef);
+    if (base != NULL)
+	xmlFree(base);
+    if (URI != NULL)
+	xmlFree(URI);
+
+    return (ret);
+}
+
+/**
+ * xsltParseStylesheetInclude:
+ * @style:  the XSLT stylesheet
+ * @cur:  the include node
+ *
+ * parse an XSLT stylesheet include element
+ *
+ * Returns 0 in case of success -1 in case of failure
+ */
+
+int
+xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) {
+    int ret = -1;
+    xmlDocPtr oldDoc;
+    xmlChar *base = NULL;
+    xmlChar *uriRef = NULL;
+    xmlChar *URI = NULL;
+    xsltStylesheetPtr result;
+    xsltDocumentPtr include;
+    xsltDocumentPtr docptr;
+    int oldNopreproc;
+
+    if ((cur == NULL) || (style == NULL))
+	return (ret);
+
+    uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", NULL);
+    if (uriRef == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:include : missing href attribute\n");
+	goto error;
+    }
+
+    base = xmlNodeGetBase(style->doc, cur);
+    URI = xmlBuildURI(uriRef, base);
+    if (URI == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:include : invalid URI reference %s\n", uriRef);
+	goto error;
+    }
+
+    /*
+     * in order to detect recursion, we check all previously included
+     * stylesheets.
+     */
+    docptr = style->includes;
+    while (docptr != NULL) {
+        if (xmlStrEqual(docptr->doc->URL, URI)) {
+	    xsltTransformError(NULL, style, cur,
+	        "xsl:include : recursion detected on included URL %s\n", URI);
+	    goto error;
+	}
+	docptr = docptr->includes;
+    }
+
+    include = xsltLoadStyleDocument(style, URI);
+    if (include == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:include : unable to load %s\n", URI);
+	goto error;
+    }
+#ifdef XSLT_REFACTORED    
+    if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) {
+	((xsltStyleItemIncludePtr) cur->psvi)->include = include;
+    } else {
+	xsltTransformError(NULL, style, cur,
+	    "Internal error: (xsltParseStylesheetInclude) "
+	    "The xsl:include element was not compiled.\n", URI);
+	style->errors++;
+    }
+#endif
+    oldDoc = style->doc;
+    style->doc = include->doc;
+    /* chain to stylesheet for recursion checking */
+    include->includes = style->includes;
+    style->includes = include;
+    oldNopreproc = style->nopreproc;
+    style->nopreproc = include->preproc;
+    /*
+    * TODO: This will change some values of the
+    *  including stylesheet with every included module
+    *  (e.g. excluded-result-prefixes)
+    *  We need to strictly seperate such stylesheet-owned values.
+    */
+    result = xsltParseStylesheetProcess(style, include->doc);
+    style->nopreproc = oldNopreproc;
+    include->preproc = 1;
+    style->includes = include->includes;
+    style->doc = oldDoc;
+    if (result == NULL) {
+	ret = -1;
+	goto error;
+    }
+    ret = 0;
+
+error:
+    if (uriRef != NULL)
+	xmlFree(uriRef);
+    if (base != NULL)
+	xmlFree(base);
+    if (URI != NULL)
+	xmlFree(URI);
+
+    return (ret);
+}
+
+/**
+ * xsltNextImport:
+ * @cur:  the current XSLT stylesheet
+ *
+ * Find the next stylesheet in import precedence.
+ *
+ * Returns the next stylesheet or NULL if it was the last one
+ */
+
+xsltStylesheetPtr
+xsltNextImport(xsltStylesheetPtr cur) {
+    if (cur == NULL)
+	return(NULL);
+    if (cur->imports != NULL)
+	return(cur->imports);
+    if (cur->next != NULL)
+	return(cur->next) ;
+    do {
+	cur = cur->parent;
+	if (cur == NULL) break;
+	if (cur->next != NULL) return(cur->next);
+    } while (cur != NULL);
+    return(cur);
+}
+
+/**
+ * xsltNeedElemSpaceHandling:
+ * @ctxt:  an XSLT transformation context
+ *
+ * Checks whether that stylesheet requires white-space stripping
+ *
+ * Returns 1 if space should be stripped, 0 if not
+ */
+
+int
+xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt) {
+    xsltStylesheetPtr style;
+
+    if (ctxt == NULL)
+	return(0);
+    style = ctxt->style;
+    while (style != NULL) {
+	if (style->stripSpaces != NULL)
+	    return(1);
+	style = xsltNextImport(style);
+    }
+    return(0);
+}
+
+/**
+ * xsltFindElemSpaceHandling:
+ * @ctxt:  an XSLT transformation context
+ * @node:  an XML node
+ *
+ * Find strip-space or preserve-space informations for an element
+ * respect the import precedence or the wildcards
+ *
+ * Returns 1 if space should be stripped, 0 if not, and 2 if everything
+ *         should be CDTATA wrapped.
+ */
+
+int
+xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) {
+    xsltStylesheetPtr style;
+    const xmlChar *val;
+
+    if ((ctxt == NULL) || (node == NULL))
+	return(0);
+    style = ctxt->style;
+    while (style != NULL) {
+	if (node->ns != NULL) {
+	    val = (const xmlChar *)
+	      xmlHashLookup2(style->stripSpaces, node->name, node->ns->href);
+	} else {
+	    val = (const xmlChar *)
+		  xmlHashLookup2(style->stripSpaces, node->name, NULL);
+	}
+	if (val != NULL) {
+	    if (xmlStrEqual(val, (xmlChar *) "strip"))
+		return(1);
+	    if (xmlStrEqual(val, (xmlChar *) "preserve"))
+		return(0);
+	} 
+	if (style->stripAll == 1)
+	    return(1);
+	if (style->stripAll == -1)
+	    return(0);
+
+	style = xsltNextImport(style);
+    }
+    return(0);
+}
+
+/**
+ * xsltFindTemplate:
+ * @ctxt:  an XSLT transformation context
+ * @name: the template name
+ * @nameURI: the template name URI
+ *
+ * Finds the named template, apply import precedence rule.
+ * REVISIT TODO: We'll change the nameURI fields of
+ *  templates to be in the string dict, so if the
+ *  specified @nameURI is in the same dict, then use pointer
+ *  comparison. Check if this can be done in a sane way.
+ *  Maybe this function is not needed internally at
+ *  transformation-time if we hard-wire the called templates
+ *  to the caller.
+ *
+ * Returns the xsltTemplatePtr or NULL if not found
+ */
+xsltTemplatePtr
+xsltFindTemplate(xsltTransformContextPtr ctxt, const xmlChar *name,
+	         const xmlChar *nameURI) {
+    xsltTemplatePtr cur;
+    xsltStylesheetPtr style;
+
+    if ((ctxt == NULL) || (name == NULL))
+	return(NULL);
+    style = ctxt->style;
+    while (style != NULL) {
+	cur = style->templates;
+	while (cur != NULL) {
+	    if (xmlStrEqual(name, cur->name)) {
+		if (((nameURI == NULL) && (cur->nameURI == NULL)) ||
+		    ((nameURI != NULL) && (cur->nameURI != NULL) &&
+		     (xmlStrEqual(nameURI, cur->nameURI)))) {
+		    return(cur);
+		}
+	    }
+	    cur = cur->next;
+	}
+
+	style = xsltNextImport(style);
+    }
+    return(NULL);
+}
+
diff --git a/third_party/libxslt/libxslt/imports.h b/third_party/libxslt/libxslt/imports.h
new file mode 100644
index 0000000..38656f1
--- /dev/null
+++ b/third_party/libxslt/libxslt/imports.h
@@ -0,0 +1,75 @@
+/*
+ * Summary: interface for the XSLT import support
+ * Description: macros and fuctions needed to implement and
+ *              access the import tree
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_IMPORTS_H__
+#define __XML_XSLT_IMPORTS_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XSLT_GET_IMPORT_PTR:
+ *
+ * A macro to import pointers from the stylesheet cascading order.
+ */
+#define XSLT_GET_IMPORT_PTR(res, style, name) {			\
+    xsltStylesheetPtr st = style;				\
+    res = NULL;							\
+    while (st != NULL) {					\
+	if (st->name != NULL) { res = st->name; break; }	\
+	st = xsltNextImport(st);				\
+    }}
+
+/**
+ * XSLT_GET_IMPORT_INT:
+ *
+ * A macro to import intergers from the stylesheet cascading order.
+ */
+#define XSLT_GET_IMPORT_INT(res, style, name) {			\
+    xsltStylesheetPtr st = style;				\
+    res = -1;							\
+    while (st != NULL) {					\
+	if (st->name != -1) { res = st->name; break; }	\
+	st = xsltNextImport(st);				\
+    }}
+
+/*
+ * Module interfaces
+ */
+XSLTPUBFUN int XSLTCALL			
+			xsltParseStylesheetImport(xsltStylesheetPtr style,
+						  xmlNodePtr cur);
+XSLTPUBFUN int XSLTCALL			
+			xsltParseStylesheetInclude
+						 (xsltStylesheetPtr style,
+						  xmlNodePtr cur);
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltNextImport		 (xsltStylesheetPtr style);
+XSLTPUBFUN int XSLTCALL			
+			xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt);
+XSLTPUBFUN int XSLTCALL			
+			xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt,
+						  xmlNodePtr node);
+XSLTPUBFUN xsltTemplatePtr XSLTCALL		
+			xsltFindTemplate	 (xsltTransformContextPtr ctxt,
+						  const xmlChar *name,
+						  const xmlChar *nameURI);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_IMPORTS_H__ */
+
diff --git a/third_party/libxslt/libxslt/keys.c b/third_party/libxslt/libxslt/keys.c
new file mode 100644
index 0000000..9e4cdfe
--- /dev/null
+++ b/third_party/libxslt/libxslt/keys.c
@@ -0,0 +1,916 @@
+/*
+ * keys.c: Implemetation of the keys support
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "imports.h"
+#include "templates.h"
+#include "keys.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_KEYS
+#endif
+
+static int
+xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name,
+                    const xmlChar *nameURI);
+
+/************************************************************************
+ * 									*
+ * 			Type functions 					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltNewKeyDef:
+ * @name:  the key name or NULL
+ * @nameURI:  the name URI or NULL
+ *
+ * Create a new XSLT KeyDef
+ *
+ * Returns the newly allocated xsltKeyDefPtr or NULL in case of error
+ */
+static xsltKeyDefPtr
+xsltNewKeyDef(const xmlChar *name, const xmlChar *nameURI) {
+    xsltKeyDefPtr cur;
+
+    cur = (xsltKeyDefPtr) xmlMalloc(sizeof(xsltKeyDef));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewKeyDef : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltKeyDef));
+    if (name != NULL)
+	cur->name = xmlStrdup(name);
+    if (nameURI != NULL)
+	cur->nameURI = xmlStrdup(nameURI);
+    cur->nsList = NULL;
+    return(cur);
+}
+
+/**
+ * xsltFreeKeyDef:
+ * @keyd:  an XSLT key definition
+ *
+ * Free up the memory allocated by @keyd
+ */
+static void
+xsltFreeKeyDef(xsltKeyDefPtr keyd) {
+    if (keyd == NULL)
+	return;
+    if (keyd->comp != NULL)
+	xmlXPathFreeCompExpr(keyd->comp);
+    if (keyd->usecomp != NULL)
+	xmlXPathFreeCompExpr(keyd->usecomp);
+    if (keyd->name != NULL)
+	xmlFree(keyd->name);
+    if (keyd->nameURI != NULL)
+	xmlFree(keyd->nameURI);
+    if (keyd->match != NULL)
+	xmlFree(keyd->match);
+    if (keyd->use != NULL)
+	xmlFree(keyd->use);
+    if (keyd->nsList != NULL)
+        xmlFree(keyd->nsList);
+    memset(keyd, -1, sizeof(xsltKeyDef));
+    xmlFree(keyd);
+}
+
+/**
+ * xsltFreeKeyDefList:
+ * @keyd:  an XSLT key definition list
+ *
+ * Free up the memory allocated by all the elements of @keyd
+ */
+static void
+xsltFreeKeyDefList(xsltKeyDefPtr keyd) {
+    xsltKeyDefPtr cur;
+
+    while (keyd != NULL) {
+	cur = keyd;
+	keyd = keyd->next;
+	xsltFreeKeyDef(cur);
+    }
+}
+
+/**
+ * xsltNewKeyTable:
+ * @name:  the key name or NULL
+ * @nameURI:  the name URI or NULL
+ *
+ * Create a new XSLT KeyTable
+ *
+ * Returns the newly allocated xsltKeyTablePtr or NULL in case of error
+ */
+static xsltKeyTablePtr
+xsltNewKeyTable(const xmlChar *name, const xmlChar *nameURI) {
+    xsltKeyTablePtr cur;
+
+    cur = (xsltKeyTablePtr) xmlMalloc(sizeof(xsltKeyTable));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewKeyTable : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltKeyTable));
+    if (name != NULL)
+	cur->name = xmlStrdup(name);
+    if (nameURI != NULL)
+	cur->nameURI = xmlStrdup(nameURI);
+    cur->keys = xmlHashCreate(0);
+    return(cur);
+}
+
+/**
+ * xsltFreeKeyTable:
+ * @keyt:  an XSLT key table
+ *
+ * Free up the memory allocated by @keyt
+ */
+static void
+xsltFreeKeyTable(xsltKeyTablePtr keyt) {
+    if (keyt == NULL)
+	return;
+    if (keyt->name != NULL)
+	xmlFree(keyt->name);
+    if (keyt->nameURI != NULL)
+	xmlFree(keyt->nameURI);
+    if (keyt->keys != NULL)
+	xmlHashFree(keyt->keys, 
+		    (xmlHashDeallocator) xmlXPathFreeNodeSet);
+    memset(keyt, -1, sizeof(xsltKeyTable));
+    xmlFree(keyt);
+}
+
+/**
+ * xsltFreeKeyTableList:
+ * @keyt:  an XSLT key table list
+ *
+ * Free up the memory allocated by all the elements of @keyt
+ */
+static void
+xsltFreeKeyTableList(xsltKeyTablePtr keyt) {
+    xsltKeyTablePtr cur;
+
+    while (keyt != NULL) {
+	cur = keyt;
+	keyt = keyt->next;
+	xsltFreeKeyTable(cur);
+    }
+}
+
+/************************************************************************
+ * 									*
+ * 		The interpreter for the precompiled patterns		*
+ * 									*
+ ************************************************************************/
+
+
+/**
+ * xsltFreeKeys:
+ * @style: an XSLT stylesheet
+ *
+ * Free up the memory used by XSLT keys in a stylesheet
+ */
+void
+xsltFreeKeys(xsltStylesheetPtr style) {
+    if (style->keys)
+	xsltFreeKeyDefList((xsltKeyDefPtr) style->keys);
+}
+
+/**
+ * skipString:
+ * @cur: the current pointer
+ * @end: the current offset
+ *
+ * skip a string delimited by " or '
+ *
+ * Returns the byte after the string or -1 in case of error
+ */
+static int
+skipString(const xmlChar *cur, int end) {
+    xmlChar limit;
+
+    if ((cur == NULL) || (end < 0)) return(-1);
+    if ((cur[end] == '\'') || (cur[end] == '"')) limit = cur[end];
+    else return(end);
+    end++;
+    while (cur[end] != 0) {
+        if (cur[end] == limit)
+	    return(end + 1);
+	end++;
+    }
+    return(-1);
+}
+
+/**
+ * skipPredicate:
+ * @cur: the current pointer
+ * @end: the current offset
+ *
+ * skip a predicate
+ *
+ * Returns the byte after the predicate or -1 in case of error
+ */
+static int
+skipPredicate(const xmlChar *cur, int end) {
+    if ((cur == NULL) || (end < 0)) return(-1);
+    if (cur[end] != '[') return(end);
+    end++;
+    while (cur[end] != 0) {
+        if ((cur[end] == '\'') || (cur[end] == '"')) {
+	    end = skipString(cur, end);
+	    if (end <= 0)
+	        return(-1);
+	    continue;
+	} else if (cur[end] == '[') {
+	    end = skipPredicate(cur, end);
+	    if (end <= 0)
+	        return(-1);
+	    continue;
+	} else if (cur[end] == ']')
+	    return(end + 1);
+	end++;
+    }
+    return(-1);
+}
+
+/**
+ * xsltAddKey:
+ * @style: an XSLT stylesheet
+ * @name:  the key name or NULL
+ * @nameURI:  the name URI or NULL
+ * @match:  the match value
+ * @use:  the use value
+ * @inst: the key instruction
+ *
+ * add a key definition to a stylesheet
+ *
+ * Returns 0 in case of success, and -1 in case of failure.
+ */
+int
+xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
+	   const xmlChar *nameURI, const xmlChar *match,
+	   const xmlChar *use, xmlNodePtr inst) {
+    xsltKeyDefPtr key;
+    xmlChar *pattern = NULL;
+    int current, end, start, i = 0;
+
+    if ((style == NULL) || (name == NULL) || (match == NULL) || (use == NULL))
+	return(-1);
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Add key %s, match %s, use %s\n", name, match, use);
+#endif
+
+    key = xsltNewKeyDef(name, nameURI);
+    key->match = xmlStrdup(match);
+    key->use = xmlStrdup(use);
+    key->inst = inst;
+    key->nsList = xmlGetNsList(inst->doc, inst);
+    if (key->nsList != NULL) {
+        while (key->nsList[i] != NULL)
+	    i++;
+    }
+    key->nsNr = i;
+
+    /*
+     * Split the | and register it as as many keys
+     */
+    current = end = 0;
+    while (match[current] != 0) {
+	start = current;
+	while (IS_BLANK_CH(match[current]))
+	    current++;
+	end = current;
+	while ((match[end] != 0) && (match[end] != '|')) {
+	    if (match[end] == '[') {
+	        end = skipPredicate(match, end);
+		if (end <= 0) {
+		    xsltTransformError(NULL, style, inst,
+		                       "key pattern is malformed: %s",
+				       key->match);
+		    if (style != NULL) style->errors++;
+		    goto error;
+		}
+	    } else
+		end++;
+	}
+	if (current == end) {
+	    xsltTransformError(NULL, style, inst,
+			       "key pattern is empty\n");
+	    if (style != NULL) style->errors++;
+	    goto error;
+	}
+	if (match[start] != '/') {
+	    pattern = xmlStrcat(pattern, (xmlChar *)"//");
+	    if (pattern == NULL) {
+		if (style != NULL) style->errors++;
+		goto error;
+	    }
+	}
+	pattern = xmlStrncat(pattern, &match[start], end - start);
+	if (pattern == NULL) {
+	    if (style != NULL) style->errors++;
+	    goto error;
+	}
+
+	if (match[end] == '|') {
+	    pattern = xmlStrcat(pattern, (xmlChar *)"|");
+	    end++;
+	}
+	current = end;
+    }
+#ifdef WITH_XSLT_DEBUG_KEYS
+    xsltGenericDebug(xsltGenericDebugContext,
+	"   resulting pattern %s\n", pattern);
+#endif
+    /*
+    * XSLT-1: "It is an error for the value of either the use
+    *  attribute or the match attribute to contain a
+    *  VariableReference."
+    * TODO: We should report a variable-reference at compile-time.
+    *   Maybe a search for "$", if it occurs outside of quotation
+    *   marks, could be sufficient.
+    */
+    key->comp = xsltXPathCompile(style, pattern);
+    if (key->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+		"xsl:key : XPath pattern compilation failed '%s'\n",
+		         pattern);
+	if (style != NULL) style->errors++;
+    }
+    key->usecomp = xsltXPathCompile(style, use);
+    if (key->usecomp == NULL) {
+	xsltTransformError(NULL, style, inst,
+		"xsl:key : XPath pattern compilation failed '%s'\n",
+		         use);
+	if (style != NULL) style->errors++;
+    }
+
+    /*
+     * Sometimes the stylesheet writer use the order to ease the
+     * resolution of keys when they are dependant, keep the provided
+     * order so add the new one at the end.
+     */
+    if (style->keys == NULL) {
+	style->keys = key;
+    } else {
+        xsltKeyDefPtr prev = style->keys;
+
+	while (prev->next != NULL)
+	    prev = prev->next;
+
+	prev->next = key;
+    }
+    key->next = NULL;
+
+error:
+    if (pattern != NULL)
+	xmlFree(pattern);
+    return(0);
+}
+
+/**
+ * xsltGetKey:
+ * @ctxt: an XSLT transformation context
+ * @name:  the key name or NULL
+ * @nameURI:  the name URI or NULL
+ * @value:  the key value to look for
+ *
+ * Looks up a key of the in current source doc (the document info
+ * on @ctxt->document). Computes the key if not already done
+ * for the current source doc.
+ *
+ * Returns the nodeset resulting from the query or NULL
+ */
+xmlNodeSetPtr
+xsltGetKey(xsltTransformContextPtr ctxt, const xmlChar *name,
+	   const xmlChar *nameURI, const xmlChar *value) {
+    xmlNodeSetPtr ret;
+    xsltKeyTablePtr table;
+    int init_table = 0;
+
+    if ((ctxt == NULL) || (name == NULL) || (value == NULL) ||
+	(ctxt->document == NULL))
+	return(NULL);
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Get key %s, value %s\n", name, value);
+#endif
+
+    /*
+     * keys are computed only on-demand on first key access for a document
+     */
+    if ((ctxt->document->nbKeysComputed < ctxt->nbKeys) &&
+        (ctxt->keyInitLevel == 0)) {
+        /*
+	 * If non-recursive behaviour, just try to initialize all keys
+	 */
+	if (xsltInitAllDocKeys(ctxt))
+	    return(NULL);
+    }
+
+retry:
+    table = (xsltKeyTablePtr) ctxt->document->keys;
+    while (table != NULL) {
+	if (((nameURI != NULL) == (table->nameURI != NULL)) &&
+	    xmlStrEqual(table->name, name) &&
+	    xmlStrEqual(table->nameURI, nameURI))
+	{
+	    ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value);
+	    return(ret);
+	}
+	table = table->next;
+    }
+
+    if ((ctxt->keyInitLevel != 0) && (init_table == 0)) {
+        /*
+	 * Apparently one key is recursive and this one is needed,
+	 * initialize just it, that time and retry
+	 */
+        xsltInitDocKeyTable(ctxt, name, nameURI);
+	init_table = 1;
+	goto retry;
+    }
+
+    return(NULL);
+}
+
+
+/**
+ * xsltInitDocKeyTable:
+ *
+ * INTERNAL ROUTINE ONLY
+ *
+ * Check if any keys on the current document need to be computed
+ */
+static int
+xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name,
+                    const xmlChar *nameURI)
+{
+    xsltStylesheetPtr style;
+    xsltKeyDefPtr keyd;
+    int found = 0;
+
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitDocKeyTable %s\n", name);
+#endif
+
+    style = ctxt->style;
+    while (style != NULL) {
+	keyd = (xsltKeyDefPtr) style->keys;
+	while (keyd != NULL) {
+	    if (((keyd->nameURI != NULL) ==
+		 (nameURI != NULL)) &&
+		xmlStrEqual(keyd->name, name) &&
+		xmlStrEqual(keyd->nameURI, nameURI))
+	    {
+		xsltInitCtxtKey(ctxt, ctxt->document, keyd);
+		if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
+		    return(0);
+		found = 1;
+	    }
+	    keyd = keyd->next;
+	}
+	style = xsltNextImport(style);
+    }
+    if (found == 0) {
+#ifdef WITH_XSLT_DEBUG_KEYS
+	XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltInitDocKeyTable: did not found %s\n", name));
+#endif
+	xsltTransformError(ctxt, NULL, keyd->inst,
+	    "Failed to find key definition for %s\n", name);
+	ctxt->state = XSLT_STATE_STOPPED;
+        return(-1);
+    }
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitDocKeyTable %s done\n", name);
+#endif
+    return(0);
+}
+
+/**
+ * xsltInitAllDocKeys:
+ *
+ * INTERNAL ROUTINE ONLY
+ *
+ * Check if any keys on the current document need to be computed
+ */
+int
+xsltInitAllDocKeys(xsltTransformContextPtr ctxt)
+{
+    xsltStylesheetPtr style;
+    xsltKeyDefPtr keyd;
+    xsltKeyTablePtr table;
+
+    if (ctxt == NULL)
+	return(-1);
+
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitAllDocKeys %d %d\n",
+        ctxt->document->nbKeysComputed, ctxt->nbKeys);
+#endif
+
+    if (ctxt->document->nbKeysComputed == ctxt->nbKeys)
+	return(0);
+
+
+    /*
+    * TODO: This could be further optimized
+    */
+    style = ctxt->style;
+    while (style) {
+	keyd = (xsltKeyDefPtr) style->keys;
+	while (keyd != NULL) {
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "Init key %s\n", keyd->name);
+#endif
+	    /*
+	    * Check if keys with this QName have been already
+	    * computed.
+	    */
+	    table = (xsltKeyTablePtr) ctxt->document->keys;
+	    while (table) {
+		if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) &&
+		    xmlStrEqual(keyd->name, table->name) &&
+		    xmlStrEqual(keyd->nameURI, table->nameURI))
+		{
+		    break;
+		}
+		table = table->next;
+	    }
+	    if (table == NULL) {
+		/*
+		* Keys with this QName have not been yet computed.
+		*/
+		xsltInitDocKeyTable(ctxt, keyd->name, keyd->nameURI);
+	    }
+	    keyd = keyd->next;
+	}
+	style = xsltNextImport(style);
+    }
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitAllDocKeys: done\n");
+#endif
+    return(0);
+}
+
+/**
+ * xsltInitCtxtKey:
+ * @ctxt: an XSLT transformation context
+ * @idoc:  the document information (holds key values)
+ * @keyDef: the key definition
+ *
+ * Computes the key tables this key and for the current input document.
+ *
+ * Returns: 0 on success, -1 on error
+ */
+int
+xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc,
+	        xsltKeyDefPtr keyDef)
+{
+    int i, len, k;
+    xmlNodeSetPtr matchList = NULL, keylist;
+    xmlXPathObjectPtr matchRes = NULL, useRes = NULL;
+    xmlChar *str = NULL;
+    xsltKeyTablePtr table;
+    xmlNodePtr oldInst, cur;
+    xmlNodePtr oldContextNode;
+    xsltDocumentPtr oldDocInfo;
+    int	oldXPPos, oldXPSize;
+    xmlDocPtr oldXPDoc;
+    int oldXPNsNr;
+    xmlNsPtr *oldXPNamespaces;
+    xmlXPathContextPtr xpctxt;
+
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitCtxtKey %s : %d\n", keyDef->name, ctxt->keyInitLevel);
+#endif
+
+    if ((keyDef->comp == NULL) || (keyDef->usecomp == NULL))
+	return(-1);
+
+    /*
+     * Detect recursive keys
+     */
+    if (ctxt->keyInitLevel > ctxt->nbKeys) {
+#ifdef WITH_XSLT_DEBUG_KEYS
+	XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,
+	           xsltGenericDebug(xsltGenericDebugContext,
+		       "xsltInitCtxtKey: key definition of %s is recursive\n",
+		       keyDef->name));
+#endif
+	xsltTransformError(ctxt, NULL, keyDef->inst,
+	    "Key definition for %s is recursive\n", keyDef->name);
+	ctxt->state = XSLT_STATE_STOPPED;
+        return(-1);
+    }
+    ctxt->keyInitLevel++;
+
+    xpctxt = ctxt->xpathCtxt;
+    idoc->nbKeysComputed++;
+    /*
+    * Save context state.
+    */
+    oldInst = ctxt->inst;
+    oldDocInfo = ctxt->document;
+    oldContextNode = ctxt->node;
+
+    oldXPDoc = xpctxt->doc;
+    oldXPPos = xpctxt->proximityPosition;
+    oldXPSize = xpctxt->contextSize;
+    oldXPNsNr = xpctxt->nsNr;
+    oldXPNamespaces = xpctxt->namespaces;
+
+    /*
+    * Set up contexts.
+    */
+    ctxt->document = idoc;
+    ctxt->node = (xmlNodePtr) idoc->doc;
+    ctxt->inst = keyDef->inst;
+
+    xpctxt->doc = idoc->doc;
+    xpctxt->node = (xmlNodePtr) idoc->doc;
+    /* TODO : clarify the use of namespaces in keys evaluation */
+    xpctxt->namespaces = keyDef->nsList;
+    xpctxt->nsNr = keyDef->nsNr;
+
+    /*
+    * Evaluate the 'match' expression of the xsl:key.
+    * TODO: The 'match' is a *pattern*.
+    */
+    matchRes = xmlXPathCompiledEval(keyDef->comp, xpctxt);
+    if (matchRes == NULL) {
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+	XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltInitCtxtKey: %s evaluation failed\n", keyDef->match));
+#endif
+	xsltTransformError(ctxt, NULL, keyDef->inst,
+	    "Failed to evaluate the 'match' expression.\n");
+	ctxt->state = XSLT_STATE_STOPPED;
+	goto error;
+    } else {
+	if (matchRes->type == XPATH_NODESET) {
+	    matchList = matchRes->nodesetval;
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+	    if (matchList != NULL)
+		XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltInitCtxtKey: %s evaluates to %d nodes\n",
+				 keyDef->match, matchList->nodeNr));
+#endif
+	} else {
+	    /*
+	    * Is not a node set, but must be.
+	    */
+#ifdef WITH_XSLT_DEBUG_KEYS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltInitCtxtKey: %s is not a node set\n", keyDef->match));
+#endif
+	    xsltTransformError(ctxt, NULL, keyDef->inst,
+		"The 'match' expression did not evaluate to a node set.\n");
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    goto error;
+	}
+    }
+    if ((matchList == NULL) || (matchList->nodeNr <= 0))
+	goto exit;
+
+    /**
+     * Multiple key definitions for the same name are allowed, so
+     * we must check if the key is already present for this doc
+     */
+    table = (xsltKeyTablePtr) idoc->keys;
+    while (table != NULL) {
+        if (xmlStrEqual(table->name, keyDef->name) &&
+	    (((keyDef->nameURI == NULL) && (table->nameURI == NULL)) ||
+	     ((keyDef->nameURI != NULL) && (table->nameURI != NULL) &&
+	      (xmlStrEqual(table->nameURI, keyDef->nameURI)))))
+	    break;
+	table = table->next;
+    }
+    /**
+     * If the key was not previously defined, create it now and
+     * chain it to the list of keys for the doc
+     */
+    if (table == NULL) {
+        table = xsltNewKeyTable(keyDef->name, keyDef->nameURI);
+        if (table == NULL)
+	    goto error;
+        table->next = idoc->keys;
+        idoc->keys = table;
+    }
+
+    /*
+    * SPEC XSLT 1.0 (XSLT 2.0 does not clarify the context size!)
+    * "...the use attribute of the xsl:key element is evaluated with x as
+    "  the current node and with a node list containing just x as the
+    *  current node list"
+    */
+    xpctxt->contextSize = 1;
+    xpctxt->proximityPosition = 1;
+
+    for (i = 0; i < matchList->nodeNr; i++) {
+	cur = matchList->nodeTab[i];
+	if (! IS_XSLT_REAL_NODE(cur))
+	    continue;
+	xpctxt->node = cur;
+	/*
+	* Process the 'use' of the xsl:key.
+	* SPEC XSLT 1.0:
+	* "The use attribute is an expression specifying the values of
+	*  the key; the expression is evaluated once for each node that
+	*  matches the pattern."
+	*/
+	if (useRes != NULL)
+	    xmlXPathFreeObject(useRes);
+	useRes = xmlXPathCompiledEval(keyDef->usecomp, xpctxt);
+	if (useRes == NULL) {
+	    xsltTransformError(ctxt, NULL, keyDef->inst,
+		"Failed to evaluate the 'use' expression.\n");
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    break;
+	}
+	if (useRes->type == XPATH_NODESET) {
+	    if ((useRes->nodesetval != NULL) &&
+		(useRes->nodesetval->nodeNr != 0))
+	    {
+		len = useRes->nodesetval->nodeNr;
+		str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[0]);
+	    } else {
+		continue;
+	    }
+	} else {
+	    len = 1;
+	    if (useRes->type == XPATH_STRING) {
+		/*
+		* Consume the string value.
+		*/
+		str = useRes->stringval;
+		useRes->stringval = NULL;
+	    } else {
+		str = xmlXPathCastToString(useRes);
+	    }
+	}
+	/*
+	* Process all strings.
+	*/
+	k = 0;
+	while (1) {
+	    if (str == NULL)
+		goto next_string;
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext,
+		"xsl:key : node associated to ('%s', '%s')\n", keyDef->name, str));
+#endif
+
+	    keylist = xmlHashLookup(table->keys, str);
+	    if (keylist == NULL) {
+		keylist = xmlXPathNodeSetCreate(cur);
+		if (keylist == NULL)
+		    goto error;
+		xmlHashAddEntry(table->keys, str, keylist);
+	    } else {
+		/*
+		* TODO: How do we know if this function failed?
+		*/
+		xmlXPathNodeSetAdd(keylist, cur);
+	    }
+	    switch (cur->type) {
+		case XML_ELEMENT_NODE:
+		case XML_TEXT_NODE:
+		case XML_CDATA_SECTION_NODE:
+		case XML_PI_NODE:
+		case XML_COMMENT_NODE:
+		    cur->psvi = keyDef;
+		    break;
+		case XML_ATTRIBUTE_NODE:
+		    ((xmlAttrPtr) cur)->psvi = keyDef;
+		    break;
+		case XML_DOCUMENT_NODE:
+		case XML_HTML_DOCUMENT_NODE:
+		    ((xmlDocPtr) cur)->psvi = keyDef;
+		    break;
+		default:
+		    break;
+	    }
+	    xmlFree(str);
+	    str = NULL;
+
+next_string:
+	    k++;
+	    if (k >= len)
+		break;
+	    str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[k]);
+	}
+    }
+
+exit:
+error:
+    ctxt->keyInitLevel--;
+    /*
+    * Restore context state.
+    */
+    xpctxt->doc = oldXPDoc;
+    xpctxt->nsNr = oldXPNsNr;
+    xpctxt->namespaces = oldXPNamespaces;
+    xpctxt->proximityPosition = oldXPPos;
+    xpctxt->contextSize = oldXPSize;
+
+    ctxt->node = oldContextNode;
+    ctxt->document = oldDocInfo;
+    ctxt->inst = oldInst;
+
+    if (str)
+	xmlFree(str);
+    if (useRes != NULL)
+	xmlXPathFreeObject(useRes);
+    if (matchRes != NULL)
+	xmlXPathFreeObject(matchRes);
+    return(0);
+}
+
+/**
+ * xsltInitCtxtKeys:
+ * @ctxt:  an XSLT transformation context
+ * @idoc:  a document info
+ *
+ * Computes all the keys tables for the current input document.
+ * Should be done before global varibales are initialized.
+ * NOTE: Not used anymore in the refactored code.
+ */
+void
+xsltInitCtxtKeys(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc) {
+    xsltStylesheetPtr style;
+    xsltKeyDefPtr keyDef;
+
+    if ((ctxt == NULL) || (idoc == NULL))
+	return;
+
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitCtxtKeys on document\n");
+#endif
+
+#ifdef WITH_XSLT_DEBUG_KEYS
+    if ((idoc->doc != NULL) && (idoc->doc->URL != NULL))
+	XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, "Initializing keys on %s\n",
+		     idoc->doc->URL));
+#endif
+    style = ctxt->style;
+    while (style != NULL) {
+	keyDef = (xsltKeyDefPtr) style->keys;
+	while (keyDef != NULL) {
+	    xsltInitCtxtKey(ctxt, idoc, keyDef);
+
+	    keyDef = keyDef->next;
+	}
+
+	style = xsltNextImport(style);
+    }
+
+#ifdef KEY_INIT_DEBUG
+fprintf(stderr, "xsltInitCtxtKeys on document: done\n");
+#endif
+
+}
+
+/**
+ * xsltFreeDocumentKeys:
+ * @idoc: a XSLT document
+ *
+ * Free the keys associated to a document
+ */
+void
+xsltFreeDocumentKeys(xsltDocumentPtr idoc) {
+    if (idoc != NULL)
+        xsltFreeKeyTableList(idoc->keys);
+}
+
diff --git a/third_party/libxslt/libxslt/keys.h b/third_party/libxslt/libxslt/keys.h
new file mode 100644
index 0000000..9182baa
--- /dev/null
+++ b/third_party/libxslt/libxslt/keys.h
@@ -0,0 +1,53 @@
+/*
+ * Summary:  interface for the key matching used in key() and template matches.
+ * Description: implementation of the key mechanims.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_KEY_H__
+#define __XML_XSLT_KEY_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * NODE_IS_KEYED:
+ *
+ * check for bit 15 set
+ */
+#define NODE_IS_KEYED (1 >> 15)
+
+XSLTPUBFUN int XSLTCALL
+		xsltAddKey		(xsltStylesheetPtr style,
+					 const xmlChar *name,
+					 const xmlChar *nameURI,
+					 const xmlChar *match,
+					 const xmlChar *use,
+					 xmlNodePtr inst);
+XSLTPUBFUN xmlNodeSetPtr XSLTCALL	
+		xsltGetKey		(xsltTransformContextPtr ctxt,
+					 const xmlChar *name,
+					 const xmlChar *nameURI,
+					 const xmlChar *value);
+XSLTPUBFUN void XSLTCALL		
+		xsltInitCtxtKeys	(xsltTransformContextPtr ctxt,
+					 xsltDocumentPtr doc);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeKeys		(xsltStylesheetPtr style);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeDocumentKeys	(xsltDocumentPtr doc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_H__ */
+
diff --git a/third_party/libxslt/libxslt/libxslt.h b/third_party/libxslt/libxslt/libxslt.h
new file mode 100644
index 0000000..903f900
--- /dev/null
+++ b/third_party/libxslt/libxslt/libxslt.h
@@ -0,0 +1,30 @@
+/*
+ * Summary: internal header only used during the compilation of libxslt
+ * Description: internal header only used during the compilation of libxslt
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XSLT_LIBXSLT_H__
+#define __XSLT_LIBXSLT_H__
+
+#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__)
+#include 
+#else
+#include "config.h"
+#endif
+
+#include "xsltconfig.h"
+#include 
+
+#if !defined LIBXSLT_PUBLIC
+#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
+#define LIBXSLT_PUBLIC __declspec(dllimport)
+#else
+#define LIBXSLT_PUBLIC 
+#endif
+#endif
+
+#endif /* ! __XSLT_LIBXSLT_H__ */
diff --git a/third_party/libxslt/libxslt/namespaces.c b/third_party/libxslt/libxslt/namespaces.c
new file mode 100644
index 0000000..b147df8
--- /dev/null
+++ b/third_party/libxslt/libxslt/namespaces.c
@@ -0,0 +1,847 @@
+/*
+ * namespaces.c: Implementation of the XSLT namespaces handling
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#ifdef HAVE_SYS_TYPES_H
+#include 
+#endif
+#ifdef HAVE_MATH_H
+#include 
+#endif
+#ifdef HAVE_FLOAT_H
+#include 
+#endif
+#ifdef HAVE_IEEEFP_H
+#include 
+#endif
+#ifdef HAVE_NAN_H
+#include 
+#endif
+#ifdef HAVE_CTYPE_H
+#include 
+#endif
+#ifndef	XSLT_NEED_TRIO
+#include 
+#else
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "namespaces.h"
+#include "imports.h"
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+#ifdef XSLT_REFACTORED  
+static xsltNsAliasPtr
+xsltNewNsAlias(xsltCompilerCtxtPtr cctxt)
+{
+    xsltNsAliasPtr ret;
+
+    if (cctxt == NULL)
+	return(NULL);
+
+    ret = (xsltNsAliasPtr) xmlMalloc(sizeof(xsltNsAlias));
+    if (ret == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltNewNsAlias(): Memory allocation failed.\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltNsAlias));    
+    /*
+    * TODO: Store the item at current stylesheet-level.
+    */
+    ret->next = cctxt->nsAliases;
+    cctxt->nsAliases = ret;       
+
+    return(ret);
+}
+#endif /* XSLT_REFACTORED */
+/**
+ * xsltNamespaceAlias:
+ * @style:  the XSLT stylesheet
+ * @node:  the xsl:namespace-alias node
+ *
+ * Read the stylesheet-prefix and result-prefix attributes, register
+ * them as well as the corresponding namespace.
+ */
+void
+xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
+{
+    xmlChar *resultPrefix = NULL;
+    xmlChar *stylePrefix = NULL;
+    xmlNsPtr literalNs = NULL;
+    xmlNsPtr targetNs = NULL;
+ 
+#ifdef XSLT_REFACTORED 
+    xsltNsAliasPtr alias;
+
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    /*
+    * SPEC XSLT 1.0:
+    *  "If a namespace URI is declared to be an alias for multiple
+    *  different namespace URIs, then the declaration with the highest
+    *  import precedence is used. It is an error if there is more than
+    *  one such declaration. An XSLT processor may signal the error;
+    *  if it does not signal the error, it must recover by choosing,
+    *  from amongst the declarations with the highest import precedence,
+    *  the one that occurs last in the stylesheet."
+    *
+    * SPEC TODO: Check for the errors mentioned above.
+    */
+    /*
+    * NOTE that the XSLT 2.0 also *does* use the NULL namespace if
+    *  "#default" is used and there's no default namespace is scope.
+    *  I.e., this is *not* an error. 
+    *  Most XSLT 1.0 implementations work this way.
+    *  The XSLT 1.0 spec has nothing to say on the subject. 
+    */
+    /*
+    * Attribute "stylesheet-prefix".
+    */
+    stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
+    if (stylePrefix == NULL) {
+	xsltTransformError(NULL, style, node,
+	    "The attribute 'stylesheet-prefix' is missing.\n");
+	return;
+    }
+    if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default"))
+	literalNs = xmlSearchNs(node->doc, node, NULL);	
+    else {
+	literalNs = xmlSearchNs(node->doc, node, stylePrefix);
+	if (literalNs == NULL) {
+	    xsltTransformError(NULL, style, node,
+	        "Attribute 'stylesheet-prefix': There's no namespace "
+		"declaration in scope for the prefix '%s'.\n",
+		    stylePrefix);
+	    goto error;
+	}
+    }
+    /*
+    * Attribute "result-prefix".
+    */
+    resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
+    if (resultPrefix == NULL) {
+	xsltTransformError(NULL, style, node,
+	    "The attribute 'result-prefix' is missing.\n");
+	goto error;
+    }        
+    if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default"))
+	targetNs = xmlSearchNs(node->doc, node, NULL);
+    else {
+	targetNs = xmlSearchNs(node->doc, node, resultPrefix);
+
+        if (targetNs == NULL) {
+	   xsltTransformError(NULL, style, node,
+	        "Attribute 'result-prefix': There's no namespace "
+		"declaration in scope for the prefix '%s'.\n",
+		    stylePrefix);
+	    goto error;
+	}
+    }
+    /*
+     *
+     * Same alias for multiple different target namespace URIs:
+     *  TODO: The one with the highest import precedence is used.
+     *  Example:
+     *  
+     *
+     *  
+     *
+     * Same target namespace URI for multiple different aliases:
+     *  All alias-definitions will be used.
+     *  Example:
+     *  
+     *
+     *  
+     * Cases using #default:
+     *  
+     *  TODO: Has this an effect at all?
+     *
+     *  
+     *  From namespace to no namespace.
+     *
+     *  
+     *  From no namespace to namespace.
+     */
+    
+	
+     /*
+     * Store the ns-node in the alias-object.
+    */
+    alias = xsltNewNsAlias(XSLT_CCTXT(style));
+    if (alias == NULL)
+	return;
+    alias->literalNs = literalNs;
+    alias->targetNs = targetNs;
+    XSLT_CCTXT(style)->hasNsAliases = 1;
+
+
+#else /* XSLT_REFACTORED */
+    const xmlChar *literalNsName;
+    const xmlChar *targetNsName;
+    
+
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
+    if (stylePrefix == NULL) {
+	xsltTransformError(NULL, style, node,
+	    "namespace-alias: stylesheet-prefix attribute missing\n");
+	return;
+    }
+    resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
+    if (resultPrefix == NULL) {
+	xsltTransformError(NULL, style, node,
+	    "namespace-alias: result-prefix attribute missing\n");
+	goto error;
+    }
+    
+    if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) {
+	literalNs = xmlSearchNs(node->doc, node, NULL);
+	if (literalNs == NULL) {
+	    literalNsName = NULL;
+	} else
+	    literalNsName = literalNs->href; /* Yes - set for nsAlias table */
+    } else {
+	literalNs = xmlSearchNs(node->doc, node, stylePrefix);
+ 
+	if ((literalNs == NULL) || (literalNs->href == NULL)) {
+	    xsltTransformError(NULL, style, node,
+	        "namespace-alias: prefix %s not bound to any namespace\n",
+					stylePrefix);
+	    goto error;
+	} else
+	    literalNsName = literalNs->href;
+    }
+
+    /*
+     * When "#default" is used for result, if a default namespace has not
+     * been explicitly declared the special value UNDEFINED_DEFAULT_NS is
+     * put into the nsAliases table
+     */
+    if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) {
+	targetNs = xmlSearchNs(node->doc, node, NULL);
+	if (targetNs == NULL) {
+	    targetNsName = UNDEFINED_DEFAULT_NS;
+	} else
+	    targetNsName = targetNs->href;
+    } else {
+	targetNs = xmlSearchNs(node->doc, node, resultPrefix);
+
+        if ((targetNs == NULL) || (targetNs->href == NULL)) {
+	    xsltTransformError(NULL, style, node,
+	        "namespace-alias: prefix %s not bound to any namespace\n",
+					resultPrefix);
+	    goto error;
+	} else
+	    targetNsName = targetNs->href;
+    }
+    /*
+     * Special case: if #default is used for
+     *  the stylesheet-prefix (literal namespace) and there's no default
+     *  namespace in scope, we'll use style->defaultAlias for this.
+     */   
+    if (literalNsName == NULL) {
+        if (targetNs != NULL) {
+	    /*
+	    * BUG TODO: Is it not sufficient to have only 1 field for
+	    *  this, since subsequently alias declarations will
+	    *  overwrite this.	    
+	    *  Example:
+	    *   
+	    *   
+	    *  The mapping for "foo" won't be visible anymore.
+	    */
+            style->defaultAlias = targetNs->href;
+	}
+    } else {
+        if (style->nsAliases == NULL)
+	    style->nsAliases = xmlHashCreate(10);
+        if (style->nsAliases == NULL) {
+	    xsltTransformError(NULL, style, node,
+	        "namespace-alias: cannot create hash table\n");
+	    goto error;
+        }
+	xmlHashAddEntry((xmlHashTablePtr) style->nsAliases,
+	    literalNsName, (void *) targetNsName);
+    }
+#endif /* else of XSLT_REFACTORED */
+
+error:
+    if (stylePrefix != NULL)
+	xmlFree(stylePrefix);
+    if (resultPrefix != NULL)
+	xmlFree(resultPrefix);
+}
+
+/**
+ * xsltGetSpecialNamespace:
+ * @ctxt:  the transformation context
+ * @invocNode: the invoking node; e.g. a literal result element/attr;
+ *             only used for error reports
+ * @nsName:  the namespace name (or NULL)
+ * @nsPrefix:  the suggested namespace prefix (or NULL)
+ * @target:  the result element on which to anchor a namespace
+ *
+ * Find a matching (prefix and ns-name) ns-declaration
+ * for the requested @nsName and @nsPrefix in the result tree.
+ * If none is found then a new ns-declaration will be
+ * added to @resultElem. If, in this case, the given prefix is
+ * already in use, then a ns-declaration with a modified ns-prefix
+ * be we created. Note that this function's priority is to
+ * preserve ns-prefixes; it will only change a prefix if there's
+ * a namespace clash.
+ * If both @nsName and @nsPrefix are NULL, then this will try to
+ * "undeclare" a default namespace by declaring an xmlns="".
+ *
+ * Returns a namespace declaration or NULL.
+ */
+xmlNsPtr
+xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
+		const xmlChar *nsName, const xmlChar *nsPrefix,
+		xmlNodePtr target)
+{
+    xmlNsPtr ns;
+    int prefixOccupied = 0;
+
+    if ((ctxt == NULL) || (target == NULL) ||
+	(target->type != XML_ELEMENT_NODE))
+	return(NULL);
+
+    /*
+    * NOTE: Namespace exclusion and ns-aliasing is performed at
+    *  compilation-time in the refactored code; so this need not be done
+    *  here (it was in the old code).
+    * NOTE: @invocNode was named @cur in the old code and was documented to
+    *  be an input node; since it was only used to anchor an error report
+    *  somewhere, we can safely change this to @invocNode, which now
+    *  will be the XSLT instruction (also a literal result element/attribute),
+    *  which was responsible for this call.
+    */
+    /*
+    * OPTIMIZE TODO: This all could be optimized by keeping track of
+    *  the ns-decls currently in-scope via a specialized context.
+    */    
+    if ((nsPrefix == NULL) && ((nsName == NULL) || (nsName[0] == 0))) {
+	/*
+	* NOTE: the "undeclaration" of the default namespace was
+	* part of the logic of the old xsltGetSpecialNamespace() code,
+	* so we'll keep that mechanism.
+	* Related to the old code: bug #302020:
+	*/
+	/*
+	* OPTIMIZE TODO: This all could be optimized by keeping track of
+	*  the ns-decls currently in-scope via a specialized context.
+	*/
+	/*
+	* Search on the result element itself.
+	*/
+	if (target->nsDef != NULL) {
+	    ns = target->nsDef;
+	    do {
+		if (ns->prefix == NULL) {
+		    if ((ns->href != NULL) && (ns->href[0] != 0)) {
+			/*
+			* Raise a namespace normalization error.
+			*/
+			xsltTransformError(ctxt, NULL, invocNode,
+			    "Namespace normalization error: Cannot undeclare "
+			    "the default namespace, since the default namespace "
+			    "'%s' is already declared on the result element "
+			    "'%s'.\n", ns->href, target->name);
+			return(NULL);
+		    } else {
+			/*
+			* The default namespace was undeclared on the
+			* result element.
+			*/
+			return(NULL);
+		    }
+		    break;
+		}
+		ns = ns->next;
+	    } while (ns != NULL);
+	}	
+	if ((target->parent != NULL) &&
+	    (target->parent->type == XML_ELEMENT_NODE))
+	{
+	    /*
+	    * The parent element is in no namespace, so assume
+	    * that there is no default namespace in scope.
+	    */
+	    if (target->parent->ns == NULL)
+		return(NULL);
+	    
+	    ns = xmlSearchNs(target->doc, target->parent,
+		NULL);
+	    /*
+	    * Fine if there's no default ns is scope, or if the
+	    * default ns was undeclared.
+	    */
+	    if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0))
+		return(NULL);
+	    
+	    /*
+	    * Undeclare the default namespace.
+	    */
+	    xmlNewNs(target, BAD_CAST "", NULL);
+	    /* TODO: Check result */	
+	    return(NULL);
+	}
+	return(NULL);
+    }
+    /*
+    * Handle the XML namespace.
+    * QUESTION: Is this faster than using xmlStrEqual() anyway?
+    */
+    if ((nsPrefix != NULL) &&
+	(nsPrefix[0] == 'x') && (nsPrefix[1] == 'm') &&
+	(nsPrefix[2] == 'l') && (nsPrefix[3] == 0))
+    {
+	return(xmlSearchNs(target->doc, target, nsPrefix));
+    }
+    /*
+    * First: search on the result element itself.
+    */
+    if (target->nsDef != NULL) {
+	ns = target->nsDef;
+	do {
+	    if ((ns->prefix == NULL) == (nsPrefix == NULL)) {
+		if (ns->prefix == nsPrefix) {
+		    if (xmlStrEqual(ns->href, nsName))
+			return(ns);
+		    prefixOccupied = 1;
+		    break;
+		} else if (xmlStrEqual(ns->prefix, nsPrefix)) {
+		    if (xmlStrEqual(ns->href, nsName))
+			return(ns);
+		    prefixOccupied = 1;
+		    break;
+		}
+	    }
+	    ns = ns->next;
+	} while (ns != NULL);
+    }
+    if (prefixOccupied) {
+	/*
+	* If the ns-prefix is occupied by an other ns-decl on the
+	* result element, then this means:
+	* 1) The desired prefix is shadowed
+	* 2) There's no way around changing the prefix	
+	*
+	* Try a desperate search for an in-scope ns-decl
+	* with a matching ns-name before we use the last option,
+	* which is to recreate the ns-decl with a modified prefix.
+	*/
+	ns = xmlSearchNsByHref(target->doc, target, nsName);
+	if (ns != NULL)
+	    return(ns);
+
+	/*
+	* Fallback to changing the prefix.
+	*/    
+    } else if ((target->parent != NULL) &&
+	(target->parent->type == XML_ELEMENT_NODE))
+    {
+	/*
+	* Try to find a matching ns-decl in the ancestor-axis.
+	*
+	* Check the common case: The parent element of the current
+	* result element is in the same namespace (with an equal ns-prefix).
+	*/     
+	if ((target->parent->ns != NULL) &&
+	    ((target->parent->ns->prefix != NULL) == (nsPrefix != NULL)))
+	{
+	    ns = target->parent->ns;
+	    
+	    if (nsPrefix == NULL) {
+		if (xmlStrEqual(ns->href, nsName))
+		    return(ns);
+	    } else if (xmlStrEqual(ns->prefix, nsPrefix) &&
+		xmlStrEqual(ns->href, nsName))
+	    {
+		return(ns);
+	    }
+	}
+	/*
+	* Lookup the remaining in-scope namespaces.
+	*/    
+	ns = xmlSearchNs(target->doc, target->parent, nsPrefix);
+	if (ns != NULL) {
+	    if (xmlStrEqual(ns->href, nsName))
+		return(ns);	    
+	    /*
+	    * Now check for a nasty case: We need to ensure that the new
+	    * ns-decl won't shadow a prefix in-use by an existing attribute.
+	    * 
+	    *   
+	    *     
+	    *        val-b
+	    *   
+	    * 
+	    */
+	    if (target->properties) {
+		xmlAttrPtr attr = target->properties;
+		do {
+		    if ((attr->ns) &&
+			xmlStrEqual(attr->ns->prefix, nsPrefix))
+		    {
+			/*
+			* Bad, this prefix is already in use.
+			* Since we'll change the prefix anyway, try
+			* a search for a matching ns-decl based on the
+			* namespace name.
+			*/
+			ns = xmlSearchNsByHref(target->doc, target, nsName);
+			if (ns != NULL)
+			    return(ns);
+			goto declare_new_prefix;
+		    }
+		    attr = attr->next;
+		} while (attr != NULL);
+	    }
+	} else {
+	    /*
+	    * Either no matching ns-prefix was found or the namespace is
+	    * shadowed.
+	    * Create a new ns-decl on the current result element.
+	    *
+	    * Hmm, we could also try to reuse an in-scope
+	    * namespace with a matching ns-name but a different
+	    * ns-prefix.
+	    * What has higher priority?
+	    *  1) If keeping the prefix: create a new ns-decl.
+	    *  2) If reusal: first lookup ns-names; then fallback
+	    *     to creation of a new ns-decl.
+	    * REVISIT: this currently uses case 1) although
+	    *  the old way was use xmlSearchNsByHref() and to let change
+	    *  the prefix.
+	    */
+#if 0
+	    ns = xmlSearchNsByHref(target->doc, target, nsName);
+	    if (ns != NULL)
+		return(ns);
+#endif
+	}
+	/*
+	* Create the ns-decl on the current result element.
+	*/
+	ns = xmlNewNs(target, nsName, nsPrefix);
+	/* TODO: check errors */
+	return(ns);
+    } else {
+	/*
+	* This is either the root of the tree or something weird is going on.
+	*/
+	ns = xmlNewNs(target, nsName, nsPrefix);
+	/* TODO: Check result */
+	return(ns);
+    }
+
+declare_new_prefix:
+    /*
+    * Fallback: we need to generate a new prefix and declare the namespace
+    * on the result element.
+    */
+    {
+	xmlChar pref[30];
+	int counter = 1;
+
+	do {
+	    snprintf((char *) pref, 30, "%s_%d", nsPrefix, counter++);
+	    ns = xmlSearchNs(target->doc, target, BAD_CAST pref);
+	    if (counter > 1000) {
+		xsltTransformError(ctxt, NULL, invocNode,
+		    "Internal error in xsltAcquireResultInScopeNs(): "
+		    "Failed to compute a unique ns-prefix for the "
+		    "generated element");
+		return(NULL);
+	    }
+	} while (ns != NULL);
+	ns = xmlNewNs(target, nsName, BAD_CAST pref);
+	/* TODO: Check result */
+	return(ns);
+    }
+    return(NULL);
+}
+
+/**
+ * xsltGetNamespace:
+ * @ctxt:  a transformation context
+ * @cur:  the input node
+ * @ns:  the namespace
+ * @out:  the output node (or its parent)
+ *
+ * Find a matching (prefix and ns-name) ns-declaration
+ * for the requested @ns->prefix and @ns->href in the result tree.
+ * If none is found then a new ns-declaration will be
+ * added to @resultElem. If, in this case, the given prefix is
+ * already in use, then a ns-declaration with a modified ns-prefix
+ * be we created.
+ *
+ * Called by:
+ *  - xsltCopyPropList() (*not*  anymore)
+ *  - xsltShallowCopyElement()
+ *  - xsltCopyTreeInternal() (*not*  anymore)
+ *  - xsltApplySequenceConstructor() (*not* in the refactored code),
+ *  - xsltElement() (*not* anymore)
+ *
+ * Returns a namespace declaration or NULL in case of
+ *         namespace fixup failures or API or internal errors.
+ */
+xmlNsPtr
+xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
+	         xmlNodePtr out)
+{    
+    
+    if (ns == NULL)
+	return(NULL);
+
+#ifdef XSLT_REFACTORED
+    /*
+    * Namespace exclusion and ns-aliasing is performed at
+    * compilation-time in the refactored code.
+    * Additionally, aliasing is not intended for non Literal
+    * Result Elements.
+    */
+    return(xsltGetSpecialNamespace(ctxt, cur, ns->href, ns->prefix, out));
+#else
+    {
+	xsltStylesheetPtr style;
+	const xmlChar *URI = NULL; /* the replacement URI */
+
+	if ((ctxt == NULL) || (cur == NULL) || (out == NULL))
+	    return(NULL);
+
+	style = ctxt->style;
+	while (style != NULL) {
+	    if (style->nsAliases != NULL)
+		URI = (const xmlChar *) 
+		xmlHashLookup(style->nsAliases, ns->href);
+	    if (URI != NULL)
+		break;
+	    
+	    style = xsltNextImport(style);
+	}
+	
+	
+	if (URI == UNDEFINED_DEFAULT_NS) {
+	    return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out));
+#if 0
+	    /*
+	    * TODO: Removed, since wrong. If there was no default
+	    * namespace in the stylesheet then this must resolve to
+	    * the NULL namespace.
+	    */
+	    xmlNsPtr dflt;	    
+	    dflt = xmlSearchNs(cur->doc, cur, NULL);
+	    if (dflt != NULL)
+		URI = dflt->href;
+	    else
+		return NULL;
+#endif
+	} else if (URI == NULL)
+	    URI = ns->href;
+
+	return(xsltGetSpecialNamespace(ctxt, cur, URI, ns->prefix, out));
+    }
+#endif
+}
+
+/**
+ * xsltGetPlainNamespace:
+ * @ctxt:  a transformation context
+ * @cur:  the input node
+ * @ns:  the namespace
+ * @out:  the result element
+ *
+ * Obsolete. 
+ * *Not* called by any Libxslt/Libexslt function.
+ * Exaclty the same as xsltGetNamespace(). 
+ *
+ * Returns a namespace declaration or NULL in case of
+ *         namespace fixup failures or API or internal errors.
+ */
+xmlNsPtr
+xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,
+                      xmlNsPtr ns, xmlNodePtr out)
+{    
+    return(xsltGetNamespace(ctxt, cur, ns, out));
+}
+
+/**
+ * xsltCopyNamespaceList:
+ * @ctxt:  a transformation context
+ * @node:  the target node
+ * @cur:  the first namespace
+ *
+ * Do a copy of an namespace list. If @node is non-NULL the
+ * new namespaces are added automatically. This handles namespaces
+ * aliases.
+ * This function is intended only for *internal* use at
+ * transformation-time for copying ns-declarations of Literal
+ * Result Elements.
+ * 
+ * Called by:
+ *   xsltCopyTreeInternal() (transform.c)
+ *   xsltShallowCopyElem() (transform.c)
+ *
+ * REVISIT: This function won't be used in the refactored code.
+ *
+ * Returns: a new xmlNsPtr, or NULL in case of error.
+ */
+xmlNsPtr
+xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	              xmlNsPtr cur) {
+    xmlNsPtr ret = NULL, tmp;
+    xmlNsPtr p = NULL,q;    
+
+    if (cur == NULL)
+	return(NULL);
+    if (cur->type != XML_NAMESPACE_DECL)
+	return(NULL);
+
+    /*
+     * One can add namespaces only on element nodes
+     */
+    if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
+	node = NULL;
+
+    while (cur != NULL) {
+	if (cur->type != XML_NAMESPACE_DECL)
+	    break;
+
+	/*
+	 * Avoid duplicating namespace declarations in the tree if
+	 * a matching declaration is in scope.
+	 */
+	if (node != NULL) {
+	    if ((node->ns != NULL) &&
+		(xmlStrEqual(node->ns->prefix, cur->prefix)) &&
+        	(xmlStrEqual(node->ns->href, cur->href))) {
+		cur = cur->next;
+		continue;
+	    }
+	    tmp = xmlSearchNs(node->doc, node, cur->prefix);
+	    if ((tmp != NULL) && (xmlStrEqual(tmp->href, cur->href))) {
+		cur = cur->next;
+		continue;
+	    }
+	}
+#ifdef XSLT_REFACTORED
+	/*
+	* Namespace exclusion and ns-aliasing is performed at
+	* compilation-time in the refactored code.
+	*/
+	q = xmlNewNs(node, cur->href, cur->prefix);
+	if (p == NULL) {
+	    ret = p = q;
+	} else {
+	    p->next = q;
+	    p = q;
+	}
+#else
+	/*
+	* TODO: Remove this if the refactored code gets enabled.
+	*/
+	if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) {
+	    const xmlChar *URI;
+	    /* TODO apply cascading */
+	    URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases,
+		                                  cur->href);
+	    if (URI == UNDEFINED_DEFAULT_NS)
+	        continue;
+	    if (URI != NULL) {
+		q = xmlNewNs(node, URI, cur->prefix);
+	    } else {
+		q = xmlNewNs(node, cur->href, cur->prefix);
+	    }
+	    if (p == NULL) {
+		ret = p = q;
+	    } else {
+		p->next = q;
+		p = q;
+	    }
+	}
+#endif
+	cur = cur->next;
+    }
+    return(ret);
+}
+
+/**
+ * xsltCopyNamespace:
+ * @ctxt:  a transformation context
+ * @elem:  the target element node
+ * @ns:  the namespace node
+ *
+ * Copies a namespace node (declaration). If @elem is not NULL,
+ * then the new namespace will be declared on @elem.
+ *
+ * Returns: a new xmlNsPtr, or NULL in case of an error.
+ */
+xmlNsPtr
+xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		  xmlNodePtr elem, xmlNsPtr ns)
+{    
+    if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
+	return(NULL);
+    /*
+     * One can add namespaces only on element nodes
+     */
+    if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE))
+	return(xmlNewNs(NULL, ns->href, ns->prefix));
+    else
+	return(xmlNewNs(elem, ns->href, ns->prefix));
+}
+
+
+/**
+ * xsltFreeNamespaceAliasHashes:
+ * @style: an XSLT stylesheet
+ *
+ * Free up the memory used by namespaces aliases
+ */
+void
+xsltFreeNamespaceAliasHashes(xsltStylesheetPtr style) {
+    if (style->nsAliases != NULL)
+	xmlHashFree((xmlHashTablePtr) style->nsAliases, NULL);
+    style->nsAliases = NULL;
+}
diff --git a/third_party/libxslt/libxslt/namespaces.h b/third_party/libxslt/libxslt/namespaces.h
new file mode 100644
index 0000000..0bda596
--- /dev/null
+++ b/third_party/libxslt/libxslt/namespaces.h
@@ -0,0 +1,68 @@
+/*
+ * Summary: interface for the XSLT namespace handling
+ * Description: set of function easing the processing and generation
+ *              of namespace nodes in XSLT.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_NAMESPACES_H__
+#define __XML_XSLT_NAMESPACES_H__
+
+#include 
+#include "xsltexports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Used within nsAliases hashtable when the default namespace is required
+ * but it's not been explicitly defined
+ */
+/**
+ * UNDEFINED_DEFAULT_NS:
+ *
+ * Special value for undefined namespace, internal
+ */
+#define	UNDEFINED_DEFAULT_NS	(const xmlChar *) -1L
+
+XSLTPUBFUN void XSLTCALL
+		xsltNamespaceAlias	(xsltStylesheetPtr style,
+					 xmlNodePtr node);
+XSLTPUBFUN xmlNsPtr XSLTCALL	
+		xsltGetNamespace	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr cur,
+					 xmlNsPtr ns,
+					 xmlNodePtr out);
+XSLTPUBFUN xmlNsPtr XSLTCALL	
+		xsltGetPlainNamespace	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr cur,
+					 xmlNsPtr ns,
+					 xmlNodePtr out);
+XSLTPUBFUN xmlNsPtr XSLTCALL	
+		xsltGetSpecialNamespace	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr cur,
+					 const xmlChar *URI,
+					 const xmlChar *prefix,
+					 xmlNodePtr out);
+XSLTPUBFUN xmlNsPtr XSLTCALL	
+		xsltCopyNamespace	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr elem,
+					 xmlNsPtr ns);
+XSLTPUBFUN xmlNsPtr XSLTCALL	
+		xsltCopyNamespaceList	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xmlNsPtr cur);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeNamespaceAliasHashes
+					(xsltStylesheetPtr style);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_NAMESPACES_H__ */
+
diff --git a/third_party/libxslt/libxslt/numbers.c b/third_party/libxslt/libxslt/numbers.c
new file mode 100644
index 0000000..8683ca8
--- /dev/null
+++ b/third_party/libxslt/libxslt/numbers.c
@@ -0,0 +1,1351 @@
+/*
+ * numbers.c: Implementation of the XSLT number functions
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ * Bjorn Reese 
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xsltutils.h"
+#include "pattern.h"
+#include "templates.h"
+#include "transform.h"
+#include "numbersInternals.h"
+
+#ifndef FALSE
+# define FALSE (0 == 1)
+# define TRUE (1 == 1)
+#endif
+
+#define SYMBOL_QUOTE		((xmlChar)'\'')
+
+#define DEFAULT_TOKEN		(xmlChar)'0'
+#define DEFAULT_SEPARATOR	"."
+
+#define MAX_TOKENS		1024
+
+typedef struct _xsltFormatToken xsltFormatToken;
+typedef xsltFormatToken *xsltFormatTokenPtr;
+struct _xsltFormatToken {
+    xmlChar	*separator;
+    xmlChar	 token;
+    int		 width;
+};
+
+typedef struct _xsltFormat xsltFormat;
+typedef xsltFormat *xsltFormatPtr;
+struct _xsltFormat {
+    xmlChar		*start;
+    xsltFormatToken	 tokens[MAX_TOKENS];
+    int			 nTokens;
+    xmlChar		*end;
+};
+
+static char alpha_upper_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static char alpha_lower_list[] = "abcdefghijklmnopqrstuvwxyz";
+static xsltFormatToken default_token;
+
+/*
+ * **** Start temp insert ****
+ *
+ * The following two routines (xsltUTF8Size and xsltUTF8Charcmp)
+ * will be replaced with calls to the corresponding libxml routines
+ * at a later date (when other inter-library dependencies require it)
+ */
+
+/**
+ * xsltUTF8Size:
+ * @utf: pointer to the UTF8 character
+ *
+ * returns the numbers of bytes in the character, -1 on format error
+ */
+static int
+xsltUTF8Size(xmlChar *utf) {
+    xmlChar mask;
+    int len;
+
+    if (utf == NULL)
+        return -1;
+    if (*utf < 0x80)
+        return 1;
+    /* check valid UTF8 character */
+    if (!(*utf & 0x40))
+        return -1;
+    /* determine number of bytes in char */
+    len = 2;
+    for (mask=0x20; mask != 0; mask>>=1) {
+        if (!(*utf & mask))
+            return len;
+        len++;
+    }
+    return -1;
+}
+
+/**
+ * xsltUTF8Charcmp
+ * @utf1: pointer to first UTF8 char
+ * @utf2: pointer to second UTF8 char
+ *
+ * returns result of comparing the two UCS4 values
+ * as with xmlStrncmp
+ */
+static int
+xsltUTF8Charcmp(xmlChar *utf1, xmlChar *utf2) {
+
+    if (utf1 == NULL ) {
+        if (utf2 == NULL)
+            return 0;
+        return -1;
+    }
+    return xmlStrncmp(utf1, utf2, xsltUTF8Size(utf1));
+}
+
+/***** Stop temp insert *****/
+/************************************************************************
+ *									*
+ *			Utility functions				*
+ *									*
+ ************************************************************************/
+
+#define IS_SPECIAL(self,letter)			\
+    ((xsltUTF8Charcmp((letter), (self)->zeroDigit) == 0)	    ||	\
+     (xsltUTF8Charcmp((letter), (self)->digit) == 0)	    ||	\
+     (xsltUTF8Charcmp((letter), (self)->decimalPoint) == 0)  ||	\
+     (xsltUTF8Charcmp((letter), (self)->grouping) == 0)	    ||	\
+     (xsltUTF8Charcmp((letter), (self)->patternSeparator) == 0))
+
+#define IS_DIGIT_ZERO(x) xsltIsDigitZero(x)
+#define IS_DIGIT_ONE(x) xsltIsDigitZero((xmlChar)(x)-1)
+
+static int
+xsltIsDigitZero(unsigned int ch)
+{
+    /*
+     * Reference: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
+     */
+    switch (ch) {
+    case 0x0030: case 0x0660: case 0x06F0: case 0x0966:
+    case 0x09E6: case 0x0A66: case 0x0AE6: case 0x0B66:
+    case 0x0C66: case 0x0CE6: case 0x0D66: case 0x0E50:
+    case 0x0E60: case 0x0F20: case 0x1040: case 0x17E0:
+    case 0x1810: case 0xFF10:
+	return TRUE;
+    default:
+	return FALSE;
+    }
+}
+
+static void
+xsltNumberFormatDecimal(xmlBufferPtr buffer,
+			double number,
+			int digit_zero,
+			int width,
+			int digitsPerGroup,
+			int groupingCharacter,
+			int groupingCharacterLen)
+{
+    /*
+     * This used to be
+     *  xmlChar temp_string[sizeof(double) * CHAR_BIT * sizeof(xmlChar) + 4];
+     * which would be length 68 on x86 arch.  It was changed to be a longer,
+     * fixed length in order to try to cater for (reasonable) UTF8
+     * separators and numeric characters.  The max UTF8 char size will be
+     * 6 or less, so the value used [500] should be *much* larger than needed
+     */
+    xmlChar temp_string[500];
+    xmlChar *pointer;
+    xmlChar temp_char[6];
+    int i;
+    int val;
+    int len;
+
+    /* Build buffer from back */
+    pointer = &temp_string[sizeof(temp_string)] - 1;	/* last char */
+    *pointer = 0;
+    i = 0;
+    while (pointer > temp_string) {
+	if ((i >= width) && (fabs(number) < 1.0))
+	    break; /* for */
+	if ((i > 0) && (groupingCharacter != 0) &&
+	    (digitsPerGroup > 0) &&
+	    ((i % digitsPerGroup) == 0)) {
+	    if (pointer - groupingCharacterLen < temp_string) {
+	        i = -1;		/* flag error */
+		break;
+	    }
+	    pointer -= groupingCharacterLen;
+	    xmlCopyCharMultiByte(pointer, groupingCharacter);
+	}
+	
+	val = digit_zero + (int)fmod(number, 10.0);
+	if (val < 0x80) {			/* shortcut if ASCII */
+	    if (pointer <= temp_string) {	/* Check enough room */
+	        i = -1;
+		break;
+	    }
+	    *(--pointer) = val;
+	}
+	else {
+	/* 
+	 * Here we have a multibyte character.  It's a little messy,
+	 * because until we generate the char we don't know how long
+	 * it is.  So, we generate it into the buffer temp_char, then
+	 * copy from there into temp_string.
+	 */
+	    len = xmlCopyCharMultiByte(temp_char, val);
+	    if ( (pointer - len) < temp_string ) {
+	        i = -1;
+		break;
+	    }
+	    pointer -= len;
+	    memcpy(pointer, temp_char, len);
+	}
+	number /= 10.0;
+	++i;
+    }
+    if (i < 0)
+        xsltGenericError(xsltGenericErrorContext,
+		"xsltNumberFormatDecimal: Internal buffer size exceeded");
+    xmlBufferCat(buffer, pointer);
+}
+
+static void
+xsltNumberFormatAlpha(xmlBufferPtr buffer,
+		      double number,
+		      int is_upper)
+{
+    char temp_string[sizeof(double) * CHAR_BIT * sizeof(xmlChar) + 1];
+    char *pointer;
+    int i;
+    char *alpha_list;
+    double alpha_size = (double)(sizeof(alpha_upper_list) - 1);
+
+    /* Build buffer from back */
+    pointer = &temp_string[sizeof(temp_string)];
+    *(--pointer) = 0;
+    alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list;
+    
+    for (i = 1; i < (int)sizeof(temp_string); i++) {
+	number--;
+	*(--pointer) = alpha_list[((int)fmod(number, alpha_size))];
+	number /= alpha_size;
+	if (fabs(number) < 1.0)
+	    break; /* for */
+    }
+    xmlBufferCCat(buffer, pointer);
+}
+
+static void
+xsltNumberFormatRoman(xmlBufferPtr buffer,
+		      double number,
+		      int is_upper)
+{
+    /*
+     * Based on an example by Jim Walsh
+     */
+    while (number >= 1000.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "M" : "m");
+	number -= 1000.0;
+    }
+    if (number >= 900.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "CM" : "cm");
+	number -= 900.0;
+    }
+    while (number >= 500.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "D" : "d");
+	number -= 500.0;
+    }
+    if (number >= 400.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "CD" : "cd");
+	number -= 400.0;
+    }
+    while (number >= 100.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "C" : "c");
+	number -= 100.0;
+    }
+    if (number >= 90.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "XC" : "xc");
+	number -= 90.0;
+    }
+    while (number >= 50.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "L" : "l");
+	number -= 50.0;
+    }
+    if (number >= 40.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "XL" : "xl");
+	number -= 40.0;
+    }
+    while (number >= 10.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "X" : "x");
+	number -= 10.0;
+    }
+    if (number >= 9.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "IX" : "ix");
+	number -= 9.0;
+    }
+    while (number >= 5.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "V" : "v");
+	number -= 5.0;
+    }
+    if (number >= 4.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "IV" : "iv");
+	number -= 4.0;
+    }
+    while (number >= 1.0) {
+	xmlBufferCCat(buffer, (is_upper) ? "I" : "i");
+	number--;
+    }
+}
+
+static void
+xsltNumberFormatTokenize(const xmlChar *format,
+			 xsltFormatPtr tokens)
+{
+    int ix = 0;
+    int j;
+    int val;
+    int len;
+
+    default_token.token = DEFAULT_TOKEN;
+    default_token.width = 1;
+    default_token.separator = BAD_CAST(DEFAULT_SEPARATOR);
+
+
+    tokens->start = NULL;
+    tokens->tokens[0].separator = NULL;
+    tokens->end = NULL;
+
+    /*
+     * Insert initial non-alphanumeric token.
+     * There is always such a token in the list, even if NULL
+     */
+    while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) ||
+    	      IS_DIGIT(val)) ) {
+	if (format[ix] == 0)		/* if end of format string */
+	    break; /* while */
+	ix += len;
+    }
+    if (ix > 0)
+	tokens->start = xmlStrndup(format, ix);
+
+
+    for (tokens->nTokens = 0; tokens->nTokens < MAX_TOKENS;
+	 tokens->nTokens++) {
+	if (format[ix] == 0)
+	    break; /* for */
+
+	/*
+	 * separator has already been parsed (except for the first
+	 * number) in tokens->end, recover it.
+	 */
+	if (tokens->nTokens > 0) {
+	    tokens->tokens[tokens->nTokens].separator = tokens->end;
+	    tokens->end = NULL;
+	}
+
+	val = xmlStringCurrentChar(NULL, format+ix, &len);
+	if (IS_DIGIT_ONE(val) ||
+		 IS_DIGIT_ZERO(val)) {
+	    tokens->tokens[tokens->nTokens].width = 1;
+	    while (IS_DIGIT_ZERO(val)) {
+		tokens->tokens[tokens->nTokens].width++;
+		ix += len;
+		val = xmlStringCurrentChar(NULL, format+ix, &len);
+	    }
+	    if (IS_DIGIT_ONE(val)) {
+		tokens->tokens[tokens->nTokens].token = val - 1;
+		ix += len;
+		val = xmlStringCurrentChar(NULL, format+ix, &len);
+	    }
+	} else if ( (val == (xmlChar)'A') ||
+		    (val == (xmlChar)'a') ||
+		    (val == (xmlChar)'I') ||
+		    (val == (xmlChar)'i') ) {
+	    tokens->tokens[tokens->nTokens].token = val;
+	    ix += len;
+	    val = xmlStringCurrentChar(NULL, format+ix, &len);
+	} else {
+	    /* XSLT section 7.7
+	     * "Any other format token indicates a numbering sequence
+	     *  that starts with that token. If an implementation does
+	     *  not support a numbering sequence that starts with that
+	     *  token, it must use a format token of 1."
+	     */
+	    tokens->tokens[tokens->nTokens].token = (xmlChar)'0';
+	    tokens->tokens[tokens->nTokens].width = 1;
+	}
+	/*
+	 * Skip over remaining alphanumeric characters from the Nd
+	 * (Number, decimal digit), Nl (Number, letter), No (Number,
+	 * other), Lu (Letter, uppercase), Ll (Letter, lowercase), Lt
+	 * (Letters, titlecase), Lm (Letters, modifiers), and Lo
+	 * (Letters, other (uncased)) Unicode categories. This happens
+	 * to correspond to the Letter and Digit classes from XML (and
+	 * one wonders why XSLT doesn't refer to these instead).
+	 */
+	while (IS_LETTER(val) || IS_DIGIT(val)) {
+	    ix += len;
+	    val = xmlStringCurrentChar(NULL, format+ix, &len);
+	}
+
+	/*
+	 * Insert temporary non-alphanumeric final tooken.
+	 */
+	j = ix;
+	while (! (IS_LETTER(val) || IS_DIGIT(val))) {
+	    if (val == 0)
+		break; /* while */
+	    ix += len;
+	    val = xmlStringCurrentChar(NULL, format+ix, &len);
+	}
+	if (ix > j)
+	    tokens->end = xmlStrndup(&format[j], ix - j);
+    }
+}
+
+static void
+xsltNumberFormatInsertNumbers(xsltNumberDataPtr data,
+			      double *numbers,
+			      int numbers_max,
+			      xsltFormatPtr tokens,
+			      xmlBufferPtr buffer)
+{
+    int i = 0;
+    double number;
+    xsltFormatTokenPtr token;
+
+    /*
+     * Handle initial non-alphanumeric token
+     */
+    if (tokens->start != NULL)
+	 xmlBufferCat(buffer, tokens->start);
+
+    for (i = 0; i < numbers_max; i++) {
+	/* Insert number */
+	number = numbers[(numbers_max - 1) - i];
+	if (i < tokens->nTokens) {
+	  /*
+	   * The "n"th format token will be used to format the "n"th
+	   * number in the list
+	   */
+	  token = &(tokens->tokens[i]);
+	} else if (tokens->nTokens > 0) {
+	  /*
+	   * If there are more numbers than format tokens, then the
+	   * last format token will be used to format the remaining
+	   * numbers.
+	   */
+	  token = &(tokens->tokens[tokens->nTokens - 1]);
+	} else {
+	  /*
+	   * If there are no format tokens, then a format token of
+	   * 1 is used to format all numbers.
+	   */
+	  token = &default_token;
+	}
+
+	/* Print separator, except for the first number */
+	if (i > 0) {
+	    if (token->separator != NULL)
+		xmlBufferCat(buffer, token->separator);
+	    else
+		xmlBufferCCat(buffer, DEFAULT_SEPARATOR);
+	}
+
+	switch (xmlXPathIsInf(number)) {
+	case -1:
+	    xmlBufferCCat(buffer, "-Infinity");
+	    break;
+	case 1:
+	    xmlBufferCCat(buffer, "Infinity");
+	    break;
+	default:
+	    if (xmlXPathIsNaN(number)) {
+		xmlBufferCCat(buffer, "NaN");
+	    } else {
+
+		switch (token->token) {
+		case 'A':
+		    xsltNumberFormatAlpha(buffer,
+					  number,
+					  TRUE);
+
+		    break;
+		case 'a':
+		    xsltNumberFormatAlpha(buffer,
+					  number,
+					  FALSE);
+
+		    break;
+		case 'I':
+		    xsltNumberFormatRoman(buffer,
+					  number,
+					  TRUE);
+
+		    break;
+		case 'i':
+		    xsltNumberFormatRoman(buffer,
+					  number,
+					  FALSE);
+
+		    break;
+		default:
+		    if (IS_DIGIT_ZERO(token->token)) {
+			xsltNumberFormatDecimal(buffer,
+						number,
+						token->token,
+						token->width,
+						data->digitsPerGroup,
+						data->groupingCharacter,
+						data->groupingCharacterLen);
+		    }
+		    break;
+		}
+	    }
+
+	}
+    }
+
+    /*
+     * Handle final non-alphanumeric token
+     */
+    if (tokens->end != NULL)
+	 xmlBufferCat(buffer, tokens->end);
+
+}
+
+static int
+xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context,
+			    xmlNodePtr node,
+			    const xmlChar *count,
+			    const xmlChar *from,
+			    double *array,
+			    xmlDocPtr doc,
+			    xmlNodePtr elem)
+{
+    int amount = 0;
+    int cnt = 0;
+    xmlNodePtr cur;
+    xsltCompMatchPtr countPat = NULL;
+    xsltCompMatchPtr fromPat = NULL;
+
+    if (count != NULL)
+	countPat = xsltCompilePattern(count, doc, elem, NULL, context);
+    if (from != NULL)
+	fromPat = xsltCompilePattern(from, doc, elem, NULL, context);
+	
+    /* select the starting node */
+    switch (node->type) {
+	case XML_ELEMENT_NODE:
+	    cur = node;
+	    break;
+	case XML_ATTRIBUTE_NODE:
+	    cur = ((xmlAttrPtr) node)->parent;
+	    break;
+	case XML_TEXT_NODE:
+	case XML_PI_NODE:
+	case XML_COMMENT_NODE:
+	    cur = node->parent;
+	    break;
+	default:
+	    cur = NULL;
+	    break;
+    }
+
+    while (cur != NULL) {
+	/* process current node */
+	if (count == NULL) {
+	    if ((node->type == cur->type) &&
+		/* FIXME: must use expanded-name instead of local name */
+		xmlStrEqual(node->name, cur->name)) {
+		    if ((node->ns == cur->ns) ||
+		        ((node->ns != NULL) &&
+			 (cur->ns != NULL) &&
+		         (xmlStrEqual(node->ns->href,
+		             cur->ns->href) )))
+		        cnt++;
+	    }
+	} else {
+	    if (xsltTestCompMatchList(context, cur, countPat))
+		cnt++;
+	}
+	if ((from != NULL) &&
+	    xsltTestCompMatchList(context, cur, fromPat)) {
+	    break; /* while */
+	}
+
+	/* Skip to next preceding or ancestor */
+	if ((cur->type == XML_DOCUMENT_NODE) ||
+#ifdef LIBXML_DOCB_ENABLED
+            (cur->type == XML_DOCB_DOCUMENT_NODE) ||
+#endif
+            (cur->type == XML_HTML_DOCUMENT_NODE))
+	    break; /* while */
+
+	while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
+	       (cur->prev->type == XML_XINCLUDE_START) ||
+	       (cur->prev->type == XML_XINCLUDE_END)))
+	    cur = cur->prev;
+	if (cur->prev != NULL) {
+	    for (cur = cur->prev; cur->last != NULL; cur = cur->last);
+	} else {
+	    cur = cur->parent;
+	}
+
+    }
+
+    array[amount++] = (double) cnt;
+
+    if (countPat != NULL)
+	xsltFreeCompMatchList(countPat);
+    if (fromPat != NULL)
+	xsltFreeCompMatchList(fromPat);
+    return(amount);
+}
+
+static int
+xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context,
+				 xmlNodePtr node,
+				 const xmlChar *count,
+				 const xmlChar *from,
+				 double *array,
+				 int max,
+				 xmlDocPtr doc,
+				 xmlNodePtr elem)
+{
+    int amount = 0;
+    int cnt;
+    xmlNodePtr ancestor;
+    xmlNodePtr preceding;
+    xmlXPathParserContextPtr parser;
+    xsltCompMatchPtr countPat;
+    xsltCompMatchPtr fromPat;
+
+    if (count != NULL)
+	countPat = xsltCompilePattern(count, doc, elem, NULL, context);
+    else
+	countPat = NULL;
+    if (from != NULL)
+	fromPat = xsltCompilePattern(from, doc, elem, NULL, context);
+    else
+	fromPat = NULL;
+    context->xpathCtxt->node = node;
+    parser = xmlXPathNewParserContext(NULL, context->xpathCtxt);
+    if (parser) {
+	/* ancestor-or-self::*[count] */
+	for (ancestor = node;
+	     (ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE);
+	     ancestor = xmlXPathNextAncestor(parser, ancestor)) {
+	    
+	    if ((from != NULL) &&
+		xsltTestCompMatchList(context, ancestor, fromPat))
+		break; /* for */
+	    
+	    if ((count == NULL && node->type == ancestor->type && 
+		xmlStrEqual(node->name, ancestor->name)) ||
+		xsltTestCompMatchList(context, ancestor, countPat)) {
+		/* count(preceding-sibling::*) */
+		cnt = 0;
+		for (preceding = ancestor;
+		     preceding != NULL;
+		     preceding = 
+		        xmlXPathNextPrecedingSibling(parser, preceding)) {
+		    if (count == NULL) {
+			if ((preceding->type == ancestor->type) &&
+			    xmlStrEqual(preceding->name, ancestor->name)){
+			    if ((preceding->ns == ancestor->ns) ||
+			        ((preceding->ns != NULL) &&
+				 (ancestor->ns != NULL) &&
+			         (xmlStrEqual(preceding->ns->href,
+			             ancestor->ns->href) )))
+			        cnt++;
+			}
+		    } else {
+			if (xsltTestCompMatchList(context, preceding,
+				                  countPat))
+			    cnt++;
+		    }
+		}
+		array[amount++] = (double)cnt;
+		if (amount >= max)
+		    break; /* for */
+	    }
+	}
+	xmlXPathFreeParserContext(parser);
+    }
+    xsltFreeCompMatchList(countPat);
+    xsltFreeCompMatchList(fromPat);
+    return amount;
+}
+
+static int
+xsltNumberFormatGetValue(xmlXPathContextPtr context,
+			 xmlNodePtr node,
+			 const xmlChar *value,
+			 double *number)
+{
+    int amount = 0;
+    xmlBufferPtr pattern;
+    xmlXPathObjectPtr obj;
+    
+    pattern = xmlBufferCreate();
+    if (pattern != NULL) {
+	xmlBufferCCat(pattern, "number(");
+	xmlBufferCat(pattern, value);
+	xmlBufferCCat(pattern, ")");
+	context->node = node;
+	obj = xmlXPathEvalExpression(xmlBufferContent(pattern),
+				     context);
+	if (obj != NULL) {
+	    *number = obj->floatval;
+	    amount++;
+	    xmlXPathFreeObject(obj);
+	}
+	xmlBufferFree(pattern);
+    }
+    return amount;
+}
+
+/**
+ * xsltNumberFormat:
+ * @ctxt: the XSLT transformation context
+ * @data: the formatting informations
+ * @node: the data to format
+ *
+ * Convert one number.
+ */
+void
+xsltNumberFormat(xsltTransformContextPtr ctxt,
+		 xsltNumberDataPtr data,
+		 xmlNodePtr node)
+{
+    xmlBufferPtr output = NULL;
+    int amount, i;
+    double number;
+    xsltFormat tokens;
+    int tempformat = 0;
+
+    if ((data->format == NULL) && (data->has_format != 0)) {
+	data->format = xsltEvalAttrValueTemplate(ctxt, data->node,
+					     (const xmlChar *) "format",
+					     XSLT_NAMESPACE);
+	tempformat = 1;
+    }
+    if (data->format == NULL) {
+	return;
+    }
+
+    output = xmlBufferCreate();
+    if (output == NULL)
+	goto XSLT_NUMBER_FORMAT_END;
+
+    xsltNumberFormatTokenize(data->format, &tokens);
+
+    /*
+     * Evaluate the XPath expression to find the value(s)
+     */
+    if (data->value) {
+	amount = xsltNumberFormatGetValue(ctxt->xpathCtxt,
+					  node,
+					  data->value,
+					  &number);
+	if (amount == 1) {
+	    xsltNumberFormatInsertNumbers(data,
+					  &number,
+					  1,
+					  &tokens,
+					  output);
+	}
+	
+    } else if (data->level) {
+	
+	if (xmlStrEqual(data->level, (const xmlChar *) "single")) {
+	    amount = xsltNumberFormatGetMultipleLevel(ctxt,
+						      node,
+						      data->count,
+						      data->from,
+						      &number,
+						      1,
+						      data->doc,
+						      data->node);
+	    if (amount == 1) {
+		xsltNumberFormatInsertNumbers(data,
+					      &number,
+					      1,
+					      &tokens,
+					      output);
+	    }
+	} else if (xmlStrEqual(data->level, (const xmlChar *) "multiple")) {
+	    double numarray[1024];
+	    int max = sizeof(numarray)/sizeof(numarray[0]);
+	    amount = xsltNumberFormatGetMultipleLevel(ctxt,
+						      node,
+						      data->count,
+						      data->from,
+						      numarray,
+						      max,
+						      data->doc,
+						      data->node);
+	    if (amount > 0) {
+		xsltNumberFormatInsertNumbers(data,
+					      numarray,
+					      amount,
+					      &tokens,
+					      output);
+	    }
+	} else if (xmlStrEqual(data->level, (const xmlChar *) "any")) {
+	    amount = xsltNumberFormatGetAnyLevel(ctxt,
+						 node,
+						 data->count,
+						 data->from,
+						 &number, 
+						 data->doc,
+						 data->node);
+	    if (amount > 0) {
+		xsltNumberFormatInsertNumbers(data,
+					      &number,
+					      1,
+					      &tokens,
+					      output);
+	    }
+	}
+    }
+    /* Insert number as text node */
+    xsltCopyTextString(ctxt, ctxt->insert, xmlBufferContent(output), 0);
+
+    if (tokens.start != NULL)
+	xmlFree(tokens.start);
+    if (tokens.end != NULL)
+	xmlFree(tokens.end);
+    for (i = 0;i < tokens.nTokens;i++) {
+	if (tokens.tokens[i].separator != NULL)
+	    xmlFree(tokens.tokens[i].separator);
+    }
+    
+XSLT_NUMBER_FORMAT_END:
+    if (tempformat == 1) {
+	/* The format need to be recomputed each time */
+	data->format = NULL;
+    }
+    if (output != NULL)
+	xmlBufferFree(output);
+}
+
+static int
+xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltFormatNumberInfoPtr info)
+{
+    int	count=0;	/* will hold total length of prefix/suffix */
+    int len;
+
+    while (1) {
+	/* 
+	 * prefix / suffix ends at end of string or at 
+	 * first 'special' character 
+	 */
+	if (**format == 0)
+	    return count;
+	/* if next character 'escaped' just count it */
+	if (**format == SYMBOL_QUOTE) {
+	    if (*++(*format) == 0)
+		return -1;
+	}
+	else if (IS_SPECIAL(self, *format))
+	    return count;
+	/*
+	 * else treat percent/per-mille as special cases,
+	 * depending on whether +ve or -ve 
+	 */
+	else {
+	    /*
+	     * for +ve prefix/suffix, allow only a 
+	     * single occurence of either 
+	     */
+	    if (xsltUTF8Charcmp(*format, self->percent) == 0) {
+		if (info->is_multiplier_set)
+		    return -1;
+		info->multiplier = 100;
+		info->is_multiplier_set = TRUE;
+	    } else if (xsltUTF8Charcmp(*format, self->permille) == 0) {
+		if (info->is_multiplier_set)
+		    return -1;
+		info->multiplier = 1000;
+		info->is_multiplier_set = TRUE;
+	    }
+	}
+	
+	if ((len=xsltUTF8Size(*format)) < 1)
+	    return -1;
+	count += len;
+	*format += len;
+    }
+}
+	    
+/**
+ * xsltFormatNumberConversion:
+ * @self: the decimal format
+ * @format: the format requested
+ * @number: the value to format
+ * @result: the place to ouput the result
+ *
+ * format-number() uses the JDK 1.1 DecimalFormat class:
+ *
+ * http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html
+ *
+ * Structure:
+ *
+ *   pattern    := subpattern{;subpattern}
+ *   subpattern := {prefix}integer{.fraction}{suffix}
+ *   prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ *   suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ *   integer    := '#'* '0'* '0'
+ *   fraction   := '0'* '#'*
+ *
+ *   Notation:
+ *    X*       0 or more instances of X
+ *    (X | Y)  either X or Y.
+ *    X..Y     any character from X up to Y, inclusive.
+ *    S - T    characters in S, except those in T
+ *
+ * Special Characters:
+ *
+ *   Symbol Meaning
+ *   0      a digit
+ *   #      a digit, zero shows as absent
+ *   .      placeholder for decimal separator
+ *   ,      placeholder for grouping separator.
+ *   ;      separates formats.
+ *   -      default negative prefix.
+ *   %      multiply by 100 and show as percentage
+ *   ?      multiply by 1000 and show as per mille
+ *   X      any other characters can be used in the prefix or suffix
+ *   '      used to quote special characters in a prefix or suffix.
+ *
+ * Returns a possible XPath error
+ */
+xmlXPathError
+xsltFormatNumberConversion(xsltDecimalFormatPtr self,
+			   xmlChar *format,
+			   double number,
+			   xmlChar **result)
+{
+    xmlXPathError status = XPATH_EXPRESSION_OK;
+    xmlBufferPtr buffer;
+    xmlChar *the_format, *prefix = NULL, *suffix = NULL;
+    xmlChar *nprefix, *nsuffix = NULL;
+    xmlChar pchar;
+    int	    prefix_length, suffix_length = 0, nprefix_length, nsuffix_length;
+    double  scale;
+    int	    j, len;
+    int     self_grouping_len;
+    xsltFormatNumberInfo format_info;
+    /* 
+     * delayed_multiplier allows a 'trailing' percent or
+     * permille to be treated as suffix 
+     */
+    int		delayed_multiplier = 0;
+    /* flag to show no -ve format present for -ve number */
+    char	default_sign = 0;
+    /* flag to show error found, should use default format */
+    char	found_error = 0;
+
+    if (xmlStrlen(format) <= 0) {
+	xsltTransformError(NULL, NULL, NULL,
+                "xsltFormatNumberConversion : "
+		"Invalid format (0-length)\n");
+    }
+    *result = NULL;
+    switch (xmlXPathIsInf(number)) {
+	case -1:
+	    if (self->minusSign == NULL)
+		*result = xmlStrdup(BAD_CAST "-");
+	    else
+		*result = xmlStrdup(self->minusSign);
+	    /* no-break on purpose */
+	case 1:
+	    if ((self == NULL) || (self->infinity == NULL))
+		*result = xmlStrcat(*result, BAD_CAST "Infinity");
+	    else
+		*result = xmlStrcat(*result, self->infinity);
+	    return(status);
+	default:
+	    if (xmlXPathIsNaN(number)) {
+		if ((self == NULL) || (self->noNumber == NULL))
+		    *result = xmlStrdup(BAD_CAST "NaN");
+		else
+		    *result = xmlStrdup(self->noNumber);
+		return(status);
+	    }
+    }
+
+    buffer = xmlBufferCreate();
+    if (buffer == NULL) {
+	return XPATH_MEMORY_ERROR;
+    }
+
+    format_info.integer_hash = 0;
+    format_info.integer_digits = 0;
+    format_info.frac_digits = 0;
+    format_info.frac_hash = 0;
+    format_info.group = -1;
+    format_info.multiplier = 1;
+    format_info.add_decimal = FALSE;
+    format_info.is_multiplier_set = FALSE;
+    format_info.is_negative_pattern = FALSE;
+
+    the_format = format;
+
+    /*
+     * First we process the +ve pattern to get percent / permille,
+     * as well as main format 
+     */
+    prefix = the_format;
+    prefix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
+    if (prefix_length < 0) {
+	found_error = 1;
+	goto OUTPUT_NUMBER;
+    }
+
+    /* 
+     * Here we process the "number" part of the format.  It gets 
+     * a little messy because of the percent/per-mille - if that
+     * appears at the end, it may be part of the suffix instead 
+     * of part of the number, so the variable delayed_multiplier 
+     * is used to handle it 
+     */
+    self_grouping_len = xmlStrlen(self->grouping);
+    while ((*the_format != 0) &&
+	   (xsltUTF8Charcmp(the_format, self->decimalPoint) != 0) &&
+	   (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) {
+	
+	if (delayed_multiplier != 0) {
+	    format_info.multiplier = delayed_multiplier;
+	    format_info.is_multiplier_set = TRUE;
+	    delayed_multiplier = 0;
+	}
+	if (xsltUTF8Charcmp(the_format, self->digit) == 0) {
+	    if (format_info.integer_digits > 0) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    format_info.integer_hash++;
+	    if (format_info.group >= 0)
+		format_info.group++;
+	} else if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) {
+	    format_info.integer_digits++;
+	    if (format_info.group >= 0)
+		format_info.group++;
+	} else if ((self_grouping_len > 0) &&
+	    (!xmlStrncmp(the_format, self->grouping, self_grouping_len))) {
+	    /* Reset group count */
+	    format_info.group = 0;
+	    the_format += self_grouping_len;
+	    continue;
+	} else if (xsltUTF8Charcmp(the_format, self->percent) == 0) {
+	    if (format_info.is_multiplier_set) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    delayed_multiplier = 100;
+	} else  if (xsltUTF8Charcmp(the_format, self->permille) == 0) {
+	    if (format_info.is_multiplier_set) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    delayed_multiplier = 1000;
+	} else
+	    break; /* while */
+	
+	if ((len=xsltUTF8Size(the_format)) < 1) {
+	    found_error = 1;
+	    goto OUTPUT_NUMBER;
+	}
+	the_format += len;
+
+    }
+
+    /* We have finished the integer part, now work on fraction */
+    if (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) {
+        format_info.add_decimal = TRUE;
+	the_format += xsltUTF8Size(the_format);	/* Skip over the decimal */
+    }
+    
+    while (*the_format != 0) {
+	
+	if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) {
+	    if (format_info.frac_hash != 0) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    format_info.frac_digits++;
+	} else if (xsltUTF8Charcmp(the_format, self->digit) == 0) {
+	    format_info.frac_hash++;
+	} else if (xsltUTF8Charcmp(the_format, self->percent) == 0) {
+	    if (format_info.is_multiplier_set) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    delayed_multiplier = 100;
+	    if ((len = xsltUTF8Size(the_format)) < 1) {
+	        found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    the_format += len;
+	    continue; /* while */
+	} else if (xsltUTF8Charcmp(the_format, self->permille) == 0) {
+	    if (format_info.is_multiplier_set) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    delayed_multiplier = 1000;
+	    if  ((len = xsltUTF8Size(the_format)) < 1) {
+	        found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    the_format += len;
+	    continue; /* while */
+	} else if (xsltUTF8Charcmp(the_format, self->grouping) != 0) {
+	    break; /* while */
+	}
+	if ((len = xsltUTF8Size(the_format)) < 1) {
+	    found_error = 1;
+	    goto OUTPUT_NUMBER;
+	}
+	the_format += len;
+	if (delayed_multiplier != 0) {
+	    format_info.multiplier = delayed_multiplier;
+	    delayed_multiplier = 0;
+	    format_info.is_multiplier_set = TRUE;
+	}
+    }
+
+    /* 
+     * If delayed_multiplier is set after processing the 
+     * "number" part, should be in suffix 
+     */
+    if (delayed_multiplier != 0) {
+	the_format -= len;
+	delayed_multiplier = 0;
+    }
+
+    suffix = the_format;
+    suffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
+    if ( (suffix_length < 0) ||
+	 ((*the_format != 0) && 
+	  (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) ) {
+	found_error = 1;
+	goto OUTPUT_NUMBER;
+    }
+
+    /*
+     * We have processed the +ve prefix, number part and +ve suffix.
+     * If the number is -ve, we must substitute the -ve prefix / suffix
+     */
+    if (number < 0) {
+        /*
+	 * Note that j is the number of UTF8 chars before the separator,
+	 * not the number of bytes! (bug 151975)
+	 */
+        j =  xmlUTF8Strloc(format, self->patternSeparator);
+	if (j < 0) {
+	/* No -ve pattern present, so use default signing */
+	    default_sign = 1;
+	}
+	else {
+	    /* Skip over pattern separator (accounting for UTF8) */
+	    the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1);
+	    /* 
+	     * Flag changes interpretation of percent/permille 
+	     * in -ve pattern 
+	     */
+	    format_info.is_negative_pattern = TRUE;
+	    format_info.is_multiplier_set = FALSE;
+
+	    /* First do the -ve prefix */
+	    nprefix = the_format;
+	    nprefix_length = xsltFormatNumberPreSuffix(self, 
+	    				&the_format, &format_info);
+	    if (nprefix_length<0) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+
+	    while (*the_format != 0) {
+		if ( (xsltUTF8Charcmp(the_format, (self)->percent) == 0) ||
+		     (xsltUTF8Charcmp(the_format, (self)->permille)== 0) ) {
+		    if (format_info.is_multiplier_set) {
+			found_error = 1;
+			goto OUTPUT_NUMBER;
+		    }
+		    format_info.is_multiplier_set = TRUE;
+		    delayed_multiplier = 1;
+		}
+		else if (IS_SPECIAL(self, the_format))
+		    delayed_multiplier = 0;
+		else
+		    break; /* while */
+		if ((len = xsltUTF8Size(the_format)) < 1) {
+		    found_error = 1;
+		    goto OUTPUT_NUMBER;
+		}
+		the_format += len;
+	    }
+	    if (delayed_multiplier != 0) {
+		format_info.is_multiplier_set = FALSE;
+		the_format -= len;
+	    }
+
+	    /* Finally do the -ve suffix */
+	    if (*the_format != 0) {
+		nsuffix = the_format;
+		nsuffix_length = xsltFormatNumberPreSuffix(self, 
+					&the_format, &format_info);
+		if (nsuffix_length < 0) {
+		    found_error = 1;
+		    goto OUTPUT_NUMBER;
+		}
+	    }
+	    else
+		nsuffix_length = 0;
+	    if (*the_format != 0) {
+		found_error = 1;
+		goto OUTPUT_NUMBER;
+	    }
+	    /*
+	     * Here's another Java peculiarity:
+	     * if -ve prefix/suffix == +ve ones, discard & use default
+	     */
+	    if ((nprefix_length != prefix_length) ||
+	    	(nsuffix_length != suffix_length) ||
+		((nprefix_length > 0) && 
+		 (xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) ||
+		((nsuffix_length > 0) && 
+		 (xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
+	 	prefix = nprefix;
+		prefix_length = nprefix_length;
+		suffix = nsuffix;
+		suffix_length = nsuffix_length;
+	    } /* else {
+		default_sign = 1;
+	    }
+	    */
+	}
+    }
+
+OUTPUT_NUMBER:
+    if (found_error != 0) {
+	xsltTransformError(NULL, NULL, NULL,
+                "xsltFormatNumberConversion : "
+		"error in format string '%s', using default\n", format);
+	default_sign = (number < 0.0) ? 1 : 0;
+	prefix_length = suffix_length = 0;
+	format_info.integer_hash = 0;
+	format_info.integer_digits = 1;
+	format_info.frac_digits = 1;
+	format_info.frac_hash = 4;
+	format_info.group = -1;
+	format_info.multiplier = 1;
+	format_info.add_decimal = TRUE;
+    }
+
+    /* Ready to output our number.  First see if "default sign" is required */
+    if (default_sign != 0)
+	xmlBufferAdd(buffer, self->minusSign, xsltUTF8Size(self->minusSign));
+
+    /* Put the prefix into the buffer */
+    for (j = 0; j < prefix_length; j++) {
+	if ((pchar = *prefix++) == SYMBOL_QUOTE) {
+	    len = xsltUTF8Size(prefix);
+	    xmlBufferAdd(buffer, prefix, len);
+	    prefix += len;
+	    j += len - 1;	/* length of symbol less length of quote */
+	} else
+	    xmlBufferAdd(buffer, &pchar, 1);
+    }
+
+    /* Next do the integer part of the number */
+    number = fabs(number) * (double)format_info.multiplier;
+    scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash));
+    number = floor((scale * number + 0.5)) / scale;
+    if ((self->grouping != NULL) && 
+        (self->grouping[0] != 0)) {
+	
+	len = xmlStrlen(self->grouping);
+	pchar = xsltGetUTF8Char(self->grouping, &len);
+	xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
+				format_info.integer_digits,
+				format_info.group,
+				pchar, len);
+    } else
+	xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
+				format_info.integer_digits,
+				format_info.group,
+				',', 1);
+
+    /* Special case: java treats '.#' like '.0', '.##' like '.0#', etc. */
+    if ((format_info.integer_digits + format_info.integer_hash +
+	 format_info.frac_digits == 0) && (format_info.frac_hash > 0)) {
+        ++format_info.frac_digits;
+	--format_info.frac_hash;
+    }
+
+    /* Add leading zero, if required */
+    if ((floor(number) == 0) &&
+	(format_info.integer_digits + format_info.frac_digits == 0)) {
+        xmlBufferAdd(buffer, self->zeroDigit, xsltUTF8Size(self->zeroDigit));
+    }
+
+    /* Next the fractional part, if required */
+    if (format_info.frac_digits + format_info.frac_hash == 0) {
+        if (format_info.add_decimal)
+	    xmlBufferAdd(buffer, self->decimalPoint, 
+	    		 xsltUTF8Size(self->decimalPoint));
+    }
+    else {
+      number -= floor(number);
+	if ((number != 0) || (format_info.frac_digits != 0)) {
+	    xmlBufferAdd(buffer, self->decimalPoint,
+	    		 xsltUTF8Size(self->decimalPoint));
+	    number = floor(scale * number + 0.5);
+	    for (j = format_info.frac_hash; j > 0; j--) {
+		if (fmod(number, 10.0) >= 1.0)
+		    break; /* for */
+		number /= 10.0;
+	    }
+	    xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
+				format_info.frac_digits + j,
+				0, 0, 0);
+	}
+    }
+    /* Put the suffix into the buffer */
+    for (j = 0; j < suffix_length; j++) {
+	if ((pchar = *suffix++) == SYMBOL_QUOTE) {
+            len = xsltUTF8Size(suffix);
+	    xmlBufferAdd(buffer, suffix, len);
+	    suffix += len;
+	    j += len - 1;	/* length of symbol less length of escape */
+	} else
+	    xmlBufferAdd(buffer, &pchar, 1);
+    }
+
+    *result = xmlStrdup(xmlBufferContent(buffer));
+    xmlBufferFree(buffer);
+    return status;
+}
+
diff --git a/third_party/libxslt/libxslt/numbersInternals.h b/third_party/libxslt/libxslt/numbersInternals.h
new file mode 100644
index 0000000..7b3cb17
--- /dev/null
+++ b/third_party/libxslt/libxslt/numbersInternals.h
@@ -0,0 +1,69 @@
+/*
+ * Summary: Implementation of the XSLT number functions
+ * Description: Implementation of the XSLT number functions
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Bjorn Reese  and Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_NUMBERSINTERNALS_H__
+#define __XML_XSLT_NUMBERSINTERNALS_H__
+
+#include 
+#include "xsltexports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * xsltNumberData:
+ *
+ * This data structure is just a wrapper to pass xsl:number data in.
+ */
+typedef struct _xsltNumberData xsltNumberData;
+typedef xsltNumberData *xsltNumberDataPtr;
+    
+struct _xsltNumberData {
+    const xmlChar *level;
+    const xmlChar *count;
+    const xmlChar *from;
+    const xmlChar *value;
+    const xmlChar *format;
+    int has_format;
+    int digitsPerGroup;
+    int groupingCharacter;
+    int groupingCharacterLen;
+    xmlDocPtr doc;
+    xmlNodePtr node;
+
+    /*
+     * accelerators
+     */
+};
+
+/**
+ * xsltFormatNumberInfo,:
+ *
+ * This data structure lists the various parameters needed to format numbers.
+ */
+typedef struct _xsltFormatNumberInfo xsltFormatNumberInfo;
+typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr;
+
+struct _xsltFormatNumberInfo {
+    int	    integer_hash;	/* Number of '#' in integer part */
+    int	    integer_digits;	/* Number of '0' in integer part */
+    int	    frac_digits;	/* Number of '0' in fractional part */
+    int	    frac_hash;		/* Number of '#' in fractional part */
+    int	    group;		/* Number of chars per display 'group' */
+    int     multiplier;		/* Scaling for percent or permille */
+    char    add_decimal;	/* Flag for whether decimal point appears in pattern */
+    char    is_multiplier_set;	/* Flag to catch multiple occurences of percent/permille */
+    char    is_negative_pattern;/* Flag for processing -ve prefix/suffix */
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_XSLT_NUMBERSINTERNALS_H__ */
diff --git a/third_party/libxslt/libxslt/pattern.c b/third_party/libxslt/libxslt/pattern.c
new file mode 100644
index 0000000..419fa3d
--- /dev/null
+++ b/third_party/libxslt/libxslt/pattern.c
@@ -0,0 +1,2619 @@
+/*
+ * pattern.c: Implemetation of the template match compilation and lookup
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+/*
+ * TODO: handle pathological cases like *[*[@a="b"]]
+ * TODO: detect [number] at compilation, optimize accordingly
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "imports.h"
+#include "templates.h"
+#include "keys.h"
+#include "pattern.h"
+#include "documents.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_PATTERN
+#endif
+
+/*
+ * Types are private:
+ */
+
+typedef enum {
+    XSLT_OP_END=0,
+    XSLT_OP_ROOT,
+    XSLT_OP_ELEM,
+    XSLT_OP_CHILD,
+    XSLT_OP_ATTR,
+    XSLT_OP_PARENT,
+    XSLT_OP_ANCESTOR,
+    XSLT_OP_ID,
+    XSLT_OP_KEY,
+    XSLT_OP_NS,
+    XSLT_OP_ALL,
+    XSLT_OP_PI,
+    XSLT_OP_COMMENT,
+    XSLT_OP_TEXT,
+    XSLT_OP_NODE,
+    XSLT_OP_PREDICATE
+} xsltOp;
+
+typedef struct _xsltStepState xsltStepState;
+typedef xsltStepState *xsltStepStatePtr;
+struct _xsltStepState {
+    int step;
+    xmlNodePtr node;
+};
+
+typedef struct _xsltStepStates xsltStepStates;
+typedef xsltStepStates *xsltStepStatesPtr;
+struct _xsltStepStates {
+    int nbstates;
+    int maxstates;
+    xsltStepStatePtr states;
+};
+
+typedef struct _xsltStepOp xsltStepOp;
+typedef xsltStepOp *xsltStepOpPtr;
+struct _xsltStepOp {
+    xsltOp op;
+    xmlChar *value;
+    xmlChar *value2;
+    xmlChar *value3;
+    xmlXPathCompExprPtr comp;
+    /*
+     * Optimisations for count
+     */
+    int        previousExtra;
+    int        indexExtra;
+    int        lenExtra;
+};
+
+struct _xsltCompMatch {
+    struct _xsltCompMatch *next; /* siblings in the name hash */
+    float priority;              /* the priority */
+    const xmlChar *pattern;       /* the pattern */
+    const xmlChar *mode;         /* the mode */
+    const xmlChar *modeURI;      /* the mode URI */
+    xsltTemplatePtr template;    /* the associated template */
+
+    int direct;
+    /* TODO fix the statically allocated size steps[] */
+    int nbStep;
+    int maxStep;
+    xmlNsPtr *nsList;		/* the namespaces in scope */
+    int nsNr;			/* the number of namespaces in scope */
+    xsltStepOpPtr steps;        /* ops for computation */
+};
+
+typedef struct _xsltParserContext xsltParserContext;
+typedef xsltParserContext *xsltParserContextPtr;
+struct _xsltParserContext {
+    xsltStylesheetPtr style;		/* the stylesheet */
+    xsltTransformContextPtr ctxt;	/* the transformation or NULL */
+    const xmlChar *cur;			/* the current char being parsed */
+    const xmlChar *base;		/* the full expression */
+    xmlDocPtr      doc;			/* the source document */
+    xmlNodePtr    elem;			/* the source element */
+    int error;				/* error code */
+    xsltCompMatchPtr comp;		/* the result */
+};
+
+/************************************************************************
+ * 									*
+ * 			Type functions 					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltNewCompMatch:
+ *
+ * Create a new XSLT CompMatch
+ *
+ * Returns the newly allocated xsltCompMatchPtr or NULL in case of error
+ */
+static xsltCompMatchPtr
+xsltNewCompMatch(void) {
+    xsltCompMatchPtr cur;
+
+    cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewCompMatch : out of memory error\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltCompMatch));
+    cur->maxStep = 10;
+    cur->nbStep = 0;
+    cur-> steps = (xsltStepOpPtr) xmlMalloc(sizeof(xsltStepOp) *
+                                            cur->maxStep);
+    if (cur->steps == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewCompMatch : out of memory error\n");
+	xmlFree(cur);
+	return(NULL);
+    }
+    cur->nsNr = 0;
+    cur->nsList = NULL;
+    cur->direct = 0;
+    return(cur);
+}
+
+/**
+ * xsltFreeCompMatch:
+ * @comp:  an XSLT comp
+ *
+ * Free up the memory allocated by @comp
+ */
+static void
+xsltFreeCompMatch(xsltCompMatchPtr comp) {
+    xsltStepOpPtr op;
+    int i;
+
+    if (comp == NULL)
+	return;
+    if (comp->pattern != NULL)
+	xmlFree((xmlChar *)comp->pattern);
+    if (comp->nsList != NULL)
+	xmlFree(comp->nsList);
+    for (i = 0;i < comp->nbStep;i++) {
+	op = &comp->steps[i];
+	if (op->value != NULL)
+	    xmlFree(op->value);
+	if (op->value2 != NULL)
+	    xmlFree(op->value2);
+	if (op->value3 != NULL)
+	    xmlFree(op->value3);
+	if (op->comp != NULL)
+	    xmlXPathFreeCompExpr(op->comp);
+    }
+    xmlFree(comp->steps);
+    memset(comp, -1, sizeof(xsltCompMatch));
+    xmlFree(comp);
+}
+
+/**
+ * xsltFreeCompMatchList:
+ * @comp:  an XSLT comp list
+ *
+ * Free up the memory allocated by all the elements of @comp
+ */
+void
+xsltFreeCompMatchList(xsltCompMatchPtr comp) {
+    xsltCompMatchPtr cur;
+
+    while (comp != NULL) {
+	cur = comp;
+	comp = comp->next;
+	xsltFreeCompMatch(cur);
+    }
+}
+
+/**
+ * xsltNormalizeCompSteps:
+ * @payload: pointer to template hash table entry
+ * @data: pointer to the stylesheet
+ * @name: template match name
+ *
+ * This is a hashtable scanner function to normalize the compiled
+ * steps of an imported stylesheet.
+ */
+void xsltNormalizeCompSteps(void *payload,
+        void *data, const xmlChar *name ATTRIBUTE_UNUSED) {
+    xsltCompMatchPtr comp = payload;
+    xsltStylesheetPtr style = data;
+    int ix;
+
+    for (ix = 0; ix < comp->nbStep; ix++) {
+        comp->steps[ix].previousExtra += style->extrasNr;
+        comp->steps[ix].indexExtra += style->extrasNr;
+        comp->steps[ix].lenExtra += style->extrasNr;
+    }
+}
+
+/**
+ * xsltNewParserContext:
+ * @style:  the stylesheet
+ * @ctxt:  the transformation context, if done at run-time
+ *
+ * Create a new XSLT ParserContext
+ *
+ * Returns the newly allocated xsltParserContextPtr or NULL in case of error
+ */
+static xsltParserContextPtr
+xsltNewParserContext(xsltStylesheetPtr style, xsltTransformContextPtr ctxt) {
+    xsltParserContextPtr cur;
+
+    cur = (xsltParserContextPtr) xmlMalloc(sizeof(xsltParserContext));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewParserContext : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltParserContext));
+    cur->style = style;
+    cur->ctxt = ctxt;
+    return(cur);
+}
+
+/**
+ * xsltFreeParserContext:
+ * @ctxt:  an XSLT parser context
+ *
+ * Free up the memory allocated by @ctxt
+ */
+static void
+xsltFreeParserContext(xsltParserContextPtr ctxt) {
+    if (ctxt == NULL)
+	return;
+    memset(ctxt, -1, sizeof(xsltParserContext));
+    xmlFree(ctxt);
+}
+
+/**
+ * xsltCompMatchAdd:
+ * @comp:  the compiled match expression
+ * @op:  an op
+ * @value:  the first value
+ * @value2:  the second value
+ * @novar:  flag to set XML_XPATH_NOVAR
+ *
+ * Add an step to an XSLT Compiled Match
+ *
+ * Returns -1 in case of failure, 0 otherwise.
+ */
+static int
+xsltCompMatchAdd(xsltParserContextPtr ctxt, xsltCompMatchPtr comp,
+                 xsltOp op, xmlChar * value, xmlChar * value2, int novar)
+{
+    if (comp->nbStep >= comp->maxStep) {
+        xsltStepOpPtr tmp;
+
+	tmp = (xsltStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 *
+	                                 sizeof(xsltStepOp));
+	if (tmp == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltCompMatchAdd: memory re-allocation failure.\n");
+	    if (ctxt->style != NULL)
+		ctxt->style->errors++;
+	    return (-1);
+	}
+        comp->maxStep *= 2;
+	comp->steps = tmp;
+    }
+    comp->steps[comp->nbStep].op = op;
+    comp->steps[comp->nbStep].value = value;
+    comp->steps[comp->nbStep].value2 = value2;
+    comp->steps[comp->nbStep].value3 = NULL;
+    comp->steps[comp->nbStep].comp = NULL;
+    if (ctxt->ctxt != NULL) {
+	comp->steps[comp->nbStep].previousExtra =
+	    xsltAllocateExtraCtxt(ctxt->ctxt);
+	comp->steps[comp->nbStep].indexExtra =
+	    xsltAllocateExtraCtxt(ctxt->ctxt);
+	comp->steps[comp->nbStep].lenExtra =
+	    xsltAllocateExtraCtxt(ctxt->ctxt);
+    } else {
+	comp->steps[comp->nbStep].previousExtra =
+	    xsltAllocateExtra(ctxt->style);
+	comp->steps[comp->nbStep].indexExtra =
+	    xsltAllocateExtra(ctxt->style);
+	comp->steps[comp->nbStep].lenExtra =
+	    xsltAllocateExtra(ctxt->style);
+    }
+    if (op == XSLT_OP_PREDICATE) {
+	xmlXPathContextPtr xctxt;
+
+	if (ctxt->style != NULL)
+	    xctxt = xmlXPathNewContext(ctxt->style->doc);
+	else
+	    xctxt = xmlXPathNewContext(NULL);
+#ifdef XML_XPATH_NOVAR
+	if (novar != 0)
+	    xctxt->flags = XML_XPATH_NOVAR;
+#endif
+	if (ctxt->style != NULL)
+	    xctxt->dict = ctxt->style->dict;
+	comp->steps[comp->nbStep].comp = xmlXPathCtxtCompile(xctxt, value);
+	xmlXPathFreeContext(xctxt);
+	if (comp->steps[comp->nbStep].comp == NULL) {
+	    xsltTransformError(NULL, ctxt->style, ctxt->elem,
+		    "Failed to compile predicate\n");
+	    if (ctxt->style != NULL)
+		ctxt->style->errors++;
+	}
+    }
+    comp->nbStep++;
+    return (0);
+}
+
+/**
+ * xsltSwapTopCompMatch:
+ * @comp:  the compiled match expression
+ *
+ * reverse the two top steps.
+ */
+static void
+xsltSwapTopCompMatch(xsltCompMatchPtr comp) {
+    int i;
+    int j = comp->nbStep - 1;
+
+    if (j > 0) {
+	register xmlChar *tmp;
+	register xsltOp op;
+	register xmlXPathCompExprPtr expr; 
+	register int t;
+	i = j - 1;
+	tmp = comp->steps[i].value;
+	comp->steps[i].value = comp->steps[j].value;
+	comp->steps[j].value = tmp;
+	tmp = comp->steps[i].value2;
+	comp->steps[i].value2 = comp->steps[j].value2;
+	comp->steps[j].value2 = tmp;
+	tmp = comp->steps[i].value3;
+	comp->steps[i].value3 = comp->steps[j].value3;
+	comp->steps[j].value3 = tmp;
+	op = comp->steps[i].op;
+	comp->steps[i].op = comp->steps[j].op;
+	comp->steps[j].op = op;
+	expr = comp->steps[i].comp;
+	comp->steps[i].comp = comp->steps[j].comp;
+	comp->steps[j].comp = expr;
+	t = comp->steps[i].previousExtra;
+	comp->steps[i].previousExtra = comp->steps[j].previousExtra;
+	comp->steps[j].previousExtra = t;
+	t = comp->steps[i].indexExtra;
+	comp->steps[i].indexExtra = comp->steps[j].indexExtra;
+	comp->steps[j].indexExtra = t;
+	t = comp->steps[i].lenExtra;
+	comp->steps[i].lenExtra = comp->steps[j].lenExtra;
+	comp->steps[j].lenExtra = t;
+    }
+}
+
+/**
+ * xsltReverseCompMatch:
+ * @ctxt: the parser context
+ * @comp:  the compiled match expression
+ *
+ * reverse all the stack of expressions
+ */
+static void
+xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) {
+    int i = 0;
+    int j = comp->nbStep - 1;
+
+    while (j > i) {
+	register xmlChar *tmp;
+	register xsltOp op;
+	register xmlXPathCompExprPtr expr;
+	register int t;
+
+	tmp = comp->steps[i].value;
+	comp->steps[i].value = comp->steps[j].value;
+	comp->steps[j].value = tmp;
+	tmp = comp->steps[i].value2;
+	comp->steps[i].value2 = comp->steps[j].value2;
+	comp->steps[j].value2 = tmp;
+	tmp = comp->steps[i].value3;
+	comp->steps[i].value3 = comp->steps[j].value3;
+	comp->steps[j].value3 = tmp;
+	op = comp->steps[i].op;
+	comp->steps[i].op = comp->steps[j].op;
+	comp->steps[j].op = op;
+	expr = comp->steps[i].comp;
+	comp->steps[i].comp = comp->steps[j].comp;
+	comp->steps[j].comp = expr;
+	t = comp->steps[i].previousExtra;
+	comp->steps[i].previousExtra = comp->steps[j].previousExtra;
+	comp->steps[j].previousExtra = t;
+	t = comp->steps[i].indexExtra;
+	comp->steps[i].indexExtra = comp->steps[j].indexExtra;
+	comp->steps[j].indexExtra = t;
+	t = comp->steps[i].lenExtra;
+	comp->steps[i].lenExtra = comp->steps[j].lenExtra;
+	comp->steps[j].lenExtra = t;
+	j--;
+	i++;
+    }
+    xsltCompMatchAdd(ctxt, comp, XSLT_OP_END, NULL, NULL, 0);
+
+    /*
+     * detect consecutive XSLT_OP_PREDICATE indicating a direct
+     * matching should be done.
+     */
+    for (i = 0;i < comp->nbStep - 1;i++) {
+        if ((comp->steps[i].op == XSLT_OP_PREDICATE) &&
+	    (comp->steps[i + 1].op == XSLT_OP_PREDICATE)) {
+
+	    comp->direct = 1;
+	    if (comp->pattern[0] != '/') {
+		xmlChar *query;
+
+		query = xmlStrdup((const xmlChar *)"//");
+		query = xmlStrcat(query, comp->pattern);
+
+		xmlFree((xmlChar *) comp->pattern);
+		comp->pattern = query;
+	    }
+	    break;
+	}
+    }
+}
+
+/************************************************************************
+ * 									*
+ * 		The interpreter for the precompiled patterns		*
+ * 									*
+ ************************************************************************/
+
+static int
+xsltPatPushState(xsltTransformContextPtr ctxt, xsltStepStates *states,
+                 int step, xmlNodePtr node) {
+    if ((states->states == NULL) || (states->maxstates <= 0)) {
+        states->maxstates = 4;
+	states->nbstates = 0;
+	states->states = xmlMalloc(4 * sizeof(xsltStepState));
+    }
+    else if (states->maxstates <= states->nbstates) {
+        xsltStepState *tmp;
+
+	tmp = (xsltStepStatePtr) xmlRealloc(states->states,
+			       2 * states->maxstates * sizeof(xsltStepState));
+	if (tmp == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltPatPushState: memory re-allocation failure.\n");
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    return(-1);
+	}
+	states->states = tmp;
+	states->maxstates *= 2;
+    }
+    states->states[states->nbstates].step = step;
+    states->states[states->nbstates++].node = node;
+#if 0
+    fprintf(stderr, "Push: %d, %s\n", step, node->name);
+#endif
+    return(0);
+}
+
+/**
+ * xsltTestCompMatchDirect:
+ * @ctxt:  a XSLT process context
+ * @comp: the precompiled pattern
+ * @node: a node
+ * @nsList: the namespaces in scope
+ * @nsNr: the number of namespaces in scope
+ *
+ * Test whether the node matches the pattern, do a direct evalutation
+ * and not a step by step evaluation.
+ *
+ * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure
+ */
+static int
+xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
+	                xmlNodePtr node, xmlNsPtr *nsList, int nsNr) {
+    xsltStepOpPtr sel = NULL;
+    xmlDocPtr prevdoc;
+    xmlDocPtr doc;
+    xmlXPathObjectPtr list;
+    int ix, j;
+    int nocache = 0;
+    int isRVT;
+
+    doc = node->doc;
+    if (XSLT_IS_RES_TREE_FRAG(doc))
+	isRVT = 1;
+    else
+	isRVT = 0;
+    sel = &comp->steps[0]; /* store extra in first step arbitrarily */
+
+    prevdoc = (xmlDocPtr)
+	XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+    ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
+    list = (xmlXPathObjectPtr)
+	XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
+    
+    if ((list == NULL) || (prevdoc != doc)) {
+	xmlXPathObjectPtr newlist;
+	xmlNodePtr parent = node->parent;
+	xmlDocPtr olddoc;
+	xmlNodePtr oldnode;
+	int oldNsNr;
+	xmlNsPtr *oldNamespaces;
+
+	oldnode = ctxt->xpathCtxt->node;
+	olddoc = ctxt->xpathCtxt->doc;
+	oldNsNr = ctxt->xpathCtxt->nsNr;
+	oldNamespaces = ctxt->xpathCtxt->namespaces;
+	ctxt->xpathCtxt->node = node;
+	ctxt->xpathCtxt->doc = doc;
+	ctxt->xpathCtxt->namespaces = nsList;
+	ctxt->xpathCtxt->nsNr = nsNr;
+	newlist = xmlXPathEval(comp->pattern, ctxt->xpathCtxt);
+	ctxt->xpathCtxt->node = oldnode;
+	ctxt->xpathCtxt->doc = olddoc;
+	ctxt->xpathCtxt->namespaces = oldNamespaces;
+	ctxt->xpathCtxt->nsNr = oldNsNr;
+	if (newlist == NULL)
+	    return(-1);
+	if (newlist->type != XPATH_NODESET) {
+	    xmlXPathFreeObject(newlist);
+	    return(-1);
+	}
+	ix = 0;
+
+	if ((parent == NULL) || (node->doc == NULL) || isRVT)
+	    nocache = 1;
+	
+	if (nocache == 0) {
+	    if (list != NULL)
+		xmlXPathFreeObject(list);
+	    list = newlist;
+
+	    XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) =
+		(void *) list;
+	    XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
+		(void *) doc;
+	    XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
+		0;
+	    XSLT_RUNTIME_EXTRA_FREE(ctxt, sel->lenExtra) =
+		(xmlFreeFunc) xmlXPathFreeObject;
+	} else
+	    list = newlist;
+    }
+    if ((list->nodesetval == NULL) ||
+	(list->nodesetval->nodeNr <= 0)) {
+	if (nocache == 1)
+	    xmlXPathFreeObject(list);
+	return(0);
+    }
+    /* TODO: store the index and use it for the scan */
+    if (ix == 0) {
+	for (j = 0;j < list->nodesetval->nodeNr;j++) {
+	    if (list->nodesetval->nodeTab[j] == node) {
+		if (nocache == 1)
+		    xmlXPathFreeObject(list);
+		return(1);
+	    }
+	}
+    } else {
+    }
+    if (nocache == 1)
+	xmlXPathFreeObject(list);
+    return(0);
+}
+
+/**
+ * xsltTestCompMatch:
+ * @ctxt:  a XSLT process context
+ * @comp: the precompiled pattern
+ * @node: a node
+ * @mode:  the mode name or NULL
+ * @modeURI:  the mode URI or NULL
+ *
+ * Test whether the node matches the pattern
+ *
+ * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure
+ */
+static int
+xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
+	          xmlNodePtr node, const xmlChar *mode,
+		  const xmlChar *modeURI) {
+    int i;
+    xsltStepOpPtr step, sel = NULL;
+    xsltStepStates states = {0, 0, NULL}; /* // may require backtrack */
+
+    if ((comp == NULL) || (node == NULL) || (ctxt == NULL)) {
+	xsltTransformError(ctxt, NULL, node,
+		"xsltTestCompMatch: null arg\n");
+        return(-1);
+    }
+    if (mode != NULL) {
+	if (comp->mode == NULL)
+	    return(0);
+	/*
+	 * both mode strings must be interned on the stylesheet dictionary
+	 */
+	if (comp->mode != mode)
+	    return(0);
+    } else {
+	if (comp->mode != NULL)
+	    return(0);
+    }
+    if (modeURI != NULL) {
+	if (comp->modeURI == NULL)
+	    return(0);
+	/*
+	 * both modeURI strings must be interned on the stylesheet dictionary
+	 */
+	if (comp->modeURI != modeURI)
+	    return(0);
+    } else {
+	if (comp->modeURI != NULL)
+	    return(0);
+    }
+
+    i = 0;
+restart:
+    for (;i < comp->nbStep;i++) {
+	step = &comp->steps[i];
+	if (step->op != XSLT_OP_PREDICATE)
+	    sel = step;
+	switch (step->op) {
+            case XSLT_OP_END:
+		goto found;
+            case XSLT_OP_ROOT:
+		if ((node->type == XML_DOCUMENT_NODE) ||
+#ifdef LIBXML_DOCB_ENABLED
+		    (node->type == XML_DOCB_DOCUMENT_NODE) ||
+#endif
+		    (node->type == XML_HTML_DOCUMENT_NODE))
+		    continue;
+		if ((node->type == XML_ELEMENT_NODE) && (node->name[0] == ' '))
+		    continue;
+		goto rollback;
+            case XSLT_OP_ELEM:
+		if (node->type != XML_ELEMENT_NODE)
+		    goto rollback;
+		if (step->value == NULL)
+		    continue;
+		if (step->value[0] != node->name[0])
+		    goto rollback;
+		if (!xmlStrEqual(step->value, node->name))
+		    goto rollback;
+
+		/* Namespace test */
+		if (node->ns == NULL) {
+		    if (step->value2 != NULL)
+			goto rollback;
+		} else if (node->ns->href != NULL) {
+		    if (step->value2 == NULL)
+			goto rollback;
+		    if (!xmlStrEqual(step->value2, node->ns->href))
+			goto rollback;
+		}
+		continue;
+            case XSLT_OP_CHILD: {
+		xmlNodePtr lst;
+
+		if ((node->type != XML_ELEMENT_NODE) &&
+		    (node->type != XML_DOCUMENT_NODE) &&
+#ifdef LIBXML_DOCB_ENABLED
+		    (node->type != XML_DOCB_DOCUMENT_NODE) &&
+#endif
+		    (node->type != XML_HTML_DOCUMENT_NODE))
+		    goto rollback;
+
+		lst = node->children;
+
+		if (step->value != NULL) {
+		    while (lst != NULL) {
+			if ((lst->type == XML_ELEMENT_NODE) &&
+			    (step->value[0] == lst->name[0]) &&
+			    (xmlStrEqual(step->value, lst->name)))
+			    break;
+			lst = lst->next;
+		    }
+		    if (lst != NULL)
+			continue;
+		}
+		goto rollback;
+	    }
+            case XSLT_OP_ATTR:
+		if (node->type != XML_ATTRIBUTE_NODE)
+		    goto rollback;
+		if (step->value != NULL) {
+		    if (step->value[0] != node->name[0])
+			goto rollback;
+		    if (!xmlStrEqual(step->value, node->name))
+			goto rollback;
+		}
+		/* Namespace test */
+		if (node->ns == NULL) {
+		    if (step->value2 != NULL)
+			goto rollback;
+		} else if (step->value2 != NULL) {
+		    if (!xmlStrEqual(step->value2, node->ns->href))
+			goto rollback;
+		}
+		continue;
+            case XSLT_OP_PARENT:
+		if ((node->type == XML_DOCUMENT_NODE) ||
+		    (node->type == XML_HTML_DOCUMENT_NODE) ||
+#ifdef LIBXML_DOCB_ENABLED
+		    (node->type == XML_DOCB_DOCUMENT_NODE) ||
+#endif
+		    (node->type == XML_NAMESPACE_DECL))
+		    goto rollback;
+		node = node->parent;
+		if (node == NULL)
+		    goto rollback;
+		if (step->value == NULL)
+		    continue;
+		if (step->value[0] != node->name[0])
+		    goto rollback;
+		if (!xmlStrEqual(step->value, node->name))
+		    goto rollback;
+		/* Namespace test */
+		if (node->ns == NULL) {
+		    if (step->value2 != NULL)
+			goto rollback;
+		} else if (node->ns->href != NULL) {
+		    if (step->value2 == NULL)
+			goto rollback;
+		    if (!xmlStrEqual(step->value2, node->ns->href))
+			goto rollback;
+		}
+		continue;
+            case XSLT_OP_ANCESTOR:
+		/* TODO: implement coalescing of ANCESTOR/NODE ops */
+		if (step->value == NULL) {
+		    step = &comp->steps[i+1];
+		    if (step->op == XSLT_OP_ROOT)
+			goto found;
+		    /* added NS, ID and KEY as a result of bug 168208 */
+		    if ((step->op != XSLT_OP_ELEM) && 
+			(step->op != XSLT_OP_ALL) && 
+			(step->op != XSLT_OP_NS) &&
+			(step->op != XSLT_OP_ID) &&
+			(step->op != XSLT_OP_KEY))
+			goto rollback;
+		}
+		if (node == NULL)
+		    goto rollback;
+		if ((node->type == XML_DOCUMENT_NODE) ||
+		    (node->type == XML_HTML_DOCUMENT_NODE) ||
+#ifdef LIBXML_DOCB_ENABLED
+		    (node->type == XML_DOCB_DOCUMENT_NODE) ||
+#endif
+		    (node->type == XML_NAMESPACE_DECL))
+		    goto rollback;
+		node = node->parent;
+		if ((step->op != XSLT_OP_ELEM) && step->op != XSLT_OP_ALL) {
+		    xsltPatPushState(ctxt, &states, i, node);
+		    continue;
+		}
+		i++;
+		if (step->value == NULL) {
+		    xsltPatPushState(ctxt, &states, i - 1, node);
+		    continue;
+		}
+		while (node != NULL) {
+		    if ((node->type == XML_ELEMENT_NODE) &&
+			(step->value[0] == node->name[0]) &&
+			(xmlStrEqual(step->value, node->name))) {
+			/* Namespace test */
+			if (node->ns == NULL) {
+			    if (step->value2 == NULL)
+				break;
+			} else if (node->ns->href != NULL) {
+			    if ((step->value2 != NULL) &&
+			        (xmlStrEqual(step->value2, node->ns->href)))
+				break;
+			}
+		    }
+		    node = node->parent;
+		}
+		if (node == NULL)
+		    goto rollback;
+		xsltPatPushState(ctxt, &states, i - 1, node);
+		continue;
+            case XSLT_OP_ID: {
+		/* TODO Handle IDs decently, must be done differently */
+		xmlAttrPtr id;
+
+		if (node->type != XML_ELEMENT_NODE)
+		    goto rollback;
+
+		id = xmlGetID(node->doc, step->value);
+		if ((id == NULL) || (id->parent != node))
+		    goto rollback;
+		break;
+	    }
+            case XSLT_OP_KEY: {
+		xmlNodeSetPtr list;
+		int indx;
+
+		list = xsltGetKey(ctxt, step->value,
+			          step->value3, step->value2);
+		if (list == NULL)
+		    goto rollback;
+		for (indx = 0;indx < list->nodeNr;indx++)
+		    if (list->nodeTab[indx] == node)
+			break;
+		if (indx >= list->nodeNr)
+		    goto rollback;
+		break;
+	    }
+            case XSLT_OP_NS:
+		if (node->type != XML_ELEMENT_NODE)
+		    goto rollback;
+		if (node->ns == NULL) {
+		    if (step->value != NULL)
+			goto rollback;
+		} else if (node->ns->href != NULL) {
+		    if (step->value == NULL)
+			goto rollback;
+		    if (!xmlStrEqual(step->value, node->ns->href))
+			goto rollback;
+		}
+		break;
+            case XSLT_OP_ALL:
+		if (node->type != XML_ELEMENT_NODE)
+		    goto rollback;
+		break;
+	    case XSLT_OP_PREDICATE: {
+		xmlNodePtr oldNode;
+		xmlDocPtr doc;
+		int oldCS, oldCP;
+		int pos = 0, len = 0;
+		int isRVT;
+
+		/*
+		 * when there is cascading XSLT_OP_PREDICATE, then use a
+		 * direct computation approach. It's not done directly
+		 * at the beginning of the routine to filter out as much
+		 * as possible this costly computation.
+		 */
+		if (comp->direct) {
+		    if (states.states != NULL) {
+			/* Free the rollback states */
+			xmlFree(states.states);
+		    }
+		    return(xsltTestCompMatchDirect(ctxt, comp, node,
+		    				   comp->nsList, comp->nsNr));
+		}
+
+		doc = node->doc;
+		if (XSLT_IS_RES_TREE_FRAG(doc))
+		    isRVT = 1;
+		else
+		    isRVT = 0;
+
+		/*
+		 * Depending on the last selection, one may need to
+		 * recompute contextSize and proximityPosition.
+		 */
+		oldCS = ctxt->xpathCtxt->contextSize;
+		oldCP = ctxt->xpathCtxt->proximityPosition;
+		if ((sel != NULL) &&
+		    (sel->op == XSLT_OP_ELEM) &&
+		    (sel->value != NULL) &&
+		    (node->type == XML_ELEMENT_NODE) &&
+		    (node->parent != NULL)) {
+		    xmlNodePtr previous;
+		    int ix, nocache = 0;
+
+		    previous = (xmlNodePtr)
+			XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+		    ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
+		    if ((previous != NULL) &&
+			(previous->parent == node->parent)) {
+			/*
+			 * just walk back to adjust the index
+			 */
+			int indx = 0;
+			xmlNodePtr sibling = node;
+
+			while (sibling != NULL) {
+			    if (sibling == previous)
+				break;
+			    if ((previous->type == XML_ELEMENT_NODE) &&
+				(previous->name != NULL) &&
+				(sibling->name != NULL) &&
+				(previous->name[0] == sibling->name[0]) &&
+				(xmlStrEqual(previous->name, sibling->name)))
+			    {
+				if ((sel->value2 == NULL) ||
+				    ((sibling->ns != NULL) &&
+				     (xmlStrEqual(sel->value2,
+						  sibling->ns->href))))
+				    indx++;
+			    }
+			    sibling = sibling->prev;
+			}
+			if (sibling == NULL) {
+			    /* hum going backward in document order ... */
+			    indx = 0;
+			    sibling = node;
+			    while (sibling != NULL) {
+				if (sibling == previous)
+				    break;
+				if ((previous->type == XML_ELEMENT_NODE) &&
+				    (previous->name != NULL) &&
+				    (sibling->name != NULL) &&
+				    (previous->name[0] == sibling->name[0]) &&
+				    (xmlStrEqual(previous->name, sibling->name)))
+				{
+				    if ((sel->value2 == NULL) ||
+					((sibling->ns != NULL) &&
+					(xmlStrEqual(sel->value2,
+					sibling->ns->href))))
+				    {
+					indx--;
+				    }
+				}
+				sibling = sibling->next;
+			    }
+			}
+			if (sibling != NULL) {
+			    pos = ix + indx;
+			    /*
+			     * If the node is in a Value Tree we need to
+			     * save len, but cannot cache the node!
+			     * (bugs 153137 and 158840)
+			     */
+			    if (node->doc != NULL) {
+				len = XSLT_RUNTIME_EXTRA(ctxt,
+				        sel->lenExtra, ival);
+				if (!isRVT) {
+				    XSLT_RUNTIME_EXTRA(ctxt,
+					sel->previousExtra, ptr) = node;
+				    XSLT_RUNTIME_EXTRA(ctxt,
+				        sel->indexExtra, ival) = pos;
+				}
+			    }
+			    ix = pos;
+			} else
+			    pos = 0;
+		    } else {
+			/*
+			 * recompute the index
+			 */
+			xmlNodePtr siblings = node->parent->children;
+			xmlNodePtr parent = node->parent;
+
+			while (siblings != NULL) {
+			    if (siblings->type == XML_ELEMENT_NODE) {
+				if (siblings == node) {
+				    len++;
+				    pos = len;
+				} else if ((node->name != NULL) &&
+					   (siblings->name != NULL) &&
+				    (node->name[0] == siblings->name[0]) &&
+				    (xmlStrEqual(node->name, siblings->name))) {
+				    if ((sel->value2 == NULL) ||
+					((siblings->ns != NULL) &&
+					 (xmlStrEqual(sel->value2,
+						      siblings->ns->href))))
+					len++;
+				}
+			    }
+			    siblings = siblings->next;
+			}
+			if ((parent == NULL) || (node->doc == NULL))
+			    nocache = 1;
+			else {
+			    while (parent->parent != NULL)
+				parent = parent->parent;
+			    if (((parent->type != XML_DOCUMENT_NODE) &&
+				 (parent->type != XML_HTML_DOCUMENT_NODE)) ||
+				 (parent != (xmlNodePtr) node->doc))
+				nocache = 1;
+			}
+		    }
+		    if (pos != 0) {
+			ctxt->xpathCtxt->contextSize = len;
+			ctxt->xpathCtxt->proximityPosition = pos;
+			/*
+			 * If the node is in a Value Tree we cannot
+			 * cache it !
+			 */
+			if ((!isRVT) && (node->doc != NULL) &&
+			    (nocache == 0)) {
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
+				node;
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
+				pos;
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) =
+				len;
+			}
+		    }
+		} else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) &&
+			   (node->type == XML_ELEMENT_NODE)) {
+		    xmlNodePtr previous;
+		    int ix, nocache = 0;
+
+		    previous = (xmlNodePtr)
+			XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+		    ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
+		    if ((previous != NULL) &&
+			(previous->parent == node->parent)) {
+			/*
+			 * just walk back to adjust the index
+			 */
+			int indx = 0;
+			xmlNodePtr sibling = node;
+
+			while (sibling != NULL) {
+			    if (sibling == previous)
+				break;
+			    if (sibling->type == XML_ELEMENT_NODE)
+				indx++;
+			    sibling = sibling->prev;
+			}
+			if (sibling == NULL) {
+			    /* hum going backward in document order ... */
+			    indx = 0;
+			    sibling = node;
+			    while (sibling != NULL) {
+				if (sibling == previous)
+				    break;
+				if (sibling->type == XML_ELEMENT_NODE)
+				    indx--;
+				sibling = sibling->next;
+			    }
+			}
+			if (sibling != NULL) {
+			    pos = ix + indx;
+			    /*
+			     * If the node is in a Value Tree we cannot
+			     * cache it !
+			     */
+			    if ((node->doc != NULL) && !isRVT) {
+				len = XSLT_RUNTIME_EXTRA(ctxt,
+				        sel->lenExtra, ival);
+				XSLT_RUNTIME_EXTRA(ctxt,
+					sel->previousExtra, ptr) = node;
+				XSLT_RUNTIME_EXTRA(ctxt,
+					sel->indexExtra, ival) = pos;
+			    }
+			} else
+			    pos = 0;
+		    } else {
+			/*
+			 * recompute the index
+			 */
+			xmlNodePtr siblings = node->parent->children;
+			xmlNodePtr parent = node->parent;
+
+			while (siblings != NULL) {
+			    if (siblings->type == XML_ELEMENT_NODE) {
+				len++;
+				if (siblings == node) {
+				    pos = len;
+				}
+			    }
+			    siblings = siblings->next;
+			}
+			if ((parent == NULL) || (node->doc == NULL))
+			    nocache = 1;
+			else {
+			    while (parent->parent != NULL)
+				parent = parent->parent;
+			    if (((parent->type != XML_DOCUMENT_NODE) &&
+				 (parent->type != XML_HTML_DOCUMENT_NODE)) ||
+				 (parent != (xmlNodePtr) node->doc))
+				nocache = 1;
+			}
+		    }
+		    if (pos != 0) {
+			ctxt->xpathCtxt->contextSize = len;
+			ctxt->xpathCtxt->proximityPosition = pos;
+			/*
+			 * If the node is in a Value Tree we cannot
+			 * cache it !
+			 */
+			if ((node->doc != NULL) && (nocache == 0) && !isRVT) {
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
+				node;
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
+				pos;
+			    XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) =
+				len;
+			}
+		    }
+		}
+		oldNode = ctxt->node;
+		ctxt->node = node;
+
+		if (step->value == NULL)
+		    goto wrong_index;
+		if (step->comp == NULL)
+		    goto wrong_index;
+
+		if (!xsltEvalXPathPredicate(ctxt, step->comp, comp->nsList,
+			                    comp->nsNr))
+		    goto wrong_index;
+
+		if (pos != 0) {
+		    ctxt->xpathCtxt->contextSize = oldCS;
+		    ctxt->xpathCtxt->proximityPosition = oldCP;
+		}
+		ctxt->node = oldNode;
+		break;
+wrong_index:
+		if (pos != 0) {
+		    ctxt->xpathCtxt->contextSize = oldCS;
+		    ctxt->xpathCtxt->proximityPosition = oldCP;
+		}
+		ctxt->node = oldNode;
+		goto rollback;
+	    }
+            case XSLT_OP_PI:
+		if (node->type != XML_PI_NODE)
+		    goto rollback;
+		if (step->value != NULL) {
+		    if (!xmlStrEqual(step->value, node->name))
+			goto rollback;
+		}
+		break;
+            case XSLT_OP_COMMENT:
+		if (node->type != XML_COMMENT_NODE)
+		    goto rollback;
+		break;
+            case XSLT_OP_TEXT:
+		if ((node->type != XML_TEXT_NODE) &&
+		    (node->type != XML_CDATA_SECTION_NODE))
+		    goto rollback;
+		break;
+            case XSLT_OP_NODE:
+		switch (node->type) {
+		    case XML_ELEMENT_NODE:
+		    case XML_CDATA_SECTION_NODE:
+		    case XML_PI_NODE:
+		    case XML_COMMENT_NODE:
+		    case XML_TEXT_NODE:
+			break;
+		    default:
+			goto rollback;
+		}
+		break;
+	}
+    }
+found:
+    if (states.states != NULL) {
+        /* Free the rollback states */
+	xmlFree(states.states);
+    }
+    return(1);
+rollback:
+    /* got an error try to rollback */
+    if (states.states == NULL)
+	return(0);
+    if (states.nbstates <= 0) {
+	xmlFree(states.states);
+	return(0);
+    }
+    states.nbstates--;
+    i = states.states[states.nbstates].step;
+    node = states.states[states.nbstates].node;
+#if 0
+    fprintf(stderr, "Pop: %d, %s\n", i, node->name);
+#endif
+    goto restart;
+}
+
+/**
+ * xsltTestCompMatchList:
+ * @ctxt:  a XSLT process context
+ * @node: a node
+ * @comp: the precompiled pattern list
+ *
+ * Test whether the node matches one of the patterns in the list
+ *
+ * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure
+ */
+int
+xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	              xsltCompMatchPtr comp) {
+    int ret;
+
+    if ((ctxt == NULL) || (node == NULL))
+	return(-1);
+    while (comp != NULL) {
+	ret = xsltTestCompMatch(ctxt, comp, node, NULL, NULL);
+	if (ret == 1)
+	    return(1);
+	comp = comp->next;
+    }
+    return(0);
+}
+
+/************************************************************************
+ *									*
+ *			Dedicated parser for templates			*
+ *									*
+ ************************************************************************/
+
+#define CUR (*ctxt->cur)
+#define SKIP(val) ctxt->cur += (val)
+#define NXT(val) ctxt->cur[(val)]
+#define CUR_PTR ctxt->cur
+
+#define SKIP_BLANKS 							\
+    while (IS_BLANK_CH(CUR)) NEXT
+
+#define CURRENT (*ctxt->cur)
+#define NEXT ((*ctxt->cur) ?  ctxt->cur++: ctxt->cur)
+
+
+#define PUSH(op, val, val2, novar) 						\
+    if (xsltCompMatchAdd(ctxt, ctxt->comp, (op), (val), (val2), (novar))) goto error;
+
+#define SWAP() 						\
+    xsltSwapTopCompMatch(ctxt->comp);
+
+#define XSLT_ERROR(X)							\
+    { xsltError(ctxt, __FILE__, __LINE__, X);			\
+      ctxt->error = (X); return; }
+
+#define XSLT_ERROR0(X)							\
+    { xsltError(ctxt, __FILE__, __LINE__, X);			\
+      ctxt->error = (X); return(0); }
+
+/**
+ * xsltScanLiteral:
+ * @ctxt:  the XPath Parser context
+ *
+ * Parse an XPath Litteral:
+ *
+ * [29] Literal ::= '"' [^"]* '"'
+ *                | "'" [^']* "'"
+ *
+ * Returns the Literal parsed or NULL
+ */
+
+static xmlChar *
+xsltScanLiteral(xsltParserContextPtr ctxt) {
+    const xmlChar *q, *cur;
+    xmlChar *ret = NULL;
+    int val, len;
+
+    SKIP_BLANKS;
+    if (CUR == '"') {
+        NEXT;
+	cur = q = CUR_PTR;
+	val = xmlStringCurrentChar(NULL, cur, &len);
+	while ((IS_CHAR(val)) && (val != '"')) {
+	    cur += len;
+	    val = xmlStringCurrentChar(NULL, cur, &len);
+	}
+	if (!IS_CHAR(val)) {
+	    ctxt->error = 1;
+	    return(NULL);
+	} else {
+	    ret = xmlStrndup(q, cur - q);
+        }
+	cur += len;
+	CUR_PTR = cur;
+    } else if (CUR == '\'') {
+        NEXT;
+	cur = q = CUR_PTR;
+	val = xmlStringCurrentChar(NULL, cur, &len);
+	while ((IS_CHAR(val)) && (val != '\'')) {
+	    cur += len;
+	    val = xmlStringCurrentChar(NULL, cur, &len);
+	}
+	if (!IS_CHAR(val)) {
+	    ctxt->error = 1;
+	    return(NULL);
+	} else {
+	    ret = xmlStrndup(q, cur - q);
+        }
+	cur += len;
+	CUR_PTR = cur;
+    } else {
+	/* XP_ERROR(XPATH_START_LITERAL_ERROR); */
+	ctxt->error = 1;
+	return(NULL);
+    }
+    return(ret);
+}
+
+/**
+ * xsltScanName:
+ * @ctxt:  the XPath Parser context
+ *
+ * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | 
+ *                  CombiningChar | Extender
+ *
+ * [5] Name ::= (Letter | '_' | ':') (NameChar)*
+ *
+ * [6] Names ::= Name (S Name)*
+ *
+ * Returns the Name parsed or NULL
+ */
+
+static xmlChar *
+xsltScanName(xsltParserContextPtr ctxt) {
+    const xmlChar *q, *cur;
+    xmlChar *ret = NULL;
+    int val, len;
+
+    SKIP_BLANKS;
+
+    cur = q = CUR_PTR;
+    val = xmlStringCurrentChar(NULL, cur, &len);
+    if (!IS_LETTER(val) && (val != '_') && (val != ':'))
+	return(NULL);
+
+    while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
+           (val == '.') || (val == '-') ||
+	   (val == '_') || 
+	   (IS_COMBINING(val)) ||
+	   (IS_EXTENDER(val))) {
+	cur += len;
+	val = xmlStringCurrentChar(NULL, cur, &len);
+    }
+    ret = xmlStrndup(q, cur - q);
+    CUR_PTR = cur;
+    return(ret);
+}
+
+/**
+ * xsltScanNCName:
+ * @ctxt:  the XPath Parser context
+ *
+ * Parses a non qualified name
+ *
+ * Returns the Name parsed or NULL
+ */
+
+static xmlChar *
+xsltScanNCName(xsltParserContextPtr ctxt) {
+    const xmlChar *q, *cur;
+    xmlChar *ret = NULL;
+    int val, len;
+
+    SKIP_BLANKS;
+
+    cur = q = CUR_PTR;
+    val = xmlStringCurrentChar(NULL, cur, &len);
+    if (!IS_LETTER(val) && (val != '_'))
+	return(NULL);
+
+    while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
+           (val == '.') || (val == '-') ||
+	   (val == '_') ||
+	   (IS_COMBINING(val)) ||
+	   (IS_EXTENDER(val))) {
+	cur += len;
+	val = xmlStringCurrentChar(NULL, cur, &len);
+    }
+    ret = xmlStrndup(q, cur - q);
+    CUR_PTR = cur;
+    return(ret);
+}
+
+/**
+ * xsltScanQName:
+ * @ctxt:  the XPath Parser context
+ * @prefix:  the place to store the prefix
+ *
+ * Parse a qualified name
+ *
+ * Returns the Name parsed or NULL
+ */
+
+static xmlChar *
+xsltScanQName(xsltParserContextPtr ctxt, xmlChar **prefix) {
+    xmlChar *ret = NULL;
+
+    *prefix = NULL;
+    ret = xsltScanNCName(ctxt);
+    if (CUR == ':') {
+        *prefix = ret;
+	NEXT;
+	ret = xsltScanNCName(ctxt);
+    }
+    return(ret);
+}
+
+/*
+ * xsltCompileIdKeyPattern:
+ * @ctxt:  the compilation context
+ * @name:  a preparsed name
+ * @aid:  whether id/key are allowed there
+ * @novar:  flag to prohibit xslt var
+ *
+ * Compile the XSLT LocationIdKeyPattern
+ * [3] IdKeyPattern ::= 'id' '(' Literal ')'
+ *                    | 'key' '(' Literal ',' Literal ')'
+ *
+ * also handle NodeType and PI from:
+ *
+ * [7]  NodeTest ::= NameTest
+ *                 | NodeType '(' ')'
+ *                 | 'processing-instruction' '(' Literal ')'
+ */
+static void
+xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+		int aid, int novar) {
+    xmlChar *lit = NULL;
+    xmlChar *lit2 = NULL;
+
+    if (CUR != '(') {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltCompileIdKeyPattern : ( expected\n");
+	ctxt->error = 1;
+	return;
+    }
+    if ((aid) && (xmlStrEqual(name, (const xmlChar *)"id"))) {
+	NEXT;
+	SKIP_BLANKS;
+        lit = xsltScanLiteral(ctxt);
+	if (ctxt->error)
+	    return;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : ) expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	PUSH(XSLT_OP_ID, lit, NULL, novar);
+    } else if ((aid) && (xmlStrEqual(name, (const xmlChar *)"key"))) {
+	NEXT;
+	SKIP_BLANKS;
+        lit = xsltScanLiteral(ctxt);
+	if (ctxt->error)
+	    return;
+	SKIP_BLANKS;
+	if (CUR != ',') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : , expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	SKIP_BLANKS;
+        lit2 = xsltScanLiteral(ctxt);
+	if (ctxt->error)
+	    return;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : ) expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	/* URGENT TODO: support namespace in keys */
+	PUSH(XSLT_OP_KEY, lit, lit2, novar);
+    } else if (xmlStrEqual(name, (const xmlChar *)"processing-instruction")) {
+	NEXT;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    lit = xsltScanLiteral(ctxt);
+	    if (ctxt->error)
+		return;
+	    SKIP_BLANKS;
+	    if (CUR != ')') {
+		xsltTransformError(NULL, NULL, NULL,
+			"xsltCompileIdKeyPattern : ) expected\n");
+		ctxt->error = 1;
+		return;
+	    }
+	}
+	NEXT;
+	PUSH(XSLT_OP_PI, lit, NULL, novar);
+    } else if (xmlStrEqual(name, (const xmlChar *)"text")) {
+	NEXT;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : ) expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	PUSH(XSLT_OP_TEXT, NULL, NULL, novar);
+    } else if (xmlStrEqual(name, (const xmlChar *)"comment")) {
+	NEXT;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : ) expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	PUSH(XSLT_OP_COMMENT, NULL, NULL, novar);
+    } else if (xmlStrEqual(name, (const xmlChar *)"node")) {
+	NEXT;
+	SKIP_BLANKS;
+	if (CUR != ')') {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileIdKeyPattern : ) expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	NEXT;
+	PUSH(XSLT_OP_NODE, NULL, NULL, novar);
+    } else if (aid) {
+	xsltTransformError(NULL, NULL, NULL,
+	    "xsltCompileIdKeyPattern : expecting 'key' or 'id' or node type\n");
+	ctxt->error = 1;
+	return;
+    } else {
+	xsltTransformError(NULL, NULL, NULL,
+	    "xsltCompileIdKeyPattern : node type\n");
+	ctxt->error = 1;
+	return;
+    }
+error:
+    if (name != NULL)
+	xmlFree(name);
+}
+
+/**
+ * xsltCompileStepPattern:
+ * @ctxt:  the compilation context
+ * @token:  a posible precompiled name
+ * @novar: flag to prohibit xslt variables from pattern
+ *
+ * Compile the XSLT StepPattern and generates a precompiled
+ * form suitable for fast matching.
+ *
+ * [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate* 
+ * [6] ChildOrAttributeAxisSpecifier ::= AbbreviatedAxisSpecifier
+ *                                     | ('child' | 'attribute') '::'
+ * from XPath
+ * [7]  NodeTest ::= NameTest
+ *                 | NodeType '(' ')'
+ *                 | 'processing-instruction' '(' Literal ')'
+ * [8] Predicate ::= '[' PredicateExpr ']'
+ * [9] PredicateExpr ::= Expr
+ * [13] AbbreviatedAxisSpecifier ::= '@'?
+ * [37] NameTest ::= '*' | NCName ':' '*' | QName
+ */
+
+static void
+xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) {
+    xmlChar *name = NULL;
+    const xmlChar *URI = NULL;
+    xmlChar *URL = NULL;
+    int level;
+
+    SKIP_BLANKS;
+    if ((token == NULL) && (CUR == '@')) {
+	xmlChar *prefix = NULL;
+
+	NEXT;
+	if (CUR == '*') {
+	    NEXT;
+	    PUSH(XSLT_OP_ATTR, NULL, NULL, novar);
+	    goto parse_predicate;
+	}
+	token = xsltScanQName(ctxt, &prefix);
+	if (prefix != NULL) {
+	    xmlNsPtr ns;
+
+	    ns = xmlSearchNs(ctxt->doc, ctxt->elem, prefix);
+	    if (ns == NULL) {
+		xsltTransformError(NULL, NULL, NULL,
+		"xsltCompileStepPattern : no namespace bound to prefix %s\n",
+				 prefix);
+	    } else {
+		URL = xmlStrdup(ns->href);
+	    }
+	    xmlFree(prefix);
+	}
+	if (token == NULL) {
+	    if (CUR == '*') {
+		NEXT;
+		PUSH(XSLT_OP_ATTR, NULL, URL, novar);
+		return;
+	    }
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileStepPattern : Name expected\n");
+	    ctxt->error = 1;
+	    goto error;
+	}
+	PUSH(XSLT_OP_ATTR, token, URL, novar);
+	goto parse_predicate;
+    }
+    if (token == NULL)
+	token = xsltScanName(ctxt);
+    if (token == NULL) {
+	if (CUR == '*') {
+	    NEXT;
+	    PUSH(XSLT_OP_ALL, token, NULL, novar);
+	    goto parse_predicate;
+	} else {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileStepPattern : Name expected\n");
+	    ctxt->error = 1;
+	    goto error;
+	}
+    }
+
+
+    SKIP_BLANKS;
+    if (CUR == '(') {
+	xsltCompileIdKeyPattern(ctxt, token, 0, novar);
+	if (ctxt->error)
+	    goto error;
+    } else if (CUR == ':') {
+	NEXT;
+	if (CUR != ':') {
+	    xmlChar *prefix = token;
+	    xmlNsPtr ns;
+
+	    /*
+	     * This is a namespace match
+	     */
+	    token = xsltScanName(ctxt);
+	    ns = xmlSearchNs(ctxt->doc, ctxt->elem, prefix);
+	    if (ns == NULL) {
+		xsltTransformError(NULL, NULL, NULL,
+	    "xsltCompileStepPattern : no namespace bound to prefix %s\n",
+				 prefix);
+		ctxt->error = 1;
+		goto error;
+	    } else {
+		URL = xmlStrdup(ns->href);
+	    }
+	    xmlFree(prefix);
+	    if (token == NULL) {
+		if (CUR == '*') {
+		    NEXT;
+		    PUSH(XSLT_OP_NS, URL, NULL, novar);
+		} else {
+		    xsltTransformError(NULL, NULL, NULL,
+			    "xsltCompileStepPattern : Name expected\n");
+		    ctxt->error = 1;
+		    goto error;
+		}
+	    } else {
+		PUSH(XSLT_OP_ELEM, token, URL, novar);
+	    }
+	} else {
+	    NEXT;
+	    if (xmlStrEqual(token, (const xmlChar *) "child")) {
+		xmlFree(token);
+		token = xsltScanName(ctxt);
+		if (token == NULL) {
+	            if (CUR == '*') {
+            	        NEXT;
+	                PUSH(XSLT_OP_ALL, token, NULL, novar);
+	                goto parse_predicate;
+	            } else {
+		        xsltTransformError(NULL, NULL, NULL,
+			    "xsltCompileStepPattern : QName expected\n");
+		        ctxt->error = 1;
+		        goto error;
+		    }
+		}
+		URI = xsltGetQNameURI(ctxt->elem, &token);
+		if (token == NULL) {
+		    ctxt->error = 1;
+		    goto error;
+		} else {
+		    name = xmlStrdup(token);
+		    if (URI != NULL)
+			URL = xmlStrdup(URI);
+		}
+		PUSH(XSLT_OP_CHILD, name, URL, novar);
+	    } else if (xmlStrEqual(token, (const xmlChar *) "attribute")) {
+		xmlFree(token);
+		token = xsltScanName(ctxt);
+		if (token == NULL) {
+		    xsltTransformError(NULL, NULL, NULL,
+			    "xsltCompileStepPattern : QName expected\n");
+		    ctxt->error = 1;
+		    goto error;
+		}
+		URI = xsltGetQNameURI(ctxt->elem, &token);
+		if (token == NULL) {
+		    ctxt->error = 1;
+		    goto error;
+		} else {
+		    name = xmlStrdup(token);
+		    if (URI != NULL)
+			URL = xmlStrdup(URI);
+		}
+		PUSH(XSLT_OP_ATTR, name, URL, novar);
+	    } else {
+		xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileStepPattern : 'child' or 'attribute' expected\n");
+		ctxt->error = 1;
+		goto error;
+	    }
+	    xmlFree(token);
+	}
+    } else if (CUR == '*') {
+	NEXT;
+	PUSH(XSLT_OP_ALL, token, NULL, novar);
+    } else {
+	URI = xsltGetQNameURI(ctxt->elem, &token);
+	if (token == NULL) {
+	    ctxt->error = 1;
+	    goto error;
+	}
+	if (URI != NULL)
+	    URL = xmlStrdup(URI);
+	PUSH(XSLT_OP_ELEM, token, URL, novar);
+    }
+parse_predicate:
+    SKIP_BLANKS;
+    level = 0;
+    while (CUR == '[') {
+	const xmlChar *q;
+	xmlChar *ret = NULL;
+
+	level++;
+	NEXT;
+	q = CUR_PTR;
+	while (CUR != 0) {
+	    /* Skip over nested predicates */
+	    if (CUR == '[')
+		level++;
+	    else if (CUR == ']') {
+		level--;
+		if (level == 0)
+		    break;
+	    } else if (CUR == '"') {
+		NEXT;
+		while ((CUR != 0) && (CUR != '"'))
+		    NEXT;
+	    } else if (CUR == '\'') {
+		NEXT;
+		while ((CUR != 0) && (CUR != '\''))
+		    NEXT;
+	    }
+	    NEXT;
+	}
+	if (CUR == 0) {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileStepPattern : ']' expected\n");
+	    ctxt->error = 1;
+	    return;
+        }
+	ret = xmlStrndup(q, CUR_PTR - q);
+	PUSH(XSLT_OP_PREDICATE, ret, NULL, novar);
+	/* push the predicate lower than local test */
+	SWAP();
+	NEXT;
+	SKIP_BLANKS;
+    }
+    return;
+error:
+    if (token != NULL)
+	xmlFree(token);
+    if (name != NULL)
+	xmlFree(name);
+}
+
+/**
+ * xsltCompileRelativePathPattern:
+ * @comp:  the compilation context
+ * @token:  a posible precompiled name
+ * @novar:  flag to prohibit xslt variables
+ *
+ * Compile the XSLT RelativePathPattern and generates a precompiled
+ * form suitable for fast matching.
+ *
+ * [4] RelativePathPattern ::= StepPattern
+ *                           | RelativePathPattern '/' StepPattern
+ *                           | RelativePathPattern '//' StepPattern
+ */
+static void
+xsltCompileRelativePathPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) {
+    xsltCompileStepPattern(ctxt, token, novar);
+    if (ctxt->error)
+	goto error;
+    SKIP_BLANKS;
+    while ((CUR != 0) && (CUR != '|')) {
+	if ((CUR == '/') && (NXT(1) == '/')) {
+	    PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar);
+	    NEXT;
+	    NEXT;
+	    SKIP_BLANKS;
+	    xsltCompileStepPattern(ctxt, NULL, novar);
+	} else if (CUR == '/') {
+	    PUSH(XSLT_OP_PARENT, NULL, NULL, novar);
+	    NEXT;
+	    SKIP_BLANKS;
+	    if ((CUR != 0) && (CUR != '|')) {
+		xsltCompileRelativePathPattern(ctxt, NULL, novar);
+	    }
+	} else {
+	    ctxt->error = 1;
+	}
+	if (ctxt->error)
+	    goto error;
+	SKIP_BLANKS;
+    }
+error:
+    return;
+}
+
+/**
+ * xsltCompileLocationPathPattern:
+ * @ctxt:  the compilation context
+ * @novar:  flag to prohibit xslt variables
+ *
+ * Compile the XSLT LocationPathPattern and generates a precompiled
+ * form suitable for fast matching.
+ *
+ * [2] LocationPathPattern ::= '/' RelativePathPattern?
+ *                           | IdKeyPattern (('/' | '//') RelativePathPattern)?
+ *                           | '//'? RelativePathPattern
+ */
+static void
+xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) {
+    SKIP_BLANKS;
+    if ((CUR == '/') && (NXT(1) == '/')) {
+	/*
+	 * since we reverse the query
+	 * a leading // can be safely ignored
+	 */
+	NEXT;
+	NEXT;
+	ctxt->comp->priority = 0.5;	/* '//' means not 0 priority */
+	xsltCompileRelativePathPattern(ctxt, NULL, novar);
+    } else if (CUR == '/') {
+	/*
+	 * We need to find root as the parent
+	 */
+	NEXT;
+	SKIP_BLANKS;
+	PUSH(XSLT_OP_ROOT, NULL, NULL, novar);
+	if ((CUR != 0) && (CUR != '|')) {
+	    PUSH(XSLT_OP_PARENT, NULL, NULL, novar);
+	    xsltCompileRelativePathPattern(ctxt, NULL, novar);
+	}
+    } else if (CUR == '*') {
+	xsltCompileRelativePathPattern(ctxt, NULL, novar);
+    } else if (CUR == '@') {
+	xsltCompileRelativePathPattern(ctxt, NULL, novar);
+    } else {
+	xmlChar *name;
+	name = xsltScanName(ctxt);
+	if (name == NULL) {
+	    xsltTransformError(NULL, NULL, NULL,
+		    "xsltCompileLocationPathPattern : Name expected\n");
+	    ctxt->error = 1;
+	    return;
+	}
+	SKIP_BLANKS;
+	if ((CUR == '(') && !xmlXPathIsNodeType(name)) {
+	    xsltCompileIdKeyPattern(ctxt, name, 1, novar);
+	    if ((CUR == '/') && (NXT(1) == '/')) {
+		PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar);
+		NEXT;
+		NEXT;
+		SKIP_BLANKS;
+		xsltCompileRelativePathPattern(ctxt, NULL, novar);
+	    } else if (CUR == '/') {
+		PUSH(XSLT_OP_PARENT, NULL, NULL, novar);
+		NEXT;
+		SKIP_BLANKS;
+		xsltCompileRelativePathPattern(ctxt, NULL, novar);
+	    }
+	    return;
+	}
+	xsltCompileRelativePathPattern(ctxt, name, novar);
+    }
+error:
+    return;
+}
+
+/**
+ * xsltCompilePatternInternal:
+ * @pattern: an XSLT pattern
+ * @doc:  the containing document
+ * @node:  the containing element
+ * @style:  the stylesheet
+ * @runtime:  the transformation context, if done at run-time
+ * @novar:  flag to prohibit xslt variables
+ *
+ * Compile the XSLT pattern and generates a list of precompiled form suitable
+ * for fast matching.
+ *
+ * [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern
+ *
+ * Returns the generated pattern list or NULL in case of failure
+ */
+
+static xsltCompMatchPtr
+xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc,
+	           xmlNodePtr node, xsltStylesheetPtr style,
+		   xsltTransformContextPtr runtime, int novar) {
+    xsltParserContextPtr ctxt = NULL;
+    xsltCompMatchPtr element, first = NULL, previous = NULL;
+    int current, start, end, level, j;
+
+    if (pattern == NULL) {
+	xsltTransformError(NULL, NULL, node,
+			 "xsltCompilePattern : NULL pattern\n");
+	return(NULL);
+    }
+
+    ctxt = xsltNewParserContext(style, runtime);
+    if (ctxt == NULL)
+	return(NULL);
+    ctxt->doc = doc;
+    ctxt->elem = node;
+    current = end = 0;
+    while (pattern[current] != 0) {
+	start = current;
+	while (IS_BLANK_CH(pattern[current]))
+	    current++;
+	end = current;
+	level = 0;
+	while ((pattern[end] != 0) && ((pattern[end] != '|') || (level != 0))) {
+	    if (pattern[end] == '[')
+		level++;
+	    else if (pattern[end] == ']')
+		level--;
+	    else if (pattern[end] == '\'') {
+		end++;
+		while ((pattern[end] != 0) && (pattern[end] != '\''))
+		    end++;
+	    } else if (pattern[end] == '"') {
+		end++;
+		while ((pattern[end] != 0) && (pattern[end] != '"'))
+		    end++;
+	    }
+	    end++;
+	}
+	if (current == end) {
+	    xsltTransformError(NULL, NULL, node,
+			     "xsltCompilePattern : NULL pattern\n");
+	    goto error;
+	}
+	element = xsltNewCompMatch();
+	if (element == NULL) {
+	    goto error;
+	}
+	if (first == NULL)
+	    first = element;
+	else if (previous != NULL)
+	    previous->next = element;
+	previous = element;
+
+	ctxt->comp = element;
+	ctxt->base = xmlStrndup(&pattern[start], end - start);
+	if (ctxt->base == NULL)
+	    goto error;
+	ctxt->cur = &(ctxt->base)[current - start];
+	element->pattern = ctxt->base;
+	element->nsList = xmlGetNsList(doc, node);
+	j = 0;
+	if (element->nsList != NULL) {
+	    while (element->nsList[j] != NULL)
+		j++;
+	}
+	element->nsNr = j;
+
+
+#ifdef WITH_XSLT_DEBUG_PATTERN
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltCompilePattern : parsing '%s'\n",
+			 element->pattern);
+#endif
+	/*
+	 Preset default priority to be zero.
+	 This may be changed by xsltCompileLocationPathPattern.
+	 */
+	element->priority = 0;
+	xsltCompileLocationPathPattern(ctxt, novar);
+	if (ctxt->error) {
+	    xsltTransformError(NULL, style, node,
+			     "xsltCompilePattern : failed to compile '%s'\n",
+			     element->pattern);
+	    if (style != NULL) style->errors++;
+	    goto error;
+	}
+
+	/*
+	 * Reverse for faster interpretation.
+	 */
+	xsltReverseCompMatch(ctxt, element);
+
+	/*
+	 * Set-up the priority
+	 */
+	if (element->priority == 0) {	/* if not yet determined */
+	    if (((element->steps[0].op == XSLT_OP_ELEM) ||
+		 (element->steps[0].op == XSLT_OP_ATTR) ||
+		 (element->steps[0].op == XSLT_OP_PI)) &&
+		(element->steps[0].value != NULL) &&
+		(element->steps[1].op == XSLT_OP_END)) {
+		;	/* previously preset */
+	    } else if ((element->steps[0].op == XSLT_OP_ATTR) &&
+		       (element->steps[0].value2 != NULL) &&
+		       (element->steps[1].op == XSLT_OP_END)) {
+			element->priority = -0.25;
+	    } else if ((element->steps[0].op == XSLT_OP_NS) &&
+		       (element->steps[0].value != NULL) &&
+		       (element->steps[1].op == XSLT_OP_END)) {
+			element->priority = -0.25;
+	    } else if ((element->steps[0].op == XSLT_OP_ATTR) &&
+		       (element->steps[0].value == NULL) &&
+		       (element->steps[0].value2 == NULL) &&
+		       (element->steps[1].op == XSLT_OP_END)) {
+			element->priority = -0.5;
+	    } else if (((element->steps[0].op == XSLT_OP_PI) ||
+		       (element->steps[0].op == XSLT_OP_TEXT) ||
+		       (element->steps[0].op == XSLT_OP_ALL) ||
+		       (element->steps[0].op == XSLT_OP_NODE) ||
+		       (element->steps[0].op == XSLT_OP_COMMENT)) &&
+		       (element->steps[1].op == XSLT_OP_END)) {
+			element->priority = -0.5;
+	    } else {
+		element->priority = 0.5;
+	    }
+	}
+#ifdef WITH_XSLT_DEBUG_PATTERN
+	xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltCompilePattern : parsed %s, default priority %f\n",
+			 element->pattern, element->priority);
+#endif
+	if (pattern[end] == '|')
+	    end++;
+	current = end;
+    }
+    if (end == 0) {
+	xsltTransformError(NULL, style, node,
+			 "xsltCompilePattern : NULL pattern\n");
+	if (style != NULL) style->errors++;
+	goto error;
+    }
+
+    xsltFreeParserContext(ctxt);
+    return(first);
+
+error:
+    if (ctxt != NULL)
+	xsltFreeParserContext(ctxt);
+    if (first != NULL)
+	xsltFreeCompMatchList(first);
+    return(NULL);
+}
+
+/**
+ * xsltCompilePattern:
+ * @pattern: an XSLT pattern
+ * @doc:  the containing document
+ * @node:  the containing element
+ * @style:  the stylesheet
+ * @runtime:  the transformation context, if done at run-time
+ *
+ * Compile the XSLT pattern and generates a list of precompiled form suitable
+ * for fast matching.
+ *
+ * [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern
+ *
+ * Returns the generated pattern list or NULL in case of failure
+ */
+
+xsltCompMatchPtr
+xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc,
+	           xmlNodePtr node, xsltStylesheetPtr style,
+		   xsltTransformContextPtr runtime) {
+    return (xsltCompilePatternInternal(pattern, doc, node, style, runtime, 0));
+}
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltAddTemplate:
+ * @style: an XSLT stylesheet
+ * @cur: an XSLT template
+ * @mode:  the mode name or NULL
+ * @modeURI:  the mode URI or NULL
+ *
+ * Register the XSLT pattern associated to @cur
+ *
+ * Returns -1 in case of error, 0 otherwise
+ */
+int
+xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur,
+	        const xmlChar *mode, const xmlChar *modeURI) {
+    xsltCompMatchPtr pat, list, next;
+    /*
+     * 'top' will point to style->xxxMatch ptr - declaring as 'void'
+     *  avoids gcc 'type-punned pointer' warning.
+     */
+    void **top = NULL;
+    const xmlChar *name = NULL;
+    float priority;              /* the priority */
+
+    if ((style == NULL) || (cur == NULL) || (cur->match == NULL))
+	return(-1);
+
+    priority = cur->priority;
+    pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
+		    style, NULL, 1);
+    if (pat == NULL)
+    	return(-1);
+    while (pat) {
+	next = pat->next;
+	pat->next = NULL;
+	name = NULL;
+	
+	pat->template = cur;
+	if (mode != NULL)
+	    pat->mode = xmlDictLookup(style->dict, mode, -1);
+	if (modeURI != NULL)
+	    pat->modeURI = xmlDictLookup(style->dict, modeURI, -1);
+	if (priority != XSLT_PAT_NO_PRIORITY)
+	    pat->priority = priority;
+
+	/*
+	 * insert it in the hash table list corresponding to its lookup name
+	 */
+	switch (pat->steps[0].op) {
+        case XSLT_OP_ATTR:
+	    if (pat->steps[0].value != NULL)
+		name = pat->steps[0].value;
+	    else
+		top = &(style->attrMatch);
+	    break;
+        case XSLT_OP_CHILD:
+        case XSLT_OP_PARENT:
+        case XSLT_OP_ANCESTOR:
+	    top = &(style->elemMatch);
+	    break;
+        case XSLT_OP_ROOT:
+	    top = &(style->rootMatch);
+	    break;
+        case XSLT_OP_KEY:
+	    top = &(style->keyMatch);
+	    break;
+        case XSLT_OP_ID:
+	    /* TODO optimize ID !!! */
+        case XSLT_OP_NS:
+        case XSLT_OP_ALL:
+	    top = &(style->elemMatch);
+	    break;
+        case XSLT_OP_END:
+	case XSLT_OP_PREDICATE:
+	    xsltTransformError(NULL, style, NULL,
+			     "xsltAddTemplate: invalid compiled pattern\n");
+	    xsltFreeCompMatch(pat);
+	    return(-1);
+	    /*
+	     * TODO: some flags at the top level about type based patterns
+	     *       would be faster than inclusion in the hash table.
+	     */
+	case XSLT_OP_PI:
+	    if (pat->steps[0].value != NULL)
+		name = pat->steps[0].value;
+	    else
+		top = &(style->piMatch);
+	    break;
+	case XSLT_OP_COMMENT:
+	    top = &(style->commentMatch);
+	    break;
+	case XSLT_OP_TEXT:
+	    top = &(style->textMatch);
+	    break;
+        case XSLT_OP_ELEM:
+	case XSLT_OP_NODE:
+	    if (pat->steps[0].value != NULL)
+		name = pat->steps[0].value;
+	    else
+		top = &(style->elemMatch);
+	    break;
+	}
+	if (name != NULL) {
+	    if (style->templatesHash == NULL) {
+		style->templatesHash = xmlHashCreate(1024);
+		if (style->templatesHash == NULL) {
+		    xsltFreeCompMatch(pat);
+		    return(-1);
+		}
+		xmlHashAddEntry3(style->templatesHash, name, mode, modeURI, pat);
+	    } else {
+		list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash,
+							 name, mode, modeURI);
+		if (list == NULL) {
+		    xmlHashAddEntry3(style->templatesHash, name,
+				     mode, modeURI, pat);
+		} else {
+		    /*
+		     * Note '<=' since one must choose among the matching
+		     * template rules that are left, the one that occurs
+		     * last in the stylesheet
+		     */
+		    if (list->priority <= pat->priority) {
+			pat->next = list;
+			xmlHashUpdateEntry3(style->templatesHash, name,
+					    mode, modeURI, pat, NULL);
+		    } else {
+			while (list->next != NULL) {
+			    if (list->next->priority <= pat->priority)
+				break;
+			    list = list->next;
+			}
+			pat->next = list->next;
+			list->next = pat;
+		    }
+		}
+	    }
+	} else if (top != NULL) {
+	    list = *top;
+	    if (list == NULL) {
+		*top = pat;
+		pat->next = NULL;
+	    } else if (list->priority <= pat->priority) {
+		pat->next = list;
+		*top = pat;
+	    } else {
+		while (list->next != NULL) {
+		    if (list->next->priority <= pat->priority)
+			break;
+		    list = list->next;
+		}
+		pat->next = list->next;
+		list->next = pat;
+	    }
+	} else {
+	    xsltTransformError(NULL, style, NULL,
+			     "xsltAddTemplate: invalid compiled pattern\n");
+	    xsltFreeCompMatch(pat);
+	    return(-1);
+	}
+#ifdef WITH_XSLT_DEBUG_PATTERN
+	if (mode)
+	    xsltGenericDebug(xsltGenericDebugContext,
+			 "added pattern : '%s' mode '%s' priority %f\n",
+			     pat->pattern, pat->mode, pat->priority);
+	else
+	    xsltGenericDebug(xsltGenericDebugContext,
+			 "added pattern : '%s' priority %f\n",
+			     pat->pattern, pat->priority);
+#endif
+
+	pat = next;
+    }
+    return(0);
+}
+
+static int
+xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode)
+{
+    if ((ctxt == NULL) || (contextNode == NULL)) {
+	xsltTransformError(ctxt, NULL, ctxt->inst,
+	    "Internal error in xsltComputeAllKeys(): "
+	    "Bad arguments.\n");
+	return(-1);
+    }
+
+    if (ctxt->document == NULL) {
+	/*
+	* The document info will only be NULL if we have a RTF.
+	*/
+	if (contextNode->doc->_private != NULL)
+	    goto doc_info_mismatch;
+	/*
+	* On-demand creation of the document info (needed for keys).
+	*/
+	ctxt->document = xsltNewDocument(ctxt, contextNode->doc);
+	if (ctxt->document == NULL)
+	    return(-1);
+    }
+    return xsltInitAllDocKeys(ctxt);
+
+doc_info_mismatch:
+    xsltTransformError(ctxt, NULL, ctxt->inst,
+	"Internal error in xsltComputeAllKeys(): "
+	"The context's document info doesn't match the "
+	"document info of the current result tree.\n");
+    ctxt->state = XSLT_STATE_STOPPED;
+    return(-1);
+}
+
+/**
+ * xsltGetTemplate:
+ * @ctxt:  a XSLT process context
+ * @node:  the node being processed
+ * @style:  the current style
+ *
+ * Finds the template applying to this node, if @style is non-NULL
+ * it means one needs to look for the next imported template in scope.
+ *
+ * Returns the xsltTemplatePtr or NULL if not found
+ */
+xsltTemplatePtr
+xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	        xsltStylesheetPtr style)
+{
+    xsltStylesheetPtr curstyle;
+    xsltTemplatePtr ret = NULL;
+    const xmlChar *name = NULL;
+    xsltCompMatchPtr list = NULL;
+    float priority;
+    int keyed = 0;
+
+    if ((ctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    if (style == NULL) {
+	curstyle = ctxt->style;
+    } else {
+	curstyle = xsltNextImport(style);
+    }
+
+    while ((curstyle != NULL) && (curstyle != style)) {
+	priority = XSLT_PAT_NO_PRIORITY;
+	/* TODO : handle IDs/keys here ! */
+	if (curstyle->templatesHash != NULL) {
+	    /*
+	     * Use the top name as selector
+	     */
+	    switch (node->type) {
+		case XML_ELEMENT_NODE:
+		    if (node->name[0] == ' ')
+			break;
+		case XML_ATTRIBUTE_NODE:
+		case XML_PI_NODE:
+		    name = node->name;
+		    break;
+		case XML_DOCUMENT_NODE:
+		case XML_HTML_DOCUMENT_NODE:
+		case XML_TEXT_NODE:
+		case XML_CDATA_SECTION_NODE:
+		case XML_COMMENT_NODE:
+		case XML_ENTITY_REF_NODE:
+		case XML_ENTITY_NODE:
+		case XML_DOCUMENT_TYPE_NODE:
+		case XML_DOCUMENT_FRAG_NODE:
+		case XML_NOTATION_NODE:
+		case XML_DTD_NODE:
+		case XML_ELEMENT_DECL:
+		case XML_ATTRIBUTE_DECL:
+		case XML_ENTITY_DECL:
+		case XML_NAMESPACE_DECL:
+		case XML_XINCLUDE_START:
+		case XML_XINCLUDE_END:
+		    break;
+		default:
+		    return(NULL);
+
+	    }
+	}
+	if (name != NULL) {
+	    /*
+	     * find the list of applicable expressions based on the name
+	     */
+	    list = (xsltCompMatchPtr) xmlHashLookup3(curstyle->templatesHash,
+					     name, ctxt->mode, ctxt->modeURI);
+	} else
+	    list = NULL;
+	while (list != NULL) {
+	    if (xsltTestCompMatch(ctxt, list, node,
+			          ctxt->mode, ctxt->modeURI)) {
+		ret = list->template;
+		priority = list->priority;
+		break;
+	    }
+	    list = list->next;
+	}
+	list = NULL;
+
+	/*
+	 * find alternate generic matches
+	 */
+	switch (node->type) {
+	    case XML_ELEMENT_NODE:
+		if (node->name[0] == ' ')
+		    list = curstyle->rootMatch;
+		else
+		    list = curstyle->elemMatch;
+		if (node->psvi != NULL) keyed = 1;
+		break;
+	    case XML_ATTRIBUTE_NODE: {
+	        xmlAttrPtr attr;
+
+		list = curstyle->attrMatch;
+		attr = (xmlAttrPtr) node;
+		if (attr->psvi != NULL) keyed = 1;
+		break;
+	    }
+	    case XML_PI_NODE:
+		list = curstyle->piMatch;
+		if (node->psvi != NULL) keyed = 1;
+		break;
+	    case XML_DOCUMENT_NODE:
+	    case XML_HTML_DOCUMENT_NODE: {
+	        xmlDocPtr doc;
+
+		list = curstyle->rootMatch;
+		doc = (xmlDocPtr) node;
+		if (doc->psvi != NULL) keyed = 1;
+		break;
+	    }
+	    case XML_TEXT_NODE:
+	    case XML_CDATA_SECTION_NODE:
+		list = curstyle->textMatch;
+		if (node->psvi != NULL) keyed = 1;
+		break;
+	    case XML_COMMENT_NODE:
+		list = curstyle->commentMatch;
+		if (node->psvi != NULL) keyed = 1;
+		break;
+	    case XML_ENTITY_REF_NODE:
+	    case XML_ENTITY_NODE:
+	    case XML_DOCUMENT_TYPE_NODE:
+	    case XML_DOCUMENT_FRAG_NODE:
+	    case XML_NOTATION_NODE:
+	    case XML_DTD_NODE:
+	    case XML_ELEMENT_DECL:
+	    case XML_ATTRIBUTE_DECL:
+	    case XML_ENTITY_DECL:
+	    case XML_NAMESPACE_DECL:
+	    case XML_XINCLUDE_START:
+	    case XML_XINCLUDE_END:
+		break;
+	    default:
+		break;
+	}
+	while ((list != NULL) &&
+	       ((ret == NULL)  || (list->priority > priority))) {
+	    if (xsltTestCompMatch(ctxt, list, node,
+			          ctxt->mode, ctxt->modeURI)) {
+		ret = list->template;
+		priority = list->priority;
+		break;
+	    }
+	    list = list->next;
+	}
+	/*
+	 * Some of the tests for elements can also apply to documents
+	 */
+	if ((node->type == XML_DOCUMENT_NODE) ||
+	    (node->type == XML_HTML_DOCUMENT_NODE) ||
+	    (node->type == XML_TEXT_NODE)) {
+	    list = curstyle->elemMatch;
+	    while ((list != NULL) &&
+		   ((ret == NULL)  || (list->priority > priority))) {
+		if (xsltTestCompMatch(ctxt, list, node,
+				      ctxt->mode, ctxt->modeURI)) {
+		    ret = list->template;
+		    priority = list->priority;
+		    break;
+		}
+		list = list->next;
+	    }
+	} else if ((node->type == XML_PI_NODE) ||
+		   (node->type == XML_COMMENT_NODE)) {
+	    list = curstyle->elemMatch;
+	    while ((list != NULL) &&
+		   ((ret == NULL)  || (list->priority > priority))) {
+		if (xsltTestCompMatch(ctxt, list, node,
+				      ctxt->mode, ctxt->modeURI)) {
+		    ret = list->template;
+		    priority = list->priority;
+		    break;
+		}
+		list = list->next;
+	    }
+	}
+
+keyed_match:
+	if (keyed) {
+	    list = curstyle->keyMatch;
+	    while ((list != NULL) &&
+		   ((ret == NULL)  || (list->priority > priority))) {
+		if (xsltTestCompMatch(ctxt, list, node,
+				      ctxt->mode, ctxt->modeURI)) {
+		    ret = list->template;
+		    priority = list->priority;
+		    break;
+		}
+		list = list->next;
+	    }
+	}
+	else if (ctxt->hasTemplKeyPatterns &&
+	    ((ctxt->document == NULL) ||
+	     (ctxt->document->nbKeysComputed < ctxt->nbKeys)))
+	{
+	    /*
+	    * Compute all remaining keys for this document.
+	    *
+	    * REVISIT TODO: I think this could be further optimized.
+	    */
+	    if (xsltComputeAllKeys(ctxt, node) == -1)
+		goto error;
+
+	    switch (node->type) {
+		case XML_ELEMENT_NODE:		    
+		    if (node->psvi != NULL) keyed = 1;
+		    break;
+		case XML_ATTRIBUTE_NODE:
+		    if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1;
+		    break;
+		case XML_TEXT_NODE:
+		case XML_CDATA_SECTION_NODE:
+		case XML_COMMENT_NODE:
+		case XML_PI_NODE:		
+		    if (node->psvi != NULL) keyed = 1;
+		    break;
+		case XML_DOCUMENT_NODE:
+		case XML_HTML_DOCUMENT_NODE:
+		    if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
+		    break;		
+		default:
+		    break;
+	    }
+	    if (keyed)
+		goto keyed_match;
+	}
+	if (ret != NULL)
+	    return(ret);
+
+	/*
+	 * Cycle on next curstylesheet import.
+	 */
+	curstyle = xsltNextImport(curstyle);
+    }
+
+error:
+    return(NULL);
+}
+
+/**
+ * xsltCleanupTemplates:
+ * @style: an XSLT stylesheet
+ *
+ * Cleanup the state of the templates used by the stylesheet and
+ * the ones it imports.
+ */
+void
+xsltCleanupTemplates(xsltStylesheetPtr style ATTRIBUTE_UNUSED) {
+}
+
+/**
+ * xsltFreeTemplateHashes:
+ * @style: an XSLT stylesheet
+ *
+ * Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism
+ */
+void
+xsltFreeTemplateHashes(xsltStylesheetPtr style) {
+    if (style->templatesHash != NULL)
+	xmlHashFree((xmlHashTablePtr) style->templatesHash,
+		    (xmlHashDeallocator) xsltFreeCompMatchList);
+    if (style->rootMatch != NULL)
+        xsltFreeCompMatchList(style->rootMatch);
+    if (style->keyMatch != NULL)
+        xsltFreeCompMatchList(style->keyMatch);
+    if (style->elemMatch != NULL)
+        xsltFreeCompMatchList(style->elemMatch);
+    if (style->attrMatch != NULL)
+        xsltFreeCompMatchList(style->attrMatch);
+    if (style->parentMatch != NULL)
+        xsltFreeCompMatchList(style->parentMatch);
+    if (style->textMatch != NULL)
+        xsltFreeCompMatchList(style->textMatch);
+    if (style->piMatch != NULL)
+        xsltFreeCompMatchList(style->piMatch);
+    if (style->commentMatch != NULL)
+        xsltFreeCompMatchList(style->commentMatch);
+}
+
diff --git a/third_party/libxslt/libxslt/pattern.h b/third_party/libxslt/libxslt/pattern.h
new file mode 100644
index 0000000..eb21be3
--- /dev/null
+++ b/third_party/libxslt/libxslt/pattern.h
@@ -0,0 +1,81 @@
+/*
+ * Summary: interface for the pattern matching used in template matches.
+ * Description: the implementation of the lookup of the right template
+ *              for a given node must be really fast in order to keep
+ *              decent performances.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_PATTERN_H__
+#define __XML_XSLT_PATTERN_H__
+
+#include "xsltInternals.h"
+#include "xsltexports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * xsltCompMatch:
+ *
+ * Data structure used for the implementation of patterns.
+ * It is kept private (in pattern.c).
+ */
+typedef struct _xsltCompMatch xsltCompMatch;
+typedef xsltCompMatch *xsltCompMatchPtr;
+
+/*
+ * Pattern related interfaces.
+ */
+
+XSLTPUBFUN xsltCompMatchPtr XSLTCALL
+		xsltCompilePattern	(const xmlChar *pattern,
+					 xmlDocPtr doc,
+					 xmlNodePtr node,
+					 xsltStylesheetPtr style,
+					 xsltTransformContextPtr runtime);
+XSLTPUBFUN void XSLTCALL
+		xsltFreeCompMatchList	(xsltCompMatchPtr comp);
+XSLTPUBFUN int XSLTCALL
+		xsltTestCompMatchList	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xsltCompMatchPtr comp);
+XSLTPUBFUN void XSLTCALL
+		xsltNormalizeCompSteps	(void *payload,
+					 void *data,
+					 const xmlChar *name);
+
+/*
+ * Template related interfaces.
+ */
+XSLTPUBFUN int XSLTCALL
+		xsltAddTemplate		(xsltStylesheetPtr style,
+					 xsltTemplatePtr cur,
+					 const xmlChar *mode,
+					 const xmlChar *modeURI);
+XSLTPUBFUN xsltTemplatePtr XSLTCALL
+		xsltGetTemplate		(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xsltStylesheetPtr style);
+XSLTPUBFUN void XSLTCALL
+		xsltFreeTemplateHashes	(xsltStylesheetPtr style);
+XSLTPUBFUN void XSLTCALL
+		xsltCleanupTemplates	(xsltStylesheetPtr style);
+
+#if 0
+int		xsltMatchPattern	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 const xmlChar *pattern,
+					 xmlDocPtr ctxtdoc,
+					 xmlNodePtr ctxtnode);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_PATTERN_H__ */
+
diff --git a/third_party/libxslt/libxslt/preproc.c b/third_party/libxslt/libxslt/preproc.c
new file mode 100644
index 0000000..2842370
--- /dev/null
+++ b/third_party/libxslt/libxslt/preproc.c
@@ -0,0 +1,2340 @@
+/*
+ * preproc.c: Preprocessing of style operations
+ *
+ * References:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ *   Michael Kay "XSLT Programmer's Reference" pp 637-643
+ *   Writing Multiple Output Files
+ *
+ *   XSLT-1.1 Working Draft
+ *   http://www.w3.org/TR/xslt11#multiple-output
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltutils.h"
+#include "xsltInternals.h"
+#include "transform.h"
+#include "templates.h"
+#include "variables.h"
+#include "numbersInternals.h"
+#include "preproc.h"
+#include "extra.h"
+#include "imports.h"
+#include "extensions.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_PREPROC
+#endif
+
+const xmlChar *xsltExtMarker = (const xmlChar *) "Extension Element";
+
+/************************************************************************
+ *									*
+ *			Grammar checks					*
+ *									*
+ ************************************************************************/
+
+#ifdef XSLT_REFACTORED
+    /*
+    * Grammar checks are now performed in xslt.c.
+    */
+#else
+/**
+ * xsltCheckTopLevelElement:
+ * @style: the XSLT stylesheet
+ * @inst: the XSLT instruction
+ * @err: raise an error or not
+ *
+ * Check that the instruction is instanciated as a top level element.
+ *
+ * Returns -1 in case of error, 0 if failed and 1 in case of success
+ */
+static int
+xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) {
+    xmlNodePtr parent;
+    if ((style == NULL) || (inst == NULL) || (inst->ns == NULL))
+        return(-1);
+    
+    parent = inst->parent;
+    if (parent == NULL) {
+        if (err) {
+	    xsltTransformError(NULL, style, inst,
+		    "internal problem: element has no parent\n");
+	    style->errors++;
+	}
+	return(0);
+    }
+    if ((parent->ns == NULL) ||
+        ((parent->ns != inst->ns) &&
+	 (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
+	((!xmlStrEqual(parent->name, BAD_CAST "stylesheet")) &&
+	 (!xmlStrEqual(parent->name, BAD_CAST "transform")))) {
+	if (err) {
+	    xsltTransformError(NULL, style, inst,
+		    "element %s only allowed as child of stylesheet\n",
+			       inst->name);
+	    style->errors++;
+	}
+	return(0);
+    }
+    return(1);
+}
+
+/**
+ * xsltCheckInstructionElement:
+ * @style: the XSLT stylesheet
+ * @inst: the XSLT instruction
+ *
+ * Check that the instruction is instanciated as an instruction element.
+ */
+static void
+xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) {
+    xmlNodePtr parent;
+    int has_ext;
+
+    if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) ||
+        (style->literal_result))
+        return;
+
+    has_ext = (style->extInfos != NULL);
+    
+    parent = inst->parent;
+    if (parent == NULL) {
+	xsltTransformError(NULL, style, inst,
+		"internal problem: element has no parent\n");
+	style->errors++;
+	return;
+    }
+    while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) {
+        if (((parent->ns == inst->ns) ||
+	     ((parent->ns != NULL) &&
+	      (xmlStrEqual(parent->ns->href, inst->ns->href)))) &&
+	    ((xmlStrEqual(parent->name, BAD_CAST "template")) ||
+	     (xmlStrEqual(parent->name, BAD_CAST "param")) ||
+	     (xmlStrEqual(parent->name, BAD_CAST "attribute")) ||
+	     (xmlStrEqual(parent->name, BAD_CAST "variable")))) {
+	    return;
+	}
+
+	/*
+	 * if we are within an extension element all bets are off
+	 * about the semantic there e.g. xsl:param within func:function
+	 */
+	if ((has_ext) && (parent->ns != NULL) &&
+	    (xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
+	    return;
+	
+        parent = parent->parent;
+    }
+    xsltTransformError(NULL, style, inst,
+	    "element %s only allowed within a template, variable or param\n",
+		           inst->name);
+    style->errors++;
+}
+
+/**
+ * xsltCheckParentElement:
+ * @style: the XSLT stylesheet
+ * @inst: the XSLT instruction
+ * @allow1: allowed parent1
+ * @allow2: allowed parent2
+ *
+ * Check that the instruction is instanciated as the childre of one of the
+ * possible parents.
+ */
+static void
+xsltCheckParentElement(xsltStylesheetPtr style, xmlNodePtr inst,
+                       const xmlChar *allow1, const xmlChar *allow2) {
+    xmlNodePtr parent;
+
+    if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) ||
+        (style->literal_result))
+        return;
+
+    parent = inst->parent;
+    if (parent == NULL) {
+	xsltTransformError(NULL, style, inst,
+		"internal problem: element has no parent\n");
+	style->errors++;
+	return;
+    }
+    if (((parent->ns == inst->ns) ||
+	 ((parent->ns != NULL) &&
+	  (xmlStrEqual(parent->ns->href, inst->ns->href)))) &&
+	((xmlStrEqual(parent->name, allow1)) ||
+	 (xmlStrEqual(parent->name, allow2)))) {
+	return;
+    }
+
+    if (style->extInfos != NULL) {
+	while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) {
+	    /*
+	     * if we are within an extension element all bets are off
+	     * about the semantic there e.g. xsl:param within func:function
+	     */
+	    if ((parent->ns != NULL) &&
+		(xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
+		return;
+	    
+	    parent = parent->parent;
+	}
+    }
+    xsltTransformError(NULL, style, inst,
+		       "element %s is not allowed within that context\n",
+		       inst->name);
+    style->errors++;
+}
+#endif
+
+/************************************************************************
+ *									*
+ *			handling of precomputed data			*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltNewStylePreComp:
+ * @style:  the XSLT stylesheet
+ * @type:  the construct type
+ *
+ * Create a new XSLT Style precomputed block
+ *
+ * Returns the newly allocated specialized structure
+ *         or NULL in case of error
+ */
+static xsltStylePreCompPtr
+xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) {
+    xsltStylePreCompPtr cur;
+#ifdef XSLT_REFACTORED
+    size_t size;
+#endif
+
+    if (style == NULL)
+        return(NULL);
+   
+#ifdef XSLT_REFACTORED
+    /*
+    * URGENT TODO: Use specialized factory functions in order
+    *   to avoid this ugliness.
+    */
+    switch (type) {
+        case XSLT_FUNC_COPY:
+            size = sizeof(xsltStyleItemCopy); break;
+        case XSLT_FUNC_SORT:
+            size = sizeof(xsltStyleItemSort); break;
+        case XSLT_FUNC_TEXT:
+            size = sizeof(xsltStyleItemText); break;
+        case XSLT_FUNC_ELEMENT:
+            size = sizeof(xsltStyleItemElement); break;
+        case XSLT_FUNC_ATTRIBUTE:
+            size = sizeof(xsltStyleItemAttribute); break;
+        case XSLT_FUNC_COMMENT:
+            size = sizeof(xsltStyleItemComment); break;
+        case XSLT_FUNC_PI:
+            size = sizeof(xsltStyleItemPI); break;
+        case XSLT_FUNC_COPYOF:
+            size = sizeof(xsltStyleItemCopyOf); break;
+        case XSLT_FUNC_VALUEOF:
+            size = sizeof(xsltStyleItemValueOf); break;;
+        case XSLT_FUNC_NUMBER:
+            size = sizeof(xsltStyleItemNumber); break;
+        case XSLT_FUNC_APPLYIMPORTS:
+            size = sizeof(xsltStyleItemApplyImports); break;
+        case XSLT_FUNC_CALLTEMPLATE:
+            size = sizeof(xsltStyleItemCallTemplate); break;
+        case XSLT_FUNC_APPLYTEMPLATES:
+            size = sizeof(xsltStyleItemApplyTemplates); break;
+        case XSLT_FUNC_CHOOSE:
+            size = sizeof(xsltStyleItemChoose); break;
+        case XSLT_FUNC_IF:
+            size = sizeof(xsltStyleItemIf); break;
+        case XSLT_FUNC_FOREACH:
+            size = sizeof(xsltStyleItemForEach); break;
+        case XSLT_FUNC_DOCUMENT:
+            size = sizeof(xsltStyleItemDocument); break;
+	case XSLT_FUNC_WITHPARAM:
+	    size = sizeof(xsltStyleItemWithParam); break;
+	case XSLT_FUNC_PARAM:
+	    size = sizeof(xsltStyleItemParam); break;
+	case XSLT_FUNC_VARIABLE:
+	    size = sizeof(xsltStyleItemVariable); break;
+	case XSLT_FUNC_WHEN:
+	    size = sizeof(xsltStyleItemWhen); break;
+	case XSLT_FUNC_OTHERWISE:
+	    size = sizeof(xsltStyleItemOtherwise); break;
+	default:	
+	    xsltTransformError(NULL, style, NULL,
+		    "xsltNewStylePreComp : invalid type %d\n", type);
+	    style->errors++;
+	    return(NULL);
+    }
+    /*
+    * Create the structure.
+    */
+    cur = (xsltStylePreCompPtr) xmlMalloc(size);
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, NULL,
+		"xsltNewStylePreComp : malloc failed\n");
+	style->errors++;
+	return(NULL);
+    }
+    memset(cur, 0, size);
+
+#else /* XSLT_REFACTORED */
+    /*
+    * Old behaviour.
+    */
+    cur = (xsltStylePreCompPtr) xmlMalloc(sizeof(xsltStylePreComp));
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, NULL,
+		"xsltNewStylePreComp : malloc failed\n");
+	style->errors++;
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltStylePreComp));
+#endif /* XSLT_REFACTORED */
+
+    /*
+    * URGENT TODO: Better to move this to spezialized factory functions.
+    */
+    cur->type = type;
+    switch (cur->type) {
+        case XSLT_FUNC_COPY:
+            cur->func = (xsltTransformFunction) xsltCopy;break;
+        case XSLT_FUNC_SORT:
+            cur->func = (xsltTransformFunction) xsltSort;break;
+        case XSLT_FUNC_TEXT:
+            cur->func = (xsltTransformFunction) xsltText;break;
+        case XSLT_FUNC_ELEMENT:
+            cur->func = (xsltTransformFunction) xsltElement;break;
+        case XSLT_FUNC_ATTRIBUTE:
+            cur->func = (xsltTransformFunction) xsltAttribute;break;
+        case XSLT_FUNC_COMMENT:
+            cur->func = (xsltTransformFunction) xsltComment;break;
+        case XSLT_FUNC_PI:
+            cur->func = (xsltTransformFunction) xsltProcessingInstruction;
+	    break;
+        case XSLT_FUNC_COPYOF:
+            cur->func = (xsltTransformFunction) xsltCopyOf;break;
+        case XSLT_FUNC_VALUEOF:
+            cur->func = (xsltTransformFunction) xsltValueOf;break;
+        case XSLT_FUNC_NUMBER:
+            cur->func = (xsltTransformFunction) xsltNumber;break;
+        case XSLT_FUNC_APPLYIMPORTS:
+            cur->func = (xsltTransformFunction) xsltApplyImports;break;
+        case XSLT_FUNC_CALLTEMPLATE:
+            cur->func = (xsltTransformFunction) xsltCallTemplate;break;
+        case XSLT_FUNC_APPLYTEMPLATES:
+            cur->func = (xsltTransformFunction) xsltApplyTemplates;break;
+        case XSLT_FUNC_CHOOSE:
+            cur->func = (xsltTransformFunction) xsltChoose;break;
+        case XSLT_FUNC_IF:
+            cur->func = (xsltTransformFunction) xsltIf;break;
+        case XSLT_FUNC_FOREACH:
+            cur->func = (xsltTransformFunction) xsltForEach;break;
+        case XSLT_FUNC_DOCUMENT:
+            cur->func = (xsltTransformFunction) xsltDocumentElem;break;
+	case XSLT_FUNC_WITHPARAM:
+	case XSLT_FUNC_PARAM:	    
+	case XSLT_FUNC_VARIABLE:	    
+	case XSLT_FUNC_WHEN:
+	    break;
+	default:
+	if (cur->func == NULL) {
+	    xsltTransformError(NULL, style, NULL,
+		    "xsltNewStylePreComp : no function for type %d\n", type);
+	    style->errors++;
+	}
+    }
+    cur->next = style->preComps;
+    style->preComps = (xsltElemPreCompPtr) cur;
+
+    return(cur);
+}
+
+/**
+ * xsltFreeStylePreComp:
+ * @comp:  an XSLT Style precomputed block
+ *
+ * Free up the memory allocated by @comp
+ */
+static void
+xsltFreeStylePreComp(xsltStylePreCompPtr comp) {
+    if (comp == NULL)
+	return;
+#ifdef XSLT_REFACTORED
+    /*
+    * URGENT TODO: Implement destructors.
+    */
+    switch (comp->type) {
+	case XSLT_FUNC_LITERAL_RESULT_ELEMENT:
+	    break;
+	case XSLT_FUNC_COPY:
+            break;
+        case XSLT_FUNC_SORT: {
+		xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_TEXT:
+            break;
+        case XSLT_FUNC_ELEMENT:
+            break;
+        case XSLT_FUNC_ATTRIBUTE:
+            break;
+        case XSLT_FUNC_COMMENT:
+            break;
+        case XSLT_FUNC_PI:
+	    break;
+        case XSLT_FUNC_COPYOF: {
+		xsltStyleItemCopyOfPtr item = (xsltStyleItemCopyOfPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_VALUEOF: {
+		xsltStyleItemValueOfPtr item = (xsltStyleItemValueOfPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_NUMBER:
+            break;
+        case XSLT_FUNC_APPLYIMPORTS:
+            break;
+        case XSLT_FUNC_CALLTEMPLATE:
+            break;
+        case XSLT_FUNC_APPLYTEMPLATES: {
+		xsltStyleItemApplyTemplatesPtr item =
+		    (xsltStyleItemApplyTemplatesPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_CHOOSE:
+            break;
+        case XSLT_FUNC_IF: {
+		xsltStyleItemIfPtr item = (xsltStyleItemIfPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_FOREACH: {
+		xsltStyleItemForEachPtr item =
+		    (xsltStyleItemForEachPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+            break;
+        case XSLT_FUNC_DOCUMENT:
+            break;
+	case XSLT_FUNC_WITHPARAM: {
+		xsltStyleItemWithParamPtr item =
+		    (xsltStyleItemWithParamPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+	    break;
+	case XSLT_FUNC_PARAM: {
+		xsltStyleItemParamPtr item =
+		    (xsltStyleItemParamPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+	    break;
+	case XSLT_FUNC_VARIABLE: {
+		xsltStyleItemVariablePtr item =
+		    (xsltStyleItemVariablePtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+	    break;
+	case XSLT_FUNC_WHEN: {
+		xsltStyleItemWhenPtr item =
+		    (xsltStyleItemWhenPtr) comp;
+		if (item->comp != NULL)
+		    xmlXPathFreeCompExpr(item->comp);
+	    }
+	    break;
+	case XSLT_FUNC_OTHERWISE:	    
+	case XSLT_FUNC_FALLBACK:
+	case XSLT_FUNC_MESSAGE:
+	case XSLT_FUNC_INCLUDE:
+	case XSLT_FUNC_ATTRSET:
+	
+	    break;
+	default:
+	    /* TODO: Raise error. */
+	    break;
+    }
+#else    
+    if (comp->comp != NULL)
+	xmlXPathFreeCompExpr(comp->comp);
+    if (comp->nsList != NULL)
+	xmlFree(comp->nsList);
+#endif
+
+    xmlFree(comp);
+}
+
+
+/************************************************************************
+ *									*
+ *		    XSLT-1.1 extensions					*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltDocumentComp:
+ * @style:  the XSLT stylesheet
+ * @inst:  the instruction in the stylesheet
+ * @function:  unused
+ *
+ * Pre process an XSLT-1.1 document element
+ *
+ * Returns a precompiled data structure for the element
+ */
+xsltElemPreCompPtr
+xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst,
+		 xsltTransformFunction function ATTRIBUTE_UNUSED) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemDocumentPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    const xmlChar *filename = NULL;
+
+    /*
+    * As of 2006-03-30, this function is currently defined in Libxslt
+    * to be used for:
+    * (in libxslt/extra.c)
+    * "output" in XSLT_SAXON_NAMESPACE
+    * "write" XSLT_XALAN_NAMESPACE
+    * "document" XSLT_XT_NAMESPACE
+    * "document" XSLT_NAMESPACE (from the abandoned old working
+    *                            draft of XSLT 1.1)
+    * (in libexslt/common.c)
+    * "document" in EXSLT_COMMON_NAMESPACE
+    */
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemDocumentPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT);
+#endif
+    
+    if (comp == NULL)
+	return (NULL);
+    comp->inst = inst;
+    comp->ver11 = 0;
+
+    if (xmlStrEqual(inst->name, (const xmlChar *) "output")) {
+#ifdef WITH_XSLT_DEBUG_EXTRA
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Found saxon:output extension\n");
+#endif
+	/*
+	* The element "output" is in the namespace XSLT_SAXON_NAMESPACE
+	*   (http://icl.com/saxon)
+	* The @file is in no namespace; it is an AVT.
+	*   (http://www.computerwizards.com/saxon/doc/extensions.html#saxon:output)
+	*
+	* TODO: Do we need not to check the namespace here?
+	*/
+	filename = xsltEvalStaticAttrValueTemplate(style, inst,
+			 (const xmlChar *)"file",
+			 NULL, &comp->has_filename);
+    } else if (xmlStrEqual(inst->name, (const xmlChar *) "write")) {
+#ifdef WITH_XSLT_DEBUG_EXTRA
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "Found xalan:write extension\n");
+#endif
+	/* the filename need to be interpreted */
+	/*
+	* TODO: Is "filename need to be interpreted" meant to be a todo?
+	*   Where will be the filename of xalan:write be processed?
+	*
+	* TODO: Do we need not to check the namespace here?
+	*   The extension ns is "http://xml.apache.org/xalan/redirect".
+	*   See http://xml.apache.org/xalan-j/extensionslib.html.
+	*/
+    } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) {
+	if (inst->ns != NULL) {
+	    if (xmlStrEqual(inst->ns->href, XSLT_NAMESPACE)) {
+		/*
+		* Mark the instruction as being of
+		* XSLT version 1.1 (abandoned).
+		*/
+		comp->ver11 = 1;
+#ifdef WITH_XSLT_DEBUG_EXTRA
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "Found xslt11:document construct\n");
+#endif	    		
+	    } else {		
+		if (xmlStrEqual(inst->ns->href,
+		    (const xmlChar *)"http://exslt.org/common")) {
+		    /* EXSLT. */
+#ifdef WITH_XSLT_DEBUG_EXTRA
+		    xsltGenericDebug(xsltGenericDebugContext,
+			"Found exslt:document extension\n");
+#endif
+		} else if (xmlStrEqual(inst->ns->href, XSLT_XT_NAMESPACE)) {
+		    /* James Clark's XT. */
+#ifdef WITH_XSLT_DEBUG_EXTRA
+		    xsltGenericDebug(xsltGenericDebugContext,
+			"Found xt:document extension\n");
+#endif
+		}
+	    }
+	}
+	/*
+	* The element "document" is used in conjunction with the
+	* following namespaces:
+	*
+	* 1) XSLT_NAMESPACE (http://www.w3.org/1999/XSL/Transform version 1.1)
+	*    
+	*    
+	*    TODO: is @href is an AVT?
+	*		
+	* In all cases @href is in no namespace.
+	*/
+	filename = xsltEvalStaticAttrValueTemplate(style, inst,
+	    (const xmlChar *)"href", NULL, &comp->has_filename);
+    }		
+    if (!comp->has_filename) {
+	goto error;
+    }
+    comp->filename = filename;
+
+error:
+    return ((xsltElemPreCompPtr) comp);
+}
+
+/************************************************************************
+ *									*
+ *		Most of the XSLT-1.0 transformations			*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltSortComp:
+ * @style:  the XSLT stylesheet
+ * @inst:  the xslt sort node
+ *
+ * Process the xslt sort node on the source node
+ */
+static void
+xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemSortPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemSortPtr) xsltNewStylePreComp(style, XSLT_FUNC_SORT);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT);
+#endif
+    
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->stype = xsltEvalStaticAttrValueTemplate(style, inst,
+			 (const xmlChar *)"data-type",
+			 NULL, &comp->has_stype);
+    if (comp->stype != NULL) {
+	if (xmlStrEqual(comp->stype, (const xmlChar *) "text"))
+	    comp->number = 0;
+	else if (xmlStrEqual(comp->stype, (const xmlChar *) "number"))
+	    comp->number = 1;
+	else {
+	    xsltTransformError(NULL, style, inst,
+		 "xsltSortComp: no support for data-type = %s\n", comp->stype);
+	    comp->number = 0; /* use default */
+	    if (style != NULL) style->warnings++;
+	}
+    }
+    comp->order = xsltEvalStaticAttrValueTemplate(style, inst,
+			      (const xmlChar *)"order",
+			      NULL, &comp->has_order);
+    if (comp->order != NULL) {
+	if (xmlStrEqual(comp->order, (const xmlChar *) "ascending"))
+	    comp->descending = 0;
+	else if (xmlStrEqual(comp->order, (const xmlChar *) "descending"))
+	    comp->descending = 1;
+	else {
+	    xsltTransformError(NULL, style, inst,
+		 "xsltSortComp: invalid value %s for order\n", comp->order);
+	    comp->descending = 0; /* use default */
+	    if (style != NULL) style->warnings++;
+	}
+    }
+    comp->case_order = xsltEvalStaticAttrValueTemplate(style, inst,
+			      (const xmlChar *)"case-order",
+			      NULL, &comp->has_use);
+    if (comp->case_order != NULL) {
+	if (xmlStrEqual(comp->case_order, (const xmlChar *) "upper-first"))
+	    comp->lower_first = 0;
+	else if (xmlStrEqual(comp->case_order, (const xmlChar *) "lower-first"))
+	    comp->lower_first = 1;
+	else {
+	    xsltTransformError(NULL, style, inst,
+		 "xsltSortComp: invalid value %s for order\n", comp->order);
+	    comp->lower_first = 0; /* use default */
+	    if (style != NULL) style->warnings++;
+	}
+    }
+
+    comp->lang = xsltEvalStaticAttrValueTemplate(style, inst,
+				 (const xmlChar *)"lang",
+				 NULL, &comp->has_lang);
+
+    comp->select = xsltGetCNsProp(style, inst,(const xmlChar *)"select", XSLT_NAMESPACE);
+    if (comp->select == NULL) {
+	/*
+	 * The default value of the select attribute is ., which will
+	 * cause the string-value of the current node to be used as
+	 * the sort key.
+	 */
+	comp->select = xmlDictLookup(style->dict, BAD_CAST ".", 1);
+    }
+    comp->comp = xsltXPathCompile(style, comp->select);
+    if (comp->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsltSortComp: could not compile select expression '%s'\n",
+	                 comp->select);
+	if (style != NULL) style->errors++;
+    }
+    if (inst->children != NULL) {
+	xsltTransformError(NULL, style, inst,
+	"xsl:sort : is not empty\n");
+	if (style != NULL) style->errors++;
+    }
+}
+
+/**
+ * xsltCopyComp:
+ * @style:  the XSLT stylesheet
+ * @inst:  the xslt copy node
+ *
+ * Process the xslt copy node on the source node
+ */
+static void
+xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCopyPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY);
+#endif
+    
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+
+    comp->use = xsltGetCNsProp(style, inst, (const xmlChar *)"use-attribute-sets",
+				    XSLT_NAMESPACE);
+    if (comp->use == NULL)
+	comp->has_use = 0;
+    else
+	comp->has_use = 1;
+}
+
+#ifdef XSLT_REFACTORED
+    /* Enable if ever needed for xsl:text. */
+#else
+/**
+ * xsltTextComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt text node
+ *
+ * TODO: This function is obsolete, since xsl:text won't
+ *  be compiled, but removed from the tree.
+ *
+ * Process the xslt text node on the source node
+ */
+static void
+xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemTextPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    const xmlChar *prop;
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
+#endif    
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+    comp->noescape = 0;
+
+    prop = xsltGetCNsProp(style, inst,
+	    (const xmlChar *)"disable-output-escaping",
+			XSLT_NAMESPACE);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+	    comp->noescape = 1;
+	} else if (!xmlStrEqual(prop,
+	    (const xmlChar *)"no")){
+	    xsltTransformError(NULL, style, inst,
+		"xsl:text: disable-output-escaping allows only yes or no\n");
+	    if (style != NULL) style->warnings++;
+	}
+    }
+}
+#endif /* else of XSLT_REFACTORED */
+
+/**
+ * xsltElementComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt element node
+ *
+ * Process the xslt element node on the source node
+ */
+static void
+xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemElementPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    /*
+    * 
+    *   
+    * 
+    */
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemElementPtr) xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+    * Attribute "name".
+    */
+    /*
+    * TODO: Precompile the AVT. See bug #344894.
+    */
+    comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
+	(const xmlChar *)"name", NULL, &comp->has_name);
+    if (! comp->has_name) {
+	xsltTransformError(NULL, style, inst,
+	    "xsl:element: The attribute 'name' is missing.\n");
+	style->errors++;
+	goto error;
+    }
+    /*
+    * Attribute "namespace".
+    */
+    /*
+    * TODO: Precompile the AVT. See bug #344894.
+    */
+    comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
+	(const xmlChar *)"namespace", NULL, &comp->has_ns);
+    
+    if (comp->name != NULL) {	
+	if (xmlValidateQName(comp->name, 0)) {
+	    xsltTransformError(NULL, style, inst,
+		"xsl:element: The value '%s' of the attribute 'name' is "
+		"not a valid QName.\n", comp->name);
+	    style->errors++;
+	} else {
+	    const xmlChar *prefix = NULL, *name;
+
+	    name = xsltSplitQName(style->dict, comp->name, &prefix);
+	    if (comp->has_ns == 0) {	    
+		xmlNsPtr ns;
+
+		/*
+		* SPEC XSLT 1.0:
+		*  "If the namespace attribute is not present, then the QName is
+		*  expanded into an expanded-name using the namespace declarations
+		*  in effect for the xsl:element element, including any default
+		*  namespace declaration.
+		*/		
+		ns = xmlSearchNs(inst->doc, inst, prefix);
+		if (ns != NULL) {
+		    comp->ns = xmlDictLookup(style->dict, ns->href, -1);
+		    comp->has_ns = 1;
+#ifdef XSLT_REFACTORED
+		    comp->nsPrefix = prefix;
+		    comp->name = name;
+#endif
+		} else if (prefix != NULL) {
+		    xsltTransformError(NULL, style, inst,
+			"xsl:element: The prefixed QName '%s' "
+			"has no namespace binding in scope in the "
+			"stylesheet; this is an error, since the namespace was "
+			"not specified by the instruction itself.\n", comp->name);
+		    style->errors++;
+		}
+	    }	    
+	    if ((prefix != NULL) &&
+		(!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)))
+	    {
+		/*
+		* Mark is to be skipped.
+		*/
+		comp->has_name = 0;		
+	    }
+	}
+    }    
+    /*
+    * Attribute "use-attribute-sets",
+    */
+    comp->use = xsltEvalStaticAttrValueTemplate(style, inst,
+		       (const xmlChar *)"use-attribute-sets",
+		       NULL, &comp->has_use);
+
+error:    
+    return;
+}
+
+/**
+ * xsltAttributeComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt attribute node
+ *
+ * Process the xslt attribute node on the source node
+ */
+static void
+xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemAttributePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    /*
+    * 
+    *   
+    * 
+    */
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemAttributePtr) xsltNewStylePreComp(style,
+	XSLT_FUNC_ATTRIBUTE);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE);
+#endif
+    
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+    * Attribute "name".
+    */
+    /*
+    * TODO: Precompile the AVT. See bug #344894.
+    */
+    comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
+				 (const xmlChar *)"name",
+				 NULL, &comp->has_name);
+    if (! comp->has_name) {
+	xsltTransformError(NULL, style, inst,
+	    "XSLT-attribute: The attribute 'name' is missing.\n");
+	style->errors++;
+	return;
+    }    
+    /*
+    * Attribute "namespace".
+    */
+    /*
+    * TODO: Precompile the AVT. See bug #344894.
+    */
+    comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
+	(const xmlChar *)"namespace",
+	NULL, &comp->has_ns);
+
+    if (comp->name != NULL) {
+	if (xmlValidateQName(comp->name, 0)) {
+	    xsltTransformError(NULL, style, inst,
+		"xsl:attribute: The value '%s' of the attribute 'name' is "
+		"not a valid QName.\n", comp->name);
+	    style->errors++;
+	} else {
+	    const xmlChar *prefix = NULL, *name;
+
+	    name = xsltSplitQName(style->dict, comp->name, &prefix);
+	    if (prefix != NULL) {
+		if (comp->has_ns == 0) {
+		    xmlNsPtr ns;
+
+		    /*
+		    * SPEC XSLT 1.0:
+		    *  "If the namespace attribute is not present, then the
+		    *  QName is expanded into an expanded-name using the
+		    *  namespace declarations in effect for the xsl:element
+		    *  element, including any default namespace declaration.
+		    */	    	    
+		    ns = xmlSearchNs(inst->doc, inst, prefix);
+		    if (ns != NULL) {
+			comp->ns = xmlDictLookup(style->dict, ns->href, -1);
+			comp->has_ns = 1;
+#ifdef XSLT_REFACTORED
+			comp->nsPrefix = prefix;
+			comp->name = name;
+#endif
+		    } else {
+			xsltTransformError(NULL, style, inst,
+			    "xsl:attribute: The prefixed QName '%s' "
+			    "has no namespace binding in scope in the "
+			    "stylesheet; this is an error, since the "
+			    "namespace was not specified by the instruction "
+			    "itself.\n", comp->name);
+			style->errors++;
+		    }
+		}
+		if (!xmlStrncasecmp(prefix, (xmlChar *) "xmlns", 5)) {
+		    /*
+		    * SPEC XSLT 1.0:
+		    *  "It is an error if the string that results from
+		    *  instantiating the attribute value template is not a
+		    *  QName or is the string xmlns. An XSLT processor may
+		    *  signal the error; if it does not signal the error,
+		    *  it must recover by not adding the attribute to the
+		    *  result tree."
+		    *
+		    * Reject a prefix of "xmlns". Mark to be skipped.
+		    */
+		    comp->has_name = 0;
+		    
+#ifdef WITH_XSLT_DEBUG_PARSING
+		    xsltGenericDebug(xsltGenericDebugContext,
+			"xsltAttribute: xmlns prefix forbidden\n");
+#endif		    
+		    return;
+		}
+		
+	    }
+	}	
+    }
+}
+
+/**
+ * xsltCommentComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt comment node
+ *
+ * Process the xslt comment node on the source node
+ */
+static void
+xsltCommentComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCommentPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemCommentPtr) xsltNewStylePreComp(style, XSLT_FUNC_COMMENT);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_COMMENT);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+}
+
+/**
+ * xsltProcessingInstructionComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt processing-instruction node
+ *
+ * Process the xslt processing-instruction node on the source node
+ */
+static void
+xsltProcessingInstructionComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemPIPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemPIPtr) xsltNewStylePreComp(style, XSLT_FUNC_PI);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_PI);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
+				 (const xmlChar *)"name",
+				 XSLT_NAMESPACE, &comp->has_name);
+}
+
+/**
+ * xsltCopyOfComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt copy-of node
+ *
+ * Process the xslt copy-of node on the source node
+ */
+static void
+xsltCopyOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCopyOfPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemCopyOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPYOF);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_COPYOF);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:copy-of : select is missing\n");
+	if (style != NULL) style->errors++;
+	return;
+    }
+    comp->comp = xsltXPathCompile(style, comp->select);
+    if (comp->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:copy-of : could not compile select expression '%s'\n",
+	                 comp->select);
+	if (style != NULL) style->errors++;
+    }
+}
+
+/**
+ * xsltValueOfComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt value-of node
+ *
+ * Process the xslt value-of node on the source node
+ */
+static void
+xsltValueOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemValueOfPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    const xmlChar *prop;
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemValueOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    prop = xsltGetCNsProp(style, inst,
+	    (const xmlChar *)"disable-output-escaping",
+			XSLT_NAMESPACE);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+	    comp->noescape = 1;
+	} else if (!xmlStrEqual(prop,
+				(const xmlChar *)"no")){
+	    xsltTransformError(NULL, style, inst,
+"xsl:value-of : disable-output-escaping allows only yes or no\n");
+	    if (style != NULL) style->warnings++;
+	}
+    }
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:value-of : select is missing\n");
+	if (style != NULL) style->errors++;
+	return;
+    }
+    comp->comp = xsltXPathCompile(style, comp->select);
+    if (comp->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:value-of : could not compile select expression '%s'\n",
+	                 comp->select);
+	if (style != NULL) style->errors++;
+    }
+}
+
+static void
+xsltGetQNameProperty(xsltStylesheetPtr style, xmlNodePtr inst,
+		     const xmlChar *propName,
+		     int mandatory,
+		     int *hasProp, const xmlChar **nsName,
+		     const xmlChar** localName)
+{
+    const xmlChar *prop;
+
+    if (nsName)
+	*nsName = NULL;
+    if (localName)
+	*localName = NULL;
+    if (hasProp)
+	*hasProp = 0;
+
+    prop = xsltGetCNsProp(style, inst, propName, XSLT_NAMESPACE);
+    if (prop == NULL) {
+	if (mandatory) {
+	    xsltTransformError(NULL, style, inst,
+		"The attribute '%s' is missing.\n", propName);
+	    style->errors++;
+	    return;
+	}
+    } else {
+        const xmlChar *URI;
+
+	if (xmlValidateQName(prop, 0)) {
+	    xsltTransformError(NULL, style, inst,
+		"The value '%s' of the attribute "
+		"'%s' is not a valid QName.\n", prop, propName);
+	    style->errors++;
+	    return;
+	} else {
+	    /*
+	    * @prop will be in the string dict afterwards, @URI not.
+	    */
+	    URI = xsltGetQNameURI2(style, inst, &prop);
+	    if (prop == NULL) {
+		style->errors++;
+	    } else {
+		*localName = prop;
+		if (hasProp)
+		    *hasProp = 1;
+		if (URI != NULL) {
+		    /*
+		    * Fixes bug #308441: Put the ns-name in the dict
+		    * in order to pointer compare names during XPath's
+		    * variable lookup.
+		    */
+		    if (nsName)
+			*nsName = xmlDictLookup(style->dict, URI, -1);
+		    /* comp->has_ns = 1; */
+		}
+	    }
+	}
+    }
+    return;
+}
+
+/**
+ * xsltWithParamComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt with-param node
+ *
+ * Process the xslt with-param node on the source node
+ * Allowed parents: xsl:call-template, xsl:apply-templates.
+ * 
+ *  
+ * 
+ */
+static void
+xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemWithParamPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemWithParamPtr) xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+    * Attribute "name".
+    */
+    xsltGetQNameProperty(style, inst, BAD_CAST "name",
+	1, &(comp->has_name), &(comp->ns), &(comp->name));
+    if (comp->ns)
+	comp->has_ns = 1;
+    /*
+    * Attribute "select".
+    */
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select != NULL) {
+	comp->comp = xsltXPathCompile(style, comp->select);
+	if (comp->comp == NULL) {
+	    xsltTransformError(NULL, style, inst,
+		 "XSLT-with-param: Failed to compile select "
+		 "expression '%s'\n", comp->select);
+	    style->errors++;
+	}
+	if (inst->children != NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-with-param: The content should be empty since "
+		"the attribute select is present.\n");
+	    style->warnings++;
+	}
+    }
+}
+
+/**
+ * xsltNumberComp:
+ * @style: an XSLT compiled stylesheet
+ * @cur:   the xslt number node
+ *
+ * Process the xslt number node on the source node
+ */
+static void
+xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemNumberPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    const xmlChar *prop;
+
+    if ((style == NULL) || (cur == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemNumberPtr) xsltNewStylePreComp(style, XSLT_FUNC_NUMBER);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_NUMBER);
+#endif
+
+    if (comp == NULL)
+	return;
+    cur->psvi = comp;
+
+    if ((style == NULL) || (cur == NULL))
+	return;
+
+    comp->numdata.doc = cur->doc;
+    comp->numdata.node = cur;
+    comp->numdata.value = xsltGetCNsProp(style, cur, (const xmlChar *)"value",
+	                                XSLT_NAMESPACE);
+    
+    prop = xsltEvalStaticAttrValueTemplate(style, cur,
+			 (const xmlChar *)"format",
+			 XSLT_NAMESPACE, &comp->numdata.has_format);
+    if (comp->numdata.has_format == 0) {
+	comp->numdata.format = xmlDictLookup(style->dict, BAD_CAST "" , 0);
+    } else {
+	comp->numdata.format = prop;
+    }
+
+    comp->numdata.count = xsltGetCNsProp(style, cur, (const xmlChar *)"count",
+					XSLT_NAMESPACE);
+    comp->numdata.from = xsltGetCNsProp(style, cur, (const xmlChar *)"from",
+					XSLT_NAMESPACE);
+    
+    prop = xsltGetCNsProp(style, cur, (const xmlChar *)"level", XSLT_NAMESPACE);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, BAD_CAST("single")) ||
+	    xmlStrEqual(prop, BAD_CAST("multiple")) ||
+	    xmlStrEqual(prop, BAD_CAST("any"))) {
+	    comp->numdata.level = prop;
+	} else {
+	    xsltTransformError(NULL, style, cur,
+			 "xsl:number : invalid value %s for level\n", prop);
+	    if (style != NULL) style->warnings++;
+	}
+    }
+    
+    prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE);
+    if (prop != NULL) {
+	    xsltTransformError(NULL, style, cur,
+		 "xsl:number : lang attribute not implemented\n");
+	XSLT_TODO; /* xsl:number lang attribute */
+    }
+    
+    prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) {
+	    xsltTransformError(NULL, style, cur,
+		 "xsl:number : letter-value 'alphabetic' not implemented\n");
+	    if (style != NULL) style->warnings++;
+	    XSLT_TODO; /* xsl:number letter-value attribute alphabetic */
+	} else if (xmlStrEqual(prop, BAD_CAST("traditional"))) {
+	    xsltTransformError(NULL, style, cur,
+		 "xsl:number : letter-value 'traditional' not implemented\n");
+	    if (style != NULL) style->warnings++;
+	    XSLT_TODO; /* xsl:number letter-value attribute traditional */
+	} else {
+	    xsltTransformError(NULL, style, cur,
+		     "xsl:number : invalid value %s for letter-value\n", prop);
+	    if (style != NULL) style->warnings++;
+	}
+    }
+    
+    prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator",
+	                XSLT_NAMESPACE);
+    if (prop != NULL) {
+        comp->numdata.groupingCharacterLen = xmlStrlen(prop);
+	comp->numdata.groupingCharacter =
+	    xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen));
+    }
+    
+    prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE);
+    if (prop != NULL) {
+	sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup);
+    } else {
+	comp->numdata.groupingCharacter = 0;
+    }
+
+    /* Set default values */
+    if (comp->numdata.value == NULL) {
+	if (comp->numdata.level == NULL) {
+	    comp->numdata.level = xmlDictLookup(style->dict,
+	                                        BAD_CAST"single", 6);
+	}
+    }
+    
+}
+
+/**
+ * xsltApplyImportsComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt apply-imports node
+ *
+ * Process the xslt apply-imports node on the source node
+ */
+static void
+xsltApplyImportsComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemApplyImportsPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemApplyImportsPtr) xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+}
+
+/**
+ * xsltCallTemplateComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt call-template node
+ *
+ * Process the xslt call-template node on the source node
+ */
+static void
+xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCallTemplatePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemCallTemplatePtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_CALLTEMPLATE);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_CALLTEMPLATE);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+     * Attribute "name".
+     */
+    xsltGetQNameProperty(style, inst, BAD_CAST "name",
+	1, &(comp->has_name), &(comp->ns), &(comp->name));
+    if (comp->ns)
+	comp->has_ns = 1;
+}
+
+/**
+ * xsltApplyTemplatesComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the apply-templates node
+ *
+ * Process the apply-templates node on the source node
+ */
+static void
+xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemApplyTemplatesPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemApplyTemplatesPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+     * Attribute "mode".
+     */
+    xsltGetQNameProperty(style, inst, BAD_CAST "mode",
+	0, NULL, &(comp->modeURI), &(comp->mode));
+    /*
+    * Attribute "select".
+    */
+    comp->select = xsltGetCNsProp(style, inst, BAD_CAST "select",
+	XSLT_NAMESPACE);
+    if (comp->select != NULL) {
+	comp->comp = xsltXPathCompile(style, comp->select);
+	if (comp->comp == NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-apply-templates: could not compile select "
+		"expression '%s'\n", comp->select);
+	     style->errors++;
+	}
+    }
+    /* TODO: handle (or skip) the xsl:sort and xsl:with-param */
+}
+
+/**
+ * xsltChooseComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt choose node
+ *
+ * Process the xslt choose node on the source node
+ */
+static void
+xsltChooseComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemChoosePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemChoosePtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_CHOOSE);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_CHOOSE);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+}
+
+/**
+ * xsltIfComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt if node
+ *
+ * Process the xslt if node on the source node
+ */
+static void
+xsltIfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemIfPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemIfPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_IF);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_IF);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
+    if (comp->test == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:if : test is not defined\n");
+	if (style != NULL) style->errors++;
+	return;
+    }
+    comp->comp = xsltXPathCompile(style, comp->test);
+    if (comp->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:if : could not compile test expression '%s'\n",
+	                 comp->test);
+	if (style != NULL) style->errors++;
+    }
+}
+
+/**
+ * xsltWhenComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt if node
+ *
+ * Process the xslt if node on the source node
+ */
+static void
+xsltWhenComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemWhenPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemWhenPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_WHEN);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_WHEN);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
+    if (comp->test == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:when : test is not defined\n");
+	if (style != NULL) style->errors++;
+	return;
+    }
+    comp->comp = xsltXPathCompile(style, comp->test);
+    if (comp->comp == NULL) {
+	xsltTransformError(NULL, style, inst,
+	     "xsl:when : could not compile test expression '%s'\n",
+	                 comp->test);
+	if (style != NULL) style->errors++;
+    }
+}
+
+/**
+ * xsltForEachComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt for-each node
+ *
+ * Process the xslt for-each node on the source node
+ */
+static void
+xsltForEachComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemForEachPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemForEachPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_FOREACH);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_FOREACH);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select == NULL) {
+	xsltTransformError(NULL, style, inst,
+		"xsl:for-each : select is missing\n");
+	if (style != NULL) style->errors++;
+    } else {
+	comp->comp = xsltXPathCompile(style, comp->select);
+	if (comp->comp == NULL) {
+	    xsltTransformError(NULL, style, inst,
+     "xsl:for-each : could not compile select expression '%s'\n",
+			     comp->select);
+	    if (style != NULL) style->errors++;
+	}
+    }
+    /* TODO: handle and skip the xsl:sort */
+}
+
+/**
+ * xsltVariableComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt variable node
+ *
+ * Process the xslt variable node on the source node
+ */
+static void
+xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemVariablePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemVariablePtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_VARIABLE);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_VARIABLE);
+#endif
+
+    if (comp == NULL)
+	return;
+
+    inst->psvi = comp;
+    comp->inst = inst;
+    /*
+     * The full template resolution can be done statically
+     */
+
+    /*
+    * Attribute "name".
+    */
+    xsltGetQNameProperty(style, inst, BAD_CAST "name",
+	1, &(comp->has_name), &(comp->ns), &(comp->name));
+    if (comp->ns)
+	comp->has_ns = 1;    
+    /*
+    * Attribute "select".
+    */
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select != NULL) {
+	comp->comp = xsltXPathCompile(style, comp->select);
+	if (comp->comp == NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-variable: Failed to compile the XPath expression '%s'.\n",
+		comp->select);
+	    style->errors++;
+	}
+	if (inst->children != NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-variable: The must be no child nodes, since the "
+		"attribute 'select' was specified.\n");
+	    style->errors++;
+	}
+    }
+}
+
+/**
+ * xsltParamComp:
+ * @style: an XSLT compiled stylesheet
+ * @inst:  the xslt param node
+ *
+ * Process the xslt param node on the source node
+ */
+static void
+xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemParamPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((style == NULL) || (inst == NULL))
+	return;
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleItemParamPtr)
+	xsltNewStylePreComp(style, XSLT_FUNC_PARAM);
+#else
+    comp = xsltNewStylePreComp(style, XSLT_FUNC_PARAM);
+#endif
+
+    if (comp == NULL)
+	return;
+    inst->psvi = comp;
+    comp->inst = inst;
+
+    /*
+     * Attribute "name".
+     */
+    xsltGetQNameProperty(style, inst, BAD_CAST "name",
+	1, &(comp->has_name), &(comp->ns), &(comp->name));
+    if (comp->ns)
+	comp->has_ns = 1;
+    /*
+    * Attribute "select".
+    */
+    comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
+	                        XSLT_NAMESPACE);
+    if (comp->select != NULL) {
+	comp->comp = xsltXPathCompile(style, comp->select);
+	if (comp->comp == NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-param: could not compile select expression '%s'.\n",
+		comp->select);
+	    style->errors++;
+	}
+	if (inst->children != NULL) {
+	    xsltTransformError(NULL, style, inst,
+		"XSLT-param: The content should be empty since the "
+		"attribute 'select' is present.\n");
+	    style->warnings++;
+	}
+    }
+}
+
+/************************************************************************
+ *									*
+ *		    Generic interface					*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltFreeStylePreComps:
+ * @style:  an XSLT transformation context
+ *
+ * Free up the memory allocated by all precomputed blocks
+ */
+void
+xsltFreeStylePreComps(xsltStylesheetPtr style) {
+    xsltElemPreCompPtr cur, next;
+
+    if (style == NULL)
+	return;        
+    
+    cur = style->preComps;
+    while (cur != NULL) {
+	next = cur->next;		
+	if (cur->type == XSLT_FUNC_EXTENSION)
+	    cur->free(cur);
+	else
+	    xsltFreeStylePreComp((xsltStylePreCompPtr) cur);
+	cur = next;
+    }
+}
+
+#ifdef XSLT_REFACTORED
+
+/**
+ * xsltStylePreCompute:
+ * @style:  the XSLT stylesheet
+ * @node:  the element in the XSLT namespace
+ *
+ * Precompute an XSLT element.
+ * This expects the type of the element to be already
+ * set in style->compCtxt->inode->type;
+ */
+void
+xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
+    /*    
+    * The xsltXSLTElemMarker marker was set beforehand by
+    *  the parsing mechanism for all elements in the XSLT namespace.
+    */
+    if (style == NULL) {
+	if (node != NULL)
+	    node->psvi = NULL;
+	return;
+    }
+    if (node == NULL)
+	return;
+    if (! IS_XSLT_ELEM_FAST(node))
+	return;
+
+    node->psvi = NULL;
+    if (XSLT_CCTXT(style)->inode->type != 0) {
+	switch (XSLT_CCTXT(style)->inode->type) {
+	    case XSLT_FUNC_APPLYTEMPLATES:
+		xsltApplyTemplatesComp(style, node);
+		break;
+	    case XSLT_FUNC_WITHPARAM:			   
+		xsltWithParamComp(style, node);
+		break;
+	    case XSLT_FUNC_VALUEOF:	    
+		xsltValueOfComp(style, node);
+		break;
+	    case XSLT_FUNC_COPY:	    
+		xsltCopyComp(style, node);
+		break;
+	    case XSLT_FUNC_COPYOF:
+		xsltCopyOfComp(style, node);
+		break;
+	    case XSLT_FUNC_IF:	    
+		xsltIfComp(style, node);
+		break;
+	    case XSLT_FUNC_CHOOSE:	    
+		xsltChooseComp(style, node);
+		break;
+	    case XSLT_FUNC_WHEN:	    
+		xsltWhenComp(style, node);
+		break;
+	    case XSLT_FUNC_OTHERWISE:	    
+		/* NOP yet */
+		return;
+	    case XSLT_FUNC_FOREACH:	    
+		xsltForEachComp(style, node);
+		break;
+	    case XSLT_FUNC_APPLYIMPORTS:	    
+		xsltApplyImportsComp(style, node);
+		break;
+	    case XSLT_FUNC_ATTRIBUTE:	    
+		xsltAttributeComp(style, node);
+		break;
+	    case XSLT_FUNC_ELEMENT:	    
+		xsltElementComp(style, node);
+		break;
+	    case XSLT_FUNC_SORT:	    
+		xsltSortComp(style, node);
+		break;
+	    case XSLT_FUNC_COMMENT:	    
+		xsltCommentComp(style, node);
+		break;
+	    case XSLT_FUNC_NUMBER:	    
+		xsltNumberComp(style, node);
+		break;
+	    case XSLT_FUNC_PI:	    
+		xsltProcessingInstructionComp(style, node);
+		break;
+	    case XSLT_FUNC_CALLTEMPLATE:	    
+		xsltCallTemplateComp(style, node);
+		break;
+	    case XSLT_FUNC_PARAM:	    
+		xsltParamComp(style, node);
+		break;
+	    case XSLT_FUNC_VARIABLE:	    
+		xsltVariableComp(style, node);
+		break;
+	    case XSLT_FUNC_FALLBACK:	    
+		/* NOP yet */
+		return;
+	    case XSLT_FUNC_DOCUMENT:	    
+		/* The extra one */
+		node->psvi = (void *) xsltDocumentComp(style, node,
+		    (xsltTransformFunction) xsltDocumentElem);
+		break;
+	    case XSLT_FUNC_MESSAGE:
+		/* NOP yet */
+		return;
+	    default:
+		/*
+		* NOTE that xsl:text, xsl:template, xsl:stylesheet,
+		*  xsl:transform, xsl:import, xsl:include are not expected
+		*  to be handed over to this function.
+		*/
+		xsltTransformError(NULL, style, node,
+		    "Internal error: (xsltStylePreCompute) cannot handle "
+		    "the XSLT element '%s'.\n", node->name);
+		style->errors++;
+		return;
+	}
+    } else {
+	/*
+	* Fallback to string comparison.
+	*/	
+	if (IS_XSLT_NAME(node, "apply-templates")) {
+	    xsltApplyTemplatesComp(style, node);
+	} else if (IS_XSLT_NAME(node, "with-param")) {
+	    xsltWithParamComp(style, node);
+	} else if (IS_XSLT_NAME(node, "value-of")) {
+	    xsltValueOfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "copy")) {
+	    xsltCopyComp(style, node);
+	} else if (IS_XSLT_NAME(node, "copy-of")) {
+	    xsltCopyOfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "if")) {
+	    xsltIfComp(style, node);
+	} else if (IS_XSLT_NAME(node, "choose")) {
+	    xsltChooseComp(style, node);
+	} else if (IS_XSLT_NAME(node, "when")) {
+	    xsltWhenComp(style, node);	
+	} else if (IS_XSLT_NAME(node, "otherwise")) {
+	    /* NOP yet */
+	    return;
+	} else if (IS_XSLT_NAME(node, "for-each")) {
+	    xsltForEachComp(style, node);
+	} else if (IS_XSLT_NAME(node, "apply-imports")) {
+	    xsltApplyImportsComp(style, node);
+	} else if (IS_XSLT_NAME(node, "attribute")) {
+	    xsltAttributeComp(style, node);
+	} else if (IS_XSLT_NAME(node, "element")) {
+	    xsltElementComp(style, node);
+	} else if (IS_XSLT_NAME(node, "sort")) {
+	    xsltSortComp(style, node);
+	} else if (IS_XSLT_NAME(node, "comment")) {
+	    xsltCommentComp(style, node);
+	} else if (IS_XSLT_NAME(node, "number")) {
+	    xsltNumberComp(style, node);
+	} else if (IS_XSLT_NAME(node, "processing-instruction")) {
+	    xsltProcessingInstructionComp(style, node);
+	} else if (IS_XSLT_NAME(node, "call-template")) {
+	    xsltCallTemplateComp(style, node);
+	} else if (IS_XSLT_NAME(node, "param")) {
+	    xsltParamComp(style, node);
+	} else if (IS_XSLT_NAME(node, "variable")) {
+	    xsltVariableComp(style, node);
+	} else if (IS_XSLT_NAME(node, "fallback")) {
+	    /* NOP yet */
+	    return;
+	} else if (IS_XSLT_NAME(node, "document")) {
+	    /* The extra one */
+	    node->psvi = (void *) xsltDocumentComp(style, node,
+		(xsltTransformFunction) xsltDocumentElem);	
+	} else if (IS_XSLT_NAME(node, "output")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "preserve-space")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "strip-space")) {
+	    /* Top-level */
+	    return;	
+	} else if (IS_XSLT_NAME(node, "key")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "message")) {
+	    return;
+	} else if (IS_XSLT_NAME(node, "attribute-set")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "namespace-alias")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "decimal-format")) {
+	    /* Top-level */
+	    return;
+	} else if (IS_XSLT_NAME(node, "include")) {
+	    /* Top-level */	    	    
+	} else {
+	    /*
+	    * NOTE that xsl:text, xsl:template, xsl:stylesheet,
+	    *  xsl:transform, xsl:import, xsl:include are not expected
+	    *  to be handed over to this function.
+	    */
+	    xsltTransformError(NULL, style, node,
+		"Internal error: (xsltStylePreCompute) cannot handle "
+		"the XSLT element '%s'.\n", node->name);
+		style->errors++;
+	    return;
+	}	
+    }
+    /*
+    * Assign the current list of in-scope namespaces to the
+    * item. This is needed for XPath expressions.
+    */
+    if (node->psvi != NULL) {
+	((xsltStylePreCompPtr) node->psvi)->inScopeNs =
+	    XSLT_CCTXT(style)->inode->inScopeNs;
+    }
+}
+
+#else
+
+/**
+ * xsltStylePreCompute:
+ * @style:  the XSLT stylesheet
+ * @inst:  the instruction in the stylesheet
+ *
+ * Precompute an XSLT stylesheet element
+ */
+void
+xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
+    /*
+    * URGENT TODO: Normally inst->psvi Should never be reserved here,
+    *   BUT: since if we include the same stylesheet from
+    *   multiple imports, then the stylesheet will be parsed
+    *   again. We simply must not try to compute the stylesheet again.
+    * TODO: Get to the point where we don't need to query the
+    *   namespace- and local-name of the node, but can evaluate this
+    *   using cctxt->style->inode->category;
+    */
+    if (inst->psvi != NULL)
+	return;
+
+    if (IS_XSLT_ELEM(inst)) {
+	xsltStylePreCompPtr cur;
+
+	if (IS_XSLT_NAME(inst, "apply-templates")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltApplyTemplatesComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "with-param")) {
+	    xsltCheckParentElement(style, inst, BAD_CAST "apply-templates",
+	                           BAD_CAST "call-template");
+	    xsltWithParamComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "value-of")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltValueOfComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "copy")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltCopyComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "copy-of")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltCopyOfComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "if")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltIfComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "when")) {
+	    xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL);
+	    xsltWhenComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "choose")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltChooseComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "for-each")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltForEachComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "apply-imports")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltApplyImportsComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "attribute")) {
+	    xmlNodePtr parent = inst->parent;
+
+	    if ((parent == NULL) || (parent->ns == NULL) ||
+		((parent->ns != inst->ns) &&
+		 (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
+		(!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) {
+		xsltCheckInstructionElement(style, inst);
+	    }
+	    xsltAttributeComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "element")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltElementComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "text")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltTextComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "sort")) {
+	    xsltCheckParentElement(style, inst, BAD_CAST "apply-templates",
+	                           BAD_CAST "for-each");
+	    xsltSortComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "comment")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltCommentComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "number")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltNumberComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "processing-instruction")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltProcessingInstructionComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "call-template")) {
+	    xsltCheckInstructionElement(style, inst);
+	    xsltCallTemplateComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "param")) {	   
+	    if (xsltCheckTopLevelElement(style, inst, 0) == 0)
+	        xsltCheckInstructionElement(style, inst);
+	    xsltParamComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "variable")) {
+	    if (xsltCheckTopLevelElement(style, inst, 0) == 0)
+	        xsltCheckInstructionElement(style, inst);
+	    xsltVariableComp(style, inst);
+	} else if (IS_XSLT_NAME(inst, "otherwise")) {
+	    xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL);
+	    xsltCheckInstructionElement(style, inst);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "template")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "output")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "preserve-space")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "strip-space")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if ((IS_XSLT_NAME(inst, "stylesheet")) ||
+	           (IS_XSLT_NAME(inst, "transform"))) {
+	    xmlNodePtr parent = inst->parent;
+
+	    if ((parent == NULL) || (parent->type != XML_DOCUMENT_NODE)) {
+		xsltTransformError(NULL, style, inst,
+		    "element %s only allowed only as root element\n",
+				   inst->name);
+		style->errors++;
+	    }
+	    return;
+	} else if (IS_XSLT_NAME(inst, "key")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "message")) {
+	    xsltCheckInstructionElement(style, inst);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "attribute-set")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "namespace-alias")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "include")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "import")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "decimal-format")) {
+	    xsltCheckTopLevelElement(style, inst, 1);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "fallback")) {
+	    xsltCheckInstructionElement(style, inst);
+	    return;
+	} else if (IS_XSLT_NAME(inst, "document")) {
+	    xsltCheckInstructionElement(style, inst);
+	    inst->psvi = (void *) xsltDocumentComp(style, inst,
+				(xsltTransformFunction) xsltDocumentElem);
+	} else {
+	    xsltTransformError(NULL, style, inst,
+		 "xsltStylePreCompute: unknown xsl:%s\n", inst->name);
+	    if (style != NULL) style->warnings++;
+	}
+	
+	cur = (xsltStylePreCompPtr) inst->psvi;
+	/*
+	* A ns-list is build for every XSLT item in the
+	* node-tree. This is needed for XPath expressions.
+	*/
+	if (cur != NULL) {
+	    int i = 0;
+
+	    cur->nsList = xmlGetNsList(inst->doc, inst);
+            if (cur->nsList != NULL) {
+		while (cur->nsList[i] != NULL)
+		    i++;
+	    }
+	    cur->nsNr = i;
+	}
+    } else {
+	inst->psvi =
+	    (void *) xsltPreComputeExtModuleElement(style, inst);
+
+	/*
+	 * Unknown element, maybe registered at the context
+	 * level. Mark it for later recognition.
+	 */
+	if (inst->psvi == NULL)
+	    inst->psvi = (void *) xsltExtMarker;
+    }
+}
+#endif /* XSLT_REFACTORED */
diff --git a/third_party/libxslt/libxslt/preproc.h b/third_party/libxslt/libxslt/preproc.h
new file mode 100644
index 0000000..f67b389
--- /dev/null
+++ b/third_party/libxslt/libxslt/preproc.h
@@ -0,0 +1,43 @@
+/*
+ * Summary: precomputing stylesheets
+ * Description: this is the compilation phase, where most of the
+ *              stylesheet is "compiled" into faster to use data.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_PRECOMP_H__
+#define __XML_XSLT_PRECOMP_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Interfaces
+ */
+extern const xmlChar *xsltExtMarker;
+
+XSLTPUBFUN xsltElemPreCompPtr XSLTCALL 
+		xsltDocumentComp	(xsltStylesheetPtr style,
+					 xmlNodePtr inst,
+					 xsltTransformFunction function);
+
+XSLTPUBFUN void XSLTCALL		
+		xsltStylePreCompute	(xsltStylesheetPtr style,
+					 xmlNodePtr inst);
+XSLTPUBFUN void XSLTCALL		
+		xsltFreeStylePreComps	(xsltStylesheetPtr style);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_PRECOMP_H__ */
+
diff --git a/third_party/libxslt/libxslt/security.c b/third_party/libxslt/libxslt/security.c
new file mode 100644
index 0000000..c7f264a
--- /dev/null
+++ b/third_party/libxslt/libxslt/security.c
@@ -0,0 +1,475 @@
+/*
+ * security.c: Implementation of the XSLT security framework
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#ifdef HAVE_SYS_TYPES_H
+#include 
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include 
+#endif
+
+#ifdef HAVE_MATH_H
+#include 
+#endif
+#ifdef HAVE_FLOAT_H
+#include 
+#endif
+#ifdef HAVE_IEEEFP_H
+#include 
+#endif
+#ifdef HAVE_NAN_H
+#include 
+#endif
+#ifdef HAVE_CTYPE_H
+#include 
+#endif
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include 
+#ifndef INVALID_FILE_ATTRIBUTES
+#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+#endif
+#endif
+
+#ifndef HAVE_STAT
+#  ifdef HAVE__STAT
+     /* MS C library seems to define stat and _stat. The definition
+      *         is identical. Still, mapping them to each other causes a warning. */
+#    ifndef _MSC_VER
+#      define stat(x,y) _stat(x,y)
+#    endif
+#    define HAVE_STAT
+#  endif
+#endif
+
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "security.h"
+
+
+struct _xsltSecurityPrefs {
+    xsltSecurityCheck readFile;
+    xsltSecurityCheck createFile;
+    xsltSecurityCheck createDir;
+    xsltSecurityCheck readNet;
+    xsltSecurityCheck writeNet;
+};
+
+static xsltSecurityPrefsPtr xsltDefaultSecurityPrefs = NULL;
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltNewSecurityPrefs:
+ *
+ * Create a new security preference block
+ *
+ * Returns a pointer to the new block or NULL in case of error
+ */
+xsltSecurityPrefsPtr
+xsltNewSecurityPrefs(void) {
+    xsltSecurityPrefsPtr ret;
+
+    ret = (xsltSecurityPrefsPtr) xmlMalloc(sizeof(xsltSecurityPrefs));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewSecurityPrefs : malloc failed\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltSecurityPrefs));
+    return(ret);
+}
+
+/**
+ * xsltFreeSecurityPrefs:
+ * @sec:  the security block to free
+ *
+ * Free up a security preference block
+ */
+void
+xsltFreeSecurityPrefs(xsltSecurityPrefsPtr sec) {
+    if (sec == NULL)
+	return;
+    xmlFree(sec);
+}
+
+/**
+ * xsltSetSecurityPrefs:
+ * @sec:  the security block to update
+ * @option:  the option to update
+ * @func:  the user callback to use for this option
+ *
+ * Update the security option to use the new callback checking function
+ *
+ * Returns -1 in case of error, 0 otherwise
+ */
+int
+xsltSetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option,
+                     xsltSecurityCheck func) {
+    if (sec == NULL)
+	return(-1);
+    switch (option) {
+        case XSLT_SECPREF_READ_FILE:
+            sec->readFile = func; return(0);
+        case XSLT_SECPREF_WRITE_FILE:
+            sec->createFile = func; return(0);
+        case XSLT_SECPREF_CREATE_DIRECTORY:
+            sec->createDir = func; return(0);
+        case XSLT_SECPREF_READ_NETWORK:
+            sec->readNet = func; return(0);
+        case XSLT_SECPREF_WRITE_NETWORK:
+            sec->writeNet = func; return(0);
+    }
+    return(-1);
+}
+
+/**
+ * xsltGetSecurityPrefs:
+ * @sec:  the security block to update
+ * @option:  the option to lookup
+ *
+ * Lookup the security option to get the callback checking function
+ *
+ * Returns NULL if not found, the function otherwise
+ */
+xsltSecurityCheck
+xsltGetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option) {
+    if (sec == NULL)
+	return(NULL);
+    switch (option) {
+        case XSLT_SECPREF_READ_FILE:
+            return(sec->readFile);
+        case XSLT_SECPREF_WRITE_FILE:
+            return(sec->createFile);
+        case XSLT_SECPREF_CREATE_DIRECTORY:
+            return(sec->createDir);
+        case XSLT_SECPREF_READ_NETWORK:
+            return(sec->readNet);
+        case XSLT_SECPREF_WRITE_NETWORK:
+            return(sec->writeNet);
+    }
+    return(NULL);
+}
+
+/**
+ * xsltSetDefaultSecurityPrefs:
+ * @sec:  the security block to use
+ *
+ * Set the default security preference application-wide
+ */
+void
+xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) {
+    xsltDefaultSecurityPrefs = sec;
+}
+
+/**
+ * xsltGetDefaultSecurityPrefs:
+ *
+ * Get the default security preference application-wide
+ *
+ * Returns the current xsltSecurityPrefsPtr in use or NULL if none
+ */
+xsltSecurityPrefsPtr
+xsltGetDefaultSecurityPrefs(void) {
+    return(xsltDefaultSecurityPrefs);
+}
+
+/**
+ * xsltSetCtxtSecurityPrefs:
+ * @sec:  the security block to use
+ * @ctxt:  an XSLT transformation context
+ *
+ * Set the security preference for a specific transformation
+ *
+ * Returns -1 in case of error, 0 otherwise
+ */
+int                    
+xsltSetCtxtSecurityPrefs(xsltSecurityPrefsPtr sec,
+	                 xsltTransformContextPtr ctxt) {
+    if (ctxt == NULL)
+	return(-1);
+    ctxt->sec = (void *) sec;
+    return(0);
+}
+
+
+/**
+ * xsltSecurityAllow:
+ * @sec:  the security block to use
+ * @ctxt:  an XSLT transformation context
+ * @value:  unused
+ *
+ * Function used to always allow an operation
+ *
+ * Returns 1 always
+ */
+int
+xsltSecurityAllow(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED,
+	          xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		  const char *value ATTRIBUTE_UNUSED) {
+    return(1);
+}
+
+/**
+ * xsltSecurityForbid:
+ * @sec:  the security block to use
+ * @ctxt:  an XSLT transformation context
+ * @value:  unused
+ *
+ * Function used to always forbid an operation
+ *
+ * Returns 0 always
+ */
+int
+xsltSecurityForbid(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED,
+	          xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
+		  const char *value ATTRIBUTE_UNUSED) {
+    return(0);
+}
+
+/************************************************************************
+ *									*
+ *			Internal interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltCheckFilename
+ * @path:  the path to check
+ *
+ * function checks to see if @path is a valid source
+ * (file, socket...) for XML.
+ *
+ * TODO: remove at some point !!!
+ * Local copy of xmlCheckFilename to avoid a hard dependency on
+ * a new version of libxml2 
+ *
+ * if stat is not available on the target machine,
+ * returns 1.  if stat fails, returns 0 (if calling
+ * stat on the filename fails, it can't be right).
+ * if stat succeeds and the file is a directory,
+ * returns 2.  otherwise returns 1.
+ */
+
+static int
+xsltCheckFilename (const char *path)
+{
+#ifdef HAVE_STAT
+    struct stat stat_buffer;
+#if defined(WIN32) && !defined(__CYGWIN__)
+    DWORD dwAttrs;
+
+    dwAttrs = GetFileAttributesA(path); 
+    if (dwAttrs != INVALID_FILE_ATTRIBUTES) {
+        if (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) {
+            return 2;
+		}
+    }
+#endif
+
+    if (stat(path, &stat_buffer) == -1)
+        return 0;
+
+#ifdef S_ISDIR
+    if (S_ISDIR(stat_buffer.st_mode)) {
+        return 2;
+    }
+#endif
+#endif
+    return 1;
+}
+
+static int
+xsltCheckWritePath(xsltSecurityPrefsPtr sec,
+		   xsltTransformContextPtr ctxt,
+		   const char *path)
+{
+    int ret;
+    xsltSecurityCheck check;
+    char *directory;
+
+    check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_WRITE_FILE);
+    if (check != NULL) {
+	ret = check(sec, ctxt, path);
+	if (ret == 0) {
+	    xsltTransformError(ctxt, NULL, NULL,
+			       "File write for %s refused\n", path);
+	    return(0);
+	}
+    }
+
+    directory = xmlParserGetDirectory (path);
+
+    if (directory != NULL) {
+	ret = xsltCheckFilename(directory);
+	if (ret == 0) {
+	    /*
+	     * The directory doesn't exist check for creation
+	     */
+	    check = xsltGetSecurityPrefs(sec,
+					 XSLT_SECPREF_CREATE_DIRECTORY);
+	    if (check != NULL) {
+		ret = check(sec, ctxt, directory);
+		if (ret == 0) {
+		    xsltTransformError(ctxt, NULL, NULL,
+				       "Directory creation for %s refused\n",
+				       path);
+		    xmlFree(directory);
+		    return(0);
+		}
+	    }
+	    ret = xsltCheckWritePath(sec, ctxt, directory);
+	    if (ret == 1)
+		ret = mkdir(directory, 0755);
+	}
+	xmlFree(directory);
+	if (ret < 0)
+	    return(ret);
+    }
+
+    return(1);
+}
+
+/**
+ * xsltCheckWrite:
+ * @sec:  the security options
+ * @ctxt:  an XSLT transformation context
+ * @URL:  the resource to be written
+ *
+ * Check if the resource is allowed to be written, if necessary makes
+ * some preliminary work like creating directories
+ *
+ * Return 1 if write is allowed, 0 if not and -1 in case or error.
+ */
+int
+xsltCheckWrite(xsltSecurityPrefsPtr sec,
+	       xsltTransformContextPtr ctxt, const xmlChar *URL) {
+    int ret;
+    xmlURIPtr uri;
+    xsltSecurityCheck check;
+
+    uri = xmlParseURI((const char *)URL);
+    if (uri == NULL) {
+        uri = xmlCreateURI();
+	if (uri == NULL) {
+	    xsltTransformError(ctxt, NULL, NULL,
+	     "xsltCheckWrite: out of memory for %s\n", URL);
+	    return(-1);
+	}
+	uri->path = (char *)xmlStrdup(URL);
+    }
+    if ((uri->scheme == NULL) ||
+	(xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) {
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+    if ((uri->path)&&(uri->path[0]=='/')&&
+        (uri->path[1]!='\0')&&(uri->path[2]==':'))
+    ret = xsltCheckWritePath(sec, ctxt, uri->path+1);
+    else
+#endif
+
+	/*
+	 * Check if we are allowed to write this file
+	 */
+	ret = xsltCheckWritePath(sec, ctxt, uri->path);
+	if (ret <= 0) {
+	    xmlFreeURI(uri);
+	    return(ret);
+	}
+    } else {
+	/*
+	 * Check if we are allowed to write this network resource
+	 */
+	check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_WRITE_NETWORK);
+	if (check != NULL) {
+	    ret = check(sec, ctxt, (const char *)URL);
+	    if (ret == 0) {
+		xsltTransformError(ctxt, NULL, NULL,
+			     "File write for %s refused\n", URL);
+		xmlFreeURI(uri);
+		return(0);
+	    }
+	}
+    }
+    xmlFreeURI(uri);
+    return(1);
+}
+
+
+/**
+ * xsltCheckRead:
+ * @sec:  the security options
+ * @ctxt: an XSLT transformation context
+ * @URL:  the resource to be read
+ *
+ * Check if the resource is allowed to be read
+ *
+ * Return 1 if read is allowed, 0 if not and -1 in case or error.
+ */
+int
+xsltCheckRead(xsltSecurityPrefsPtr sec,
+	      xsltTransformContextPtr ctxt, const xmlChar *URL) {
+    int ret;
+    xmlURIPtr uri;
+    xsltSecurityCheck check;
+
+    uri = xmlParseURI((const char *)URL);
+    if (uri == NULL) {
+	xsltTransformError(ctxt, NULL, NULL,
+	 "xsltCheckRead: URL parsing failed for %s\n",
+			 URL);
+	return(-1);
+    }
+    if ((uri->scheme == NULL) ||
+	(xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) {
+
+	/*
+	 * Check if we are allowed to read this file
+	 */
+	check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_FILE);
+	if (check != NULL) {
+	    ret = check(sec, ctxt, uri->path);
+	    if (ret == 0) {
+		xsltTransformError(ctxt, NULL, NULL,
+			     "Local file read for %s refused\n", URL);
+		xmlFreeURI(uri);
+		return(0);
+	    }
+	}
+    } else {
+	/*
+	 * Check if we are allowed to write this network resource
+	 */
+	check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_NETWORK);
+	if (check != NULL) {
+	    ret = check(sec, ctxt, (const char *)URL);
+	    if (ret == 0) {
+		xsltTransformError(ctxt, NULL, NULL,
+			     "Network file read for %s refused\n", URL);
+		xmlFreeURI(uri);
+		return(0);
+	    }
+	}
+    }
+    xmlFreeURI(uri);
+    return(1);
+}
+
diff --git a/third_party/libxslt/libxslt/security.h b/third_party/libxslt/libxslt/security.h
new file mode 100644
index 0000000..d52c0ae
--- /dev/null
+++ b/third_party/libxslt/libxslt/security.h
@@ -0,0 +1,104 @@
+/*
+ * Summary: interface for the libxslt security framework
+ * Description: the libxslt security framework allow to restrict
+ *              the access to new resources (file or URL) from
+ *              the stylesheet at runtime.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_SECURITY_H__
+#define __XML_XSLT_SECURITY_H__
+
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * xsltSecurityPref:
+ *
+ * structure to indicate the preferences for security in the XSLT
+ * transformation.
+ */
+typedef struct _xsltSecurityPrefs xsltSecurityPrefs;
+typedef xsltSecurityPrefs *xsltSecurityPrefsPtr;
+
+/**
+ * xsltSecurityOption:
+ *
+ * the set of option that can be configured
+ */
+typedef enum {
+    XSLT_SECPREF_READ_FILE = 1,
+    XSLT_SECPREF_WRITE_FILE,
+    XSLT_SECPREF_CREATE_DIRECTORY,
+    XSLT_SECPREF_READ_NETWORK,
+    XSLT_SECPREF_WRITE_NETWORK
+} xsltSecurityOption;
+
+/**
+ * xsltSecurityCheck:
+ *
+ * User provided function to check the value of a string like a file
+ * path or an URL ...
+ */
+typedef int (*xsltSecurityCheck)	(xsltSecurityPrefsPtr sec,
+					 xsltTransformContextPtr ctxt,
+					 const char *value);
+
+/*
+ * Module interfaces
+ */
+XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL	
+		    xsltNewSecurityPrefs	(void);
+XSLTPUBFUN void XSLTCALL			
+		    xsltFreeSecurityPrefs	(xsltSecurityPrefsPtr sec);
+XSLTPUBFUN int XSLTCALL			
+		    xsltSetSecurityPrefs	(xsltSecurityPrefsPtr sec,
+						 xsltSecurityOption option,
+						 xsltSecurityCheck func);
+XSLTPUBFUN xsltSecurityCheck XSLTCALL	
+		    xsltGetSecurityPrefs	(xsltSecurityPrefsPtr sec,
+						 xsltSecurityOption option);
+
+XSLTPUBFUN void XSLTCALL			
+		    xsltSetDefaultSecurityPrefs	(xsltSecurityPrefsPtr sec);
+XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL	
+		    xsltGetDefaultSecurityPrefs	(void);
+
+XSLTPUBFUN int XSLTCALL			
+		    xsltSetCtxtSecurityPrefs	(xsltSecurityPrefsPtr sec,
+						 xsltTransformContextPtr ctxt);
+
+XSLTPUBFUN int XSLTCALL			
+		    xsltSecurityAllow		(xsltSecurityPrefsPtr sec,
+						 xsltTransformContextPtr ctxt,
+						 const char *value);
+XSLTPUBFUN int XSLTCALL	
+		    xsltSecurityForbid		(xsltSecurityPrefsPtr sec,
+						 xsltTransformContextPtr ctxt,
+						 const char *value);
+/*
+ * internal interfaces
+ */
+XSLTPUBFUN int XSLTCALL			
+		    xsltCheckWrite		(xsltSecurityPrefsPtr sec,
+						 xsltTransformContextPtr ctxt,
+						 const xmlChar *URL);
+XSLTPUBFUN int XSLTCALL			
+		    xsltCheckRead		(xsltSecurityPrefsPtr sec,
+						 xsltTransformContextPtr ctxt,
+						 const xmlChar *URL);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_SECURITY_H__ */
+
diff --git a/third_party/libxslt/libxslt/templates.c b/third_party/libxslt/libxslt/templates.c
new file mode 100644
index 0000000..8d26a8a
--- /dev/null
+++ b/third_party/libxslt/libxslt/templates.c
@@ -0,0 +1,822 @@
+/*
+ * templates.c: Implementation of the template processing
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "variables.h"
+#include "functions.h"
+#include "templates.h"
+#include "transform.h"
+#include "namespaces.h"
+#include "attributes.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_TEMPLATES
+#endif
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+ 
+/**
+ * xsltEvalXPathPredicate:
+ * @ctxt:  the XSLT transformation context
+ * @comp:  the XPath compiled expression
+ * @nsList:  the namespaces in scope
+ * @nsNr:  the number of namespaces in scope
+ *
+ * Process the expression using XPath and evaluate the result as
+ * an XPath predicate
+ *
+ * Returns 1 is the predicate was true, 0 otherwise
+ */
+int
+xsltEvalXPathPredicate(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp,
+		       xmlNsPtr *nsList, int nsNr) {
+    int ret;
+    xmlXPathObjectPtr res;
+    int oldNsNr;
+    xmlNsPtr *oldNamespaces;
+    xmlNodePtr oldInst;
+    int oldProximityPosition, oldContextSize;
+
+    oldContextSize = ctxt->xpathCtxt->contextSize;
+    oldProximityPosition = ctxt->xpathCtxt->proximityPosition;
+    oldNsNr = ctxt->xpathCtxt->nsNr;
+    oldNamespaces = ctxt->xpathCtxt->namespaces;
+    oldInst = ctxt->inst;
+
+    ctxt->xpathCtxt->node = ctxt->node;
+    ctxt->xpathCtxt->namespaces = nsList;
+    ctxt->xpathCtxt->nsNr = nsNr;
+
+    res = xmlXPathCompiledEval(comp, ctxt->xpathCtxt);
+
+    if (res != NULL) {
+	ret = xmlXPathEvalPredicate(ctxt->xpathCtxt, res);
+	xmlXPathFreeObject(res);
+#ifdef WITH_XSLT_DEBUG_TEMPLATES
+	XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltEvalXPathPredicate: returns %d\n", ret));
+#endif
+    } else {
+#ifdef WITH_XSLT_DEBUG_TEMPLATES
+	XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltEvalXPathPredicate: failed\n"));
+#endif
+	ctxt->state = XSLT_STATE_STOPPED;
+	ret = 0;
+    }
+    ctxt->xpathCtxt->nsNr = oldNsNr;
+
+    ctxt->xpathCtxt->namespaces = oldNamespaces;
+    ctxt->inst = oldInst;
+    ctxt->xpathCtxt->contextSize = oldContextSize;
+    ctxt->xpathCtxt->proximityPosition = oldProximityPosition;
+
+    return(ret);
+}
+
+/**
+ * xsltEvalXPathStringNs:
+ * @ctxt:  the XSLT transformation context
+ * @comp:  the compiled XPath expression
+ * @nsNr:  the number of namespaces in the list
+ * @nsList:  the list of in-scope namespaces to use
+ *
+ * Process the expression using XPath, allowing to pass a namespace mapping
+ * context and get a string
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *    caller.
+ */
+xmlChar *
+xsltEvalXPathStringNs(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp,
+	              int nsNr, xmlNsPtr *nsList) {
+    xmlChar *ret = NULL;
+    xmlXPathObjectPtr res;
+    xmlNodePtr oldInst;
+    xmlNodePtr oldNode;
+    int	oldPos, oldSize;
+    int oldNsNr;
+    xmlNsPtr *oldNamespaces;
+
+    oldInst = ctxt->inst;
+    oldNode = ctxt->node;
+    oldPos = ctxt->xpathCtxt->proximityPosition;
+    oldSize = ctxt->xpathCtxt->contextSize;
+    oldNsNr = ctxt->xpathCtxt->nsNr;
+    oldNamespaces = ctxt->xpathCtxt->namespaces;
+
+    ctxt->xpathCtxt->node = ctxt->node;
+    /* TODO: do we need to propagate the namespaces here ? */
+    ctxt->xpathCtxt->namespaces = nsList;
+    ctxt->xpathCtxt->nsNr = nsNr;
+    res = xmlXPathCompiledEval(comp, ctxt->xpathCtxt);
+    if (res != NULL) {
+	if (res->type != XPATH_STRING)
+	    res = xmlXPathConvertString(res);
+	if (res->type == XPATH_STRING) {
+            ret = res->stringval;
+	    res->stringval = NULL;
+	} else {
+	    xsltTransformError(ctxt, NULL, NULL,
+		 "xpath : string() function didn't return a String\n");
+	}
+	xmlXPathFreeObject(res);
+    } else {
+	ctxt->state = XSLT_STATE_STOPPED;
+    }
+#ifdef WITH_XSLT_DEBUG_TEMPLATES
+    XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltEvalXPathString: returns %s\n", ret));
+#endif
+    ctxt->inst = oldInst;
+    ctxt->node = oldNode;
+    ctxt->xpathCtxt->contextSize = oldSize;
+    ctxt->xpathCtxt->proximityPosition = oldPos;
+    ctxt->xpathCtxt->nsNr = oldNsNr;
+    ctxt->xpathCtxt->namespaces = oldNamespaces;
+    return(ret);
+}
+
+/**
+ * xsltEvalXPathString:
+ * @ctxt:  the XSLT transformation context
+ * @comp:  the compiled XPath expression
+ *
+ * Process the expression using XPath and get a string
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *    caller.
+ */
+xmlChar *
+xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) {
+    return(xsltEvalXPathStringNs(ctxt, comp, 0, NULL));
+}
+
+/**
+ * xsltEvalTemplateString:
+ * @ctxt:  the XSLT transformation context
+ * @contextNode:  the current node in the source tree
+ * @inst:  the XSLT instruction (xsl:comment, xsl:processing-instruction)
+ *
+ * Processes the sequence constructor of the given instruction on
+ * @contextNode and converts the resulting tree to a string.
+ * This is needed by e.g. xsl:comment and xsl:processing-instruction.
+ *
+ * Returns the computed string value or NULL; it's up to the caller to
+ *         free the result.
+ */
+xmlChar *
+xsltEvalTemplateString(xsltTransformContextPtr ctxt,
+		       xmlNodePtr contextNode,
+	               xmlNodePtr inst)
+{
+    xmlNodePtr oldInsert, insert = NULL;
+    xmlChar *ret;
+
+    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
+	return(NULL);
+
+    if (inst->children == NULL)
+	return(NULL);
+
+    /*
+    * This creates a temporary element-node to add the resulting
+    * text content to.
+    * OPTIMIZE TODO: Keep such an element-node in the transformation
+    *  context to avoid creating it every time.
+    */
+    insert = xmlNewDocNode(ctxt->output, NULL,
+	                   (const xmlChar *)"fake", NULL);
+    if (insert == NULL) {
+	xsltTransformError(ctxt, NULL, contextNode,
+		"Failed to create temporary node\n");
+	return(NULL);
+    }
+    oldInsert = ctxt->insert;
+    ctxt->insert = insert;
+    /*
+    * OPTIMIZE TODO: if inst->children consists only of text-nodes.
+    */
+    xsltApplyOneTemplate(ctxt, contextNode, inst->children, NULL, NULL);
+
+    ctxt->insert = oldInsert;
+
+    ret = xmlNodeGetContent(insert);
+    if (insert != NULL)
+	xmlFreeNode(insert);
+    return(ret);
+}
+
+/**
+ * xsltAttrTemplateValueProcessNode:
+ * @ctxt:  the XSLT transformation context
+ * @str:  the attribute template node value
+ * @inst:  the instruction (or LRE) in the stylesheet holding the
+ *         attribute with an AVT
+ *
+ * Process the given string, allowing to pass a namespace mapping
+ * context and return the new string value.
+ *
+ * Called by:
+ *  - xsltAttrTemplateValueProcess() (templates.c)
+ *  - xsltEvalAttrValueTemplate() (templates.c)
+ *
+ * QUESTION: Why is this function public? It is not used outside
+ *  of templates.c.
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *    caller.
+ */
+xmlChar *
+xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
+	  const xmlChar *str, xmlNodePtr inst)
+{
+    xmlChar *ret = NULL;
+    const xmlChar *cur;
+    xmlChar *expr, *val;
+    xmlNsPtr *nsList = NULL;
+    int nsNr = 0;
+
+    if (str == NULL) return(NULL);
+    if (*str == 0)
+	return(xmlStrndup((xmlChar *)"", 0));
+
+    cur = str;
+    while (*cur != 0) {
+	if (*cur == '{') {
+	    if (*(cur+1) == '{') {	/* escaped '{' */
+	        cur++;
+		ret = xmlStrncat(ret, str, cur - str);
+		cur++;
+		str = cur;
+		continue;
+	    }
+	    ret = xmlStrncat(ret, str, cur - str);
+	    str = cur;
+	    cur++;
+	    while ((*cur != 0) && (*cur != '}')) cur++;
+	    if (*cur == 0) {
+	        xsltTransformError(ctxt, NULL, inst,
+			"xsltAttrTemplateValueProcessNode: unmatched '{'\n");
+		ret = xmlStrncat(ret, str, cur - str);
+		return(ret);
+	    }
+	    str++;
+	    expr = xmlStrndup(str, cur - str);
+	    if (expr == NULL)
+		return(ret);
+	    else if (*expr == '{') {
+		ret = xmlStrcat(ret, expr);
+		xmlFree(expr);
+	    } else {
+		xmlXPathCompExprPtr comp;
+		/*
+		 * TODO: keep precompiled form around
+		 */
+		if ((nsList == NULL) && (inst != NULL)) {
+		    int i = 0;
+
+		    nsList = xmlGetNsList(inst->doc, inst);
+		    if (nsList != NULL) {
+			while (nsList[i] != NULL)
+			    i++;
+			nsNr = i;
+		    }
+		}
+		comp = xmlXPathCompile(expr);
+                val = xsltEvalXPathStringNs(ctxt, comp, nsNr, nsList);
+		xmlXPathFreeCompExpr(comp);
+		xmlFree(expr);
+		if (val != NULL) {
+		    ret = xmlStrcat(ret, val);
+		    xmlFree(val);
+		}
+	    }
+	    cur++;
+	    str = cur;
+	} else if (*cur == '}') {
+	    cur++;
+	    if (*cur == '}') {	/* escaped '}' */
+		ret = xmlStrncat(ret, str, cur - str);
+		cur++;
+		str = cur;
+		continue;
+	    } else {
+	        xsltTransformError(ctxt, NULL, inst,
+		     "xsltAttrTemplateValueProcessNode: unmatched '}'\n");
+	    }
+	} else
+	    cur++;
+    }
+    if (cur != str) {
+	ret = xmlStrncat(ret, str, cur - str);
+    }
+
+    if (nsList != NULL)
+	xmlFree(nsList);
+
+    return(ret);
+}
+
+/**
+ * xsltAttrTemplateValueProcess:
+ * @ctxt:  the XSLT transformation context
+ * @str:  the attribute template node value
+ *
+ * Process the given node and return the new string value.
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *    caller.
+ */
+xmlChar *
+xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) {
+    return(xsltAttrTemplateValueProcessNode(ctxt, str, NULL));
+}
+
+/**
+ * xsltEvalAttrValueTemplate:
+ * @ctxt:  the XSLT transformation context
+ * @inst:  the instruction (or LRE) in the stylesheet holding the
+ *         attribute with an AVT
+ * @name:  the attribute QName
+ * @ns:  the attribute namespace URI
+ *
+ * Evaluate a attribute value template, i.e. the attribute value can
+ * contain expressions contained in curly braces ({}) and those are
+ * substituted by they computed value.
+ *
+ * Returns the computed string value or NULL, must be deallocated by the
+ *    caller.
+ */
+xmlChar *
+xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst,
+	                  const xmlChar *name, const xmlChar *ns)
+{
+    xmlChar *ret;
+    xmlChar *expr;
+
+    if ((ctxt == NULL) || (inst == NULL) || (name == NULL))
+	return(NULL);
+
+    expr = xsltGetNsProp(inst, name, ns);
+    if (expr == NULL)
+	return(NULL);
+
+    /*
+     * TODO: though now {} is detected ahead, it would still be good to
+     *       optimize both functions to keep the splitted value if the
+     *       attribute content and the XPath precompiled expressions around
+     */
+
+    ret = xsltAttrTemplateValueProcessNode(ctxt, expr, inst);
+#ifdef WITH_XSLT_DEBUG_TEMPLATES
+    XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltEvalAttrValueTemplate: %s returns %s\n", expr, ret));
+#endif
+    if (expr != NULL)
+	xmlFree(expr);
+    return(ret);
+}
+
+/**
+ * xsltEvalStaticAttrValueTemplate:
+ * @style:  the XSLT stylesheet
+ * @inst:  the instruction (or LRE) in the stylesheet holding the
+ *         attribute with an AVT
+ * @name:  the attribute Name
+ * @ns:  the attribute namespace URI
+ * @found:  indicator whether the attribute is present
+ *
+ * Check if an attribute value template has a static value, i.e. the
+ * attribute value does not contain expressions contained in curly braces ({})
+ *
+ * Returns the static string value or NULL, must be deallocated by the
+ *    caller.
+ */
+const xmlChar *
+xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
+			const xmlChar *name, const xmlChar *ns, int *found) {
+    const xmlChar *ret;
+    xmlChar *expr;
+
+    if ((style == NULL) || (inst == NULL) || (name == NULL))
+	return(NULL);
+
+    expr = xsltGetNsProp(inst, name, ns);
+    if (expr == NULL) {
+	*found = 0;
+	return(NULL);
+    }
+    *found = 1;
+
+    ret = xmlStrchr(expr, '{');
+    if (ret != NULL) {
+	xmlFree(expr);
+	return(NULL);
+    }
+    ret = xmlDictLookup(style->dict, expr, -1);
+    xmlFree(expr);
+    return(ret);
+}
+
+/**
+ * xsltAttrTemplateProcess:
+ * @ctxt:  the XSLT transformation context
+ * @target:  the element where the attribute will be grafted
+ * @attr:  the attribute node of a literal result element
+ *
+ * Process one attribute of a Literal Result Element (in the stylesheet).
+ * Evaluates Attribute Value Templates and copies the attribute over to
+ * the result element.
+ * This does *not* process attribute sets (xsl:use-attribute-set).
+ * 
+ *
+ * Returns the generated attribute node.
+ */
+xmlAttrPtr
+xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
+	                xmlAttrPtr attr)
+{
+    const xmlChar *value;
+    xmlAttrPtr ret;
+
+    if ((ctxt == NULL) || (attr == NULL) || (target == NULL))
+	return(NULL);
+    
+    if (attr->type != XML_ATTRIBUTE_NODE)
+	return(NULL);
+
+    /*
+    * Skip all XSLT attributes.
+    */
+#ifdef XSLT_REFACTORED    
+    if (attr->psvi == xsltXSLTAttrMarker)
+	return(NULL);
+#else
+    if ((attr->ns != NULL) && xmlStrEqual(attr->ns->href, XSLT_NAMESPACE))
+	return(NULL);
+#endif
+    /*
+    * Get the value.
+    */
+    if (attr->children != NULL) {
+	if ((attr->children->type != XML_TEXT_NODE) ||
+	    (attr->children->next != NULL))
+	{
+	    xsltTransformError(ctxt, NULL, attr->parent,
+		"Internal error: The children of an attribute node of a "
+		"literal result element are not in the expected form.\n");
+	    return(NULL);
+	}
+	value = attr->children->content;
+	if (value == NULL)
+	    value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0);
+    } else
+	value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0);
+    /*
+    * Overwrite duplicates.
+    */
+    ret = target->properties;
+    while (ret != NULL) {
+        if (((attr->ns != NULL) == (ret->ns != NULL)) &&
+	    xmlStrEqual(ret->name, attr->name) &&
+	    ((attr->ns == NULL) || xmlStrEqual(ret->ns->href, attr->ns->href)))
+	{
+	    break;
+	}
+        ret = ret->next;
+    }
+    if (ret != NULL) {	
+        /* free the existing value */
+	xmlFreeNodeList(ret->children);
+	ret->children = ret->last = NULL;
+	/*
+	* Adjust ns-prefix if needed.
+	*/
+	if ((ret->ns != NULL) &&
+	    (! xmlStrEqual(ret->ns->prefix, attr->ns->prefix)))
+	{
+	    ret->ns = xsltGetNamespace(ctxt, attr->parent, attr->ns, target);
+	}
+    } else {
+        /* create a new attribute */
+	if (attr->ns != NULL)
+	    ret = xmlNewNsProp(target,
+		xsltGetNamespace(ctxt, attr->parent, attr->ns, target),
+		    attr->name, NULL);
+	else
+	    ret = xmlNewNsProp(target, NULL, attr->name, NULL);	
+    }
+    /*
+    * Set the value.
+    */
+    if (ret != NULL) {
+        xmlNodePtr text;
+
+        text = xmlNewText(NULL);
+	if (text != NULL) {
+	    ret->last = ret->children = text;
+	    text->parent = (xmlNodePtr) ret;
+	    text->doc = ret->doc;
+
+	    if (attr->psvi != NULL) {
+		/*
+		* Evaluate the Attribute Value Template.
+		*/
+		xmlChar *val;
+		val = xsltEvalAVT(ctxt, attr->psvi, attr->parent);
+		if (val == NULL) {
+		    /*
+		    * TODO: Damn, we need an easy mechanism to report
+		    * qualified names!
+		    */
+		    if (attr->ns) {
+			xsltTransformError(ctxt, NULL, attr->parent,
+			    "Internal error: Failed to evaluate the AVT "
+			    "of attribute '{%s}%s'.\n",
+			    attr->ns->href, attr->name);
+		    } else {
+			xsltTransformError(ctxt, NULL, attr->parent,
+			    "Internal error: Failed to evaluate the AVT "
+			    "of attribute '%s'.\n",
+			    attr->name);
+		    }
+		    text->content = xmlStrdup(BAD_CAST "");
+		} else {
+		    text->content = val;
+		}
+	    } else if ((ctxt->internalized) && (target != NULL) &&
+	               (target->doc != NULL) &&
+		       (target->doc->dict == ctxt->dict)) {
+		text->content = (xmlChar *) value;
+	    } else {
+		text->content = xmlStrdup(value);
+	    }
+	}
+    } else {
+	if (attr->ns) {
+	    xsltTransformError(ctxt, NULL, attr->parent,
+	    	"Internal error: Failed to create attribute '{%s}%s'.\n",
+		attr->ns->href, attr->name);
+	} else {
+	    xsltTransformError(ctxt, NULL, attr->parent,
+	    	"Internal error: Failed to create attribute '%s'.\n",
+		attr->name);
+	}
+    }
+    return(ret);
+}
+
+
+/**
+ * xsltAttrListTemplateProcess:
+ * @ctxt:  the XSLT transformation context
+ * @target:  the element where the attributes will be grafted
+ * @attrs:  the first attribute
+ *
+ * Processes all attributes of a Literal Result Element.
+ * Attribute references are applied via xsl:use-attribute-set
+ * attributes.
+ * Copies all non XSLT-attributes over to the @target element
+ * and evaluates Attribute Value Templates.
+ *
+ * Called by xsltApplySequenceConstructor() (transform.c).
+ *
+ * Returns a new list of attribute nodes, or NULL in case of error.
+ *         (Don't assign the result to @target->properties; if
+ *         the result is NULL, you'll get memory leaks, since the
+ *         attributes will be disattached.)
+ */
+xmlAttrPtr
+xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, 
+	                    xmlNodePtr target, xmlAttrPtr attrs)
+{
+    xmlAttrPtr attr, copy, last;
+    xmlNodePtr oldInsert, text;
+    xmlNsPtr origNs = NULL, copyNs = NULL;
+    const xmlChar *value;
+    xmlChar *valueAVT;
+
+    if ((ctxt == NULL) || (target == NULL) || (attrs == NULL))
+	return(NULL);
+
+    oldInsert = ctxt->insert;
+    ctxt->insert = target;        
+
+    /*
+    * Instantiate LRE-attributes.
+    */
+    if (target->properties) {
+	last = target->properties;
+	while (last->next != NULL)
+	    last = last->next;
+    } else {
+	last = NULL;
+    }    
+    attr = attrs;
+    do {
+	/*
+	* Skip XSLT attributes.
+	*/
+#ifdef XSLT_REFACTORED
+	if (attr->psvi == xsltXSLTAttrMarker) {
+	    goto next_attribute;
+	}
+#else
+	if ((attr->ns != NULL) &&
+	    xmlStrEqual(attr->ns->href, XSLT_NAMESPACE))
+	{
+	    goto next_attribute;
+	}
+#endif
+	/*
+	* Get the value.
+	*/
+	if (attr->children != NULL) {
+	    if ((attr->children->type != XML_TEXT_NODE) ||
+		(attr->children->next != NULL))
+	    {
+		xsltTransformError(ctxt, NULL, attr->parent,
+		    "Internal error: The children of an attribute node of a "
+		    "literal result element are not in the expected form.\n");
+		goto error;
+	    }
+	    value = attr->children->content;
+	    if (value == NULL)
+		value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0);
+	} else
+	    value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0);
+
+	/*
+	* Create a new attribute.
+	*/
+	copy = xmlNewDocProp(target->doc, attr->name, NULL);
+	if (copy == NULL) {
+	    if (attr->ns) {
+		xsltTransformError(ctxt, NULL, attr->parent,
+		    "Internal error: Failed to create attribute '{%s}%s'.\n",
+		    attr->ns->href, attr->name);
+	    } else {
+		xsltTransformError(ctxt, NULL, attr->parent,
+		    "Internal error: Failed to create attribute '%s'.\n",
+		    attr->name);
+	    }
+	    goto error;
+	}
+	/*
+	* Attach it to the target element.
+	*/
+	copy->parent = target;
+	if (last == NULL) {
+	    target->properties = copy;
+	    last = copy;
+	} else {
+	    last->next = copy;
+	    copy->prev = last;
+	    last = copy;
+	}
+	/*
+	* Set the namespace. Avoid lookups of same namespaces.
+	*/
+	if (attr->ns != origNs) {
+	    origNs = attr->ns;
+	    if (attr->ns != NULL) {
+#ifdef XSLT_REFACTORED
+		copyNs = xsltGetSpecialNamespace(ctxt, attr->parent,
+		    attr->ns->href, attr->ns->prefix, target);
+#else
+		copyNs = xsltGetNamespace(ctxt, attr->parent,
+		    attr->ns, target);
+#endif
+		if (copyNs == NULL)
+		    goto error;
+	    } else
+		copyNs = NULL;
+	}
+	copy->ns = copyNs;
+	
+	/*
+	* Set the value.
+	*/	    
+	text = xmlNewText(NULL);
+	if (text != NULL) {
+	    copy->last = copy->children = text;
+	    text->parent = (xmlNodePtr) copy;
+	    text->doc = copy->doc;
+	    
+	    if (attr->psvi != NULL) {
+		/*
+		* Evaluate the Attribute Value Template.
+		*/		
+		valueAVT = xsltEvalAVT(ctxt, attr->psvi, attr->parent);
+		if (valueAVT == NULL) {
+		    /*
+		    * TODO: Damn, we need an easy mechanism to report
+		    * qualified names!
+		    */
+		    if (attr->ns) {
+			xsltTransformError(ctxt, NULL, attr->parent,
+			    "Internal error: Failed to evaluate the AVT "
+			    "of attribute '{%s}%s'.\n",
+			    attr->ns->href, attr->name);			    
+		    } else {
+			xsltTransformError(ctxt, NULL, attr->parent,
+			    "Internal error: Failed to evaluate the AVT "
+			    "of attribute '%s'.\n",
+			    attr->name);
+		    }
+		    text->content = xmlStrdup(BAD_CAST "");
+		    goto error;
+		} else {
+		    text->content = valueAVT;
+		}
+	    } else if ((ctxt->internalized) &&
+		(target->doc != NULL) &&
+		(target->doc->dict == ctxt->dict))
+	    {
+		text->content = (xmlChar *) value;
+	    } else {
+		text->content = xmlStrdup(value);
+	    }
+	}
+
+next_attribute:
+	attr = attr->next;
+    } while (attr != NULL);
+
+    /*
+    * Apply attribute-sets.
+    * The creation of such attributes will not overwrite any existing
+    * attribute.
+    */
+    attr = attrs;
+    do {
+#ifdef XSLT_REFACTORED
+	if ((attr->psvi == xsltXSLTAttrMarker) &&
+	    xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets"))
+	{
+	    xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
+	}
+#else
+	if ((attr->ns != NULL) &&
+	    xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets") &&
+	    xmlStrEqual(attr->ns->href, XSLT_NAMESPACE))
+	{
+	    xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL);
+	}
+#endif
+	attr = attr->next;
+    } while (attr != NULL);
+
+    ctxt->insert = oldInsert;
+    return(target->properties);
+
+error:
+    ctxt->insert = oldInsert;
+    return(NULL);
+}
+
+
+/**
+ * xsltTemplateProcess:
+ * @ctxt:  the XSLT transformation context
+ * @node:  the attribute template node
+ *
+ * Obsolete. Don't use it.
+ *
+ * Returns NULL.
+ */
+xmlNodePtr *
+xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) {
+    if (node == NULL)
+	return(NULL);
+    
+    return(0);
+}
+
+
diff --git a/third_party/libxslt/libxslt/templates.h b/third_party/libxslt/libxslt/templates.h
new file mode 100644
index 0000000..18adfdb
--- /dev/null
+++ b/third_party/libxslt/libxslt/templates.h
@@ -0,0 +1,77 @@
+/*
+ * Summary: interface for the template processing
+ * Description: This set of routine encapsulates XPath calls
+ *              and Attribute Value Templates evaluation.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_TEMPLATES_H__
+#define __XML_XSLT_TEMPLATES_H__
+
+#include 
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+XSLTPUBFUN int XSLTCALL		
+		xsltEvalXPathPredicate		(xsltTransformContextPtr ctxt,
+						 xmlXPathCompExprPtr comp,
+		                                 xmlNsPtr *nsList,
+						 int nsNr);
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltEvalTemplateString		(xsltTransformContextPtr ctxt,
+						 xmlNodePtr contextNode,
+						 xmlNodePtr inst);
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltEvalAttrValueTemplate	(xsltTransformContextPtr ctxt,
+						 xmlNodePtr node,
+						 const xmlChar *name,
+						 const xmlChar *ns);
+XSLTPUBFUN const xmlChar * XSLTCALL	
+		xsltEvalStaticAttrValueTemplate	(xsltStylesheetPtr style,
+						 xmlNodePtr node,
+						 const xmlChar *name,
+						 const xmlChar *ns,
+						 int *found);
+
+/* TODO: this is obviously broken ... the namespaces should be passed too ! */
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltEvalXPathString		(xsltTransformContextPtr ctxt,
+						 xmlXPathCompExprPtr comp);
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltEvalXPathStringNs		(xsltTransformContextPtr ctxt,
+						 xmlXPathCompExprPtr comp,
+						 int nsNr,
+						 xmlNsPtr *nsList);
+
+XSLTPUBFUN xmlNodePtr * XSLTCALL	
+		xsltTemplateProcess		(xsltTransformContextPtr ctxt,
+						 xmlNodePtr node);
+XSLTPUBFUN xmlAttrPtr XSLTCALL	
+		xsltAttrListTemplateProcess	(xsltTransformContextPtr ctxt,
+						 xmlNodePtr target,
+						 xmlAttrPtr cur);
+XSLTPUBFUN xmlAttrPtr XSLTCALL	
+		xsltAttrTemplateProcess		(xsltTransformContextPtr ctxt,
+						 xmlNodePtr target,
+						 xmlAttrPtr attr);
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltAttrTemplateValueProcess	(xsltTransformContextPtr ctxt,
+						 const xmlChar* attr);
+XSLTPUBFUN xmlChar * XSLTCALL	
+		xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
+						 const xmlChar* str,
+						 xmlNodePtr node);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_TEMPLATES_H__ */
+
diff --git a/third_party/libxslt/libxslt/transform.c b/third_party/libxslt/libxslt/transform.c
new file mode 100644
index 0000000..da37503
--- /dev/null
+++ b/third_party/libxslt/libxslt/transform.c
@@ -0,0 +1,6457 @@
+/*
+ * transform.c: Implementation of the XSL Transformation 1.0 engine
+ *              transform part, i.e. applying a Stylesheet to a document
+ *
+ * References:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ *   Michael Kay "XSLT Programmer's Reference" pp 637-643
+ *   Writing Multiple Output Files
+ *
+ *   XSLT-1.1 Working Draft
+ *   http://www.w3.org/TR/xslt11#multiple-output
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "pattern.h"
+#include "transform.h"
+#include "variables.h"
+#include "numbersInternals.h"
+#include "namespaces.h"
+#include "attributes.h"
+#include "templates.h"
+#include "imports.h"
+#include "keys.h"
+#include "documents.h"
+#include "extensions.h"
+#include "extra.h"
+#include "preproc.h"
+#include "security.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_EXTRA
+#define WITH_XSLT_DEBUG_PROCESS
+#endif
+
+#define XSLT_GENERATE_HTML_DOCTYPE
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+static int xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID,
+			  const xmlChar **systemID);
+#endif
+
+int xsltMaxDepth = 3000;
+
+/*
+ * Useful macros
+ */
+
+#ifndef FALSE
+# define FALSE (0 == 1)
+# define TRUE (!FALSE)
+#endif
+
+#define IS_BLANK_NODE(n)						\
+    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
+
+
+/*
+* Forward declarations
+*/
+
+static xmlNsPtr
+xsltCopyNamespaceListInternal(xmlNodePtr node, xmlNsPtr cur);
+
+static xmlNodePtr
+xsltCopyTreeInternal(xsltTransformContextPtr ctxt,
+		     xmlNodePtr invocNode,
+		     xmlNodePtr node,
+		     xmlNodePtr insert, int isLRE, int topElemVisited);
+
+static void
+xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
+			     xmlNodePtr contextNode, xmlNodePtr list,
+			     xsltTemplatePtr templ);
+
+static void
+xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
+		      xmlNodePtr contextNode,
+		      xmlNodePtr list,
+		      xsltTemplatePtr templ,
+		      xsltStackElemPtr withParams);
+
+/**
+ * templPush:
+ * @ctxt: the transformation context
+ * @value:  the template to push on the stack
+ *
+ * Push a template on the stack
+ *
+ * Returns the new index in the stack or 0 in case of error
+ */
+static int
+templPush(xsltTransformContextPtr ctxt, xsltTemplatePtr value)
+{
+    if (ctxt->templMax == 0) {
+        ctxt->templMax = 4;
+        ctxt->templTab =
+            (xsltTemplatePtr *) xmlMalloc(ctxt->templMax *
+                                          sizeof(ctxt->templTab[0]));
+        if (ctxt->templTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+            return (0);
+        }
+    }
+    if (ctxt->templNr >= ctxt->templMax) {
+        ctxt->templMax *= 2;
+        ctxt->templTab =
+            (xsltTemplatePtr *) xmlRealloc(ctxt->templTab,
+                                           ctxt->templMax *
+                                           sizeof(ctxt->templTab[0]));
+        if (ctxt->templTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+            return (0);
+        }
+    }
+    ctxt->templTab[ctxt->templNr] = value;
+    ctxt->templ = value;
+    return (ctxt->templNr++);
+}
+/**
+ * templPop:
+ * @ctxt: the transformation context
+ *
+ * Pop a template value from the stack
+ *
+ * Returns the stored template value
+ */
+static xsltTemplatePtr
+templPop(xsltTransformContextPtr ctxt)
+{
+    xsltTemplatePtr ret;
+
+    if (ctxt->templNr <= 0)
+        return (0);
+    ctxt->templNr--;
+    if (ctxt->templNr > 0)
+        ctxt->templ = ctxt->templTab[ctxt->templNr - 1];
+    else
+        ctxt->templ = (xsltTemplatePtr) 0;
+    ret = ctxt->templTab[ctxt->templNr];
+    ctxt->templTab[ctxt->templNr] = 0;
+    return (ret);
+}
+
+/**
+ * xsltLocalVariablePop:
+ * @ctxt: the transformation context
+ * @limitNr: number of variables which should remain
+ * @level: the depth in the xsl:template's tree
+ *
+ * Pops all variable values at the given @depth from the stack.
+ *
+ * Returns the stored variable value
+ * **NOTE:**
+ * This is an internal routine and should not be called by users!
+ */
+void
+xsltLocalVariablePop(xsltTransformContextPtr ctxt, int limitNr, int level)
+{
+    xsltStackElemPtr variable;
+
+    if (ctxt->varsNr <= 0)
+        return;
+
+    do {
+	if (ctxt->varsNr <= limitNr)
+	    break;
+	variable = ctxt->varsTab[ctxt->varsNr - 1];
+	if (variable->level <= level)
+	    break;	
+	if (variable->level >= 0)
+	    xsltFreeStackElemList(variable);
+	ctxt->varsNr--;
+    } while (ctxt->varsNr != 0);
+    if (ctxt->varsNr > 0)
+        ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1];
+    else
+        ctxt->vars = NULL;
+}
+
+/**
+ * xsltTemplateParamsCleanup:
+ *
+ * Removes xsl:param and xsl:with-param items from the
+ * variable-stack. Only xsl:with-param items are not freed. 
+ */
+static void
+xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt)
+{
+    xsltStackElemPtr param;    
+
+    for (; ctxt->varsNr > ctxt->varsBase; ctxt->varsNr--) {
+	param = ctxt->varsTab[ctxt->varsNr -1];
+	/*
+	* Free xsl:param items.
+	* xsl:with-param items will have a level of -1 or -2.
+	*/
+	if (param->level >= 0) {	    
+	    xsltFreeStackElemList(param);
+	}	    
+    }    
+    if (ctxt->varsNr > 0)
+        ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1];
+    else
+        ctxt->vars = NULL;
+}
+
+/**
+ * profPush:
+ * @ctxt: the transformation context
+ * @value:  the profiling value to push on the stack
+ *
+ * Push a profiling value on the stack
+ *
+ * Returns the new index in the stack or 0 in case of error
+ */
+static int
+profPush(xsltTransformContextPtr ctxt, long value)
+{
+    if (ctxt->profMax == 0) {
+        ctxt->profMax = 4;
+        ctxt->profTab =
+            (long *) xmlMalloc(ctxt->profMax * sizeof(ctxt->profTab[0]));
+        if (ctxt->profTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+            return (0);
+        }
+    }
+    if (ctxt->profNr >= ctxt->profMax) {
+        ctxt->profMax *= 2;
+        ctxt->profTab =
+            (long *) xmlRealloc(ctxt->profTab,
+                                ctxt->profMax * sizeof(ctxt->profTab[0]));
+        if (ctxt->profTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+            return (0);
+        }
+    }
+    ctxt->profTab[ctxt->profNr] = value;
+    ctxt->prof = value;
+    return (ctxt->profNr++);
+}
+/**
+ * profPop:
+ * @ctxt: the transformation context
+ *
+ * Pop a profiling value from the stack
+ *
+ * Returns the stored profiling value
+ */
+static long
+profPop(xsltTransformContextPtr ctxt)
+{
+    long ret;
+
+    if (ctxt->profNr <= 0)
+        return (0);
+    ctxt->profNr--;
+    if (ctxt->profNr > 0)
+        ctxt->prof = ctxt->profTab[ctxt->profNr - 1];
+    else
+        ctxt->prof = (long) 0;
+    ret = ctxt->profTab[ctxt->profNr];
+    ctxt->profTab[ctxt->profNr] = 0;
+    return (ret);
+}
+
+/************************************************************************
+ *									*
+ *			XInclude default settings			*
+ *									*
+ ************************************************************************/
+
+static int xsltDoXIncludeDefault = 0;
+
+/**
+ * xsltSetXIncludeDefault:
+ * @xinclude: whether to do XInclude processing
+ *
+ * Set whether XInclude should be processed on document being loaded by default
+ */
+void
+xsltSetXIncludeDefault(int xinclude) {
+    xsltDoXIncludeDefault = (xinclude != 0);
+}
+
+/**
+ * xsltGetXIncludeDefault:
+ *
+ * Provides the default state for XInclude processing
+ *
+ * Returns 0 if there is no processing 1 otherwise
+ */
+int
+xsltGetXIncludeDefault(void) {
+    return(xsltDoXIncludeDefault);
+}
+
+unsigned long xsltDefaultTrace = (unsigned long) XSLT_TRACE_ALL;
+
+/**
+ * xsltDebugSetDefaultTrace:
+ * @val: tracing level mask
+ *
+ * Set the default debug tracing level mask
+ */
+void xsltDebugSetDefaultTrace(xsltDebugTraceCodes val) {
+	xsltDefaultTrace = val;
+}
+
+/**
+ * xsltDebugGetDefaultTrace:
+ *
+ * Get the current default debug tracing level mask
+ *
+ * Returns the current default debug tracing level mask
+ */
+xsltDebugTraceCodes xsltDebugGetDefaultTrace() {
+	return xsltDefaultTrace;
+}
+
+/************************************************************************
+ *									*
+ *			Handling of Transformation Contexts		*
+ *									*
+ ************************************************************************/
+
+static xsltTransformCachePtr
+xsltTransformCacheCreate(void)
+{
+    xsltTransformCachePtr ret;
+    
+    ret = (xsltTransformCachePtr) xmlMalloc(sizeof(xsltTransformCache));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+	    "xsltTransformCacheCreate : malloc failed\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltTransformCache));
+    return(ret);
+}
+
+static void
+xsltTransformCacheFree(xsltTransformCachePtr cache)
+{    
+    if (cache == NULL)
+	return;    
+    /*
+    * Free tree fragments.
+    */
+    if (cache->RVT) {
+	xmlDocPtr tmp, cur = cache->RVT;
+	while (cur) {
+	    tmp = cur;
+	    cur = (xmlDocPtr) cur->next;
+	    if (tmp->_private != NULL) {
+		/*
+		* Tree the document info.
+		*/
+		xsltFreeDocumentKeys((xsltDocumentPtr) tmp->_private);
+		xmlFree(tmp->_private);
+	    }
+	    xmlFreeDoc(tmp);
+	}
+    }
+    /*
+    * Free vars/params.
+    */
+    if (cache->stackItems) {
+	xsltStackElemPtr tmp, cur = cache->stackItems;
+	while (cur) {
+	    tmp = cur;
+	    cur = cur->next;
+	    /*
+	    * REVISIT TODO: Should be call a destruction-function
+	    * instead?
+	    */
+	    xmlFree(tmp);
+	}
+    }
+    xmlFree(cache);
+}
+
+/**
+ * xsltNewTransformContext:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  the input document
+ *
+ * Create a new XSLT TransformContext
+ *
+ * Returns the newly allocated xsltTransformContextPtr or NULL in case of error
+ */
+xsltTransformContextPtr
+xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
+    xsltTransformContextPtr cur;
+    xsltDocumentPtr docu;
+    int i;
+
+    cur = (xsltTransformContextPtr) xmlMalloc(sizeof(xsltTransformContext));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, (xmlNodePtr)doc,
+		"xsltNewTransformContext : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltTransformContext));
+
+    cur->cache = xsltTransformCacheCreate();
+    if (cur->cache == NULL)
+	goto internal_err;
+    /*
+     * setup of the dictionary must be done early as some of the
+     * processing later like key handling may need it.
+     */
+    cur->dict = xmlDictCreateSub(style->dict);
+    cur->internalized = ((style->internalized) && (cur->dict != NULL));
+#ifdef WITH_XSLT_DEBUG
+    xsltGenericDebug(xsltGenericDebugContext,
+	     "Creating sub-dictionary from stylesheet for transformation\n");
+#endif
+
+    /*
+     * initialize the template stack
+     */
+    cur->templTab = (xsltTemplatePtr *)
+	        xmlMalloc(10 * sizeof(xsltTemplatePtr));
+    if (cur->templTab == NULL) {
+	xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
+		"xsltNewTransformContext: out of memory\n");
+	goto internal_err;
+    }
+    cur->templNr = 0;
+    cur->templMax = 5;
+    cur->templ = NULL;
+
+    /*
+     * initialize the variables stack
+     */
+    cur->varsTab = (xsltStackElemPtr *)
+	        xmlMalloc(10 * sizeof(xsltStackElemPtr));
+    if (cur->varsTab == NULL) {
+        xmlGenericError(xmlGenericErrorContext,
+		"xsltNewTransformContext: out of memory\n");
+	goto internal_err;
+    }
+    cur->varsNr = 0;
+    cur->varsMax = 10;
+    cur->vars = NULL;
+    cur->varsBase = 0;
+
+    /*
+     * the profiling stack is not initialized by default
+     */
+    cur->profTab = NULL;
+    cur->profNr = 0;
+    cur->profMax = 0;
+    cur->prof = 0;
+
+    cur->style = style;
+    xmlXPathInit();
+    cur->xpathCtxt = xmlXPathNewContext(doc);
+    if (cur->xpathCtxt == NULL) {
+	xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
+		"xsltNewTransformContext : xmlXPathNewContext failed\n");
+	goto internal_err;
+    }
+    /*
+    * Create an XPath cache.
+    */
+    if (xmlXPathContextSetCache(cur->xpathCtxt, 1, -1, 0) == -1)
+	goto internal_err;
+    /*
+     * Initialize the extras array
+     */
+    if (style->extrasNr != 0) {
+	cur->extrasMax = style->extrasNr + 20;
+	cur->extras = (xsltRuntimeExtraPtr) 
+	    xmlMalloc(cur->extrasMax * sizeof(xsltRuntimeExtra));
+	if (cur->extras == NULL) {
+	    xmlGenericError(xmlGenericErrorContext,
+		    "xsltNewTransformContext: out of memory\n");
+	    goto internal_err;
+	}
+	cur->extrasNr = style->extrasNr;
+	for (i = 0;i < cur->extrasMax;i++) {
+	    cur->extras[i].info = NULL;
+	    cur->extras[i].deallocate = NULL;
+	    cur->extras[i].val.ptr = NULL;
+	}
+    } else {
+	cur->extras = NULL;
+	cur->extrasNr = 0;
+	cur->extrasMax = 0;
+    }
+
+    XSLT_REGISTER_VARIABLE_LOOKUP(cur);
+    XSLT_REGISTER_FUNCTION_LOOKUP(cur);
+    cur->xpathCtxt->nsHash = style->nsHash;
+    /*
+     * Initialize the registered external modules
+     */
+    xsltInitCtxtExts(cur);
+    /*
+     * Setup document element ordering for later efficiencies
+     * (bug 133289)
+     */
+    if (xslDebugStatus == XSLT_DEBUG_NONE)
+        xmlXPathOrderDocElems(doc);
+    /*
+     * Must set parserOptions before calling xsltNewDocument
+     * (bug 164530)
+     */
+    cur->parserOptions = XSLT_PARSE_OPTIONS;
+    docu = xsltNewDocument(cur, doc);
+    if (docu == NULL) {
+	xsltTransformError(cur, NULL, (xmlNodePtr)doc,
+		"xsltNewTransformContext : xsltNewDocument failed\n");
+	goto internal_err;
+    }
+    docu->main = 1;
+    cur->document = docu;
+    cur->inst = NULL;
+    cur->outputFile = NULL;
+    cur->sec = xsltGetDefaultSecurityPrefs();
+    cur->debugStatus = xslDebugStatus;
+    cur->traceCode = (unsigned long*) &xsltDefaultTrace;
+    cur->xinclude = xsltGetXIncludeDefault();
+    cur->keyInitLevel = 0;
+
+    return(cur);
+
+internal_err:
+    if (cur != NULL)
+	xsltFreeTransformContext(cur);
+    return(NULL);
+}
+
+/**
+ * xsltFreeTransformContext:
+ * @ctxt:  an XSLT parser context
+ *
+ * Free up the memory allocated by @ctxt
+ */
+void
+xsltFreeTransformContext(xsltTransformContextPtr ctxt) {
+    if (ctxt == NULL)
+	return;
+
+    /*
+     * Shutdown the extension modules associated to the stylesheet
+     * used if needed.
+     */
+    xsltShutdownCtxtExts(ctxt);
+
+    if (ctxt->xpathCtxt != NULL) {
+	ctxt->xpathCtxt->nsHash = NULL;
+	xmlXPathFreeContext(ctxt->xpathCtxt);
+    }
+    if (ctxt->templTab != NULL)
+	xmlFree(ctxt->templTab);
+    if (ctxt->varsTab != NULL)
+	xmlFree(ctxt->varsTab);
+    if (ctxt->profTab != NULL)
+	xmlFree(ctxt->profTab);
+    if ((ctxt->extrasNr > 0) && (ctxt->extras != NULL)) {
+	int i;
+
+	for (i = 0;i < ctxt->extrasNr;i++) {
+	    if ((ctxt->extras[i].deallocate != NULL) &&
+		(ctxt->extras[i].info != NULL))
+		ctxt->extras[i].deallocate(ctxt->extras[i].info);
+	}
+	xmlFree(ctxt->extras);
+    }
+    xsltFreeGlobalVariables(ctxt);
+    xsltFreeDocuments(ctxt);
+    xsltFreeCtxtExts(ctxt);
+    xsltFreeRVTs(ctxt);
+    xsltTransformCacheFree(ctxt->cache);
+    xmlDictFree(ctxt->dict);
+#ifdef WITH_XSLT_DEBUG
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "freeing transformation dictionary\n");
+#endif
+    memset(ctxt, -1, sizeof(xsltTransformContext));
+    xmlFree(ctxt);
+}
+
+/************************************************************************
+ *									*
+ *			Copy of Nodes in an XSLT fashion		*
+ *									*
+ ************************************************************************/
+
+xmlNodePtr xsltCopyTree(xsltTransformContextPtr ctxt,
+                        xmlNodePtr node, xmlNodePtr insert, int literal);
+
+/**
+ * xsltAddTextString:
+ * @ctxt:  a XSLT process context
+ * @target:  the text node where the text will be attached
+ * @string:  the text string
+ * @len:  the string length in byte
+ *
+ * Extend the current text node with the new string, it handles coalescing
+ *
+ * Returns: the text node
+ */
+static xmlNodePtr
+xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target,
+		  const xmlChar *string, int len) {
+    /*
+     * optimization
+     */
+    if ((len <= 0) || (string == NULL) || (target == NULL))
+        return(target);
+
+    if (ctxt->lasttext == target->content) {
+
+	if (ctxt->lasttuse + len >= ctxt->lasttsize) {
+	    xmlChar *newbuf;
+	    int size;
+
+	    size = ctxt->lasttsize + len + 100;
+	    size *= 2;
+	    newbuf = (xmlChar *) xmlRealloc(target->content,size);
+	    if (newbuf == NULL) {
+		xsltTransformError(ctxt, NULL, target,
+		 "xsltCopyText: text allocation failed\n");
+		return(NULL);
+	    }
+	    ctxt->lasttsize = size;
+	    ctxt->lasttext = newbuf;
+	    target->content = newbuf;
+	}
+	memcpy(&(target->content[ctxt->lasttuse]), string, len);
+	ctxt->lasttuse += len;
+	target->content[ctxt->lasttuse] = 0;
+    } else {
+	xmlNodeAddContent(target, string);
+	ctxt->lasttext = target->content;
+	len = xmlStrlen(target->content);
+	ctxt->lasttsize = len;
+	ctxt->lasttuse = len;
+    }
+    return(target);
+}
+
+/**
+ * xsltCopyTextString:
+ * @ctxt:  a XSLT process context
+ * @target:  the element where the text will be attached
+ * @string:  the text string
+ * @noescape:  should disable-escaping be activated for this text node.
+ *
+ * Adds @string to a newly created or an existent text node child of
+ * @target.
+ *
+ * Returns: the text node, where the text content of @cur is copied to.
+ *          NULL in case of API or internal errors.
+ */
+xmlNodePtr
+xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target,
+	           const xmlChar *string, int noescape)
+{
+    xmlNodePtr copy;
+    int len;
+
+    if (string == NULL)
+	return(NULL);
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltCopyTextString: copy text %s\n",
+		     string));
+#endif
+
+    /*
+    * Play save and reset the merging mechanism for every new
+    * target node.
+    */
+    if ((target == NULL) || (target->children == NULL)) {
+	ctxt->lasttext = NULL;
+    }
+
+    /* handle coalescing of text nodes here */
+    len = xmlStrlen(string);
+    if ((ctxt->type == XSLT_OUTPUT_XML) &&
+	(ctxt->style->cdataSection != NULL) &&
+	(target != NULL) && 
+	(target->type == XML_ELEMENT_NODE) &&
+	(((target->ns == NULL) && 
+	  (xmlHashLookup2(ctxt->style->cdataSection,
+		          target->name, NULL) != NULL)) ||
+	 ((target->ns != NULL) &&
+	  (xmlHashLookup2(ctxt->style->cdataSection,
+	                  target->name, target->ns->href) != NULL))))
+    {
+	/*
+	* Process "cdata-section-elements".
+	*/
+	if ((target->last != NULL) &&
+	    (target->last->type == XML_CDATA_SECTION_NODE))
+	{
+	    return(xsltAddTextString(ctxt, target->last, string, len));
+	}
+	copy = xmlNewCDataBlock(ctxt->output, string, len);
+    } else if (noescape) {
+	/*
+	* Process "disable-output-escaping".
+	*/
+	if ((target != NULL) && (target->last != NULL) &&
+	    (target->last->type == XML_TEXT_NODE) &&
+	    (target->last->name == xmlStringTextNoenc))
+	{
+	    return(xsltAddTextString(ctxt, target->last, string, len));
+	}
+	copy = xmlNewTextLen(string, len);
+	if (copy != NULL)
+	    copy->name = xmlStringTextNoenc;
+    } else {
+	/*
+	* Default processing.
+	*/
+	if ((target != NULL) && (target->last != NULL) &&
+	    (target->last->type == XML_TEXT_NODE) &&
+	    (target->last->name == xmlStringText)) {
+	    return(xsltAddTextString(ctxt, target->last, string, len));
+	}
+	copy = xmlNewTextLen(string, len);
+    }
+    if (copy != NULL) {
+	if (target != NULL)
+	    xmlAddChild(target, copy);
+	ctxt->lasttext = copy->content;
+	ctxt->lasttsize = len;
+	ctxt->lasttuse = len;
+    } else {
+	xsltTransformError(ctxt, NULL, target,
+			 "xsltCopyTextString: text copy failed\n");
+	ctxt->lasttext = NULL;
+    }
+    return(copy);
+}
+
+/**
+ * xsltCopyText:
+ * @ctxt:  a XSLT process context
+ * @target:  the element where the text will be attached
+ * @cur:  the text or CDATA node
+ * @interned:  the string is in the target doc dictionary
+ *
+ * Copy the text content of @cur and append it to @target's children.
+ *
+ * Returns: the text node, where the text content of @cur is copied to.
+ *          NULL in case of API or internal errors.
+ */
+static xmlNodePtr
+xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target,
+	     xmlNodePtr cur, int interned)
+{
+    xmlNodePtr copy;
+
+    if ((cur->type != XML_TEXT_NODE) &&
+	(cur->type != XML_CDATA_SECTION_NODE))
+	return(NULL);
+    if (cur->content == NULL) 
+	return(NULL);
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (cur->type == XML_CDATA_SECTION_NODE) {
+	XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltCopyText: copy CDATA text %s\n",
+			 cur->content));
+    } else if (cur->name == xmlStringTextNoenc) {
+	XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltCopyText: copy unescaped text %s\n",
+			 cur->content));
+    } else {
+	XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltCopyText: copy text %s\n",
+			 cur->content));
+    }
+#endif
+
+    /*
+    * Play save and reset the merging mechanism for every new
+    * target node.
+    */
+    if ((target == NULL) || (target->children == NULL)) {
+	ctxt->lasttext = NULL;
+    }
+
+    if ((ctxt->style->cdataSection != NULL) &&
+	(ctxt->type == XSLT_OUTPUT_XML) &&	
+	(target != NULL) &&
+	(target->type == XML_ELEMENT_NODE) &&
+	(((target->ns == NULL) && 
+	  (xmlHashLookup2(ctxt->style->cdataSection,
+		          target->name, NULL) != NULL)) ||
+	 ((target->ns != NULL) &&
+	  (xmlHashLookup2(ctxt->style->cdataSection,
+	                  target->name, target->ns->href) != NULL))))
+    {
+	/*
+	* Process "cdata-section-elements".
+	*/
+	/* 
+	* OPTIMIZE TODO: xsltCopyText() is also used for attribute content.	
+	*/
+	/*
+	* TODO: Since this doesn't merge adjacent CDATA-section nodes,
+	* we'll get: .
+	* TODO: Reported in #321505.
+	*/
+	if ((target->last != NULL) &&
+	     (target->last->type == XML_CDATA_SECTION_NODE))
+	{
+	    /*
+	    * Append to existing CDATA-section node.
+	    */
+	    copy = xsltAddTextString(ctxt, target->last, cur->content,
+		xmlStrlen(cur->content));
+	    goto exit;
+	} else {
+	    unsigned int len;
+
+	    len = xmlStrlen(cur->content);	    
+	    copy = xmlNewCDataBlock(ctxt->output, cur->content, len);
+	    if (copy == NULL)
+		goto exit;
+	    ctxt->lasttext = copy->content;
+	    ctxt->lasttsize = len;
+	    ctxt->lasttuse = len;
+	}
+    } else if ((target != NULL) &&
+	(target->last != NULL) &&
+	/* both escaped or both non-escaped text-nodes */
+	(((target->last->type == XML_TEXT_NODE) &&
+	(target->last->name == cur->name)) ||
+        /* non-escaped text nodes and CDATA-section nodes */
+	(((target->last->type == XML_CDATA_SECTION_NODE) &&
+	(cur->name == xmlStringTextNoenc)))))
+    {
+	/*
+	 * we are appending to an existing text node
+	 */
+	copy = xsltAddTextString(ctxt, target->last, cur->content,
+	    xmlStrlen(cur->content));
+	goto exit;
+    } else if ((interned) && (target != NULL) &&
+	(target->doc != NULL) &&
+	(target->doc->dict == ctxt->dict))
+    {        
+	/*
+	* TODO: DO we want to use this also for "text" output?
+	*/
+        copy = xmlNewTextLen(NULL, 0);
+	if (copy == NULL)
+	    goto exit;	
+	if (cur->name == xmlStringTextNoenc)
+	    copy->name = xmlStringTextNoenc;
+	
+	/*
+	 * Must confirm that content is in dict (bug 302821)
+	 * TODO: This check should be not needed for text coming
+	 * from the stylesheets 
+	 */
+	if (xmlDictOwns(ctxt->dict, cur->content))
+	    copy->content = cur->content;
+	else {
+	    if ((copy->content = xmlStrdup(cur->content)) == NULL)
+		return NULL;
+	}
+    } else {
+        /*
+	 * normal processing. keep counters to extend the text node
+	 * in xsltAddTextString if needed.
+	 */
+        unsigned int len;
+
+	len = xmlStrlen(cur->content);
+	copy = xmlNewTextLen(cur->content, len);
+	if (copy == NULL)
+	    goto exit;
+	if (cur->name == xmlStringTextNoenc)
+	    copy->name = xmlStringTextNoenc;
+	ctxt->lasttext = copy->content;
+	ctxt->lasttsize = len;
+	ctxt->lasttuse = len;
+    }
+    if (copy != NULL) {
+	if (target != NULL) {
+	    copy->doc = target->doc;
+	    /*
+	    * MAYBE TODO: Maybe we should reset the ctxt->lasttext here
+	    *  to ensure that the optimized text-merging mechanism
+	    *  won't interfere with normal node-merging in any case.
+	    */
+	    xmlAddChild(target, copy);
+	}
+    } else {
+	xsltTransformError(ctxt, NULL, target,
+			 "xsltCopyText: text copy failed\n");
+    }
+
+exit:
+    if ((copy == NULL) || (copy->content == NULL)) {
+	xsltTransformError(ctxt, NULL, target,
+	    "Internal error in xsltCopyText(): "
+	    "Failed to copy the string.\n");
+	ctxt->state = XSLT_STATE_STOPPED;
+    }
+    return(copy);
+}
+
+/**
+ * xsltShallowCopyAttr:
+ * @ctxt:  a XSLT process context
+ * @invocNode: responsible node in the stylesheet; used for error reports
+ * @target:  the element where the attribute will be grafted
+ * @attr: the attribute to be copied
+ *
+ * Do a copy of an attribute.
+ * Called by:
+ *  - xsltCopyTreeInternal()
+ *  - xsltCopyOf()
+ *  - xsltCopy()
+ *
+ * Returns: a new xmlAttrPtr, or NULL in case of error.
+ */
+static xmlAttrPtr
+xsltShallowCopyAttr(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
+	     xmlNodePtr target, xmlAttrPtr attr)
+{
+    xmlAttrPtr copy;
+    xmlChar *value;
+
+    if (attr == NULL)
+	return(NULL);
+
+    if (target->type != XML_ELEMENT_NODE) {
+	xsltTransformError(ctxt, NULL, invocNode,
+	    "Cannot add an attribute node to a non-element node.\n");
+	return(NULL);
+    }
+    
+    if (target->children != NULL) {
+	xsltTransformError(ctxt, NULL, invocNode,
+	    "Attribute nodes must be added before "
+	    "any child nodes to an element.\n");
+	return(NULL);
+    }
+
+    value = xmlNodeListGetString(attr->doc, attr->children, 1);
+    if (attr->ns != NULL) {
+	xmlNsPtr ns; 
+
+	ns = xsltGetSpecialNamespace(ctxt, invocNode,
+	    attr->ns->href, attr->ns->prefix, target);
+	if (ns == NULL) {
+	    xsltTransformError(ctxt, NULL, invocNode,
+		"Namespace fixup error: Failed to acquire an in-scope "
+		"namespace binding of the copied attribute '{%s}%s'.\n",
+		attr->ns->href, attr->name);
+	    /*
+	    * TODO: Should we just stop here?
+	    */
+	}
+	/*
+	* Note that xmlSetNsProp() will take care of duplicates
+	* and assigns the new namespace even to a duplicate.
+	*/
+	copy = xmlSetNsProp(target, ns, attr->name, value);
+    } else {
+	copy = xmlSetNsProp(target, NULL, attr->name, value);
+    }
+    if (value != NULL)
+	xmlFree(value);
+
+    if (copy == NULL)
+	return(NULL);
+
+#if 0
+    /*
+    * NOTE: This was optimized according to bug #342695.
+    * TODO: Can this further be optimized, if source and target
+    *  share the same dict and attr->children is just 1 text node
+    *  which is in the dict? How probable is such a case?
+    */
+    /*
+    * TODO: Do we need to create an empty text node if the value
+    *  is the empty string?
+    */
+    value = xmlNodeListGetString(attr->doc, attr->children, 1);
+    if (value != NULL) {
+	txtNode = xmlNewDocText(target->doc, NULL);
+	if (txtNode == NULL)
+	    return(NULL);
+	if ((target->doc != NULL) &&
+	    (target->doc->dict != NULL))
+	{
+	    txtNode->content =
+		(xmlChar *) xmlDictLookup(target->doc->dict,
+		    BAD_CAST value, -1);
+	    xmlFree(value);
+	} else
+	    txtNode->content = value;
+	copy->children = txtNode;
+    }
+#endif
+
+    return(copy);
+}
+
+/**
+ * xsltCopyAttrListNoOverwrite:
+ * @ctxt:  a XSLT process context
+ * @invocNode: responsible node in the stylesheet; used for error reports
+ * @target:  the element where the new attributes will be grafted
+ * @attr:  the first attribute in the list to be copied
+ *
+ * Copies a list of attribute nodes, starting with @attr, over to the
+ * @target element node.
+ *
+ * Called by:
+ *  - xsltCopyTreeInternal()
+ *
+ * Returns 0 on success and -1 on errors and internal errors.
+ */
+static int
+xsltCopyAttrListNoOverwrite(xsltTransformContextPtr ctxt,
+			    xmlNodePtr invocNode,
+			    xmlNodePtr target, xmlAttrPtr attr)
+{
+    xmlAttrPtr last = NULL, copy;
+    xmlNsPtr origNs = NULL, copyNs = NULL;
+    xmlChar *value = NULL;
+
+    /*
+    * Don't use xmlCopyProp() here, since it will try to
+    * reconciliate namespaces.
+    */
+    while (attr != NULL) {
+	/*
+	* Find a namespace node in the tree of @target.
+	* Avoid searching for the same ns.
+	*/
+	if (attr->ns != origNs) {
+	    origNs = attr->ns;
+	    if (attr->ns != NULL) {
+		copyNs = xsltGetSpecialNamespace(ctxt, invocNode,
+		    attr->ns->href, attr->ns->prefix, target);
+		if (copyNs == NULL)
+		    return(-1);
+	    } else
+		copyNs = NULL;
+	}
+	/*
+	 * If attribute has a value, we need to copy it (watching out
+	 * for possible entities)
+	 */
+	if (attr->children)
+	    value = xmlNodeListGetString(attr->doc, attr->children, 0);
+	/*
+	* REVISIT: I think xmlNewDocProp() is the only attr function
+	* which does not eval if the attr is of type ID. This is good,
+	* since we don't need this.
+	*/
+	copy = xmlNewDocProp(target->doc, attr->name, BAD_CAST value);
+	if (copy == NULL)
+	    return(-1);
+	copy->parent = target;
+	copy->ns = copyNs;
+	
+	if (last == NULL) {
+	    target->properties = copy;
+	    last = copy;
+	} else {
+	    last->next = copy;
+	    copy->prev = last;
+	    last = copy;
+	}
+	/*
+	* OPTIMIZE TODO: How to avoid this intermediate string?
+	*/
+	if (value != NULL) {
+	    xmlFree(value);
+	    value = NULL;
+	}
+	attr = attr->next;
+    }    
+    return(0);
+}
+
+/**
+ * xsltShallowCopyElem:
+ * @ctxt:  the XSLT process context
+ * @node:  the element node in the source tree
+ *         or the Literal Result Element
+ * @insert:  the parent in the result tree
+ * @isLRE: if @node is a Literal Result Element
+ *
+ * Make a copy of the element node @node
+ * and insert it as last child of @insert.
+ *
+ * URGENT TODO: The problem with this one (for the non-refactored code)
+ * is that it is used for both, Literal Result Elements *and*
+ * copying input nodes.
+ *
+ * BIG NOTE: This is only called for XML_ELEMENT_NODEs.
+ *
+ * Called from:
+ *   xsltApplySequenceConstructor()
+ *    (for Literal Result Elements - which is a problem)
+ *   xsltCopy() (for shallow-copying elements via xsl:copy)
+ *
+ * Returns a pointer to the new node, or NULL in case of error
+ */
+static xmlNodePtr
+xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
+		    xmlNodePtr insert, int isLRE)
+{
+    xmlNodePtr copy;
+
+    if ((node->type == XML_DTD_NODE) || (insert == NULL))
+	return(NULL);
+    if ((node->type == XML_TEXT_NODE) ||
+	(node->type == XML_CDATA_SECTION_NODE))
+	return(xsltCopyText(ctxt, insert, node, 0));
+
+    copy = xmlDocCopyNode(node, insert->doc, 0);
+    if (copy != NULL) {
+	copy->doc = ctxt->output;
+	xmlAddChild(insert, copy);
+
+	if (node->type == XML_ELEMENT_NODE) {
+	    /*
+	     * Add namespaces as they are needed
+	     */
+	    if (node->nsDef != NULL) {
+		/*
+		* TODO: Remove the LRE case in the refactored code
+		* gets enabled.
+		*/
+		if (isLRE)
+		    xsltCopyNamespaceList(ctxt, copy, node->nsDef);
+		else
+		    xsltCopyNamespaceListInternal(copy, node->nsDef);
+	    }
+
+	    /*
+	    * URGENT TODO: The problem with this is that it does not
+	    *  copy over all namespace nodes in scope.
+	    *  The damn thing about this is, that we would need to
+	    *  use the xmlGetNsList(), for every single node; this is
+	    *  also done in xsltCopyTreeInternal(), but only for the top node.
+	    */
+	    if (node->ns != NULL) {
+		if (isLRE) {
+		    /*
+		    * REVISIT TODO: Since the non-refactored code still does
+		    *  ns-aliasing, we need to call xsltGetNamespace() here.
+		    *  Remove this when ready.
+		    */
+		    copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy);
+		} else {
+		    copy->ns = xsltGetSpecialNamespace(ctxt,
+			node, node->ns->href, node->ns->prefix, copy);
+		    
+		}
+	    } else if ((insert->type == XML_ELEMENT_NODE) &&
+		       (insert->ns != NULL))
+	    {
+		/*
+		* "Undeclare" the default namespace.
+		*/
+		xsltGetSpecialNamespace(ctxt, node, NULL, NULL, copy);
+	    }
+	}
+    } else {
+	xsltTransformError(ctxt, NULL, node,
+		"xsltShallowCopyElem: copy %s failed\n", node->name);
+    }
+    return(copy);
+}
+
+/**
+ * xsltCopyTreeList:
+ * @ctxt:  a XSLT process context
+ * @invocNode: responsible node in the stylesheet; used for error reports
+ * @list:  the list of element nodes in the source tree.
+ * @insert:  the parent in the result tree.
+ * @isLRE:  is this a literal result element list
+ * @topElemVisited: indicates if a top-most element was already processed
+ *
+ * Make a copy of the full list of tree @list
+ * and insert it as last children of @insert
+ *
+ * NOTE: Not to be used for Literal Result Elements.
+ *
+ * Used by:
+ *  - xsltCopyOf()
+ *
+ * Returns a pointer to the new list, or NULL in case of error
+ */
+static xmlNodePtr
+xsltCopyTreeList(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
+		 xmlNodePtr list,
+		 xmlNodePtr insert, int isLRE, int topElemVisited)
+{
+    xmlNodePtr copy, ret = NULL;
+
+    while (list != NULL) {
+	copy = xsltCopyTreeInternal(ctxt, invocNode,
+	    list, insert, isLRE, topElemVisited);
+	if (copy != NULL) {
+	    if (ret == NULL) {
+		ret = copy;
+	    }
+	}
+	list = list->next;
+    }
+    return(ret);
+}
+
+/**
+ * xsltCopyNamespaceListInternal:
+ * @node:  the target node
+ * @cur:  the first namespace
+ *
+ * Do a copy of a namespace list. If @node is non-NULL the
+ * new namespaces are added automatically.
+ * Called by:
+ *   xsltCopyTreeInternal()
+ *
+ * QUESTION: What is the exact difference between this function
+ *  and xsltCopyNamespaceList() in "namespaces.c"?
+ * ANSWER: xsltCopyNamespaceList() tries to apply ns-aliases.
+ *
+ * Returns: a new xmlNsPtr, or NULL in case of error.
+ */
+static xmlNsPtr
+xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) {
+    xmlNsPtr ret = NULL;
+    xmlNsPtr p = NULL, q, luNs;
+
+    if (ns == NULL)
+	return(NULL);
+    /*
+     * One can add namespaces only on element nodes
+     */
+    if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE))
+	elem = NULL;
+
+    do {
+	if (ns->type != XML_NAMESPACE_DECL)
+	    break;
+	/*
+	 * Avoid duplicating namespace declarations on the tree.
+	 */
+	if (elem != NULL) {	    
+	    if ((elem->ns != NULL) &&
+		xmlStrEqual(elem->ns->prefix, ns->prefix) &&
+		xmlStrEqual(elem->ns->href, ns->href))
+	    {
+		ns = ns->next;
+		continue;
+	    }
+	    luNs = xmlSearchNs(elem->doc, elem, ns->prefix);
+	    if ((luNs != NULL) && (xmlStrEqual(luNs->href, ns->href)))
+	    {
+		ns = ns->next;
+		continue;
+	    }
+	}	    	
+	q = xmlNewNs(elem, ns->href, ns->prefix);
+	if (p == NULL) {
+	    ret = p = q;
+	} else if (q != NULL) {
+	    p->next = q;
+	    p = q;
+	}
+	ns = ns->next;	
+    } while (ns != NULL);
+    return(ret);
+}
+
+/**
+ * xsltShallowCopyNsNode:
+ * @ctxt:  the XSLT transformation context
+ * @invocNode: responsible node in the stylesheet; used for error reports
+ * @insert:  the target element node in the result tree
+ * @ns: the namespace node
+ *
+ * This is used for copying ns-nodes with xsl:copy-of and xsl:copy.
+ *
+ * Returns a new/existing ns-node, or NULL.
+ */
+static xmlNsPtr
+xsltShallowCopyNsNode(xsltTransformContextPtr ctxt,
+		      xmlNodePtr invocNode,
+		      xmlNodePtr insert,
+		      xmlNsPtr ns)
+{
+    /*
+     * TODO: Contrary to header comments, this is declared as int.  
+     * be modified to return a node pointer, or NULL if any error
+     */
+    xmlNsPtr tmpns;
+
+    if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE))
+	return(NULL);
+    
+    if (insert->children != NULL) {
+	xsltTransformError(ctxt, NULL, invocNode,
+	    "Namespace nodes must be added before "
+	    "any child nodes are added to an element.\n");
+	return(NULL);
+    }
+    /*    
+    *
+    * BIG NOTE: Xalan-J simply overwrites any ns-decls with
+    * an equal prefix. We definitively won't do that.
+    *
+    * MSXML 4.0 and the .NET ignores ns-decls for which an
+    * equal prefix is already in use.
+    *
+    * Saxon raises an error like:
+    * "net.sf.saxon.xpath.DynamicError: Cannot create two namespace
+    * nodes with the same name".
+    *
+    * NOTE: We'll currently follow MSXML here.
+    * REVISIT TODO: Check if it's better to follow Saxon here.
+    */
+    if (ns->prefix == NULL) {
+	/*
+	* If we are adding ns-nodes to an element using e.g.
+	* , then we need
+	* to ensure that we don't incorrectly declare a default
+	* namespace on an element in no namespace, which otherwise
+	* would move the element incorrectly into a namespace, if
+	* the node tree is serialized.
+	*/
+	if (insert->ns == NULL)
+	    goto occupied;
+    } else if ((ns->prefix[0] == 'x') &&
+	xmlStrEqual(ns->prefix, BAD_CAST "xml"))
+    {
+	/*
+	* The XML namespace is built in.
+	*/
+	return(NULL);
+    }
+
+    if (insert->nsDef != NULL) {
+	tmpns = insert->nsDef;
+	do {
+	    if ((tmpns->prefix == NULL) == (ns->prefix == NULL)) {		
+		if ((tmpns->prefix == ns->prefix) ||
+		    xmlStrEqual(tmpns->prefix, ns->prefix))
+		{
+		    /*
+		    * Same prefix.
+		    */
+		    if (xmlStrEqual(tmpns->href, ns->href))
+			return(NULL);
+		    goto occupied;
+		}
+	    }
+	    tmpns = tmpns->next;
+	} while (tmpns != NULL);
+    }
+    tmpns = xmlSearchNs(insert->doc, insert, ns->prefix);
+    if ((tmpns != NULL) && xmlStrEqual(tmpns->href, ns->href))
+	return(NULL);
+    /*
+    * Declare a new namespace.
+    * TODO: The problem (wrt efficiency) with this xmlNewNs() is
+    * that it will again search the already declared namespaces
+    * for a duplicate :-/
+    */
+    return(xmlNewNs(insert, ns->href, ns->prefix));
+
+occupied:
+    /*
+    * TODO: We could as well raise an error here (like Saxon does),
+    * or at least generate a warning.
+    */
+    return(NULL);
+}
+
+/**
+ * xsltCopyTreeInternal:
+ * @ctxt:  the XSLT transformation context
+ * @invocNode: responsible node in the stylesheet; used for error reports
+ * @node:  the element node in the source tree
+ * @insert:  the parent in the result tree
+ * @isLRE:  indicates if @node is a Literal Result Element
+ * @topElemVisited: indicates if a top-most element was already processed
+ *
+ * Make a copy of the full tree under the element node @node
+ * and insert it as last child of @insert
+ *
+ * NOTE: Not to be used for Literal Result Elements.
+ *
+ * Used by:
+ *  - xsltCopyOf()
+ *
+ * Returns a pointer to the new tree, or NULL in case of error
+ */
+static xmlNodePtr
+xsltCopyTreeInternal(xsltTransformContextPtr ctxt,
+		     xmlNodePtr invocNode,
+		     xmlNodePtr node,
+		     xmlNodePtr insert, int isLRE, int topElemVisited)
+{
+    xmlNodePtr copy;
+
+    if (node == NULL)
+	return(NULL);
+    switch (node->type) {
+        case XML_ELEMENT_NODE:
+        case XML_ENTITY_REF_NODE:
+        case XML_ENTITY_NODE:
+        case XML_PI_NODE:
+        case XML_COMMENT_NODE:
+        case XML_DOCUMENT_NODE:
+        case XML_HTML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+        case XML_DOCB_DOCUMENT_NODE:
+#endif
+	    break;
+        case XML_TEXT_NODE: {
+	    int noenc = (node->name == xmlStringTextNoenc);
+	    return(xsltCopyTextString(ctxt, insert, node->content, noenc));
+	    }
+        case XML_CDATA_SECTION_NODE:
+	    return(xsltCopyTextString(ctxt, insert, node->content, 0));
+        case XML_ATTRIBUTE_NODE:
+	    return((xmlNodePtr)
+		xsltShallowCopyAttr(ctxt, invocNode, insert, (xmlAttrPtr) node));
+        case XML_NAMESPACE_DECL:
+	    return((xmlNodePtr) xsltShallowCopyNsNode(ctxt, invocNode,
+		insert, (xmlNsPtr) node));
+	    
+        case XML_DOCUMENT_TYPE_NODE:
+        case XML_DOCUMENT_FRAG_NODE:
+        case XML_NOTATION_NODE:
+        case XML_DTD_NODE:
+        case XML_ELEMENT_DECL:
+        case XML_ATTRIBUTE_DECL:
+        case XML_ENTITY_DECL:
+        case XML_XINCLUDE_START:
+        case XML_XINCLUDE_END:
+            return(NULL);
+    }    
+    if (XSLT_IS_RES_TREE_FRAG(node)) {
+	if (node->children != NULL)
+	    copy = xsltCopyTreeList(ctxt, invocNode,
+		node->children, insert, 0, 0);
+	else
+	    copy = NULL;
+	return(copy);
+    }
+    copy = xmlDocCopyNode(node, insert->doc, 0);
+    if (copy != NULL) {
+	copy->doc = ctxt->output;
+	xmlAddChild(insert, copy);
+	/*
+	 * The node may have been coalesced into another text node.
+	 */
+	if (insert->last != copy)
+	    return(insert->last);
+	copy->next = NULL;
+
+	if (node->type == XML_ELEMENT_NODE) {	    
+	    /*
+	    * Copy in-scope namespace nodes.
+	    *
+	    * REVISIT: Since we try to reuse existing in-scope ns-decls by
+	    *  using xmlSearchNsByHref(), this will eventually change
+	    *  the prefix of an original ns-binding; thus it might
+	    *  break QNames in element/attribute content.
+	    * OPTIMIZE TODO: If we had a xmlNsPtr * on the transformation
+	    *  context, plus a ns-lookup function, which writes directly
+	    *  to a given list, then we wouldn't need to create/free the
+	    *  nsList every time.
+	    */
+	    if ((topElemVisited == 0) &&
+		(node->parent != NULL) &&
+		(node->parent->type != XML_DOCUMENT_NODE) &&
+		(node->parent->type != XML_HTML_DOCUMENT_NODE))
+	    {
+		xmlNsPtr *nsList, *curns, ns;
+		
+		/*
+		* If this is a top-most element in a tree to be
+		* copied, then we need to ensure that all in-scope
+		* namespaces are copied over. For nodes deeper in the
+		* tree, it is sufficient to reconcile only the ns-decls
+		* (node->nsDef entries).
+		*/
+		
+		nsList = xmlGetNsList(node->doc, node);
+		if (nsList != NULL) {
+		    curns = nsList;
+		    do {
+			/*
+			* Search by prefix first in order to break as less
+			* QNames in element/attribute content as possible.
+			*/
+			ns = xmlSearchNs(insert->doc, insert,
+			    (*curns)->prefix);
+			
+			if ((ns == NULL) ||
+			    (! xmlStrEqual(ns->href, (*curns)->href)))
+			{
+			    ns = NULL;
+			    /*
+			    * Search by namespace name.
+			    * REVISIT TODO: Currently disabled.
+			    */
+#if 0
+			    ns = xmlSearchNsByHref(insert->doc,
+				insert, (*curns)->href);
+#endif
+			}
+			if (ns == NULL) {
+			    /*
+			    * Declare a new namespace on the copied element.
+			    */
+			    ns = xmlNewNs(copy, (*curns)->href,
+				(*curns)->prefix);
+			    /* TODO: Handle errors */
+			}
+			if (node->ns == *curns) {
+			    /*
+			    * If this was the original's namespace then set
+			    * the generated counterpart on the copy.
+			    */
+			    copy->ns = ns;
+			}
+			curns++;
+		    } while (*curns != NULL);
+		    xmlFree(nsList);
+		}
+	    } else if (node->nsDef != NULL) {		
+		/*
+		* Copy over all namespace declaration attributes.		
+		*/
+		if (node->nsDef != NULL) {
+		    if (isLRE)
+			xsltCopyNamespaceList(ctxt, copy, node->nsDef);
+		    else
+			xsltCopyNamespaceListInternal(copy, node->nsDef);
+		}
+	    }
+	    /*
+	    * Set the namespace.
+	    */
+	    if (node->ns != NULL) {
+		if (copy->ns == NULL) {
+		    /*
+		    * This will map copy->ns to one of the newly created
+		    * in-scope ns-decls, OR create a new ns-decl on @copy.
+		    */
+		    copy->ns = xsltGetSpecialNamespace(ctxt, invocNode,
+			node->ns->href, node->ns->prefix, copy);
+		}
+	    } else if ((insert->type == XML_ELEMENT_NODE) &&
+		(insert->ns != NULL))
+	    {
+		/*
+		* "Undeclare" the default namespace on @copy with xmlns="".
+		*/
+		xsltGetSpecialNamespace(ctxt, invocNode, NULL, NULL, copy);
+	    }
+	    /*
+	    * Copy attribute nodes.
+	    */
+	    if (node->properties != NULL) {
+		xsltCopyAttrListNoOverwrite(ctxt, invocNode,
+		    copy, node->properties);
+	    }
+	    if (topElemVisited == 0)
+		topElemVisited = 1;
+	}
+	/*
+	* Copy the subtree.
+	*/
+	if (node->children != NULL) {
+	    xsltCopyTreeList(ctxt, invocNode,
+		node->children, copy, isLRE, topElemVisited);
+	}
+    } else {
+	xsltTransformError(ctxt, NULL, invocNode,
+	    "xsltCopyTreeInternal: Copying of '%s' failed.\n", node->name);
+    }
+    return(copy);
+}
+
+/**
+ * xsltCopyTree:
+ * @ctxt:  the XSLT transformation context
+ * @node:  the element node in the source tree
+ * @insert:  the parent in the result tree
+ * @literal:  indicates if @node is a Literal Result Element
+ *
+ * Make a copy of the full tree under the element node @node
+ * and insert it as last child of @insert
+ * For literal result element, some of the namespaces may not be copied
+ * over according to section 7.1.
+ * TODO: Why is this a public function?
+ *
+ * Returns a pointer to the new tree, or NULL in case of error
+ */
+xmlNodePtr
+xsltCopyTree(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	     xmlNodePtr insert, int literal)
+{
+    return(xsltCopyTreeInternal(ctxt, node, node, insert, literal, 0));
+    
+}
+
+/************************************************************************
+ *									*
+ *		Error/fallback processing				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltApplyFallbacks:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the node generating the error
+ *
+ * Process possible xsl:fallback nodes present under @inst
+ *
+ * Returns the number of xsl:fallback element found and processed
+ */
+static int
+xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst) {
+
+    xmlNodePtr child;
+    int ret = 0;
+    
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL) ||
+	(inst->children == NULL))
+	return(0);
+
+    child = inst->children;
+    while (child != NULL) {
+        if ((IS_XSLT_ELEM(child)) &&
+            (xmlStrEqual(child->name, BAD_CAST "fallback"))) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+			     "applying xsl:fallback\n");
+#endif
+	    ret++;
+	    xsltApplySequenceConstructor(ctxt, node, child->children,
+		NULL);
+	}
+	child = child->next;
+    }
+    return(ret);
+}
+
+/************************************************************************
+ *									*
+ *			Default processing				*
+ *									*
+ ************************************************************************/
+
+void xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
+			xsltStackElemPtr params);
+/**
+ * xsltDefaultProcessOneNode:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @params: extra parameters passed to the template if any
+ *
+ * Process the source node with the default built-in template rule:
+ * 
+ *   
+ * 
+ *
+ * and
+ *
+ * 
+ *   
+ * 
+ *
+ * Note also that namespace declarations are copied directly:
+ *
+ * the built-in template rule is the only template rule that is applied
+ * for namespace nodes.
+ */
+static void
+xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
+			  xsltStackElemPtr params) {
+    xmlNodePtr copy;
+    xmlNodePtr delete = NULL, cur;
+    int nbchild = 0, oldSize;
+    int childno = 0, oldPos;
+    xsltTemplatePtr template;
+
+    CHECK_STOPPED;
+    /*
+     * Handling of leaves
+     */
+    switch (node->type) {
+	case XML_DOCUMENT_NODE:
+	case XML_HTML_DOCUMENT_NODE:
+	case XML_ELEMENT_NODE:
+	    break;
+	case XML_CDATA_SECTION_NODE:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltDefaultProcessOneNode: copy CDATA %s\n",
+		node->content));
+#endif
+	    copy = xsltCopyText(ctxt, ctxt->insert, node, 0);
+	    if (copy == NULL) {
+		xsltTransformError(ctxt, NULL, node,
+		 "xsltDefaultProcessOneNode: cdata copy failed\n");
+	    }
+	    return;
+	case XML_TEXT_NODE:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    if (node->content == NULL) {
+		XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltDefaultProcessOneNode: copy empty text\n"));
+		return;
+	    } else {
+		XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltDefaultProcessOneNode: copy text %s\n",
+			node->content));
+            }
+#endif
+	    copy = xsltCopyText(ctxt, ctxt->insert, node, 0);
+	    if (copy == NULL) {
+		xsltTransformError(ctxt, NULL, node,
+		 "xsltDefaultProcessOneNode: text copy failed\n");
+	    }
+	    return;
+	case XML_ATTRIBUTE_NODE:
+	    cur = node->children;
+	    while ((cur != NULL) && (cur->type != XML_TEXT_NODE))
+		cur = cur->next;
+	    if (cur == NULL) {
+		xsltTransformError(ctxt, NULL, node,
+		 "xsltDefaultProcessOneNode: no text for attribute\n");
+	    } else {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		if (cur->content == NULL) {
+		    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: copy empty text\n"));
+		} else {
+		    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: copy text %s\n",
+			cur->content));
+                }
+#endif
+		copy = xsltCopyText(ctxt, ctxt->insert, cur, 0);
+		if (copy == NULL) {
+		    xsltTransformError(ctxt, NULL, node,
+		     "xsltDefaultProcessOneNode: text copy failed\n");
+		}
+	    }
+	    return;
+	default:
+	    return;
+    }
+    /*
+     * Handling of Elements: first pass, cleanup and counting
+     */
+    cur = node->children;
+    while (cur != NULL) {
+	switch (cur->type) {
+	    case XML_TEXT_NODE:
+	    case XML_CDATA_SECTION_NODE:
+	    case XML_DOCUMENT_NODE:
+	    case XML_HTML_DOCUMENT_NODE:
+	    case XML_ELEMENT_NODE:
+	    case XML_PI_NODE:
+	    case XML_COMMENT_NODE:
+		nbchild++;
+		break;
+            case XML_DTD_NODE:
+		/* Unlink the DTD, it's still reachable using doc->intSubset */
+		if (cur->next != NULL)
+		    cur->next->prev = cur->prev;
+		if (cur->prev != NULL)
+		    cur->prev->next = cur->next;
+		break;
+	    default:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltDefaultProcessOneNode: skipping node type %d\n",
+		                 cur->type));
+#endif
+		delete = cur;
+	}
+	cur = cur->next;
+	if (delete != NULL) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
+#endif
+	    xmlUnlinkNode(delete);
+	    xmlFreeNode(delete);
+	    delete = NULL;
+	}
+    }
+    if (delete != NULL) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
+#endif
+	xmlUnlinkNode(delete);
+	xmlFreeNode(delete);
+	delete = NULL;
+    }
+
+    /*
+     * Handling of Elements: second pass, actual processing
+     */
+    oldSize = ctxt->xpathCtxt->contextSize;
+    oldPos = ctxt->xpathCtxt->proximityPosition;
+    cur = node->children;
+    while (cur != NULL) {
+	childno++;
+	switch (cur->type) {
+	    case XML_DOCUMENT_NODE:
+	    case XML_HTML_DOCUMENT_NODE:
+	    case XML_ELEMENT_NODE:
+		ctxt->xpathCtxt->contextSize = nbchild;
+		ctxt->xpathCtxt->proximityPosition = childno;
+		xsltProcessOneNode(ctxt, cur, params);
+		break;
+	    case XML_CDATA_SECTION_NODE:
+		template = xsltGetTemplate(ctxt, cur, NULL);
+		if (template) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltDefaultProcessOneNode: applying template for CDATA %s\n",
+				     cur->content));
+#endif
+		    /*
+		    * Instantiate the xsl:template.
+		    */
+		    xsltApplyXSLTTemplate(ctxt, cur, template->content,
+			template, params);
+		} else /* if (ctxt->mode == NULL) */ {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: copy CDATA %s\n",
+				     cur->content));
+#endif
+		    copy = xsltCopyText(ctxt, ctxt->insert, cur, 0);
+		    if (copy == NULL) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "xsltDefaultProcessOneNode: cdata copy failed\n");
+		    }
+		}
+		break;
+	    case XML_TEXT_NODE:
+		template = xsltGetTemplate(ctxt, cur, NULL);
+		if (template) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltDefaultProcessOneNode: applying template for text %s\n",
+				     cur->content));
+#endif
+		    ctxt->xpathCtxt->contextSize = nbchild;
+		    ctxt->xpathCtxt->proximityPosition = childno;
+		    /*
+		    * Instantiate the xsl:template.
+		    */
+		    xsltApplyXSLTTemplate(ctxt, cur, template->content,
+			template, params);
+		} else /* if (ctxt->mode == NULL) */ {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    if (cur->content == NULL) {
+			XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltDefaultProcessOneNode: copy empty text\n"));
+		    } else {
+			XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: copy text %s\n",
+					 cur->content));
+                    }
+#endif
+		    copy = xsltCopyText(ctxt, ctxt->insert, cur, 0);
+		    if (copy == NULL) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "xsltDefaultProcessOneNode: text copy failed\n");
+		    }
+		}
+		break;
+	    case XML_PI_NODE:
+	    case XML_COMMENT_NODE:
+		template = xsltGetTemplate(ctxt, cur, NULL);
+		if (template) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    if (cur->type == XML_PI_NODE) {
+			XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: template found for PI %s\n",
+			                 cur->name));
+		    } else if (cur->type == XML_COMMENT_NODE) {
+			XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltDefaultProcessOneNode: template found for comment\n"));
+                    }
+#endif
+		    ctxt->xpathCtxt->contextSize = nbchild;
+		    ctxt->xpathCtxt->proximityPosition = childno;
+		    /*
+		    * Instantiate the xsl:template.
+		    */
+		    xsltApplyXSLTTemplate(ctxt, cur, template->content,
+			template, params);
+		}
+		break;
+	    default:
+		break;
+	}
+	cur = cur->next;
+    }
+    ctxt->xpathCtxt->contextSize = oldSize;
+    ctxt->xpathCtxt->proximityPosition = oldPos;
+}
+
+/**
+ * xsltProcessOneNode:
+ * @ctxt:  a XSLT process context
+ * @contextNode:  the "current node" in the source tree
+ * @withParams:  extra parameters (e.g. xsl:with-param) passed to the
+ *               template if any
+ *
+ * Process the source node.
+ */
+void
+xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
+	           xsltStackElemPtr withParams)
+{
+    xsltTemplatePtr templ;
+    xmlNodePtr oldNode;
+    
+    templ = xsltGetTemplate(ctxt, contextNode, NULL);
+    /*
+     * If no template is found, apply the default rule.
+     */
+    if (templ == NULL) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	if (contextNode->type == XML_DOCUMENT_NODE) {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: no template found for /\n"));
+	} else if (contextNode->type == XML_CDATA_SECTION_NODE) {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: no template found for CDATA\n"));
+	} else if (contextNode->type == XML_ATTRIBUTE_NODE) {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: no template found for attribute %s\n",
+	                     ((xmlAttrPtr) contextNode)->name));
+	} else  {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: no template found for %s\n", contextNode->name));
+        }
+#endif
+	oldNode = ctxt->node;
+	ctxt->node = contextNode;
+	xsltDefaultProcessOneNode(ctxt, contextNode, withParams);
+	ctxt->node = oldNode;
+	return;
+    }
+
+    if (contextNode->type == XML_ATTRIBUTE_NODE) {
+	xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; 
+	/*
+	* Set the "current template rule".
+	*/
+	ctxt->currentTemplateRule = templ;
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: applying template '%s' for attribute %s\n",
+	                 templ->match, contextNode->name));
+#endif
+	xsltApplyXSLTTemplate(ctxt, contextNode, templ->content, templ, withParams);
+
+	ctxt->currentTemplateRule = oldCurTempRule;
+    } else {
+	xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; 
+	/*
+	* Set the "current template rule".
+	*/
+	ctxt->currentTemplateRule = templ;
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	if (contextNode->type == XML_DOCUMENT_NODE) {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: applying template '%s' for /\n",
+	                     templ->match));
+	} else {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessOneNode: applying template '%s' for %s\n",
+	                     templ->match, contextNode->name));
+        }
+#endif
+	xsltApplyXSLTTemplate(ctxt, contextNode, templ->content, templ, withParams);
+
+	ctxt->currentTemplateRule = oldCurTempRule;
+    }
+}
+
+static xmlNodePtr
+xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
+				     xmlNodePtr contextNode,
+				     xmlNodePtr list,
+				     xsltTemplatePtr templ,
+				     int *addCallResult)
+{
+    xmlNodePtr debugedNode = NULL;    
+
+    if (ctxt->debugStatus != XSLT_DEBUG_NONE) {
+        if (templ) {
+            *addCallResult = xslAddCall(templ, templ->elem);
+        } else {
+            *addCallResult = xslAddCall(NULL, list);
+        }
+        switch (ctxt->debugStatus) {
+            case XSLT_DEBUG_RUN_RESTART:
+            case XSLT_DEBUG_QUIT:
+                if (*addCallResult)
+                    xslDropCall();
+                return(NULL);
+        }
+        if (templ) {
+            xslHandleDebugger(templ->elem, contextNode, templ, ctxt);
+            debugedNode = templ->elem;
+        } else if (list) {
+            xslHandleDebugger(list, contextNode, templ, ctxt);
+            debugedNode = list;
+        } else if (ctxt->inst) {
+            xslHandleDebugger(ctxt->inst, contextNode, templ, ctxt);
+            debugedNode = ctxt->inst;
+        }
+    }
+    return(debugedNode);
+}
+
+/**
+ * xsltLocalVariablePush:
+ * @ctxt: the transformation context
+ * @variable: variable to be pushed to the variable stack
+ * @level: new value for variable's level
+ *
+ * Places the variable onto the local variable stack
+ *
+ * Returns: 0 for success, -1 for any error
+ * **NOTE:**
+ * This is an internal routine and should not be called by users!
+ */
+int
+xsltLocalVariablePush(xsltTransformContextPtr ctxt,
+		      xsltStackElemPtr variable,
+		      int level)
+{
+    if (ctxt->varsMax == 0) {
+	ctxt->varsMax = 10;
+	ctxt->varsTab =
+	    (xsltStackElemPtr *) xmlMalloc(ctxt->varsMax *
+	    sizeof(ctxt->varsTab[0]));
+	if (ctxt->varsTab == NULL) {
+	    xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+	    return (-1);
+	}
+    }
+    if (ctxt->varsNr >= ctxt->varsMax) {
+	ctxt->varsMax *= 2;
+	ctxt->varsTab =
+	    (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab,
+	    ctxt->varsMax *
+	    sizeof(ctxt->varsTab[0]));
+	if (ctxt->varsTab == NULL) {
+	    xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+	    return (-1);
+	}
+    }
+    ctxt->varsTab[ctxt->varsNr++] = variable;
+    ctxt->vars = variable;
+    variable->level = level;
+    return(0);
+}
+
+/**
+ * xsltReleaseLocalRVTs:
+ *
+ * Fragments which are results of extension instructions
+ * are preserved; all other fragments are freed/cached.
+ */
+static void
+xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base)
+{
+    xmlDocPtr cur = ctxt->localRVT, tmp;
+    
+    while ((cur != NULL) && (cur != base)) {
+	if (cur->psvi == (void *) ((long) 1)) {
+	    cur = (xmlDocPtr) cur->next;
+	} else {
+	    tmp = cur;
+	    cur = (xmlDocPtr) cur->next;
+
+	    if (tmp == ctxt->localRVT)
+		ctxt->localRVT = cur;
+
+	    /*
+	    * We need ctxt->localRVTBase for extension instructions
+	    * which return values (like EXSLT's function).
+	    */
+	    if (tmp == ctxt->localRVTBase)
+		ctxt->localRVTBase = cur;
+
+	    if (tmp->prev)
+		tmp->prev->next = (xmlNodePtr) cur;
+	    if (cur)
+		cur->prev = tmp->prev;
+	    xsltReleaseRVT(ctxt, tmp);
+	}
+    }
+}
+
+/**
+ * xsltApplySequenceConstructor:
+ * @ctxt:  a XSLT process context
+ * @contextNode:  the "current node" in the source tree
+ * @list:  the nodes of a sequence constructor;
+ *         (plus leading xsl:param elements)
+ * @templ: the compiled xsl:template (optional)
+ *
+ * Processes a sequence constructor.
+ * 
+ * NOTE: ctxt->currentTemplateRule was introduced to reflect the
+ * semantics of "current template rule". I.e. the field ctxt->templ
+ * is not intended to reflect this, thus always pushed onto the
+ * template stack.
+ */
+static void
+xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
+			     xmlNodePtr contextNode, xmlNodePtr list,
+			     xsltTemplatePtr templ)
+{
+    xmlNodePtr oldInsert, oldInst, oldCurInst, oldContextNode;
+    xmlNodePtr cur, insert, copy = NULL;
+    int level = 0, oldVarsNr;
+    xmlDocPtr oldLocalFragmentTop, oldLocalFragmentBase;
+
+#ifdef XSLT_REFACTORED
+    xsltStylePreCompPtr info;
+#endif
+
+#ifdef WITH_DEBUGGER
+    int addCallResult = 0;
+    xmlNodePtr debuggedNode = NULL;
+#endif
+
+    if (ctxt == NULL)
+	return;
+
+#ifdef WITH_DEBUGGER 
+    if (ctxt->debugStatus != XSLT_DEBUG_NONE) {
+	debuggedNode =
+	    xsltDebuggerStartSequenceConstructor(ctxt, contextNode,
+		list, templ, &addCallResult);
+	if (debuggedNode == NULL)
+	    return;
+    }
+#endif
+
+    if (list == NULL)
+        return;
+    CHECK_STOPPED;
+
+    oldLocalFragmentTop = ctxt->localRVT;
+    oldInsert = insert = ctxt->insert;
+    oldInst = oldCurInst = ctxt->inst;
+    oldContextNode = ctxt->node;
+    /*
+    * Save current number of variables on the stack; new vars are popped when
+    * exiting.
+    */
+    oldVarsNr = ctxt->varsNr;
+    /*
+    * Process the sequence constructor.
+    */
+    cur = list;
+    while (cur != NULL) {
+        ctxt->inst = cur;
+
+#ifdef WITH_DEBUGGER
+        switch (ctxt->debugStatus) {
+            case XSLT_DEBUG_RUN_RESTART:
+            case XSLT_DEBUG_QUIT:
+                break;
+
+        }
+#endif
+        /*
+         * Test; we must have a valid insertion point.
+         */
+        if (insert == NULL) {
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+            XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltApplySequenceConstructor: insert == NULL !\n"));
+#endif
+            goto error;
+        }
+
+#ifdef WITH_DEBUGGER
+        if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (debuggedNode != cur))
+            xslHandleDebugger(cur, contextNode, templ, ctxt);
+#endif
+
+#ifdef XSLT_REFACTORED
+	if (cur->type == XML_ELEMENT_NODE) {
+	    info = (xsltStylePreCompPtr) cur->psvi;
+	    /*
+	    * We expect a compiled representation on:
+	    * 1) XSLT instructions of this XSLT version (1.0)
+	    *    (with a few exceptions)
+	    * 2) Literal result elements
+	    * 3) Extension instructions
+	    * 4) XSLT instructions of future XSLT versions
+	    *    (forwards-compatible mode).
+	    */
+	    if (info == NULL) {
+		/*
+		* Handle the rare cases where we don't expect a compiled
+		* representation on an XSLT element.
+		*/
+		if (IS_XSLT_ELEM_FAST(cur) && IS_XSLT_NAME(cur, "message")) {
+		    xsltMessage(ctxt, contextNode, cur);
+		    goto skip_children;
+		}		    		 
+		/*
+		* Something really went wrong:
+		*/
+		xsltTransformError(ctxt, NULL, cur,
+		    "Internal error in xsltApplySequenceConstructor(): "
+		    "The element '%s' in the stylesheet has no compiled "
+		    "representation.\n",
+		    cur->name);
+                goto skip_children;
+            }
+
+	    if (info->type == XSLT_FUNC_LITERAL_RESULT_ELEMENT) {
+		xsltStyleItemLRElementInfoPtr lrInfo =
+		    (xsltStyleItemLRElementInfoPtr) info;
+		/*
+		* Literal result elements
+		* --------------------------------------------------------
+		*/
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplySequenceConstructor: copy literal result "
+		    "element '%s'\n", cur->name));
+#endif
+		/*
+		* Copy the raw element-node.
+		* OLD: if ((copy = xsltShallowCopyElem(ctxt, cur, insert))
+		*     == NULL)
+		*   goto error;
+		*/		
+		copy = xmlDocCopyNode(cur, insert->doc, 0);
+		if (copy == NULL) {
+		    xsltTransformError(ctxt, NULL, cur,
+			"Internal error in xsltApplySequenceConstructor(): "
+			"Failed to copy literal result element '%s'.\n",
+			cur->name);
+		    goto error;
+		} else {
+		    /*
+		    * Add the element-node to the result tree.
+		    */
+		    copy->doc = ctxt->output;
+		    xmlAddChild(insert, copy);
+		    /*
+		    * Create effective namespaces declarations.
+		    * OLD: xsltCopyNamespaceList(ctxt, copy, cur->nsDef);
+		    */
+		    if (lrInfo->effectiveNs != NULL) {
+			xsltEffectiveNsPtr effNs = lrInfo->effectiveNs;
+			xmlNsPtr ns, lastns = NULL;
+
+			while (effNs != NULL) {
+			    /*
+			    * Avoid generating redundant namespace
+			    * declarations; thus lookup if there is already
+			    * such a ns-decl in the result.
+			    */			    
+			    ns = xmlSearchNs(copy->doc, copy, effNs->prefix);
+			    if ((ns != NULL) &&
+				(xmlStrEqual(ns->href, effNs->nsName)))
+			    {
+				effNs = effNs->next;
+				continue;			    
+			    }
+			    ns = xmlNewNs(copy, effNs->nsName, effNs->prefix);
+			    if (ns == NULL) {
+				xsltTransformError(ctxt, NULL, cur,
+				    "Internal error in "
+				    "xsltApplySequenceConstructor(): "
+				    "Failed to copy a namespace "
+				    "declaration.\n");
+				goto error;
+			    }
+								
+			    if (lastns == NULL)
+				copy->nsDef = ns;
+			    else
+				lastns->next =ns;
+			    lastns = ns;
+
+			    effNs = effNs->next;
+			}
+			
+		    }
+		    /*
+		    * NOTE that we don't need to apply ns-alising: this was
+		    *  already done at compile-time.
+		    */
+		    if (cur->ns != NULL) {
+			/*
+			* If there's no such ns-decl in the result tree,
+			* then xsltGetSpecialNamespace() will
+			* create a ns-decl on the copied node.
+			*/			
+			copy->ns = xsltGetSpecialNamespace(ctxt, cur,
+			    cur->ns->href, cur->ns->prefix, copy);			    
+		    } else {
+			/*
+			* Undeclare the default namespace if needed.
+			* This can be skipped, if the result element has
+			*  no ns-decls, in which case the result element
+			*  obviously does not declare a default namespace;
+			*  AND there's either no parent, or the parent
+			*  element is in no namespace; this means there's no
+			*  default namespace is scope to care about.
+			*
+			* REVISIT: This might result in massive
+			*  generation of ns-decls if nodes in a default
+			*  namespaces are mixed with nodes in no namespace.
+			*  
+			*/
+			if (copy->nsDef ||
+			    ((insert != NULL) &&
+			     (insert->type == XML_ELEMENT_NODE) &&
+			     (insert->ns != NULL)))
+			{
+			    xsltGetSpecialNamespace(ctxt, cur,
+				NULL, NULL, copy);
+			}
+		    }
+		}
+		/*
+		* SPEC XSLT 2.0 "Each attribute of the literal result
+		*  element, other than an attribute in the XSLT namespace,
+		*  is processed to produce an attribute for the element in
+		*  the result tree."
+		* NOTE: See bug #341325.
+		*/
+		if (cur->properties != NULL) {
+		    xsltAttrListTemplateProcess(ctxt, copy, cur->properties);
+		}
+	    } else if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* XSLT instructions
+		* --------------------------------------------------------
+		*/
+		if (info->type == XSLT_FUNC_UNKOWN_FORWARDS_COMPAT) {
+		    /*
+		    * We hit an unknown XSLT element.
+		    * Try to apply one of the fallback cases.
+		    */		
+		    ctxt->insert = insert;
+		    if (!xsltApplyFallbacks(ctxt, contextNode, cur)) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "The is no fallback behaviour defined for "
+			    "the unknown XSLT element '%s'.\n",
+			    cur->name);
+		    }			
+		    ctxt->insert = oldInsert;
+		} else if (info->func != NULL) {
+		    /*
+		    * Execute the XSLT instruction.
+		    */
+		    ctxt->insert = insert;
+
+		    info->func(ctxt, contextNode, cur,
+			(xsltElemPreCompPtr) info);
+
+		    /*
+		    * Cleanup temporary tree fragments.
+		    */
+		    if (oldLocalFragmentTop != ctxt->localRVT)
+			xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
+
+		    ctxt->insert = oldInsert;
+		} else if (info->type == XSLT_FUNC_VARIABLE) {		
+		    xsltStackElemPtr tmpvar = ctxt->vars;
+		
+		    xsltParseStylesheetVariable(ctxt, cur);
+		    
+		    if (tmpvar != ctxt->vars) {
+			/*
+			* TODO: Using a @tmpvar is an annoying workaround, but
+			*  the current mechanisms do not provide any other way
+			*  of knowing if the var was really pushed onto the
+			*  stack.
+			*/
+			ctxt->vars->level = level;
+		    }
+		} else if (info->type == XSLT_FUNC_MESSAGE) {
+		    /*
+		    * TODO: Won't be hit, since we don't compile xsl:message.
+		    */
+		    xsltMessage(ctxt, contextNode, cur);
+		} else {
+		    xsltTransformError(ctxt, NULL, cur,
+			"Unexpected XSLT element '%s'.\n", cur->name);		    	
+		}
+		goto skip_children;
+
+	    } else {
+		xsltTransformFunction func;
+		/*
+		* Extension intructions (elements)
+		* --------------------------------------------------------
+		*/				
+		if (cur->psvi == xsltExtMarker) {
+		    /*
+		    * The xsltExtMarker was set during the compilation
+		    * of extension instructions if there was no registered
+		    * handler for this specific extension function at
+		    * compile-time.
+		    * Libxslt will now lookup if a handler is
+		    * registered in the context of this transformation.
+		    */
+		    func = (xsltTransformFunction)
+			xsltExtElementLookup(ctxt, cur->name, cur->ns->href);
+		} else
+		    func = ((xsltElemPreCompPtr) cur->psvi)->func;
+		
+		if (func == NULL) {
+		    /*
+		    * No handler available.
+		    * Try to execute fallback behaviour via xsl:fallback.
+		    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+			xsltGenericDebug(xsltGenericDebugContext,
+			    "xsltApplySequenceConstructor: unknown extension %s\n",
+			    cur->name));
+#endif
+		    ctxt->insert = insert;
+		    if (!xsltApplyFallbacks(ctxt, contextNode, cur)) {
+			xsltTransformError(ctxt, NULL, cur,
+			    "Unknown extension instruction '{%s}%s'.\n",
+			    cur->ns->href, cur->name);
+		    }			
+		    ctxt->insert = oldInsert;		    
+		} else {
+		    /*
+		    * Execute the handler-callback.
+		    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+			"xsltApplySequenceConstructor: extension construct %s\n",
+			cur->name));
+#endif		    
+		    ctxt->insert = insert;
+		    /*
+		    * We need the fragment base for extension instructions
+		    * which return values (like EXSLT's function).
+		    */
+		    oldLocalFragmentBase = ctxt->localRVTBase;
+		    ctxt->localRVTBase = NULL;
+
+		    func(ctxt, contextNode, cur, cur->psvi);
+
+		    ctxt->localRVTBase = oldLocalFragmentBase;
+		    /*
+		    * Cleanup temporary tree fragments.
+		    */
+		    if (oldLocalFragmentTop != ctxt->localRVT)
+			xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
+
+		    ctxt->insert = oldInsert;
+		}
+		goto skip_children;
+	    }
+
+	} else if (XSLT_IS_TEXT_NODE(cur)) {
+	    /*
+	    * Text
+	    * ------------------------------------------------------------
+	    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+            if (cur->name == xmlStringTextNoenc) {
+                XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplySequenceConstructor: copy unescaped text '%s'\n",
+		    cur->content));
+            } else {
+                XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplySequenceConstructor: copy text '%s'\n",
+		    cur->content));
+            }
+#endif
+            if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL)
+		goto error;	    
+	}
+
+#else /* XSLT_REFACTORED */
+
+        if (IS_XSLT_ELEM(cur)) {
+            /*
+             * This is an XSLT node
+             */
+            xsltStylePreCompPtr info = (xsltStylePreCompPtr) cur->psvi;
+
+            if (info == NULL) {
+                if (IS_XSLT_NAME(cur, "message")) {
+                    xsltMessage(ctxt, contextNode, cur);
+                } else {		    
+                    /*
+                     * That's an error try to apply one of the fallback cases
+                     */
+                    ctxt->insert = insert;
+                    if (!xsltApplyFallbacks(ctxt, contextNode, cur)) {
+                        xsltGenericError(xsltGenericErrorContext,
+			    "xsltApplySequenceConstructor: %s was not compiled\n",
+			    cur->name);
+                    }
+                    ctxt->insert = oldInsert;
+                }
+                goto skip_children;
+            }	    
+
+            if (info->func != NULL) {
+		oldCurInst = ctxt->inst;
+		ctxt->inst = cur;
+                ctxt->insert = insert;
+		oldLocalFragmentBase = ctxt->localRVTBase;
+		ctxt->localRVTBase = NULL;
+
+                info->func(ctxt, contextNode, cur, (xsltElemPreCompPtr) info);
+
+		ctxt->localRVTBase = oldLocalFragmentBase;
+		/*
+		* Cleanup temporary tree fragments.
+		*/
+		if (oldLocalFragmentTop != ctxt->localRVT)
+		    xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
+
+                ctxt->insert = oldInsert;
+		ctxt->inst = oldCurInst;
+                goto skip_children;
+            }
+
+            if (IS_XSLT_NAME(cur, "variable")) {
+		xsltStackElemPtr tmpvar = ctxt->vars;
+		
+		oldCurInst = ctxt->inst;
+		ctxt->inst = cur;
+
+		xsltParseStylesheetVariable(ctxt, cur);
+
+		ctxt->inst = oldCurInst;
+		
+		if (tmpvar != ctxt->vars) {
+		    /*
+		    * TODO: Using a @tmpvar is an annoying workaround, but
+		    *  the current mechanisms do not provide any other way
+		    *  of knowing if the var was really pushed onto the
+		    *  stack.
+		    */
+		    ctxt->vars->level = level;
+		}
+            } else if (IS_XSLT_NAME(cur, "message")) {
+                xsltMessage(ctxt, contextNode, cur);
+            } else {
+		xsltTransformError(ctxt, NULL, cur,
+		    "Unexpected XSLT element '%s'.\n", cur->name);
+            }
+            goto skip_children;
+        } else if ((cur->type == XML_TEXT_NODE) ||
+                   (cur->type == XML_CDATA_SECTION_NODE)) {
+
+            /*
+             * This text comes from the stylesheet
+             * For stylesheets, the set of whitespace-preserving
+             * element names consists of just xsl:text.
+             */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+            if (cur->type == XML_CDATA_SECTION_NODE) {
+                XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+                                 "xsltApplySequenceConstructor: copy CDATA text %s\n",
+                                 cur->content));
+            } else if (cur->name == xmlStringTextNoenc) {
+                XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+                                 "xsltApplySequenceConstructor: copy unescaped text %s\n",
+                                 cur->content));
+            } else {
+                XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+                                 "xsltApplySequenceConstructor: copy text %s\n",
+                                 cur->content));
+            }
+#endif
+            if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL)
+		goto error;
+        } else if ((cur->type == XML_ELEMENT_NODE) &&
+                   (cur->ns != NULL) && (cur->psvi != NULL)) {
+            xsltTransformFunction function;
+
+	    oldCurInst = ctxt->inst;
+	    ctxt->inst = cur;
+            /*
+             * Flagged as an extension element
+             */
+            if (cur->psvi == xsltExtMarker)
+                function = (xsltTransformFunction)
+                    xsltExtElementLookup(ctxt, cur->name, cur->ns->href);
+            else
+                function = ((xsltElemPreCompPtr) cur->psvi)->func;
+
+            if (function == NULL) {
+                xmlNodePtr child;
+                int found = 0;
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+                XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplySequenceConstructor: unknown extension %s\n",
+                    cur->name));
+#endif
+                /*
+                 * Search if there are fallbacks
+                 */
+                child = cur->children;
+                while (child != NULL) {
+                    if ((IS_XSLT_ELEM(child)) &&
+                        (IS_XSLT_NAME(child, "fallback")))
+		    {
+                        found = 1;
+                        xsltApplySequenceConstructor(ctxt, contextNode,
+			    child->children, NULL);
+                    }
+                    child = child->next;
+                }
+
+                if (!found) {
+                    xsltTransformError(ctxt, NULL, cur,
+			"xsltApplySequenceConstructor: failed to find extension %s\n",
+			cur->name);
+                }
+            } else {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+                XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltApplySequenceConstructor: extension construct %s\n",
+                    cur->name));
+#endif
+
+                ctxt->insert = insert;
+		/*
+		* We need the fragment base for extension instructions
+		* which return values (like EXSLT's function).
+		*/
+		oldLocalFragmentBase = ctxt->localRVTBase;
+		ctxt->localRVTBase = NULL;
+
+                function(ctxt, contextNode, cur, cur->psvi);
+		/*
+		* Cleanup temporary tree fragments.
+		*/
+		if (oldLocalFragmentTop != ctxt->localRVT)
+		    xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
+
+		ctxt->localRVTBase = oldLocalFragmentBase;
+                ctxt->insert = oldInsert;
+
+            }
+	    ctxt->inst = oldCurInst;
+            goto skip_children;
+        } else if (cur->type == XML_ELEMENT_NODE) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+            XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltApplySequenceConstructor: copy node %s\n",
+                cur->name));
+#endif
+	    oldCurInst = ctxt->inst;
+	    ctxt->inst = cur;
+
+            if ((copy = xsltShallowCopyElem(ctxt, cur, insert, 1)) == NULL)
+		goto error;            
+            /*
+             * Add extra namespaces inherited from the current template
+             * if we are in the first level children and this is a
+	     * "real" template.	     
+             */
+            if ((templ != NULL) && (oldInsert == insert) &&
+                (ctxt->templ != NULL) && (ctxt->templ->inheritedNs != NULL)) {
+                int i;
+                xmlNsPtr ns, ret;
+
+                for (i = 0; i < ctxt->templ->inheritedNsNr; i++) {
+		    const xmlChar *URI = NULL;
+		    xsltStylesheetPtr style;
+                    ns = ctxt->templ->inheritedNs[i];		    
+		    
+		    /* Note that the XSLT namespace was already excluded
+		    * in xsltGetInheritedNsList().
+		    */
+#if 0
+		    if (xmlStrEqual(ns->href, XSLT_NAMESPACE))
+			continue;
+#endif
+		    style = ctxt->style;
+		    while (style != NULL) {
+			if (style->nsAliases != NULL)
+			    URI = (const xmlChar *) 
+				xmlHashLookup(style->nsAliases, ns->href);
+			if (URI != NULL)
+			    break;
+			
+			style = xsltNextImport(style);
+		    }
+		    if (URI == UNDEFINED_DEFAULT_NS)
+			continue;
+		    if (URI == NULL)
+			URI = ns->href;
+		    /*
+		    * TODO: The following will still be buggy for the
+		    * non-refactored code.
+		    */
+		    ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+		    if ((ret == NULL) || (!xmlStrEqual(ret->href, URI)))
+		    {
+			xmlNewNs(copy, URI, ns->prefix);
+		    }
+                }
+		if (copy->ns != NULL) {
+		    /*
+		     * Fix the node namespace if needed
+		     */
+		    copy->ns = xsltGetNamespace(ctxt, cur, copy->ns, copy);
+		}
+            }
+	    /*
+             * all the attributes are directly inherited
+             */
+            if (cur->properties != NULL) {
+                xsltAttrListTemplateProcess(ctxt, copy, cur->properties);
+            }
+	    ctxt->inst = oldCurInst;
+        }
+#endif /* else of XSLT_REFACTORED */
+
+        /*
+         * Descend into content in document order.
+         */
+        if (cur->children != NULL) {
+            if (cur->children->type != XML_ENTITY_DECL) {
+                cur = cur->children;
+		level++;
+                if (copy != NULL)
+                    insert = copy;
+                continue;
+            }
+        }
+
+skip_children:
+	/*
+	* If xslt:message was just processed, we might have hit a
+	* terminate='yes'; if so, then break the loop and clean up.
+	* TODO: Do we need to check this also before trying to descend
+	*  into the content?
+	*/
+	if (ctxt->state == XSLT_STATE_STOPPED)
+	    break;
+        if (cur->next != NULL) {
+            cur = cur->next;
+            continue;
+        }
+
+        do {
+            cur = cur->parent;
+	    level--;
+	    /*
+	    * Pop variables/params (xsl:variable and xsl:param).
+	    */
+	    if ((ctxt->varsNr > oldVarsNr) && (ctxt->vars->level > level)) {
+		xsltLocalVariablePop(ctxt, oldVarsNr, level);		
+	    }
+
+            insert = insert->parent;
+            if (cur == NULL)
+                break;
+            if (cur == list->parent) {
+                cur = NULL;
+                break;
+            }
+            if (cur->next != NULL) {
+                cur = cur->next;
+                break;
+            }
+        } while (cur != NULL);
+    }
+
+error:
+    /*
+    * In case of errors: pop remaining variables.
+    */
+    if (ctxt->varsNr > oldVarsNr)
+	xsltLocalVariablePop(ctxt, oldVarsNr, -1);     
+
+    ctxt->node = oldContextNode;
+    ctxt->inst = oldInst;
+    ctxt->insert = oldInsert;
+    
+#ifdef WITH_DEBUGGER
+    if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) {
+        xslDropCall();
+    }
+#endif
+}
+
+/*
+* xsltApplyXSLTTemplate:
+* @ctxt:  a XSLT transformation context
+* @contextNode:  the node in the source tree.
+* @list:  the nodes of a sequence constructor;
+*         (plus leading xsl:param elements)
+* @templ: the compiled xsl:template declaration;
+*         NULL if a sequence constructor
+* @withParams:  a set of caller-parameters (xsl:with-param) or NULL
+*
+* Called by:
+* - xsltApplyImports()
+* - xsltCallTemplate()
+* - xsltDefaultProcessOneNode()
+* - xsltProcessOneNode()
+*/
+static void
+xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
+		      xmlNodePtr contextNode,
+		      xmlNodePtr list,
+		      xsltTemplatePtr templ,
+		      xsltStackElemPtr withParams)
+{
+    int oldVarsBase = 0;
+    long start = 0;
+    xmlNodePtr cur;
+    xsltStackElemPtr tmpParam = NULL;
+    xmlDocPtr oldUserFragmentTop, oldLocalFragmentTop;
+
+#ifdef XSLT_REFACTORED
+    xsltStyleItemParamPtr iparam;
+#else
+    xsltStylePreCompPtr iparam;
+#endif
+
+#ifdef WITH_DEBUGGER
+    int addCallResult = 0;
+#endif 
+
+    if (ctxt == NULL)
+	return;    
+    if (templ == NULL) {
+	xsltTransformError(ctxt, NULL, list,
+	    "xsltApplyXSLTTemplate: Bad arguments; @templ is mandatory.\n");
+	return;
+    }
+
+#ifdef WITH_DEBUGGER
+    if (ctxt->debugStatus != XSLT_DEBUG_NONE) {
+	if (xsltDebuggerStartSequenceConstructor(ctxt, contextNode,
+		list, templ, &addCallResult) == NULL)
+	    return;
+    }
+#endif
+
+    if (list == NULL)
+        return;
+    CHECK_STOPPED;
+
+    /*
+    * Check for infinite recursion: stop if the maximum of nested templates
+    * is excceeded. Adjust xsltMaxDepth if you need more.
+    */
+    if (((ctxt->templNr >= xsltMaxDepth) ||
+        (ctxt->varsNr >= 5 * xsltMaxDepth)))
+    {
+        xsltTransformError(ctxt, NULL, list,
+	    "xsltApplyXSLTTemplate: A potential infinite template recursion "
+	    "was detected.\n"
+	    "You can adjust xsltMaxDepth (--maxdepth) in order to "
+	    "raise the maximum number of nested template calls and "
+	    "variables/params (currently set to %d).\n",
+	    xsltMaxDepth);
+        xsltDebug(ctxt, contextNode, list, NULL);
+        return;
+    }
+    
+    oldUserFragmentTop = ctxt->tmpRVT;
+    ctxt->tmpRVT = NULL;
+    oldLocalFragmentTop = ctxt->localRVT;
+       
+    /*
+    * Initiate a distinct scope of local params/variables.
+    */
+    oldVarsBase = ctxt->varsBase;
+    ctxt->varsBase = ctxt->varsNr;
+    
+    ctxt->node = contextNode;
+    if (ctxt->profile) {
+	templ->nbCalls++;
+	start = xsltTimestamp();
+	profPush(ctxt, 0);
+    }
+    /*
+    * Push the xsl:template declaration onto the stack.
+    */
+    templPush(ctxt, templ);
+    
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (templ->name != NULL)
+	XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+	"applying xsl:template '%s'\n", templ->name));
+#endif
+    /*
+    * Process xsl:param instructions and skip those elements for
+    * further processing.
+    */
+    cur = list;
+    do {
+	if (cur->type == XML_TEXT_NODE) {
+	    cur = cur->next;
+	    continue;
+	}
+	if ((cur->type != XML_ELEMENT_NODE) ||
+	    (cur->name[0] != 'p') ||
+	    (cur->psvi == NULL) ||
+	    (! xmlStrEqual(cur->name, BAD_CAST "param")) ||
+	    (! IS_XSLT_ELEM(cur)))
+	{
+	    break;
+	}
+
+	list = cur->next;
+
+#ifdef XSLT_REFACTORED
+	iparam = (xsltStyleItemParamPtr) cur->psvi;
+#else
+	iparam = (xsltStylePreCompPtr) cur->psvi;
+#endif
+	
+	/*
+	* Substitute xsl:param for a given xsl:with-param.
+	* Since the XPath expression will reference the params/vars
+	* by index, we need to slot the xsl:with-params in the
+	* order of encountered xsl:params to keep the sequence of
+	* params/variables in the stack exactly as it was at
+	* compile time,
+	*/
+	tmpParam = NULL;
+	if (withParams) {
+	    tmpParam = withParams;
+	    do {
+		if ((tmpParam->name == (iparam->name)) &&
+		    (tmpParam->nameURI == (iparam->ns)))
+		{
+		    /*
+		    * Push the caller-parameter.
+		    */		    
+		    xsltLocalVariablePush(ctxt, tmpParam, -1);
+		    break;
+		}
+		tmpParam = tmpParam->next;
+	    } while (tmpParam != NULL);
+	}
+	/*
+	* Push the xsl:param.
+	*/
+	if (tmpParam == NULL) {
+	    /*
+	    * Note that we must assume that the added parameter
+	    * has a @depth of 0.
+	    */
+	    xsltParseStylesheetParam(ctxt, cur);
+	}
+	cur = cur->next;
+    } while (cur != NULL);    
+    /*
+    * Process the sequence constructor.
+    */
+    xsltApplySequenceConstructor(ctxt, contextNode, list, templ);
+    
+    /*
+    * Remove remaining xsl:param and xsl:with-param items from
+    * the stack. Don't free xsl:with-param items.
+    */
+    if (ctxt->varsNr > ctxt->varsBase)
+	xsltTemplateParamsCleanup(ctxt);    
+    ctxt->varsBase = oldVarsBase;
+    
+    /*
+    * Clean up remaining local tree fragments.
+    * This also frees fragments which are the result of
+    * extension instructions. Should normally not be hit; but
+    * just for the case xsltExtensionInstructionResultFinalize()
+    * was not called by the extension author.
+    */
+    if (oldLocalFragmentTop != ctxt->localRVT) {
+	xmlDocPtr curdoc = ctxt->localRVT, tmp;
+
+	do {
+	    tmp = curdoc;
+	    curdoc = (xmlDocPtr) curdoc->next;
+	    /* Need to housekeep localRVTBase */
+	    if (tmp == ctxt->localRVTBase)
+	        ctxt->localRVTBase = curdoc;
+	    if (tmp->prev)
+		tmp->prev->next = (xmlNodePtr) curdoc;
+	    if (curdoc)
+		curdoc->prev = tmp->prev;
+	    xsltReleaseRVT(ctxt, tmp);
+	} while (curdoc != oldLocalFragmentTop);
+    }
+    ctxt->localRVT = oldLocalFragmentTop;
+
+    /*
+    * Release user-created fragments stored in the scope
+    * of xsl:template. Note that this mechanism is deprecated:
+    * user code should now use xsltRegisterLocalRVT() instead
+    * of the obsolete xsltRegisterTmpRVT().    
+    */
+    if (ctxt->tmpRVT) {
+	xmlDocPtr curdoc = ctxt->tmpRVT, tmp;
+
+	while (curdoc != NULL) {
+	    tmp = curdoc;
+	    curdoc = (xmlDocPtr) curdoc->next;
+	    xsltReleaseRVT(ctxt, tmp);
+	}	
+    }
+    ctxt->tmpRVT = oldUserFragmentTop;    
+    
+    /*
+    * Pop the xsl:template declaration from the stack.
+    */
+    templPop(ctxt);    
+    if (ctxt->profile) {
+	long spent, child, total, end;
+	
+	end = xsltTimestamp();
+	child = profPop(ctxt);
+	total = end - start;
+	spent = total - child;
+	if (spent <= 0) {
+	    /*
+	    * Not possible unless the original calibration failed
+	    * we can try to correct it on the fly.
+	    */
+	    xsltCalibrateAdjust(spent);
+	    spent = 0;
+	}
+	
+	templ->time += spent;
+	if (ctxt->profNr > 0)
+	    ctxt->profTab[ctxt->profNr - 1] += total;
+    }
+    
+#ifdef WITH_DEBUGGER
+    if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) {
+        xslDropCall();
+    }
+#endif
+}
+
+
+/**
+ * xsltApplyOneTemplate:
+ * @ctxt:  a XSLT process context
+ * @contextNode:  the node in the source tree.
+ * @list:  the nodes of a sequence constructor
+ * @templ: not used
+ * @params:  a set of parameters (xsl:param) or NULL
+ *
+ * Processes a sequence constructor on the current node in the source tree.
+ *
+ * @params are the already computed variable stack items; this function
+ * pushes them on the variable stack, and pops them before exiting; it's
+ * left to the caller to free or reuse @params afterwards. The initial
+ * states of the variable stack will always be restored before this
+ * function exits.
+ * NOTE that this does *not* initiate a new distinct variable scope; i.e.
+ * variables already on the stack are visible to the process. The caller's
+ * side needs to start a new variable scope if needed (e.g. in exsl:function).
+ *
+ * @templ is obsolete and not used anymore (e.g.  does not
+ * provide a @templ); a non-NULL @templ might raise an error in the future.
+ *
+ * BIG NOTE: This function is not intended to process the content of an
+ * xsl:template; it does not expect xsl:param instructions in @list and
+ * will report errors if found.
+ *
+ * Called by:
+ *  - xsltEvalVariable() (variables.c)
+ *  - exsltFuncFunctionFunction() (libexsl/functions.c)
+ */
+void
+xsltApplyOneTemplate(xsltTransformContextPtr ctxt,
+		     xmlNodePtr contextNode,
+                     xmlNodePtr list,
+		     xsltTemplatePtr templ ATTRIBUTE_UNUSED,
+                     xsltStackElemPtr params)
+{
+    if ((ctxt == NULL) || (list == NULL))
+	return;
+    CHECK_STOPPED;
+
+    if (params) {
+	/*
+	 * This code should be obsolete - was previously used
+	 * by libexslt/functions.c, but due to bug 381319 the
+	 * logic there was changed.
+	 */
+	int oldVarsNr = ctxt->varsNr;
+
+	/*
+	* Push the given xsl:param(s) onto the variable stack.
+	*/
+	while (params != NULL) {
+	    xsltLocalVariablePush(ctxt, params, -1);
+	    params = params->next;
+	}
+	xsltApplySequenceConstructor(ctxt, contextNode, list, templ);
+	/*
+	* Pop the given xsl:param(s) from the stack but don't free them.
+	*/
+	xsltLocalVariablePop(ctxt, oldVarsNr, -2);
+    } else
+	xsltApplySequenceConstructor(ctxt, contextNode, list, templ);    
+}
+
+/************************************************************************
+ *									*
+ *		    XSLT-1.1 extensions					*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltDocumentElem:
+ * @ctxt:  an XSLT processing context
+ * @node:  The current node
+ * @inst:  the instruction in the stylesheet
+ * @castedComp:  precomputed information
+ *
+ * Process an EXSLT/XSLT-1.1 document element
+ */
+void
+xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
+                 xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemDocumentPtr comp = (xsltStyleItemDocumentPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xsltStylesheetPtr style = NULL;
+    int ret;
+    xmlChar *filename = NULL, *prop, *elements;
+    xmlChar *element, *end;
+    xmlDocPtr res = NULL;
+    xmlDocPtr oldOutput;
+    xmlNodePtr oldInsert, root;
+    const char *oldOutputFile;
+    xsltOutputType oldType;
+    xmlChar *URL = NULL;
+    const xmlChar *method;
+    const xmlChar *doctypePublic;
+    const xmlChar *doctypeSystem;
+    const xmlChar *version;
+
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
+        return;
+
+    if (comp->filename == NULL) {
+
+        if (xmlStrEqual(inst->name, (const xmlChar *) "output")) {
+	    /*
+	    * The element "output" is in the namespace XSLT_SAXON_NAMESPACE
+	    *   (http://icl.com/saxon)
+	    * The @file is in no namespace.
+	    */
+#ifdef WITH_XSLT_DEBUG_EXTRA
+            xsltGenericDebug(xsltGenericDebugContext,
+                             "Found saxon:output extension\n");
+#endif
+            URL = xsltEvalAttrValueTemplate(ctxt, inst,
+                                                 (const xmlChar *) "file",
+                                                 XSLT_SAXON_NAMESPACE);
+	     
+	    if (URL == NULL)
+		URL = xsltEvalAttrValueTemplate(ctxt, inst,
+                                                 (const xmlChar *) "href",
+                                                 XSLT_SAXON_NAMESPACE);
+        } else if (xmlStrEqual(inst->name, (const xmlChar *) "write")) {
+#ifdef WITH_XSLT_DEBUG_EXTRA
+            xsltGenericDebug(xsltGenericDebugContext,
+                             "Found xalan:write extension\n");
+#endif
+            URL = xsltEvalAttrValueTemplate(ctxt, inst,
+                                                 (const xmlChar *)
+                                                 "select",
+                                                 XSLT_XALAN_NAMESPACE);
+	    if (URL != NULL) {
+		xmlXPathCompExprPtr cmp;
+		xmlChar *val;
+
+		/*
+		 * Trying to handle bug #59212
+		 * The value of the "select" attribute is an
+		 * XPath expression.
+		 * (see http://xml.apache.org/xalan-j/extensionslib.html#redirect) 
+		 */
+		cmp = xmlXPathCompile(URL);
+                val = xsltEvalXPathString(ctxt, cmp);
+		xmlXPathFreeCompExpr(cmp);
+		xmlFree(URL);
+		URL = val;
+	    }
+	    if (URL == NULL)
+		URL = xsltEvalAttrValueTemplate(ctxt, inst,
+						     (const xmlChar *)
+						     "file",
+						     XSLT_XALAN_NAMESPACE);
+	    if (URL == NULL)
+		URL = xsltEvalAttrValueTemplate(ctxt, inst,
+						     (const xmlChar *)
+						     "href",
+						     XSLT_XALAN_NAMESPACE);
+        } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) {
+            URL = xsltEvalAttrValueTemplate(ctxt, inst,
+                                                 (const xmlChar *) "href",
+                                                 NULL);
+        }
+
+    } else {
+        URL = xmlStrdup(comp->filename);
+    }
+
+    if (URL == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+		         "xsltDocumentElem: href/URI-Reference not found\n");
+	return;
+    }
+
+    /*
+     * If the computation failed, it's likely that the URL wasn't escaped
+     */
+    filename = xmlBuildURI(URL, (const xmlChar *) ctxt->outputFile);
+    if (filename == NULL) {
+	xmlChar *escURL;
+
+	escURL=xmlURIEscapeStr(URL, BAD_CAST ":/.?,");
+	if (escURL != NULL) {
+	    filename = xmlBuildURI(escURL, (const xmlChar *) ctxt->outputFile);
+	    xmlFree(escURL);
+	}
+    }
+
+    if (filename == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+		         "xsltDocumentElem: URL computation failed for %s\n",
+			 URL);
+	xmlFree(URL);
+	return;
+    }
+
+    /*
+     * Security checking: can we write to this resource
+     */
+    if (ctxt->sec != NULL) {
+	ret = xsltCheckWrite(ctxt->sec, ctxt, filename);
+	if (ret == 0) {
+	    xsltTransformError(ctxt, NULL, inst,
+		 "xsltDocumentElem: write rights for %s denied\n",
+			     filename);
+	    xmlFree(URL);
+	    xmlFree(filename);
+	    return;
+	}
+    }
+
+    oldOutputFile = ctxt->outputFile;
+    oldOutput = ctxt->output;
+    oldInsert = ctxt->insert;
+    oldType = ctxt->type;
+    ctxt->outputFile = (const char *) filename;
+
+    style = xsltNewStylesheet();
+    if (style == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+                         "xsltDocumentElem: out of memory\n");
+        goto error;
+    }
+
+    /*
+     * Version described in 1.1 draft allows full parameterization
+     * of the output.
+     */
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *) "version",
+				     NULL);
+    if (prop != NULL) {
+	if (style->version != NULL)
+	    xmlFree(style->version);
+	style->version = prop;
+    }
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *) "encoding",
+				     NULL);
+    if (prop != NULL) {
+	if (style->encoding != NULL)
+	    xmlFree(style->encoding);
+	style->encoding = prop;
+    }
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *) "method",
+				     NULL);
+    if (prop != NULL) {
+	const xmlChar *URI;
+
+	if (style->method != NULL)
+	    xmlFree(style->method);
+	style->method = NULL;
+	if (style->methodURI != NULL)
+	    xmlFree(style->methodURI);
+	style->methodURI = NULL;
+
+	URI = xsltGetQNameURI(inst, &prop);
+	if (prop == NULL) {
+	    if (style != NULL) style->errors++;
+	} else if (URI == NULL) {
+	    if ((xmlStrEqual(prop, (const xmlChar *) "xml")) ||
+		(xmlStrEqual(prop, (const xmlChar *) "html")) ||
+		(xmlStrEqual(prop, (const xmlChar *) "text"))) {
+		style->method = prop;
+	    } else {
+		xsltTransformError(ctxt, NULL, inst,
+				 "invalid value for method: %s\n", prop);
+		if (style != NULL) style->warnings++;
+	    }
+	} else {
+	    style->method = prop;
+	    style->methodURI = xmlStrdup(URI);
+	}
+    }
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *)
+				     "doctype-system", NULL);
+    if (prop != NULL) {
+	if (style->doctypeSystem != NULL)
+	    xmlFree(style->doctypeSystem);
+	style->doctypeSystem = prop;
+    }
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *)
+				     "doctype-public", NULL);
+    if (prop != NULL) {
+	if (style->doctypePublic != NULL)
+	    xmlFree(style->doctypePublic);
+	style->doctypePublic = prop;
+    }
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *) "standalone",
+				     NULL);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+	    style->standalone = 1;
+	} else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+	    style->standalone = 0;
+	} else {
+	    xsltTransformError(ctxt, NULL, inst,
+			     "invalid value for standalone: %s\n",
+			     prop);
+	    if (style != NULL) style->warnings++;
+	}
+	xmlFree(prop);
+    }
+
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *) "indent",
+				     NULL);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+	    style->indent = 1;
+	} else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+	    style->indent = 0;
+	} else {
+	    xsltTransformError(ctxt, NULL, inst,
+			     "invalid value for indent: %s\n", prop);
+	    if (style != NULL) style->warnings++;
+	}
+	xmlFree(prop);
+    }
+
+    prop = xsltEvalAttrValueTemplate(ctxt, inst,
+				     (const xmlChar *)
+				     "omit-xml-declaration",
+				     NULL);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+	    style->omitXmlDeclaration = 1;
+	} else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+	    style->omitXmlDeclaration = 0;
+	} else {
+	    xsltTransformError(ctxt, NULL, inst,
+			     "invalid value for omit-xml-declaration: %s\n",
+			     prop);
+	    if (style != NULL) style->warnings++;
+	}
+	xmlFree(prop);
+    }
+
+    elements = xsltEvalAttrValueTemplate(ctxt, inst,
+					 (const xmlChar *)
+					 "cdata-section-elements",
+					 NULL);
+    if (elements != NULL) {
+	if (style->stripSpaces == NULL)
+	    style->stripSpaces = xmlHashCreate(10);
+	if (style->stripSpaces == NULL)
+	    return;
+
+	element = elements;
+	while (*element != 0) {
+	    while (IS_BLANK_CH(*element))
+		element++;
+	    if (*element == 0)
+		break;
+	    end = element;
+	    while ((*end != 0) && (!IS_BLANK_CH(*end)))
+		end++;
+	    element = xmlStrndup(element, end - element);
+	    if (element) {
+		const xmlChar *URI;
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+				 "add cdata section output element %s\n",
+				 element);
+#endif
+                URI = xsltGetQNameURI(inst, &element);
+
+		xmlHashAddEntry2(style->stripSpaces, element, URI,
+			        (xmlChar *) "cdata");
+		xmlFree(element);
+	    }
+	    element = end;
+	}
+	xmlFree(elements);
+    }
+
+    /*
+     * Create a new document tree and process the element template
+     */
+    XSLT_GET_IMPORT_PTR(method, style, method)
+    XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
+    XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
+    XSLT_GET_IMPORT_PTR(version, style, version)
+
+    if ((method != NULL) &&
+	(!xmlStrEqual(method, (const xmlChar *) "xml"))) {
+	if (xmlStrEqual(method, (const xmlChar *) "html")) {
+	    ctxt->type = XSLT_OUTPUT_HTML;
+	    if (((doctypePublic != NULL) || (doctypeSystem != NULL)))
+		res = htmlNewDoc(doctypeSystem, doctypePublic);
+	    else {
+		if (version != NULL) {
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+		    xsltGetHTMLIDs(version, &doctypePublic, &doctypeSystem);
+#endif
+                }
+		res = htmlNewDocNoDtD(doctypeSystem, doctypePublic);
+	    }
+	    if (res == NULL)
+		goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+	} else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
+	    xsltTransformError(ctxt, NULL, inst,
+	     "xsltDocumentElem: unsupported method xhtml\n",
+		             style->method);
+	    ctxt->type = XSLT_OUTPUT_HTML;
+	    res = htmlNewDocNoDtD(doctypeSystem, doctypePublic);
+	    if (res == NULL)
+		goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+	} else if (xmlStrEqual(method, (const xmlChar *) "text")) {
+	    ctxt->type = XSLT_OUTPUT_TEXT;
+	    res = xmlNewDoc(style->version);
+	    if (res == NULL)
+		goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+#ifdef WITH_XSLT_DEBUG
+	    xsltGenericDebug(xsltGenericDebugContext,
+                     "reusing transformation dict for output\n");
+#endif
+	} else {
+	    xsltTransformError(ctxt, NULL, inst,
+			     "xsltDocumentElem: unsupported method %s\n",
+		             style->method);
+	    goto error;
+	}
+    } else {
+	ctxt->type = XSLT_OUTPUT_XML;
+	res = xmlNewDoc(style->version);
+	if (res == NULL)
+	    goto error;
+	res->dict = ctxt->dict;
+	xmlDictReference(res->dict);
+#ifdef WITH_XSLT_DEBUG
+	xsltGenericDebug(xsltGenericDebugContext,
+                     "reusing transformation dict for output\n");
+#endif
+    }
+    res->charset = XML_CHAR_ENCODING_UTF8;
+    if (style->encoding != NULL)
+	res->encoding = xmlStrdup(style->encoding);
+    ctxt->output = res;
+    ctxt->insert = (xmlNodePtr) res;
+    xsltApplySequenceConstructor(ctxt, node, inst->children, NULL);
+
+    /*
+     * Do some post processing work depending on the generated output
+     */
+    root = xmlDocGetRootElement(res);
+    if (root != NULL) {
+        const xmlChar *doctype = NULL;
+
+        if ((root->ns != NULL) && (root->ns->prefix != NULL))
+	    doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name);
+	if (doctype == NULL)
+	    doctype = root->name;
+
+        /*
+         * Apply the default selection of the method
+         */
+        if ((method == NULL) &&
+            (root->ns == NULL) &&
+            (!xmlStrcasecmp(root->name, (const xmlChar *) "html"))) {
+            xmlNodePtr tmp;
+
+            tmp = res->children;
+            while ((tmp != NULL) && (tmp != root)) {
+                if (tmp->type == XML_ELEMENT_NODE)
+                    break;
+                if ((tmp->type == XML_TEXT_NODE) && (!xmlIsBlankNode(tmp)))
+                    break;
+		tmp = tmp->next;
+            }
+            if (tmp == root) {
+                ctxt->type = XSLT_OUTPUT_HTML;
+                res->type = XML_HTML_DOCUMENT_NODE;
+                if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+                    res->intSubset = xmlCreateIntSubset(res, doctype,
+                                                        doctypePublic,
+                                                        doctypeSystem);
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+		} else if (version != NULL) {
+                    xsltGetHTMLIDs(version, &doctypePublic,
+                                   &doctypeSystem);
+                    if (((doctypePublic != NULL) || (doctypeSystem != NULL)))
+                        res->intSubset =
+                            xmlCreateIntSubset(res, doctype,
+                                               doctypePublic,
+                                               doctypeSystem);
+#endif
+                }
+            }
+
+        }
+        if (ctxt->type == XSLT_OUTPUT_XML) {
+            XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
+                XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
+                if (((doctypePublic != NULL) || (doctypeSystem != NULL)))
+                res->intSubset = xmlCreateIntSubset(res, doctype,
+                                                    doctypePublic,
+                                                    doctypeSystem);
+        }
+    }
+
+    /*
+     * Save the result
+     */
+    ret = xsltSaveResultToFilename((const char *) filename,
+                                   res, style, 0);
+    if (ret < 0) {
+	xsltTransformError(ctxt, NULL, inst,
+                         "xsltDocumentElem: unable to save to %s\n",
+                         filename);
+	ctxt->state = XSLT_STATE_ERROR;
+#ifdef WITH_XSLT_DEBUG_EXTRA
+    } else {
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "Wrote %d bytes to %s\n", ret, filename);
+#endif
+    }
+
+  error:
+    ctxt->output = oldOutput;
+    ctxt->insert = oldInsert;
+    ctxt->type = oldType;
+    ctxt->outputFile = oldOutputFile;
+    if (URL != NULL)
+        xmlFree(URL);
+    if (filename != NULL)
+        xmlFree(filename);
+    if (style != NULL)
+        xsltFreeStylesheet(style);
+    if (res != NULL)
+        xmlFreeDoc(res);
+}
+
+/************************************************************************
+ *									*
+ *		Most of the XSLT-1.0 transformations			*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltSort:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt sort node
+ * @comp:  precomputed information
+ *
+ * function attached to xsl:sort nodes, but this should not be
+ * called directly
+ */
+void
+xsltSort(xsltTransformContextPtr ctxt,
+	xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst,
+	xsltStylePreCompPtr comp) {
+    if (comp == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:sort : compilation failed\n");
+	return;
+    }
+    xsltTransformError(ctxt, NULL, inst,
+	 "xsl:sort : improper use this should not be reached\n");
+}
+
+/**
+ * xsltCopy:
+ * @ctxt:  an XSLT process context
+ * @node:  the node in the source tree
+ * @inst:  the element node of the XSLT-copy instruction
+ * @castedComp:  computed information of the XSLT-copy instruction
+ *
+ * Execute the XSLT-copy instruction on the source node.
+ */
+void
+xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	 xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCopyPtr comp = (xsltStyleItemCopyPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xmlNodePtr copy, oldInsert;
+   
+    oldInsert = ctxt->insert;
+    if (ctxt->insert != NULL) {
+	switch (node->type) {
+	    case XML_TEXT_NODE:
+	    case XML_CDATA_SECTION_NODE:
+		/*
+		 * This text comes from the stylesheet
+		 * For stylesheets, the set of whitespace-preserving
+		 * element names consists of just xsl:text.
+		 */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		if (node->type == XML_CDATA_SECTION_NODE) {
+		    XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltCopy: CDATA text %s\n", node->content));
+		} else {
+		    XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+			 "xsltCopy: text %s\n", node->content));
+                }
+#endif
+		xsltCopyText(ctxt, ctxt->insert, node, 0);
+		break;
+	    case XML_DOCUMENT_NODE:
+	    case XML_HTML_DOCUMENT_NODE:
+		break;
+	    case XML_ELEMENT_NODE:
+		/*
+		* REVISIT NOTE: The "fake" is a doc-node, not an element node.
+		* REMOVED:
+		*   if (xmlStrEqual(node->name, BAD_CAST " fake node libxslt"))
+		*    return;
+		*/		
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+				 "xsltCopy: node %s\n", node->name));
+#endif
+		copy = xsltShallowCopyElem(ctxt, node, ctxt->insert, 0);
+		ctxt->insert = copy;
+		if (comp->use != NULL) {
+		    xsltApplyAttributeSet(ctxt, node, inst, comp->use);
+		}
+		break;
+	    case XML_ATTRIBUTE_NODE: {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+				 "xsltCopy: attribute %s\n", node->name));
+#endif
+		/*
+		* REVISIT: We could also raise an error if the parent is not
+		* an element node.
+		* OPTIMIZE TODO: Can we set the value/children of the
+		* attribute without an intermediate copy of the string value?
+		*/
+		xsltShallowCopyAttr(ctxt, inst, ctxt->insert, (xmlAttrPtr) node);		
+		break;
+	    }
+	    case XML_PI_NODE:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+				 "xsltCopy: PI %s\n", node->name));
+#endif
+		copy = xmlNewDocPI(ctxt->insert->doc, node->name,
+		                   node->content);
+		xmlAddChild(ctxt->insert, copy);
+		break;
+	    case XML_COMMENT_NODE:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+				 "xsltCopy: comment\n"));
+#endif
+		copy = xmlNewComment(node->content);
+		xmlAddChild(ctxt->insert, copy);
+		break;
+	    case XML_NAMESPACE_DECL:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext,
+				 "xsltCopy: namespace declaration\n"));
+#endif		
+		xsltShallowCopyNsNode(ctxt, inst, ctxt->insert, (xmlNsPtr)node);		     
+		break;
+	    default:
+		break;
+
+	}
+    }
+
+    switch (node->type) {
+	case XML_DOCUMENT_NODE:
+	case XML_HTML_DOCUMENT_NODE:
+	case XML_ELEMENT_NODE:
+	    xsltApplySequenceConstructor(ctxt, ctxt->node, inst->children,
+		NULL);
+	    break;
+	default:
+	    break;
+    }
+    ctxt->insert = oldInsert;
+}
+
+/**
+ * xsltText:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt text node
+ * @comp:  precomputed information
+ *
+ * Process the xslt text node on the source node
+ */
+void
+xsltText(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED,
+	    xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) {
+    if ((inst->children != NULL) && (comp != NULL)) {
+	xmlNodePtr text = inst->children;
+	xmlNodePtr copy;
+
+	while (text != NULL) {
+	    if ((text->type != XML_TEXT_NODE) &&
+	         (text->type != XML_CDATA_SECTION_NODE)) {
+		xsltTransformError(ctxt, NULL, inst,
+				 "xsl:text content problem\n");
+		break;
+	    }
+	    copy = xmlNewDocText(ctxt->output, text->content);
+	    if (text->type != XML_CDATA_SECTION_NODE) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+		     "Disable escaping: %s\n", text->content);
+#endif
+		copy->name = xmlStringTextNoenc;
+	    }
+	    xmlAddChild(ctxt->insert, copy);
+	    text = text->next;
+	}
+    }
+}
+
+/**
+ * xsltElement:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt element node
+ * @castedComp:  precomputed information
+ *
+ * Process the xslt element node on the source node
+ */
+void
+xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	    xmlNodePtr inst, xsltStylePreCompPtr castedComp) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemElementPtr comp = (xsltStyleItemElementPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xmlChar *prop = NULL;
+    const xmlChar *name, *prefix = NULL, *nsName = NULL;    
+    xmlNodePtr copy;
+    xmlNodePtr oldInsert;
+
+    if (ctxt->insert == NULL)
+	return;
+
+    /* 
+    * A comp->has_name == 0 indicates that we need to skip this instruction,
+    * since it was evaluated to be invalid already during compilation.
+    */
+    if (!comp->has_name)
+        return;
+
+    /*
+     * stack and saves
+     */
+    oldInsert = ctxt->insert;
+
+    if (comp->name == NULL) {
+	/* TODO: fix attr acquisition wrt to the XSLT namespace */
+        prop = xsltEvalAttrValueTemplate(ctxt, inst,
+	    (const xmlChar *) "name", XSLT_NAMESPACE);
+        if (prop == NULL) {
+            xsltTransformError(ctxt, NULL, inst,
+		"xsl:element: The attribute 'name' is missing.\n");
+            goto error;
+        }
+	if (xmlValidateQName(prop, 0)) {
+	    xsltTransformError(ctxt, NULL, inst,
+		"xsl:element: The effective name '%s' is not a "
+		"valid QName.\n", prop);
+	    /* we fall through to catch any further errors, if possible */
+	}
+	name = xsltSplitQName(ctxt->dict, prop, &prefix);
+	xmlFree(prop);
+	if ((prefix != NULL) &&
+	    (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)))
+	{
+	    /*
+	    * TODO: Should we really disallow an "xml" prefix?
+	    */
+	    goto error;
+	}
+    } else {
+	/*
+	* The "name" value was static.
+	*/
+#ifdef XSLT_REFACTORED
+	prefix = comp->nsPrefix;
+	name = comp->name;
+#else	
+	name = xsltSplitQName(ctxt->dict, comp->name, &prefix);
+#endif
+    }
+    
+    /*
+     * Create the new element
+     */
+    if (ctxt->output->dict == ctxt->dict) {
+	copy = xmlNewDocNodeEatName(ctxt->output, NULL, (xmlChar *)name, NULL);
+    } else {
+	copy = xmlNewDocNode(ctxt->output, NULL, (xmlChar *)name, NULL);
+    }
+    if (copy == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "xsl:element : creation of %s failed\n", name);
+	return;
+    }
+    xmlAddChild(ctxt->insert, copy);    
+
+    /*
+    * Namespace
+    * ---------
+    */
+    if (comp->has_ns) {	 
+	if (comp->ns != NULL) {
+	    /*
+	    * No AVT; just plain text for the namespace name.
+	    */
+	    if (comp->ns[0] != 0)
+		nsName = comp->ns;
+	} else {
+	    xmlChar *tmpNsName;
+	    /*
+	    * Eval the AVT.
+	    */
+	    /* TODO: check attr acquisition wrt to the XSLT namespace */
+	    tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst,
+		(const xmlChar *) "namespace", XSLT_NAMESPACE);	
+	    /*
+	    * SPEC XSLT 1.0:
+	    *  "If the string is empty, then the expanded-name of the
+	    *  attribute has a null namespace URI."
+	    */
+	    if ((tmpNsName != NULL) && (tmpNsName[0] != 0))
+		nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1);
+	    xmlFree(tmpNsName);		
+	};	    
+    } else {
+	xmlNsPtr ns;
+	/*
+	* SPEC XSLT 1.0:
+	*  "If the namespace attribute is not present, then the QName is
+	*  expanded into an expanded-name using the namespace declarations
+	*  in effect for the xsl:element element, including any default
+	*  namespace declaration.
+	*/	
+	ns = xmlSearchNs(inst->doc, inst, prefix);
+	if (ns == NULL) {
+	    /*
+	    * TODO: Check this in the compilation layer in case it's a
+	    * static value.
+	    */
+	    if (prefix != NULL) {
+		xsltTransformError(ctxt, NULL, inst,
+		    "xsl:element: The QName '%s:%s' has no "
+		    "namespace binding in scope in the stylesheet; "
+		    "this is an error, since the namespace was not "
+		    "specified by the instruction itself.\n", prefix, name);
+	    }
+	} else
+	    nsName = ns->href;	
+    }
+    /*
+    * Find/create a matching ns-decl in the result tree.
+    */
+    if (nsName != NULL) {
+	copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, copy);
+    } else if ((copy->parent != NULL) &&
+	(copy->parent->type == XML_ELEMENT_NODE) &&
+	(copy->parent->ns != NULL))
+    {
+	/*
+	* "Undeclare" the default namespace.
+	*/
+	xsltGetSpecialNamespace(ctxt, inst, NULL, NULL, copy);
+    }
+
+    ctxt->insert = copy;
+
+    if (comp->has_use) {
+	if (comp->use != NULL) {
+	    xsltApplyAttributeSet(ctxt, node, inst, comp->use);
+	} else {
+	    xmlChar *attrSets = NULL;
+	    /*
+	    * BUG TODO: use-attribute-sets is not a value template.
+	    *  use-attribute-sets = qnames
+	    */
+	    attrSets = xsltEvalAttrValueTemplate(ctxt, inst,
+		(const xmlChar *)"use-attribute-sets", NULL);
+	    if (attrSets != NULL) {
+		xsltApplyAttributeSet(ctxt, node, inst, attrSets);
+		xmlFree(attrSets);
+	    }
+	}
+    }
+    /*
+    * Instantiate the sequence constructor.
+    */
+    if (inst->children != NULL)
+	xsltApplySequenceConstructor(ctxt, ctxt->node, inst->children,
+	    NULL);
+
+error:
+    ctxt->insert = oldInsert;
+    return;    
+}
+
+
+/**
+ * xsltComment:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt comment node
+ * @comp:  precomputed information
+ *
+ * Process the xslt comment node on the source node
+ */
+void
+xsltComment(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) {
+    xmlChar *value = NULL;
+    xmlNodePtr commentNode;
+    int len;
+    
+    value = xsltEvalTemplateString(ctxt, node, inst);
+    /* TODO: use or generate the compiled form */
+    len = xmlStrlen(value);
+    if (len > 0) {
+        if ((value[len-1] == '-') || 
+	    (xmlStrstr(value, BAD_CAST "--"))) {
+	    xsltTransformError(ctxt, NULL, inst,
+	    	    "xsl:comment : '--' or ending '-' not allowed in comment\n");
+	    /* fall through to try to catch further errors */
+	}
+    }
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (value == NULL) {
+	XSLT_TRACE(ctxt,XSLT_TRACE_COMMENT,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltComment: empty\n"));
+    } else {
+	XSLT_TRACE(ctxt,XSLT_TRACE_COMMENT,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltComment: content %s\n", value));
+    }
+#endif
+
+    commentNode = xmlNewComment(value);
+    xmlAddChild(ctxt->insert, commentNode);
+
+    if (value != NULL)
+	xmlFree(value);
+}
+
+/**
+ * xsltProcessingInstruction:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt processing-instruction node
+ * @castedComp:  precomputed information
+ *
+ * Process the xslt processing-instruction node on the source node
+ */
+void
+xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemPIPtr comp = (xsltStyleItemPIPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    const xmlChar *name;
+    xmlChar *value = NULL;
+    xmlNodePtr pi;
+
+
+    if (ctxt->insert == NULL)
+	return;
+    if (comp->has_name == 0)
+	return;
+    if (comp->name == NULL) {
+	name = xsltEvalAttrValueTemplate(ctxt, inst,
+			    (const xmlChar *)"name", NULL);
+	if (name == NULL) {
+	    xsltTransformError(ctxt, NULL, inst,
+		 "xsl:processing-instruction : name is missing\n");
+	    goto error;
+	}
+    } else {
+	name = comp->name;
+    }
+    /* TODO: check that it's both an an NCName and a PITarget. */
+
+
+    value = xsltEvalTemplateString(ctxt, node, inst);
+    if (xmlStrstr(value, BAD_CAST "?>") != NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:processing-instruction: '?>' not allowed within PI content\n");
+	goto error;
+    }
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (value == NULL) {
+	XSLT_TRACE(ctxt,XSLT_TRACE_PI,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessingInstruction: %s empty\n", name));
+    } else {
+	XSLT_TRACE(ctxt,XSLT_TRACE_PI,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltProcessingInstruction: %s content %s\n", name, value));
+    }
+#endif
+
+    pi = xmlNewDocPI(ctxt->insert->doc, name, value);
+    xmlAddChild(ctxt->insert, pi);
+
+error:
+    if ((name != NULL) && (name != comp->name))
+        xmlFree((xmlChar *) name);
+    if (value != NULL)
+	xmlFree(value);
+}
+
+/**
+ * xsltCopyOf:
+ * @ctxt:  an XSLT transformation context
+ * @node:  the current node in the source tree
+ * @inst:  the element node of the XSLT copy-of instruction 
+ * @castedComp:  precomputed information of the XSLT copy-of instruction
+ *
+ * Process the XSLT copy-of instruction.
+ */
+void
+xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCopyOfPtr comp = (xsltStyleItemCopyOfPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xmlXPathObjectPtr res = NULL;
+    xmlNodeSetPtr list = NULL;
+    int i;
+    xmlDocPtr oldXPContextDoc;
+    xmlNsPtr *oldXPNamespaces;
+    xmlNodePtr oldXPContextNode;
+    int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+    xmlXPathContextPtr xpctxt;
+
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
+	return;
+    if ((comp == NULL) || (comp->select == NULL) || (comp->comp == NULL)) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:copy-of : compilation failed\n");
+	return;
+    }
+
+     /*
+    * SPEC XSLT 1.0:
+    *  "The xsl:copy-of element can be used to insert a result tree
+    *  fragment into the result tree, without first converting it to
+    *  a string as xsl:value-of does (see [7.6.1 Generating Text with
+    *  xsl:value-of]). The required select attribute contains an
+    *  expression. When the result of evaluating the expression is a
+    *  result tree fragment, the complete fragment is copied into the
+    *  result tree. When the result is a node-set, all the nodes in the
+    *  set are copied in document order into the result tree; copying
+    *  an element node copies the attribute nodes, namespace nodes and
+    *  children of the element node as well as the element node itself;
+    *  a root node is copied by copying its children. When the result
+    *  is neither a node-set nor a result tree fragment, the result is
+    *  converted to a string and then inserted into the result tree,
+    *  as with xsl:value-of.
+    */
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltCopyOf: select %s\n", comp->select));
+#endif
+
+    /*
+    * Evaluate the "select" expression.
+    */
+    xpctxt = ctxt->xpathCtxt;
+    oldXPContextDoc = xpctxt->doc;
+    oldXPContextNode = xpctxt->node;
+    oldXPProximityPosition = xpctxt->proximityPosition;
+    oldXPContextSize = xpctxt->contextSize;
+    oldXPNsNr = xpctxt->nsNr;
+    oldXPNamespaces = xpctxt->namespaces;
+    
+    xpctxt->node = node;
+    if (comp != NULL) {
+
+#ifdef XSLT_REFACTORED
+	if (comp->inScopeNs != NULL) {
+	    xpctxt->namespaces = comp->inScopeNs->list;
+	    xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+#else
+	xpctxt->namespaces = comp->nsList;
+	xpctxt->nsNr = comp->nsNr;
+#endif
+    } else {
+	xpctxt->namespaces = NULL;
+	xpctxt->nsNr = 0;
+    }
+
+    res = xmlXPathCompiledEval(comp->comp, xpctxt);
+
+    xpctxt->doc = oldXPContextDoc;
+    xpctxt->node = oldXPContextNode;
+    xpctxt->contextSize = oldXPContextSize;
+    xpctxt->proximityPosition = oldXPProximityPosition;	
+    xpctxt->nsNr = oldXPNsNr;
+    xpctxt->namespaces = oldXPNamespaces;
+
+    if (res != NULL) {
+	if (res->type == XPATH_NODESET) {
+	    /*
+	    * Node-set
+	    * --------
+	    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltCopyOf: result is a node set\n"));
+#endif
+	    list = res->nodesetval;
+	    if (list != NULL) {
+		xmlNodePtr cur;
+		/*
+		* The list is already sorted in document order by XPath.
+		* Append everything in this order under ctxt->insert.
+		*/
+		for (i = 0;i < list->nodeNr;i++) {
+		    cur = list->nodeTab[i];
+		    if (cur == NULL)
+			continue;
+		    if ((cur->type == XML_DOCUMENT_NODE) ||
+			(cur->type == XML_HTML_DOCUMENT_NODE))
+		    {
+			xsltCopyTreeList(ctxt, inst,
+			    cur->children, ctxt->insert, 0, 0);
+		    } else if (cur->type == XML_ATTRIBUTE_NODE) {
+			xsltShallowCopyAttr(ctxt, inst,
+			    ctxt->insert, (xmlAttrPtr) cur);
+		    } else {
+			xsltCopyTreeInternal(ctxt, inst,
+			    cur, ctxt->insert, 0, 0);
+		    }
+		}
+	    }
+	} else if (res->type == XPATH_XSLT_TREE) {
+	    /*
+	    * Result tree fragment
+	    * --------------------
+	    * E.g. via 
+	    * Note that the root node of such trees is an xmlDocPtr in Libxslt.
+	    */
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
+		 "xsltCopyOf: result is a result tree fragment\n"));
+#endif	    
+	    list = res->nodesetval;
+	    if ((list != NULL) && (list->nodeTab != NULL) &&
+		(list->nodeTab[0] != NULL) &&
+		(IS_XSLT_REAL_NODE(list->nodeTab[0])))
+	    {
+		xsltCopyTreeList(ctxt, inst,
+		    list->nodeTab[0]->children, ctxt->insert, 0, 0);
+	    }
+	} else {
+	    xmlChar *value = NULL;
+	    /*
+	    * Convert to a string.
+	    */
+	    value = xmlXPathCastToString(res);
+	    if (value == NULL) {
+		xsltTransformError(ctxt, NULL, inst,
+		    "Internal error in xsltCopyOf(): "
+		    "failed to cast an XPath object to string.\n");
+		ctxt->state = XSLT_STATE_STOPPED;
+	    } else {
+		if (value[0] != 0) {
+		    /*
+		    * Append content as text node.
+		    */
+		    xsltCopyTextString(ctxt, ctxt->insert, value, 0);
+		}
+		xmlFree(value);
+		
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltCopyOf: result %s\n", res->stringval));
+#endif
+	    }
+	}
+    } else {
+	ctxt->state = XSLT_STATE_STOPPED;
+    }
+
+    if (res != NULL)
+	xmlXPathFreeObject(res);
+}
+
+/**
+ * xsltValueOf:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt value-of node
+ * @castedComp:  precomputed information
+ *
+ * Process the xslt value-of node on the source node
+ */
+void
+xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemValueOfPtr comp = (xsltStyleItemValueOfPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xmlXPathObjectPtr res = NULL;
+    xmlNodePtr copy = NULL;
+    xmlChar *value = NULL;
+    xmlDocPtr oldXPContextDoc;
+    xmlNsPtr *oldXPNamespaces;
+    xmlNodePtr oldXPContextNode;
+    int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+    xmlXPathContextPtr xpctxt;
+
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
+	return;
+
+    if ((comp == NULL) || (comp->select == NULL) || (comp->comp == NULL)) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltValueOf(): "
+	    "The XSLT 'value-of' instruction was not compiled.\n");
+	return;
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltValueOf: select %s\n", comp->select));
+#endif
+
+    xpctxt = ctxt->xpathCtxt;
+    oldXPContextDoc = xpctxt->doc;
+    oldXPContextNode = xpctxt->node;
+    oldXPProximityPosition = xpctxt->proximityPosition;
+    oldXPContextSize = xpctxt->contextSize;
+    oldXPNsNr = xpctxt->nsNr;
+    oldXPNamespaces = xpctxt->namespaces;
+    
+    xpctxt->node = node;
+    if (comp != NULL) {
+
+#ifdef XSLT_REFACTORED
+	if (comp->inScopeNs != NULL) {
+	    xpctxt->namespaces = comp->inScopeNs->list;
+	    xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+#else
+	xpctxt->namespaces = comp->nsList;
+	xpctxt->nsNr = comp->nsNr;
+#endif
+    } else {
+	xpctxt->namespaces = NULL;
+	xpctxt->nsNr = 0;
+    }
+
+    res = xmlXPathCompiledEval(comp->comp, xpctxt);
+
+    xpctxt->doc = oldXPContextDoc;
+    xpctxt->node = oldXPContextNode;
+    xpctxt->contextSize = oldXPContextSize;
+    xpctxt->proximityPosition = oldXPProximityPosition;	
+    xpctxt->nsNr = oldXPNsNr;
+    xpctxt->namespaces = oldXPNamespaces;
+
+    /*
+    * Cast the XPath object to string.
+    */
+    if (res != NULL) {
+	value = xmlXPathCastToString(res);
+	if (value == NULL) {
+	    xsltTransformError(ctxt, NULL, inst,
+		"Internal error in xsltValueOf(): "
+		"failed to cast an XPath object to string.\n");
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    goto error;
+	}
+	if (value[0] != 0) {
+	    copy = xsltCopyTextString(ctxt,
+		ctxt->insert, value, comp->noescape);
+	}
+    } else {
+	xsltTransformError(ctxt, NULL, inst,	    
+	    "XPath evaluation returned no result.\n");
+	ctxt->state = XSLT_STATE_STOPPED;
+	goto error;	
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (value) {    
+	XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltValueOf: result '%s'\n", value));
+    }
+#endif
+
+error:
+    if (value != NULL)
+	xmlFree(value);
+    if (res != NULL)
+	xmlXPathFreeObject(res);
+}
+
+/**
+ * xsltNumber:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xslt number node
+ * @castedComp:  precomputed information
+ *
+ * Process the xslt number node on the source node
+ */
+void
+xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	   xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemNumberPtr comp = (xsltStyleItemNumberPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    if (comp == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:number : compilation failed\n");
+	return;
+    }
+
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
+	return;
+
+    comp->numdata.doc = inst->doc;
+    comp->numdata.node = inst;
+    
+    xsltNumberFormat(ctxt, &comp->numdata, node);
+}
+
+/**
+ * xsltApplyImports:
+ * @ctxt:  an XSLT transformation context
+ * @contextNode:  the current node in the source tree.
+ * @inst:  the element node of the XSLT 'apply-imports' instruction
+ * @comp:  the compiled instruction
+ *
+ * Process the XSLT apply-imports element.
+ */
+void
+xsltApplyImports(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
+	         xmlNodePtr inst,
+		 xsltStylePreCompPtr comp ATTRIBUTE_UNUSED)
+{
+    xsltTemplatePtr templ;
+
+    if ((ctxt == NULL) || (inst == NULL))
+	return;
+
+    if (comp == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltApplyImports(): "
+	    "The XSLT 'apply-imports' instruction was not compiled.\n");
+	return;
+    }
+    /*
+    * NOTE that ctxt->currentTemplateRule and ctxt->templ is not the
+    * same; the former is the "Current Template Rule" as defined by the
+    * XSLT spec, the latter is simply the template struct being
+    * currently processed.
+    */
+    if (ctxt->currentTemplateRule == NULL) {
+	/*
+	* SPEC XSLT 2.0:
+	* "[ERR XTDE0560] It is a non-recoverable dynamic error if
+	*  xsl:apply-imports or xsl:next-match is evaluated when the
+	*  current template rule is null."
+	*/
+	xsltTransformError(ctxt, NULL, inst,
+	     "It is an error to call 'apply-imports' "
+	     "when there's no current template rule.\n");
+	return;
+    }
+    /*
+    * TODO: Check if this is correct.
+    */
+    templ = xsltGetTemplate(ctxt, contextNode,
+	ctxt->currentTemplateRule->style);
+
+    if (templ != NULL) {
+	xsltTemplatePtr oldCurTemplRule = ctxt->currentTemplateRule;
+	/*
+	* Set the current template rule.
+	*/
+	ctxt->currentTemplateRule = templ;
+	/*
+	* URGENT TODO: Need xsl:with-param be handled somehow here?
+	*/
+	xsltApplyXSLTTemplate(ctxt, contextNode, templ->content,
+	    templ, NULL);
+
+	ctxt->currentTemplateRule = oldCurTemplRule;
+    }
+}
+
+/**
+ * xsltCallTemplate:
+ * @ctxt:  a XSLT transformation context
+ * @node:  the "current node" in the source tree
+ * @inst:  the XSLT 'call-template' instruction
+ * @castedComp:  the compiled information of the instruction
+ *
+ * Processes the XSLT call-template instruction on the source node.
+ */
+void
+xsltCallTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemCallTemplatePtr comp =
+	(xsltStyleItemCallTemplatePtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    xsltStackElemPtr withParams = NULL;
+
+    if (ctxt->insert == NULL)
+	return;
+    if (comp == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "The XSLT 'call-template' instruction was not compiled.\n");
+	return;
+    }
+
+    /*
+     * The template must have been precomputed
+     */
+    if (comp->templ == NULL) {
+	comp->templ = xsltFindTemplate(ctxt, comp->name, comp->ns);
+	if (comp->templ == NULL) {
+	    if (comp->ns != NULL) {
+	        xsltTransformError(ctxt, NULL, inst,
+			"The called template '{%s}%s' was not found.\n",
+			comp->ns, comp->name);
+	    } else {
+	        xsltTransformError(ctxt, NULL, inst,
+			"The called template '%s' was not found.\n",
+			comp->name);
+	    }
+	    return;
+	}
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if ((comp != NULL) && (comp->name != NULL))
+	XSLT_TRACE(ctxt,XSLT_TRACE_CALL_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+			 "call-template: name %s\n", comp->name));
+#endif
+
+    if (inst->children) {
+	xmlNodePtr cur;
+	xsltStackElemPtr param;
+
+	cur = inst->children;
+	while (cur != NULL) {
+#ifdef WITH_DEBUGGER
+	    if (ctxt->debugStatus != XSLT_DEBUG_NONE)
+		xslHandleDebugger(cur, node, comp->templ, ctxt);
+#endif
+	    if (ctxt->state == XSLT_STATE_STOPPED) break;
+	    /*
+	    * TODO: The "with-param"s could be part of the "call-template"
+	    *   structure. Avoid to "search" for params dynamically
+	    *   in the XML tree every time.
+	    */
+	    if (IS_XSLT_ELEM(cur)) {
+		if (IS_XSLT_NAME(cur, "with-param")) {
+		    param = xsltParseStylesheetCallerParam(ctxt, cur);
+		    if (param != NULL) {
+			param->next = withParams;
+			withParams = param;
+		    }
+		} else {
+		    xsltGenericError(xsltGenericErrorContext,
+			"xsl:call-template: misplaced xsl:%s\n", cur->name);
+		}
+	    } else {
+		xsltGenericError(xsltGenericErrorContext,
+		    "xsl:call-template: misplaced %s element\n", cur->name);
+	    }
+	    cur = cur->next;
+	}
+    }
+    /*
+     * Create a new frame using the params first     
+     */
+    xsltApplyXSLTTemplate(ctxt, node, comp->templ->content, comp->templ,
+	withParams);
+    if (withParams != NULL)
+	xsltFreeStackElemList(withParams);
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if ((comp != NULL) && (comp->name != NULL))
+	XSLT_TRACE(ctxt,XSLT_TRACE_CALL_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext,
+			 "call-template returned: name %s\n", comp->name));
+#endif
+}
+
+/**
+ * xsltApplyTemplates:
+ * @ctxt:  a XSLT transformation context
+ * @node:  the 'current node' in the source tree
+ * @inst:  the element node of an XSLT 'apply-templates' instruction
+ * @castedComp:  the compiled instruction
+ *
+ * Processes the XSLT 'apply-templates' instruction on the current node.
+ */
+void
+xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemApplyTemplatesPtr comp =
+	(xsltStyleItemApplyTemplatesPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    int i;
+    xmlNodePtr cur, delNode = NULL, oldContextNode;    
+    xmlNodeSetPtr list = NULL, oldList;
+    xsltStackElemPtr withParams = NULL;
+    int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+    const xmlChar *oldMode, *oldModeURI;
+    xmlDocPtr oldXPDoc;
+    xsltDocumentPtr oldDocInfo;
+    xmlXPathContextPtr xpctxt;
+    xmlNsPtr *oldXPNamespaces;
+
+    if (comp == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:apply-templates : compilation failed\n");
+	return;
+    }
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
+	return;
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if ((node != NULL) && (node->name != NULL))
+	XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltApplyTemplates: node: '%s'\n", node->name));
+#endif
+
+    xpctxt = ctxt->xpathCtxt;   
+    /*
+    * Save context states.
+    */
+    oldContextNode = ctxt->node;
+    oldMode = ctxt->mode;
+    oldModeURI = ctxt->modeURI;    
+    oldDocInfo = ctxt->document;
+    oldList = ctxt->nodeList;    
+
+    /*
+     * The xpath context size and proximity position, as
+     * well as the xpath and context documents, may be changed
+     * so we save their initial state and will restore on exit
+     */    
+    oldXPContextSize = xpctxt->contextSize;
+    oldXPProximityPosition = xpctxt->proximityPosition;
+    oldXPDoc = xpctxt->doc;
+    oldXPNsNr = xpctxt->nsNr;
+    oldXPNamespaces = xpctxt->namespaces;
+
+    /*
+    * Set up contexts.
+    */
+    ctxt->mode = comp->mode;
+    ctxt->modeURI = comp->modeURI;
+
+    if (comp->select != NULL) {	
+	xmlXPathObjectPtr res = NULL;
+
+	if (comp->comp == NULL) {
+	    xsltTransformError(ctxt, NULL, inst,
+		 "xsl:apply-templates : compilation failed\n");
+	    goto error;
+	}
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltApplyTemplates: select %s\n", comp->select));
+#endif
+
+	/*
+	* Set up XPath.
+	*/
+	xpctxt->node = node; /* Set the "context node" */
+#ifdef XSLT_REFACTORED
+	if (comp->inScopeNs != NULL) {
+	    xpctxt->namespaces = comp->inScopeNs->list;
+	    xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+#else
+	xpctxt->namespaces = comp->nsList;
+	xpctxt->nsNr = comp->nsNr;
+#endif
+	res = xmlXPathCompiledEval(comp->comp, xpctxt);
+
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->proximityPosition = oldXPProximityPosition;
+	if (res != NULL) {
+	    if (res->type == XPATH_NODESET) {
+		list = res->nodesetval; /* consume the node set */
+		res->nodesetval = NULL;	
+	    } else {
+		xsltTransformError(ctxt, NULL, inst,
+		    "The 'select' expression did not evaluate to a "
+		    "node set.\n");
+		ctxt->state = XSLT_STATE_STOPPED;
+		xmlXPathFreeObject(res);
+		goto error;
+	    }
+	    xmlXPathFreeObject(res);
+	    /*
+	    * Note: An xsl:apply-templates with a 'select' attribute,
+	    * can change the current source doc.
+	    */	    
+	} else {
+	    xsltTransformError(ctxt, NULL, inst,
+		"Failed to evaluate the 'select' expression.\n");
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    goto error;
+	}	   
+	if (list == NULL) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltApplyTemplates: select didn't evaluate to a node list\n"));
+#endif
+	    goto exit;
+	}
+	/*
+	* 
+	* NOTE: Previously a document info (xsltDocument) was
+	* created and attached to the Result Tree Fragment.
+	* But such a document info is created on demand in
+	* xsltKeyFunction() (functions.c), so we need to create
+	* it here beforehand.
+	* In order to take care of potential keys we need to
+	* do some extra work for the case when a Result Tree Fragment
+	* is converted into a nodeset (e.g. exslt:node-set()) :
+	* We attach a "pseudo-doc" (xsltDocument) to _private.		
+	* This xsltDocument, together with the keyset, will be freed
+	* when the Result Tree Fragment is freed.
+	*		
+	*/
+#if 0
+	if ((ctxt->nbKeys > 0) &&
+	    (list->nodeNr != 0) &&	    	    
+	    (list->nodeTab[0]->doc != NULL) &&
+	    XSLT_IS_RES_TREE_FRAG(list->nodeTab[0]->doc))
+	{
+	    /*
+	    * NOTE that it's also OK if @effectiveDocInfo will be
+	    * set to NULL.
+	    */
+	    isRTF = 1;
+	    effectiveDocInfo = list->nodeTab[0]->doc->_private;
+	}
+#endif
+    } else {
+	/*
+	 * Build an XPath node set with the children
+	 */
+	list = xmlXPathNodeSetCreate(NULL);
+	if (list == NULL)
+	    goto error;
+	cur = node->children;
+	while (cur != NULL) {
+	    switch (cur->type) {
+		case XML_TEXT_NODE:
+		    if ((IS_BLANK_NODE(cur)) &&
+			(cur->parent != NULL) &&
+			(cur->parent->type == XML_ELEMENT_NODE) &&
+			(ctxt->style->stripSpaces != NULL)) {
+			const xmlChar *val;
+
+			if (cur->parent->ns != NULL) {
+			    val = (const xmlChar *)
+				  xmlHashLookup2(ctxt->style->stripSpaces,
+						 cur->parent->name,
+						 cur->parent->ns->href);
+			    if (val == NULL) {
+				val = (const xmlChar *)
+				  xmlHashLookup2(ctxt->style->stripSpaces,
+						 BAD_CAST "*",
+						 cur->parent->ns->href);
+			    }
+			} else {
+			    val = (const xmlChar *)
+				  xmlHashLookup2(ctxt->style->stripSpaces,
+						 cur->parent->name, NULL);
+			}
+			if ((val != NULL) &&
+			    (xmlStrEqual(val, (xmlChar *) "strip"))) {
+			    delNode = cur;
+			    break;
+			}
+		    }
+		    /* no break on purpose */
+		case XML_ELEMENT_NODE:
+		case XML_DOCUMENT_NODE:
+		case XML_HTML_DOCUMENT_NODE:
+		case XML_CDATA_SECTION_NODE:
+		case XML_PI_NODE:
+		case XML_COMMENT_NODE:
+		    xmlXPathNodeSetAddUnique(list, cur);
+		    break;
+		case XML_DTD_NODE:
+		    /* Unlink the DTD, it's still reachable
+		     * using doc->intSubset */
+		    if (cur->next != NULL)
+			cur->next->prev = cur->prev;
+		    if (cur->prev != NULL)
+			cur->prev->next = cur->next;
+		    break;
+		default:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltApplyTemplates: skipping cur type %d\n",
+				     cur->type));
+#endif
+		    delNode = cur;
+	    }
+	    cur = cur->next;
+	    if (delNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+		     "xsltApplyTemplates: removing ignorable blank cur\n"));
+#endif
+		xmlUnlinkNode(delNode);
+		xmlFreeNode(delNode);
+		delNode = NULL;
+	    }
+	}
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    if (list != NULL)
+    XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+	"xsltApplyTemplates: list of %d nodes\n", list->nodeNr));
+#endif
+
+    if ((list == NULL) || (list->nodeNr == 0))
+	goto exit;
+
+    /*
+    * Set the context's node set and size; this is also needed for
+    * for xsltDoSortFunction().
+    */
+    ctxt->nodeList = list;
+    /* 
+    * Process xsl:with-param and xsl:sort instructions.
+    * (The code became so verbose just to avoid the
+    *  xmlNodePtr sorts[XSLT_MAX_SORT] if there's no xsl:sort)
+    * BUG TODO: We are not using namespaced potentially defined on the
+    * xsl:sort or xsl:with-param elements; XPath expression might fail.
+    */
+    if (inst->children) {
+	xsltStackElemPtr param;
+
+	cur = inst->children;
+	while (cur) {
+
+#ifdef WITH_DEBUGGER
+	    if (ctxt->debugStatus != XSLT_DEBUG_NONE)
+		xslHandleDebugger(cur, node, NULL, ctxt);
+#endif
+	    if (ctxt->state == XSLT_STATE_STOPPED)
+		break;
+	    if (cur->type == XML_TEXT_NODE) {
+		cur = cur->next;
+		continue;
+	    }	    
+	    if (! IS_XSLT_ELEM(cur))
+		break;
+	    if (IS_XSLT_NAME(cur, "with-param")) {
+		param = xsltParseStylesheetCallerParam(ctxt, cur);
+		if (param != NULL) {
+		    param->next = withParams;
+		    withParams = param;
+		}
+	    }
+	    if (IS_XSLT_NAME(cur, "sort")) {
+		xsltTemplatePtr oldCurTempRule =
+		    ctxt->currentTemplateRule;
+		int nbsorts = 0;
+		xmlNodePtr sorts[XSLT_MAX_SORT];		
+		
+		sorts[nbsorts++] = cur;
+		
+		while (cur) {
+		    
+#ifdef WITH_DEBUGGER
+		    if (ctxt->debugStatus != XSLT_DEBUG_NONE)
+			xslHandleDebugger(cur, node, NULL, ctxt);
+#endif
+		    if (ctxt->state == XSLT_STATE_STOPPED)
+			break;
+		    
+		    if (cur->type == XML_TEXT_NODE) {
+			cur = cur->next;
+			continue;
+		    }
+		    
+		    if (! IS_XSLT_ELEM(cur))
+			break;
+		    if (IS_XSLT_NAME(cur, "with-param")) {
+			param = xsltParseStylesheetCallerParam(ctxt, cur);
+			if (param != NULL) {
+			    param->next = withParams;
+			    withParams = param;
+			}
+		    }	
+		    if (IS_XSLT_NAME(cur, "sort")) {
+			if (nbsorts >= XSLT_MAX_SORT) {
+			    xsltTransformError(ctxt, NULL, cur,
+				"The number (%d) of xsl:sort instructions exceeds the "
+				"maximum allowed by this processor's settings.\n",
+				nbsorts);
+			    ctxt->state = XSLT_STATE_STOPPED;
+			    break;
+			} else {
+			    sorts[nbsorts++] = cur;
+			}
+		    }
+		    cur = cur->next;
+		}
+		/*
+		* The "current template rule" is cleared for xsl:sort.
+		*/
+		ctxt->currentTemplateRule = NULL;
+		/*
+		* Sort.
+		*/
+		xsltDoSortFunction(ctxt, sorts, nbsorts);
+		ctxt->currentTemplateRule = oldCurTempRule;
+		break;
+	    }
+	    cur = cur->next;
+	}
+    }    
+    xpctxt->contextSize = list->nodeNr;
+    /*
+    * Apply templates for all selected source nodes.
+    */    
+    for (i = 0; i < list->nodeNr; i++) {
+	cur = list->nodeTab[i];
+	/*
+	* The node becomes the "current node".
+	*/
+	ctxt->node = cur;
+	/*
+	* An xsl:apply-templates can change the current context doc.
+	* OPTIMIZE TODO: Get rid of the need to set the context doc.
+	*/
+	if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL))
+	    xpctxt->doc = cur->doc;
+
+	xpctxt->proximityPosition = i + 1;
+	/*
+	* Find and apply a template for this node.
+	*/
+	xsltProcessOneNode(ctxt, cur, withParams);
+    }
+
+exit:
+error:
+    /*
+    * Free the parameter list.
+    */
+    if (withParams != NULL)
+	xsltFreeStackElemList(withParams);
+    if (list != NULL)
+	xmlXPathFreeNodeSet(list);    
+    /*
+    * Restore context states.
+    */
+    xpctxt->nsNr = oldXPNsNr;
+    xpctxt->namespaces = oldXPNamespaces;
+    xpctxt->doc = oldXPDoc;
+    xpctxt->contextSize = oldXPContextSize;
+    xpctxt->proximityPosition = oldXPProximityPosition;
+
+    ctxt->document = oldDocInfo;
+    ctxt->nodeList = oldList;
+    ctxt->node = oldContextNode;
+    ctxt->mode = oldMode;
+    ctxt->modeURI = oldModeURI;
+}
+
+
+/**
+ * xsltChoose:
+ * @ctxt:  a XSLT process context
+ * @contextNode:  the current node in the source tree
+ * @inst:  the xsl:choose instruction
+ * @comp:  compiled information of the instruction
+ *
+ * Processes the xsl:choose instruction on the source node.
+ */
+void
+xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
+	   xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED)
+{
+    xmlNodePtr cur;
+
+    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
+	return;
+    
+    /* 
+    * TODO: Content model checks should be done only at compilation
+    * time.
+    */
+    cur = inst->children;
+    if (cur == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "xsl:choose: The instruction has no content.\n");
+	return;
+    }
+
+#ifdef XSLT_REFACTORED
+    /*
+    * We don't check the content model during transformation.
+    */
+#else
+    if ((! IS_XSLT_ELEM(cur)) || (! IS_XSLT_NAME(cur, "when"))) {
+	xsltTransformError(ctxt, NULL, inst,
+	     "xsl:choose: xsl:when expected first\n");
+	return;
+    }
+#endif
+
+    {
+	int testRes = 0, res = 0;
+	xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;	
+	xmlDocPtr oldXPContextDoc = xpctxt->doc;
+	int oldXPProximityPosition = xpctxt->proximityPosition;
+	int oldXPContextSize = xpctxt->contextSize;
+	xmlNsPtr *oldXPNamespaces = xpctxt->namespaces;
+	int oldXPNsNr = xpctxt->nsNr;
+	
+#ifdef XSLT_REFACTORED
+	xsltStyleItemWhenPtr wcomp = NULL;
+#else
+	xsltStylePreCompPtr wcomp = NULL;
+#endif
+
+	/*
+	* Process xsl:when ---------------------------------------------------
+	*/
+	while (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "when")) {	
+	    wcomp = cur->psvi;
+	    
+	    if ((wcomp == NULL) || (wcomp->test == NULL) ||
+		(wcomp->comp == NULL))
+	    {
+		xsltTransformError(ctxt, NULL, cur,
+		    "Internal error in xsltChoose(): "
+		    "The XSLT 'when' instruction was not compiled.\n");
+		goto error;
+	    }
+	    
+	    
+#ifdef WITH_DEBUGGER
+	    if (xslDebugStatus != XSLT_DEBUG_NONE) {
+		/* 
+		* TODO: Isn't comp->templ always NULL for xsl:choose?
+		*/
+		xslHandleDebugger(cur, contextNode, NULL, ctxt);
+	    }
+#endif
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltChoose: test %s\n", wcomp->test));
+#endif
+
+	    xpctxt->node = contextNode;
+	    xpctxt->doc = oldXPContextDoc;
+	    xpctxt->proximityPosition = oldXPProximityPosition;
+	    xpctxt->contextSize = oldXPContextSize;
+	    
+#ifdef XSLT_REFACTORED
+	    if (wcomp->inScopeNs != NULL) {
+		xpctxt->namespaces = wcomp->inScopeNs->list;
+		xpctxt->nsNr = wcomp->inScopeNs->xpathNumber;
+	    } else {
+		xpctxt->namespaces = NULL;
+		xpctxt->nsNr = 0;
+	    }
+#else
+	    xpctxt->namespaces = wcomp->nsList;
+	    xpctxt->nsNr = wcomp->nsNr;
+#endif
+	    
+	    
+#ifdef XSLT_FAST_IF
+	    res = xmlXPathCompiledEvalToBoolean(wcomp->comp, xpctxt);
+	    
+	    if (res == -1) {
+		ctxt->state = XSLT_STATE_STOPPED;
+		goto error;
+	    }
+	    testRes = (res == 1) ? 1 : 0;	
+	    
+#else /* XSLT_FAST_IF */
+	    
+	    res = xmlXPathCompiledEval(wcomp->comp, xpctxt);
+	    
+	    if (res != NULL) {
+		if (res->type != XPATH_BOOLEAN)
+		    res = xmlXPathConvertBoolean(res);
+		if (res->type == XPATH_BOOLEAN)
+		    testRes = res->boolval;
+		else {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext,
+			"xsltChoose: test didn't evaluate to a boolean\n"));
+#endif
+		    goto error;
+		}
+		xmlXPathFreeObject(res);
+		res = NULL;
+	    } else {
+		ctxt->state = XSLT_STATE_STOPPED;
+		goto error;
+	    }
+	    
+#endif /* else of XSLT_FAST_IF */
+	    
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltChoose: test evaluate to %d\n", testRes));
+#endif
+	    if (testRes)		
+		goto test_is_true;
+	    
+	    cur = cur->next;
+	}
+    
+	/*
+	* Process xsl:otherwise ----------------------------------------------
+	*/
+	if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "otherwise")) {
+	    
+#ifdef WITH_DEBUGGER
+	    if (xslDebugStatus != XSLT_DEBUG_NONE)
+		xslHandleDebugger(cur, contextNode, NULL, ctxt);
+#endif
+	    
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext,
+		"evaluating xsl:otherwise\n"));
+#endif	    
+	    goto test_is_true;
+	}
+	xpctxt->node = contextNode;
+	xpctxt->doc = oldXPContextDoc;
+	xpctxt->proximityPosition = oldXPProximityPosition;
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->namespaces = oldXPNamespaces;
+	xpctxt->nsNr = oldXPNsNr;
+	goto exit;
+
+test_is_true:
+
+	xpctxt->node = contextNode;
+	xpctxt->doc = oldXPContextDoc;
+	xpctxt->proximityPosition = oldXPProximityPosition;
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->namespaces = oldXPNamespaces;
+	xpctxt->nsNr = oldXPNsNr;
+	goto process_sequence;
+    }
+
+process_sequence:
+    
+    /*
+    * Instantiate the sequence constructor.
+    */
+    xsltApplySequenceConstructor(ctxt, ctxt->node, cur->children,
+	NULL);
+
+exit:
+error:
+    return;
+}
+
+/**
+ * xsltIf:
+ * @ctxt:  a XSLT process context
+ * @contextNode:  the current node in the source tree
+ * @inst:  the xsl:if instruction
+ * @castedComp:  compiled information of the instruction
+ *
+ * Processes the xsl:if instruction on the source node.
+ */
+void
+xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
+	           xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+    int res = 0;
+
+#ifdef XSLT_REFACTORED
+    xsltStyleItemIfPtr comp = (xsltStyleItemIfPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+
+    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
+	return;
+    if ((comp == NULL) || (comp->test == NULL) || (comp->comp == NULL)) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltIf(): "
+	    "The XSLT 'if' instruction was not compiled.\n");
+	return;
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltIf: test %s\n", comp->test));
+#endif
+
+#ifdef XSLT_FAST_IF    
+    {
+	xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
+	xmlDocPtr oldXPContextDoc = xpctxt->doc;
+	xmlNsPtr *oldXPNamespaces = xpctxt->namespaces;
+	xmlNodePtr oldXPContextNode = xpctxt->node;
+	int oldXPProximityPosition = xpctxt->proximityPosition;
+	int oldXPContextSize = xpctxt->contextSize;
+	int oldXPNsNr = xpctxt->nsNr;
+	xmlDocPtr oldLocalFragmentTop = ctxt->localRVT; 
+	
+	xpctxt->node = contextNode;
+	if (comp != NULL) {
+	    
+#ifdef XSLT_REFACTORED
+	    if (comp->inScopeNs != NULL) {
+		xpctxt->namespaces = comp->inScopeNs->list;
+		xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	    } else {
+		xpctxt->namespaces = NULL;
+		xpctxt->nsNr = 0;
+	    }
+#else
+	    xpctxt->namespaces = comp->nsList;
+	    xpctxt->nsNr = comp->nsNr;
+#endif
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+	/*
+	* This XPath function is optimized for boolean results.
+	*/	
+	res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt);
+
+	/*
+	* Cleanup fragments created during evaluation of the
+	* "select" expression.
+	*/
+	if (oldLocalFragmentTop != ctxt->localRVT)
+	    xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
+	
+	xpctxt->doc = oldXPContextDoc;
+	xpctxt->node = oldXPContextNode;
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->proximityPosition = oldXPProximityPosition;	
+	xpctxt->nsNr = oldXPNsNr;
+	xpctxt->namespaces = oldXPNamespaces;
+    }
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext,
+	"xsltIf: test evaluate to %d\n", res));
+#endif
+    
+    if (res == -1) {
+	ctxt->state = XSLT_STATE_STOPPED;
+	goto error;
+    }
+    if (res == 1) {
+	/*
+	* Instantiate the sequence constructor of xsl:if.
+	*/
+	xsltApplySequenceConstructor(ctxt,
+	    contextNode, inst->children, NULL);
+    }
+	
+#else /* XSLT_FAST_IF */
+    {
+	xmlXPathObjectPtr xpobj = NULL;
+	/*
+	* OLD CODE:
+	*/
+	{
+	    xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
+	    xmlDocPtr oldXPContextDoc = xpctxt->doc;
+	    xmlNsPtr *oldXPNamespaces = xpctxt->namespaces;
+	    xmlNodePtr oldXPContextNode = xpctxt->node;
+	    int oldXPProximityPosition = xpctxt->proximityPosition;
+	    int oldXPContextSize = xpctxt->contextSize;
+	    int oldXPNsNr = xpctxt->nsNr;	
+	    
+	    xpctxt->node = contextNode;
+	    if (comp != NULL) {
+		
+#ifdef XSLT_REFACTORED
+		if (comp->inScopeNs != NULL) {
+		    xpctxt->namespaces = comp->inScopeNs->list;
+		    xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+		} else {
+		    xpctxt->namespaces = NULL;
+		    xpctxt->nsNr = 0;
+		}
+#else
+		xpctxt->namespaces = comp->nsList;
+		xpctxt->nsNr = comp->nsNr;
+#endif
+	    } else {
+		xpctxt->namespaces = NULL;
+		xpctxt->nsNr = 0;
+	    }
+	    
+	    /*
+	    * This XPath function is optimized for boolean results.
+	    */	
+	    xpobj = xmlXPathCompiledEval(comp->comp, xpctxt);
+	    
+	    xpctxt->doc = oldXPContextDoc;
+	    xpctxt->node = oldXPContextNode;
+	    xpctxt->contextSize = oldXPContextSize;
+	    xpctxt->proximityPosition = oldXPProximityPosition;	
+	    xpctxt->nsNr = oldXPNsNr;
+	    xpctxt->namespaces = oldXPNamespaces;
+	}
+	if (xpobj != NULL) {
+	    if (xpobj->type != XPATH_BOOLEAN)
+		xpobj = xmlXPathConvertBoolean(xpobj);
+	    if (xpobj->type == XPATH_BOOLEAN) {
+		res = xpobj->boolval;
+		
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltIf: test evaluate to %d\n", res));
+#endif
+		if (res) {
+		    xsltApplySequenceConstructor(ctxt,
+			contextNode, inst->children, NULL);
+		}
+	    } else {
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		XSLT_TRACE(ctxt, XSLT_TRACE_IF,
+		    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltIf: test didn't evaluate to a boolean\n"));
+#endif
+		ctxt->state = XSLT_STATE_STOPPED;
+	    }
+	    xmlXPathFreeObject(xpobj);
+	} else {
+	    ctxt->state = XSLT_STATE_STOPPED;
+	}
+    }
+#endif /* else of XSLT_FAST_IF */
+
+error:
+    return;
+}
+
+/**
+ * xsltForEach:
+ * @ctxt:  an XSLT transformation context
+ * @contextNode:  the "current node" in the source tree  
+ * @inst:  the element node of the xsl:for-each instruction
+ * @castedComp:  the compiled information of the instruction
+ *
+ * Process the xslt for-each node on the source node
+ */
+void
+xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
+	    xmlNodePtr inst, xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemForEachPtr comp = (xsltStyleItemForEachPtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif
+    int i;
+    xmlXPathObjectPtr res = NULL;
+    xmlNodePtr cur, curInst;
+    xmlNodeSetPtr list = NULL;
+    xmlNodeSetPtr oldList;        
+    int oldXPProximityPosition, oldXPContextSize;
+    xmlNodePtr oldContextNode;
+    xsltTemplatePtr oldCurTemplRule;    
+    xmlDocPtr oldXPDoc;
+    xsltDocumentPtr oldDocInfo;
+    xmlXPathContextPtr xpctxt;
+
+    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) {
+	xsltGenericError(xsltGenericErrorContext,	
+	    "xsltForEach(): Bad arguments.\n");
+	return;
+    }
+
+    if (comp == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltForEach(): "
+	    "The XSLT 'for-each' instruction was not compiled.\n");
+        return;
+    }
+    if ((comp->select == NULL) || (comp->comp == NULL)) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltForEach(): "
+	    "The selecting expression of the XSLT 'for-each' "
+	    "instruction was not compiled correctly.\n");
+	return;
+    }
+    xpctxt = ctxt->xpathCtxt;    
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltForEach: select %s\n", comp->select));
+#endif
+
+    /*
+    * Save context states.
+    */
+    oldDocInfo = ctxt->document;
+    oldList = ctxt->nodeList;    
+    oldContextNode = ctxt->node;
+    /*
+    * The "current template rule" is cleared for the instantiation of
+    * xsl:for-each.
+    */
+    oldCurTemplRule = ctxt->currentTemplateRule;
+    ctxt->currentTemplateRule = NULL;
+
+    oldXPDoc = xpctxt->doc;
+    oldXPProximityPosition = xpctxt->proximityPosition;
+    oldXPContextSize = xpctxt->contextSize;
+    /*
+    * Set up XPath.
+    */
+    xpctxt->node = contextNode;
+#ifdef XSLT_REFACTORED
+    if (comp->inScopeNs != NULL) {
+	xpctxt->namespaces = comp->inScopeNs->list;
+	xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+    } else {
+	xpctxt->namespaces = NULL;
+	xpctxt->nsNr = 0;
+    }
+#else
+    xpctxt->namespaces = comp->nsList;
+    xpctxt->nsNr = comp->nsNr;
+#endif   
+    
+    /*
+    * Evaluate the 'select' expression.
+    */
+    res = xmlXPathCompiledEval(comp->comp, ctxt->xpathCtxt);
+
+    if (res != NULL) {
+	if (res->type == XPATH_NODESET)
+	    list = res->nodesetval;
+	else {
+	    xsltTransformError(ctxt, NULL, inst,
+		"The 'select' expression does not evaluate to a node set.\n");
+	    
+#ifdef WITH_XSLT_DEBUG_PROCESS
+	    XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext,
+		"xsltForEach: select didn't evaluate to a node list\n"));
+#endif
+	    goto error;
+	}
+    } else {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Failed to evaluate the 'select' expression.\n");
+	ctxt->state = XSLT_STATE_STOPPED;
+	goto error;
+    }
+
+    if ((list == NULL) || (list->nodeNr <= 0))
+	goto exit;
+
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext,
+	"xsltForEach: select evaluates to %d nodes\n", list->nodeNr));
+#endif
+
+    /*
+    * Restore XPath states for the "current node".
+    */
+    xpctxt->contextSize = oldXPContextSize;
+    xpctxt->proximityPosition = oldXPProximityPosition;
+    xpctxt->node = contextNode;
+    
+    /*
+    * Set the list; this has to be done already here for xsltDoSortFunction().
+    */
+    ctxt->nodeList = list;    
+    /* 
+    * Handle xsl:sort instructions and skip them for further processing.
+    * BUG TODO: We are not using namespaced potentially defined on the
+    * xsl:sort element; XPath expression might fail.
+    */
+    curInst = inst->children;
+    if (IS_XSLT_ELEM(curInst) && IS_XSLT_NAME(curInst, "sort")) {
+	int nbsorts = 0;
+	xmlNodePtr sorts[XSLT_MAX_SORT];
+
+	sorts[nbsorts++] = curInst;
+
+#ifdef WITH_DEBUGGER
+	if (xslDebugStatus != XSLT_DEBUG_NONE)
+	    xslHandleDebugger(curInst, contextNode, NULL, ctxt);
+#endif
+
+	curInst = curInst->next;
+	while (IS_XSLT_ELEM(curInst) && IS_XSLT_NAME(curInst, "sort")) {
+	    if (nbsorts >= XSLT_MAX_SORT) {
+		xsltTransformError(ctxt, NULL, curInst,
+		    "The number of xsl:sort instructions exceeds the "
+		    "maximum (%d) allowed by this processor.\n",
+		    XSLT_MAX_SORT);
+		goto error;
+	    } else {
+		sorts[nbsorts++] = curInst;
+	    }
+	    
+#ifdef WITH_DEBUGGER
+	    if (xslDebugStatus != XSLT_DEBUG_NONE)
+		xslHandleDebugger(curInst, contextNode, NULL, ctxt);
+#endif
+	    curInst = curInst->next;
+	}
+	xsltDoSortFunction(ctxt, sorts, nbsorts);
+    }    
+    xpctxt->contextSize = list->nodeNr;
+    /*
+    * Instantiate the sequence constructor for each selected node.
+    */    
+    for (i = 0; i < list->nodeNr; i++) {
+	cur = list->nodeTab[i];
+	/*
+	* The selected node becomes the "current node".
+	*/
+	ctxt->node = cur;
+	/*
+	* An xsl:for-each can change the current context doc.
+	* OPTIMIZE TODO: Get rid of the need to set the context doc.
+	*/
+	if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL))
+	    xpctxt->doc = cur->doc;
+
+	xpctxt->proximityPosition = i + 1;
+
+	xsltApplySequenceConstructor(ctxt, cur, curInst, NULL);
+    }
+
+exit:
+error:
+    if (res != NULL)
+	xmlXPathFreeObject(res);
+    /*
+    * Restore old states.
+    */
+    ctxt->document = oldDocInfo;
+    ctxt->nodeList = oldList;
+    ctxt->node = oldContextNode;
+    ctxt->currentTemplateRule = oldCurTemplRule;
+
+    xpctxt->doc = oldXPDoc;
+    xpctxt->contextSize = oldXPContextSize;
+    xpctxt->proximityPosition = oldXPProximityPosition;
+}
+
+/************************************************************************
+ *									*
+ *			Generic interface				*
+ *									*
+ ************************************************************************/
+
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+typedef struct xsltHTMLVersion {
+    const char *version;
+    const char *public;
+    const char *system;
+} xsltHTMLVersion;
+
+static xsltHTMLVersion xsltHTMLVersions[] = {
+    { "4.01frame", "-//W3C//DTD HTML 4.01 Frameset//EN",
+      "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"},
+    { "4.01strict", "-//W3C//DTD HTML 4.01//EN",
+      "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"},
+    { "4.01trans", "-//W3C//DTD HTML 4.01 Transitional//EN",
+      "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"},
+    { "4.01", "-//W3C//DTD HTML 4.01 Transitional//EN",
+      "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"},
+    { "4.0strict", "-//W3C//DTD HTML 4.01//EN",
+      "http://www.w3.org/TR/html4/strict.dtd"},
+    { "4.0trans", "-//W3C//DTD HTML 4.01 Transitional//EN",
+      "http://www.w3.org/TR/html4/loose.dtd"},
+    { "4.0frame", "-//W3C//DTD HTML 4.01 Frameset//EN",
+      "http://www.w3.org/TR/html4/frameset.dtd"},
+    { "4.0", "-//W3C//DTD HTML 4.01 Transitional//EN",
+      "http://www.w3.org/TR/html4/loose.dtd"},
+    { "3.2", "-//W3C//DTD HTML 3.2//EN", NULL }
+};
+
+/**
+ * xsltGetHTMLIDs:
+ * @version:  the version string
+ * @publicID:  used to return the public ID
+ * @systemID:  used to return the system ID
+ *
+ * Returns -1 if not found, 0 otherwise and the system and public
+ *         Identifier for this given verion of HTML
+ */
+static int
+xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID,
+	            const xmlChar **systemID) {
+    unsigned int i;
+    if (version == NULL)
+	return(-1);
+    for (i = 0;i < (sizeof(xsltHTMLVersions)/sizeof(xsltHTMLVersions[1]));
+	 i++) {
+	if (!xmlStrcasecmp(version,
+		           (const xmlChar *) xsltHTMLVersions[i].version)) {
+	    if (publicID != NULL)
+		*publicID = (const xmlChar *) xsltHTMLVersions[i].public;
+	    if (systemID != NULL)
+		*systemID = (const xmlChar *) xsltHTMLVersions[i].system;
+	    return(0);
+	}
+    }
+    return(-1);
+}
+#endif
+
+/**
+ * xsltApplyStripSpaces:
+ * @ctxt:  a XSLT process context
+ * @node:  the root of the XML tree
+ *
+ * Strip the unwanted ignorable spaces from the input tree
+ */
+void
+xsltApplyStripSpaces(xsltTransformContextPtr ctxt, xmlNodePtr node) {
+    xmlNodePtr current;
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    int nb = 0;
+#endif
+
+
+    current = node;
+    while (current != NULL) {
+	/*
+	 * Cleanup children empty nodes if asked for
+	 */
+	if ((IS_XSLT_REAL_NODE(current)) &&
+	    (current->children != NULL) &&
+	    (xsltFindElemSpaceHandling(ctxt, current))) {
+	    xmlNodePtr delete = NULL, cur = current->children;
+
+	    while (cur != NULL) {
+		if (IS_BLANK_NODE(cur))
+		    delete = cur;
+		
+		cur = cur->next;
+		if (delete != NULL) {
+		    xmlUnlinkNode(delete);
+		    xmlFreeNode(delete);
+		    delete = NULL;
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    nb++;
+#endif
+		}
+	    }
+	}
+
+	/*
+	 * Skip to next node in document order.
+	 */
+	if (node->type == XML_ENTITY_REF_NODE) {
+	    /* process deep in entities */
+	    xsltApplyStripSpaces(ctxt, node->children);
+	}
+	if ((current->children != NULL) &&
+            (current->type != XML_ENTITY_REF_NODE)) {
+	    current = current->children;
+	} else if (current->next != NULL) {
+	    current = current->next;
+	} else {
+	    do {
+		current = current->parent;
+		if (current == NULL)
+		    break;
+		if (current == node)
+		    goto done;
+		if (current->next != NULL) {
+		    current = current->next;
+		    break;
+		}
+	    } while (current != NULL);
+	}
+    }
+
+done:
+#ifdef WITH_XSLT_DEBUG_PROCESS
+    XSLT_TRACE(ctxt,XSLT_TRACE_STRIP_SPACES,xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltApplyStripSpaces: removed %d ignorable blank node\n", nb));
+#endif
+    return;
+}
+
+static int
+xsltCountKeys(xsltTransformContextPtr ctxt)
+{
+    xsltStylesheetPtr style;
+    xsltKeyDefPtr keyd;
+
+    if (ctxt == NULL)
+	return(-1);
+
+    /*
+    * Do we have those nastly templates with a key() in the match pattern?
+    */
+    ctxt->hasTemplKeyPatterns = 0;
+    style = ctxt->style;
+    while (style != NULL) {
+	if (style->keyMatch != NULL) {
+	    ctxt->hasTemplKeyPatterns = 1;
+	    break;
+	}
+	style = xsltNextImport(style);
+    }
+    /*
+    * Count number of key declarations.
+    */
+    ctxt->nbKeys = 0;
+    style = ctxt->style;
+    while (style != NULL) {
+	keyd = style->keys;
+	while (keyd) {
+	    ctxt->nbKeys++;
+	    keyd = keyd->next;
+	}
+	style = xsltNextImport(style);
+    }
+    return(ctxt->nbKeys);
+}
+
+/**
+ * xsltApplyStylesheetInternal:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated array of parameters names/values tuples
+ * @output:  the targetted output
+ * @profile:  profile FILE * output or NULL
+ * @user:  user provided parameter
+ *
+ * Apply the stylesheet to the document
+ * NOTE: This may lead to a non-wellformed output XML wise !
+ *
+ * Returns the result document or NULL in case of error
+ */
+static xmlDocPtr
+xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
+                            const char **params, const char *output,
+                            FILE * profile, xsltTransformContextPtr userCtxt)
+{
+    xmlDocPtr res = NULL;
+    xsltTransformContextPtr ctxt = NULL;
+    xmlNodePtr root, node;
+    const xmlChar *method;
+    const xmlChar *doctypePublic;
+    const xmlChar *doctypeSystem;
+    const xmlChar *version;
+    xsltStackElemPtr variables;
+    xsltStackElemPtr vptr;
+
+    if ((style == NULL) || (doc == NULL))
+        return (NULL);
+
+    if (style->internalized == 0) {
+#ifdef WITH_XSLT_DEBUG
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "Stylesheet was not fully internalized !\n");
+#endif
+    }
+    if (doc->intSubset != NULL) {
+	/*
+	 * Avoid hitting the DTD when scanning nodes
+	 * but keep it linked as doc->intSubset
+	 */
+	xmlNodePtr cur = (xmlNodePtr) doc->intSubset;
+	if (cur->next != NULL)
+	    cur->next->prev = cur->prev;
+	if (cur->prev != NULL)
+	    cur->prev->next = cur->next;
+	if (doc->children == cur)
+	    doc->children = cur->next;
+	if (doc->last == cur)
+	    doc->last = cur->prev;
+	cur->prev = cur->next = NULL;
+    }
+
+    /*
+     * Check for XPath document order availability
+     */
+    root = xmlDocGetRootElement(doc);
+    if (root != NULL) {
+	if (((long) root->content) >= 0 && (xslDebugStatus == XSLT_DEBUG_NONE))
+	    xmlXPathOrderDocElems(doc);
+    }
+
+    if (userCtxt != NULL)
+	ctxt = userCtxt;
+    else
+	ctxt = xsltNewTransformContext(style, doc);
+
+    if (ctxt == NULL)
+        return (NULL);
+
+    ctxt->initialContextDoc = doc;
+    ctxt->initialContextNode = (xmlNodePtr) doc;
+
+    if (profile != NULL)
+        ctxt->profile = 1;
+
+    if (output != NULL)
+        ctxt->outputFile = output;
+    else
+        ctxt->outputFile = NULL;
+
+    /*
+     * internalize the modes if needed
+     */
+    if (ctxt->dict != NULL) {
+        if (ctxt->mode != NULL)
+	    ctxt->mode = xmlDictLookup(ctxt->dict, ctxt->mode, -1);
+        if (ctxt->modeURI != NULL)
+	    ctxt->modeURI = xmlDictLookup(ctxt->dict, ctxt->modeURI, -1);
+    }
+
+    XSLT_GET_IMPORT_PTR(method, style, method)
+    XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
+    XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
+    XSLT_GET_IMPORT_PTR(version, style, version)
+
+    if ((method != NULL) &&
+	(!xmlStrEqual(method, (const xmlChar *) "xml")))
+    {
+        if (xmlStrEqual(method, (const xmlChar *) "html")) {
+            ctxt->type = XSLT_OUTPUT_HTML;
+            if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+                res = htmlNewDoc(doctypeSystem, doctypePublic);
+	    } else {
+                if (version == NULL) {
+		    xmlDtdPtr dtd;
+		    
+		    res = htmlNewDoc(NULL, NULL);
+		    /*
+		    * Make sure no DTD node is generated in this case
+		    */
+		    if (res != NULL) {
+			dtd = xmlGetIntSubset(res);
+			if (dtd != NULL) {
+			    xmlUnlinkNode((xmlNodePtr) dtd);
+			    xmlFreeDtd(dtd);
+			}
+			res->intSubset = NULL;
+			res->extSubset = NULL;
+		    }
+		} else {
+
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+		    xsltGetHTMLIDs(version, &doctypePublic, &doctypeSystem);
+#endif
+		    res = htmlNewDoc(doctypeSystem, doctypePublic);
+		}
+            }
+            if (res == NULL)
+                goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+
+#ifdef WITH_XSLT_DEBUG
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"reusing transformation dict for output\n");
+#endif
+        } else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) {
+	    xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
+		"xsltApplyStylesheetInternal: unsupported method xhtml, using html\n",
+		style->method);
+            ctxt->type = XSLT_OUTPUT_HTML;
+            res = htmlNewDoc(doctypeSystem, doctypePublic);
+            if (res == NULL)
+                goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+
+#ifdef WITH_XSLT_DEBUG
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"reusing transformation dict for output\n");
+#endif
+        } else if (xmlStrEqual(method, (const xmlChar *) "text")) {
+            ctxt->type = XSLT_OUTPUT_TEXT;
+            res = xmlNewDoc(style->version);
+            if (res == NULL)
+                goto error;
+	    res->dict = ctxt->dict;
+	    xmlDictReference(res->dict);
+
+#ifdef WITH_XSLT_DEBUG
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"reusing transformation dict for output\n");
+#endif
+        } else {
+	    xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
+		"xsltApplyStylesheetInternal: unsupported method %s\n",
+		style->method);
+            goto error;
+        }
+    } else {
+        ctxt->type = XSLT_OUTPUT_XML;
+        res = xmlNewDoc(style->version);
+        if (res == NULL)
+            goto error;
+	res->dict = ctxt->dict;
+	xmlDictReference(ctxt->dict);
+#ifdef WITH_XSLT_DEBUG
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "reusing transformation dict for output\n");
+#endif
+    }
+    res->charset = XML_CHAR_ENCODING_UTF8;
+    if (style->encoding != NULL)
+        res->encoding = xmlStrdup(style->encoding);
+    variables = style->variables;
+
+    /*
+     * Start the evaluation, evaluate the params, the stylesheets globals
+     * and start by processing the top node.
+     */
+    if (xsltNeedElemSpaceHandling(ctxt))
+	xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc));    
+    /*
+    * Evaluate global params and user-provided params.
+    */
+    ctxt->node = (xmlNodePtr) doc;
+    if (ctxt->globalVars == NULL)
+	ctxt->globalVars = xmlHashCreate(20);
+    if (params != NULL) {	
+        xsltEvalUserParams(ctxt, params);
+    }
+
+    /* need to be called before evaluating global variables */
+    xsltCountKeys(ctxt);
+
+    xsltEvalGlobalVariables(ctxt);
+
+    ctxt->node = (xmlNodePtr) doc;
+    ctxt->output = res;
+    ctxt->insert = (xmlNodePtr) res;
+    ctxt->varsBase = ctxt->varsNr - 1;
+
+    ctxt->xpathCtxt->contextSize = 1;
+    ctxt->xpathCtxt->proximityPosition = 1;
+    ctxt->xpathCtxt->node = NULL; /* TODO: Set the context node here? */
+    /*
+    * Start processing the source tree -----------------------------------
+    */
+    xsltProcessOneNode(ctxt, ctxt->node, NULL);
+    /*
+    * Remove all remaining vars from the stack.
+    */
+    xsltLocalVariablePop(ctxt, 0, -2);
+    xsltShutdownCtxtExts(ctxt);
+
+    xsltCleanupTemplates(style); /* TODO: <- style should be read only */
+
+    /*
+     * Now cleanup our variables so stylesheet can be re-used
+     *
+     * TODO: this is not needed anymore global variables are copied
+     *       and not evaluated directly anymore, keep this as a check
+     */
+    if (style->variables != variables) {
+        vptr = style->variables;
+        while (vptr->next != variables)
+            vptr = vptr->next;
+        vptr->next = NULL;
+        xsltFreeStackElemList(style->variables);
+        style->variables = variables;
+    }
+    vptr = style->variables;
+    while (vptr != NULL) {
+        if (vptr->computed) {
+            if (vptr->value != NULL) {
+                xmlXPathFreeObject(vptr->value);
+                vptr->value = NULL;
+                vptr->computed = 0;
+            }
+        }
+        vptr = vptr->next;
+    }
+#if 0
+    /*
+     * code disabled by wmb; awaiting kb's review
+     * problem is that global variable(s) may contain xpath objects
+     * from doc associated with RVT, so can't be freed at this point.
+     * xsltFreeTransformContext includes a call to xsltFreeRVTs, so
+     * I assume this shouldn't be required at this point.
+     */
+    /*
+    * Free all remaining tree fragments.
+    */
+    xsltFreeRVTs(ctxt);
+#endif
+    /*
+     * Do some post processing work depending on the generated output
+     */
+    root = xmlDocGetRootElement(res);
+    if (root != NULL) {
+        const xmlChar *doctype = NULL;
+
+        if ((root->ns != NULL) && (root->ns->prefix != NULL))
+	    doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name);
+	if (doctype == NULL)
+	    doctype = root->name;
+
+        /*
+         * Apply the default selection of the method
+         */
+        if ((method == NULL) &&
+            (root->ns == NULL) &&
+            (!xmlStrcasecmp(root->name, (const xmlChar *) "html"))) {
+            xmlNodePtr tmp;
+
+            tmp = res->children;
+            while ((tmp != NULL) && (tmp != root)) {
+                if (tmp->type == XML_ELEMENT_NODE)
+                    break;
+                if ((tmp->type == XML_TEXT_NODE) && (!xmlIsBlankNode(tmp)))
+                    break;
+		tmp = tmp->next;
+            }
+            if (tmp == root) {
+                ctxt->type = XSLT_OUTPUT_HTML;
+		/*
+		* REVISIT TODO: XML_HTML_DOCUMENT_NODE is set after the
+		*  transformation on the doc, but functions like
+		*/
+                res->type = XML_HTML_DOCUMENT_NODE;
+                if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+                    res->intSubset = xmlCreateIntSubset(res, doctype,
+                                                        doctypePublic,
+                                                        doctypeSystem);
+#ifdef XSLT_GENERATE_HTML_DOCTYPE
+		} else if (version != NULL) {
+                    xsltGetHTMLIDs(version, &doctypePublic,
+                                   &doctypeSystem);
+                    if (((doctypePublic != NULL) || (doctypeSystem != NULL)))
+                        res->intSubset =
+                            xmlCreateIntSubset(res, doctype,
+                                               doctypePublic,
+                                               doctypeSystem);
+#endif
+                }
+            }
+
+        }
+        if (ctxt->type == XSLT_OUTPUT_XML) {
+            XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
+            XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
+            if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+	        xmlNodePtr last;
+		/* Need a small "hack" here to assure DTD comes before
+		   possible comment nodes */
+		node = res->children;
+		last = res->last;
+		res->children = NULL;
+		res->last = NULL;
+                res->intSubset = xmlCreateIntSubset(res, doctype,
+                                                    doctypePublic,
+                                                    doctypeSystem);
+		if (res->children != NULL) {
+		    res->children->next = node;
+		    node->prev = res->children;
+		    res->last = last;
+		} else {
+		    res->children = node;
+		    res->last = last;
+		}
+	    }
+        }
+    }
+    xmlXPathFreeNodeSet(ctxt->nodeList);
+    if (profile != NULL) {
+        xsltSaveProfiling(ctxt, profile);
+    }
+
+    /*
+     * Be pedantic.
+     */
+    if ((ctxt != NULL) && (ctxt->state == XSLT_STATE_ERROR)) {
+	xmlFreeDoc(res);
+	res = NULL;
+    }
+    if ((res != NULL) && (ctxt != NULL) && (output != NULL)) {
+	int ret;
+
+	ret = xsltCheckWrite(ctxt->sec, ctxt, (const xmlChar *) output);
+	if (ret == 0) {
+	    xsltTransformError(ctxt, NULL, NULL,
+		     "xsltApplyStylesheet: forbidden to save to %s\n",
+			       output);
+	} else if (ret < 0) {
+	    xsltTransformError(ctxt, NULL, NULL,
+		     "xsltApplyStylesheet: saving to %s may not be possible\n",
+			       output);
+	}
+    }
+
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+    printf("# Cache:\n");
+    printf("# Reused tree fragments: %d\n", ctxt->cache->dbgReusedRVTs);
+    printf("# Reused variables     : %d\n", ctxt->cache->dbgReusedVars);
+#endif
+
+    if ((ctxt != NULL) && (userCtxt == NULL))
+	xsltFreeTransformContext(ctxt);
+
+    return (res);
+
+error:
+    if (res != NULL)
+        xmlFreeDoc(res);
+
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+    printf("# Cache:\n");
+    printf("# Reused tree fragments: %d\n", ctxt->cache->dbgReusedRVTs);
+    printf("# Reused variables     : %d\n", ctxt->cache->dbgReusedVars);
+#endif
+
+    if ((ctxt != NULL) && (userCtxt == NULL))
+        xsltFreeTransformContext(ctxt);
+    return (NULL);
+}
+
+/**
+ * xsltApplyStylesheet:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated arry of parameters names/values tuples
+ *
+ * Apply the stylesheet to the document
+ * NOTE: This may lead to a non-wellformed output XML wise !
+ *
+ * Returns the result document or NULL in case of error
+ */
+xmlDocPtr
+xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
+                    const char **params)
+{
+    return (xsltApplyStylesheetInternal(style, doc, params, NULL, NULL, NULL));
+}
+
+/**
+ * xsltProfileStylesheet:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated arry of parameters names/values tuples
+ * @output:  a FILE * for the profiling output
+ *
+ * Apply the stylesheet to the document and dump the profiling to
+ * the given output.
+ *
+ * Returns the result document or NULL in case of error
+ */
+xmlDocPtr
+xsltProfileStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
+                      const char **params, FILE * output)
+{
+    xmlDocPtr res;
+
+    res = xsltApplyStylesheetInternal(style, doc, params, NULL, output, NULL);
+    return (res);
+}
+
+/**
+ * xsltApplyStylesheetUser:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated array of parameters names/values tuples
+ * @output:  the targetted output
+ * @profile:  profile FILE * output or NULL
+ * @userCtxt:  user provided transform context
+ *
+ * Apply the stylesheet to the document and allow the user to provide
+ * its own transformation context.
+ *
+ * Returns the result document or NULL in case of error
+ */
+xmlDocPtr
+xsltApplyStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc,
+                            const char **params, const char *output,
+                            FILE * profile, xsltTransformContextPtr userCtxt)
+{
+    xmlDocPtr res;
+
+    res = xsltApplyStylesheetInternal(style, doc, params, output,
+	                              profile, userCtxt);
+    return (res);
+}
+
+/**
+ * xsltRunStylesheetUser:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated array of parameters names/values tuples
+ * @output:  the URL/filename ot the generated resource if available
+ * @SAX:  a SAX handler for progressive callback output (not implemented yet)
+ * @IObuf:  an output buffer for progressive output (not implemented yet)
+ * @profile:  profile FILE * output or NULL
+ * @userCtxt:  user provided transform context
+ *
+ * Apply the stylesheet to the document and generate the output according
+ * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf.
+ *
+ * NOTE: This may lead to a non-wellformed output XML wise !
+ * NOTE: This may also result in multiple files being generated
+ * NOTE: using IObuf, the result encoding used will be the one used for
+ *       creating the output buffer, use the following macro to read it
+ *       from the stylesheet
+ *       XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+ * NOTE: using SAX, any encoding specified in the stylesheet will be lost
+ *       since the interface uses only UTF8
+ *
+ * Returns the number of by written to the main resource or -1 in case of
+ *         error.
+ */
+int
+xsltRunStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc,
+                  const char **params, const char *output,
+                  xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf,
+		  FILE * profile, xsltTransformContextPtr userCtxt)
+{
+    xmlDocPtr tmp;
+    int ret;
+
+    if ((output == NULL) && (SAX == NULL) && (IObuf == NULL))
+        return (-1);
+    if ((SAX != NULL) && (IObuf != NULL))
+        return (-1);
+
+    /* unsupported yet */
+    if (SAX != NULL) {
+        XSLT_TODO   /* xsltRunStylesheet xmlSAXHandlerPtr SAX */
+	return (-1);
+    }
+
+    tmp = xsltApplyStylesheetInternal(style, doc, params, output, profile,
+	                              userCtxt);
+    if (tmp == NULL) {
+	xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
+                         "xsltRunStylesheet : run failed\n");
+        return (-1);
+    }
+    if (IObuf != NULL) {
+        /* TODO: incomplete, IObuf output not progressive */
+        ret = xsltSaveResultTo(IObuf, tmp, style);
+    } else {
+        ret = xsltSaveResultToFilename(output, tmp, style, 0);
+    }
+    xmlFreeDoc(tmp);
+    return (ret);
+}
+
+/**
+ * xsltRunStylesheet:
+ * @style:  a parsed XSLT stylesheet
+ * @doc:  a parsed XML document
+ * @params:  a NULL terminated array of parameters names/values tuples
+ * @output:  the URL/filename ot the generated resource if available
+ * @SAX:  a SAX handler for progressive callback output (not implemented yet)
+ * @IObuf:  an output buffer for progressive output (not implemented yet)
+ *
+ * Apply the stylesheet to the document and generate the output according
+ * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf.
+ *
+ * NOTE: This may lead to a non-wellformed output XML wise !
+ * NOTE: This may also result in multiple files being generated
+ * NOTE: using IObuf, the result encoding used will be the one used for
+ *       creating the output buffer, use the following macro to read it
+ *       from the stylesheet
+ *       XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+ * NOTE: using SAX, any encoding specified in the stylesheet will be lost
+ *       since the interface uses only UTF8
+ *
+ * Returns the number of bytes written to the main resource or -1 in case of
+ *         error.
+ */
+int
+xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc,
+                  const char **params, const char *output,
+                  xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf)
+{
+    return(xsltRunStylesheetUser(style, doc, params, output, SAX, IObuf,
+		                 NULL, NULL));
+}
+
+/**
+ * xsltRegisterAllElement:
+ * @ctxt:  the XPath context
+ *
+ * Registers all default XSLT elements in this context
+ */
+void
+xsltRegisterAllElement(xsltTransformContextPtr ctxt)
+{
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "apply-templates",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltApplyTemplates);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "apply-imports",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltApplyImports);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "call-template",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltCallTemplate);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "element",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltElement);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "attribute",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltAttribute);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "text",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltText);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "processing-instruction",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltProcessingInstruction);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "comment",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltComment);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "copy",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltCopy);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "value-of",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltValueOf);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "number",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltNumber);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "for-each",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltForEach);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "if",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltIf);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "choose",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltChoose);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "sort",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltSort);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "copy-of",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltCopyOf);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "message",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltMessage);
+
+    /*
+     * Those don't have callable entry points but are registered anyway
+     */
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "variable",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "param",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "with-param",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "decimal-format",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "when",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "otherwise",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+    xsltRegisterExtElement(ctxt, (const xmlChar *) "fallback",
+                           XSLT_NAMESPACE,
+			   (xsltTransformFunction) xsltDebug);
+
+}
diff --git a/third_party/libxslt/libxslt/transform.h b/third_party/libxslt/libxslt/transform.h
new file mode 100644
index 0000000..105ac2d
--- /dev/null
+++ b/third_party/libxslt/libxslt/transform.h
@@ -0,0 +1,203 @@
+/*
+ * Summary: the XSLT engine transformation part.
+ * Description: This module implements the bulk of the actual
+ *              transformation processing. Most of the xsl: element
+ *              constructs are implemented in this module.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_TRANSFORM_H__
+#define __XML_XSLT_TRANSFORM_H__
+
+#include 
+#include 
+#include "xsltexports.h"
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XInclude default processing.
+ */
+XSLTPUBFUN void XSLTCALL		
+		xsltSetXIncludeDefault	(int xinclude);
+XSLTPUBFUN int XSLTCALL		
+		xsltGetXIncludeDefault	(void);
+
+/**
+ * Export context to users.
+ */
+XSLTPUBFUN xsltTransformContextPtr XSLTCALL 
+		xsltNewTransformContext	(xsltStylesheetPtr style,
+					 xmlDocPtr doc);
+
+XSLTPUBFUN void XSLTCALL			
+		xsltFreeTransformContext(xsltTransformContextPtr ctxt);
+
+XSLTPUBFUN xmlDocPtr XSLTCALL		
+		xsltApplyStylesheetUser	(xsltStylesheetPtr style,
+					 xmlDocPtr doc,
+					 const char **params,
+					 const char *output,
+					 FILE * profile,
+					 xsltTransformContextPtr userCtxt);
+/**
+ * Private Interfaces.
+ */
+XSLTPUBFUN void XSLTCALL		
+		xsltApplyStripSpaces	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node);
+XSLTPUBFUN xmlDocPtr XSLTCALL	
+		xsltApplyStylesheet	(xsltStylesheetPtr style,
+					 xmlDocPtr doc,
+					 const char **params);
+XSLTPUBFUN xmlDocPtr XSLTCALL	
+		xsltProfileStylesheet	(xsltStylesheetPtr style,
+					 xmlDocPtr doc,
+					 const char **params,
+					 FILE * output);
+XSLTPUBFUN int XSLTCALL		
+		xsltRunStylesheet	(xsltStylesheetPtr style,
+					 xmlDocPtr doc,
+					 const char **params,
+					 const char *output,
+					 xmlSAXHandlerPtr SAX,
+					 xmlOutputBufferPtr IObuf);
+XSLTPUBFUN int XSLTCALL		
+		xsltRunStylesheetUser	(xsltStylesheetPtr style,
+					 xmlDocPtr doc,
+					 const char **params,
+					 const char *output,
+					 xmlSAXHandlerPtr SAX,
+					 xmlOutputBufferPtr IObuf,
+					 FILE * profile,
+					 xsltTransformContextPtr userCtxt);
+XSLTPUBFUN void XSLTCALL		
+		xsltApplyOneTemplate	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr node,
+					 xmlNodePtr list,
+					 xsltTemplatePtr templ,
+					 xsltStackElemPtr params);
+XSLTPUBFUN void XSLTCALL 		
+		xsltDocumentElem	(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltSort		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltCopy		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltText		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltElement		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltComment		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltAttribute		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltProcessingInstruction(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltCopyOf		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltValueOf		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltNumber		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltApplyImports	(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltCallTemplate	(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltApplyTemplates	(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltChoose		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltIf			(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL 		
+		xsltForEach		(xsltTransformContextPtr ctxt,
+	                                 xmlNodePtr node,
+					 xmlNodePtr inst,
+					 xsltStylePreCompPtr comp);
+XSLTPUBFUN void XSLTCALL		
+		xsltRegisterAllElement	(xsltTransformContextPtr ctxt);
+
+XSLTPUBFUN xmlNodePtr XSLTCALL	
+		xsltCopyTextString	(xsltTransformContextPtr ctxt,
+					 xmlNodePtr target,
+					 const xmlChar *string,
+					 int noescape);
+
+/* Following 2 functions needed for libexslt/functions.c */
+XSLTPUBFUN void XSLTCALL
+		xsltLocalVariablePop	(xsltTransformContextPtr ctxt,
+					 int limitNr,
+					 int level);
+XSLTPUBFUN int XSLTCALL
+		xsltLocalVariablePush	(xsltTransformContextPtr ctxt,
+					 xsltStackElemPtr variable,
+					 int level);
+/*
+ * Hook for the debugger if activated.
+ */
+XSLTPUBFUN void XSLTCALL		
+		xslHandleDebugger	(xmlNodePtr cur,
+					 xmlNodePtr node,
+					 xsltTemplatePtr templ,
+					 xsltTransformContextPtr ctxt);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_TRANSFORM_H__ */
+
diff --git a/third_party/libxslt/libxslt/trio.h b/third_party/libxslt/libxslt/trio.h
new file mode 100644
index 0000000..b788dc8
--- /dev/null
+++ b/third_party/libxslt/libxslt/trio.h
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * $Id: trio.h 897 2003-04-07 12:41:56Z veillard $
+ *
+ * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
+ *
+ *************************************************************************
+ *
+ * http://ctrio.sourceforge.net/
+ *
+ ************************************************************************/
+
+#ifndef TRIO_TRIO_H
+#define TRIO_TRIO_H
+
+#if !defined(WITHOUT_TRIO)
+
+/*
+ * Use autoconf defines if present. Packages using trio must define
+ * HAVE_CONFIG_H as a compiler option themselves.
+ */
+#if defined(HAVE_CONFIG_H)
+# include 
+#endif
+
+#include "triodef.h"
+
+#include 
+#include 
+#if defined(TRIO_COMPILER_ANCIENT)
+# include 
+#else
+# include 
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Error codes.
+ *
+ * Remember to add a textual description to trio_strerror.
+ */
+enum {
+  TRIO_EOF      = 1,
+  TRIO_EINVAL   = 2,
+  TRIO_ETOOMANY = 3,
+  TRIO_EDBLREF  = 4,
+  TRIO_EGAP     = 5,
+  TRIO_ENOMEM   = 6,
+  TRIO_ERANGE   = 7,
+  TRIO_ERRNO    = 8,
+  TRIO_ECUSTOM  = 9
+};
+
+/* Error macros */
+#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
+#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
+#define TRIO_ERROR_NAME(x) trio_strerror(x)
+
+typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int));
+typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t));
+
+TRIO_CONST char *trio_strerror TRIO_PROTO((int));
+
+/*************************************************************************
+ * Print Functions
+ */
+
+int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...));
+int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
+int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args));
+
+int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
+int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
+int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
+
+int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
+int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
+int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
+
+int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
+			     TRIO_CONST char *format, ...));
+int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
+			      TRIO_CONST char *format, va_list args));
+int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure,
+			      TRIO_CONST char *format, void **args));
+
+int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...));
+int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args));
+int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args));
+
+int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
+int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
+		   va_list args));
+int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
+		   void **args));
+
+int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...));
+int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format,
+                      va_list args));
+
+char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...));
+char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args));
+
+int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...));
+int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args));
+
+/*************************************************************************
+ * Scan Functions
+ */
+int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...));
+int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args));
+int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args));
+
+int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...));
+int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args));
+int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args));
+
+int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...));
+int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args));
+int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args));
+
+int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
+			    TRIO_CONST char *format, ...));
+int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
+			     TRIO_CONST char *format, va_list args));
+int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure,
+			     TRIO_CONST char *format, void **args));
+
+int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...));
+int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args));
+int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args));
+
+/*************************************************************************
+ * Locale Functions
+ */
+void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint));
+void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator));
+void trio_locale_set_grouping TRIO_PROTO((char *grouping));
+
+/*************************************************************************
+ * Renaming
+ */
+#ifdef TRIO_REPLACE_STDIO
+/* Replace the  functions */
+#ifndef HAVE_PRINTF
+# define printf trio_printf
+#endif
+#ifndef HAVE_VPRINTF
+# define vprintf trio_vprintf
+#endif
+#ifndef HAVE_FPRINTF
+# define fprintf trio_fprintf
+#endif
+#ifndef HAVE_VFPRINTF
+# define vfprintf trio_vfprintf
+#endif
+#ifndef HAVE_SPRINTF
+# define sprintf trio_sprintf
+#endif
+#ifndef HAVE_VSPRINTF
+# define vsprintf trio_vsprintf
+#endif
+#ifndef HAVE_SNPRINTF
+# define snprintf trio_snprintf
+#endif
+#ifndef HAVE_VSNPRINTF
+# define vsnprintf trio_vsnprintf
+#endif
+#ifndef HAVE_SCANF
+# define scanf trio_scanf
+#endif
+#ifndef HAVE_VSCANF
+# define vscanf trio_vscanf
+#endif
+#ifndef HAVE_FSCANF
+# define fscanf trio_fscanf
+#endif
+#ifndef HAVE_VFSCANF
+# define vfscanf trio_vfscanf
+#endif
+#ifndef HAVE_SSCANF
+# define sscanf trio_sscanf
+#endif
+#ifndef HAVE_VSSCANF
+# define vsscanf trio_vsscanf
+#endif
+/* These aren't stdio functions, but we make them look similar */
+#define dprintf trio_dprintf
+#define vdprintf trio_vdprintf
+#define aprintf trio_aprintf
+#define vaprintf trio_vaprintf
+#define asprintf trio_asprintf
+#define vasprintf trio_vasprintf
+#define dscanf trio_dscanf
+#define vdscanf trio_vdscanf
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* WITHOUT_TRIO */
+
+#endif /* TRIO_TRIO_H */
diff --git a/third_party/libxslt/libxslt/triodef.h b/third_party/libxslt/libxslt/triodef.h
new file mode 100644
index 0000000..58c7fce
--- /dev/null
+++ b/third_party/libxslt/libxslt/triodef.h
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * $Id: triodef.h 912 2003-04-26 12:06:36Z veillard $
+ *
+ * Copyright (C) 2001 Bjorn Reese 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
+ *
+ ************************************************************************/
+
+#ifndef TRIO_TRIODEF_H
+#define TRIO_TRIODEF_H
+
+/*************************************************************************
+ * Platform and compiler support detection
+ */
+#if defined(__GNUC__)
+# define TRIO_COMPILER_GCC
+#elif defined(__SUNPRO_C)
+# define TRIO_COMPILER_SUNPRO
+#elif defined(__SUNPRO_CC)
+# define TRIO_COMPILER_SUNPRO
+# define __SUNPRO_C __SUNPRO_CC
+#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
+# define TRIO_COMPILER_XLC
+#elif defined(_AIX) && !defined(__GNUC__)
+# define TRIO_COMPILER_XLC /* Workaround for old xlc */
+#elif defined(__DECC) || defined(__DECCXX)
+# define TRIO_COMPILER_DECC
+#elif defined(__osf__) && defined(__LANGUAGE_C__)
+# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */
+#elif defined(_MSC_VER)
+# define TRIO_COMPILER_MSVC
+#elif defined(__BORLANDC__)
+# define TRIO_COMPILER_BCB
+#endif
+
+#if defined(VMS) || defined(__VMS)
+/*
+ * VMS is placed first to avoid identifying the platform as Unix
+ * based on the DECC compiler later on.
+ */
+# define TRIO_PLATFORM_VMS
+#elif defined(unix) || defined(__unix) || defined(__unix__)
+# define TRIO_PLATFORM_UNIX
+#elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
+# define TRIO_PLATFORM_UNIX
+#elif defined(TRIO_COMPILER_DECC) || defined(__osf___)
+# define TRIO_PLATFORM_UNIX
+#elif defined(__NetBSD__)
+# define TRIO_PLATFORM_UNIX
+#elif defined(__QNX__)
+# define TRIO_PLATFORM_UNIX
+# define TRIO_PLATFORM_QNX
+#elif defined(__CYGWIN__)
+# define TRIO_PLATFORM_UNIX
+#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
+# define TRIO_PLATFORM_UNIX
+#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
+# define TRIO_PLATFORM_WIN32
+#elif defined(mpeix) || defined(__mpexl)
+# define TRIO_PLATFORM_MPEIX
+#endif
+
+#if defined(_AIX)
+# define TRIO_PLATFORM_AIX
+#elif defined(__hpux)
+# define TRIO_PLATFORM_HPUX
+#elif defined(sun) || defined(__sun__)
+# if defined(__SVR4) || defined(__svr4__)
+#  define TRIO_PLATFORM_SOLARIS
+# else
+#  define TRIO_PLATFORM_SUNOS
+# endif
+#endif
+
+#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB)
+# define TRIO_COMPILER_SUPPORTS_C89
+# if defined(__STDC_VERSION__)
+#  define TRIO_COMPILER_SUPPORTS_C90
+#  if (__STDC_VERSION__ >= 199409L)
+#   define TRIO_COMPILER_SUPPORTS_C94
+#  endif
+#  if (__STDC_VERSION__ >= 199901L)
+#   define TRIO_COMPILER_SUPPORTS_C99
+#  endif
+# elif defined(TRIO_COMPILER_SUNPRO)
+#  if (__SUNPRO_C >= 0x420)
+#   define TRIO_COMPILER_SUPPORTS_C94
+#  endif
+# endif
+#endif
+
+#if defined(_XOPEN_SOURCE)
+# if defined(_XOPEN_SOURCE_EXTENDED)
+#  define TRIO_COMPILER_SUPPORTS_UNIX95
+# endif
+# if (_XOPEN_VERSION >= 500)
+#  define TRIO_COMPILER_SUPPORTS_UNIX98
+# endif
+# if (_XOPEN_VERSION >= 600)
+#  define TRIO_COMPILER_SUPPORTS_UNIX01
+# endif
+#endif
+
+/*************************************************************************
+ * Generic defines
+ */
+
+#if !defined(TRIO_PUBLIC)
+# define TRIO_PUBLIC
+#endif
+#if !defined(TRIO_PRIVATE)
+# define TRIO_PRIVATE static
+#endif
+
+#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus))
+# define TRIO_COMPILER_ANCIENT
+#endif
+
+#if defined(TRIO_COMPILER_ANCIENT)
+# define TRIO_CONST
+# define TRIO_VOLATILE
+# define TRIO_SIGNED
+typedef double trio_long_double_t;
+typedef char * trio_pointer_t;
+# define TRIO_SUFFIX_LONG(x) x
+# define TRIO_PROTO(x) ()
+# define TRIO_NOARGS
+# define TRIO_ARGS1(list,a1) list a1;
+# define TRIO_ARGS2(list,a1,a2) list a1; a2;
+# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3;
+# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4;
+# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5;
+# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6;
+# define TRIO_VARGS2(list,a1,a2) list a1; a2
+# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3
+# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4
+# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5
+# define TRIO_VA_DECL va_dcl
+# define TRIO_VA_START(x,y) va_start(x)
+# define TRIO_VA_END(x) va_end(x)
+#else /* ANSI C */
+# define TRIO_CONST const
+# define TRIO_VOLATILE volatile
+# define TRIO_SIGNED signed
+typedef long double trio_long_double_t;
+typedef void * trio_pointer_t;
+# define TRIO_SUFFIX_LONG(x) x ## L
+# define TRIO_PROTO(x) x
+# define TRIO_NOARGS void
+# define TRIO_ARGS1(list,a1) (a1)
+# define TRIO_ARGS2(list,a1,a2) (a1,a2)
+# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3)
+# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4)
+# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5)
+# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6)
+# define TRIO_VARGS2 TRIO_ARGS2
+# define TRIO_VARGS3 TRIO_ARGS3
+# define TRIO_VARGS4 TRIO_ARGS4
+# define TRIO_VARGS5 TRIO_ARGS5
+# define TRIO_VA_DECL ...
+# define TRIO_VA_START(x,y) va_start(x,y)
+# define TRIO_VA_END(x) va_end(x)
+#endif
+
+#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
+# define TRIO_INLINE inline
+#elif defined(TRIO_COMPILER_GCC)
+# define TRIO_INLINE __inline__
+#elif defined(TRIO_COMPILER_MSVC)
+# define TRIO_INLINE _inline
+#elif defined(TRIO_COMPILER_BCB)
+# define TRIO_INLINE __inline
+#else
+# define TRIO_INLINE
+#endif
+
+/*************************************************************************
+ * Workarounds
+ */
+
+#if defined(TRIO_PLATFORM_VMS)
+/*
+ * Computations done with constants at compile time can trigger these
+ * even when compiling with IEEE enabled.
+ */
+# pragma message disable (UNDERFLOW, FLOATOVERFL)
+
+# if (__CRTL_VER < 80000000)
+/*
+ * Although the compiler supports C99 language constructs, the C
+ * run-time library does not contain all C99 functions.
+ *
+ * This was the case for 70300022. Update the 80000000 value when
+ * it has been accurately determined what version of the library
+ * supports C99.
+ */
+#  if defined(TRIO_COMPILER_SUPPORTS_C99)
+#   undef TRIO_COMPILER_SUPPORTS_C99
+#  endif
+# endif
+#endif
+
+/*
+ * Not all preprocessors supports the LL token.
+ */
+#if defined(TRIO_COMPILER_BCB)
+#else
+# define TRIO_COMPILER_SUPPORTS_LL
+#endif
+
+#endif /* TRIO_TRIODEF_H */
diff --git a/third_party/libxslt/libxslt/variables.c b/third_party/libxslt/libxslt/variables.c
new file mode 100644
index 0000000..1cdfa80
--- /dev/null
+++ b/third_party/libxslt/libxslt/variables.c
@@ -0,0 +1,2308 @@
+/*
+ * variables.c: Implementation of the variable storage and lookup
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "variables.h"
+#include "transform.h"
+#include "imports.h"
+#include "preproc.h"
+#include "keys.h"
+
+#ifdef WITH_XSLT_DEBUG
+ #define WITH_XSLT_DEBUG_VARIABLE
+#endif
+
+#ifdef XSLT_REFACTORED
+const xmlChar *xsltDocFragFake = (const xmlChar *) " fake node libxslt";
+#endif
+
+const xmlChar *xsltComputingGlobalVarMarker =
+ (const xmlChar *) " var/param being computed";
+
+/************************************************************************
+ *									*
+ *  Result Value Tree (Result Tree Fragment) interfaces			*
+ *									*
+ ************************************************************************/
+/**
+ * xsltCreateRVT:
+ * @ctxt:  an XSLT transformation context
+ *
+ * Creates a Result Value Tree
+ * (the XSLT 1.0 term for this is "Result Tree Fragment") 
+ *
+ * Returns the result value tree or NULL in case of API or internal errors.
+ */
+xmlDocPtr
+xsltCreateRVT(xsltTransformContextPtr ctxt)
+{
+    xmlDocPtr container;
+
+    /*
+    * Question: Why is this function public?
+    * Answer: It is called by the EXSLT module.
+    */    
+    if (ctxt == NULL)
+	return(NULL);
+
+    /*
+    * Reuse a RTF from the cache if available.
+    */
+    if (ctxt->cache->RVT) {
+	container = ctxt->cache->RVT;
+	ctxt->cache->RVT = (xmlDocPtr) container->next;
+	/* clear the internal pointers */
+	container->next = NULL;
+	container->prev = NULL;
+	if (ctxt->cache->nbRVT > 0)
+	    ctxt->cache->nbRVT--;
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+	ctxt->cache->dbgReusedRVTs++;
+#endif
+	return(container);
+    }
+
+    container = xmlNewDoc(NULL);
+    if (container == NULL)
+	return(NULL);
+    container->dict = ctxt->dict;
+    xmlDictReference(container->dict);
+    XSLT_MARK_RES_TREE_FRAG(container);
+    container->doc = container;
+    container->parent = NULL;
+    return(container);
+}
+
+/**
+ * xsltRegisterTmpRVT:
+ * @ctxt:  an XSLT transformation context
+ * @RVT:  a result value tree (Result Tree Fragment)
+ *
+ * Registers the result value tree (XSLT 1.0 term: Result Tree Fragment)
+ * in the garbage collector.
+ * The fragment will be freed at the exit of the currently
+ * instantiated xsl:template.
+ * Obsolete; this function might produce massive memory overhead,
+ * since the fragment is only freed when the current xsl:template
+ * exits. Use xsltRegisterLocalRVT() instead.
+ *
+ * Returns 0 in case of success and -1 in case of API or internal errors.
+ */
+int
+xsltRegisterTmpRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
+{
+    if ((ctxt == NULL) || (RVT == NULL))
+	return(-1);
+
+    /*
+    * We'll restrict the lifetime of user-created fragments
+    * insinde an xsl:variable and xsl:param to the lifetime of the
+    * var/param itself.
+    */
+    if (ctxt->contextVariable != NULL) {
+	RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment;
+	XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT;
+	return(0);
+    }
+
+    RVT->next = (xmlNodePtr) ctxt->tmpRVT;
+    if (ctxt->tmpRVT != NULL)
+	ctxt->tmpRVT->prev = (xmlNodePtr) RVT;
+    ctxt->tmpRVT = RVT;
+    return(0);
+}
+
+/**
+ * xsltRegisterLocalRVT:
+ * @ctxt:  an XSLT transformation context
+ * @RVT:  a result value tree (Result Tree Fragment; xmlDocPtr)
+ *
+ * Registers a result value tree (XSLT 1.0 term: Result Tree Fragment)
+ * in the RVT garbage collector.
+ * The fragment will be freed when the instruction which created the
+ * fragment exits.
+ *
+ * Returns 0 in case of success and -1 in case of API or internal errors.
+ */
+int
+xsltRegisterLocalRVT(xsltTransformContextPtr ctxt,
+		     xmlDocPtr RVT)
+{
+    if ((ctxt == NULL) || (RVT == NULL))
+	return(-1);
+    
+    /*
+    * When evaluating "select" expressions of xsl:variable
+    * and xsl:param, we need to bind newly created tree fragments
+    * to the variable itself; otherwise the tragment will be
+    * freed before we leave the scope of a var.
+    */
+    if ((ctxt->contextVariable != NULL) &&
+	(XSLT_TCTXT_VARIABLE(ctxt)->flags & XSLT_VAR_IN_SELECT))
+    {
+	RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment;
+	XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT;
+	return(0);
+    }
+    /*
+    * Store the fragment in the scope of the current instruction.
+    * If not reference by a returning instruction (like EXSLT's function),
+    * then this fragment will be freed, when the instruction exits.
+    */
+    RVT->next = (xmlNodePtr) ctxt->localRVT;
+    if (ctxt->localRVT != NULL)
+	ctxt->localRVT->prev = (xmlNodePtr) RVT;
+    ctxt->localRVT = RVT;
+    /*
+    * We need to keep track of the first registered fragment
+    * for extension instructions which return fragments
+    * (e.g. EXSLT'S function), in order to let
+    * xsltExtensionInstructionResultFinalize() clear the
+    * preserving flag on the fragments.
+    */
+    if (ctxt->localRVTBase == NULL)
+	ctxt->localRVTBase = RVT;
+    return(0);
+}
+
+/**
+ * xsltExtensionInstructionResultFinalize:
+ * @ctxt:  an XSLT transformation context
+ *
+ * Finalizes the data (e.g. result tree fragments) created
+ * within a value-returning process (e.g. EXSLT's function).
+ * Tree fragments marked as being returned by a function are
+ * set to normal state, which means that the fragment garbage
+ * collector will free them after the function-calling process exits.
+ *
+ * Returns 0 in case of success and -1 in case of API or internal errors.
+ */
+int
+xsltExtensionInstructionResultFinalize(xsltTransformContextPtr ctxt)
+{
+    xmlDocPtr cur;
+
+    if (ctxt == NULL)
+	return(-1);
+    if (ctxt->localRVTBase == NULL)
+	return(0);
+    /*
+    * Enable remaining local tree fragments to be freed
+    * by the fragment garbage collector.
+    */
+    cur = ctxt->localRVTBase;
+    do {
+	cur->psvi = NULL;
+	cur = (xmlDocPtr) cur->next;
+    } while (cur != NULL);
+    return(0);
+}
+
+/**
+ * xsltExtensionInstructionResultRegister:
+ * @ctxt: an XSLT transformation context
+ * @obj: an XPath object to be inspected for result tree fragments
+ *
+ * Marks the result of a value-returning extension instruction
+ * in order to avoid it being garbage collected before the
+ * extension instruction exits.
+ * Note that one still has to additionally register any newly created
+ * tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT().
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+xsltExtensionInstructionResultRegister(xsltTransformContextPtr ctxt,
+				       xmlXPathObjectPtr obj)
+{
+    int i;
+    xmlNodePtr cur;
+    xmlDocPtr doc;
+
+    if ((ctxt == NULL) || (obj == NULL))
+	return(-1);
+
+    /*
+    * OPTIMIZE TODO: If no local variables/params and no local tree
+    * fragments were created, then we don't need to analyse the XPath
+    * objects for tree fragments.
+    */
+
+    if ((obj->type != XPATH_NODESET) && (obj->type != XPATH_XSLT_TREE))
+	return(0);
+    if ((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr == 0))
+	return(0);
+
+    for (i = 0; i < obj->nodesetval->nodeNr; i++) {
+	cur = obj->nodesetval->nodeTab[i];
+	if (cur->type == XML_NAMESPACE_DECL) {
+	    /*
+	    * The XPath module sets the owner element of a ns-node on
+	    * the ns->next field.
+	    */
+	    if ((((xmlNsPtr) cur)->next != NULL) &&
+		(((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE))
+	    {
+		cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
+		doc = cur->doc;	
+	    } else {
+		xsltTransformError(ctxt, NULL, ctxt->inst,
+		    "Internal error in "
+		    "xsltExtensionInstructionResultRegister(): "
+		    "Cannot retrieve the doc of a namespace node.\n");
+		goto error;
+	    }
+	} else {
+	    doc = cur->doc;
+	}
+	if (doc == NULL) {
+	    xsltTransformError(ctxt, NULL, ctxt->inst,
+		"Internal error in "
+		"xsltExtensionInstructionResultRegister(): "
+		"Cannot retrieve the doc of a node.\n");
+	    goto error;
+	}
+	if (doc->name && (doc->name[0] == ' ')) {
+	    /*
+	    * This is a result tree fragment.
+	    * We'll use the @psvi field for reference counting.
+	    * TODO: How do we know if this is a value of a
+	    *  global variable or a doc acquired via the
+	    *  document() function?
+	    */
+	    doc->psvi = (void *) ((long) 1);
+	}
+    }
+
+    return(0);
+error:
+    return(-1);
+}
+
+/**
+ * xsltReleaseRVT:
+ * @ctxt:  an XSLT transformation context
+ * @RVT:  a result value tree (Result Tree Fragment)
+ *
+ * Either frees the RVT (which is an xmlDoc) or stores
+ * it in the context's cache for later reuse.
+ */
+void
+xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
+{
+    if (RVT == NULL)
+	return;
+
+    if (ctxt && (ctxt->cache->nbRVT < 40)) {
+	/*
+	* Store the Result Tree Fragment.
+	* Free the document info.
+	*/
+	if (RVT->_private != NULL) {
+	    xsltFreeDocumentKeys((xsltDocumentPtr) RVT->_private);
+	    xmlFree(RVT->_private);
+	    RVT->_private = NULL;
+	}
+	/*
+	* Clear the document tree.
+	* REVISIT TODO: Do we expect ID/IDREF tables to be existent?	
+	*/
+	if (RVT->children != NULL) {
+	    xmlFreeNodeList(RVT->children);
+	    RVT->children = NULL;
+	    RVT->last = NULL;
+	}
+	if (RVT->ids != NULL) {
+	    xmlFreeIDTable((xmlIDTablePtr) RVT->ids);
+	    RVT->ids = NULL;
+	}
+	if (RVT->refs != NULL) {
+	    xmlFreeRefTable((xmlRefTablePtr) RVT->refs);
+	    RVT->refs = NULL;
+	}
+
+	/*
+	* Reset the reference counter.
+	*/
+	RVT->psvi = 0;
+
+	RVT->next = (xmlNodePtr) ctxt->cache->RVT;
+	ctxt->cache->RVT = RVT;
+
+	ctxt->cache->nbRVT++;
+
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+	ctxt->cache->dbgCachedRVTs++;
+#endif
+	return;
+    }
+    /*
+    * Free it.
+    */
+    if (RVT->_private != NULL) {
+	xsltFreeDocumentKeys((xsltDocumentPtr) RVT->_private);
+	xmlFree(RVT->_private);
+    }
+    xmlFreeDoc(RVT);
+}
+
+/**
+ * xsltRegisterPersistRVT:
+ * @ctxt:  an XSLT transformation context
+ * @RVT:  a result value tree (Result Tree Fragment)
+ *
+ * Register the result value tree (XSLT 1.0 term: Result Tree Fragment)
+ * in the fragment garbage collector.
+ * The fragment will be freed when the transformation context is
+ * freed.
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+xsltRegisterPersistRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
+{
+    if ((ctxt == NULL) || (RVT == NULL)) return(-1);
+
+    RVT->next = (xmlNodePtr) ctxt->persistRVT;
+    if (ctxt->persistRVT != NULL)
+	ctxt->persistRVT->prev = (xmlNodePtr) RVT;
+    ctxt->persistRVT = RVT;
+    return(0);
+}
+
+/**
+ * xsltFreeRVTs:
+ * @ctxt:  an XSLT transformation context
+ *
+ * Frees all registered result value trees (Result Tree Fragments)
+ * of the transformation. Internal function; should not be called
+ * by user-code.
+ */
+void
+xsltFreeRVTs(xsltTransformContextPtr ctxt)
+{
+    xmlDocPtr cur, next;
+
+    if (ctxt == NULL)
+	return;
+    /*
+    * Local fragments.
+    */
+    cur = ctxt->localRVT;
+    while (cur != NULL) {
+        next = (xmlDocPtr) cur->next;
+	if (cur->_private != NULL) {
+	    xsltFreeDocumentKeys(cur->_private);
+	    xmlFree(cur->_private);
+	}
+	xmlFreeDoc(cur);
+	cur = next;
+    }
+    ctxt->localRVT = NULL;
+    /*
+    * User-created per-template fragments.
+    */
+    cur = ctxt->tmpRVT;
+    while (cur != NULL) {
+        next = (xmlDocPtr) cur->next;
+	if (cur->_private != NULL) {
+	    xsltFreeDocumentKeys(cur->_private);
+	    xmlFree(cur->_private);
+	}
+	xmlFreeDoc(cur);
+	cur = next;
+    }
+    ctxt->tmpRVT = NULL;
+    /*
+    * Global fragments.
+    */
+    cur = ctxt->persistRVT;
+    while (cur != NULL) {
+        next = (xmlDocPtr) cur->next;
+	if (cur->_private != NULL) {
+	    xsltFreeDocumentKeys(cur->_private);
+	    xmlFree(cur->_private);
+	}
+	xmlFreeDoc(cur);
+	cur = next;
+    }
+    ctxt->persistRVT = NULL;
+}
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltNewStackElem:
+ *
+ * Create a new XSLT ParserContext
+ *
+ * Returns the newly allocated xsltParserStackElem or NULL in case of error
+ */
+static xsltStackElemPtr
+xsltNewStackElem(xsltTransformContextPtr ctxt)
+{
+    xsltStackElemPtr ret;
+    /*
+    * Reuse a stack item from the cache if available.
+    */
+    if (ctxt && ctxt->cache->stackItems) {
+	ret = ctxt->cache->stackItems;
+	ctxt->cache->stackItems = ret->next;
+	ret->next = NULL;
+	ctxt->cache->nbStackItems--;
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+	ctxt->cache->dbgReusedVars++;
+#endif
+	return(ret);
+    }
+    ret = (xsltStackElemPtr) xmlMalloc(sizeof(xsltStackElem));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewStackElem : malloc failed\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltStackElem));
+    ret->context = ctxt;
+    return(ret);
+}
+
+/**
+ * xsltCopyStackElem:
+ * @elem:  an XSLT stack element
+ *
+ * Makes a copy of the stack element
+ *
+ * Returns the copy of NULL
+ */
+static xsltStackElemPtr
+xsltCopyStackElem(xsltStackElemPtr elem) {
+    xsltStackElemPtr cur;
+
+    cur = (xsltStackElemPtr) xmlMalloc(sizeof(xsltStackElem));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltCopyStackElem : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltStackElem));
+    cur->context = elem->context;
+    cur->name = elem->name;
+    cur->nameURI = elem->nameURI;
+    cur->select = elem->select;
+    cur->tree = elem->tree;
+    cur->comp = elem->comp;    
+    return(cur);
+}
+
+/**
+ * xsltFreeStackElem:
+ * @elem:  an XSLT stack element
+ *
+ * Free up the memory allocated by @elem
+ */
+static void
+xsltFreeStackElem(xsltStackElemPtr elem) {
+    if (elem == NULL)
+	return;
+    if (elem->value != NULL)
+	xmlXPathFreeObject(elem->value);
+    /*
+    * Release the list of temporary Result Tree Fragments.
+    */
+    if (elem->fragment) {
+	xmlDocPtr cur;
+
+	while (elem->fragment != NULL) {
+	    cur = elem->fragment;
+	    elem->fragment = (xmlDocPtr) cur->next;
+
+	    if (elem->context &&
+		(cur->psvi == (void *) ((long) 1)))
+	    {
+		/*
+		* This fragment is a result of an extension instruction
+		* (e.g. XSLT's function) and needs to be preserved until
+		* the instruction exits.
+		* Example: The fragment of the variable must not be freed
+		*  since it is returned by the EXSLT function:
+		*  
+		*   
+		*     
+		*   
+		*   
+		*  
+		* 
+		*/
+		xsltRegisterLocalRVT(elem->context, cur);
+	    } else {
+		xsltReleaseRVT((xsltTransformContextPtr) elem->context,
+		    cur);
+	    }	    
+	}
+    }
+    /*
+    * Cache or free the variable structure.
+    */
+    if (elem->context && (elem->context->cache->nbStackItems < 50)) {
+	/*
+	* Store the item in the cache.
+	*/
+	xsltTransformContextPtr ctxt = elem->context;
+	memset(elem, 0, sizeof(xsltStackElem));
+	elem->context = ctxt;
+	elem->next = ctxt->cache->stackItems;
+	ctxt->cache->stackItems = elem;	
+	ctxt->cache->nbStackItems++;
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+	ctxt->cache->dbgCachedVars++;
+#endif
+	return;
+    }
+    xmlFree(elem);
+}
+
+/**
+ * xsltFreeStackElemList:
+ * @elem:  an XSLT stack element
+ *
+ * Free up the memory allocated by @elem
+ */
+void
+xsltFreeStackElemList(xsltStackElemPtr elem) {
+    xsltStackElemPtr next;
+    
+    while (elem != NULL) {
+	next = elem->next;
+	xsltFreeStackElem(elem);
+	elem = next;
+    }
+}
+
+/**
+ * xsltStackLookup:
+ * @ctxt:  an XSLT transformation context
+ * @name:  the local part of the name
+ * @nameURI:  the URI part of the name
+ *
+ * Locate an element in the stack based on its name.
+ */
+#if 0 /* TODO: Those seem to have been used for debugging. */
+static int stack_addr = 0;
+static int stack_cmp = 0;
+#endif
+
+static xsltStackElemPtr
+xsltStackLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
+	        const xmlChar *nameURI) {
+    int i;
+    xsltStackElemPtr cur;
+
+    if ((ctxt == NULL) || (name == NULL) || (ctxt->varsNr == 0))
+	return(NULL);
+
+    /*
+     * Do the lookup from the top of the stack, but
+     * don't use params being computed in a call-param
+     * First lookup expects the variable name and URI to
+     * come from the disctionnary and hence pointer comparison.
+     */
+    for (i = ctxt->varsNr; i > ctxt->varsBase; i--) {
+	cur = ctxt->varsTab[i-1];
+	while (cur != NULL) {
+	    if ((cur->name == name) && (cur->nameURI == nameURI)) {
+#if 0
+		stack_addr++;
+#endif
+		return(cur);
+	    }
+	    cur = cur->next;
+	}
+    }
+
+    /*
+     * Redo the lookup with interned string compares
+     * to avoid string compares.
+     */
+    name = xmlDictLookup(ctxt->dict, name, -1);
+    if (nameURI != NULL)
+        nameURI = xmlDictLookup(ctxt->dict, nameURI, -1);
+
+    for (i = ctxt->varsNr; i > ctxt->varsBase; i--) {
+	cur = ctxt->varsTab[i-1];
+	while (cur != NULL) {
+	    if ((cur->name == name) && (cur->nameURI == nameURI)) {
+#if 0
+		stack_cmp++;
+#endif
+		return(cur);
+	    }
+	    cur = cur->next;
+	}
+    }
+
+    return(NULL);
+}
+
+/**
+ * xsltCheckStackElem:
+ * @ctxt:  xn XSLT transformation context
+ * @name:  the variable name
+ * @nameURI:  the variable namespace URI
+ *
+ * Checks whether a variable or param is already defined.
+ *
+ * URGENT TODO: Checks for redefinition of vars/params should be
+ *  done only at compilation time.
+ *
+ * Returns 1 if variable is present, 2 if param is present, 3 if this
+ *         is an inherited param, 0 if not found, -1 in case of failure.
+ */
+static int
+xsltCheckStackElem(xsltTransformContextPtr ctxt, const xmlChar *name,
+	           const xmlChar *nameURI) {
+    xsltStackElemPtr cur;
+
+    if ((ctxt == NULL) || (name == NULL))
+	return(-1);
+
+    cur = xsltStackLookup(ctxt, name, nameURI);
+    if (cur == NULL)
+        return(0);
+    if (cur->comp != NULL) {
+        if (cur->comp->type == XSLT_FUNC_WITHPARAM)
+	    return(3);
+	else if (cur->comp->type == XSLT_FUNC_PARAM)
+	    return(2);
+    }
+    
+    return(1);
+}
+
+/**
+ * xsltAddStackElem:
+ * @ctxt:  xn XSLT transformation context
+ * @elem:  a stack element
+ *
+ * Push an element (or list) onto the stack.
+ * In case of a list, each member will be pushed into
+ * a seperate slot; i.e. there's always 1 stack entry for
+ * 1 stack element.
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+static int
+xsltAddStackElem(xsltTransformContextPtr ctxt, xsltStackElemPtr elem)
+{
+    if ((ctxt == NULL) || (elem == NULL))
+	return(-1);
+
+    do {
+	if (ctxt->varsMax == 0) {
+	    ctxt->varsMax = 10;
+	    ctxt->varsTab =
+		(xsltStackElemPtr *) xmlMalloc(ctxt->varsMax *
+		sizeof(ctxt->varsTab[0]));
+	    if (ctxt->varsTab == NULL) {
+		xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+		return (-1);
+	    }
+	}
+	if (ctxt->varsNr >= ctxt->varsMax) {
+	    ctxt->varsMax *= 2;
+	    ctxt->varsTab =
+		(xsltStackElemPtr *) xmlRealloc(ctxt->varsTab,
+		ctxt->varsMax *
+		sizeof(ctxt->varsTab[0]));
+	    if (ctxt->varsTab == NULL) {
+		xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+		return (-1);
+	    }
+	}
+	ctxt->varsTab[ctxt->varsNr++] = elem;
+	ctxt->vars = elem;
+	
+	elem = elem->next;
+    } while (elem != NULL);
+    
+    return(0);
+}
+
+/**
+ * xsltAddStackElemList:
+ * @ctxt:  xn XSLT transformation context
+ * @elems:  a stack element list
+ *
+ * Push an element list onto the stack.
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+int
+xsltAddStackElemList(xsltTransformContextPtr ctxt, xsltStackElemPtr elems)
+{
+    return(xsltAddStackElem(ctxt, elems));
+}
+
+/************************************************************************
+ *									*
+ *			Module interfaces				*
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltEvalVariable:
+ * @ctxt:  the XSLT transformation context
+ * @variable:  the variable or parameter item
+ * @comp: the compiled XSLT instruction
+ *
+ * Evaluate a variable value.
+ *
+ * Returns the XPath Object value or NULL in case of error
+ */
+static xmlXPathObjectPtr
+xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
+	         xsltStylePreCompPtr castedComp)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemVariablePtr comp =
+	(xsltStyleItemVariablePtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif   
+    xmlXPathObjectPtr result = NULL;
+    xmlNodePtr oldInst;
+
+    if ((ctxt == NULL) || (variable == NULL))
+	return(NULL);
+
+    /*
+    * A variable or parameter are evaluated on demand; thus the
+    * context (of XSLT and XPath) need to be temporarily adjusted and
+    * restored on exit.
+    */
+    oldInst = ctxt->inst;
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	"Evaluating variable '%s'\n", variable->name));
+#endif
+    if (variable->select != NULL) {
+	xmlXPathCompExprPtr xpExpr = NULL;
+	xmlDocPtr oldXPDoc;
+	xmlNodePtr oldXPContextNode;
+	int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+	xmlNsPtr *oldXPNamespaces;
+	xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
+	xsltStackElemPtr oldVar = ctxt->contextVariable;
+
+	if ((comp != NULL) && (comp->comp != NULL)) {
+	    xpExpr = comp->comp;
+	} else {
+	    xpExpr = xmlXPathCompile(variable->select);
+	}
+	if (xpExpr == NULL)
+	    return(NULL);
+	/*
+	* Save context states.
+	*/
+	oldXPDoc = xpctxt->doc;
+	oldXPContextNode = xpctxt->node;
+	oldXPProximityPosition = xpctxt->proximityPosition;
+	oldXPContextSize = xpctxt->contextSize;
+	oldXPNamespaces = xpctxt->namespaces;
+	oldXPNsNr = xpctxt->nsNr;
+		
+	xpctxt->node = ctxt->node;
+	/*
+	* OPTIMIZE TODO: Lame try to set the context doc.
+	*   Get rid of this somehow in xpath.c.
+	*/
+	if ((ctxt->node->type != XML_NAMESPACE_DECL) &&
+	    ctxt->node->doc)
+	    xpctxt->doc = ctxt->node->doc;
+	/*
+	* BUG TODO: The proximity position and the context size will
+	*  potentially be wrong.
+	*  Example: 
+	*  
+	*    
+	*    
+	*      
+	*    
+	*  
+	*  Here the proximity position and context size are changed
+	*  to the context of , but
+	*  the variable needs to be evaluated in the context of
+	*  .
+	*/	
+	if (comp != NULL) {
+	    
+#ifdef XSLT_REFACTORED
+	    if (comp->inScopeNs != NULL) {
+		xpctxt->namespaces = comp->inScopeNs->list;
+		xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	    } else {
+		xpctxt->namespaces = NULL;
+		xpctxt->nsNr = 0;
+	    }
+#else
+	    xpctxt->namespaces = comp->nsList;
+	    xpctxt->nsNr = comp->nsNr;
+#endif
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+
+	/*
+	* We need to mark that we are "selecting" a var's value;
+	* if any tree fragments are created inside the expression,
+	* then those need to be stored inside the variable; otherwise
+	* we'll eventually free still referenced fragments, before
+	* we leave the scope of the variable.
+	*/
+	ctxt->contextVariable = variable;	
+	variable->flags |= XSLT_VAR_IN_SELECT;	
+	
+	result = xmlXPathCompiledEval(xpExpr, xpctxt);
+
+	variable->flags ^= XSLT_VAR_IN_SELECT;
+	/*
+	* Restore Context states.
+	*/
+	ctxt->contextVariable = oldVar;
+
+	xpctxt->doc = oldXPDoc;
+	xpctxt->node = oldXPContextNode;
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->proximityPosition = oldXPProximityPosition;
+	xpctxt->namespaces = oldXPNamespaces;
+	xpctxt->nsNr = oldXPNsNr;
+
+	if ((comp == NULL) || (comp->comp == NULL))
+	    xmlXPathFreeCompExpr(xpExpr);
+	if (result == NULL) {
+	    xsltTransformError(ctxt, NULL,
+		(comp != NULL) ? comp->inst : NULL,
+		"Failed to evaluate the expression of variable '%s'.\n",
+		variable->name);
+	    ctxt->state = XSLT_STATE_STOPPED;
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+#ifdef LIBXML_DEBUG_ENABLED
+	} else {
+	    if ((xsltGenericDebugContext == stdout) ||
+		(xsltGenericDebugContext == stderr))
+		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+					result, 0);
+#endif
+#endif
+	}
+    } else {
+	if (variable->tree == NULL) {
+	    result = xmlXPathNewCString("");
+	} else {	    
+	    if (variable->tree) {
+		xmlDocPtr container;
+		xmlNodePtr oldInsert;
+		xmlDocPtr  oldOutput;
+		xsltStackElemPtr oldVar = ctxt->contextVariable;
+
+		/*
+		* Generate a result tree fragment.
+		*/
+		container = xsltCreateRVT(ctxt);
+		if (container == NULL)
+		    goto error;
+		/*
+		* NOTE: Local Result Tree Fragments of params/variables
+		* are not registered globally anymore; the life-time
+		* is not directly dependant of the param/variable itself.
+		*
+		* OLD: xsltRegisterTmpRVT(ctxt, container);
+		*/
+		/*
+		* Attach the Result Tree Fragment to the variable;
+		* when the variable is freed, it will also free 
+		* the Result Tree Fragment.
+		*/
+		variable->fragment = container;
+		
+		oldOutput = ctxt->output;
+		oldInsert = ctxt->insert;		
+		
+		ctxt->output = container;
+		ctxt->insert = (xmlNodePtr) container;
+		ctxt->contextVariable = variable;
+		/*
+		* Process the sequence constructor (variable->tree).
+		* The resulting tree will be held by @container.
+		*/
+		xsltApplyOneTemplate(ctxt, ctxt->node, variable->tree,
+		    NULL, NULL);
+
+		ctxt->contextVariable = oldVar;		
+		ctxt->insert = oldInsert;
+		ctxt->output = oldOutput;
+		
+		result = xmlXPathNewValueTree((xmlNodePtr) container);
+	    }
+	    if (result == NULL) {
+		result = xmlXPathNewCString("");
+	    } else {
+		/*
+		* Freeing is not handled there anymore.
+		* QUESTION TODO: What does the above comment mean?
+		*/
+	        result->boolval = 0; 
+	    }
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+#ifdef LIBXML_DEBUG_ENABLED
+
+	    if ((xsltGenericDebugContext == stdout) ||
+		(xsltGenericDebugContext == stderr))
+		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+					result, 0);
+#endif
+#endif
+	}
+    }
+
+error:
+    ctxt->inst = oldInst;
+    return(result);
+}
+
+/**
+ * xsltEvalGlobalVariable:
+ * @elem:  the variable or parameter
+ * @ctxt:  the XSLT transformation context
+ *
+ * Evaluates a the value of a global xsl:variable or
+ * xsl:param declaration.
+ *
+ * Returns the XPath Object value or NULL in case of error
+ */
+static xmlXPathObjectPtr
+xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
+{
+    xmlXPathObjectPtr result = NULL;
+    xmlNodePtr oldInst;
+    const xmlChar* oldVarName;
+
+#ifdef XSLT_REFACTORED
+    xsltStyleBasicItemVariablePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((ctxt == NULL) || (elem == NULL))
+	return(NULL);
+    if (elem->computed)
+	return(elem->value);
+
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	"Evaluating global variable %s\n", elem->name));
+#endif
+
+#ifdef WITH_DEBUGGER
+    if ((ctxt->debugStatus != XSLT_DEBUG_NONE) &&
+        elem->comp && elem->comp->inst)
+        xslHandleDebugger(elem->comp->inst, NULL, NULL, ctxt);
+#endif
+
+    oldInst = ctxt->inst;
+    comp = elem->comp;
+    oldVarName = elem->name;
+    elem->name = xsltComputingGlobalVarMarker;
+    /*
+    * OPTIMIZE TODO: We should consider instantiating global vars/params
+    *  on-demand. The vars/params don't need to be evaluated if never
+    *  called; and in the case of global params, if values for such params
+    *  are provided by the user.
+    */
+    if (elem->select != NULL) {		
+	xmlXPathCompExprPtr xpExpr = NULL;
+	xmlDocPtr oldXPDoc;
+	xmlNodePtr oldXPContextNode;
+	int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+	xmlNsPtr *oldXPNamespaces;
+	xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
+
+	if ((comp != NULL) && (comp->comp != NULL)) {
+	    xpExpr = comp->comp;
+	} else {
+	    xpExpr = xmlXPathCompile(elem->select);
+	}
+	if (xpExpr == NULL)
+	    goto error;
+	
+	
+	if (comp != NULL)
+	    ctxt->inst = comp->inst;
+	else
+	    ctxt->inst = NULL;
+	/*
+	* SPEC XSLT 1.0:
+	* "At top-level, the expression or template specifying the
+	*  variable value is evaluated with the same context as that used
+	*  to process the root node of the source document: the current
+	*  node is the root node of the source document and the current
+	*  node list is a list containing just the root node of the source
+	*  document."	
+	*/
+	/*
+	* Save context states.
+	*/
+	oldXPDoc = xpctxt->doc;
+	oldXPContextNode = xpctxt->node;
+	oldXPProximityPosition = xpctxt->proximityPosition;
+	oldXPContextSize = xpctxt->contextSize;
+	oldXPNamespaces = xpctxt->namespaces;
+	oldXPNsNr = xpctxt->nsNr;
+		
+	xpctxt->node = ctxt->initialContextNode;
+	xpctxt->doc = ctxt->initialContextDoc;
+	xpctxt->contextSize = 1;
+	xpctxt->proximityPosition = 1;
+		
+	if (comp != NULL) {
+	    
+#ifdef XSLT_REFACTORED
+	    if (comp->inScopeNs != NULL) {
+		xpctxt->namespaces = comp->inScopeNs->list;
+		xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+	    } else {
+		xpctxt->namespaces = NULL;
+		xpctxt->nsNr = 0;
+	    }
+#else
+	    xpctxt->namespaces = comp->nsList;
+	    xpctxt->nsNr = comp->nsNr;
+#endif
+	} else {
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;
+	}
+	
+	result = xmlXPathCompiledEval(xpExpr, xpctxt);
+
+	/*
+	* Restore Context states.
+	*/
+	xpctxt->doc = oldXPDoc;
+	xpctxt->node = oldXPContextNode;
+	xpctxt->contextSize = oldXPContextSize;
+	xpctxt->proximityPosition = oldXPProximityPosition;
+	xpctxt->namespaces = oldXPNamespaces;
+	xpctxt->nsNr = oldXPNsNr;
+
+	if ((comp == NULL) || (comp->comp == NULL))
+	    xmlXPathFreeCompExpr(xpExpr);
+	if (result == NULL) {
+	    if (comp == NULL)
+		xsltTransformError(ctxt, NULL, NULL,
+		    "Evaluating global variable %s failed\n", elem->name);
+	    else
+		xsltTransformError(ctxt, NULL, comp->inst,
+		    "Evaluating global variable %s failed\n", elem->name);
+	    ctxt->state = XSLT_STATE_STOPPED;
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+#ifdef LIBXML_DEBUG_ENABLED
+	} else {
+	    if ((xsltGenericDebugContext == stdout) ||
+		(xsltGenericDebugContext == stderr))
+		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+					result, 0);
+#endif
+#endif
+	}
+    } else {
+	if (elem->tree == NULL) {
+	    result = xmlXPathNewCString("");
+	} else {
+	    xmlDocPtr container;
+	    xmlNodePtr oldInsert;
+	    xmlDocPtr  oldOutput, oldXPDoc;	    
+	    /*
+	    * Generate a result tree fragment.
+	    */
+	    container = xsltCreateRVT(ctxt);
+	    if (container == NULL)
+		goto error;
+	    /*
+	    * Let the lifetime of the tree fragment be handled by
+	    * the Libxslt's garbage collector.
+	    */
+	    xsltRegisterPersistRVT(ctxt, container);	    
+
+	    oldOutput = ctxt->output;
+	    oldInsert = ctxt->insert;
+
+	    oldXPDoc = ctxt->xpathCtxt->doc;
+	    
+	    ctxt->output = container;	    
+	    ctxt->insert = (xmlNodePtr) container;
+
+	    ctxt->xpathCtxt->doc = ctxt->initialContextDoc;
+	    /*
+	    * Process the sequence constructor.
+	    */
+	    xsltApplyOneTemplate(ctxt, ctxt->node, elem->tree, NULL, NULL);
+
+	    ctxt->xpathCtxt->doc = oldXPDoc;
+
+	    ctxt->insert = oldInsert;
+	    ctxt->output = oldOutput;
+	    
+	    result = xmlXPathNewValueTree((xmlNodePtr) container);
+	    if (result == NULL) {
+		result = xmlXPathNewCString("");
+	    } else {
+	        result->boolval = 0; /* Freeing is not handled there anymore */
+	    }
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+#ifdef LIBXML_DEBUG_ENABLED
+	    if ((xsltGenericDebugContext == stdout) ||
+		(xsltGenericDebugContext == stderr))
+		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+					result, 0);
+#endif
+#endif
+	}
+    }
+
+error:
+    elem->name = oldVarName;
+    ctxt->inst = oldInst;
+    if (result != NULL) {
+	elem->value = result;
+	elem->computed = 1;
+    }
+    return(result);
+}
+
+/**
+ * xsltEvalGlobalVariables:
+ * @ctxt:  the XSLT transformation context
+ *
+ * Evaluates all global variables and parameters of a stylesheet.
+ * For internal use only. This is called at start of a transformation.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+int
+xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
+    xsltStackElemPtr elem;
+    xsltStylesheetPtr style;    
+
+    if ((ctxt == NULL) || (ctxt->document == NULL))
+	return(-1);
+ 
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	"Registering global variables\n"));
+#endif
+    /*
+     * Walk the list from the stylesheets and populate the hash table
+     */
+    style = ctxt->style;
+    while (style != NULL) {
+	elem = style->variables;
+	
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	if ((style->doc != NULL) && (style->doc->URL != NULL)) {
+	    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+			     "Registering global variables from %s\n",
+		             style->doc->URL));
+	}
+#endif
+
+	while (elem != NULL) {
+	    xsltStackElemPtr def;
+
+	    /*
+	     * Global variables are stored in the variables pool.
+	     */
+	    def = (xsltStackElemPtr) 
+		    xmlHashLookup2(ctxt->globalVars,
+		                 elem->name, elem->nameURI);
+	    if (def == NULL) {
+
+		def = xsltCopyStackElem(elem);
+		xmlHashAddEntry2(ctxt->globalVars,
+				 elem->name, elem->nameURI, def);
+	    } else if ((elem->comp != NULL) &&
+		       (elem->comp->type == XSLT_FUNC_VARIABLE)) {
+		/*
+		 * Redefinition of variables from a different stylesheet
+		 * should not generate a message.
+		 */
+		if ((elem->comp->inst != NULL) &&
+		    (def->comp != NULL) && (def->comp->inst != NULL) &&
+		    (elem->comp->inst->doc == def->comp->inst->doc))
+		{
+		    xsltTransformError(ctxt, style, elem->comp->inst,
+			"Global variable %s already defined\n", elem->name);
+		    if (style != NULL) style->errors++;
+		}
+	    }
+	    elem = elem->next;
+	}
+
+	style = xsltNextImport(style);
+    }
+
+    /*
+     * This part does the actual evaluation
+     */    
+    xmlHashScan(ctxt->globalVars,
+	        (xmlHashScanner) xsltEvalGlobalVariable, ctxt);
+
+    return(0);
+}
+
+/**
+ * xsltRegisterGlobalVariable:
+ * @style:  the XSLT transformation context
+ * @name:  the variable name
+ * @ns_uri:  the variable namespace URI
+ * @sel:  the expression which need to be evaluated to generate a value
+ * @tree:  the subtree if sel is NULL
+ * @comp:  the precompiled value
+ * @value:  the string value if available
+ *
+ * Register a new variable value. If @value is NULL it unregisters
+ * the variable
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+static int
+xsltRegisterGlobalVariable(xsltStylesheetPtr style, const xmlChar *name,
+		     const xmlChar *ns_uri, const xmlChar *sel,
+		     xmlNodePtr tree, xsltStylePreCompPtr comp,
+		     const xmlChar *value) {
+    xsltStackElemPtr elem, tmp;
+    if (style == NULL)
+	return(-1);
+    if (name == NULL)
+	return(-1);
+    if (comp == NULL)
+	return(-1);
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    if (comp->type == XSLT_FUNC_PARAM)
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "Defining global param %s\n", name);
+    else
+	xsltGenericDebug(xsltGenericDebugContext,
+			 "Defining global variable %s\n", name);
+#endif
+
+    elem = xsltNewStackElem(NULL);
+    if (elem == NULL)
+	return(-1);
+    elem->comp = comp;
+    elem->name = xmlDictLookup(style->dict, name, -1);
+    elem->select = xmlDictLookup(style->dict, sel, -1);
+    if (ns_uri)
+	elem->nameURI = xmlDictLookup(style->dict, ns_uri, -1);
+    elem->tree = tree;
+    tmp = style->variables;
+    if (tmp == NULL) {
+	elem->next = NULL;
+	style->variables = elem;
+    } else {
+	while (tmp != NULL) {
+	    if ((elem->comp->type == XSLT_FUNC_VARIABLE) &&
+		(tmp->comp->type == XSLT_FUNC_VARIABLE) &&
+		(xmlStrEqual(elem->name, tmp->name)) &&
+		((elem->nameURI == tmp->nameURI) ||
+		 (xmlStrEqual(elem->nameURI, tmp->nameURI))))
+	    {
+		xsltTransformError(NULL, style, comp->inst,
+		"redefinition of global variable %s\n", elem->name);
+		style->errors++;
+	    }
+	    if (tmp->next == NULL)
+	        break;
+	    tmp = tmp->next;
+	}
+	elem->next = NULL;
+	tmp->next = elem;
+    }
+    if (value != NULL) {
+	elem->computed = 1;
+	elem->value = xmlXPathNewString(value);
+    }
+    return(0);
+}
+
+/**
+ * xsltProcessUserParamInternal
+ *
+ * @ctxt:  the XSLT transformation context
+ * @name:  a null terminated parameter name
+ * @value: a null terminated value (may be an XPath expression)
+ * @eval:  0 to treat the value literally, else evaluate as XPath expression
+ *
+ * If @eval is 0 then @value is treated literally and is stored in the global
+ * parameter/variable table without any change.
+ *
+ * Uf @eval is 1 then @value is treated as an XPath expression and is
+ * evaluated.  In this case, if you want to pass a string which will be
+ * interpreted literally then it must be enclosed in single or double quotes.
+ * If the string contains single quotes (double quotes) then it cannot be
+ * enclosed single quotes (double quotes).  If the string which you want to
+ * be treated literally contains both single and double quotes (e.g. Meet
+ * at Joe's for "Twelfth Night" at 7 o'clock) then there is no suitable
+ * quoting character.  You cannot use ' or " inside the string
+ * because the replacement of character entities with their equivalents is
+ * done at a different stage of processing.  The solution is to call
+ * xsltQuoteUserParams or xsltQuoteOneUserParam.
+ *
+ * This needs to be done on parsed stylesheets before starting to apply
+ * transformations.  Normally this will be called (directly or indirectly)
+ * only from xsltEvalUserParams, xsltEvalOneUserParam, xsltQuoteUserParams,
+ * or xsltQuoteOneUserParam.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+
+static
+int
+xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
+		             const xmlChar * name,
+			     const xmlChar * value,
+			     int eval) {
+
+    xsltStylesheetPtr style;
+    const xmlChar *prefix;
+    const xmlChar *href;
+    xmlXPathCompExprPtr xpExpr;
+    xmlXPathObjectPtr result;
+    
+    xsltStackElemPtr elem;
+    int res;
+    void *res_ptr;
+
+    if (ctxt == NULL)
+	return(-1);
+    if (name == NULL)
+	return(0);
+    if (value == NULL)
+	return(0);
+
+    style = ctxt->style;
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	    "Evaluating user parameter %s=%s\n", name, value));
+#endif
+
+    /*
+     * Name lookup
+     */
+
+    name = xsltSplitQName(ctxt->dict, name, &prefix);
+    href = NULL;
+    if (prefix != NULL) {
+	xmlNsPtr ns;
+
+	ns = xmlSearchNs(style->doc, xmlDocGetRootElement(style->doc),
+			 prefix);
+	if (ns == NULL) {
+	    xsltTransformError(ctxt, style, NULL,
+	    "user param : no namespace bound to prefix %s\n", prefix);
+	    href = NULL;
+	} else {
+	    href = ns->href;
+	}
+    }
+
+    if (name == NULL)
+	return (-1);
+
+    res_ptr = xmlHashLookup2(ctxt->globalVars, name, href);
+    if (res_ptr != 0) {
+	xsltTransformError(ctxt, style, NULL,
+	    "Global parameter %s already defined\n", name);
+    }
+    if (ctxt->globalVars == NULL)
+	ctxt->globalVars = xmlHashCreate(20);
+
+    /*
+     * do not overwrite variables with parameters from the command line
+     */
+    while (style != NULL) {
+        elem = ctxt->style->variables;
+	while (elem != NULL) {
+	    if ((elem->comp != NULL) &&
+	        (elem->comp->type == XSLT_FUNC_VARIABLE) &&
+		(xmlStrEqual(elem->name, name)) &&
+		(xmlStrEqual(elem->nameURI, href))) {
+		return(0);
+	    }
+            elem = elem->next;
+	}
+        style = xsltNextImport(style);
+    }
+    style = ctxt->style;
+    elem = NULL;
+
+    /*
+     * Do the evaluation if @eval is non-zero.
+     */
+
+    result = NULL;
+    if (eval != 0) {
+        xpExpr = xmlXPathCompile(value);
+	if (xpExpr != NULL) {
+	    xmlDocPtr oldXPDoc;
+	    xmlNodePtr oldXPContextNode;
+	    int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
+	    xmlNsPtr *oldXPNamespaces;
+	    xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
+	   
+	    /*
+	    * Save context states.
+	    */
+	    oldXPDoc = xpctxt->doc;
+	    oldXPContextNode = xpctxt->node;
+	    oldXPProximityPosition = xpctxt->proximityPosition;
+	    oldXPContextSize = xpctxt->contextSize;
+	    oldXPNamespaces = xpctxt->namespaces;
+	    oldXPNsNr = xpctxt->nsNr;
+
+	    /*
+	    * SPEC XSLT 1.0:
+	    * "At top-level, the expression or template specifying the
+	    *  variable value is evaluated with the same context as that used
+	    *  to process the root node of the source document: the current
+	    *  node is the root node of the source document and the current
+	    *  node list is a list containing just the root node of the source
+	    *  document."
+	    */
+	    xpctxt->doc = ctxt->initialContextDoc;	    
+	    xpctxt->node = ctxt->initialContextNode;	    
+	    xpctxt->contextSize = 1;
+	    xpctxt->proximityPosition = 1;
+	    /* 
+	    * There is really no in scope namespace for parameters on the
+	    * command line.
+	    */
+	    xpctxt->namespaces = NULL;
+	    xpctxt->nsNr = 0;	   
+	    
+	    result = xmlXPathCompiledEval(xpExpr, xpctxt);
+	    
+	    /*
+	    * Restore Context states.
+	    */
+	    xpctxt->doc = oldXPDoc;
+	    xpctxt->node = oldXPContextNode;
+	    xpctxt->contextSize = oldXPContextSize;
+	    xpctxt->proximityPosition = oldXPProximityPosition;
+	    xpctxt->namespaces = oldXPNamespaces;
+	    xpctxt->nsNr = oldXPNsNr;
+	    
+	    xmlXPathFreeCompExpr(xpExpr);
+	}
+	if (result == NULL) {
+	    xsltTransformError(ctxt, style, NULL,
+		"Evaluating user parameter %s failed\n", name);
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    return(-1);
+	}
+    }
+
+    /* 
+     * If @eval is 0 then @value is to be taken literally and result is NULL
+     * 
+     * If @eval is not 0, then @value is an XPath expression and has been
+     * successfully evaluated and result contains the resulting value and
+     * is not NULL.
+     *
+     * Now create an xsltStackElemPtr for insertion into the context's
+     * global variable/parameter hash table.
+     */
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+#ifdef LIBXML_DEBUG_ENABLED
+    if ((xsltGenericDebugContext == stdout) ||
+        (xsltGenericDebugContext == stderr))
+	    xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+				    result, 0);
+#endif
+#endif
+
+    elem = xsltNewStackElem(NULL);
+    if (elem != NULL) {
+	elem->name = name;
+	elem->select = xmlDictLookup(ctxt->dict, value, -1);
+	if (href != NULL)
+	    elem->nameURI = xmlDictLookup(ctxt->dict, href, -1);
+	elem->tree = NULL;
+	elem->computed = 1;
+	if (eval == 0) {
+	    elem->value = xmlXPathNewString(value);
+	} 
+	else {
+	    elem->value = result;
+	}
+    }
+
+    /*
+     * Global parameters are stored in the XPath context variables pool.
+     */
+
+    res = xmlHashAddEntry2(ctxt->globalVars, name, href, elem);
+    if (res != 0) {
+	xsltFreeStackElem(elem);
+	xsltTransformError(ctxt, style, NULL,
+	    "Global parameter %s already defined\n", name);
+    }
+    return(0);
+}
+
+/**
+ * xsltEvalUserParams:
+ *
+ * @ctxt:  the XSLT transformation context
+ * @params:  a NULL terminated array of parameters name/value tuples
+ *
+ * Evaluate the global variables of a stylesheet. This needs to be
+ * done on parsed stylesheets before starting to apply transformations.
+ * Each of the parameters is evaluated as an XPath expression and stored
+ * in the global variables/parameter hash table.  If you want your
+ * parameter used literally, use xsltQuoteUserParams.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+ 
+int
+xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
+    int indx = 0;
+    const xmlChar *name;
+    const xmlChar *value;
+
+    if (params == NULL)
+	return(0);
+    while (params[indx] != NULL) {
+	name = (const xmlChar *) params[indx++];
+	value = (const xmlChar *) params[indx++];
+    	if (xsltEvalOneUserParam(ctxt, name, value) != 0) 
+	    return(-1);
+    }
+    return 0;
+}
+
+/**
+ * xsltQuoteUserParams:
+ *
+ * @ctxt:  the XSLT transformation context
+ * @params:  a NULL terminated arry of parameters names/values tuples
+ *
+ * Similar to xsltEvalUserParams, but the values are treated literally and
+ * are * *not* evaluated as XPath expressions. This should be done on parsed
+ * stylesheets before starting to apply transformations.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
+ 
+int
+xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
+    int indx = 0;
+    const xmlChar *name;
+    const xmlChar *value;
+
+    if (params == NULL)
+	return(0);
+    while (params[indx] != NULL) {
+	name = (const xmlChar *) params[indx++];
+	value = (const xmlChar *) params[indx++];
+    	if (xsltQuoteOneUserParam(ctxt, name, value) != 0) 
+	    return(-1);
+    }
+    return 0;
+}
+
+/**
+ * xsltEvalOneUserParam:
+ * @ctxt:  the XSLT transformation context
+ * @name:  a null terminated string giving the name of the parameter
+ * @value:  a null terminated string giving the XPath expression to be evaluated
+ *
+ * This is normally called from xsltEvalUserParams to process a single
+ * parameter from a list of parameters.  The @value is evaluated as an
+ * XPath expression and the result is stored in the context's global
+ * variable/parameter hash table.
+ *
+ * To have a parameter treated literally (not as an XPath expression)
+ * use xsltQuoteUserParams (or xsltQuoteOneUserParam).  For more
+ * details see description of xsltProcessOneUserParamInternal.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
+
+int
+xsltEvalOneUserParam(xsltTransformContextPtr ctxt,
+    		     const xmlChar * name,
+		     const xmlChar * value) {
+    return xsltProcessUserParamInternal(ctxt, name, value,
+		                        1 /* xpath eval ? */);
+}
+
+/**
+ * xsltQuoteOneUserParam:
+ * @ctxt:  the XSLT transformation context
+ * @name:  a null terminated string giving the name of the parameter
+ * @value:  a null terminated string giving the parameter value
+ *
+ * This is normally called from xsltQuoteUserParams to process a single
+ * parameter from a list of parameters.  The @value is stored in the
+ * context's global variable/parameter hash table.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
+
+int
+xsltQuoteOneUserParam(xsltTransformContextPtr ctxt,
+			 const xmlChar * name,
+			 const xmlChar * value) {
+    return xsltProcessUserParamInternal(ctxt, name, value,
+					0 /* xpath eval ? */);
+}
+
+/**
+ * xsltBuildVariable:
+ * @ctxt:  the XSLT transformation context
+ * @comp:  the precompiled form
+ * @tree:  the tree if select is NULL
+ *
+ * Computes a new variable value.
+ *
+ * Returns the xsltStackElemPtr or NULL in case of error
+ */
+static xsltStackElemPtr
+xsltBuildVariable(xsltTransformContextPtr ctxt,
+		  xsltStylePreCompPtr castedComp,
+		  xmlNodePtr tree)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleBasicItemVariablePtr comp =
+	(xsltStyleBasicItemVariablePtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+#endif 
+    xsltStackElemPtr elem;
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		     "Building variable %s", comp->name));
+    if (comp->select != NULL)
+	XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+			 " select %s", comp->select));
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, "\n"));
+#endif
+
+    elem = xsltNewStackElem(ctxt);
+    if (elem == NULL)
+	return(NULL);
+    elem->comp = (xsltStylePreCompPtr) comp;
+    elem->name = comp->name;
+    elem->select = comp->select;
+    elem->nameURI = comp->ns;
+    elem->tree = tree;
+    elem->value = xsltEvalVariable(ctxt, elem,
+	(xsltStylePreCompPtr) comp);
+    if (elem->value != NULL)
+	elem->computed = 1;
+    return(elem);
+}
+
+/**
+ * xsltRegisterVariable:
+ * @ctxt:  the XSLT transformation context
+ * @comp: the compiled XSLT-variable (or param) instruction
+ * @tree:  the tree if select is NULL
+ * @isParam:  indicates if this is a parameter
+ *
+ * Computes and registers a new variable.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+static int
+xsltRegisterVariable(xsltTransformContextPtr ctxt,
+		     xsltStylePreCompPtr castedComp,
+		     xmlNodePtr tree, int isParam)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleBasicItemVariablePtr comp =
+	(xsltStyleBasicItemVariablePtr) castedComp;
+#else
+    xsltStylePreCompPtr comp = castedComp;
+    int present;
+#endif
+    xsltStackElemPtr variable;    
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * REFACTORED NOTE: Redefinitions of vars/params are checked
+    *  at compilation time in the refactored code.
+    * xsl:with-param parameters are checked in xsltApplyXSLTTemplate().
+    */
+#else
+    present = xsltCheckStackElem(ctxt, comp->name, comp->ns);
+    if (isParam == 0) {	
+	if ((present != 0) && (present != 3)) {
+	    /* TODO: report QName. */
+	    xsltTransformError(ctxt, NULL, comp->inst,
+		"XSLT-variable: Redefinition of variable '%s'.\n", comp->name);
+	    return(0);
+	}
+    } else if (present != 0) {
+	if ((present == 1) || (present == 2)) {
+	    /* TODO: report QName. */
+	    xsltTransformError(ctxt, NULL, comp->inst,
+		"XSLT-param: Redefinition of parameter '%s'.\n", comp->name);
+	    return(0);
+	}
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		 "param %s defined by caller\n", comp->name));
+#endif
+	return(0);
+    }
+#endif /* else of XSLT_REFACTORED */
+
+    variable = xsltBuildVariable(ctxt, (xsltStylePreCompPtr) comp, tree);
+    xsltAddStackElem(ctxt, variable);
+    return(0);
+}
+
+/**
+ * xsltGlobalVariableLookup:
+ * @ctxt:  the XSLT transformation context
+ * @name:  the variable name
+ * @ns_uri:  the variable namespace URI
+ *
+ * Search in the Variable array of the context for the given
+ * variable value.
+ *
+ * Returns the value or NULL if not found
+ */
+static xmlXPathObjectPtr
+xsltGlobalVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
+		         const xmlChar *ns_uri) {
+    xsltStackElemPtr elem;
+    xmlXPathObjectPtr ret = NULL;
+
+    /*
+     * Lookup the global variables in XPath global variable hash table
+     */
+    if ((ctxt->xpathCtxt == NULL) || (ctxt->globalVars == NULL))
+	return(NULL);
+    elem = (xsltStackElemPtr)
+	    xmlHashLookup2(ctxt->globalVars, name, ns_uri);
+    if (elem == NULL) {
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+			 "global variable not found %s\n", name));
+#endif
+	return(NULL);
+    }
+    /*
+    * URGENT TODO: Move the detection of recursive definitions
+    * to compile-time.
+    */
+    if (elem->computed == 0) {
+	if (elem->name == xsltComputingGlobalVarMarker) {
+	    xsltTransformError(ctxt, NULL, elem->comp->inst,
+		"Recursive definition of %s\n", name);
+	    return(NULL);
+	}
+	ret = xsltEvalGlobalVariable(elem, ctxt);
+    } else
+	ret = elem->value;
+    return(xmlXPathObjectCopy(ret));
+}
+
+/**
+ * xsltVariableLookup:
+ * @ctxt:  the XSLT transformation context
+ * @name:  the variable name
+ * @ns_uri:  the variable namespace URI
+ *
+ * Search in the Variable array of the context for the given
+ * variable value.
+ *
+ * Returns the value or NULL if not found
+ */
+xmlXPathObjectPtr
+xsltVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
+		   const xmlChar *ns_uri) {
+    xsltStackElemPtr elem;
+
+    if (ctxt == NULL)
+	return(NULL);
+
+    elem = xsltStackLookup(ctxt, name, ns_uri);
+    if (elem == NULL) {
+	return(xsltGlobalVariableLookup(ctxt, name, ns_uri));
+    }
+    if (elem->computed == 0) {
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		         "uncomputed variable %s\n", name));
+#endif
+        elem->value = xsltEvalVariable(ctxt, elem, NULL);
+	elem->computed = 1;
+    }
+    if (elem->value != NULL)
+	return(xmlXPathObjectCopy(elem->value));
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		     "variable not found %s\n", name));
+#endif
+    return(NULL);
+}
+
+/**
+ * xsltParseStylesheetCallerParam:
+ * @ctxt:  the XSLT transformation context 
+ * @inst:  the xsl:with-param instruction element
+ *
+ * Processes an xsl:with-param instruction at transformation time.
+ * The value is compute, but not recorded.
+ * NOTE that this is also called with an *xsl:param* element
+ * from exsltFuncFunctionFunction(). 
+ *
+ * Returns the new xsltStackElemPtr or NULL
+ */
+
+xsltStackElemPtr
+xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleBasicItemVariablePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    xmlNodePtr tree = NULL; /* The first child node of the instruction or
+                               the instruction itself. */
+    xsltStackElemPtr param = NULL;
+    
+    if ((ctxt == NULL) || (inst == NULL))
+	return(NULL);
+
+#ifdef XSLT_REFACTORED
+    comp = (xsltStyleBasicItemVariablePtr) inst->psvi;
+#else
+    comp = (xsltStylePreCompPtr) inst->psvi;
+#endif
+    
+    if (comp == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltParseStylesheetCallerParam(): "
+	    "The XSLT 'with-param' instruction was not compiled.\n");
+        return(NULL);
+    }
+    if (comp->name == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltParseStylesheetCallerParam(): "
+	    "XSLT 'with-param': The attribute 'name' was not compiled.\n");
+	return(NULL);
+    }
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	    "Handling xsl:with-param %s\n", comp->name));
+#endif
+
+    if (comp->select == NULL) {
+	tree = inst->children;
+    } else {
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	    "        select %s\n", comp->select));
+#endif
+	tree = inst;
+    }
+
+    param = xsltBuildVariable(ctxt, (xsltStylePreCompPtr) comp, tree);
+
+    return(param);
+}
+
+/**
+ * xsltParseGlobalVariable:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "variable" element
+ *
+ * Parses a global XSLT 'variable' declaration at compilation time
+ * and registers it
+ */
+void
+xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemVariablePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * Note that xsltStylePreCompute() will be called from
+    * xslt.c only.
+    */
+    comp = (xsltStyleItemVariablePtr) cur->psvi;
+#else
+    xsltStylePreCompute(style, cur);
+    comp = (xsltStylePreCompPtr) cur->psvi;
+#endif
+    if (comp == NULL) {
+	xsltTransformError(NULL, style, cur,
+	     "xsl:variable : compilation failed\n");
+	return;
+    }
+
+    if (comp->name == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:variable : missing name attribute\n");
+	return;
+    }
+
+    /*
+    * Parse the content (a sequence constructor) of xsl:variable.
+    */
+    if (cur->children != NULL) {
+#ifdef XSLT_REFACTORED	
+        xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
+#else
+        xsltParseTemplateContent(style, cur);
+#endif
+    }
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Registering global variable %s\n", comp->name);
+#endif
+
+    xsltRegisterGlobalVariable(style, comp->name, comp->ns,
+	comp->select, cur->children, (xsltStylePreCompPtr) comp,
+	NULL);
+}
+
+/**
+ * xsltParseGlobalParam:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "param" element
+ *
+ * parse an XSLT transformation param declaration and record
+ * its value.
+ */
+
+void
+xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemParamPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * Note that xsltStylePreCompute() will be called from
+    * xslt.c only.
+    */
+    comp = (xsltStyleItemParamPtr) cur->psvi;
+#else
+    xsltStylePreCompute(style, cur);
+    comp = (xsltStylePreCompPtr) cur->psvi;
+#endif    
+    if (comp == NULL) {
+	xsltTransformError(NULL, style, cur,
+	     "xsl:param : compilation failed\n");
+	return;
+    }
+
+    if (comp->name == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsl:param : missing name attribute\n");
+	return;
+    }
+
+    /*
+    * Parse the content (a sequence constructor) of xsl:param.
+    */
+    if (cur->children != NULL) {
+#ifdef XSLT_REFACTORED	
+        xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
+#else
+        xsltParseTemplateContent(style, cur);
+#endif
+    }
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Registering global param %s\n", comp->name);
+#endif
+
+    xsltRegisterGlobalVariable(style, comp->name, comp->ns,
+	comp->select, cur->children, (xsltStylePreCompPtr) comp,
+	NULL);
+}
+
+/**
+ * xsltParseStylesheetVariable:
+ * @ctxt:  the XSLT transformation context
+ * @inst:  the xsl:variable instruction element
+ *
+ * Registers a local XSLT 'variable' instruction at transformation time
+ * and evaluates its value.
+ */
+void
+xsltParseStylesheetVariable(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemVariablePtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((inst == NULL) || (ctxt == NULL))
+	return;
+
+    comp = inst->psvi;
+    if (comp == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltParseStylesheetVariable(): "
+	    "The XSLT 'variable' instruction was not compiled.\n");
+        return;
+    }
+    if (comp->name == NULL) {
+	xsltTransformError(ctxt, NULL, inst,
+	    "Internal error in xsltParseStylesheetVariable(): "
+	    "The attribute 'name' was not compiled.\n");
+	return;
+    }
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	"Registering variable '%s'\n", comp->name));
+#endif
+
+    xsltRegisterVariable(ctxt, (xsltStylePreCompPtr) comp, inst->children, 0);
+}
+
+/**
+ * xsltParseStylesheetParam:
+ * @ctxt:  the XSLT transformation context
+ * @cur:  the XSLT 'param' element
+ *
+ * Registers a local XSLT 'param' declaration at transformation time and
+ * evaluates its value.
+ */
+void
+xsltParseStylesheetParam(xsltTransformContextPtr ctxt, xmlNodePtr cur)
+{
+#ifdef XSLT_REFACTORED
+    xsltStyleItemParamPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+
+    if ((cur == NULL) || (ctxt == NULL))
+	return;
+
+    comp = cur->psvi;
+    if ((comp == NULL) || (comp->name == NULL)) {
+	xsltTransformError(ctxt, NULL, cur,
+	    "Internal error in xsltParseStylesheetParam(): "
+	    "The XSLT 'param' declaration was not compiled correctly.\n");
+	return;
+    }
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	"Registering param %s\n", comp->name));
+#endif
+
+    xsltRegisterVariable(ctxt, (xsltStylePreCompPtr) comp, cur->children, 1);
+}
+
+/**
+ * xsltFreeGlobalVariables:
+ * @ctxt:  the XSLT transformation context
+ *
+ * Free up the data associated to the global variables
+ * its value.
+ */
+
+void
+xsltFreeGlobalVariables(xsltTransformContextPtr ctxt) {
+    xmlHashFree(ctxt->globalVars, (xmlHashDeallocator) xsltFreeStackElem);
+}
+
+/**
+ * xsltXPathVariableLookup:
+ * @ctxt:  a void * but the the XSLT transformation context actually
+ * @name:  the variable name
+ * @ns_uri:  the variable namespace URI
+ *
+ * This is the entry point when a varibale is needed by the XPath
+ * interpretor.
+ *
+ * Returns the value or NULL if not found
+ */
+xmlXPathObjectPtr
+xsltXPathVariableLookup(void *ctxt, const xmlChar *name,
+	                const xmlChar *ns_uri) {
+    xsltTransformContextPtr tctxt;
+    xmlXPathObjectPtr valueObj = NULL;
+
+    if ((ctxt == NULL) || (name == NULL))
+	return(NULL);
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	    "Lookup variable '%s'\n", name));
+#endif
+    
+    tctxt = (xsltTransformContextPtr) ctxt;
+    /*
+    * Local variables/params ---------------------------------------------
+    *
+    * Do the lookup from the top of the stack, but
+    * don't use params being computed in a call-param
+    * First lookup expects the variable name and URI to
+    * come from the disctionnary and hence pointer comparison.
+    */
+    if (tctxt->varsNr != 0) {
+	int i;
+	xsltStackElemPtr variable = NULL, cur;
+
+	for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
+	    cur = tctxt->varsTab[i-1];
+	    if ((cur->name == name) && (cur->nameURI == ns_uri)) {
+#if 0
+		stack_addr++;
+#endif
+		variable = cur;
+		goto local_variable_found;
+	    }
+	    cur = cur->next;
+	}	
+	/*
+	* Redo the lookup with interned strings to avoid string comparison.
+	*
+	* OPTIMIZE TODO: The problem here is, that if we request a
+	*  global variable, then this will be also executed.
+	*/
+	{
+	    const xmlChar *tmpName = name, *tmpNsName = ns_uri;
+
+	    name = xmlDictLookup(tctxt->dict, name, -1);
+	    if (ns_uri)
+		ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1);
+	    if ((tmpName != name) || (tmpNsName != ns_uri)) {		
+		for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
+		    cur = tctxt->varsTab[i-1];
+		    if ((cur->name == name) && (cur->nameURI == ns_uri)) {
+#if 0
+			stack_cmp++;
+#endif
+			variable = cur;
+			goto local_variable_found;
+		    }
+		}
+	    }
+	}
+
+local_variable_found:
+
+	if (variable) {
+	    if (variable->computed == 0) {
+		
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+		XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		    "uncomputed variable '%s'\n", name));
+#endif
+		variable->value = xsltEvalVariable(tctxt, variable, NULL);
+		variable->computed = 1;
+	    }
+	    if (variable->value != NULL) {
+		valueObj = xmlXPathObjectCopy(variable->value); 
+	    }
+	    return(valueObj);
+	}
+    }
+    /*
+    * Global variables/params --------------------------------------------
+    */    
+    if (tctxt->globalVars) {
+	valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri);
+    }
+
+    if (valueObj == NULL) {
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+    XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+		     "variable not found '%s'\n", name));
+#endif
+
+	if (ns_uri) {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"Variable '{%s}%s' has not been declared.\n", ns_uri, name);
+	} else {
+	    xsltTransformError(tctxt, NULL, tctxt->inst,
+		"Variable '%s' has not been declared.\n", name);
+	}
+    } else {
+
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+	XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+	    "found variable '%s'\n", name));
+#endif
+    }
+
+    return(valueObj);
+}
+
+
diff --git a/third_party/libxslt/libxslt/variables.h b/third_party/libxslt/libxslt/variables.h
new file mode 100644
index 0000000..85055e4
--- /dev/null
+++ b/third_party/libxslt/libxslt/variables.h
@@ -0,0 +1,91 @@
+/*
+ * Summary: interface for the variable matching and lookup.
+ * Description: interface for the variable matching and lookup.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_VARIABLES_H__
+#define __XML_XSLT_VARIABLES_H__
+
+#include 
+#include 
+#include "xsltexports.h"
+#include "xsltInternals.h"
+#include "functions.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * XSLT_REGISTER_VARIABLE_LOOKUP:
+ *
+ * Registering macro, not general purpose at all but used in different modules.
+ */
+
+#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt)			\
+    xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt,		\
+	       xsltXPathVariableLookup,	(void *)(ctxt));	\
+    xsltRegisterAllFunctions((ctxt)->xpathCtxt);		\
+    xsltRegisterAllElement(ctxt);				\
+    (ctxt)->xpathCtxt->extra = ctxt
+
+/*
+ * Interfaces for the variable module.
+ */
+
+XSLTPUBFUN int XSLTCALL		
+		xsltEvalGlobalVariables		(xsltTransformContextPtr ctxt);
+XSLTPUBFUN int XSLTCALL		
+		xsltEvalUserParams		(xsltTransformContextPtr ctxt,
+						 const char **params);
+XSLTPUBFUN int XSLTCALL		
+    		xsltQuoteUserParams		(xsltTransformContextPtr ctxt,
+						 const char **params);
+XSLTPUBFUN int XSLTCALL		
+		xsltEvalOneUserParam		(xsltTransformContextPtr ctxt,
+    						 const xmlChar * name,
+						 const xmlChar * value);
+XSLTPUBFUN int XSLTCALL		
+    		xsltQuoteOneUserParam		(xsltTransformContextPtr ctxt,
+    						 const xmlChar * name,
+						 const xmlChar * value);
+
+XSLTPUBFUN void XSLTCALL		
+    		xsltParseGlobalVariable		(xsltStylesheetPtr style,
+						 xmlNodePtr cur);
+XSLTPUBFUN void XSLTCALL		
+    		xsltParseGlobalParam		(xsltStylesheetPtr style,
+						 xmlNodePtr cur);
+XSLTPUBFUN void XSLTCALL		
+    		xsltParseStylesheetVariable	(xsltTransformContextPtr ctxt,
+						 xmlNodePtr cur);
+XSLTPUBFUN void XSLTCALL		
+    		xsltParseStylesheetParam	(xsltTransformContextPtr ctxt,
+						 xmlNodePtr cur);
+XSLTPUBFUN xsltStackElemPtr XSLTCALL 
+		xsltParseStylesheetCallerParam	(xsltTransformContextPtr ctxt,
+						 xmlNodePtr cur);
+XSLTPUBFUN int XSLTCALL		
+    		xsltAddStackElemList		(xsltTransformContextPtr ctxt,
+						 xsltStackElemPtr elems);
+XSLTPUBFUN void XSLTCALL		
+    		xsltFreeGlobalVariables		(xsltTransformContextPtr ctxt);
+XSLTPUBFUN xmlXPathObjectPtr XSLTCALL	
+		xsltVariableLookup		(xsltTransformContextPtr ctxt,
+						 const xmlChar *name,
+						 const xmlChar *ns_uri);
+XSLTPUBFUN xmlXPathObjectPtr XSLTCALL	
+		xsltXPathVariableLookup		(void *ctxt,
+						 const xmlChar *name,
+						 const xmlChar *ns_uri);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_VARIABLES_H__ */
+
diff --git a/third_party/libxslt/libxslt/win32config.h b/third_party/libxslt/libxslt/win32config.h
new file mode 100644
index 0000000..169b03d
--- /dev/null
+++ b/third_party/libxslt/libxslt/win32config.h
@@ -0,0 +1,99 @@
+/*
+ * Summary: Windows configuration header
+ * Description: Windows configuration header
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Igor Zlatkovic
+ */
+#ifndef __LIBXSLT_WIN32_CONFIG__
+#define __LIBXSLT_WIN32_CONFIG__
+
+#define HAVE_CTYPE_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_TIME_H 1
+#define HAVE_LOCALTIME 1
+#define HAVE_GMTIME 1
+#define HAVE_TIME 1
+#define HAVE_MATH_H 1
+#define HAVE_FCNTL_H 1
+
+#include 
+
+#define HAVE_ISINF
+#define HAVE_ISNAN
+
+#include 
+#if defined _MSC_VER || defined __MINGW32__
+/* MS C-runtime has functions which can be used in order to determine if
+   a given floating-point variable contains NaN, (+-)INF. These are 
+   preferred, because floating-point technology is considered propriatary
+   by MS and we can assume that their functions know more about their 
+   oddities than we do. */
+#include 
+/* Bjorn Reese figured a quite nice construct for isinf() using the 
+   _fpclass() function. */
+#ifndef isinf
+#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
+	: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
+#endif
+/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
+#ifndef isnan
+#define isnan(d) (_isnan(d))
+#endif
+#else /* _MSC_VER */
+static int isinf (double d) {
+    int expon = 0;
+    double val = frexp (d, &expon);
+    if (expon == 1025) {
+        if (val == 0.5) {
+            return 1;
+        } else if (val == -0.5) {
+            return -1;
+        } else {
+            return 0;
+        }
+    } else {
+        return 0;
+    }
+}
+static int isnan (double d) {
+    int expon = 0;
+    double val = frexp (d, &expon);
+    if (expon == 1025) {
+        if (val == 0.5) {
+            return 0;
+        } else if (val == -0.5) {
+            return 0;
+        } else {
+            return 1;
+        }
+    } else {
+        return 0;
+    }
+}
+#endif /* _MSC_VER */
+
+#include 
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#define mkdir(p,m) _mkdir(p)
+#define snprintf _snprintf
+#if _MSC_VER < 1500
+#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
+#endif
+#endif
+
+#define HAVE_SYS_STAT_H
+#define HAVE__STAT
+#define HAVE_STRING_H
+
+#include 
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED
+#endif
+
+#endif /* __LIBXSLT_WIN32_CONFIG__ */
+
diff --git a/third_party/libxslt/libxslt/xslt.c b/third_party/libxslt/libxslt/xslt.c
new file mode 100644
index 0000000..6f76a33
--- /dev/null
+++ b/third_party/libxslt/libxslt/xslt.c
@@ -0,0 +1,6923 @@
+/*
+ * xslt.c: Implemetation of an XSL Transformation 1.0 engine
+ *
+ * Reference:
+ *   XSLT specification
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ *   Associating Style Sheets with XML documents
+ *   http://www.w3.org/1999/06/REC-xml-stylesheet-19990629
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "pattern.h"
+#include "variables.h"
+#include "namespaces.h"
+#include "attributes.h"
+#include "xsltutils.h"
+#include "imports.h"
+#include "keys.h"
+#include "documents.h"
+#include "extensions.h"
+#include "preproc.h"
+#include "extra.h"
+#include "security.h"
+
+#ifdef WITH_XSLT_DEBUG
+#define WITH_XSLT_DEBUG_PARSING
+/* #define WITH_XSLT_DEBUG_BLANKS */
+#endif
+
+const char *xsltEngineVersion = LIBXSLT_VERSION_STRING LIBXSLT_VERSION_EXTRA;
+const int xsltLibxsltVersion = LIBXSLT_VERSION;
+const int xsltLibxmlVersion = LIBXML_VERSION;
+
+#ifdef XSLT_REFACTORED
+
+const xmlChar *xsltConstNamespaceNameXSLT = (const xmlChar *) XSLT_NAMESPACE;
+
+/*
+* xsltLiteralResultMarker:
+* Marker for Literal result elements, in order to avoid multiple attempts
+* to recognize such elements in the stylesheet's tree.
+* This marker is set on node->psvi during the initial traversal
+* of a stylesheet's node tree.
+*
+const xmlChar *xsltLiteralResultMarker =
+    (const xmlChar *) "Literal Result Element";
+*/
+
+/*
+* xsltXSLTTextMarker:
+* Marker for xsl:text elements. Used to recognize xsl:text elements
+* for post-processing of the stylesheet's tree, where those
+* elements are removed from the tree.
+*/
+const xmlChar *xsltXSLTTextMarker = (const xmlChar *) "XSLT Text Element";
+
+/*
+* xsltXSLTAttrMarker:
+* Marker for XSLT attribute on Literal Result Elements.
+*/
+const xmlChar *xsltXSLTAttrMarker = (const xmlChar *) "LRE XSLT Attr";
+
+#endif
+
+/*
+ * Harmless but avoiding a problem when compiling against a
+ * libxml <= 2.3.11 without LIBXML_DEBUG_ENABLED
+ */
+#ifndef LIBXML_DEBUG_ENABLED
+double xmlXPathStringEvalNumber(const xmlChar *str);
+#endif
+/*
+ * Useful macros
+ */
+
+#ifdef  IS_BLANK
+#undef	IS_BLANK
+#endif
+#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) ||	\
+                     ((c) == 0x0D))
+
+#ifdef	IS_BLANK_NODE
+#undef	IS_BLANK_NODE
+#endif
+#define IS_BLANK_NODE(n)						\
+    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
+
+/**
+ * xsltParseContentError:
+ *
+ * @style: the stylesheet
+ * @node: the node where the error occured
+ *
+ * Compile-time error function.
+ */
+static void
+xsltParseContentError(xsltStylesheetPtr style,
+		       xmlNodePtr node)
+{
+    if ((style == NULL) || (node == NULL))
+	return;
+
+    if (IS_XSLT_ELEM(node))
+	xsltTransformError(NULL, style, node,
+	    "The XSLT-element '%s' is not allowed at this position.\n",
+	    node->name);
+    else
+	xsltTransformError(NULL, style, node,
+	    "The element '%s' is not allowed at this position.\n",
+	    node->name);
+    style->errors++;
+}
+
+#ifdef XSLT_REFACTORED
+#else
+/**
+ * exclPrefixPush:
+ * @style: the transformation stylesheet
+ * @value:  the excluded namespace name to push on the stack
+ *
+ * Push an excluded namespace name on the stack
+ *
+ * Returns the new index in the stack or 0 in case of error
+ */
+static int
+exclPrefixPush(xsltStylesheetPtr style, xmlChar * value)
+{
+    if (style->exclPrefixMax == 0) {
+        style->exclPrefixMax = 4;
+        style->exclPrefixTab =
+            (xmlChar * *)xmlMalloc(style->exclPrefixMax *
+                                   sizeof(style->exclPrefixTab[0]));
+        if (style->exclPrefixTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+            return (0);
+        }
+    }
+    if (style->exclPrefixNr >= style->exclPrefixMax) {
+        style->exclPrefixMax *= 2;
+        style->exclPrefixTab =
+            (xmlChar * *)xmlRealloc(style->exclPrefixTab,
+                                    style->exclPrefixMax *
+                                    sizeof(style->exclPrefixTab[0]));
+        if (style->exclPrefixTab == NULL) {
+            xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+            return (0);
+        }
+    }
+    style->exclPrefixTab[style->exclPrefixNr] = value;
+    style->exclPrefix = value;
+    return (style->exclPrefixNr++);
+}
+/**
+ * exclPrefixPop:
+ * @style: the transformation stylesheet
+ *
+ * Pop an excluded prefix value from the stack
+ *
+ * Returns the stored excluded prefix value
+ */
+static xmlChar *
+exclPrefixPop(xsltStylesheetPtr style)
+{
+    xmlChar *ret;
+
+    if (style->exclPrefixNr <= 0)
+        return (0);
+    style->exclPrefixNr--;
+    if (style->exclPrefixNr > 0)
+        style->exclPrefix = style->exclPrefixTab[style->exclPrefixNr - 1];
+    else
+        style->exclPrefix = NULL;
+    ret = style->exclPrefixTab[style->exclPrefixNr];
+    style->exclPrefixTab[style->exclPrefixNr] = 0;
+    return (ret);
+}
+#endif
+
+/************************************************************************
+ *									*
+ *			Helper functions				*
+ *									*
+ ************************************************************************/
+
+static int initialized = 0;
+/**
+ * xsltInit:
+ *
+ * Initializes the processor (e.g. registers built-in extensions,
+ * etc.)
+ */
+void
+xsltInit (void) {
+    if (initialized == 0) {
+	initialized = 1;
+        xsltRegisterAllExtras();
+    }
+}
+
+/**
+ * xsltUninit:
+ *
+ * Uninitializes the processor.
+ */
+void
+xsltUninit (void) {
+    initialized = 0;
+}
+
+/**
+ * xsltIsBlank:
+ * @str:  a string
+ *
+ * Check if a string is ignorable
+ *
+ * Returns 1 if the string is NULL or made of blanks chars, 0 otherwise
+ */
+int
+xsltIsBlank(xmlChar *str) {
+    if (str == NULL)
+	return(1);
+    while (*str != 0) {
+	if (!(IS_BLANK(*str))) return(0);
+	str++;
+    }
+    return(1);
+}
+
+/************************************************************************
+ *									*
+ *		Routines to handle XSLT data structures			*
+ *									*
+ ************************************************************************/
+static xsltDecimalFormatPtr
+xsltNewDecimalFormat(xmlChar *name)
+{
+    xsltDecimalFormatPtr self;
+    /* UTF-8 for 0x2030 */
+    static const xmlChar permille[4] = {0xe2, 0x80, 0xb0, 0};
+
+    self = xmlMalloc(sizeof(xsltDecimalFormat));
+    if (self != NULL) {
+	self->next = NULL;
+	self->name = name;
+	
+	/* Default values */
+	self->digit = xmlStrdup(BAD_CAST("#"));
+	self->patternSeparator = xmlStrdup(BAD_CAST(";"));
+	self->decimalPoint = xmlStrdup(BAD_CAST("."));
+	self->grouping = xmlStrdup(BAD_CAST(","));
+	self->percent = xmlStrdup(BAD_CAST("%"));
+	self->permille = xmlStrdup(BAD_CAST(permille));
+	self->zeroDigit = xmlStrdup(BAD_CAST("0"));
+	self->minusSign = xmlStrdup(BAD_CAST("-"));
+	self->infinity = xmlStrdup(BAD_CAST("Infinity"));
+	self->noNumber = xmlStrdup(BAD_CAST("NaN"));
+    }
+    return self;
+}
+
+static void
+xsltFreeDecimalFormat(xsltDecimalFormatPtr self)
+{
+    if (self != NULL) {
+	if (self->digit)
+	    xmlFree(self->digit);
+	if (self->patternSeparator)
+	    xmlFree(self->patternSeparator);
+	if (self->decimalPoint)
+	    xmlFree(self->decimalPoint);
+	if (self->grouping)
+	    xmlFree(self->grouping);
+	if (self->percent)
+	    xmlFree(self->percent);
+	if (self->permille)
+	    xmlFree(self->permille);
+	if (self->zeroDigit)
+	    xmlFree(self->zeroDigit);
+	if (self->minusSign)
+	    xmlFree(self->minusSign);
+	if (self->infinity)
+	    xmlFree(self->infinity);
+	if (self->noNumber)
+	    xmlFree(self->noNumber);
+	if (self->name)
+	    xmlFree(self->name);
+	xmlFree(self);
+    }
+}
+
+static void
+xsltFreeDecimalFormatList(xsltStylesheetPtr self)
+{
+    xsltDecimalFormatPtr iter;
+    xsltDecimalFormatPtr tmp;
+
+    if (self == NULL)
+	return;
+    
+    iter = self->decimalFormat;
+    while (iter != NULL) {
+	tmp = iter->next;
+	xsltFreeDecimalFormat(iter);
+	iter = tmp;
+    }
+}
+
+/**
+ * xsltDecimalFormatGetByName:
+ * @style: the XSLT stylesheet
+ * @name: the decimal-format name to find
+ *
+ * Find decimal-format by name
+ *
+ * Returns the xsltDecimalFormatPtr
+ */
+xsltDecimalFormatPtr
+xsltDecimalFormatGetByName(xsltStylesheetPtr style, xmlChar *name)
+{
+    xsltDecimalFormatPtr result = NULL;
+
+    if (name == NULL)
+	return style->decimalFormat;
+
+    while (style != NULL) {
+	for (result = style->decimalFormat->next;
+	     result != NULL;
+	     result = result->next) {
+	    if (xmlStrEqual(name, result->name))
+		return result;
+	}
+	style = xsltNextImport(style);
+    }
+    return result;
+}
+
+
+/**
+ * xsltNewTemplate:
+ *
+ * Create a new XSLT Template
+ *
+ * Returns the newly allocated xsltTemplatePtr or NULL in case of error
+ */
+static xsltTemplatePtr
+xsltNewTemplate(void) {
+    xsltTemplatePtr cur;
+
+    cur = (xsltTemplatePtr) xmlMalloc(sizeof(xsltTemplate));
+    if (cur == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewTemplate : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltTemplate));
+    cur->priority = XSLT_PAT_NO_PRIORITY;
+    return(cur);
+}
+
+/**
+ * xsltFreeTemplate:
+ * @template:  an XSLT template
+ *
+ * Free up the memory allocated by @template
+ */
+static void
+xsltFreeTemplate(xsltTemplatePtr template) {
+    if (template == NULL)
+	return;
+    if (template->match) xmlFree(template->match);
+/*
+*   NOTE: @name and @nameURI are put into the string dict now.
+*   if (template->name) xmlFree(template->name);
+*   if (template->nameURI) xmlFree(template->nameURI);
+*/
+/*
+    if (template->mode) xmlFree(template->mode);
+    if (template->modeURI) xmlFree(template->modeURI);
+ */
+    if (template->inheritedNs) xmlFree(template->inheritedNs);
+    memset(template, -1, sizeof(xsltTemplate));
+    xmlFree(template);
+}
+
+/**
+ * xsltFreeTemplateList:
+ * @template:  an XSLT template list
+ *
+ * Free up the memory allocated by all the elements of @template
+ */
+static void
+xsltFreeTemplateList(xsltTemplatePtr template) {
+    xsltTemplatePtr cur;
+
+    while (template != NULL) {
+	cur = template;
+	template = template->next;
+	xsltFreeTemplate(cur);
+    }
+}
+
+#ifdef XSLT_REFACTORED
+
+static void
+xsltFreeNsAliasList(xsltNsAliasPtr item)
+{
+    xsltNsAliasPtr tmp;
+    
+    while (item) {
+	tmp = item;
+	item = item->next;
+	xmlFree(tmp);
+    } 
+    return;
+}
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+static void
+xsltFreeNamespaceMap(xsltNsMapPtr item)
+{
+    xsltNsMapPtr tmp;
+    
+    while (item) {
+	tmp = item;
+	item = item->next;
+	xmlFree(tmp);
+    } 
+    return;
+}
+
+static xsltNsMapPtr
+xsltNewNamespaceMapItem(xsltCompilerCtxtPtr cctxt,
+			xmlDocPtr doc,
+			xmlNsPtr ns,
+			xmlNodePtr elem)
+{
+    xsltNsMapPtr ret;
+
+    if ((cctxt == NULL) || (doc == NULL) || (ns == NULL))
+	return(NULL);
+
+    ret = (xsltNsMapPtr) xmlMalloc(sizeof(xsltNsMap));
+    if (ret == NULL) {
+	xsltTransformError(NULL, cctxt->style, elem,
+	    "Internal error: (xsltNewNamespaceMapItem) "
+	    "memory allocation failed.\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltNsMap));
+    ret->doc = doc;
+    ret->ns = ns;
+    ret->origNsName = ns->href;
+    /*
+    * Store the item at current stylesheet-level.
+    */
+    if (cctxt->psData->nsMap != NULL)
+	ret->next = cctxt->psData->nsMap;
+    cctxt->psData->nsMap = ret;
+
+    return(ret);
+}
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+/**
+ * xsltCompilerVarInfoFree: 
+ * @cctxt: the compilation context
+ * 
+ * Frees the list of information for vars/params.
+ */
+static void
+xsltCompilerVarInfoFree(xsltCompilerCtxtPtr cctxt)
+{
+    xsltVarInfoPtr ivar = cctxt->ivars, ivartmp;    
+
+    while (ivar) {
+	ivartmp = ivar;
+	ivar = ivar->next;
+	xmlFree(ivartmp);
+    }
+}
+
+/**
+ * xsltCompilerCtxtFree:
+ *
+ * Free an XSLT compiler context. 
+ */
+static void
+xsltCompilationCtxtFree(xsltCompilerCtxtPtr cctxt)
+{    
+    if (cctxt == NULL)
+	return;
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"Freeing compilation context\n");
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max inodes: %d\n", cctxt->maxNodeInfos);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max LREs  : %d\n", cctxt->maxLREs);
+#endif
+    /*
+    * Free node-infos.
+    */
+    if (cctxt->inodeList != NULL) {
+	xsltCompilerNodeInfoPtr tmp, cur = cctxt->inodeList;
+	while (cur != NULL) {
+	    tmp = cur;
+	    cur = cur->next;
+	    xmlFree(tmp);
+	}
+    }
+    if (cctxt->tmpList != NULL)
+	xsltPointerListFree(cctxt->tmpList);
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    if (cctxt->xpathCtxt != NULL)
+	xmlXPathFreeContext(cctxt->xpathCtxt);
+#endif
+    if (cctxt->nsAliases != NULL)
+	xsltFreeNsAliasList(cctxt->nsAliases);
+
+    if (cctxt->ivars)
+	xsltCompilerVarInfoFree(cctxt);
+
+    xmlFree(cctxt);
+}
+
+/**
+ * xsltCompilerCreate:
+ *
+ * Creates an XSLT compiler context.
+ *
+ * Returns the pointer to the created xsltCompilerCtxt or
+ *         NULL in case of an internal error.
+ */
+static xsltCompilerCtxtPtr
+xsltCompilationCtxtCreate(xsltStylesheetPtr style) {
+    xsltCompilerCtxtPtr ret;
+
+    ret = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt));
+    if (ret == NULL) {
+	xsltTransformError(NULL, style, NULL,
+	    "xsltCompilerCreate: allocation of compiler "
+	    "context failed.\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltCompilerCtxt));
+
+    ret->errSeverity = XSLT_ERROR_SEVERITY_ERROR;
+    ret->tmpList = xsltPointerListCreate(20);
+    if (ret->tmpList == NULL) {
+	goto internal_err;
+    }
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    /*
+    * Create the XPath compilation context in order
+    * to speed up precompilation of XPath expressions.
+    */
+    ret->xpathCtxt = xmlXPathNewContext(NULL);
+    if (ret->xpathCtxt == NULL)
+	goto internal_err;
+#endif
+    
+    return(ret);
+
+internal_err:
+    xsltCompilationCtxtFree(ret);
+    return(NULL);
+}
+
+static void
+xsltLREEffectiveNsNodesFree(xsltEffectiveNsPtr first)
+{
+    xsltEffectiveNsPtr tmp;
+
+    while (first != NULL) {
+	tmp = first;
+	first = first->nextInStore;
+	xmlFree(tmp);
+    }
+}
+
+static void
+xsltFreePrincipalStylesheetData(xsltPrincipalStylesheetDataPtr data)
+{
+    if (data == NULL)
+	return;
+
+    if (data->inScopeNamespaces != NULL) {
+	int i;
+	xsltNsListContainerPtr nsi;
+	xsltPointerListPtr list =
+	    (xsltPointerListPtr) data->inScopeNamespaces;
+
+	for (i = 0; i < list->number; i++) {
+	    /*
+	    * REVISIT TODO: Free info of in-scope namespaces.
+	    */
+	    nsi = (xsltNsListContainerPtr) list->items[i];
+	    if (nsi->list != NULL)
+		xmlFree(nsi->list);
+	    xmlFree(nsi);
+	}
+	xsltPointerListFree(list);
+	data->inScopeNamespaces = NULL;
+    }
+
+    if (data->exclResultNamespaces != NULL) {
+	int i;
+	xsltPointerListPtr list = (xsltPointerListPtr)
+	    data->exclResultNamespaces;	
+	
+	for (i = 0; i < list->number; i++)
+	    xsltPointerListFree((xsltPointerListPtr) list->items[i]);
+	
+	xsltPointerListFree(list);
+	data->exclResultNamespaces = NULL;
+    }
+
+    if (data->extElemNamespaces != NULL) {
+	xsltPointerListPtr list = (xsltPointerListPtr)
+	    data->extElemNamespaces;
+	int i;
+
+	for (i = 0; i < list->number; i++)
+	    xsltPointerListFree((xsltPointerListPtr) list->items[i]);
+
+	xsltPointerListFree(list);
+	data->extElemNamespaces = NULL;
+    }
+    if (data->effectiveNs) {
+	xsltLREEffectiveNsNodesFree(data->effectiveNs);
+	data->effectiveNs = NULL;
+    }
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltFreeNamespaceMap(data->nsMap);
+#endif
+    xmlFree(data);
+}
+
+static xsltPrincipalStylesheetDataPtr
+xsltNewPrincipalStylesheetData(void)
+{
+    xsltPrincipalStylesheetDataPtr ret;
+
+    ret = (xsltPrincipalStylesheetDataPtr)
+	xmlMalloc(sizeof(xsltPrincipalStylesheetData));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+	    "xsltNewPrincipalStylesheetData: memory allocation failed.\n");
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xsltPrincipalStylesheetData));
+    
+    /*
+    * Global list of in-scope namespaces.
+    */    
+    ret->inScopeNamespaces = xsltPointerListCreate(-1);
+    if (ret->inScopeNamespaces == NULL)
+	goto internal_err;
+    /*
+    * Global list of excluded result ns-decls.
+    */
+    ret->exclResultNamespaces = xsltPointerListCreate(-1);
+    if (ret->exclResultNamespaces == NULL)
+	goto internal_err;
+    /*
+    * Global list of extension instruction namespace names.
+    */    
+    ret->extElemNamespaces = xsltPointerListCreate(-1);
+    if (ret->extElemNamespaces == NULL)
+	goto internal_err;
+
+    return(ret);
+
+internal_err:
+
+    return(NULL);
+}
+
+#endif
+
+/**
+ * xsltNewStylesheet:
+ *
+ * Create a new XSLT Stylesheet
+ *
+ * Returns the newly allocated xsltStylesheetPtr or NULL in case of error
+ */
+xsltStylesheetPtr
+xsltNewStylesheet(void) {
+    xsltStylesheetPtr ret = NULL;    
+
+    ret = (xsltStylesheetPtr) xmlMalloc(sizeof(xsltStylesheet));
+    if (ret == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltNewStylesheet : malloc failed\n");
+	goto internal_err;
+    }
+    memset(ret, 0, sizeof(xsltStylesheet));
+
+    ret->omitXmlDeclaration = -1;
+    ret->standalone = -1;
+    ret->decimalFormat = xsltNewDecimalFormat(NULL);
+    ret->indent = -1;
+    ret->errors = 0;
+    ret->warnings = 0;
+    ret->exclPrefixNr = 0;
+    ret->exclPrefixMax = 0;
+    ret->exclPrefixTab = NULL;
+    ret->extInfos = NULL;
+    ret->extrasNr = 0;
+    ret->internalized = 1;
+    ret->literal_result = 0;
+    ret->dict = xmlDictCreate();
+#ifdef WITH_XSLT_DEBUG
+    xsltGenericDebug(xsltGenericDebugContext,
+	"creating dictionary for stylesheet\n");
+#endif
+
+    xsltInit();
+
+    return(ret);
+
+internal_err:
+    if (ret != NULL)
+	xsltFreeStylesheet(ret);
+    return(NULL);
+}
+
+/**
+ * xsltAllocateExtra:
+ * @style:  an XSLT stylesheet
+ *
+ * Allocate an extra runtime information slot statically while compiling
+ * the stylesheet and return its number
+ *
+ * Returns the number of the slot
+ */
+int
+xsltAllocateExtra(xsltStylesheetPtr style)
+{
+    return(style->extrasNr++);
+}
+
+/**
+ * xsltAllocateExtraCtxt:
+ * @ctxt:  an XSLT transformation context
+ *
+ * Allocate an extra runtime information slot at run-time
+ * and return its number
+ * This make sure there is a slot ready in the transformation context
+ *
+ * Returns the number of the slot
+ */
+int
+xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt)
+{
+    if (ctxt->extrasNr >= ctxt->extrasMax) {
+	int i;
+	if (ctxt->extrasNr == 0) {
+	    ctxt->extrasMax = 20;
+	    ctxt->extras = (xsltRuntimeExtraPtr)
+		xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra));
+	    if (ctxt->extras == NULL) {
+		xmlGenericError(xmlGenericErrorContext,
+			"xsltAllocateExtraCtxt: out of memory\n");
+		ctxt->state = XSLT_STATE_ERROR;
+		return(0);
+	    }
+	    for (i = 0;i < ctxt->extrasMax;i++) {
+		ctxt->extras[i].info = NULL;
+		ctxt->extras[i].deallocate = NULL;
+		ctxt->extras[i].val.ptr = NULL;
+	    }
+
+	} else {
+	    xsltRuntimeExtraPtr tmp;
+
+	    ctxt->extrasMax += 100;
+	    tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras,
+		            ctxt->extrasMax * sizeof(xsltRuntimeExtra));
+	    if (tmp == NULL) {
+		xmlGenericError(xmlGenericErrorContext,
+			"xsltAllocateExtraCtxt: out of memory\n");
+		ctxt->state = XSLT_STATE_ERROR;
+		return(0);
+	    }
+	    ctxt->extras = tmp;
+	    for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) {
+		ctxt->extras[i].info = NULL;
+		ctxt->extras[i].deallocate = NULL;
+		ctxt->extras[i].val.ptr = NULL;
+	    }
+	}
+    }
+    return(ctxt->extrasNr++);
+}
+
+/**
+ * xsltFreeStylesheetList:
+ * @style:  an XSLT stylesheet list
+ *
+ * Free up the memory allocated by the list @style
+ */
+static void
+xsltFreeStylesheetList(xsltStylesheetPtr style) {
+    xsltStylesheetPtr next;
+
+    while (style != NULL) {
+	next = style->next;
+	xsltFreeStylesheet(style);
+	style = next;
+    }
+}
+
+/**
+ * xsltCleanupStylesheetTree:
+ *
+ * @doc: the document-node
+ * @node: the element where the stylesheet is rooted at
+ *
+ * Actually @node need not be the document-element, but
+ * currently Libxslt does not support embedded stylesheets.
+ *
+ * Returns 0 if OK, -1 on API or internal errors.
+ */
+static int
+xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED,
+			  xmlNodePtr rootElem ATTRIBUTE_UNUSED)
+{    
+#if 0 /* TODO: Currently disabled, since probably not needed. */
+    xmlNodePtr cur;
+
+    if ((doc == NULL) || (rootElem == NULL) ||
+	(rootElem->type != XML_ELEMENT_NODE) ||
+	(doc != rootElem->doc))
+	return(-1);
+
+    /*
+    * Cleanup was suggested by Aleksey Sanin:
+    * Clear the PSVI field to avoid problems if the
+    * node-tree of the stylesheet is intended to be used for
+    * further processing by the user (e.g. for compiling it
+    * once again - although not recommended).
+    */
+
+    cur = rootElem;
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
+	    /*
+	    * Clear the PSVI field.
+	    */
+	    cur->psvi = NULL;
+	    if (cur->children) {
+		cur = cur->children;
+		continue;
+	    }
+	}
+
+leave_node:
+	if (cur == rootElem)
+	    break;
+	if (cur->next != NULL)
+	    cur = cur->next;
+	else {
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    goto leave_node;
+	}
+    }
+#endif /* #if 0 */
+    return(0);
+}
+
+/**
+ * xsltFreeStylesheet:
+ * @style:  an XSLT stylesheet
+ *
+ * Free up the memory allocated by @style
+ */
+void
+xsltFreeStylesheet(xsltStylesheetPtr style)
+{
+    if (style == NULL)
+        return;
+    
+#ifdef XSLT_REFACTORED
+    /*
+    * Start with a cleanup of the main stylesheet's doc.
+    */
+    if ((style->principal == style) && (style->doc))
+	xsltCleanupStylesheetTree(style->doc,
+	    xmlDocGetRootElement(style->doc));
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    /*
+    * Restore changed ns-decls before freeing the document.
+    */
+    if ((style->doc != NULL) &&
+	XSLT_HAS_INTERNAL_NSMAP(style))
+    {
+	xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style),
+	    style->doc);	
+    }
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+#else
+    /*
+    * Start with a cleanup of the main stylesheet's doc.
+    */
+    if ((style->parent == NULL) && (style->doc))
+	xsltCleanupStylesheetTree(style->doc,
+	    xmlDocGetRootElement(style->doc));
+#endif /* XSLT_REFACTORED */
+
+    xsltFreeKeys(style);
+    xsltFreeExts(style);
+    xsltFreeTemplateHashes(style);
+    xsltFreeDecimalFormatList(style);
+    xsltFreeTemplateList(style->templates);
+    xsltFreeAttributeSetsHashes(style);
+    xsltFreeNamespaceAliasHashes(style);
+    xsltFreeStylePreComps(style);
+    /*
+    * Free documents of all included stylsheet modules of this
+    * stylesheet level.
+    */
+    xsltFreeStyleDocuments(style);
+    /*
+    * TODO: Best time to shutdown extension stuff?
+    */
+    xsltShutdownExts(style);
+       
+    if (style->variables != NULL)
+        xsltFreeStackElemList(style->variables);
+    if (style->cdataSection != NULL)
+        xmlHashFree(style->cdataSection, NULL);
+    if (style->stripSpaces != NULL)
+        xmlHashFree(style->stripSpaces, NULL);
+    if (style->nsHash != NULL)
+        xmlHashFree(style->nsHash, NULL);
+    if (style->exclPrefixTab != NULL)
+        xmlFree(style->exclPrefixTab);
+    if (style->method != NULL)
+        xmlFree(style->method);
+    if (style->methodURI != NULL)
+        xmlFree(style->methodURI);
+    if (style->version != NULL)
+        xmlFree(style->version);
+    if (style->encoding != NULL)
+        xmlFree(style->encoding);
+    if (style->doctypePublic != NULL)
+        xmlFree(style->doctypePublic);
+    if (style->doctypeSystem != NULL)
+        xmlFree(style->doctypeSystem);
+    if (style->mediaType != NULL)
+        xmlFree(style->mediaType);
+    if (style->attVTs)
+        xsltFreeAVTList(style->attVTs);
+    if (style->imports != NULL)
+        xsltFreeStylesheetList(style->imports);
+
+#ifdef XSLT_REFACTORED
+    /*
+    * If this is the principal stylesheet, then
+    * free its internal data.
+    */
+    if (style->principal == style) {
+	if (style->principalData) {
+	    xsltFreePrincipalStylesheetData(style->principalData);
+	    style->principalData = NULL;
+	}
+    }    
+#endif
+    /*
+    * Better to free the main document of this stylesheet level
+    * at the end - so here.
+    */
+    if (style->doc != NULL) {	
+        xmlFreeDoc(style->doc);
+    }
+
+#ifdef WITH_XSLT_DEBUG
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "freeing dictionary from stylesheet\n");
+#endif
+    xmlDictFree(style->dict);
+
+    memset(style, -1, sizeof(xsltStylesheet));
+    xmlFree(style);
+}
+
+/************************************************************************
+ *									*
+ *		Parsing of an XSLT Stylesheet				*
+ *									*
+ ************************************************************************/
+
+#ifdef XSLT_REFACTORED
+    /*
+    * This is now performed in an optimized way in xsltParseXSLTTemplate.
+    */
+#else
+/**
+ * xsltGetInheritedNsList:
+ * @style:  the stylesheet
+ * @template: the template
+ * @node:  the current node
+ *
+ * Search all the namespace applying to a given element except the ones 
+ * from excluded output prefixes currently in scope. Initialize the
+ * template inheritedNs list with it.
+ *
+ * Returns the number of entries found
+ */
+static int
+xsltGetInheritedNsList(xsltStylesheetPtr style,
+	               xsltTemplatePtr template,
+	               xmlNodePtr node)
+{
+    xmlNsPtr cur;
+    xmlNsPtr *ret = NULL;
+    int nbns = 0;
+    int maxns = 10;
+    int i;    
+
+    if ((style == NULL) || (template == NULL) || (node == NULL) ||
+	(template->inheritedNsNr != 0) || (template->inheritedNs != NULL))
+	return(0);
+    while (node != NULL) {
+        if (node->type == XML_ELEMENT_NODE) {
+            cur = node->nsDef;
+            while (cur != NULL) {
+		if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
+		    goto skip_ns;
+
+		if ((cur->prefix != NULL) &&
+		    (xsltCheckExtPrefix(style, cur->prefix)))
+		    goto skip_ns;
+		/*
+		* Check if this namespace was excluded.
+		* Note that at this point only the exclusions defined
+		* on the topmost stylesheet element are in the exclusion-list.
+		*/
+		for (i = 0;i < style->exclPrefixNr;i++) {
+		    if (xmlStrEqual(cur->href, style->exclPrefixTab[i]))
+			goto skip_ns;
+		}
+                if (ret == NULL) {
+                    ret =
+                        (xmlNsPtr *) xmlMalloc((maxns + 1) *
+                                               sizeof(xmlNsPtr));
+                    if (ret == NULL) {
+                        xmlGenericError(xmlGenericErrorContext,
+                                        "xsltGetInheritedNsList : out of memory!\n");
+                        return(0);
+                    }
+                    ret[nbns] = NULL;
+                }
+		/*
+		* Skip shadowed namespace bindings.
+		*/
+                for (i = 0; i < nbns; i++) {
+                    if ((cur->prefix == ret[i]->prefix) ||
+                        (xmlStrEqual(cur->prefix, ret[i]->prefix)))
+                        break;
+                }
+                if (i >= nbns) {
+                    if (nbns >= maxns) {
+                        maxns *= 2;
+                        ret = (xmlNsPtr *) xmlRealloc(ret,
+                                                      (maxns +
+                                                       1) *
+                                                      sizeof(xmlNsPtr));
+                        if (ret == NULL) {
+                            xmlGenericError(xmlGenericErrorContext,
+                                            "xsltGetInheritedNsList : realloc failed!\n");
+                            return(0);
+                        }
+                    }
+                    ret[nbns++] = cur;
+                    ret[nbns] = NULL;
+                }
+skip_ns:
+                cur = cur->next;
+            }
+        }
+        node = node->parent;
+    }
+    if (nbns != 0) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+        xsltGenericDebug(xsltGenericDebugContext,
+                         "template has %d inherited namespaces\n", nbns);
+#endif
+	template->inheritedNsNr = nbns;
+	template->inheritedNs = ret;
+    }
+    return (nbns);
+}
+#endif /* else of XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetOutput:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "output" element
+ *
+ * parse an XSLT stylesheet output element and record
+ * information related to the stylesheet output
+ */
+
+void
+xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
+{
+    xmlChar *elements,
+     *prop;
+    xmlChar *element,
+     *end;
+
+    if ((cur == NULL) || (style == NULL))
+        return;
+   
+    prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL);
+    if (prop != NULL) {
+        if (style->version != NULL)
+            xmlFree(style->version);
+        style->version = prop;
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "encoding", NULL);
+    if (prop != NULL) {
+        if (style->encoding != NULL)
+            xmlFree(style->encoding);
+        style->encoding = prop;
+    }
+
+    /* relaxed to support xt:document
+    * TODO KB: What does "relaxed to support xt:document" mean?
+    */
+    prop = xmlGetNsProp(cur, (const xmlChar *) "method", NULL);
+    if (prop != NULL) {
+        const xmlChar *URI;
+
+        if (style->method != NULL)
+            xmlFree(style->method);
+        style->method = NULL;
+        if (style->methodURI != NULL)
+            xmlFree(style->methodURI);
+        style->methodURI = NULL;
+
+	/*
+	* TODO: Don't use xsltGetQNameURI().
+	*/
+	URI = xsltGetQNameURI(cur, &prop);
+	if (prop == NULL) {
+	    if (style != NULL) style->errors++;
+	} else if (URI == NULL) {
+            if ((xmlStrEqual(prop, (const xmlChar *) "xml")) ||
+                (xmlStrEqual(prop, (const xmlChar *) "html")) ||
+                (xmlStrEqual(prop, (const xmlChar *) "text"))) {
+                style->method = prop;
+            } else {
+		xsltTransformError(NULL, style, cur,
+                                 "invalid value for method: %s\n", prop);
+                if (style != NULL) style->warnings++;
+            }
+	} else {
+	    style->method = prop;
+	    style->methodURI = xmlStrdup(URI);
+	}
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-system", NULL);
+    if (prop != NULL) {
+        if (style->doctypeSystem != NULL)
+            xmlFree(style->doctypeSystem);
+        style->doctypeSystem = prop;
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-public", NULL);
+    if (prop != NULL) {
+        if (style->doctypePublic != NULL)
+            xmlFree(style->doctypePublic);
+        style->doctypePublic = prop;
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "standalone", NULL);
+    if (prop != NULL) {
+        if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+            style->standalone = 1;
+        } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+            style->standalone = 0;
+        } else {
+	    xsltTransformError(NULL, style, cur,
+                             "invalid value for standalone: %s\n", prop);
+            style->errors++;
+        }
+        xmlFree(prop);
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "indent", NULL);
+    if (prop != NULL) {
+        if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+            style->indent = 1;
+        } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+            style->indent = 0;
+        } else {
+	    xsltTransformError(NULL, style, cur,
+                             "invalid value for indent: %s\n", prop);
+            style->errors++;
+        }
+        xmlFree(prop);
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "omit-xml-declaration", NULL);
+    if (prop != NULL) {
+        if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
+            style->omitXmlDeclaration = 1;
+        } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
+            style->omitXmlDeclaration = 0;
+        } else {
+	    xsltTransformError(NULL, style, cur,
+                             "invalid value for omit-xml-declaration: %s\n",
+                             prop);
+            style->errors++;
+        }
+        xmlFree(prop);
+    }
+
+    elements = xmlGetNsProp(cur, (const xmlChar *) "cdata-section-elements",
+	NULL);
+    if (elements != NULL) {
+        if (style->cdataSection == NULL)
+            style->cdataSection = xmlHashCreate(10);
+        if (style->cdataSection == NULL)
+            return;
+
+        element = elements;
+        while (*element != 0) {
+            while (IS_BLANK(*element))
+                element++;
+            if (*element == 0)
+                break;
+            end = element;
+            while ((*end != 0) && (!IS_BLANK(*end)))
+                end++;
+            element = xmlStrndup(element, end - element);
+            if (element) {		
+#ifdef WITH_XSLT_DEBUG_PARSING
+                xsltGenericDebug(xsltGenericDebugContext,
+                                 "add cdata section output element %s\n",
+                                 element);
+#endif
+		if (xmlValidateQName(BAD_CAST element, 0) != 0) {
+		    xsltTransformError(NULL, style, cur,
+			"Attribute 'cdata-section-elements': The value "
+			"'%s' is not a valid QName.\n", element);
+		    xmlFree(element);
+		    style->errors++;
+		} else {
+		    const xmlChar *URI;
+
+		    /*
+		    * TODO: Don't use xsltGetQNameURI().
+		    */
+		    URI = xsltGetQNameURI(cur, &element);
+		    if (element == NULL) {
+			/*
+			* TODO: We'll report additionally an error
+			*  via the stylesheet's error handling.			
+			*/
+			xsltTransformError(NULL, style, cur,
+			    "Attribute 'cdata-section-elements': The value "
+			    "'%s' is not a valid QName.\n", element);
+			style->errors++;
+		    } else {
+			xmlNsPtr ns;
+			
+			/*
+			* XSLT-1.0 "Each QName is expanded into an
+			*  expanded-name using the namespace declarations in
+			*  effect on the xsl:output element in which the QName
+			*  occurs; if there is a default namespace, it is used
+			*  for QNames that do not have a prefix"
+			* NOTE: Fix of bug #339570.
+			*/
+			if (URI == NULL) {
+			    ns = xmlSearchNs(style->doc, cur, NULL);
+			    if (ns != NULL)
+				URI = ns->href;
+			}		   
+			xmlHashAddEntry2(style->cdataSection, element, URI,
+			    (void *) "cdata");
+			xmlFree(element);
+		    }
+		}
+            }
+            element = end;
+        }
+        xmlFree(elements);
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *) "media-type", NULL);
+    if (prop != NULL) {
+	if (style->mediaType)
+	    xmlFree(style->mediaType);
+	style->mediaType = prop;
+    }
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
+}
+
+/**
+ * xsltParseStylesheetDecimalFormat:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "decimal-format" element
+ *
+ * 
+ * 
+ *
+ * parse an XSLT stylesheet decimal-format element and
+ * and record the formatting characteristics
+ */
+static void
+xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur)
+{
+    xmlChar *prop;
+    xsltDecimalFormatPtr format;
+    xsltDecimalFormatPtr iter;
+    
+    if ((cur == NULL) || (style == NULL))
+	return;
+
+    format = style->decimalFormat;
+    
+    prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL);
+    if (prop != NULL) {
+	format = xsltDecimalFormatGetByName(style, prop);
+	if (format != NULL) {
+	    xsltTransformError(NULL, style, cur,
+	 "xsltParseStylestyleDecimalFormat: %s already exists\n", prop);
+	    if (style != NULL) style->warnings++;
+	    return;
+	}
+	format = xsltNewDecimalFormat(prop);
+	if (format == NULL) {
+	    xsltTransformError(NULL, style, cur,
+     "xsltParseStylestyleDecimalFormat: failed creating new decimal-format\n");
+	    if (style != NULL) style->errors++;
+	    return;
+	}
+	/* Append new decimal-format structure */
+	for (iter = style->decimalFormat; iter->next; iter = iter->next)
+	    ;
+	if (iter)
+	    iter->next = format;
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *)"decimal-separator", NULL);
+    if (prop != NULL) {
+	if (format->decimalPoint != NULL) xmlFree(format->decimalPoint);
+	format->decimalPoint  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"grouping-separator", NULL);
+    if (prop != NULL) {
+	if (format->grouping != NULL) xmlFree(format->grouping);
+	format->grouping  = prop;
+    }
+
+    prop = xmlGetNsProp(cur, (const xmlChar *)"infinity", NULL);
+    if (prop != NULL) {
+	if (format->infinity != NULL) xmlFree(format->infinity);
+	format->infinity  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"minus-sign", NULL);
+    if (prop != NULL) {
+	if (format->minusSign != NULL) xmlFree(format->minusSign);
+	format->minusSign  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"NaN", NULL);
+    if (prop != NULL) {
+	if (format->noNumber != NULL) xmlFree(format->noNumber);
+	format->noNumber  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"percent", NULL);
+    if (prop != NULL) {
+	if (format->percent != NULL) xmlFree(format->percent);
+	format->percent  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"per-mille", NULL);
+    if (prop != NULL) {
+	if (format->permille != NULL) xmlFree(format->permille);
+	format->permille  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"zero-digit", NULL);
+    if (prop != NULL) {
+	if (format->zeroDigit != NULL) xmlFree(format->zeroDigit);
+	format->zeroDigit  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"digit", NULL);
+    if (prop != NULL) {
+	if (format->digit != NULL) xmlFree(format->digit);
+	format->digit  = prop;
+    }
+    
+    prop = xmlGetNsProp(cur, (const xmlChar *)"pattern-separator", NULL);
+    if (prop != NULL) {
+	if (format->patternSeparator != NULL) xmlFree(format->patternSeparator);
+	format->patternSeparator  = prop;
+    }
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
+}
+
+/**
+ * xsltParseStylesheetPreserveSpace:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "preserve-space" element
+ *
+ * parse an XSLT stylesheet preserve-space element and record
+ * elements needing preserving
+ */
+
+static void
+xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+    xmlChar *elements;
+    xmlChar *element, *end;
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+
+    elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+    if (elements == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsltParseStylesheetPreserveSpace: missing elements attribute\n");
+	if (style != NULL) style->warnings++;
+	return;
+    }
+
+    if (style->stripSpaces == NULL)
+	style->stripSpaces = xmlHashCreate(10);
+    if (style->stripSpaces == NULL)
+	return;
+
+    element = elements;
+    while (*element != 0) {
+	while (IS_BLANK(*element)) element++;
+	if (*element == 0)
+	    break;
+        end = element;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	element = xmlStrndup(element, end - element);
+	if (element) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add preserved space element %s\n", element);
+#endif
+	    if (xmlStrEqual(element, (const xmlChar *)"*")) {
+		style->stripAll = -1;
+	    } else {
+		const xmlChar *URI;
+
+		/*
+		* TODO: Don't use xsltGetQNameURI().
+		*/
+                URI = xsltGetQNameURI(cur, &element);
+
+		xmlHashAddEntry2(style->stripSpaces, element, URI,
+				(xmlChar *) "preserve");
+	    }
+	    xmlFree(element);
+	}
+	element = end;
+    }
+    xmlFree(elements);
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
+}
+
+#ifdef XSLT_REFACTORED
+#else
+/**
+ * xsltParseStylesheetExtPrefix:
+ * @style:  the XSLT stylesheet
+ * @template:  the "extension-element-prefixes" prefix
+ *
+ * parse an XSLT stylesheet's "extension-element-prefix" attribute value
+ * and register the namespaces of extension instruction.
+ * SPEC "A namespace is designated as an extension namespace by using
+ *   an extension-element-prefixes attribute on:
+ *   1) an xsl:stylesheet element
+ *   2) an xsl:extension-element-prefixes attribute on a
+ *      literal result element 
+ *   3) an extension instruction."
+ */
+static void
+xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+			     int isXsltElem) {
+    xmlChar *prefixes;
+    xmlChar *prefix, *end;
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+
+    if (isXsltElem) {
+	/* For xsl:stylesheet/xsl:transform. */
+	prefixes = xmlGetNsProp(cur,
+	    (const xmlChar *)"extension-element-prefixes", NULL);
+    } else {
+	/* For literal result elements and extension instructions. */
+	prefixes = xmlGetNsProp(cur,
+	    (const xmlChar *)"extension-element-prefixes", XSLT_NAMESPACE);
+    }
+    if (prefixes == NULL) {
+	return;
+    }
+
+    prefix = prefixes;
+    while (*prefix != 0) {
+	while (IS_BLANK(*prefix)) prefix++;
+	if (*prefix == 0)
+	    break;
+        end = prefix;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	prefix = xmlStrndup(prefix, end - prefix);
+	if (prefix) {
+	    xmlNsPtr ns;
+
+	    if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
+		ns = xmlSearchNs(style->doc, cur, NULL);
+	    else
+		ns = xmlSearchNs(style->doc, cur, prefix);
+	    if (ns == NULL) {
+		xsltTransformError(NULL, style, cur,
+	    "xsl:extension-element-prefix : undefined namespace %s\n",
+	                         prefix);
+		if (style != NULL) style->warnings++;
+	    } else {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "add extension prefix %s\n", prefix);
+#endif
+		xsltRegisterExtPrefix(style, prefix, ns->href);
+	    }
+	    xmlFree(prefix);
+	}
+	prefix = end;
+    }
+    xmlFree(prefixes);
+}
+#endif /* else of XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetStripSpace:
+ * @style:  the XSLT stylesheet
+ * @cur:  the "strip-space" element
+ *
+ * parse an XSLT stylesheet's strip-space element and record
+ * the elements needing stripping
+ */
+
+static void
+xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+    xmlChar *elements;
+    xmlChar *element, *end;
+
+    if ((cur == NULL) || (style == NULL))
+	return;
+
+    elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+    if (elements == NULL) {
+	xsltTransformError(NULL, style, cur,
+	    "xsltParseStylesheetStripSpace: missing elements attribute\n");
+	if (style != NULL) style->warnings++;
+	return;
+    }
+
+    if (style->stripSpaces == NULL)
+	style->stripSpaces = xmlHashCreate(10);
+    if (style->stripSpaces == NULL)
+	return;
+
+    element = elements;
+    while (*element != 0) {
+	while (IS_BLANK(*element)) element++;
+	if (*element == 0)
+	    break;
+        end = element;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	element = xmlStrndup(element, end - element);
+	if (element) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add stripped space element %s\n", element);
+#endif
+	    if (xmlStrEqual(element, (const xmlChar *)"*")) {
+		style->stripAll = 1;
+	    } else {
+		const xmlChar *URI;
+
+		/*
+		* TODO: Don't use xsltGetQNameURI().
+		*/
+                URI = xsltGetQNameURI(cur, &element);
+
+		xmlHashAddEntry2(style->stripSpaces, element, URI,
+			        (xmlChar *) "strip");
+	    }
+	    xmlFree(element);
+	}
+	element = end;
+    }
+    xmlFree(elements);
+    if (cur->children != NULL) {
+	xsltParseContentError(style, cur->children);
+    }
+}
+
+#ifdef XSLT_REFACTORED
+#else
+/**
+ * xsltParseStylesheetExcludePrefix:
+ * @style:  the XSLT stylesheet
+ * @cur:  the current point in the stylesheet
+ *
+ * parse an XSLT stylesheet exclude prefix and record
+ * namespaces needing stripping
+ *
+ * Returns the number of Excluded prefixes added at that level
+ */
+
+static int
+xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+				 int isXsltElem)
+{
+    int nb = 0;
+    xmlChar *prefixes;
+    xmlChar *prefix, *end;
+
+    if ((cur == NULL) || (style == NULL))
+	return(0);
+
+    if (isXsltElem)
+	prefixes = xmlGetNsProp(cur,
+	    (const xmlChar *)"exclude-result-prefixes", NULL);
+    else
+	prefixes = xmlGetNsProp(cur,
+	    (const xmlChar *)"exclude-result-prefixes", XSLT_NAMESPACE);
+
+    if (prefixes == NULL) {
+	return(0);
+    }
+
+    prefix = prefixes;
+    while (*prefix != 0) {
+	while (IS_BLANK(*prefix)) prefix++;
+	if (*prefix == 0)
+	    break;
+        end = prefix;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	prefix = xmlStrndup(prefix, end - prefix);
+	if (prefix) {
+	    xmlNsPtr ns;
+
+	    if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
+		ns = xmlSearchNs(style->doc, cur, NULL);
+	    else
+		ns = xmlSearchNs(style->doc, cur, prefix);
+	    if (ns == NULL) {
+		xsltTransformError(NULL, style, cur,
+	    "xsl:exclude-result-prefixes : undefined namespace %s\n",
+	                         prefix);
+		if (style != NULL) style->warnings++;
+	    } else {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "exclude result prefix %s\n", prefix);
+#endif
+		exclPrefixPush(style, (xmlChar *) ns->href);
+		nb++;
+	    }
+	    xmlFree(prefix);
+	}
+	prefix = end;
+    }
+    xmlFree(prefixes);
+    return(nb);
+}
+#endif /* else of XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+
+/*
+* xsltTreeEnsureXMLDecl:
+* @doc: the doc
+* 
+* BIG NOTE:
+*  This was copy&pasted from Libxml2's xmlTreeEnsureXMLDecl() in "tree.c".
+* Ensures that there is an XML namespace declaration on the doc.
+* 
+* Returns the XML ns-struct or NULL on API and internal errors.
+*/
+static xmlNsPtr
+xsltTreeEnsureXMLDecl(xmlDocPtr doc)
+{
+    if (doc == NULL)
+	return (NULL);
+    if (doc->oldNs != NULL)
+	return (doc->oldNs);
+    {
+	xmlNsPtr ns;
+	ns = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
+	if (ns == NULL) {
+	    xmlGenericError(xmlGenericErrorContext,
+		"xsltTreeEnsureXMLDecl: Failed to allocate "
+		"the XML namespace.\n");	
+	    return (NULL);
+	}
+	memset(ns, 0, sizeof(xmlNs));
+	ns->type = XML_LOCAL_NAMESPACE;
+	/*
+	* URGENT TODO: revisit this.
+	*/
+#ifdef LIBXML_NAMESPACE_DICT
+	if (doc->dict)
+	    ns->href = xmlDictLookup(doc->dict, XML_XML_NAMESPACE, -1);
+	else
+	    ns->href = xmlStrdup(XML_XML_NAMESPACE);
+#else
+	ns->href = xmlStrdup(XML_XML_NAMESPACE); 
+#endif
+	ns->prefix = xmlStrdup((const xmlChar *)"xml");
+	doc->oldNs = ns;
+	return (ns);
+    }
+}
+
+/*
+* xsltTreeAcquireStoredNs:
+* @doc: the doc
+* @nsName: the namespace name
+* @prefix: the prefix
+* 
+* BIG NOTE:
+*  This was copy&pasted from Libxml2's xmlDOMWrapStoreNs() in "tree.c".
+* Creates or reuses an xmlNs struct on doc->oldNs with
+* the given prefix and namespace name.
+* 
+* Returns the aquired ns struct or NULL in case of an API
+*         or internal error.
+*/
+static xmlNsPtr
+xsltTreeAcquireStoredNs(xmlDocPtr doc,
+			const xmlChar *nsName,
+			const xmlChar *prefix)
+{
+    xmlNsPtr ns;
+
+    if (doc == NULL)
+	return (NULL);
+    if (doc->oldNs != NULL)
+	ns = doc->oldNs;
+    else
+	ns = xsltTreeEnsureXMLDecl(doc);
+    if (ns == NULL)
+	return (NULL);
+    if (ns->next != NULL) {
+	/* Reuse. */
+	ns = ns->next;
+	while (ns != NULL) {
+	    if ((ns->prefix == NULL) != (prefix == NULL)) {
+		/* NOP */
+	    } else if (prefix == NULL) {
+		if (xmlStrEqual(ns->href, nsName))
+		    return (ns);
+	    } else {
+		if ((ns->prefix[0] == prefix[0]) &&
+		     xmlStrEqual(ns->prefix, prefix) &&
+		     xmlStrEqual(ns->href, nsName))
+		    return (ns);
+		
+	    }
+	    if (ns->next == NULL)
+		break;
+	    ns = ns->next;
+	}
+    }
+    /* Create. */
+    ns->next = xmlNewNs(NULL, nsName, prefix);
+    return (ns->next);
+}
+
+/**
+ * xsltLREBuildEffectiveNs:
+ *
+ * Apply ns-aliasing on the namespace of the given @elem and
+ * its attributes.
+ */
+static int
+xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt,
+			xmlNodePtr elem)
+{
+    xmlNsPtr ns;
+    xsltNsAliasPtr alias;
+
+    if ((cctxt == NULL) || (elem == NULL))
+	return(-1);
+    if ((cctxt->nsAliases == NULL) || (! cctxt->hasNsAliases))
+	return(0);
+
+    alias = cctxt->nsAliases;    		
+    while (alias != NULL) {
+	if ( /* If both namespaces are NULL... */
+	    ( (elem->ns == NULL) &&
+	    ((alias->literalNs == NULL) ||
+	    (alias->literalNs->href == NULL)) ) ||
+	    /* ... or both namespace are equal */
+	    ( (elem->ns != NULL) &&
+	    (alias->literalNs != NULL) &&
+	    xmlStrEqual(elem->ns->href, alias->literalNs->href) ) )
+	{
+	    if ((alias->targetNs != NULL) &&
+		(alias->targetNs->href != NULL))
+	    {
+		/*
+		* Convert namespace.
+		*/
+		if (elem->doc == alias->docOfTargetNs) {
+		    /*
+		    * This is the nice case: same docs.
+		    * This will eventually assign a ns-decl which
+		    * is shadowed, but this has no negative effect on
+		    * the generation of the result tree.
+		    */
+		    elem->ns = alias->targetNs;
+		} else {
+		    /*
+		    * This target xmlNs originates from a different
+		    * stylesheet tree. Try to locate it in the
+		    * in-scope namespaces.
+		    * OPTIMIZE TODO: Use the compiler-node-info inScopeNs.
+		    */
+		    ns = xmlSearchNs(elem->doc, elem,
+			alias->targetNs->prefix);		    
+		    /*
+		    * If no matching ns-decl found, then assign a
+		    * ns-decl stored in xmlDoc.
+		    */
+		    if ((ns == NULL) ||
+			(! xmlStrEqual(ns->href, alias->targetNs->href)))
+		    {
+			/*
+			* BIG NOTE: The use of xsltTreeAcquireStoredNs()
+			*  is not very efficient, but currently I don't
+			*  see an other way of *safely* changing a node's
+			*  namespace, since the xmlNs struct in
+			*  alias->targetNs might come from an other
+			*  stylesheet tree. So we need to anchor it in the
+			*  current document, without adding it to the tree,
+			*  which would otherwise change the in-scope-ns
+			*  semantic of the tree.
+			*/
+			ns = xsltTreeAcquireStoredNs(elem->doc,
+			    alias->targetNs->href,
+			    alias->targetNs->prefix);
+			
+			if (ns == NULL) {
+			    xsltTransformError(NULL, cctxt->style, elem,
+				"Internal error in "
+				"xsltLREBuildEffectiveNs(): "
+				"failed to acquire a stored "
+				"ns-declaration.\n");
+			    cctxt->style->errors++;
+			    return(-1);
+			    
+			}
+		    }
+		    elem->ns = ns;
+		}		   
+	    } else {
+		/*
+		* Move into or leave in the NULL namespace.
+		*/
+		elem->ns = NULL;
+	    }
+	    break;
+	}
+	alias = alias->next;
+    }
+    /*
+    * Same with attributes of literal result elements.
+    */
+    if (elem->properties != NULL) {
+	xmlAttrPtr attr = elem->properties;
+	
+	while (attr != NULL) {
+	    if (attr->ns == NULL) {
+		attr = attr->next;
+		continue;
+	    }
+	    alias = cctxt->nsAliases;
+	    while (alias != NULL) {
+		if ( /* If both namespaces are NULL... */
+		    ( (elem->ns == NULL) &&
+		    ((alias->literalNs == NULL) ||
+		    (alias->literalNs->href == NULL)) ) ||
+		    /* ... or both namespace are equal */
+		    ( (elem->ns != NULL) &&
+		    (alias->literalNs != NULL) &&
+		    xmlStrEqual(elem->ns->href, alias->literalNs->href) ) )
+		{
+		    if ((alias->targetNs != NULL) &&
+			(alias->targetNs->href != NULL))
+		    {		    
+			if (elem->doc == alias->docOfTargetNs) {
+			    elem->ns = alias->targetNs;
+			} else {
+			    ns = xmlSearchNs(elem->doc, elem,
+				alias->targetNs->prefix);
+			    if ((ns == NULL) ||
+				(! xmlStrEqual(ns->href, alias->targetNs->href)))
+			    {
+				ns = xsltTreeAcquireStoredNs(elem->doc,
+				    alias->targetNs->href,
+				    alias->targetNs->prefix);
+				
+				if (ns == NULL) {
+				    xsltTransformError(NULL, cctxt->style, elem,
+					"Internal error in "
+					"xsltLREBuildEffectiveNs(): "
+					"failed to acquire a stored "
+					"ns-declaration.\n");
+				    cctxt->style->errors++;
+				    return(-1);
+				    
+				}
+			    }
+			    elem->ns = ns;
+			}
+		    } else {
+		    /*
+		    * Move into or leave in the NULL namespace.
+			*/
+			elem->ns = NULL;
+		    }
+		    break;
+		}
+		alias = alias->next;
+	    }
+	    
+	    attr = attr->next;
+	}
+    }
+    return(0);
+}
+
+/**
+ * xsltLREBuildEffectiveNsNodes:
+ *
+ * Computes the effective namespaces nodes for a literal result
+ * element.
+ * @effectiveNs is the set of effective ns-nodes
+ *  on the literal result element, which will be added to the result
+ *  element if not already existing in the result tree.
+ *  This means that excluded namespaces (via exclude-result-prefixes,
+ *  extension-element-prefixes and the XSLT namespace) not added
+ *  to the set.
+ *  Namespace-aliasing was applied on the @effectiveNs.
+ */
+static int
+xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt,
+			     xsltStyleItemLRElementInfoPtr item,
+			     xmlNodePtr elem,
+			     int isLRE)
+{
+    xmlNsPtr ns, tmpns;
+    xsltEffectiveNsPtr effNs, lastEffNs = NULL;
+    int i, j, holdByElem;
+    xsltPointerListPtr extElemNs = cctxt->inode->extElemNs;
+    xsltPointerListPtr exclResultNs = cctxt->inode->exclResultNs;
+
+    if ((cctxt == NULL) || (cctxt->inode == NULL) || (elem == NULL) ||
+	(item == NULL) || (item->effectiveNs != NULL))
+	return(-1);
+
+    if (item->inScopeNs == NULL)    
+	return(0);
+
+    extElemNs = cctxt->inode->extElemNs;
+    exclResultNs = cctxt->inode->exclResultNs;
+
+    for (i = 0; i < item->inScopeNs->totalNumber; i++) {
+	ns = item->inScopeNs->list[i];
+	/*
+	* Skip namespaces designated as excluded namespaces
+	* -------------------------------------------------
+	*
+	* XSLT-20 TODO: In XSLT 2.0 we need to keep namespaces
+	*  which are target namespaces of namespace-aliases
+	*  regardless if designated as excluded.
+	*
+	* Exclude the XSLT namespace.
+	*/
+	if (xmlStrEqual(ns->href, XSLT_NAMESPACE))
+	    goto skip_ns;
+
+	/*
+	* Apply namespace aliasing
+	* ------------------------
+	*
+	* SPEC XSLT 2.0
+	*  "- A namespace node whose string value is a literal namespace
+	*     URI is not copied to the result tree.
+	*   - A namespace node whose string value is a target namespace URI
+	*     is copied to the result tree, whether or not the URI
+	*     identifies an excluded namespace."
+	* 
+	* NOTE: The ns-aliasing machanism is non-cascading.
+	*  (checked with Saxon, Xalan and MSXML .NET).
+	* URGENT TODO: is style->nsAliases the effective list of
+	*  ns-aliases, or do we need to lookup the whole
+	*  import-tree?
+	* TODO: Get rid of import-tree lookup.
+	*/
+	if (cctxt->hasNsAliases) {
+	    xsltNsAliasPtr alias;
+	    /*
+	    * First check for being a target namespace.
+	    */
+	    alias = cctxt->nsAliases;
+	    do {
+		/*
+		* TODO: Is xmlns="" handled already?
+		*/
+		if ((alias->targetNs != NULL) &&
+		    (xmlStrEqual(alias->targetNs->href, ns->href)))
+		{
+		    /*
+		    * Recognized as a target namespace; use it regardless
+		    * if excluded otherwise.
+		    */
+		    goto add_effective_ns;
+		}
+		alias = alias->next;
+	    } while (alias != NULL);
+
+	    alias = cctxt->nsAliases;
+	    do {
+		/*
+		* TODO: Is xmlns="" handled already?
+		*/
+		if ((alias->literalNs != NULL) &&
+		    (xmlStrEqual(alias->literalNs->href, ns->href)))
+		{
+		    /*
+		    * Recognized as an namespace alias; do not use it.
+		    */
+		    goto skip_ns;
+		}
+		alias = alias->next;
+	    } while (alias != NULL);
+	}
+	
+	/*
+	* Exclude excluded result namespaces.
+	*/
+	if (exclResultNs) {
+	    for (j = 0; j < exclResultNs->number; j++)
+		if (xmlStrEqual(ns->href, BAD_CAST exclResultNs->items[j]))
+		    goto skip_ns;
+	}
+	/*
+	* Exclude extension-element namespaces.
+	*/
+	if (extElemNs) {
+	    for (j = 0; j < extElemNs->number; j++)
+		if (xmlStrEqual(ns->href, BAD_CAST extElemNs->items[j]))
+		    goto skip_ns;
+	}
+
+add_effective_ns:
+	/*
+	* OPTIMIZE TODO: This information may not be needed.
+	*/
+	if (isLRE && (elem->nsDef != NULL)) {
+	    holdByElem = 0;
+	    tmpns = elem->nsDef;
+	    do {
+		if (tmpns == ns) {
+		    holdByElem = 1;
+		    break;
+		}
+		tmpns = tmpns->next;
+	    } while (tmpns != NULL);	    
+	} else
+	    holdByElem = 0;
+	
+	
+	/*
+	* Add the effective namespace declaration.
+	*/
+	effNs = (xsltEffectiveNsPtr) xmlMalloc(sizeof(xsltEffectiveNs));
+	if (effNs == NULL) {
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"Internal error in xsltLREBuildEffectiveNs(): "
+		"failed to allocate memory.\n");
+	    cctxt->style->errors++;
+	    return(-1);
+	}
+	if (cctxt->psData->effectiveNs == NULL) {
+	    cctxt->psData->effectiveNs = effNs;
+	    effNs->nextInStore = NULL;	 
+	} else {
+	    effNs->nextInStore = cctxt->psData->effectiveNs;
+	    cctxt->psData->effectiveNs = effNs;
+	}
+
+	effNs->next = NULL;
+	effNs->prefix = ns->prefix;
+	effNs->nsName = ns->href;
+	effNs->holdByElem = holdByElem;
+	
+	if (lastEffNs == NULL)
+	    item->effectiveNs = effNs;
+	else
+	    lastEffNs->next = effNs;
+	lastEffNs = effNs;
+	
+skip_ns:
+	{}
+    }
+    return(0);
+}
+
+
+/**
+ * xsltLREInfoCreate:
+ *
+ * @isLRE: indicates if the given @elem is a literal result element
+ *
+ * Creates a new info for a literal result element.
+ */
+static int
+xsltLREInfoCreate(xsltCompilerCtxtPtr cctxt,
+		  xmlNodePtr elem,
+		  int isLRE)
+{
+    xsltStyleItemLRElementInfoPtr item;
+
+    if ((cctxt == NULL) || (cctxt->inode == NULL))
+	return(-1);
+
+    item = (xsltStyleItemLRElementInfoPtr)
+	xmlMalloc(sizeof(xsltStyleItemLRElementInfo));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltLREInfoCreate(): "
+	    "memory allocation failed.\n");
+	cctxt->style->errors++;
+	return(-1);
+    }
+    memset(item, 0, sizeof(xsltStyleItemLRElementInfo));
+    item->type = XSLT_FUNC_LITERAL_RESULT_ELEMENT;
+    /*
+    * Store it in the stylesheet.
+    */
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+    /*
+    * @inScopeNs are used for execution of XPath expressions
+    *  in AVTs.
+    */
+    item->inScopeNs = cctxt->inode->inScopeNs;
+    
+    if (elem)
+	xsltLREBuildEffectiveNsNodes(cctxt, item, elem, isLRE);
+
+    cctxt->inode->litResElemInfo = item;
+    cctxt->inode->nsChanged = 0;
+    cctxt->maxLREs++;
+    return(0);
+}
+
+/**
+ * xsltCompilerVarInfoPush: 
+ * @cctxt: the compilation context
+ * 
+ * Pushes a new var/param info onto the stack.
+ *
+ * Returns the acquired variable info.
+ */ 
+static xsltVarInfoPtr
+xsltCompilerVarInfoPush(xsltCompilerCtxtPtr cctxt,
+				  xmlNodePtr inst,
+				  const xmlChar *name,
+				  const xmlChar *nsName)
+{
+    xsltVarInfoPtr ivar;
+
+    if ((cctxt->ivar != NULL) && (cctxt->ivar->next != NULL)) {
+	ivar = cctxt->ivar->next;
+    } else if ((cctxt->ivar == NULL) && (cctxt->ivars != NULL)) {
+	ivar = cctxt->ivars;
+    } else {
+	ivar = (xsltVarInfoPtr) xmlMalloc(sizeof(xsltVarInfo));
+	if (ivar == NULL) {
+	    xsltTransformError(NULL, cctxt->style, inst,
+		"xsltParseInScopeVarPush: xmlMalloc() failed!\n");
+	    cctxt->style->errors++;
+	    return(NULL);
+	}
+	/* memset(retVar, 0, sizeof(xsltInScopeVar)); */
+	if (cctxt->ivars == NULL) {
+	    cctxt->ivars = ivar;
+	    ivar->prev = NULL;
+	} else {
+	    cctxt->ivar->next = ivar;
+	    ivar->prev = cctxt->ivar;
+	}
+	cctxt->ivar = ivar;
+	ivar->next = NULL;
+    }
+    ivar->depth = cctxt->depth;
+    ivar->name = name;
+    ivar->nsName = nsName;
+    return(ivar);
+}
+
+/**
+ * xsltCompilerVarInfoPop: 
+ * @cctxt: the compilation context
+ * 
+ * Pops all var/param infos from the stack, which
+ * have the current depth.
+ */ 
+static void
+xsltCompilerVarInfoPop(xsltCompilerCtxtPtr cctxt)
+{
+
+    while ((cctxt->ivar != NULL) &&
+	(cctxt->ivar->depth > cctxt->depth))
+    {
+	cctxt->ivar = cctxt->ivar->prev;
+    }
+}
+
+/*
+* xsltCompilerNodePush:
+*
+* @cctxt: the compilation context
+* @node: the node to be pushed (this can also be the doc-node)
+*
+* 
+*
+* Returns the current node info structure or
+*         NULL in case of an internal error.
+*/
+static xsltCompilerNodeInfoPtr
+xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{    
+    xsltCompilerNodeInfoPtr inode, iprev;
+
+    if ((cctxt->inode != NULL) && (cctxt->inode->next != NULL)) {	
+	inode = cctxt->inode->next;
+    } else if ((cctxt->inode == NULL) && (cctxt->inodeList != NULL)) {
+	inode = cctxt->inodeList;	
+    } else {
+	/*
+	* Create a new node-info.
+	*/
+	inode = (xsltCompilerNodeInfoPtr)
+	    xmlMalloc(sizeof(xsltCompilerNodeInfo));
+	if (inode == NULL) {
+	    xsltTransformError(NULL, cctxt->style, NULL,
+		"xsltCompilerNodePush: malloc failed.\n");
+	    return(NULL);
+	}
+	memset(inode, 0, sizeof(xsltCompilerNodeInfo));
+	if (cctxt->inodeList == NULL)
+	    cctxt->inodeList = inode;
+	else {
+	    cctxt->inodeLast->next = inode;
+	    inode->prev = cctxt->inodeLast;
+	}
+	cctxt->inodeLast = inode;
+	cctxt->maxNodeInfos++;	
+	if (cctxt->inode == NULL) {
+	    cctxt->inode = inode;
+	    /*
+	    * Create an initial literal result element info for
+	    * the root of the stylesheet.
+	    */
+	    xsltLREInfoCreate(cctxt, NULL, 0);
+	} 
+    }       
+    cctxt->depth++;
+    cctxt->inode = inode;
+    /*
+    * REVISIT TODO: Keep the reset always complete.    
+    * NOTE: Be carefull with the @node, since it might be
+    *  a doc-node.
+    */
+    inode->node = node;
+    inode->depth = cctxt->depth;
+    inode->templ = NULL;
+    inode->category = XSLT_ELEMENT_CATEGORY_XSLT;
+    inode->type = 0;
+    inode->item = NULL;
+    inode->curChildType = 0;
+    inode->extContentHandled = 0;
+    inode->isRoot = 0;
+    
+    if (inode->prev != NULL) {
+	iprev = inode->prev;
+	/*
+	* Inherit the following information:
+	* ---------------------------------
+	*
+	* In-scope namespaces
+	*/
+	inode->inScopeNs = iprev->inScopeNs;
+	/*
+	* Info for literal result elements
+	*/
+	inode->litResElemInfo = iprev->litResElemInfo;
+	inode->nsChanged = iprev->nsChanged;
+	/*
+	* Excluded result namespaces
+	*/
+	inode->exclResultNs = iprev->exclResultNs;
+	/*
+	* Extension instruction namespaces
+	*/
+	inode->extElemNs = iprev->extElemNs;
+	/*
+	* Whitespace preservation
+	*/
+	inode->preserveWhitespace = iprev->preserveWhitespace;
+	/*
+	* Forwards-compatible mode
+	*/
+	inode->forwardsCompat = iprev->forwardsCompat;	
+    } else {
+	inode->inScopeNs = NULL;
+	inode->exclResultNs = NULL;
+	inode->extElemNs = NULL;
+	inode->preserveWhitespace = 0;
+	inode->forwardsCompat = 0;
+    }
+    
+    return(inode);
+}
+
+/*
+* xsltCompilerNodePop:
+*
+* @cctxt: the compilation context
+* @node: the node to be pushed (this can also be the doc-node)
+*
+* Pops the current node info.
+*/
+static void
+xsltCompilerNodePop(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{    
+    if (cctxt->inode == NULL) {
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltCompilerNodePop: Top-node mismatch.\n");
+	return;
+    }
+    /*
+    * NOTE: Be carefull with the @node, since it might be
+    *  a doc-node.
+    */
+    if (cctxt->inode->node != node) {
+	xmlGenericError(xmlGenericErrorContext,
+	"xsltCompilerNodePop: Node mismatch.\n");
+	goto mismatch;
+    }
+    if (cctxt->inode->depth != cctxt->depth) {
+	xmlGenericError(xmlGenericErrorContext,
+	"xsltCompilerNodePop: Depth mismatch.\n");
+	goto mismatch;
+    }
+    /*
+    * Pop information of variables.
+    */
+    if ((cctxt->ivar) && (cctxt->ivar->depth > cctxt->depth))
+	xsltCompilerVarInfoPop(cctxt);
+
+    cctxt->depth--;
+    cctxt->inode = cctxt->inode->prev;
+    if (cctxt->inode != NULL)
+	cctxt->inode->curChildType = 0;
+    return;
+
+mismatch:
+    {
+	const xmlChar *nsName = NULL, *name = NULL;
+	const xmlChar *infnsName = NULL, *infname = NULL;
+	
+	if (node) {
+	    if (node->type == XML_ELEMENT_NODE) {
+		name = node->name;
+		if (node->ns != NULL)
+		    nsName = node->ns->href;
+		else
+		    nsName = BAD_CAST "";
+	    } else {
+		name = BAD_CAST "#document";
+		nsName = BAD_CAST "";
+	    }
+	} else
+	    name = BAD_CAST "Not given";
+
+	if (cctxt->inode->node) {
+	    if (node->type == XML_ELEMENT_NODE) {
+		infname = cctxt->inode->node->name;
+		if (cctxt->inode->node->ns != NULL)
+		    infnsName = cctxt->inode->node->ns->href;
+		else
+		    infnsName = BAD_CAST "";
+	    } else {
+		infname = BAD_CAST "#document";
+		infnsName = BAD_CAST "";
+	    }
+	} else
+	    infname = BAD_CAST "Not given";
+
+	
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltCompilerNodePop: Given   : '%s' URI '%s'\n",
+	    name, nsName);
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltCompilerNodePop: Expected: '%s' URI '%s'\n",
+	    infname, infnsName);
+    }
+}
+
+/*
+* xsltCompilerBuildInScopeNsList:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltNsListContainerPtr
+xsltCompilerBuildInScopeNsList(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xsltNsListContainerPtr nsi = NULL;
+    xmlNsPtr *list = NULL, ns;
+    int i, maxns = 5;
+    /*
+    * Create a new ns-list for this position in the node-tree.
+    * xmlGetNsList() will return NULL, if there are no ns-decls in the
+    * tree. Note that the ns-decl for the XML namespace is not added
+    * to the resulting list; the XPath module handles the XML namespace
+    * internally.
+    */
+    while (node != NULL) {
+        if (node->type == XML_ELEMENT_NODE) {
+            ns = node->nsDef;
+            while (ns != NULL) {
+                if (nsi == NULL) {
+		    nsi = (xsltNsListContainerPtr)
+			xmlMalloc(sizeof(xsltNsListContainer));
+		    if (nsi == NULL) {
+			xsltTransformError(NULL, cctxt->style, NULL,
+			    "xsltCompilerBuildInScopeNsList: "
+			    "malloc failed!\n");
+			goto internal_err;
+		    }
+		    memset(nsi, 0, sizeof(xsltNsListContainer));
+                    nsi->list =
+                        (xmlNsPtr *) xmlMalloc(maxns * sizeof(xmlNsPtr));
+                    if (nsi->list == NULL) {
+			xsltTransformError(NULL, cctxt->style, NULL,
+			    "xsltCompilerBuildInScopeNsList: "
+			    "malloc failed!\n");
+			goto internal_err;
+                    }
+                    nsi->list[0] = NULL;
+                }
+		/*
+		* Skip shadowed namespace bindings.
+		*/
+                for (i = 0; i < nsi->totalNumber; i++) {
+                    if ((ns->prefix == nsi->list[i]->prefix) ||
+                        (xmlStrEqual(ns->prefix, nsi->list[i]->prefix)))
+		    break;
+                }
+                if (i >= nsi->totalNumber) {
+                    if (nsi->totalNumber +1 >= maxns) {
+                        maxns *= 2;
+			nsi->list =
+			    (xmlNsPtr *) xmlRealloc(nsi->list,
+				maxns * sizeof(xmlNsPtr));
+                        if (nsi->list == NULL) {
+                            xsltTransformError(NULL, cctxt->style, NULL,
+				"xsltCompilerBuildInScopeNsList: "
+				"realloc failed!\n");
+				goto internal_err;
+                        }
+                    }
+                    nsi->list[nsi->totalNumber++] = ns;
+                    nsi->list[nsi->totalNumber] = NULL;
+                }
+
+                ns = ns->next;
+            }
+        }
+        node = node->parent;
+    }
+    if (nsi == NULL)
+	return(NULL);
+    /*
+    * Move the default namespace to last position.
+    */
+    nsi->xpathNumber = nsi->totalNumber;
+    for (i = 0; i < nsi->totalNumber; i++) {
+	if (nsi->list[i]->prefix == NULL) {
+	    ns = nsi->list[i];
+	    nsi->list[i] = nsi->list[nsi->totalNumber-1];
+	    nsi->list[nsi->totalNumber-1] = ns;
+	    nsi->xpathNumber--;
+	    break;
+	}
+    }
+    /*
+    * Store the ns-list in the stylesheet.
+    */
+    if (xsltPointerListAddSize(
+	(xsltPointerListPtr)cctxt->psData->inScopeNamespaces,
+	(void *) nsi, 5) == -1)
+    {	
+	xmlFree(nsi);
+	nsi = NULL;
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "xsltCompilerBuildInScopeNsList: failed to add ns-info.\n");
+	goto internal_err;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+    return(nsi);
+
+internal_err:
+    if (list != NULL)
+	xmlFree(list);    
+    cctxt->style->errors++;
+    return(NULL);
+}
+
+static int
+xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt,
+		      xsltPointerListPtr list,
+		      xmlNodePtr node,
+		      const xmlChar *value)
+{
+    xmlChar *cur, *end;
+    xmlNsPtr ns;
+    
+    if ((cctxt == NULL) || (value == NULL) || (list == NULL))
+	return(-1);
+
+    list->number = 0;
+
+    cur = (xmlChar *) value;
+    while (*cur != 0) {
+	while (IS_BLANK(*cur)) cur++;
+	if (*cur == 0)
+	    break;
+	end = cur;
+	while ((*end != 0) && (!IS_BLANK(*end))) end++;
+	cur = xmlStrndup(cur, end - cur);
+	if (cur == NULL) {
+	    cur = end;
+	    continue;
+	}		
+	/*
+	* TODO: Export and use xmlSearchNsByPrefixStrict()
+	*   in Libxml2, tree.c, since xmlSearchNs() is in most
+	*   cases not efficient and in some cases not correct.
+	*
+	* XSLT-2 TODO: XSLT 2.0 allows an additional "#all" value.
+	*/
+	if ((cur[0] == '#') &&
+	    xmlStrEqual(cur, (const xmlChar *)"#default"))
+	    ns = xmlSearchNs(cctxt->style->doc, node, NULL);
+	else
+	    ns = xmlSearchNs(cctxt->style->doc, node, cur);	    
+
+	if (ns == NULL) {
+	    /*
+	    * TODO: Better to report the attr-node, otherwise
+	    *  the user won't know which attribute was invalid.
+	    */
+	    xsltTransformError(NULL, cctxt->style, node,
+		"No namespace binding in scope for prefix '%s'.\n", cur);
+	    /*
+	    * XSLT-1.0: "It is an error if there is no namespace
+	    *  bound to the prefix on the element bearing the
+	    *  exclude-result-prefixes or xsl:exclude-result-prefixes
+	    *  attribute."
+	    */
+	    cctxt->style->errors++;
+	} else {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"resolved prefix '%s'\n", cur);
+#endif
+	    /*
+	    * Note that we put the namespace name into the dict.
+	    */
+	    if (xsltPointerListAddSize(list,
+		(void *) xmlDictLookup(cctxt->style->dict,
+		ns->href, -1), 5) == -1)
+	    {
+		xmlFree(cur);
+		goto internal_err;
+	    }
+	}
+	xmlFree(cur);
+		
+	cur = end;
+    }
+    return(0);
+
+internal_err:
+    cctxt->style->errors++;
+    return(-1);
+}
+
+/**
+ * xsltCompilerUtilsCreateMergedList:
+ * @dest: the destination list (optional)
+ * @first: the first list
+ * @second: the second list (optional)
+ *
+ * Appends the content of @second to @first into @destination.
+ * If @destination is NULL a new list will be created.
+ *
+ * Returns the merged list of items or NULL if there's nothing to merge.
+ */
+static xsltPointerListPtr
+xsltCompilerUtilsCreateMergedList(xsltPointerListPtr first,
+			    xsltPointerListPtr second)
+{
+    xsltPointerListPtr ret;
+    size_t num;
+
+    if (first)
+	num = first->number;
+    else
+	num = 0;
+    if (second)
+	num += second->number;    
+    if (num == 0)
+	return(NULL);
+    ret = xsltPointerListCreate(num);
+    if (ret == NULL)
+	return(NULL);
+    /*
+    * Copy contents.
+    */
+    if ((first != NULL) &&  (first->number != 0)) {
+	memcpy(ret->items, first->items,
+	    first->number * sizeof(void *));
+	if ((second != NULL) && (second->number != 0))
+	    memcpy(ret->items + first->number, second->items,
+		second->number * sizeof(void *));
+    } else if ((second != NULL) && (second->number != 0))
+	memcpy(ret->items, (void *) second->items,
+	    second->number * sizeof(void *));
+    ret->number = num;
+    return(ret);
+}
+
+/*
+* xsltParseExclResultPrefixes:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltPointerListPtr
+xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,
+			    xsltPointerListPtr def,
+			    int instrCategory)
+{    
+    xsltPointerListPtr list = NULL;
+    xmlChar *value;
+    xmlAttrPtr attr;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	attr = xmlHasNsProp(node, BAD_CAST "exclude-result-prefixes", NULL);
+    else
+	attr = xmlHasNsProp(node, BAD_CAST "exclude-result-prefixes",
+	    XSLT_NAMESPACE);
+    if (attr == NULL)	
+	return(def);
+
+    if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) {
+	/*
+	* Mark the XSLT attr.
+	*/
+	attr->psvi = (void *) xsltXSLTAttrMarker;
+    }
+
+    if ((attr->children != NULL) &&	
+	(attr->children->content != NULL))
+	value = attr->children->content;
+    else {
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Attribute 'exclude-result-prefixes': Invalid value.\n");
+	cctxt->style->errors++;
+	return(def);
+    }        
+
+    if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node,
+	BAD_CAST value) != 0)
+	goto exit;
+    if (cctxt->tmpList->number == 0)	
+	goto exit;    
+    /*
+    * Merge the list with the inherited list.
+    */
+    list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList);
+    if (list == NULL)
+	goto exit;    
+    /*
+    * Store the list in the stylesheet/compiler context.
+    */
+    if (xsltPointerListAddSize(
+	cctxt->psData->exclResultNamespaces, list, 5) == -1)
+    {
+	xsltPointerListFree(list);
+	list = NULL;
+	goto exit;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+exit:    
+    if (list != NULL)
+	return(list);
+    else
+	return(def);
+}
+
+/*
+* xsltParseExtElemPrefixes:
+*
+* Create and store the list of in-scope namespaces for the given
+* node in the stylesheet. If there are no changes in the in-scope
+* namespaces then the last ns-info of the ancestor axis will be returned.
+* Compilation-time only.
+*
+* Returns the ns-info or NULL if there are no namespaces in scope.
+*/
+static xsltPointerListPtr
+xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,
+			 xsltPointerListPtr def,
+			 int instrCategory)
+{    
+    xsltPointerListPtr list = NULL;
+    xmlAttrPtr attr;
+    xmlChar *value;
+    int i;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes", NULL);
+    else
+	attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes",
+	    XSLT_NAMESPACE);
+    if (attr == NULL)	
+	return(def);
+
+    if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) {
+	/*
+	* Mark the XSLT attr.
+	*/
+	attr->psvi = (void *) xsltXSLTAttrMarker;
+    }
+
+    if ((attr->children != NULL) &&	
+	(attr->children->content != NULL))
+	value = attr->children->content;
+    else {
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Attribute 'extension-element-prefixes': Invalid value.\n");
+	cctxt->style->errors++;
+	return(def);
+    }
+
+
+    if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node,
+	BAD_CAST value) != 0)
+	goto exit;
+
+    if (cctxt->tmpList->number == 0)
+	goto exit;    
+    /*
+    * REVISIT: Register the extension namespaces.
+    */
+    for (i = 0; i < cctxt->tmpList->number; i++)
+	xsltRegisterExtPrefix(cctxt->style, NULL,
+	BAD_CAST cctxt->tmpList->items[i]);
+    /*
+    * Merge the list with the inherited list.
+    */
+    list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList);
+    if (list == NULL)
+	goto exit;
+    /*
+    * Store the list in the stylesheet.
+    */
+    if (xsltPointerListAddSize(
+	cctxt->psData->extElemNamespaces, list, 5) == -1)
+    {
+	xsltPointerListFree(list);
+	list = NULL;
+	goto exit;
+    }
+    /*
+    * Notify of change in status wrt namespaces.
+    */
+    if (cctxt->inode != NULL)
+	cctxt->inode->nsChanged = 1;
+
+exit:    
+    if (list != NULL)
+	return(list);
+    else
+	return(def);
+}
+
+/*
+* xsltParseAttrXSLTVersion:
+*
+* @cctxt: the compilation context
+* @node: the element-node
+* @isXsltElem: whether this is an XSLT element
+*
+* Parses the attribute xsl:version.
+*
+* Returns 1 if there was such an attribute, 0 if not and
+*         -1 if an internal or API error occured.
+*/
+static int
+xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node,			 
+			 int instrCategory)
+{
+    xmlChar *value;
+    xmlAttrPtr attr;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT)
+	attr = xmlHasNsProp(node, BAD_CAST "version", NULL);
+    else
+	attr = xmlHasNsProp(node, BAD_CAST "version", XSLT_NAMESPACE);
+
+    if (attr == NULL)	
+	return(0);
+
+    attr->psvi = (void *) xsltXSLTAttrMarker;
+
+    if ((attr->children != NULL) &&	
+	(attr->children->content != NULL))
+	value = attr->children->content;
+    else {
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Attribute 'version': Invalid value.\n");
+	cctxt->style->errors++;
+	return(1);
+    }
+    
+    if (! xmlStrEqual(value, (const xmlChar *)"1.0")) {
+	cctxt->inode->forwardsCompat = 1;
+	/*
+	* TODO: To what extent do we support the
+	*  forwards-compatible mode?
+	*/
+	/*
+	* Report this only once per compilation episode.
+	*/
+	if (! cctxt->hasForwardsCompat) {
+	    cctxt->hasForwardsCompat = 1;
+	    cctxt->errSeverity = XSLT_ERROR_SEVERITY_WARNING;
+	    xsltTransformError(NULL, cctxt->style, node,
+		"Warning: the attribute xsl:version specifies a value "
+		"different from '1.0'. Switching to forwards-compatible "
+		"mode. Only features of XSLT 1.0 are supported by this "
+		"processor.\n");
+	    cctxt->style->warnings++;
+	    cctxt->errSeverity = XSLT_ERROR_SEVERITY_ERROR;
+	}	
+    } else {
+	cctxt->inode->forwardsCompat = 0;
+    }
+
+    if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) {
+	/*
+	* Set a marker on XSLT attributes.
+	*/
+	attr->psvi = (void *) xsltXSLTAttrMarker;
+    }
+    return(1);
+}
+
+static int
+xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xmlNodePtr deleteNode, cur, txt, textNode = NULL;
+    xmlDocPtr doc;
+    xsltStylesheetPtr style;
+    int internalize = 0, findSpaceAttr;
+    int xsltStylesheetElemDepth;
+    xmlAttrPtr attr;
+    xmlChar *value;
+    const xmlChar *name, *nsNameXSLT = NULL;
+    int strictWhitespace, inXSLText = 0;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    xsltNsMapPtr nsMapItem;
+#endif
+
+    if ((cctxt == NULL) || (cctxt->style == NULL) ||
+	(node == NULL) || (node->type != XML_ELEMENT_NODE))
+        return(-1);
+
+    doc = node->doc;
+    if (doc == NULL)
+	goto internal_err;
+
+    style = cctxt->style;
+    if ((style->dict != NULL) && (doc->dict == style->dict))
+	internalize = 1;
+    else
+        style->internalized = 0;
+
+    /*
+    * Init value of xml:space. Since this might be an embedded
+    * stylesheet, this is needed to be performed on the element
+    * where the stylesheet is rooted at, taking xml:space of
+    * ancestors into account.
+    */
+    if (! cctxt->simplified)
+	xsltStylesheetElemDepth = cctxt->depth +1;
+    else
+	xsltStylesheetElemDepth = 0;
+
+    if (xmlNodeGetSpacePreserve(node) != 1)
+	cctxt->inode->preserveWhitespace = 0;
+    else
+	cctxt->inode->preserveWhitespace = 1; 
+    
+    /*
+    * Eval if we should keep the old incorrect behaviour.
+    */
+    strictWhitespace = (cctxt->strict != 0) ? 1 : 0;
+
+    nsNameXSLT = xsltConstNamespaceNameXSLT;
+
+    deleteNode = NULL;
+    cur = node;
+    while (cur != NULL) {
+	if (deleteNode != NULL)	{
+
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParsePreprocessStylesheetTree: removing node\n");
+#endif
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
+	}
+	if (cur->type == XML_ELEMENT_NODE) {
+	    
+	    /*
+	    * Clear the PSVI field.
+	    */
+	    cur->psvi = NULL;
+
+	    xsltCompilerNodePush(cctxt, cur);
+
+	    inXSLText = 0;
+	    textNode = NULL;	    
+	    findSpaceAttr = 1;	    
+	    cctxt->inode->stripWhitespace = 0;
+	    /*
+	    * TODO: I'd love to use a string pointer comparison here :-/
+	    */
+	    if (IS_XSLT_ELEM(cur)) {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		if (cur->ns->href != nsNameXSLT) {
+		    nsMapItem = xsltNewNamespaceMapItem(cctxt,
+			doc, cur->ns, cur);
+		    if (nsMapItem == NULL)
+			goto internal_err;
+		    cur->ns->href = nsNameXSLT;
+		}
+#endif
+
+		if (cur->name == NULL)
+		    goto process_attributes;
+		/*
+		* Mark the XSLT element for later recognition.
+		* TODO: Using the marker is still too dangerous, since if
+		*   the parsing mechanism leaves out an XSLT element, then
+		*   this might hit the transformation-mechanism, which
+		*   will break if it doesn't expect such a marker.
+		*/
+		/* cur->psvi = (void *) xsltXSLTElemMarker; */
+
+		/*
+		* XSLT 2.0: "Any whitespace text node whose parent is
+		* one of the following elements is removed from the "
+		* tree, regardless of any xml:space attributes:..."
+		* xsl:apply-imports, 
+		* xsl:apply-templates,
+		* xsl:attribute-set,
+		* xsl:call-template, 
+		* xsl:choose,
+		* xsl:stylesheet, xsl:transform.
+		* XSLT 2.0: xsl:analyze-string,
+		*           xsl:character-map,
+		*           xsl:next-match		
+		*
+		* TODO: I'd love to use a string pointer comparison here :-/
+		*/		
+		name = cur->name;
+		switch (*name) {
+		    case 't':
+			if ((name[0] == 't') && (name[1] == 'e') &&
+			    (name[2] == 'x') && (name[3] == 't') &&
+			    (name[4] == 0))
+			{
+			    /*
+			    * Process the xsl:text element.
+			    * ----------------------------
+			    * Mark it for later recognition.
+			    */
+			    cur->psvi = (void *) xsltXSLTTextMarker;
+			    /*
+			    * For stylesheets, the set of
+			    * whitespace-preserving element names
+			    * consists of just xsl:text.
+			    */
+			    findSpaceAttr = 0;
+			    cctxt->inode->preserveWhitespace = 1;
+			    inXSLText = 1;
+			}			    
+			break;
+		    case 'c':
+			if (xmlStrEqual(name, BAD_CAST "choose") ||
+			    xmlStrEqual(name, BAD_CAST "call-template"))
+			    cctxt->inode->stripWhitespace = 1;
+			break;
+		    case 'a':
+			if (xmlStrEqual(name, BAD_CAST "apply-templates") ||
+			    xmlStrEqual(name, BAD_CAST "apply-imports") ||
+			    xmlStrEqual(name, BAD_CAST "attribute-set"))
+
+			    cctxt->inode->stripWhitespace = 1;
+			break;
+		    default:
+			if (xsltStylesheetElemDepth == cctxt->depth) {
+			    /*
+			    * This is a xsl:stylesheet/xsl:transform.
+			    */
+			    cctxt->inode->stripWhitespace = 1;
+			    break;
+			}
+
+			if ((cur->prev != NULL) &&
+			    (cur->prev->type == XML_TEXT_NODE))
+			{
+			    /*
+			    * XSLT 2.0 : "Any whitespace text node whose
+			    *  following-sibling node is an xsl:param or
+			    *  xsl:sort element is removed from the tree,
+			    *  regardless of any xml:space attributes."
+			    */
+			    if (((*name == 'p') || (*name == 's')) &&
+				(xmlStrEqual(name, BAD_CAST "param") ||
+				 xmlStrEqual(name, BAD_CAST "sort")))
+			    {
+				do {
+				    if (IS_BLANK_NODE(cur->prev)) {
+					txt = cur->prev;
+					xmlUnlinkNode(txt);
+					xmlFreeNode(txt);
+				    } else {
+					/*
+					* This will result in a content
+					* error, when hitting the parsing
+					* functions.
+					*/
+					break;
+				    }
+				} while (cur->prev);				    
+			    }
+			}
+			break;
+		}
+	    }
+
+process_attributes:
+	    /*
+	    * Process attributes.
+	    * ------------------
+	    */
+	    if (cur->properties != NULL) {
+		if (cur->children == NULL)
+		    findSpaceAttr = 0;
+		attr = cur->properties;
+		do {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		    if ((attr->ns) && (attr->ns->href != nsNameXSLT) &&
+			xmlStrEqual(attr->ns->href, nsNameXSLT))
+		    {			
+			nsMapItem = xsltNewNamespaceMapItem(cctxt,
+			    doc, attr->ns, cur);
+			if (nsMapItem == NULL)
+			    goto internal_err;
+			attr->ns->href = nsNameXSLT;
+		    }		    
+#endif
+		    if (internalize) {
+			/*
+			* Internalize the attribute's value; the goal is to
+			* speed up operations and minimize used space by
+			* compiled stylesheets.
+			*/
+			txt = attr->children;
+			/*
+			* NOTE that this assumes only one
+			*  text-node in the attribute's content.
+			*/
+			if ((txt != NULL) && (txt->content != NULL) &&
+			    (!xmlDictOwns(style->dict, txt->content)))
+			{
+			    value = (xmlChar *) xmlDictLookup(style->dict,
+				txt->content, -1);
+			    xmlNodeSetContent(txt, NULL);
+			    txt->content = value;
+			}
+		    }
+		    /*
+		    * Process xml:space attributes.
+		    * ----------------------------
+		    */
+		    if ((findSpaceAttr != 0) &&
+			(attr->ns != NULL) &&
+			(attr->name != NULL) &&
+			(attr->name[0] == 's') &&			
+			(attr->ns->prefix != NULL) &&
+			(attr->ns->prefix[0] == 'x') &&
+			(attr->ns->prefix[1] == 'm') &&
+			(attr->ns->prefix[2] == 'l') &&
+			(attr->ns->prefix[3] == 0))
+		    {
+			value = xmlGetNsProp(cur, BAD_CAST "space",
+			    XML_XML_NAMESPACE);
+			if (value != NULL) {
+			    if (xmlStrEqual(value, BAD_CAST "preserve")) {
+				cctxt->inode->preserveWhitespace = 1;				
+			    } else if (xmlStrEqual(value, BAD_CAST "default")) {
+				cctxt->inode->preserveWhitespace = 0;
+			    } else {
+				/* Invalid value for xml:space. */
+				xsltTransformError(NULL, style, cur,
+				    "Attribute xml:space: Invalid value.\n");
+				cctxt->style->warnings++;
+			    }
+			    findSpaceAttr = 0;
+			    xmlFree(value);
+			}
+			
+		    }
+		    attr = attr->next;
+		} while (attr != NULL);
+	    }
+	    /*
+	    * We'll descend into the children of element nodes only.
+	    */
+	    if (cur->children != NULL) {
+		cur = cur->children;
+		continue;
+	    }
+	} else if ((cur->type == XML_TEXT_NODE) ||
+		(cur->type == XML_CDATA_SECTION_NODE))
+	{
+	    /*
+	    * Merge adjacent text/CDATA-section-nodes
+	    * ---------------------------------------	    
+	    * In order to avoid breaking of existing stylesheets,
+	    * if the old behaviour is wanted (strictWhitespace == 0),
+	    * then we *won't* merge adjacent text-nodes
+	    * (except in xsl:text); this will ensure that whitespace-only
+	    * text nodes are (incorrectly) not stripped in some cases.
+	    * 
+	    * Example:               :   zoo
+	    * Corrent (strict) result:   zoo
+	    * Incorrect (old) result : zoo
+	    *    
+	    * NOTE that we *will* merge adjacent text-nodes if
+	    * they are in xsl:text.
+	    * Example, the following:
+	    *   zoo
+	    * will result in both cases in:
+	    *   zoo
+	    */
+	    cur->type = XML_TEXT_NODE;
+	    if ((strictWhitespace != 0) || (inXSLText != 0)) {
+		/*
+		* New behaviour; merge nodes.
+		*/
+		if (textNode == NULL)
+		    textNode = cur;
+		else {
+		    if (cur->content != NULL)
+			xmlNodeAddContent(textNode, cur->content);
+		    deleteNode = cur;
+		}
+		if ((cur->next == NULL) ||
+		    (cur->next->type == XML_ELEMENT_NODE))
+		    goto end_of_text;
+		else
+		    goto next_sibling;
+	    } else {
+		/*
+		* Old behaviour.
+		*/
+		if (textNode == NULL)
+		    textNode = cur;
+		goto end_of_text;
+	    }	    	   
+	} else if ((cur->type == XML_COMMENT_NODE) ||
+	    (cur->type == XML_PI_NODE))
+	{	    
+	    /*
+	    * Remove processing instructions and comments.
+	    */
+	    deleteNode = cur;
+	    if ((cur->next == NULL) ||
+		(cur->next->type == XML_ELEMENT_NODE))
+		goto end_of_text;
+	    else
+		goto next_sibling;
+	} else {
+	    textNode = NULL;
+	    /*
+	    * Invalid node-type for this data-model.
+	    */
+	    xsltTransformError(NULL, style, cur,
+		"Invalid type of node for the XSLT data model.\n");
+	    cctxt->style->errors++;
+	    goto next_sibling;
+	}
+
+end_of_text:
+	if (textNode) {
+	    value = textNode->content;
+	    /*
+	    * At this point all adjacent text/CDATA-section nodes
+	    * have been merged.
+	    *
+	    * Strip whitespace-only text-nodes.
+	    * (cctxt->inode->stripWhitespace)
+	    */
+	    if ((value == NULL) || (*value == 0) ||
+		(((cctxt->inode->stripWhitespace) ||
+		  (! cctxt->inode->preserveWhitespace)) &&
+		 IS_BLANK(*value) &&
+		 xsltIsBlank(value)))
+	    {		
+		if (textNode != cur) {
+		    xmlUnlinkNode(textNode);
+		    xmlFreeNode(textNode);
+		} else
+		    deleteNode = textNode;
+		textNode = NULL;
+		goto next_sibling;
+	    }
+	    /*
+	    * Convert CDATA-section nodes to text-nodes.
+	    * TODO: Can this produce problems?
+	    */
+	    if (textNode->type != XML_TEXT_NODE) {
+		textNode->type = XML_TEXT_NODE;
+		textNode->name = xmlStringText;
+	    }
+	    if (internalize &&
+		(textNode->content != NULL) &&
+		(!xmlDictOwns(style->dict, textNode->content)))
+	    {
+		/*
+		* Internalize the string.
+		*/
+		value = (xmlChar *) xmlDictLookup(style->dict,
+		    textNode->content, -1);
+		xmlNodeSetContent(textNode, NULL);
+		textNode->content = value;
+	    }
+	    textNode = NULL;
+	    /*
+	    * Note that "disable-output-escaping" of the xsl:text
+	    * element will be applied at a later level, when
+	    * XSLT elements are processed.
+	    */
+	}
+
+next_sibling:
+	if (cur->type == XML_ELEMENT_NODE) {
+	    xsltCompilerNodePop(cctxt, cur);
+	}
+	if (cur == node)
+	    break;
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	} else {
+	    cur = cur->parent;
+	    inXSLText = 0;
+	    goto next_sibling;
+	};
+    }
+    if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltParsePreprocessStylesheetTree: removing node\n");
+#endif
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
+    }
+    return(0);
+
+internal_err:
+    return(-1);
+}
+
+#endif /* XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+#else
+static void
+xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
+{
+    xmlNodePtr deleteNode, styleelem;
+    int internalize = 0;
+
+    if ((style == NULL) || (cur == NULL))
+        return;
+
+    if ((cur->doc != NULL) && (style->dict != NULL) &&
+        (cur->doc->dict == style->dict))
+	internalize = 1;
+    else
+        style->internalized = 0;
+
+    if ((cur != NULL) && (IS_XSLT_ELEM(cur)) &&
+        (IS_XSLT_NAME(cur, "stylesheet"))) {
+	styleelem = cur;
+    } else {
+        styleelem = NULL;
+    }
+
+    /*
+     * This content comes from the stylesheet
+     * For stylesheets, the set of whitespace-preserving
+     * element names consists of just xsl:text.
+     */
+    deleteNode = NULL;
+    while (cur != NULL) {
+	if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltPrecomputeStylesheet: removing ignorable blank node\n");
+#endif
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
+	}
+	if (cur->type == XML_ELEMENT_NODE) {
+	    int exclPrefixes;
+	    /*
+	     * Internalize attributes values.
+	     */
+	    if ((internalize) && (cur->properties != NULL)) {
+	        xmlAttrPtr attr = cur->properties;
+		xmlNodePtr txt;
+
+		while (attr != NULL) {
+		    txt = attr->children;
+		    if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
+		        (txt->content != NULL) &&
+			(!xmlDictOwns(style->dict, txt->content)))
+		    {
+			xmlChar *tmp;
+
+			/*
+			 * internalize the text string, goal is to speed
+			 * up operations and minimize used space by compiled
+			 * stylesheets.
+			 */
+			tmp = (xmlChar *) xmlDictLookup(style->dict,
+			                                txt->content, -1);
+			if (tmp != txt->content) {
+			    xmlNodeSetContent(txt, NULL);
+			    txt->content = tmp;
+			}
+		    }
+		    attr = attr->next;
+		}
+	    }
+	    if (IS_XSLT_ELEM(cur)) {
+		exclPrefixes = 0;
+		xsltStylePreCompute(style, cur);
+		if (IS_XSLT_NAME(cur, "text")) {
+		    for (;exclPrefixes > 0;exclPrefixes--)
+			exclPrefixPop(style);
+		    goto skip_children;
+		}
+	    } else {
+		exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0);
+	    }
+	    	     
+	    if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) {
+		xmlNsPtr ns = cur->nsDef, prev = NULL, next;
+		xmlNodePtr root = NULL;
+		int i, moved;
+
+		root = xmlDocGetRootElement(cur->doc);
+		if ((root != NULL) && (root != cur)) {
+		    while (ns != NULL) {
+			moved = 0;
+			next = ns->next;
+			for (i = 0;i < style->exclPrefixNr;i++) {
+			    if ((ns->prefix != NULL) && 
+			        (xmlStrEqual(ns->href,
+					     style->exclPrefixTab[i]))) {
+				/*
+				 * Move the namespace definition on the root
+				 * element to avoid duplicating it without
+				 * loosing it.
+				 */
+				if (prev == NULL) {
+				    cur->nsDef = ns->next;
+				} else {
+				    prev->next = ns->next;
+				}
+				ns->next = root->nsDef;
+				root->nsDef = ns;
+				moved = 1;
+				break;
+			    }
+			}
+			if (moved == 0)
+			    prev = ns;
+			ns = next;
+		    }
+		}
+	    }
+	    /*
+	     * If we have prefixes locally, recurse and pop them up when
+	     * going back
+	     */
+	    if (exclPrefixes > 0) {
+		xsltPrecomputeStylesheet(style, cur->children);
+		for (;exclPrefixes > 0;exclPrefixes--)
+		    exclPrefixPop(style);
+		goto skip_children;
+	    }
+	} else if (cur->type == XML_TEXT_NODE) {
+	    if (IS_BLANK_NODE(cur)) {
+		if (xmlNodeGetSpacePreserve(cur) != 1) {
+		    deleteNode = cur;
+		}
+	    } else if ((cur->content != NULL) && (internalize) &&
+	               (!xmlDictOwns(style->dict, cur->content))) {
+		xmlChar *tmp;
+
+		/*
+		 * internalize the text string, goal is to speed
+		 * up operations and minimize used space by compiled
+		 * stylesheets.
+		 */
+		tmp = (xmlChar *) xmlDictLookup(style->dict, cur->content, -1);
+		xmlNodeSetContent(cur, NULL);
+		cur->content = tmp;
+	    }
+	} else if ((cur->type != XML_ELEMENT_NODE) &&
+		   (cur->type != XML_CDATA_SECTION_NODE)) {
+	    deleteNode = cur;
+	    goto skip_children;
+	}
+
+	/*
+	 * Skip to next node. In case of a namespaced element children of
+	 * the stylesheet and not in the XSLT namespace and not an extension
+	 * element, ignore its content.
+	 */
+	if ((cur->type == XML_ELEMENT_NODE) && (cur->ns != NULL) &&
+	    (styleelem != NULL) && (cur->parent == styleelem) &&
+	    (!xmlStrEqual(cur->ns->href, XSLT_NAMESPACE)) &&
+	    (!xsltCheckExtURI(style, cur->ns->href))) {
+	    goto skip_children;
+	} else if (cur->children != NULL) {
+	    if ((cur->children->type != XML_ENTITY_DECL) &&
+		(cur->children->type != XML_ENTITY_REF_NODE) &&
+		(cur->children->type != XML_ENTITY_NODE)) {
+		cur = cur->children;
+		continue;
+	    }
+	}
+
+skip_children:
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	    continue;
+	}
+	do {
+
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    if (cur == (xmlNodePtr) style->doc) {
+		cur = NULL;
+		break;
+	    }
+	    if (cur->next != NULL) {
+		cur = cur->next;
+		break;
+	    }
+	} while (cur != NULL);
+    }
+    if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltPrecomputeStylesheet: removing ignorable blank node\n");
+#endif
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
+    }
+}
+#endif /* end of else XSLT_REFACTORED */
+
+/**
+ * xsltGatherNamespaces:
+ * @style:  the XSLT stylesheet
+ *
+ * Browse the stylesheet and build the namspace hash table which
+ * will be used for XPath interpretation. If needed do a bit of normalization
+ */
+
+static void
+xsltGatherNamespaces(xsltStylesheetPtr style) {
+    xmlNodePtr cur;
+    const xmlChar *URI;
+
+    if (style == NULL)
+        return;
+    /* 
+     * TODO: basically if the stylesheet uses the same prefix for different
+     *       patterns, well they may be in problem, hopefully they will get
+     *       a warning first.
+     */
+    /*
+    * TODO: Eliminate the use of the hash for XPath expressions.
+    *   An expression should be evaluated in the context of the in-scope
+    *   namespaces; eliminate the restriction of an XML document to contain
+    *   no duplicate prefixes for different namespace names.
+    * 
+    */
+    cur = xmlDocGetRootElement(style->doc);
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
+	    xmlNsPtr ns = cur->nsDef;
+	    while (ns != NULL) {
+		if (ns->prefix != NULL) {
+		    if (style->nsHash == NULL) {
+			style->nsHash = xmlHashCreate(10);
+			if (style->nsHash == NULL) {
+			    xsltTransformError(NULL, style, cur,
+		 "xsltGatherNamespaces: failed to create hash table\n");
+			    style->errors++;
+			    return;
+			}
+		    }
+		    URI = xmlHashLookup(style->nsHash, ns->prefix);
+		    if ((URI != NULL) && (!xmlStrEqual(URI, ns->href))) {
+			xsltTransformError(NULL, style, cur,
+	     "Namespaces prefix %s used for multiple namespaces\n",ns->prefix);
+			style->warnings++;
+		    } else if (URI == NULL) {
+			xmlHashUpdateEntry(style->nsHash, ns->prefix,
+			    (void *) ns->href, (xmlHashDeallocator)xmlFree);
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+			xsltGenericDebug(xsltGenericDebugContext,
+		 "Added namespace: %s mapped to %s\n", ns->prefix, ns->href);
+#endif
+		    }
+		}
+		ns = ns->next;
+	    }
+	}
+
+	/*
+	 * Skip to next node
+	 */
+	if (cur->children != NULL) {
+	    if (cur->children->type != XML_ENTITY_DECL) {
+		cur = cur->children;
+		continue;
+	    }
+	}
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	    continue;
+	}
+	
+	do {
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    if (cur == (xmlNodePtr) style->doc) {
+		cur = NULL;
+		break;
+	    }
+	    if (cur->next != NULL) {
+		cur = cur->next;
+		break;
+	    }
+	} while (cur != NULL);
+    }
+}
+
+#ifdef XSLT_REFACTORED
+
+static xsltStyleType
+xsltGetXSLTElementTypeByNode(xsltCompilerCtxtPtr cctxt,
+			     xmlNodePtr node)
+{
+    if ((node == NULL) || (node->type != XML_ELEMENT_NODE) ||
+	(node->name == NULL))
+	return(0);
+
+    if (node->name[0] == 'a') {
+	if (IS_XSLT_NAME(node, "apply-templates"))
+	    return(XSLT_FUNC_APPLYTEMPLATES);
+	else if (IS_XSLT_NAME(node, "attribute"))
+	    return(XSLT_FUNC_ATTRIBUTE);
+	else if (IS_XSLT_NAME(node, "apply-imports"))
+	    return(XSLT_FUNC_APPLYIMPORTS);
+	else if (IS_XSLT_NAME(node, "attribute-set"))
+	    return(0);
+
+    } else if (node->name[0] == 'c') {
+	if (IS_XSLT_NAME(node, "choose"))
+	    return(XSLT_FUNC_CHOOSE);
+	else if (IS_XSLT_NAME(node, "copy"))
+	    return(XSLT_FUNC_COPY);
+	else if (IS_XSLT_NAME(node, "copy-of"))
+	    return(XSLT_FUNC_COPYOF);
+	else if (IS_XSLT_NAME(node, "call-template"))
+	    return(XSLT_FUNC_CALLTEMPLATE);
+	else if (IS_XSLT_NAME(node, "comment"))
+	    return(XSLT_FUNC_COMMENT);
+
+    } else if (node->name[0] == 'd') {
+	if (IS_XSLT_NAME(node, "document"))
+	    return(XSLT_FUNC_DOCUMENT);
+	else if (IS_XSLT_NAME(node, "decimal-format"))
+	    return(0);
+
+    } else if (node->name[0] == 'e') {
+	if (IS_XSLT_NAME(node, "element"))
+	    return(XSLT_FUNC_ELEMENT);
+
+    } else if (node->name[0] == 'f') {
+	if (IS_XSLT_NAME(node, "for-each"))
+	    return(XSLT_FUNC_FOREACH);
+	else if (IS_XSLT_NAME(node, "fallback"))
+	    return(XSLT_FUNC_FALLBACK);
+
+    } else if (*(node->name) == 'i') {
+	if (IS_XSLT_NAME(node, "if"))
+	    return(XSLT_FUNC_IF);
+	else if (IS_XSLT_NAME(node, "include"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "import"))
+	    return(0);
+
+    } else if (*(node->name) == 'k') {
+	if (IS_XSLT_NAME(node, "key"))
+	    return(0);
+
+    } else if (*(node->name) == 'm') {
+	if (IS_XSLT_NAME(node, "message"))
+	    return(XSLT_FUNC_MESSAGE);
+
+    } else if (*(node->name) == 'n') {
+	if (IS_XSLT_NAME(node, "number"))
+	    return(XSLT_FUNC_NUMBER);
+	else if (IS_XSLT_NAME(node, "namespace-alias"))
+	    return(0);
+
+    } else if (*(node->name) == 'o') {
+	if (IS_XSLT_NAME(node, "otherwise"))
+	    return(XSLT_FUNC_OTHERWISE);
+	else if (IS_XSLT_NAME(node, "output"))
+	    return(0);
+
+    } else if (*(node->name) == 'p') {
+	if (IS_XSLT_NAME(node, "param"))
+	    return(XSLT_FUNC_PARAM);
+	else if (IS_XSLT_NAME(node, "processing-instruction"))
+	    return(XSLT_FUNC_PI);
+	else if (IS_XSLT_NAME(node, "preserve-space"))
+	    return(0);
+
+    } else if (*(node->name) == 's') {
+	if (IS_XSLT_NAME(node, "sort"))
+	    return(XSLT_FUNC_SORT);
+	else if (IS_XSLT_NAME(node, "strip-space"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "stylesheet"))
+	    return(0);
+
+    } else if (node->name[0] == 't') {
+	if (IS_XSLT_NAME(node, "text"))
+	    return(XSLT_FUNC_TEXT);
+	else if (IS_XSLT_NAME(node, "template"))
+	    return(0);
+	else if (IS_XSLT_NAME(node, "transform"))
+	    return(0);
+
+    } else if (*(node->name) == 'v') {
+	if (IS_XSLT_NAME(node, "value-of"))
+	    return(XSLT_FUNC_VALUEOF);
+	else if (IS_XSLT_NAME(node, "variable"))
+	    return(XSLT_FUNC_VARIABLE);
+
+    } else if (*(node->name) == 'w') {
+	if (IS_XSLT_NAME(node, "when"))
+	    return(XSLT_FUNC_WHEN);
+	if (IS_XSLT_NAME(node, "with-param"))
+	    return(XSLT_FUNC_WITHPARAM);
+    }
+    return(0);
+}
+
+/**
+ * xsltParseAnyXSLTElem:
+ *
+ * @cctxt: the compilation context
+ * @elem: the element node of the XSLT instruction
+ *
+ * Parses, validates the content models and compiles XSLT instructions.
+ *
+ * Returns 0 if everything's fine;
+ *         -1 on API or internal errors.
+ */ 
+int
+xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem)
+{
+    if ((cctxt == NULL) || (elem == NULL) ||
+	(elem->type != XML_ELEMENT_NODE))
+	return(-1);
+
+    elem->psvi = NULL;
+
+    if (! (IS_XSLT_ELEM_FAST(elem)))
+	return(-1);
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }
+    
+    xsltCompilerNodePush(cctxt, elem);
+    /*
+    * URGENT TODO: Find a way to speed up this annoying redundant
+    *  textual node-name and namespace comparison.
+    */
+    if (cctxt->inode->prev->curChildType != 0)
+	cctxt->inode->type = cctxt->inode->prev->curChildType;
+    else
+	cctxt->inode->type = xsltGetXSLTElementTypeByNode(cctxt, elem);    
+    /*
+    * Update the in-scope namespaces if needed.
+    */
+    if (elem->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, elem);
+    /*
+    * xsltStylePreCompute():
+    *  This will compile the information found on the current
+    *  element's attributes. NOTE that this won't process the
+    *  children of the instruction.
+    */
+    xsltStylePreCompute(cctxt->style, elem);
+    /*
+    * TODO: How to react on errors in xsltStylePreCompute() ?
+    */
+
+    /*
+    * Validate the content model of the XSLT-element.
+    */
+    switch (cctxt->inode->type) {	
+	case XSLT_FUNC_APPLYIMPORTS:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_APPLYTEMPLATES:
+	    /*  */
+	    goto apply_templates;	    
+	case XSLT_FUNC_ATTRIBUTE:	    
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_CALLTEMPLATE:
+	    /*  */
+	    goto call_template;
+	case XSLT_FUNC_CHOOSE:	    
+	    /*  */
+	    goto choose;
+	case XSLT_FUNC_COMMENT:
+	    /*  */
+	    goto sequence_constructor;	    
+	case XSLT_FUNC_COPY:
+	    /*  */
+	    goto sequence_constructor;	    
+	case XSLT_FUNC_COPYOF:
+	    /* EMPTY */
+	    goto empty_content;	   
+	case XSLT_FUNC_DOCUMENT: /* Extra one */
+	    /* ?? template ?? */
+	    goto sequence_constructor;
+	case XSLT_FUNC_ELEMENT:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_FALLBACK:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_FOREACH:
+	    /*  */
+	    goto for_each;
+	case XSLT_FUNC_IF:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_OTHERWISE:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_MESSAGE:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_NUMBER:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_PARAM:
+	    /*
+	    * Check for redefinition.
+	    */
+	    if ((elem->psvi != NULL) && (cctxt->ivar != NULL)) {
+		xsltVarInfoPtr ivar = cctxt->ivar;
+
+		do {
+		    if ((ivar->name ==
+			 ((xsltStyleItemParamPtr) elem->psvi)->name) &&
+			(ivar->nsName ==
+			 ((xsltStyleItemParamPtr) elem->psvi)->ns))
+		    {
+			elem->psvi = NULL;
+			xsltTransformError(NULL, cctxt->style, elem,
+			    "Redefinition of variable or parameter '%s'.\n",
+			    ivar->name);
+			cctxt->style->errors++;
+			goto error;
+		    }
+		    ivar = ivar->prev;
+		} while (ivar != NULL);
+	    }
+	    /*   */
+	    goto sequence_constructor;
+	case XSLT_FUNC_PI:
+	    /*   */
+	    goto sequence_constructor;
+	case XSLT_FUNC_SORT:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_TEXT:
+	    /*  */
+	    goto text;
+	case XSLT_FUNC_VALUEOF:
+	    /* EMPTY */
+	    goto empty_content;
+	case XSLT_FUNC_VARIABLE:
+	    /*
+	    * Check for redefinition.
+	    */
+	    if ((elem->psvi != NULL) && (cctxt->ivar != NULL)) {
+		xsltVarInfoPtr ivar = cctxt->ivar;		
+
+		do {
+		    if ((ivar->name ==
+			 ((xsltStyleItemVariablePtr) elem->psvi)->name) &&
+			(ivar->nsName ==
+			 ((xsltStyleItemVariablePtr) elem->psvi)->ns))
+		    {
+			elem->psvi = NULL;
+			xsltTransformError(NULL, cctxt->style, elem,
+			    "Redefinition of variable or parameter '%s'.\n",
+			    ivar->name);
+			cctxt->style->errors++;
+			goto error;
+		    }
+		    ivar = ivar->prev;
+		} while (ivar != NULL);
+	    }
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_WHEN:
+	    /*  */
+	    goto sequence_constructor;
+	case XSLT_FUNC_WITHPARAM:
+	    /*  */
+	    goto sequence_constructor;
+	default:
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseXSLTNode: Unhandled XSLT element '%s'.\n",
+		elem->name);	    
+#endif
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"xsltParseXSLTNode: Internal error; "
+		"unhandled XSLT element '%s'.\n", elem->name);
+	    cctxt->style->errors++;
+	    goto internal_err;
+    }
+
+apply_templates:
+    /*  */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    if (xmlStrEqual(child->name, BAD_CAST "with-param")) {
+			cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else if (xmlStrEqual(child->name, BAD_CAST "sort")) {
+			cctxt->inode->curChildType = XSLT_FUNC_SORT;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else
+			xsltParseContentError(cctxt->style, child);
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }    
+    goto exit;
+
+call_template:
+    /*  */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    xsltStyleType type;
+
+		    type = xsltGetXSLTElementTypeByNode(cctxt, child);
+		    if (type == XSLT_FUNC_WITHPARAM) {
+			cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else {
+			xsltParseContentError(cctxt->style, child);
+		    }
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }    
+    goto exit;
+
+text:
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	do {
+	    if ((child->type != XML_TEXT_NODE) &&
+		(child->type != XML_CDATA_SECTION_NODE))
+	    {
+		xsltTransformError(NULL, cctxt->style, elem,
+		    "The XSLT 'text' element must have only character "
+		    "data as content.\n");
+	    }
+	    child = child->next;
+	} while (child != NULL);
+    }
+    goto exit;
+
+empty_content:
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	/*
+	* Relaxed behaviour: we will allow whitespace-only text-nodes.
+	*/
+	do {
+	    if (((child->type != XML_TEXT_NODE) &&
+		 (child->type != XML_CDATA_SECTION_NODE)) ||
+		(! IS_BLANK_NODE(child)))
+	    {
+		xsltTransformError(NULL, cctxt->style, elem,
+		    "This XSLT element must have no content.\n");
+		cctxt->style->errors++;
+		break;
+	    }
+	    child = child->next;
+	} while (child != NULL);		
+    }
+    goto exit;
+
+choose:
+    /*  */
+    /*
+    * TODO: text-nodes in between are *not* allowed in XSLT 1.0.
+    *   The old behaviour did not check this.
+    * NOTE: In XSLT 2.0 they are stripped beforehand
+    *  if whitespace-only (regardless of xml:space).
+    */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	int nbWhen = 0, nbOtherwise = 0, err = 0;
+	do {
+	    if (child->type == XML_ELEMENT_NODE) {
+		if (IS_XSLT_ELEM_FAST(child)) {
+		    xsltStyleType type;
+		
+		    type = xsltGetXSLTElementTypeByNode(cctxt, child);
+		    if (type == XSLT_FUNC_WHEN) {
+			nbWhen++;
+			if (nbOtherwise) {
+			    xsltParseContentError(cctxt->style, child);
+			    err = 1;
+			    break;
+			}
+			cctxt->inode->curChildType = XSLT_FUNC_WHEN;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else if (type == XSLT_FUNC_OTHERWISE) {
+			if (! nbWhen) {
+			    xsltParseContentError(cctxt->style, child);
+			    err = 1;
+			    break;
+			}			
+			if (nbOtherwise) {
+			    xsltTransformError(NULL, cctxt->style, elem,
+				"The XSLT 'choose' element must not contain "
+				"more than one XSLT 'otherwise' element.\n");
+			    cctxt->style->errors++;
+			    err = 1;
+			    break;
+			}
+			nbOtherwise++;
+			cctxt->inode->curChildType = XSLT_FUNC_OTHERWISE;
+			xsltParseAnyXSLTElem(cctxt, child);
+		    } else
+			xsltParseContentError(cctxt->style, child);
+		} else
+		    xsltParseContentError(cctxt->style, child);
+	    } 
+	    /*
+		else
+		    xsltParseContentError(cctxt, child);
+	    */
+	    child = child->next;
+	} while (child != NULL);
+	if ((! err) && (! nbWhen)) {
+	    xsltTransformError(NULL, cctxt->style, elem,
+		"The XSLT element 'choose' must contain at least one "
+		"XSLT element 'when'.\n");
+		cctxt->style->errors++;
+	}	
+    }    
+    goto exit;
+
+for_each:
+    /*  */
+    /*
+    * NOTE: Text-nodes before xsl:sort are *not* allowed in XSLT 1.0.
+    *   The old behaviour did not allow this, but it catched this
+    *   only at transformation-time.
+    *   In XSLT 2.0 they are stripped beforehand if whitespace-only
+    *   (regardless of xml:space).
+    */
+    if (elem->children != NULL) {
+	xmlNodePtr child = elem->children;
+	/*
+	* Parse xsl:sort first.
+	*/
+	do {	    
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child))
+	    {		
+		if (xsltGetXSLTElementTypeByNode(cctxt, child) ==
+		    XSLT_FUNC_SORT)
+		{		
+		    cctxt->inode->curChildType = XSLT_FUNC_SORT;
+		    xsltParseAnyXSLTElem(cctxt, child);
+		} else
+		    break;
+	    } else
+		break;
+	    child = child->next;
+	} while (child != NULL);
+	/*
+	* Parse the sequece constructor.
+	*/
+	if (child != NULL)
+	    xsltParseSequenceConstructor(cctxt, child);
+    }    
+    goto exit;
+
+sequence_constructor:
+    /*
+    * Parse the sequence constructor.
+    */
+    if (elem->children != NULL)
+	xsltParseSequenceConstructor(cctxt, elem->children);
+
+    /*
+    * Register information for vars/params. Only needed if there
+    * are any following siblings.
+    */
+    if ((elem->next != NULL) &&
+	((cctxt->inode->type == XSLT_FUNC_VARIABLE) ||
+	 (cctxt->inode->type == XSLT_FUNC_PARAM)))
+    {	
+	if ((elem->psvi != NULL) &&
+	    (((xsltStyleBasicItemVariablePtr) elem->psvi)->name))
+	{	
+	    xsltCompilerVarInfoPush(cctxt, elem,
+		((xsltStyleBasicItemVariablePtr) elem->psvi)->name,
+		((xsltStyleBasicItemVariablePtr) elem->psvi)->ns);
+	}
+    }
+
+error:
+exit:
+    xsltCompilerNodePop(cctxt, elem);
+    return(0);
+
+internal_err:
+    xsltCompilerNodePop(cctxt, elem);
+    return(-1);
+}
+
+/**
+ * xsltForwardsCompatUnkownItemCreate:
+ *
+ * @cctxt: the compilation context 
+ *
+ * Creates a compiled representation of the unknown
+ * XSLT instruction.
+ *
+ * Returns the compiled representation.
+ */ 
+static xsltStyleItemUknownPtr
+xsltForwardsCompatUnkownItemCreate(xsltCompilerCtxtPtr cctxt)
+{
+    xsltStyleItemUknownPtr item;
+
+    item = (xsltStyleItemUknownPtr) xmlMalloc(sizeof(xsltStyleItemUknown));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, NULL,
+	    "Internal error in xsltForwardsCompatUnkownItemCreate(): "
+	    "Failed to allocate memory.\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(item, 0, sizeof(xsltStyleItemUknown));
+    item->type = XSLT_FUNC_UNKOWN_FORWARDS_COMPAT;
+    /*
+    * Store it in the stylesheet.
+    */
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+    return(item);
+}
+
+/**
+ * xsltParseUnknownXSLTElem:
+ *
+ * @cctxt: the compilation context
+ * @node: the element of the unknown XSLT instruction
+ *
+ * Parses an unknown XSLT element.
+ * If forwards compatible mode is enabled this will allow
+ * such an unknown XSLT and; otherwise it is rejected.
+ *
+ * Returns 1 in the unknown XSLT instruction is rejected,
+ *         0 if everything's fine and
+ *         -1 on API or internal errors.
+ */ 
+static int
+xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt,
+			    xmlNodePtr node)
+{
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }    
+    if (cctxt->inode->forwardsCompat == 0) {	
+	/*
+	* We are not in forwards-compatible mode, so raise an error.
+	*/
+	xsltTransformError(NULL, cctxt->style, node,
+	    "Unknown XSLT element '%s'.\n", node->name);
+	cctxt->style->errors++;
+	return(1);
+    }
+    /*
+    * Forwards-compatible mode.
+    * ------------------------
+    *    
+    * Parse/compile xsl:fallback elements.
+    *
+    * QUESTION: Do we have to raise an error if there's no xsl:fallback?
+    * ANSWER: No, since in the stylesheet the fallback behaviour might
+    *  also be provided by using the XSLT function "element-available".
+    */
+    if (cctxt->unknownItem == NULL) {
+	/*
+	* Create a singleton for all unknown XSLT instructions.
+	*/
+	cctxt->unknownItem = xsltForwardsCompatUnkownItemCreate(cctxt);
+	if (cctxt->unknownItem == NULL) {
+	    node->psvi = NULL;
+	    return(-1);
+	}
+    }
+    node->psvi = cctxt->unknownItem;
+    if (node->children == NULL)
+	return(0);
+    else {
+	xmlNodePtr child = node->children;
+
+	xsltCompilerNodePush(cctxt, node);
+	/*
+	* Update the in-scope namespaces if needed.
+	*/
+	if (node->nsDef != NULL)
+	    cctxt->inode->inScopeNs =
+		xsltCompilerBuildInScopeNsList(cctxt, node);
+	/*
+	* Parse all xsl:fallback children.
+	*/
+	do {
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child) &&
+		IS_XSLT_NAME(child, "fallback"))
+	    {
+		cctxt->inode->curChildType = XSLT_FUNC_FALLBACK;
+		xsltParseAnyXSLTElem(cctxt, child);
+	    }
+	    child = child->next;
+	} while (child != NULL);
+	
+	xsltCompilerNodePop(cctxt, node);
+    }
+    return(0);
+}
+
+/**
+ * xsltParseSequenceConstructor:
+ *
+ * @cctxt: the compilation context
+ * @cur: the start-node of the content to be parsed
+ *
+ * Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms).
+ * This will additionally remove xsl:text elements from the tree.
+ */ 
+void
+xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+{
+    xsltStyleType type;
+    xmlNodePtr deleteNode = NULL;
+
+    if (cctxt == NULL) {
+	xmlGenericError(xmlGenericErrorContext,
+	    "xsltParseSequenceConstructor: Bad arguments\n");
+	cctxt->style->errors++;
+	return;
+    }
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	cctxt->inode->extContentHandled = 1;
+    }
+    if (cur == NULL)
+	return;
+    /*
+    * This is the content reffered to as a "template".
+    * E.g. an xsl:element has such content model:
+    * 
+    * 
+    *
+    * NOTE that in XSLT-2 the term "template" was abandoned due to
+    *  confusion with xsl:template and the term "sequence constructor"
+    *  was introduced instead.
+    *
+    * The following XSLT-instructions are allowed to appear:
+    *  xsl:apply-templates, xsl:call-template, xsl:apply-imports,
+    *  xsl:for-each, xsl:value-of, xsl:copy-of, xsl:number,
+    *  xsl:choose, xsl:if, xsl:text, xsl:copy, xsl:variable,
+    *  xsl:message, xsl:fallback,
+    *  xsl:processing-instruction, xsl:comment, xsl:element
+    *  xsl:attribute. 
+    * Additional allowed content:
+    * 1) extension instructions
+    * 2) literal result elements
+    * 3) PCDATA
+    *
+    * NOTE that this content model does *not* allow xsl:param.
+    */    
+    while (cur != NULL) {
+	if (deleteNode != NULL)	{
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseSequenceConstructor: removing xsl:text element\n");
+#endif
+	    xmlUnlinkNode(deleteNode);
+	    xmlFreeNode(deleteNode);
+	    deleteNode = NULL;
+	}
+	if (cur->type == XML_ELEMENT_NODE) {	    
+	    
+	    if (cur->psvi == xsltXSLTTextMarker) {
+		/*
+		* xsl:text elements
+		* --------------------------------------------------------
+		*/
+		xmlNodePtr tmp;
+
+		cur->psvi = NULL;
+		/*
+		* Mark the xsl:text element for later deletion.
+		*/
+		deleteNode = cur;
+		/*
+		* Validate content.
+		*/
+		tmp = cur->children;
+		if (tmp) {
+		    /*
+		    * We don't expect more than one text-node in the
+		    * content, since we already merged adjacent
+		    * text/CDATA-nodes and eliminated PI/comment-nodes.
+		    */
+		    if ((tmp->type == XML_TEXT_NODE) ||
+			(tmp->next == NULL))
+		    {
+			/*
+			* Leave the contained text-node in the tree.
+			*/
+			xmlUnlinkNode(tmp);
+			xmlAddPrevSibling(cur, tmp);
+		    } else {
+			tmp = NULL;
+			xsltTransformError(NULL, cctxt->style, cur,
+			    "Element 'xsl:text': Invalid type "
+			    "of node found in content.\n");
+			cctxt->style->errors++;
+		    } 
+		}
+		if (cur->properties) {
+		    xmlAttrPtr attr;
+		    /*
+		    * TODO: We need to report errors for
+		    *  invalid attrs.
+		    */
+		    attr = cur->properties;
+		    do {
+			if ((attr->ns == NULL) &&
+			    (attr->name != NULL) &&
+			    (attr->name[0] == 'd') &&
+			    xmlStrEqual(attr->name,
+			    BAD_CAST "disable-output-escaping"))
+			{
+			    /*
+			    * Attr "disable-output-escaping".
+			    * XSLT-2: This attribute is deprecated.
+			    */
+			    if ((attr->children != NULL) &&
+				xmlStrEqual(attr->children->content,
+				BAD_CAST "yes"))
+			    {
+				/*
+				* Disable output escaping for this
+				* text node.
+				*/
+				if (tmp)
+				    tmp->name = xmlStringTextNoenc;
+			    } else if ((attr->children == NULL) ||
+				(attr->children->content == NULL) ||
+				(!xmlStrEqual(attr->children->content,
+				BAD_CAST "no")))
+			    {
+				xsltTransformError(NULL, cctxt->style,
+				    cur,
+				    "Attribute 'disable-output-escaping': "
+				    "Invalid value. Expected is "
+				    "'yes' or 'no'.\n");
+				cctxt->style->errors++;
+			    }
+			    break;
+			}
+			attr = attr->next;
+		    } while (attr != NULL);
+		}
+	    } else if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* TODO: Using the XSLT-marker is still not stable yet.
+		*/
+		/* if (cur->psvi == xsltXSLTElemMarker) { */	    
+		/*
+		* XSLT instructions
+		* --------------------------------------------------------
+		*/
+		cur->psvi = NULL;
+		type = xsltGetXSLTElementTypeByNode(cctxt, cur);
+		switch (type) {
+		    case XSLT_FUNC_APPLYIMPORTS:
+		    case XSLT_FUNC_APPLYTEMPLATES:
+		    case XSLT_FUNC_ATTRIBUTE:
+		    case XSLT_FUNC_CALLTEMPLATE:
+		    case XSLT_FUNC_CHOOSE:
+		    case XSLT_FUNC_COMMENT:
+		    case XSLT_FUNC_COPY:
+		    case XSLT_FUNC_COPYOF:
+		    case XSLT_FUNC_DOCUMENT: /* Extra one */
+		    case XSLT_FUNC_ELEMENT:
+		    case XSLT_FUNC_FALLBACK:
+		    case XSLT_FUNC_FOREACH:
+		    case XSLT_FUNC_IF:
+		    case XSLT_FUNC_MESSAGE:
+		    case XSLT_FUNC_NUMBER:
+		    case XSLT_FUNC_PI:
+		    case XSLT_FUNC_TEXT:
+		    case XSLT_FUNC_VALUEOF:
+		    case XSLT_FUNC_VARIABLE:
+			/*
+			* Parse the XSLT element.
+			*/
+			cctxt->inode->curChildType = type;
+			xsltParseAnyXSLTElem(cctxt, cur);
+			break;
+		    default:
+			xsltParseUnknownXSLTElem(cctxt, cur);			
+			cur = cur->next;
+			continue;
+		}
+	    } else {
+		/*
+		* Non-XSLT elements
+		* -----------------
+		*/
+		xsltCompilerNodePush(cctxt, cur);
+		/*
+		* Update the in-scope namespaces if needed.
+		*/
+		if (cur->nsDef != NULL)
+		    cctxt->inode->inScopeNs =
+			xsltCompilerBuildInScopeNsList(cctxt, cur);
+		/*
+		* The current element is either a literal result element
+		* or an extension instruction.
+		*
+		* Process attr "xsl:extension-element-prefixes".
+		* FUTURE TODO: IIRC in XSLT 2.0 this attribute must be
+		* processed by the implementor of the extension function;
+		* i.e., it won't be handled by the XSLT processor.
+		*/
+		/* SPEC 1.0:
+		*   "exclude-result-prefixes" is only allowed on literal
+		*   result elements and "xsl:exclude-result-prefixes"
+		*   on xsl:stylesheet/xsl:transform.
+		* SPEC 2.0:
+		*   "There are a number of standard attributes
+		*   that may appear on any XSLT element: specifically
+		*   version, exclude-result-prefixes,
+		*   extension-element-prefixes, xpath-default-namespace,
+		*   default-collation, and use-when."
+		*
+		* SPEC 2.0:
+		*   For literal result elements:
+		*   "xsl:version, xsl:exclude-result-prefixes,
+		*    xsl:extension-element-prefixes,
+		*    xsl:xpath-default-namespace,
+		*    xsl:default-collation, or xsl:use-when."
+		*/
+		if (cur->properties)
+		    cctxt->inode->extElemNs =
+			xsltParseExtElemPrefixes(cctxt,
+			    cur, cctxt->inode->extElemNs,
+			    XSLT_ELEMENT_CATEGORY_LRE);
+		/*
+		* Eval if we have an extension instruction here.
+		*/
+		if ((cur->ns != NULL) &&
+		    (cctxt->inode->extElemNs != NULL) &&
+		    (xsltCheckExtPrefix(cctxt->style, cur->ns->href) == 1))
+		{
+		    /*
+		    * Extension instructions
+		    * ----------------------------------------------------
+		    * Mark the node information.
+		    */
+		    cctxt->inode->category = XSLT_ELEMENT_CATEGORY_EXTENSION;
+		    cctxt->inode->extContentHandled = 0;
+		    if (cur->psvi != NULL) {
+			cur->psvi = NULL;
+			/*
+			* TODO: Temporary sanity check.
+			*/
+			xsltTransformError(NULL, cctxt->style, cur,
+			    "Internal error in xsltParseSequenceConstructor(): "
+			    "Occupied PSVI field.\n");
+			cctxt->style->errors++;
+			cur = cur->next;
+			continue;
+		    }
+		    cur->psvi = (void *)
+			xsltPreComputeExtModuleElement(cctxt->style, cur);
+		    
+		    if (cur->psvi == NULL) {
+			/*
+			* OLD COMMENT: "Unknown element, maybe registered
+			*  at the context level. Mark it for later
+			*  recognition."
+			* QUESTION: What does the xsltExtMarker mean?
+			*  ANSWER: It is used in
+			*   xsltApplySequenceConstructor() at
+			*   transformation-time to look out for extension
+			*   registered in the transformation context.
+			*/
+			cur->psvi = (void *) xsltExtMarker;
+		    }
+		    /*
+		    * BIG NOTE: Now the ugly part. In previous versions
+		    *  of Libxslt (until 1.1.16), all the content of an
+		    *  extension instruction was processed and compiled without
+		    *  the need of the extension-author to explicitely call
+		    *  such a processing;.We now need to mimic this old
+		    *  behaviour in order to avoid breaking old code
+		    *  on the extension-author's side.
+		    * The mechanism:
+		    *  1) If the author does *not* set the
+		    *    compile-time-flag @extContentHandled, then we'll
+		    *    parse the content assuming that it's a "template"
+		    *    (or "sequence constructor in XSLT 2.0 terms).
+		    *    NOTE: If the extension is registered at
+		    *    transformation-time only, then there's no way of
+		    *    knowing that content shall be valid, and we'll
+		    *    process the content the same way.
+		    *  2) If the author *does* set the flag, then we'll assume
+		    *   that the author has handled the parsing him/herself
+		    *   (e.g. called xsltParseSequenceConstructor(), etc.
+		    *   explicitely in his/her code).
+		    */
+		    if ((cur->children != NULL) &&
+			(cctxt->inode->extContentHandled == 0))
+		    {
+			/*
+			* Default parsing of the content using the
+			* sequence-constructor model.
+			*/
+			xsltParseSequenceConstructor(cctxt, cur->children);
+		    }
+		} else {
+		    /*
+		    * Literal result element
+		    * ----------------------------------------------------
+		    * Allowed XSLT attributes:
+		    *  xsl:extension-element-prefixes CDATA #IMPLIED
+		    *  xsl:exclude-result-prefixes CDATA #IMPLIED
+		    *  TODO: xsl:use-attribute-sets %qnames; #IMPLIED
+		    *  xsl:version NMTOKEN #IMPLIED
+		    */
+		    cur->psvi = NULL;
+		    cctxt->inode->category = XSLT_ELEMENT_CATEGORY_LRE;
+		    if (cur->properties != NULL) {
+			xmlAttrPtr attr = cur->properties;
+			/*
+			* Attribute "xsl:exclude-result-prefixes".
+			*/
+			cctxt->inode->exclResultNs =
+			    xsltParseExclResultPrefixes(cctxt, cur,
+				cctxt->inode->exclResultNs,
+				XSLT_ELEMENT_CATEGORY_LRE);
+			/*
+			* Attribute "xsl:version".
+			*/
+			xsltParseAttrXSLTVersion(cctxt, cur,
+			    XSLT_ELEMENT_CATEGORY_LRE);
+			/*
+			* Report invalid XSLT attributes.			
+			* For XSLT 1.0 only xsl:use-attribute-sets is allowed
+			* next to xsl:version, xsl:exclude-result-prefixes and
+			* xsl:extension-element-prefixes.
+			*
+			* Mark all XSLT attributes, in order to skip such
+			* attributes when instantiating the LRE.
+			*/
+			do {
+			    if ((attr->psvi != xsltXSLTAttrMarker) &&
+				IS_XSLT_ATTR_FAST(attr))
+			    {				    
+				if (! xmlStrEqual(attr->name,
+				    BAD_CAST "use-attribute-sets"))
+				{				
+				    xsltTransformError(NULL, cctxt->style,
+					cur,
+					"Unknown XSLT attribute '%s'.\n",
+					attr->name);
+				    cctxt->style->errors++;
+				} else {
+				    /*
+				    * XSLT attr marker.
+				    */
+				    attr->psvi = (void *) xsltXSLTAttrMarker;
+				}
+			    }
+			    attr = attr->next;
+			} while (attr != NULL);
+		    }
+		    /*
+		    * Create/reuse info for the literal result element.
+		    */
+		    if (cctxt->inode->nsChanged)
+			xsltLREInfoCreate(cctxt, cur, 1);
+		    cur->psvi = cctxt->inode->litResElemInfo;
+		    /*
+		    * Apply ns-aliasing on the element and on its attributes.
+		    */
+		    if (cctxt->hasNsAliases)
+			xsltLREBuildEffectiveNs(cctxt, cur);
+		    /*
+		    * Compile attribute value templates (AVT).
+		    */
+		    if (cur->properties) {
+			xmlAttrPtr attr = cur->properties;
+			
+			while (attr != NULL) {
+			    xsltCompileAttr(cctxt->style, attr);
+			    attr = attr->next;
+			}
+		    }
+		    /*
+		    * Parse the content, which is defined to be a "template"
+		    * (or "sequence constructor" in XSLT 2.0 terms).
+		    */
+		    if (cur->children != NULL) {
+			xsltParseSequenceConstructor(cctxt, cur->children);
+		    }
+		}
+		/*
+		* Leave the non-XSLT element.
+		*/
+		xsltCompilerNodePop(cctxt, cur);
+	    }
+	}
+	cur = cur->next;
+    }
+    if (deleteNode != NULL) {
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	xsltGenericDebug(xsltGenericDebugContext,
+	    "xsltParseSequenceConstructor: removing xsl:text element\n");
+#endif
+	xmlUnlinkNode(deleteNode);
+	xmlFreeNode(deleteNode);
+	deleteNode = NULL;
+    }
+}
+
+/**
+ * xsltParseTemplateContent:
+ * @style:  the XSLT stylesheet
+ * @templ:  the node containing the content to be parsed
+ *
+ * Parses and compiles the content-model of an xsl:template element.
+ * Note that this is *not* the "template" content model (or "sequence
+ *  constructor" in XSLT 2.0); it it allows addional xsl:param
+ *  elements as immediate children of @templ.
+ *
+ * Called by: 
+ *   exsltFuncFunctionComp() (EXSLT, functions.c)
+ *   So this is intended to be called from extension functions.
+ */
+void
+xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+    if ((style == NULL) || (templ == NULL))
+	return;
+
+    /*
+    * Detection of handled content of extension instructions.
+    */
+    if (XSLT_CCTXT(style)->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+	XSLT_CCTXT(style)->inode->extContentHandled = 1;
+    }
+
+    if (templ->children != NULL) {	
+	xmlNodePtr child = templ->children;
+	/*
+	* Process xsl:param elements, which can only occur as the
+	* immediate children of xsl:template (well, and of any
+	* user-defined extension instruction if needed).
+	*/	
+	do {
+	    if ((child->type == XML_ELEMENT_NODE) &&
+		IS_XSLT_ELEM_FAST(child) &&
+		IS_XSLT_NAME(child, "param"))
+	    {
+		XSLT_CCTXT(style)->inode->curChildType = XSLT_FUNC_PARAM;
+		xsltParseAnyXSLTElem(XSLT_CCTXT(style), child);
+	    } else
+		break;
+	    child = child->next;
+	} while (child != NULL);
+	/*
+	* Parse the content and register the pattern.
+	*/
+	xsltParseSequenceConstructor(XSLT_CCTXT(style), child);
+    }
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
+ * xsltParseTemplateContent:
+ * @style:  the XSLT stylesheet
+ * @templ:  the container node (can be a document for literal results)
+ *
+ * parse a template content-model
+ * Clean-up the template content from unwanted ignorable blank nodes
+ * and process xslt:text
+ */
+void
+xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+    xmlNodePtr cur, delete;
+    /*
+     * This content comes from the stylesheet
+     * For stylesheets, the set of whitespace-preserving
+     * element names consists of just xsl:text.
+     */
+    cur = templ->children;
+    delete = NULL;
+    while (cur != NULL) {
+	if (delete != NULL) {
+#ifdef WITH_XSLT_DEBUG_BLANKS
+	    xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseTemplateContent: removing text\n");
+#endif
+	    xmlUnlinkNode(delete);
+	    xmlFreeNode(delete);
+	    delete = NULL;
+	}
+	if (IS_XSLT_ELEM(cur)) {
+	    if (IS_XSLT_NAME(cur, "text")) {
+		/*
+		* TODO: Processing of xsl:text should be moved to
+		*   xsltPrecomputeStylesheet(), since otherwise this
+		*   will be performed for every multiply included
+		*   stylesheet; i.e. this here is not skipped with
+		*   the use of the style->nopreproc flag.
+		*/
+		if (cur->children != NULL) {
+		    xmlChar *prop;
+		    xmlNodePtr text = cur->children, next;
+		    int noesc = 0;
+			
+		    prop = xmlGetNsProp(cur,
+			(const xmlChar *)"disable-output-escaping",
+			NULL);
+		    if (prop != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+			xsltGenericDebug(xsltGenericDebugContext,
+			     "Disable escaping: %s\n", text->content);
+#endif
+			if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+			    noesc = 1;
+			} else if (!xmlStrEqual(prop,
+						(const xmlChar *)"no")){
+			    xsltTransformError(NULL, style, cur,
+	     "xsl:text: disable-output-escaping allows only yes or no\n");
+			    style->warnings++;
+
+			}
+			xmlFree(prop);
+		    }
+
+		    while (text != NULL) {
+			if (text->type == XML_COMMENT_NODE) {
+			    text = text->next;
+			    continue;
+			}
+			if ((text->type != XML_TEXT_NODE) &&
+			     (text->type != XML_CDATA_SECTION_NODE)) {
+			    xsltTransformError(NULL, style, cur,
+		 "xsltParseTemplateContent: xslt:text content problem\n");
+			    style->errors++;
+			    break;
+			}
+			if ((noesc) && (text->type != XML_CDATA_SECTION_NODE))
+			    text->name = xmlStringTextNoenc;
+			text = text->next;
+		    }
+
+		    /*
+		     * replace xsl:text by the list of childs
+		     */
+		    if (text == NULL) {
+			text = cur->children;
+			while (text != NULL) {
+			    if ((style->internalized) &&
+			        (text->content != NULL) &&
+			        (!xmlDictOwns(style->dict, text->content))) {
+
+				/*
+				 * internalize the text string
+				 */
+				if (text->doc->dict != NULL) {
+				    const xmlChar *tmp;
+				    
+				    tmp = xmlDictLookup(text->doc->dict,
+				                        text->content, -1);
+				    if (tmp != text->content) {
+				        xmlNodeSetContent(text, NULL);
+					text->content = (xmlChar *) tmp;
+				    }
+				}
+			    }
+
+			    next = text->next;
+			    xmlUnlinkNode(text);
+			    xmlAddPrevSibling(cur, text);
+			    text = next;
+			}
+		    }
+		}
+		delete = cur;
+		goto skip_children;
+	    }
+	}
+	else if ((cur->ns != NULL) && (style->nsDefs != NULL) &&
+	    (xsltCheckExtPrefix(style, cur->ns->prefix)))
+	{
+	    /*
+	     * okay this is an extension element compile it too
+	     */
+	    xsltStylePreCompute(style, cur);
+	} else {
+	    /*
+	     * This is an element which will be output as part of the
+	     * template exectution, precompile AVT if found.
+	     */
+	    if ((cur->ns == NULL) && (style->defaultAlias != NULL) &&
+	    		(cur->type == XML_ELEMENT_NODE)) {
+		cur->ns = xmlSearchNsByHref(cur->doc, cur,
+			style->defaultAlias);
+	    }
+	    if (cur->properties != NULL) {
+	        xmlAttrPtr attr = cur->properties;
+
+		while (attr != NULL) {
+		    xsltCompileAttr(style, attr);
+		    attr = attr->next;
+		}
+	    }
+	}
+	/*
+	 * Skip to next node
+	 */
+	if (cur->children != NULL) {
+	    if (cur->children->type != XML_ENTITY_DECL) {
+		cur = cur->children;
+		continue;
+	    }
+	}
+skip_children:
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	    continue;
+	}
+	
+	do {
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    if (cur == templ) {
+		cur = NULL;
+		break;
+	    }
+	    if (cur->next != NULL) {
+		cur = cur->next;
+		break;
+	    }
+	} while (cur != NULL);
+    }
+    if (delete != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	 "xsltParseTemplateContent: removing text\n");
+#endif
+	xmlUnlinkNode(delete);
+	xmlFreeNode(delete);
+	delete = NULL;
+    }
+
+    /*
+     * Skip the first params
+     */
+    cur = templ->children;
+    while (cur != NULL) {
+	if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param"))))
+	    break;
+	cur = cur->next;
+    }
+
+    /*
+     * Browse the remainder of the template
+     */
+    while (cur != NULL) {
+	if ((IS_XSLT_ELEM(cur)) && (IS_XSLT_NAME(cur, "param"))) {
+	    xmlNodePtr param = cur;
+
+	    xsltTransformError(NULL, style, cur,
+		"xsltParseTemplateContent: ignoring misplaced param element\n");
+	    if (style != NULL) style->warnings++;
+            cur = cur->next;
+	    xmlUnlinkNode(param);
+	    xmlFreeNode(param);
+	} else
+	    break;
+    }
+}
+
+#endif /* else XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetKey:
+ * @style:  the XSLT stylesheet
+ * @key:  the "key" element
+ *
+ * 
+ * 
+ *
+ * parse an XSLT stylesheet key definition and register it
+ */
+
+static void
+xsltParseStylesheetKey(xsltStylesheetPtr style, xmlNodePtr key) {
+    xmlChar *prop = NULL;
+    xmlChar *use = NULL;
+    xmlChar *match = NULL;
+    xmlChar *name = NULL;
+    xmlChar *nameURI = NULL;
+
+    if ((style == NULL) || (key == NULL))
+	return;
+
+    /*
+     * Get arguments
+     */
+    prop = xmlGetNsProp(key, (const xmlChar *)"name", NULL);
+    if (prop != NULL) {
+        const xmlChar *URI;
+
+	/*
+	* TODO: Don't use xsltGetQNameURI().
+	*/
+	URI = xsltGetQNameURI(key, &prop);
+	if (prop == NULL) {
+	    if (style != NULL) style->errors++;
+	    goto error;
+	} else {
+	    name = prop;
+	    if (URI != NULL)
+		nameURI = xmlStrdup(URI);
+	}
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseStylesheetKey: name %s\n", name);
+#endif
+    } else {
+	xsltTransformError(NULL, style, key,
+	    "xsl:key : error missing name\n");
+	if (style != NULL) style->errors++;
+	goto error;
+    }
+
+    match = xmlGetNsProp(key, (const xmlChar *)"match", NULL);
+    if (match == NULL) {
+	xsltTransformError(NULL, style, key,
+	    "xsl:key : error missing match\n");
+	if (style != NULL) style->errors++;
+	goto error;
+    }
+
+    use = xmlGetNsProp(key, (const xmlChar *)"use", NULL);
+    if (use == NULL) {
+	xsltTransformError(NULL, style, key,
+	    "xsl:key : error missing use\n");
+	if (style != NULL) style->errors++;
+	goto error;
+    }
+
+    /*
+     * register the keys
+     */
+    xsltAddKey(style, name, nameURI, match, use, key);
+
+
+error:
+    if (use != NULL)
+	xmlFree(use);
+    if (match != NULL)
+	xmlFree(match);
+    if (name != NULL)
+	xmlFree(name);
+    if (nameURI != NULL)
+	xmlFree(nameURI);
+
+    if (key->children != NULL) {
+	xsltParseContentError(style, key->children);
+    }
+}
+
+#ifdef XSLT_REFACTORED
+/**
+ * xsltParseXSLTTemplate:
+ * @style:  the XSLT stylesheet
+ * @template:  the "template" element
+ *
+ * parse an XSLT stylesheet template building the associated structures
+ * TODO: Is @style ever expected to be NULL?
+ *
+ * Called from:
+ *   xsltParseXSLTStylesheet()
+ *   xsltParseStylesheetTop()
+ */
+
+static void
+xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) {
+    xsltTemplatePtr templ;
+    xmlChar *prop;    
+    double  priority;    
+
+    if ((cctxt == NULL) || (templNode == NULL))
+	return;
+
+    /*
+     * Create and link the structure
+     */
+    templ = xsltNewTemplate();
+    if (templ == NULL)
+	return;
+
+    xsltCompilerNodePush(cctxt, templNode);
+    if (templNode->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, templNode);
+
+    templ->next = cctxt->style->templates;
+    cctxt->style->templates = templ;
+    templ->style = cctxt->style;  
+
+    /*
+    * Attribute "mode".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"mode", NULL);
+    if (prop != NULL) {	
+        const xmlChar *modeURI;
+
+	/*
+	* TODO: We need a standardized function for extraction
+	*  of namespace names and local names from QNames.
+	*  Don't use xsltGetQNameURI() as it cannot channeö
+	*  reports through the context.
+	*/
+	modeURI = xsltGetQNameURI(templNode, &prop);
+	if (prop == NULL) {
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	templ->mode = xmlDictLookup(cctxt->style->dict, prop, -1);
+	xmlFree(prop);
+	prop = NULL;
+	if (xmlValidateNCName(templ->mode, 0)) {
+	    xsltTransformError(NULL, cctxt->style, templNode,
+		"xsl:template: Attribute 'mode': The local part '%s' "
+		"of the value is not a valid NCName.\n", templ->name);
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	if (modeURI != NULL)
+	    templ->modeURI = xmlDictLookup(cctxt->style->dict, modeURI, -1);
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseXSLTTemplate: mode %s\n", templ->mode);
+#endif
+    }
+    /*
+    * Attribute "match".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"match", NULL);
+    if (prop != NULL) {
+	templ->match  = prop;
+	prop = NULL;
+    }
+    /*
+    * Attribute "priority".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"priority", NULL);
+    if (prop != NULL) {
+	priority = xmlXPathStringEvalNumber(prop);
+	templ->priority = (float) priority;
+	xmlFree(prop);
+	prop = NULL;
+    }
+    /*
+    * Attribute "name".
+    */
+    prop = xmlGetNsProp(templNode, (const xmlChar *)"name", NULL);
+    if (prop != NULL) {
+        const xmlChar *nameURI;
+	xsltTemplatePtr curTempl;
+	
+	/*
+	* TODO: Don't use xsltGetQNameURI().
+	*/
+	nameURI = xsltGetQNameURI(templNode, &prop);
+	if (prop == NULL) {
+	    cctxt->style->errors++;
+	    goto error;
+	}
+	templ->name = xmlDictLookup(cctxt->style->dict, prop, -1);
+	xmlFree(prop);
+	prop = NULL;
+	if (xmlValidateNCName(templ->name, 0)) {
+	    xsltTransformError(NULL, cctxt->style, templNode,
+		"xsl:template: Attribute 'name': The local part '%s' of "
+		"the value is not a valid NCName.\n", templ->name);
+	    cctxt->style->errors++;
+	    goto error;
+	} 	
+	if (nameURI != NULL)
+	    templ->nameURI = xmlDictLookup(cctxt->style->dict, nameURI, -1);
+	curTempl = templ->next;
+	while (curTempl != NULL) {
+	    if ((nameURI != NULL && xmlStrEqual(curTempl->name, templ->name) &&
+		xmlStrEqual(curTempl->nameURI, nameURI) ) ||
+		(nameURI == NULL && curTempl->nameURI == NULL &&
+		xmlStrEqual(curTempl->name, templ->name)))
+	    {
+		xsltTransformError(NULL, cctxt->style, templNode,
+		    "xsl:template: error duplicate name '%s'\n", templ->name);
+		cctxt->style->errors++;
+		goto error;
+	    }
+	    curTempl = curTempl->next;
+	}
+    }
+    if (templNode->children != NULL) {
+	xsltParseTemplateContent(cctxt->style, templNode);	
+	/*
+	* MAYBE TODO: Custom behaviour: In order to stay compatible with
+	* Xalan and MSXML(.NET), we could allow whitespace
+	* to appear before an xml:param element; this whitespace
+	* will additionally become part of the "template".
+	* NOTE that this is totally deviates from the spec, but
+	* is the de facto behaviour of Xalan and MSXML(.NET).
+	* Personally I wouldn't allow this, since if we have:
+	* 
+	*   
+	*   
+	*   
+	* ... the whitespace between every xsl:param would be
+	* added to the result tree.
+	*/		
+    }    
+    
+    templ->elem = templNode;
+    templ->content = templNode->children;
+    xsltAddTemplate(cctxt->style, templ, templ->mode, templ->modeURI);
+
+error:
+    xsltCompilerNodePop(cctxt, templNode);
+    return;
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetTemplate:
+ * @style:  the XSLT stylesheet
+ * @template:  the "template" element
+ *
+ * parse an XSLT stylesheet template building the associated structures
+ */
+
+static void
+xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
+    xsltTemplatePtr ret;
+    xmlChar *prop;
+    xmlChar *mode = NULL;
+    xmlChar *modeURI = NULL;
+    double  priority;
+
+    if (template == NULL)
+	return;
+
+    /*
+     * Create and link the structure
+     */
+    ret = xsltNewTemplate();
+    if (ret == NULL)
+	return;
+    ret->next = style->templates;
+    style->templates = ret;
+    ret->style = style;
+   
+    /*
+     * Get inherited namespaces
+     */
+    /*
+    * TODO: Apply the optimized in-scope-namespace mechanism
+    *   as for the other XSLT instructions.
+    */
+    xsltGetInheritedNsList(style, ret, template);
+
+    /*
+     * Get arguments
+     */
+    prop = xmlGetNsProp(template, (const xmlChar *)"mode", NULL);
+    if (prop != NULL) {
+        const xmlChar *URI;
+
+	/*
+	* TODO: Don't use xsltGetQNameURI().
+	*/
+	URI = xsltGetQNameURI(template, &prop);
+	if (prop == NULL) {
+	    if (style != NULL) style->errors++;
+	    goto error;
+	} else {
+	    mode = prop;
+	    if (URI != NULL)
+		modeURI = xmlStrdup(URI);
+	}
+	ret->mode = xmlDictLookup(style->dict, mode, -1);
+	ret->modeURI = xmlDictLookup(style->dict, modeURI, -1);
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+	     "xsltParseStylesheetTemplate: mode %s\n", mode);
+#endif
+        if (mode != NULL) xmlFree(mode);
+	if (modeURI != NULL) xmlFree(modeURI);
+    }
+    prop = xmlGetNsProp(template, (const xmlChar *)"match", NULL);
+    if (prop != NULL) {
+	if (ret->match != NULL) xmlFree(ret->match);
+	ret->match  = prop;
+    }
+
+    prop = xmlGetNsProp(template, (const xmlChar *)"priority", NULL);
+    if (prop != NULL) {
+	priority = xmlXPathStringEvalNumber(prop);
+	ret->priority = (float) priority;
+	xmlFree(prop);
+    }
+
+    prop = xmlGetNsProp(template, (const xmlChar *)"name", NULL);
+    if (prop != NULL) {
+        const xmlChar *URI;
+	xsltTemplatePtr cur;
+	
+	/*
+	* TODO: Don't use xsltGetQNameURI().
+	*/
+	URI = xsltGetQNameURI(template, &prop);
+	if (prop == NULL) {
+	    if (style != NULL) style->errors++;
+	    goto error;
+	} else {
+	    if (xmlValidateNCName(prop,0)) {
+	        xsltTransformError(NULL, style, template,
+	            "xsl:template : error invalid name '%s'\n", prop);
+		if (style != NULL) style->errors++;
+		goto error;
+	    }
+	    ret->name = xmlDictLookup(style->dict, BAD_CAST prop, -1);
+	    xmlFree(prop);
+	    prop = NULL;
+	    if (URI != NULL)
+		ret->nameURI = xmlDictLookup(style->dict, BAD_CAST URI, -1);
+	    else
+		ret->nameURI = NULL;
+	    cur = ret->next;
+	    while (cur != NULL) {
+	        if ((URI != NULL && xmlStrEqual(cur->name, ret->name) &&
+				xmlStrEqual(cur->nameURI, URI) ) ||
+		    (URI == NULL && cur->nameURI == NULL &&
+				xmlStrEqual(cur->name, ret->name))) {
+		    xsltTransformError(NULL, style, template,
+		        "xsl:template: error duplicate name '%s'\n", ret->name);
+		    style->errors++;
+		    goto error;
+		}
+		cur = cur->next;
+	    }
+	}
+    }
+
+    /*
+     * parse the content and register the pattern
+     */
+    xsltParseTemplateContent(style, template);
+    ret->elem = template;
+    ret->content = template->children;
+    xsltAddTemplate(style, ret, ret->mode, ret->modeURI);
+
+error:
+    return;
+}
+
+#endif /* else XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+
+/**
+ * xsltIncludeComp:
+ * @cctxt: the compilation contenxt
+ * @node:  the xsl:include node
+ *
+ * Process the xslt include node on the source node
+ */
+static xsltStyleItemIncludePtr
+xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) {
+    xsltStyleItemIncludePtr item;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(NULL);
+
+    node->psvi = NULL;
+    item = (xsltStyleItemIncludePtr) xmlMalloc(sizeof(xsltStyleItemInclude));
+    if (item == NULL) {
+	xsltTransformError(NULL, cctxt->style, node,
+		"xsltIncludeComp : malloc failed\n");
+	cctxt->style->errors++;
+	return(NULL);
+    }
+    memset(item, 0, sizeof(xsltStyleItemInclude));
+
+    node->psvi = item;
+    item->inst = node;
+    item->type = XSLT_FUNC_INCLUDE;
+
+    item->next = cctxt->style->preComps;
+    cctxt->style->preComps = (xsltElemPreCompPtr) item;
+
+    return(item);
+}
+
+/**
+ * xsltParseFindTopLevelElem:
+ */
+static int
+xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt,
+			      xmlNodePtr cur,
+			      const xmlChar *name,
+			      const xmlChar *namespaceURI,
+			      int breakOnOtherElem,			      
+			      xmlNodePtr *resultNode)
+{
+    if (name == NULL)
+	return(-1);
+
+    *resultNode = NULL;
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
+	    if ((cur->ns != NULL) && (cur->name != NULL)) {
+		if ((*(cur->name) == *name) &&
+		    xmlStrEqual(cur->name, name) &&
+		    xmlStrEqual(cur->ns->href, namespaceURI))		    
+		{
+		    *resultNode = cur;
+		    return(1);
+		}
+	    }
+	    if (breakOnOtherElem)
+		break;
+	}
+	cur = cur->next;
+    }
+    *resultNode = cur;
+    return(0);
+}
+
+static int
+xsltParseTopLevelXSLTElem(xsltCompilerCtxtPtr cctxt,
+			  xmlNodePtr node,
+			  xsltStyleType type)
+{
+    int ret = 0;
+
+    /*
+    * TODO: The reason why this function exists:
+    *  due to historical reasons some of the
+    *  top-level declarations are processed by functions
+    *  in other files. Since we need still to set
+    *  up the node-info and generate information like
+    *  in-scope namespaces, this is a wrapper around
+    *  those old parsing functions.
+    */
+    xsltCompilerNodePush(cctxt, node);
+    if (node->nsDef != NULL)
+	cctxt->inode->inScopeNs =
+	    xsltCompilerBuildInScopeNsList(cctxt, node);
+    cctxt->inode->type = type;
+
+    switch (type) {
+	case XSLT_FUNC_INCLUDE:
+	    {
+		int oldIsInclude;
+
+		if (xsltCompileXSLTIncludeElem(cctxt, node) == NULL)
+		    goto exit;		
+		/*
+		* Mark this stylesheet tree as being currently included.
+		*/
+		oldIsInclude = cctxt->isInclude;
+		cctxt->isInclude = 1;
+						
+		if (xsltParseStylesheetInclude(cctxt->style, node) != 0) {
+		    cctxt->style->errors++;
+		}
+		cctxt->isInclude = oldIsInclude;
+	    }
+	    break;
+	case XSLT_FUNC_PARAM:
+	    xsltStylePreCompute(cctxt->style, node);
+	    xsltParseGlobalParam(cctxt->style, node);
+	    break;
+	case XSLT_FUNC_VARIABLE:
+	    xsltStylePreCompute(cctxt->style, node);
+	    xsltParseGlobalVariable(cctxt->style, node);
+	    break;
+	case XSLT_FUNC_ATTRSET:
+	    xsltParseStylesheetAttributeSet(cctxt->style, node);
+	    break;
+	default:
+	    xsltTransformError(NULL, cctxt->style, node,
+		"Internal error: (xsltParseTopLevelXSLTElem) "
+		"Cannot handle this top-level declaration.\n");
+	    cctxt->style->errors++;
+	    ret = -1;
+    }
+
+exit:
+    xsltCompilerNodePop(cctxt, node);
+
+    return(ret);
+}
+
+#if 0
+static int
+xsltParseRemoveWhitespace(xmlNodePtr node)
+{
+    if ((node == NULL) || (node->children == NULL))
+	return(0);
+    else {
+	xmlNodePtr delNode = NULL, child = node->children;
+
+	do {
+	    if (delNode) {
+		xmlUnlinkNode(delNode);
+		xmlFreeNode(delNode);
+		delNode = NULL;
+	    }
+	    if (((child->type == XML_TEXT_NODE) ||
+		 (child->type == XML_CDATA_SECTION_NODE)) &&
+		(IS_BLANK_NODE(child)))
+		delNode = child;	    
+	    child = child->next;
+	} while (child != NULL);
+	if (delNode) {
+	    xmlUnlinkNode(delNode);
+	    xmlFreeNode(delNode);
+	    delNode = NULL;
+	}
+    }
+    return(0);
+}
+#endif
+
+static int
+xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+#ifdef WITH_XSLT_DEBUG_PARSING
+    int templates = 0;
+#endif
+    xmlNodePtr cur, start = NULL;
+    xsltStylesheetPtr style;
+
+    if ((cctxt == NULL) || (node == NULL) ||
+	(node->type != XML_ELEMENT_NODE))
+	return(-1);    
+
+    style = cctxt->style;    
+    /*
+    * At this stage all import declarations of all stylesheet modules
+    * with the same stylesheet level have been processed.
+    * Now we can safely parse the rest of the declarations.
+    */
+    if (IS_XSLT_ELEM_FAST(node) && IS_XSLT_NAME(node, "include"))
+    {
+	xsltDocumentPtr include;
+	/*
+	* URGENT TODO: Make this work with simplified stylesheets!
+	*   I.e., when we won't find an xsl:stylesheet element.
+	*/
+	/*
+	* This is as include declaration.
+	*/
+	include = ((xsltStyleItemIncludePtr) node->psvi)->include;
+	if (include == NULL) {
+	    /* TODO: raise error? */
+	    return(-1);
+	}
+	/*
+	* TODO: Actually an xsl:include should locate an embedded
+	*  stylesheet as well; so the document-element won't always
+	*  be the element where the actual stylesheet is rooted at.
+	*  But such embedded stylesheets are not supported by Libxslt yet.
+	*/
+	node = xmlDocGetRootElement(include->doc);
+	if (node == NULL) {
+	    return(-1);
+	}
+    }    
+    
+    if (node->children == NULL)
+	return(0);
+    /*
+    * Push the xsl:stylesheet/xsl:transform element.
+    */  
+    xsltCompilerNodePush(cctxt, node);
+    cctxt->inode->isRoot = 1;
+    cctxt->inode->nsChanged = 0;
+    /*
+    * Start with the naked dummy info for literal result elements.
+    */
+    cctxt->inode->litResElemInfo = cctxt->inodeList->litResElemInfo;
+
+    /*
+    * In every case, we need to have
+    * the in-scope namespaces of the element, where the
+    * stylesheet is rooted at, regardless if it's an XSLT
+    * instruction or a literal result instruction (or if
+    * this is an embedded stylesheet).
+    */		
+    cctxt->inode->inScopeNs =
+	xsltCompilerBuildInScopeNsList(cctxt, node);
+
+    /*
+    * Process attributes of xsl:stylesheet/xsl:transform.
+    * --------------------------------------------------
+    * Allowed are:
+    *  id = id
+    *  extension-element-prefixes = tokens
+    *  exclude-result-prefixes = tokens
+    *  version = number (mandatory)    
+    */
+    if (xsltParseAttrXSLTVersion(cctxt, node,
+	XSLT_ELEMENT_CATEGORY_XSLT) == 0)
+    {    
+	/*
+	* Attribute "version".
+	* XSLT 1.0: "An xsl:stylesheet element *must* have a version
+	*  attribute, indicating the version of XSLT that the
+	*  stylesheet requires".
+	* The root element of a simplified stylesheet must also have
+	* this attribute.
+	*/
+#ifdef XSLT_REFACTORED_MANDATORY_VERSION
+	if (isXsltElem)
+	    xsltTransformError(NULL, cctxt->style, node,
+		"The attribute 'version' is missing.\n");
+	cctxt->style->errors++;	
+#else
+	/* OLD behaviour. */
+	xsltTransformError(NULL, cctxt->style, node,
+	    "xsl:version is missing: document may not be a stylesheet\n");
+	cctxt->style->warnings++;
+#endif
+    }    
+    /*
+    * The namespaces declared by the attributes
+    *  "extension-element-prefixes" and
+    *  "exclude-result-prefixes" are local to *this*
+    *  stylesheet tree; i.e., they are *not* visible to
+    *  other stylesheet-modules, whether imported or included.
+    * 
+    * Attribute "extension-element-prefixes".
+    */
+    cctxt->inode->extElemNs =
+	xsltParseExtElemPrefixes(cctxt, node, NULL,
+	    XSLT_ELEMENT_CATEGORY_XSLT);
+    /*
+    * Attribute "exclude-result-prefixes".
+    */
+    cctxt->inode->exclResultNs =
+	xsltParseExclResultPrefixes(cctxt, node, NULL,
+	    XSLT_ELEMENT_CATEGORY_XSLT);
+    /*
+    * Create/reuse info for the literal result element.
+    */
+    if (cctxt->inode->nsChanged)
+	xsltLREInfoCreate(cctxt, node, 0);
+    /*
+    * Processed top-level elements:
+    * ----------------------------
+    *  xsl:variable, xsl:param (QName, in-scope ns,
+    *    expression (vars allowed))
+    *  xsl:attribute-set (QName, in-scope ns)
+    *  xsl:strip-space, xsl:preserve-space (XPath NameTests,
+    *    in-scope ns)
+    *    I *think* global scope, merge with includes
+    *  xsl:output (QName, in-scope ns)
+    *  xsl:key (QName, in-scope ns, pattern,
+    *    expression (vars *not* allowed))
+    *  xsl:decimal-format (QName, needs in-scope ns)
+    *  xsl:namespace-alias (in-scope ns)
+    *    global scope, merge with includes
+    *  xsl:template (last, QName, pattern)
+    *
+    * (whitespace-only text-nodes have *not* been removed
+    *  yet; this will be done in xsltParseSequenceConstructor)
+    *
+    * Report misplaced child-nodes first.
+    */
+    cur = node->children;
+    while (cur != NULL) {
+	if (cur->type == XML_TEXT_NODE) {
+	    xsltTransformError(NULL, style, cur,
+		"Misplaced text node (content: '%s').\n",
+		(cur->content != NULL) ? cur->content : BAD_CAST "");
+	    style->errors++;
+	} else if (cur->type != XML_ELEMENT_NODE) {
+	    xsltTransformError(NULL, style, cur, "Misplaced node.\n");
+	    style->errors++;
+	}
+	cur = cur->next;
+    }
+    /*
+    * Skip xsl:import elements; they have been processed
+    * already.
+    */
+    cur = node->children;
+    while ((cur != NULL) && xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1)
+	cur = cur->next;
+    if (cur == NULL)
+	goto exit;
+
+    start = cur;
+    /*
+    * Process all top-level xsl:param elements.
+    */
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	BAD_CAST "param", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_PARAM);	
+	cur = cur->next;
+    }  
+    /*
+    * Process all top-level xsl:variable elements.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	BAD_CAST "variable", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_VARIABLE);
+	cur = cur->next;
+    }   
+    /*
+    * Process all the rest of top-level elements.
+    */
+    cur = start;
+    while (cur != NULL) {	
+	/*
+	* Process element nodes.
+	*/
+	if (cur->type == XML_ELEMENT_NODE) {	    
+	    if (cur->ns == NULL) {
+		xsltTransformError(NULL, style, cur,
+		    "Unexpected top-level element in no namespace.\n");
+		style->errors++;
+		cur = cur->next;
+		continue;
+	    }
+	    /*
+	    * Process all XSLT elements.
+	    */
+	    if (IS_XSLT_ELEM_FAST(cur)) {
+		/*
+		* xsl:import is only allowed at the beginning.
+		*/
+		if (IS_XSLT_NAME(cur, "import")) {
+		    xsltTransformError(NULL, style, cur,
+			"Misplaced xsl:import element.\n");
+		    style->errors++;
+		    cur = cur->next;
+		    continue;
+		}
+		/* 
+		* TODO: Change the return type of the parsing functions
+		*  to int.
+		*/
+		if (IS_XSLT_NAME(cur, "template")) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		    templates++;
+#endif
+		    /*
+		    * TODO: Is the position of xsl:template in the
+		    *  tree significant? If not it would be easier to
+		    *  parse them at a later stage.
+		    */
+		    xsltParseXSLTTemplate(cctxt, cur);
+		} else if (IS_XSLT_NAME(cur, "variable")) {
+		    /* NOP; done already */
+		} else if (IS_XSLT_NAME(cur, "param")) {
+		    /* NOP; done already */
+		} else if (IS_XSLT_NAME(cur, "include")) {		    
+		    if (cur->psvi != NULL)		    
+			xsltParseXSLTStylesheetElemCore(cctxt, cur);
+		    else {
+			xsltTransformError(NULL, style, cur,
+			    "Internal error: "
+			    "(xsltParseXSLTStylesheetElemCore) "
+			    "The xsl:include element was not compiled.\n");
+			style->errors++;
+		    }
+		} else if (IS_XSLT_NAME(cur, "strip-space")) {
+		    /* No node info needed. */
+		    xsltParseStylesheetStripSpace(style, cur);
+		} else if (IS_XSLT_NAME(cur, "preserve-space")) {
+		    /* No node info needed. */
+		    xsltParseStylesheetPreserveSpace(style, cur);
+		} else if (IS_XSLT_NAME(cur, "output")) {
+		    /* No node-info needed. */
+		    xsltParseStylesheetOutput(style, cur);
+		} else if (IS_XSLT_NAME(cur, "key")) {
+		    /* TODO: node-info needed for expressions ? */
+		    xsltParseStylesheetKey(style, cur);
+		} else if (IS_XSLT_NAME(cur, "decimal-format")) {
+		    /* No node-info needed. */		     
+		    xsltParseStylesheetDecimalFormat(style, cur);
+		} else if (IS_XSLT_NAME(cur, "attribute-set")) {		    
+		    xsltParseTopLevelXSLTElem(cctxt, cur,
+			XSLT_FUNC_ATTRSET);		
+		} else if (IS_XSLT_NAME(cur, "namespace-alias")) {
+		    /* NOP; done already */		    
+		} else {
+		    if (cctxt->inode->forwardsCompat) {
+			/*
+			* Forwards-compatible mode:
+			*
+			* XSLT-1: "if it is a top-level element and
+			*  XSLT 1.0 does not allow such elements as top-level
+			*  elements, then the element must be ignored along
+			*  with its content;"
+			*/
+			/*
+			* TODO: I don't think we should generate a warning.
+			*/
+			xsltTransformError(NULL, style, cur,
+			    "Forwards-compatible mode: Ignoring unknown XSLT "
+			    "element '%s'.\n", cur->name);
+			style->warnings++;
+		    } else {
+			xsltTransformError(NULL, style, cur,
+			    "Unknown XSLT element '%s'.\n", cur->name);
+			style->errors++;
+		    }
+		}
+	    } else {
+		xsltTopLevelFunction function;
+
+		/*
+		* Process non-XSLT elements, which are in a
+		*  non-NULL namespace.
+		*/
+		/*
+		* QUESTION: What does xsltExtModuleTopLevelLookup()
+		*  do exactly?
+		*/
+		function = xsltExtModuleTopLevelLookup(cur->name,
+		    cur->ns->href);
+		if (function != NULL)
+		    function(style, cur);
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltParseXSLTStylesheetElemCore : User-defined "
+		    "data element '%s'.\n", cur->name);
+#endif
+	    }
+	}
+	cur = cur->next;
+    }
+
+exit:
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### END of parsing top-level elements of doc '%s'.\n",
+	node->doc->URL);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Templates: %d\n", templates);
+#ifdef XSLT_REFACTORED
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max inodes: %d\n", cctxt->maxNodeInfos);
+    xsltGenericDebug(xsltGenericDebugContext,
+	"### Max LREs  : %d\n", cctxt->maxLREs);
+#endif /* XSLT_REFACTORED */
+#endif /* WITH_XSLT_DEBUG_PARSING */
+
+    xsltCompilerNodePop(cctxt, node);
+    return(0);
+}
+
+/**
+ * xsltParseXSLTStylesheet:
+ * @cctxt: the compiler context
+ * @node: the xsl:stylesheet/xsl:transform element-node
+ *
+ * Parses the xsl:stylesheet and xsl:transform element. 
+ *
+ * 
+ *  
+ * 
+ *
+ * BIG TODO: The xsl:include stuff.
+ * 
+ * Called by xsltParseStylesheetTree()
+ *
+ * Returns 0 on success, a positive result on errors and
+ *         -1 on API or internal errors.
+ */
+static int
+xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+{
+    xmlNodePtr cur, start;
+
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+    
+    if (node->children == NULL)
+	goto exit;
+
+    /*
+    * Process top-level elements:
+    *  xsl:import (must be first)
+    *  xsl:include (this is just a pre-processing)
+    */
+    cur = node->children;
+    /*
+    * Process xsl:import elements.
+    * XSLT 1.0: "The xsl:import element children must precede all
+    *  other element children of an xsl:stylesheet element,
+    *  including any xsl:include element children."
+    */    
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1)
+    {
+	if (xsltParseStylesheetImport(cctxt->style, cur) != 0) {
+	    cctxt->style->errors++;
+	}
+	cur = cur->next;
+    }
+    if (cur == NULL)
+	goto exit;
+    start = cur;
+    /*
+    * Pre-process all xsl:include elements.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "include", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_INCLUDE);
+	cur = cur->next;
+    }
+    /*
+    * Pre-process all xsl:namespace-alias elements.
+    * URGENT TODO: This won't work correctly: the order of included
+    *  aliases and aliases defined here is significant.
+    */
+    cur = start;
+    while ((cur != NULL) &&
+	xsltParseFindTopLevelElem(cctxt, cur,
+	    BAD_CAST "namespace-alias", XSLT_NAMESPACE, 0, &cur) == 1)
+    {
+	xsltNamespaceAlias(cctxt->style, cur);
+	cur = cur->next;
+    }
+
+    if (cctxt->isInclude) {
+	/*
+	* If this stylesheet is intended for inclusion, then
+	* we will process only imports and includes. 
+	*/
+	goto exit;
+    } 
+    /*
+    * Now parse the rest of the top-level elements.
+    */
+    xsltParseXSLTStylesheetElemCore(cctxt, node); 	
+exit:
+
+    return(0);
+}
+
+#else /* XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetTop:
+ * @style:  the XSLT stylesheet
+ * @top:  the top level "stylesheet" or "transform" element
+ *
+ * scan the top level elements of an XSL stylesheet
+ */
+static void
+xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) {
+    xmlNodePtr cur;
+    xmlChar *prop;
+#ifdef WITH_XSLT_DEBUG_PARSING
+    int templates = 0;
+#endif
+
+    if (top == NULL)
+	return;
+
+    prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL);
+    if (prop == NULL) {
+	xsltTransformError(NULL, style, top,
+	    "xsl:version is missing: document may not be a stylesheet\n");
+	if (style != NULL) style->warnings++;
+    } else {
+	if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
+            (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
+	    xsltTransformError(NULL, style, top,
+		"xsl:version: only 1.0 features are supported\n");
+	     /* TODO set up compatibility when not XSLT 1.0 */
+	    if (style != NULL) style->warnings++;
+	}
+	xmlFree(prop);
+    }
+
+    /*
+     * process xsl:import elements
+     */
+    cur = top->children;
+    while (cur != NULL) {
+	    if (IS_BLANK_NODE(cur)) {
+		    cur = cur->next;
+		    continue;
+	    }
+	    if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "import")) {
+		    if (xsltParseStylesheetImport(style, cur) != 0)
+			    if (style != NULL) style->errors++;
+	    } else
+		    break;
+	    cur = cur->next;
+    }
+
+    /*
+     * process other top-level elements
+     */
+    while (cur != NULL) {
+	if (IS_BLANK_NODE(cur)) {
+	    cur = cur->next;
+	    continue;
+	}
+	if (cur->type == XML_TEXT_NODE) {
+	    if (cur->content != NULL) {
+		xsltTransformError(NULL, style, cur,
+		    "misplaced text node: '%s'\n", cur->content);
+	    }
+	    if (style != NULL) style->errors++;
+            cur = cur->next;
+	    continue;
+	}
+	if ((cur->type == XML_ELEMENT_NODE) && (cur->ns == NULL)) {
+	    xsltGenericError(xsltGenericErrorContext,
+		     "Found a top-level element %s with null namespace URI\n",
+		     cur->name);
+	    if (style != NULL) style->errors++;
+	    cur = cur->next;
+	    continue;
+	}
+	if ((cur->type == XML_ELEMENT_NODE) && (!(IS_XSLT_ELEM(cur)))) {
+	    xsltTopLevelFunction function;
+
+	    function = xsltExtModuleTopLevelLookup(cur->name,
+						   cur->ns->href);
+	    if (function != NULL)
+		function(style, cur);
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltParseStylesheetTop : found foreign element %s\n",
+		    cur->name);
+#endif
+            cur = cur->next;
+	    continue;
+	}
+	if (IS_XSLT_NAME(cur, "import")) {
+	    xsltTransformError(NULL, style, cur,
+			"xsltParseStylesheetTop: ignoring misplaced import element\n");
+	    if (style != NULL) style->errors++;
+    } else if (IS_XSLT_NAME(cur, "include")) {
+	    if (xsltParseStylesheetInclude(style, cur) != 0)
+		if (style != NULL) style->errors++;
+    } else if (IS_XSLT_NAME(cur, "strip-space")) {
+	    xsltParseStylesheetStripSpace(style, cur);
+    } else if (IS_XSLT_NAME(cur, "preserve-space")) {
+	    xsltParseStylesheetPreserveSpace(style, cur);
+    } else if (IS_XSLT_NAME(cur, "output")) {
+	    xsltParseStylesheetOutput(style, cur);
+    } else if (IS_XSLT_NAME(cur, "key")) {
+	    xsltParseStylesheetKey(style, cur);
+    } else if (IS_XSLT_NAME(cur, "decimal-format")) {
+	    xsltParseStylesheetDecimalFormat(style, cur);
+    } else if (IS_XSLT_NAME(cur, "attribute-set")) {
+	    xsltParseStylesheetAttributeSet(style, cur);
+    } else if (IS_XSLT_NAME(cur, "variable")) {
+	    xsltParseGlobalVariable(style, cur);
+    } else if (IS_XSLT_NAME(cur, "param")) {
+	    xsltParseGlobalParam(style, cur);
+    } else if (IS_XSLT_NAME(cur, "template")) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    templates++;
+#endif
+	    xsltParseStylesheetTemplate(style, cur);
+    } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
+	    xsltNamespaceAlias(style, cur);
+	} else {
+	    /*
+	    * BUG TODO: The version of the *doc* is irrelevant for
+	    *  the forwards-compatible mode.
+	    */
+            if ((style != NULL) && (style->doc->version != NULL) &&
+	        (!strncmp((const char *) style->doc->version, "1.0", 3))) {
+	        xsltTransformError(NULL, style, cur,
+			"xsltParseStylesheetTop: unknown %s element\n",
+			cur->name);
+	        if (style != NULL) style->errors++;
+	    }
+	    else {
+                /* do Forwards-Compatible Processing */
+	        xsltTransformError(NULL, style, cur,
+			"xsltParseStylesheetTop: ignoring unknown %s element\n",
+			cur->name);
+	        if (style != NULL) style->warnings++;
+            }
+	}
+	cur = cur->next;
+    }
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+		    "parsed %d templates\n", templates);
+#endif
+}
+
+#endif /* else of XSLT_REFACTORED */
+
+#ifdef XSLT_REFACTORED
+/**
+ * xsltParseSimplifiedStylesheetTree:
+ *
+ * @style: the stylesheet (TODO: Change this to the compiler context)
+ * @doc: the document containing the stylesheet.
+ * @node: the node where the stylesheet is rooted at
+ *
+ * Returns 0 in case of success, a positive result if an error occurred
+ *         and -1 on API and internal errors.
+ */
+static int
+xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt,
+				  xmlDocPtr doc,
+				  xmlNodePtr node)
+{
+    xsltTemplatePtr templ;
+    
+    if ((cctxt == NULL) || (node == NULL))
+	return(-1);
+
+    if (xsltParseAttrXSLTVersion(cctxt, node, 0) == XSLT_ELEMENT_CATEGORY_LRE)
+    {
+	/*
+	* TODO: Adjust report, since this might be an
+	* embedded stylesheet.
+	*/
+	xsltTransformError(NULL, cctxt->style, node,
+	    "The attribute 'xsl:version' is missing; cannot identify "
+	    "this document as an XSLT stylesheet document.\n");
+	cctxt->style->errors++;
+	return(1);
+    }
+    
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	"xsltParseSimplifiedStylesheetTree: document is stylesheet\n");
+#endif        
+    
+    /*
+    * Create and link the template
+    */
+    templ = xsltNewTemplate();
+    if (templ == NULL) {
+	return(-1);
+    }
+    templ->next = cctxt->style->templates;
+    cctxt->style->templates = templ;
+    templ->match = xmlStrdup(BAD_CAST "/");
+
+    /*
+    * Note that we push the document-node in this special case.
+    */
+    xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
+    /*
+    * In every case, we need to have
+    * the in-scope namespaces of the element, where the
+    * stylesheet is rooted at, regardless if it's an XSLT
+    * instruction or a literal result instruction (or if
+    * this is an embedded stylesheet).
+    */
+    cctxt->inode->inScopeNs =
+	xsltCompilerBuildInScopeNsList(cctxt, node);
+    /*
+    * Parse the content and register the match-pattern.
+    */
+    xsltParseSequenceConstructor(cctxt, node);
+    xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
+
+    templ->elem = (xmlNodePtr) doc;
+    templ->content = node;
+    xsltAddTemplate(cctxt->style, templ, NULL, NULL);
+    cctxt->style->literal_result = 1;
+    return(0);
+}
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+int
+xsltRestoreDocumentNamespaces(xsltNsMapPtr ns, xmlDocPtr doc)
+{
+    if (doc == NULL)
+	return(-1);
+    /*
+    * Revert the changes we have applied to the namespace-URIs of
+    * ns-decls.
+    */    
+    while (ns != NULL) {
+	if ((ns->doc == doc) && (ns->ns != NULL)) {
+	    ns->ns->href = ns->origNsName;
+	    ns->origNsName = NULL;
+	    ns->ns = NULL;	    
+	}
+	ns = ns->next;
+    }
+    return(0);
+}
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+/**
+ * xsltParseStylesheetProcess:
+ * @style:  the XSLT stylesheet (the current stylesheet-level)
+ * @doc:  and xmlDoc parsed XML
+ *
+ * Parses an XSLT stylesheet, adding the associated structures.
+ * Called by:
+ *  xsltParseStylesheetImportedDoc() (xslt.c)
+ *  xsltParseStylesheetInclude() (imports.c)
+ *
+ * Returns the value of the @style parameter if everything
+ * went right, NULL if something went amiss.
+ */
+xsltStylesheetPtr
+xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc)
+{
+    xsltCompilerCtxtPtr cctxt;
+    xmlNodePtr cur;
+    int oldIsSimplifiedStylesheet;
+
+
+    if ((style == NULL) || (doc == NULL))
+	return(NULL);
+
+    cctxt = XSLT_CCTXT(style);
+
+    cur = xmlDocGetRootElement(doc);
+    if (cur == NULL) {
+	xsltTransformError(NULL, style, (xmlNodePtr) doc,
+		"xsltParseStylesheetProcess : empty stylesheet\n");
+	return(NULL);
+    }
+    oldIsSimplifiedStylesheet = cctxt->simplified;
+
+    if ((IS_XSLT_ELEM(cur)) && 
+	((IS_XSLT_NAME(cur, "stylesheet")) ||
+	 (IS_XSLT_NAME(cur, "transform")))) {	
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseStylesheetProcess : found stylesheet\n");
+#endif
+	cctxt->simplified = 0;
+	style->literal_result = 0;
+    } else {
+	cctxt->simplified = 1;
+	style->literal_result = 1;
+    }
+    /*
+    * Pre-process the stylesheet if not already done before.
+    *  This will remove PIs and comments, merge adjacent
+    *  text nodes, internalize strings, etc.
+    */
+    if (! style->nopreproc)
+	xsltParsePreprocessStylesheetTree(cctxt, cur);
+    /*
+    * Parse and compile the stylesheet.
+    */
+    if (style->literal_result == 0) {
+	if (xsltParseXSLTStylesheetElem(cctxt, cur) != 0)
+	    return(NULL);
+    } else {
+	if (xsltParseSimplifiedStylesheetTree(cctxt, doc, cur) != 0)
+	    return(NULL);
+    }    
+
+    cctxt->simplified = oldIsSimplifiedStylesheet;
+
+    return(style);
+}
+
+#else /* XSLT_REFACTORED */
+
+xsltStylesheetPtr
+xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) {
+    xmlNodePtr cur;
+
+    if (doc == NULL)
+	return(NULL);
+    if (ret == NULL)
+	return(ret);
+    
+    /*
+     * First steps, remove blank nodes,
+     * locate the xsl:stylesheet element and the
+     * namespace declaration.
+     */
+    cur = xmlDocGetRootElement(doc);
+    if (cur == NULL) {
+	xsltTransformError(NULL, ret, (xmlNodePtr) doc,
+		"xsltParseStylesheetProcess : empty stylesheet\n");
+	return(NULL);
+    }
+
+    if ((IS_XSLT_ELEM(cur)) && 
+	((IS_XSLT_NAME(cur, "stylesheet")) ||
+	 (IS_XSLT_NAME(cur, "transform")))) {	
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseStylesheetProcess : found stylesheet\n");
+#endif
+	ret->literal_result = 0;
+	xsltParseStylesheetExcludePrefix(ret, cur, 1);
+	xsltParseStylesheetExtPrefix(ret, cur, 1);
+    } else {
+	xsltParseStylesheetExcludePrefix(ret, cur, 0);
+	xsltParseStylesheetExtPrefix(ret, cur, 0);
+	ret->literal_result = 1;
+    }
+    if (!ret->nopreproc) {
+	xsltPrecomputeStylesheet(ret, cur);
+    }
+    if (ret->literal_result == 0) {
+	xsltParseStylesheetTop(ret, cur);
+    } else {
+	xmlChar *prop;
+	xsltTemplatePtr template;
+
+	/*
+	 * the document itself might be the template, check xsl:version
+	 */
+	prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
+	if (prop == NULL) {
+	    xsltTransformError(NULL, ret, cur,
+		"xsltParseStylesheetProcess : document is not a stylesheet\n");
+	    return(NULL);
+	}
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+        xsltGenericDebug(xsltGenericDebugContext,
+		"xsltParseStylesheetProcess : document is stylesheet\n");
+#endif
+	
+	if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) {
+	    xsltTransformError(NULL, ret, cur,
+		"xsl:version: only 1.0 features are supported\n");
+	     /* TODO set up compatibility when not XSLT 1.0 */
+	    ret->warnings++;
+	}
+	xmlFree(prop);
+
+	/*
+	 * Create and link the template
+	 */
+	template = xsltNewTemplate();
+	if (template == NULL) {
+	    return(NULL);
+	}
+	template->next = ret->templates;
+	ret->templates = template;
+	template->match = xmlStrdup((const xmlChar *)"/");
+
+	/*
+	 * parse the content and register the pattern
+	 */
+	xsltParseTemplateContent(ret, (xmlNodePtr) doc);
+	template->elem = (xmlNodePtr) doc;
+	template->content = doc->children;
+	xsltAddTemplate(ret, template, NULL, NULL);
+	ret->literal_result = 1;	
+    }
+
+    return(ret);
+}
+
+#endif /* else of XSLT_REFACTORED */
+
+/**
+ * xsltParseStylesheetImportedDoc:
+ * @doc:  an xmlDoc parsed XML
+ * @parentStyle: pointer to the parent stylesheet (if it exists)
+ *
+ * parse an XSLT stylesheet building the associated structures
+ * except the processing not needed for imported documents.
+ *
+ * Returns a new XSLT stylesheet structure.
+ */
+
+xsltStylesheetPtr
+xsltParseStylesheetImportedDoc(xmlDocPtr doc,
+			       xsltStylesheetPtr parentStyle) {
+    xsltStylesheetPtr retStyle;
+
+    if (doc == NULL)
+	return(NULL);
+
+    retStyle = xsltNewStylesheet();
+    if (retStyle == NULL)
+	return(NULL);
+    /*
+    * Set the importing stylesheet module; also used to detect recursion.
+    */
+    retStyle->parent = parentStyle;
+    /*
+    * Adjust the string dict.
+    */
+    if (doc->dict != NULL) {
+        xmlDictFree(retStyle->dict);
+	retStyle->dict = doc->dict;
+#ifdef WITH_XSLT_DEBUG
+        xsltGenericDebug(xsltGenericDebugContext,
+	    "reusing dictionary from %s for stylesheet\n",
+	    doc->URL);
+#endif
+	xmlDictReference(retStyle->dict);
+    }    	
+    
+    /*
+    * TODO: Eliminate xsltGatherNamespaces(); we must not restrict
+    *  the stylesheet to containt distinct namespace prefixes.
+    */
+    xsltGatherNamespaces(retStyle);
+
+#ifdef XSLT_REFACTORED
+    {
+	xsltCompilerCtxtPtr cctxt;
+	xsltStylesheetPtr oldCurSheet;
+	    
+	if (parentStyle == NULL) {
+	    xsltPrincipalStylesheetDataPtr principalData;
+	    /*
+	    * Principal stylesheet
+	    * --------------------
+	    */
+	    retStyle->principal = retStyle;
+	    /*
+	    * Create extra data for the principal stylesheet.
+	    */
+	    principalData = xsltNewPrincipalStylesheetData();
+	    if (principalData == NULL) {
+		xsltFreeStylesheet(retStyle);
+		return(NULL);
+	    }
+	    retStyle->principalData = principalData;
+	    /*
+	    * Create the compilation context
+	    * ------------------------------
+	    * (only once; for the principal stylesheet).
+	    * This is currently the only function where the
+	    * compilation context is created.
+	    */
+	    cctxt = xsltCompilationCtxtCreate(retStyle);
+	    if (cctxt == NULL) {
+		xsltFreeStylesheet(retStyle);
+		return(NULL);
+	    }	    	    
+	    retStyle->compCtxt = (void *) cctxt;
+	    cctxt->style = retStyle;
+	    cctxt->dict = retStyle->dict;
+	    cctxt->psData = principalData;
+	    /*
+	    * Push initial dummy node info.
+	    */
+	    cctxt->depth = -1;
+	    xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
+	} else {
+	    /*
+	    * Imported stylesheet.
+	    */
+	    retStyle->principal = parentStyle->principal;
+	    cctxt = parentStyle->compCtxt;
+	    retStyle->compCtxt = cctxt;
+	}
+	/*
+	* Save the old and set the current stylesheet structure in the
+	* compilation context.
+	*/
+	oldCurSheet = cctxt->style;
+	cctxt->style = retStyle;
+	
+	retStyle->doc = doc;
+	xsltParseStylesheetProcess(retStyle, doc);
+	
+	cctxt->style = oldCurSheet;
+	if (parentStyle == NULL) {
+	    /*
+	    * Pop the initial dummy node info.
+	    */
+	    xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
+	} else {
+	    /*
+	    * Clear the compilation context of imported
+	    * stylesheets.
+	    * TODO: really?
+	    */
+	    /* retStyle->compCtxt = NULL; */
+	}
+	/*
+	* Free the stylesheet if there were errors.
+	*/
+	if (retStyle != NULL) {
+	    if (retStyle->errors != 0) {
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+		/*
+		* Restore all changes made to namespace URIs of ns-decls.
+		*/
+		if (cctxt->psData->nsMap)		
+		    xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc);
+#endif
+		/*
+		* Detach the doc from the stylesheet; otherwise the doc
+		* will be freed in xsltFreeStylesheet().
+		*/
+		retStyle->doc = NULL;
+		/*
+		* Cleanup the doc if its the main stylesheet.
+		*/
+		if (parentStyle == NULL) {
+		    xsltCleanupStylesheetTree(doc, xmlDocGetRootElement(doc));
+		    if (retStyle->compCtxt != NULL) {			
+			xsltCompilationCtxtFree(retStyle->compCtxt);
+			retStyle->compCtxt = NULL;
+		    }
+		}
+
+		xsltFreeStylesheet(retStyle);
+		retStyle = NULL;
+	    }
+	}
+    }
+        
+#else /* XSLT_REFACTORED */
+    /*
+    * Old behaviour.
+    */
+    retStyle->doc = doc;
+    if (xsltParseStylesheetProcess(retStyle, doc) == NULL) {
+		retStyle->doc = NULL;
+		xsltFreeStylesheet(retStyle);
+		retStyle = NULL;
+    }
+    if (retStyle != NULL) {
+	if (retStyle->errors != 0) {
+	    retStyle->doc = NULL;
+	    if (parentStyle == NULL)
+		xsltCleanupStylesheetTree(doc,
+		    xmlDocGetRootElement(doc));
+	    xsltFreeStylesheet(retStyle);
+	    retStyle = NULL;
+	}
+    }
+#endif /* else of XSLT_REFACTORED */
+        
+    return(retStyle);
+}
+
+/**
+ * xsltParseStylesheetDoc:
+ * @doc:  and xmlDoc parsed XML
+ *
+ * parse an XSLT stylesheet, building the associated structures.  doc
+ * is kept as a reference within the returned stylesheet, so changes
+ * to doc after the parsing will be reflected when the stylesheet
+ * is applied, and the doc is automatically freed when the
+ * stylesheet is closed.
+ *
+ * Returns a new XSLT stylesheet structure.
+ */
+
+xsltStylesheetPtr
+xsltParseStylesheetDoc(xmlDocPtr doc) {
+    xsltStylesheetPtr ret;
+
+    ret = xsltParseStylesheetImportedDoc(doc, NULL);
+    if (ret == NULL)
+	return(NULL);
+
+    xsltResolveStylesheetAttributeSet(ret);
+#ifdef XSLT_REFACTORED
+    /*
+    * Free the compilation context.
+    * TODO: Check if it's better to move this cleanup to
+    *   xsltParseStylesheetImportedDoc().
+    */
+    if (ret->compCtxt != NULL) {
+	xsltCompilationCtxtFree(XSLT_CCTXT(ret));
+	ret->compCtxt = NULL;
+    }
+#endif
+    return(ret);
+}
+
+/**
+ * xsltParseStylesheetFile:
+ * @filename:  the filename/URL to the stylesheet
+ *
+ * Load and parse an XSLT stylesheet
+ *
+ * Returns a new XSLT stylesheet structure.
+ */
+
+xsltStylesheetPtr
+xsltParseStylesheetFile(const xmlChar* filename) {
+    xsltSecurityPrefsPtr sec;
+    xsltStylesheetPtr ret;
+    xmlDocPtr doc;
+    
+
+    if (filename == NULL)
+	return(NULL);
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+    xsltGenericDebug(xsltGenericDebugContext,
+	    "xsltParseStylesheetFile : parse %s\n", filename);
+#endif
+
+    /*
+     * Security framework check
+     */
+    sec = xsltGetDefaultSecurityPrefs();
+    if (sec != NULL) {
+	int res;
+
+	res = xsltCheckRead(sec, NULL, filename);
+	if (res == 0) {
+	    xsltTransformError(NULL, NULL, NULL,
+		 "xsltParseStylesheetFile: read rights for %s denied\n",
+			     filename);
+	    return(NULL);
+	}
+    }
+
+    doc = xsltDocDefaultLoader(filename, NULL, XSLT_PARSE_OPTIONS,
+                               NULL, XSLT_LOAD_START);
+    if (doc == NULL) {
+	xsltTransformError(NULL, NULL, NULL,
+		"xsltParseStylesheetFile : cannot parse %s\n", filename);
+	return(NULL);
+    }
+    ret = xsltParseStylesheetDoc(doc);
+    if (ret == NULL) {
+	xmlFreeDoc(doc);
+	return(NULL);
+    }
+
+    return(ret);
+}
+
+/************************************************************************
+ *									*
+ *			Handling of Stylesheet PI			*
+ *									*
+ ************************************************************************/
+
+#define CUR (*cur)
+#define SKIP(val) cur += (val)
+#define NXT(val) cur[(val)]
+#define SKIP_BLANKS						\
+    while (IS_BLANK(CUR)) NEXT
+#define NEXT ((*cur) ?  cur++ : cur)
+
+/**
+ * xsltParseStylesheetPI:
+ * @value: the value of the PI
+ *
+ * This function checks that the type is text/xml and extracts
+ * the URI-Reference for the stylesheet
+ *
+ * Returns the URI-Reference for the stylesheet or NULL (it need to
+ *         be freed by the caller)
+ */
+static xmlChar *
+xsltParseStylesheetPI(const xmlChar *value) {
+    const xmlChar *cur;
+    const xmlChar *start;
+    xmlChar *val;
+    xmlChar tmp;
+    xmlChar *href = NULL;
+    int isXml = 0;
+
+    if (value == NULL)
+	return(NULL);
+
+    cur = value;
+    while (CUR != 0) {
+	SKIP_BLANKS;
+	if ((CUR == 't') && (NXT(1) == 'y') && (NXT(2) == 'p') &&
+	    (NXT(3) == 'e')) {
+	    SKIP(4);
+	    SKIP_BLANKS;
+	    if (CUR != '=')
+		continue;
+	    NEXT;
+	    if ((CUR != '\'') && (CUR != '"'))
+		continue;
+	    tmp = CUR;
+	    NEXT;
+	    start = cur;
+	    while ((CUR != 0) && (CUR != tmp))
+		NEXT;
+	    if (CUR != tmp)
+		continue;
+	    val = xmlStrndup(start, cur - start);
+	    NEXT;
+	    if (val == NULL) 
+		return(NULL);
+	    if ((xmlStrcasecmp(val, BAD_CAST "text/xml")) &&
+		(xmlStrcasecmp(val, BAD_CAST "text/xsl"))) {
+                xmlFree(val);
+		break;
+	    }
+	    isXml = 1;
+	    xmlFree(val);
+	} else if ((CUR == 'h') && (NXT(1) == 'r') && (NXT(2) == 'e') &&
+	    (NXT(3) == 'f')) {
+	    SKIP(4);
+	    SKIP_BLANKS;
+	    if (CUR != '=')
+		continue;
+	    NEXT;
+	    if ((CUR != '\'') && (CUR != '"'))
+		continue;
+	    tmp = CUR;
+	    NEXT;
+	    start = cur;
+	    while ((CUR != 0) && (CUR != tmp))
+		NEXT;
+	    if (CUR != tmp)
+		continue;
+	    if (href == NULL)
+		href = xmlStrndup(start, cur - start);
+	    NEXT;
+	} else {
+	    while ((CUR != 0) && (!IS_BLANK(CUR)))
+		NEXT;
+	}
+            
+    }
+
+    if (!isXml) {
+	if (href != NULL)
+	    xmlFree(href);
+	href = NULL;
+    }
+    return(href);
+}
+
+/**
+ * xsltLoadStylesheetPI:
+ * @doc:  a document to process
+ *
+ * This function tries to locate the stylesheet PI in the given document
+ * If found, and if contained within the document, it will extract 
+ * that subtree to build the stylesheet to process @doc (doc itself will
+ * be modified). If found but referencing an external document it will
+ * attempt to load it and generate a stylesheet from it. In both cases,
+ * the resulting stylesheet and the document need to be freed once the
+ * transformation is done.
+ *
+ * Returns a new XSLT stylesheet structure or NULL if not found.
+ */
+xsltStylesheetPtr
+xsltLoadStylesheetPI(xmlDocPtr doc) {
+    xmlNodePtr child;
+    xsltStylesheetPtr ret = NULL;
+    xmlChar *href = NULL;
+    xmlURIPtr URI;
+
+    if (doc == NULL)
+	return(NULL);
+
+    /*
+     * Find the text/xml stylesheet PI id any before the root
+     */
+    child = doc->children;
+    while ((child != NULL) && (child->type != XML_ELEMENT_NODE)) {
+	if ((child->type == XML_PI_NODE) &&
+	    (xmlStrEqual(child->name, BAD_CAST "xml-stylesheet"))) {
+	    href = xsltParseStylesheetPI(child->content);
+	    if (href != NULL)
+		break;
+	}
+	child = child->next;
+    }
+
+    /*
+     * If found check the href to select processing
+     */
+    if (href != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+	xsltGenericDebug(xsltGenericDebugContext,
+		"xsltLoadStylesheetPI : found PI href=%s\n", href);
+#endif
+	URI = xmlParseURI((const char *) href);
+	if (URI == NULL) {
+	    xsltTransformError(NULL, NULL, child,
+		    "xml-stylesheet : href %s is not valid\n", href);
+	    xmlFree(href);
+	    return(NULL);
+	}
+	if ((URI->fragment != NULL) && (URI->scheme == NULL) &&
+            (URI->opaque == NULL) && (URI->authority == NULL) &&
+            (URI->server == NULL) && (URI->user == NULL) &&
+            (URI->path == NULL) && (URI->query == NULL)) {
+	    xmlAttrPtr ID;
+
+#ifdef WITH_XSLT_DEBUG_PARSING
+	    xsltGenericDebug(xsltGenericDebugContext,
+		    "xsltLoadStylesheetPI : Reference to ID %s\n", href);
+#endif
+	    if (URI->fragment[0] == '#')
+		ID = xmlGetID(doc, (const xmlChar *) &(URI->fragment[1]));
+	    else
+		ID = xmlGetID(doc, (const xmlChar *) URI->fragment);
+	    if (ID == NULL) {
+		xsltTransformError(NULL, NULL, child,
+		    "xml-stylesheet : no ID %s found\n", URI->fragment);
+	    } else {
+		xmlDocPtr fake;
+		xmlNodePtr subtree;
+
+		/*
+		 * move the subtree in a new document passed to
+		 * the stylesheet analyzer
+		 */
+		subtree = ID->parent;
+		fake = xmlNewDoc(NULL);
+		if (fake != NULL) {
+                    /*
+		     * the dictionary should be shared since nodes are
+		     * moved over.
+		     */
+		    fake->dict = doc->dict;
+		    xmlDictReference(doc->dict);
+#ifdef WITH_XSLT_DEBUG
+		    xsltGenericDebug(xsltGenericDebugContext,
+                         "reusing dictionary from %s for stylesheet\n",
+			 doc->URL);
+#endif
+
+		    xmlUnlinkNode(subtree);
+		    xmlAddChild((xmlNodePtr) fake, subtree);
+		    ret = xsltParseStylesheetDoc(fake);
+		    if (ret == NULL)
+			xmlFreeDoc(fake);
+		}
+	    }
+	} else {
+	    xmlChar *URL, *base;
+
+	    /*
+	     * Reference to an external stylesheet
+	     */
+
+	    base = xmlNodeGetBase(doc, (xmlNodePtr) doc);
+	    URL = xmlBuildURI(href, base);
+	    if (URL != NULL) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+			"xsltLoadStylesheetPI : fetching %s\n", URL);
+#endif
+		ret = xsltParseStylesheetFile(URL);
+		xmlFree(URL);
+	    } else {
+#ifdef WITH_XSLT_DEBUG_PARSING
+		xsltGenericDebug(xsltGenericDebugContext,
+			"xsltLoadStylesheetPI : fetching %s\n", href);
+#endif
+		ret = xsltParseStylesheetFile(href);
+	    }
+	    if (base != NULL)
+		xmlFree(base);
+	}
+	xmlFreeURI(URI);
+	xmlFree(href);
+    }
+    return(ret);
+}
diff --git a/third_party/libxslt/libxslt/xslt.h b/third_party/libxslt/libxslt/xslt.h
new file mode 100644
index 0000000..849b03c
--- /dev/null
+++ b/third_party/libxslt/libxslt/xslt.h
@@ -0,0 +1,103 @@
+/*
+ * Summary: Interfaces, constants and types related to the XSLT engine
+ * Description: Interfaces, constants and types related to the XSLT engine
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_H__
+#define __XML_XSLT_H__
+
+#include 
+#include "xsltexports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XSLT_DEFAULT_VERSION:
+ *
+ * The default version of XSLT supported.
+ */
+#define XSLT_DEFAULT_VERSION     "1.0"
+
+/**
+ * XSLT_DEFAULT_VENDOR:
+ *
+ * The XSLT "vendor" string for this processor.
+ */
+#define XSLT_DEFAULT_VENDOR      "libxslt"
+
+/**
+ * XSLT_DEFAULT_URL:
+ *
+ * The XSLT "vendor" URL for this processor.
+ */
+#define XSLT_DEFAULT_URL         "http://xmlsoft.org/XSLT/"
+
+/**
+ * XSLT_NAMESPACE:
+ *
+ * The XSLT specification namespace.
+ */
+#define XSLT_NAMESPACE ((xmlChar *) "http://www.w3.org/1999/XSL/Transform")
+
+/**
+ * XSLT_PARSE_OPTIONS:
+ *
+ * The set of options to pass to an xmlReadxxx when loading files for
+ * XSLT consumption.
+ */
+#define XSLT_PARSE_OPTIONS \
+ XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA
+
+/**
+ * xsltMaxDepth:
+ *
+ * This value is used to detect templates loops.
+ */
+XSLTPUBVAR int xsltMaxDepth;
+
+/**
+ * xsltEngineVersion:
+ *
+ * The version string for libxslt.
+ */
+XSLTPUBVAR const char *xsltEngineVersion;
+
+/**
+ * xsltLibxsltVersion:
+ *
+ * The version of libxslt compiled.
+ */
+XSLTPUBVAR const int xsltLibxsltVersion;
+
+/**
+ * xsltLibxmlVersion:
+ *
+ * The version of libxml libxslt was compiled against.
+ */
+XSLTPUBVAR const int xsltLibxmlVersion;
+
+/*
+ * Global initialization function.
+ */
+
+XSLTPUBFUN void XSLTCALL
+		xsltInit		(void);
+
+/*
+ * Global cleanup function.
+ */
+XSLTPUBFUN void XSLTCALL	
+		xsltCleanupGlobals	(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_H__ */
+
diff --git a/third_party/libxslt/libxslt/xsltInternals.h b/third_party/libxslt/libxslt/xsltInternals.h
new file mode 100644
index 0000000..f176264
--- /dev/null
+++ b/third_party/libxslt/libxslt/xsltInternals.h
@@ -0,0 +1,1970 @@
+/*
+ * Summary: internal data structures, constants and functions
+ * Description: Internal data structures, constants and functions used
+ *              by the XSLT engine. 
+ *              They are not part of the API or ABI, i.e. they can change
+ *              without prior notice, use carefully.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLT_INTERNALS_H__
+#define __XML_XSLT_INTERNALS_H__
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xsltexports.h"
+#include "numbersInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* #define XSLT_DEBUG_PROFILE_CACHE */
+
+/**
+ * XSLT_IS_TEXT_NODE:
+ *
+ * check if the argument is a text node
+ */
+#define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
+    (((n)->type == XML_TEXT_NODE) || \
+     ((n)->type == XML_CDATA_SECTION_NODE)))
+
+
+/**
+ * XSLT_MARK_RES_TREE_FRAG:
+ *
+ * internal macro to set up tree fragments
+ */
+#define XSLT_MARK_RES_TREE_FRAG(n) \
+    (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
+
+/**
+ * XSLT_IS_RES_TREE_FRAG:
+ *
+ * internal macro to test tree fragments
+ */
+#define XSLT_IS_RES_TREE_FRAG(n) \
+    ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
+     ((n)->name != NULL) && ((n)->name[0] == ' '))
+
+/**
+ * XSLT_REFACTORED_KEYCOMP:
+ *
+ * Internal define to enable on-demand xsl:key computation.
+ * That's the only mode now but the define is kept for compatibility
+ */
+#define XSLT_REFACTORED_KEYCOMP
+
+/**
+ * XSLT_FAST_IF:
+ *
+ * Internal define to enable usage of xmlXPathCompiledEvalToBoolean()
+ * for XSLT "tests"; e.g. in 
+ */
+#define XSLT_FAST_IF
+
+/**
+ * XSLT_REFACTORED:
+ *
+ * Internal define to enable the refactored parts of Libxslt.
+ */
+/* #define XSLT_REFACTORED */
+/* ==================================================================== */
+
+/**
+ * XSLT_REFACTORED_VARS:
+ *
+ * Internal define to enable the refactored variable part of libxslt
+ */
+#define XSLT_REFACTORED_VARS
+
+#ifdef XSLT_REFACTORED
+
+extern const xmlChar *xsltXSLTAttrMarker;
+
+
+/* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
+
+/* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
+
+/**
+ * XSLT_REFACTORED_XSLT_NSCOMP
+ *
+ * Internal define to enable the pointer-comparison of
+ * namespaces of XSLT elements. 
+ */
+/* #define XSLT_REFACTORED_XSLT_NSCOMP */
+
+/**
+ * XSLT_REFACTORED_XPATHCOMP:
+ *
+ * Internal define to enable the optimization of the
+ * compilation of XPath expressions.
+ */
+#define XSLT_REFACTORED_XPATHCOMP
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+
+extern const xmlChar *xsltConstNamespaceNameXSLT;
+
+/**
+ * IS_XSLT_ELEM_FAST:
+ *
+ * quick test to detect XSLT elements
+ */
+#define IS_XSLT_ELEM_FAST(n) \
+    (((n) != NULL) && ((n)->ns != NULL) && \
+    ((n)->ns->href == xsltConstNamespaceNameXSLT))
+
+/**
+ * IS_XSLT_ATTR_FAST:
+ *
+ * quick test to detect XSLT attributes
+ */
+#define IS_XSLT_ATTR_FAST(a) \
+    (((a) != NULL) && ((a)->ns != NULL) && \
+    ((a)->ns->href == xsltConstNamespaceNameXSLT))
+
+/**
+ * XSLT_HAS_INTERNAL_NSMAP:
+ *
+ * check for namespace mapping
+ */
+#define XSLT_HAS_INTERNAL_NSMAP(s) \
+    (((s) != NULL) && ((s)->principal) && \
+     ((s)->principal->principalData) && \
+     ((s)->principal->principalData->nsMap))
+
+/**
+ * XSLT_GET_INTERNAL_NSMAP:
+ *
+ * get pointer to namespace map
+ */
+#define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
+
+#else /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+/**
+ * IS_XSLT_ELEM_FAST:
+ *
+ * quick check whether this is an xslt element
+ */
+#define IS_XSLT_ELEM_FAST(n) \
+    (((n) != NULL) && ((n)->ns != NULL) && \
+     (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
+
+/**
+ * IS_XSLT_ATTR_FAST:
+ *
+ * quick check for xslt namespace attribute
+ */
+#define IS_XSLT_ATTR_FAST(a) \
+    (((a) != NULL) && ((a)->ns != NULL) && \
+     (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
+
+
+#endif /* XSLT_REFACTORED_XSLT_NSCOMP */
+
+
+/**
+ * XSLT_REFACTORED_MANDATORY_VERSION:
+ *
+ * TODO: Currently disabled to surpress regression test failures, since
+ *  the old behaviour was that a missing version attribute
+ *  produced a only a warning and not an error, which was incerrect.
+ *  So the regression tests need to be fixed if this is enabled.
+ */
+/* #define XSLT_REFACTORED_MANDATORY_VERSION */
+
+/**
+ * xsltPointerList:
+ *
+ * Pointer-list for various purposes.
+ */
+typedef struct _xsltPointerList xsltPointerList;
+typedef xsltPointerList *xsltPointerListPtr;
+struct _xsltPointerList {
+    void **items;
+    int number;
+    int size;
+};
+
+#endif
+
+/**
+ * XSLT_REFACTORED_PARSING:
+ *
+ * Internal define to enable the refactored parts of Libxslt
+ * related to parsing.
+ */
+/* #define XSLT_REFACTORED_PARSING */
+
+/**
+ * XSLT_MAX_SORT:
+ *
+ * Max number of specified xsl:sort on an element.
+ */
+#define XSLT_MAX_SORT 15
+
+/**
+ * XSLT_PAT_NO_PRIORITY:
+ *
+ * Specific value for pattern without priority expressed.
+ */
+#define XSLT_PAT_NO_PRIORITY -12345789
+
+/**
+ * xsltRuntimeExtra:
+ *
+ * Extra information added to the transformation context.
+ */
+typedef struct _xsltRuntimeExtra xsltRuntimeExtra;
+typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
+struct _xsltRuntimeExtra {
+    void       *info;		/* pointer to the extra data */
+    xmlFreeFunc deallocate;	/* pointer to the deallocation routine */
+    union {			/* dual-purpose field */
+        void   *ptr;		/* data not needing deallocation */
+	int    ival;		/* integer value storage */
+    } val;
+};
+
+/**
+ * XSLT_RUNTIME_EXTRA_LST:
+ * @ctxt: the transformation context
+ * @nr: the index
+ *
+ * Macro used to access extra information stored in the context
+ */
+#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
+/**
+ * XSLT_RUNTIME_EXTRA_FREE:
+ * @ctxt: the transformation context
+ * @nr: the index
+ *
+ * Macro used to free extra information stored in the context
+ */
+#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
+/**
+ * XSLT_RUNTIME_EXTRA:
+ * @ctxt: the transformation context
+ * @nr: the index
+ *
+ * Macro used to define extra information stored in the context
+ */
+#define	XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
+
+/**
+ * xsltTemplate:
+ *
+ * The in-memory structure corresponding to an XSLT Template.
+ */
+typedef struct _xsltTemplate xsltTemplate;
+typedef xsltTemplate *xsltTemplatePtr;
+struct _xsltTemplate {
+    struct _xsltTemplate *next;/* chained list sorted by priority */
+    struct _xsltStylesheet *style;/* the containing stylesheet */
+    xmlChar *match;	/* the matching string */
+    float priority;	/* as given from the stylesheet, not computed */
+    const xmlChar *name; /* the local part of the name QName */
+    const xmlChar *nameURI; /* the URI part of the name QName */
+    const xmlChar *mode;/* the local part of the mode QName */
+    const xmlChar *modeURI;/* the URI part of the mode QName */
+    xmlNodePtr content;	/* the template replacement value */
+    xmlNodePtr elem;	/* the source element */
+
+    /*
+    * TODO: @inheritedNsNr and @inheritedNs won't be used in the
+    *  refactored code.
+    */
+    int inheritedNsNr;  /* number of inherited namespaces */
+    xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
+
+    /* Profiling informations */
+    int nbCalls;        /* the number of time the template was called */
+    unsigned long time; /* the time spent in this template */
+    void *params;       /* xsl:param instructions */
+};
+
+/**
+ * xsltDecimalFormat:
+ *
+ * Data structure of decimal-format.
+ */
+typedef struct _xsltDecimalFormat xsltDecimalFormat;
+typedef xsltDecimalFormat *xsltDecimalFormatPtr;
+struct _xsltDecimalFormat {
+    struct _xsltDecimalFormat *next; /* chained list */
+    xmlChar *name;
+    /* Used for interpretation of pattern */
+    xmlChar *digit;
+    xmlChar *patternSeparator;
+    /* May appear in result */
+    xmlChar *minusSign;
+    xmlChar *infinity;
+    xmlChar *noNumber; /* Not-a-number */
+    /* Used for interpretation of pattern and may appear in result */
+    xmlChar *decimalPoint;
+    xmlChar *grouping;
+    xmlChar *percent;
+    xmlChar *permille;
+    xmlChar *zeroDigit;
+};
+
+/**
+ * xsltDocument:
+ *
+ * Data structure associated to a parsed document.
+ */
+typedef struct _xsltDocument xsltDocument;
+typedef xsltDocument *xsltDocumentPtr;
+struct _xsltDocument {
+    struct _xsltDocument *next;	/* documents are kept in a chained list */
+    int main;			/* is this the main document */
+    xmlDocPtr doc;		/* the parsed document */
+    void *keys;			/* key tables storage */
+    struct _xsltDocument *includes; /* subsidiary includes */
+    int preproc;		/* pre-processing already done */
+    int nbKeysComputed;
+};
+
+/**
+ * xsltKeyDef:
+ *
+ * Representation of an xsl:key.
+ */
+typedef struct _xsltKeyDef xsltKeyDef;
+typedef xsltKeyDef *xsltKeyDefPtr;
+struct _xsltKeyDef {
+    struct _xsltKeyDef *next;
+    xmlNodePtr inst;
+    xmlChar *name;
+    xmlChar *nameURI;
+    xmlChar *match;
+    xmlChar *use;
+    xmlXPathCompExprPtr comp;
+    xmlXPathCompExprPtr usecomp;
+    xmlNsPtr *nsList;           /* the namespaces in scope */
+    int nsNr;                   /* the number of namespaces in scope */
+};
+
+/**
+ * xsltKeyTable:
+ *
+ * Holds the computed keys for key definitions of the same QName.
+ * Is owned by an xsltDocument.
+ */
+typedef struct _xsltKeyTable xsltKeyTable;
+typedef xsltKeyTable *xsltKeyTablePtr;
+struct _xsltKeyTable {
+    struct _xsltKeyTable *next;
+    xmlChar *name;
+    xmlChar *nameURI;
+    xmlHashTablePtr keys;
+};
+
+/*
+ * The in-memory structure corresponding to an XSLT Stylesheet.
+ * NOTE: most of the content is simply linked from the doc tree
+ *       structure, no specific allocation is made.
+ */
+typedef struct _xsltStylesheet xsltStylesheet;
+typedef xsltStylesheet *xsltStylesheetPtr;
+
+typedef struct _xsltTransformContext xsltTransformContext;
+typedef xsltTransformContext *xsltTransformContextPtr;
+
+/**
+ * xsltElemPreComp:
+ *
+ * The in-memory structure corresponding to element precomputed data,
+ * designed to be extended by extension implementors.
+ */
+typedef struct _xsltElemPreComp xsltElemPreComp;
+typedef xsltElemPreComp *xsltElemPreCompPtr;
+
+/**
+ * xsltTransformFunction:
+ * @ctxt: the XSLT transformation context
+ * @node: the input node
+ * @inst: the stylesheet node
+ * @comp: the compiled information from the stylesheet
+ *
+ * Signature of the function associated to elements part of the
+ * stylesheet language like xsl:if or xsl:apply-templates.
+ */
+typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
+	                               xmlNodePtr node,
+				       xmlNodePtr inst,
+			               xsltElemPreCompPtr comp);
+
+/**
+ * xsltSortFunc:
+ * @ctxt:    a transformation context
+ * @sorts:   the node-set to sort
+ * @nbsorts: the number of sorts
+ *
+ * Signature of the function to use during sorting
+ */
+typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
+			      int nbsorts);
+
+typedef enum {
+    XSLT_FUNC_COPY=1,
+    XSLT_FUNC_SORT,
+    XSLT_FUNC_TEXT,
+    XSLT_FUNC_ELEMENT,
+    XSLT_FUNC_ATTRIBUTE,
+    XSLT_FUNC_COMMENT,
+    XSLT_FUNC_PI,
+    XSLT_FUNC_COPYOF,
+    XSLT_FUNC_VALUEOF,
+    XSLT_FUNC_NUMBER,
+    XSLT_FUNC_APPLYIMPORTS,
+    XSLT_FUNC_CALLTEMPLATE,
+    XSLT_FUNC_APPLYTEMPLATES,
+    XSLT_FUNC_CHOOSE,
+    XSLT_FUNC_IF,
+    XSLT_FUNC_FOREACH,
+    XSLT_FUNC_DOCUMENT,
+    XSLT_FUNC_WITHPARAM,
+    XSLT_FUNC_PARAM,
+    XSLT_FUNC_VARIABLE,
+    XSLT_FUNC_WHEN,
+    XSLT_FUNC_EXTENSION
+#ifdef XSLT_REFACTORED
+    ,
+    XSLT_FUNC_OTHERWISE,
+    XSLT_FUNC_FALLBACK,
+    XSLT_FUNC_MESSAGE,
+    XSLT_FUNC_INCLUDE,
+    XSLT_FUNC_ATTRSET,
+    XSLT_FUNC_LITERAL_RESULT_ELEMENT,
+    XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
+#endif
+} xsltStyleType;
+
+/**
+ * xsltElemPreCompDeallocator:
+ * @comp:  the #xsltElemPreComp to free up
+ *
+ * Deallocates an #xsltElemPreComp structure.
+ */
+typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp);
+
+/**
+ * xsltElemPreComp:
+ *
+ * The basic structure for compiled items of the AST of the XSLT processor.
+ * This structure is also intended to be extended by extension implementors.
+ * TODO: This is somehow not nice, since it has a "free" field, which
+ *   derived stylesheet-structs do not have.
+ */
+struct _xsltElemPreComp {
+    xsltElemPreCompPtr next;		/* next item in the global chained
+					   list hold by xsltStylesheet. */
+    xsltStyleType type;		/* type of the element */
+    xsltTransformFunction func; 	/* handling function */
+    xmlNodePtr inst;			/* the node in the stylesheet's tree
+					   corresponding to this item */
+
+    /* end of common part */
+    xsltElemPreCompDeallocator free;	/* the deallocator */
+};
+
+/**
+ * xsltStylePreComp:
+ *
+ * The abstract basic structure for items of the XSLT processor.
+ * This includes:
+ * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
+ * 2) compiled forms of literal result elements
+ * 3) compiled forms of extension elements
+ */
+typedef struct _xsltStylePreComp xsltStylePreComp;
+typedef xsltStylePreComp *xsltStylePreCompPtr;
+
+#ifdef XSLT_REFACTORED
+
+/*
+* Some pointer-list utility functions.
+*/
+XSLTPUBFUN xsltPointerListPtr XSLTCALL
+		xsltPointerListCreate		(int initialSize);
+XSLTPUBFUN void XSLTCALL
+		xsltPointerListFree		(xsltPointerListPtr list);
+XSLTPUBFUN void XSLTCALL
+		xsltPointerListClear		(xsltPointerListPtr list);
+XSLTPUBFUN int XSLTCALL
+		xsltPointerListAddSize		(xsltPointerListPtr list,						 
+						 void *item,
+						 int initialSize);
+
+/************************************************************************
+ *									*
+ * Refactored structures                                                *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltNsListContainer xsltNsListContainer;
+typedef xsltNsListContainer *xsltNsListContainerPtr;
+struct _xsltNsListContainer {
+    xmlNsPtr *list;
+    int totalNumber;
+    int xpathNumber;    
+};
+
+/**
+ * XSLT_ITEM_COMPATIBILITY_FIELDS:
+ * 
+ * Fields for API compatibility to the structure
+ * _xsltElemPreComp which is used for extension functions.
+ * Note that @next is used for storage; it does not reflect a next
+ * sibling in the tree.
+ * TODO: Evaluate if we really need such a compatibility.
+ */
+#define XSLT_ITEM_COMPATIBILITY_FIELDS \
+    xsltElemPreCompPtr next;\
+    xsltStyleType type;\
+    xsltTransformFunction func;\
+    xmlNodePtr inst;
+
+/**
+ * XSLT_ITEM_NAVIGATION_FIELDS:
+ *
+ * Currently empty.
+ * TODO: It is intended to hold navigational fields in the future.
+ */
+#define XSLT_ITEM_NAVIGATION_FIELDS
+/*
+    xsltStylePreCompPtr parent;\
+    xsltStylePreCompPtr children;\
+    xsltStylePreCompPtr nextItem; 
+*/
+
+/**
+ * XSLT_ITEM_NSINSCOPE_FIELDS:
+ *
+ * The in-scope namespaces.
+ */
+#define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
+
+/**
+ * XSLT_ITEM_COMMON_FIELDS:
+ *
+ * Common fields used for all items.
+ */
+#define XSLT_ITEM_COMMON_FIELDS \
+    XSLT_ITEM_COMPATIBILITY_FIELDS \
+    XSLT_ITEM_NAVIGATION_FIELDS \
+    XSLT_ITEM_NSINSCOPE_FIELDS
+
+/**
+ * _xsltStylePreComp: 
+ *
+ * The abstract basic structure for items of the XSLT processor.
+ * This includes:
+ * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
+ * 2) compiled forms of literal result elements
+ * 3) various properties for XSLT instructions (e.g. xsl:when,
+ *    xsl:with-param)
+ *
+ * REVISIT TODO: Keep this structure equal to the fields
+ *   defined by XSLT_ITEM_COMMON_FIELDS
+ */
+struct _xsltStylePreComp {
+    xsltElemPreCompPtr next;    /* next item in the global chained
+				   list hold by xsltStylesheet */
+    xsltStyleType type;         /* type of the item */ 
+    xsltTransformFunction func; /* handling function */
+    xmlNodePtr inst;		/* the node in the stylesheet's tree
+				   corresponding to this item. */
+    /* Currently no navigational fields. */
+    xsltNsListContainerPtr inScopeNs;
+};
+
+/**
+ * xsltStyleBasicEmptyItem:
+ * 
+ * Abstract structure only used as a short-cut for
+ * XSLT items with no extra fields.
+ * NOTE that it is intended that this structure looks the same as
+ *  _xsltStylePreComp.
+ */
+typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem;
+typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr;
+
+struct _xsltStyleBasicEmptyItem {
+    XSLT_ITEM_COMMON_FIELDS
+};
+
+/**
+ * xsltStyleBasicExpressionItem:
+ * 
+ * Abstract structure only used as a short-cut for
+ * XSLT items with just an expression.
+ */
+typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem;
+typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr;
+
+struct _xsltStyleBasicExpressionItem {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *select; /* TODO: Change this to "expression". */
+    xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */
+};
+
+/************************************************************************
+ *									*
+ * XSLT-instructions/declarations                                       *
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltStyleItemElement:
+ * 
+ * 
+ * 
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemElement xsltStyleItemElement;
+typedef xsltStyleItemElement *xsltStyleItemElementPtr;
+
+struct _xsltStyleItemElement {
+    XSLT_ITEM_COMMON_FIELDS 
+
+    const xmlChar *use;
+    int      has_use;
+    const xmlChar *name;    
+    int      has_name;
+    const xmlChar *ns;
+    const xmlChar *nsPrefix;
+    int      has_ns;
+};
+
+/**
+ * xsltStyleItemAttribute:
+ *
+ * 
+ * 
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute;
+typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr;
+
+struct _xsltStyleItemAttribute {
+    XSLT_ITEM_COMMON_FIELDS
+    const xmlChar *name;
+    int      has_name;
+    const xmlChar *ns;
+    const xmlChar *nsPrefix;
+    int      has_ns;
+};
+
+/**
+ * xsltStyleItemText:
+ *
+ * 
+ * 
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemText xsltStyleItemText;
+typedef xsltStyleItemText *xsltStyleItemTextPtr;
+
+struct _xsltStyleItemText {
+    XSLT_ITEM_COMMON_FIELDS
+    int      noescape;		/* text */
+};
+
+/**
+ * xsltStyleItemComment:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef xsltStyleBasicEmptyItem xsltStyleItemComment;
+typedef xsltStyleItemComment *xsltStyleItemCommentPtr;
+
+/**
+ * xsltStyleItemPI:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemPI xsltStyleItemPI;
+typedef xsltStyleItemPI *xsltStyleItemPIPtr;
+
+struct _xsltStyleItemPI {
+    XSLT_ITEM_COMMON_FIELDS
+    const xmlChar *name;
+    int      has_name;
+};
+
+/**
+ * xsltStyleItemApplyImports:
+ *
+ * 
+ * 
+ */
+typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports;
+typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr;
+
+/**
+ * xsltStyleItemApplyTemplates:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates;
+typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr;
+
+struct _xsltStyleItemApplyTemplates {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *mode;	/* apply-templates */
+    const xmlChar *modeURI;	/* apply-templates */
+    const xmlChar *select;	/* sort, copy-of, value-of, apply-templates */
+    xmlXPathCompExprPtr comp;	/* a precompiled XPath expression */
+    /* TODO: with-params */
+};
+
+/**
+ * xsltStyleItemCallTemplate:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate;
+typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr;
+
+struct _xsltStyleItemCallTemplate {
+    XSLT_ITEM_COMMON_FIELDS
+
+    xsltTemplatePtr templ;	/* call-template */
+    const xmlChar *name;	/* element, attribute, pi */
+    int      has_name;		/* element, attribute, pi */
+    const xmlChar *ns;		/* element */
+    int      has_ns;		/* element */
+    /* TODO: with-params */
+};
+
+/**
+ * xsltStyleItemCopy:
+ *
+ * 
+ * 
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemCopy xsltStyleItemCopy;
+typedef xsltStyleItemCopy *xsltStyleItemCopyPtr;
+
+struct _xsltStyleItemCopy {
+   XSLT_ITEM_COMMON_FIELDS
+    const xmlChar *use;		/* copy, element */
+    int      has_use;		/* copy, element */    
+};
+
+/**
+ * xsltStyleItemIf:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef struct _xsltStyleItemIf xsltStyleItemIf;
+typedef xsltStyleItemIf *xsltStyleItemIfPtr;
+
+struct _xsltStyleItemIf {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *test;	/* if */
+    xmlXPathCompExprPtr comp;	/* a precompiled XPath expression */
+};
+
+
+/**
+ * xsltStyleItemCopyOf:
+ *
+ * 
+ * 
+ */
+typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf;
+typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr;
+
+/**
+ * xsltStyleItemValueOf:
+ *
+ * 
+ * 
+ */
+typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf;
+typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr;
+
+struct _xsltStyleItemValueOf {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *select;
+    xmlXPathCompExprPtr comp;	/* a precompiled XPath expression */
+    int      noescape;
+};
+
+/**
+ * xsltStyleItemNumber:
+ *
+ * 
+ *  
+ */
+typedef struct _xsltStyleItemNumber xsltStyleItemNumber;
+typedef xsltStyleItemNumber *xsltStyleItemNumberPtr;
+
+struct _xsltStyleItemNumber {
+    XSLT_ITEM_COMMON_FIELDS
+    xsltNumberData numdata;	/* number */
+};
+
+/**
+ * xsltStyleItemChoose:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef xsltStyleBasicEmptyItem xsltStyleItemChoose;
+typedef xsltStyleItemChoose *xsltStyleItemChoosePtr;
+
+/**
+ * xsltStyleItemFallback:
+ *
+ * 
+ *  
+ *  
+ * 
+ */
+typedef xsltStyleBasicEmptyItem xsltStyleItemFallback;
+typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr;
+
+/**
+ * xsltStyleItemForEach:
+ *
+ * 
+ * 
+ *   
+ * 
+ */
+typedef xsltStyleBasicExpressionItem xsltStyleItemForEach;
+typedef xsltStyleItemForEach *xsltStyleItemForEachPtr;
+
+/**
+ * xsltStyleItemMessage:
+ *
+ * 
+ * 
+ *   
+ * 
+ */
+typedef struct _xsltStyleItemMessage xsltStyleItemMessage;
+typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
+
+struct _xsltStyleItemMessage {
+    XSLT_ITEM_COMMON_FIELDS    
+    int terminate;
+};
+
+/**
+ * xsltStyleItemDocument:
+ *
+ * NOTE: This is not an instruction of XSLT 1.0.
+ */
+typedef struct _xsltStyleItemDocument xsltStyleItemDocument;
+typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr;
+
+struct _xsltStyleItemDocument {
+    XSLT_ITEM_COMMON_FIELDS
+    int      ver11;		/* assigned: in xsltDocumentComp;
+                                  read: nowhere;
+                                  TODO: Check if we need. */
+    const xmlChar *filename;	/* document URL */
+    int has_filename;
+};   
+
+/************************************************************************
+ *									*
+ * Non-instructions (actually properties of instructions/declarations)  *
+ *									*
+ ************************************************************************/
+
+/**
+ * xsltStyleBasicItemVariable:
+ *
+ * Basic struct for xsl:variable, xsl:param and xsl:with-param.
+ * It's currently important to have equal fields, since
+ * xsltParseStylesheetCallerParam() is used with xsl:with-param from
+ * the xslt side and with xsl:param from the exslt side (in
+ * exsltFuncFunctionFunction()).
+ *
+ * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
+ *   have additional different fields.
+ */
+typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable;
+typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr;
+
+struct _xsltStyleBasicItemVariable {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *select;
+    xmlXPathCompExprPtr comp;
+
+    const xmlChar *name;
+    int      has_name;
+    const xmlChar *ns;
+    int      has_ns;
+};
+
+/**
+ * xsltStyleItemVariable:
+ *
+ * 
+ * 
+ *   
+ * 
+ */
+typedef xsltStyleBasicItemVariable xsltStyleItemVariable;
+typedef xsltStyleItemVariable *xsltStyleItemVariablePtr;
+
+/**
+ * xsltStyleItemParam:
+ *
+ * 
+ * 
+ *   
+ * 
+ */
+typedef struct _xsltStyleItemParam xsltStyleItemParam;
+typedef xsltStyleItemParam *xsltStyleItemParamPtr;
+
+struct _xsltStyleItemParam {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *select;
+    xmlXPathCompExprPtr comp;
+
+    const xmlChar *name;
+    int      has_name;
+    const xmlChar *ns;
+    int      has_ns;    
+};
+
+/**
+ * xsltStyleItemWithParam:
+ *
+ * 
+ *  
+ * 
+ */
+typedef xsltStyleBasicItemVariable xsltStyleItemWithParam;
+typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr;
+
+/**
+ * xsltStyleItemSort:
+ *
+ * Reflects the XSLT xsl:sort item.
+ * Allowed parents: xsl:apply-templates, xsl:for-each
+ * 
+ */
+typedef struct _xsltStyleItemSort xsltStyleItemSort;
+typedef xsltStyleItemSort *xsltStyleItemSortPtr;
+
+struct _xsltStyleItemSort {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *stype;       /* sort */
+    int      has_stype;		/* sort */
+    int      number;		/* sort */
+    const xmlChar *order;	/* sort */
+    int      has_order;		/* sort */
+    int      descending;	/* sort */
+    const xmlChar *lang;	/* sort */
+    int      has_lang;		/* sort */
+    const xmlChar *case_order;	/* sort */
+    int      lower_first;	/* sort */
+
+    const xmlChar *use;
+    int      has_use;
+
+    const xmlChar *select;	/* sort, copy-of, value-of, apply-templates */
+
+    xmlXPathCompExprPtr comp;	/* a precompiled XPath expression */
+};
+
+
+/**
+ * xsltStyleItemWhen:
+ * 
+ * 
+ *   
+ * 
+ * Allowed parent: xsl:choose
+ */
+typedef struct _xsltStyleItemWhen xsltStyleItemWhen;
+typedef xsltStyleItemWhen *xsltStyleItemWhenPtr;
+
+struct _xsltStyleItemWhen {
+    XSLT_ITEM_COMMON_FIELDS
+
+    const xmlChar *test;
+    xmlXPathCompExprPtr comp;
+};
+
+/**
+ * xsltStyleItemOtherwise:
+ *
+ * Allowed parent: xsl:choose
+ * 
+ *   
+ * 
+ */
+typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise;
+typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr;
+
+struct _xsltStyleItemOtherwise {
+    XSLT_ITEM_COMMON_FIELDS
+};
+
+typedef struct _xsltStyleItemInclude xsltStyleItemInclude;
+typedef xsltStyleItemInclude *xsltStyleItemIncludePtr;
+
+struct _xsltStyleItemInclude {
+    XSLT_ITEM_COMMON_FIELDS
+    xsltDocumentPtr include;
+};
+
+/************************************************************************
+ *									*
+ *  XSLT elements in forwards-compatible mode                           *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltStyleItemUknown xsltStyleItemUknown;
+typedef xsltStyleItemUknown *xsltStyleItemUknownPtr;
+struct _xsltStyleItemUknown {
+    XSLT_ITEM_COMMON_FIELDS
+};
+
+
+/************************************************************************
+ *									*
+ *  Extension elements                                                  *
+ *									*
+ ************************************************************************/
+
+/*
+ * xsltStyleItemExtElement:
+ *
+ * Reflects extension elements.
+ *
+ * NOTE: Due to the fact that the structure xsltElemPreComp is most
+ * probably already heavily in use out there by users, so we cannot
+ * easily change it, we'll create an intermediate structure which will
+ * hold an xsltElemPreCompPtr.
+ * BIG NOTE: The only problem I see here is that the user processes the
+ *  content of the stylesheet tree, possibly he'll lookup the node->psvi
+ *  fields in order to find subsequent extension functions.
+ *  In this case, the user's code will break, since the node->psvi
+ *  field will hold now the xsltStyleItemExtElementPtr and not
+ *  the xsltElemPreCompPtr.
+ *  However the place where the structure is anchored in the node-tree,
+ *  namely node->psvi, has beed already once been moved from node->_private
+ *  to node->psvi, so we have a precedent here, which, I think, should allow
+ *  us to change such semantics without headaches.
+ */
+typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
+typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
+struct _xsltStyleItemExtElement {
+    XSLT_ITEM_COMMON_FIELDS
+    xsltElemPreCompPtr item;   
+};
+
+/************************************************************************
+ *									*
+ *  Literal result elements                                             *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltEffectiveNs xsltEffectiveNs;
+typedef xsltEffectiveNs *xsltEffectiveNsPtr;
+struct _xsltEffectiveNs {
+    xsltEffectiveNsPtr nextInStore; /* storage next */
+    xsltEffectiveNsPtr next; /* next item in the list */
+    const xmlChar *prefix;
+    const xmlChar *nsName;
+    /* 
+    * Indicates if eclared on the literal result element; dunno if really
+    * needed.
+    */
+    int holdByElem;
+};
+
+/*
+ * Info for literal result elements.
+ * This will be set on the elem->psvi field and will be
+ * shared by literal result elements, which have the same
+ * excluded result namespaces; i.e., this *won't* be created uniquely
+ * for every literal result element.
+ */
+typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo;
+typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr;
+struct _xsltStyleItemLRElementInfo {
+    XSLT_ITEM_COMMON_FIELDS
+    /*
+    * @effectiveNs is the set of effective ns-nodes
+    *  on the literal result element, which will be added to the result
+    *  element if not already existing in the result tree.
+    *  This means that excluded namespaces (via exclude-result-prefixes,
+    *  extension-element-prefixes and the XSLT namespace) not added
+    *  to the set.
+    *  Namespace-aliasing was applied on the @effectiveNs.
+    */
+    xsltEffectiveNsPtr effectiveNs;
+
+};
+
+#ifdef XSLT_REFACTORED
+
+typedef struct _xsltNsAlias xsltNsAlias;
+typedef xsltNsAlias *xsltNsAliasPtr;
+struct _xsltNsAlias {
+    xsltNsAliasPtr next; /* next in the list */    
+    xmlNsPtr literalNs;
+    xmlNsPtr targetNs;
+    xmlDocPtr docOfTargetNs;
+};
+#endif
+
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+
+typedef struct _xsltNsMap xsltNsMap;
+typedef xsltNsMap *xsltNsMapPtr;
+struct _xsltNsMap {
+    xsltNsMapPtr next; /* next in the list */
+    xmlDocPtr doc;
+    xmlNodePtr elem; /* the element holding the ns-decl */
+    xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
+    const xmlChar *origNsName; /* the original XML namespace name */
+    const xmlChar *newNsName; /* the mapped XML namespace name */    
+};
+#endif
+
+/************************************************************************
+ *									*
+ *  Compile-time structures for *internal* use only                     *
+ *									*
+ ************************************************************************/
+
+typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData;
+typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr;
+
+typedef struct _xsltNsList xsltNsList;
+typedef xsltNsList *xsltNsListPtr;
+struct _xsltNsList {
+    xsltNsListPtr next; /* next in the list */
+    xmlNsPtr ns;
+};
+
+/*
+* xsltVarInfo:
+*
+* Used at compilation time for parameters and variables.
+*/
+typedef struct _xsltVarInfo xsltVarInfo;
+typedef xsltVarInfo *xsltVarInfoPtr;
+struct _xsltVarInfo {
+    xsltVarInfoPtr next; /* next in the list */
+    xsltVarInfoPtr prev;
+    int depth; /* the depth in the tree */
+    const xmlChar *name;
+    const xmlChar *nsName;
+};
+
+#define XSLT_ELEMENT_CATEGORY_XSLT 0
+#define XSLT_ELEMENT_CATEGORY_EXTENSION 1
+#define XSLT_ELEMENT_CATEGORY_LRE 2
+
+/**
+ * xsltCompilerNodeInfo:
+ *
+ * Per-node information during compile-time.
+ */
+typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo;
+typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr;
+struct _xsltCompilerNodeInfo {
+    xsltCompilerNodeInfoPtr next;
+    xsltCompilerNodeInfoPtr prev;
+    xmlNodePtr node;
+    int depth;
+    xsltTemplatePtr templ;   /* The owning template */
+    int category;	     /* XSLT element, LR-element or
+                                extension element */
+    xsltStyleType type;
+    xsltElemPreCompPtr item; /* The compiled information */
+    /* The current in-scope namespaces */
+    xsltNsListContainerPtr inScopeNs;
+    /* The current excluded result namespaces */
+    xsltPointerListPtr exclResultNs; 
+    /* The current extension instruction namespaces */
+    xsltPointerListPtr extElemNs;
+
+    /* The current info for literal result elements. */
+    xsltStyleItemLRElementInfoPtr litResElemInfo;
+    /* 
+    * Set to 1 if in-scope namespaces changed,
+    *  or excluded result namespaces changed,
+    *  or extension element namespaces changed.
+    * This will trigger creation of new infos
+    *  for literal result elements.
+    */
+    int nsChanged;
+    int preserveWhitespace;
+    int stripWhitespace;
+    int isRoot; /* whether this is the stylesheet's root node */
+    int forwardsCompat; /* whether forwards-compatible mode is enabled */
+    /* whether the content of an extension element was processed */
+    int extContentHandled;
+    /* the type of the current child */
+    xsltStyleType curChildType;    
+};
+
+/**
+ * XSLT_CCTXT:
+ *
+ * get pointer to compiler context
+ */
+#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) 
+
+typedef enum {
+    XSLT_ERROR_SEVERITY_ERROR = 0,
+    XSLT_ERROR_SEVERITY_WARNING
+} xsltErrorSeverityType;
+
+typedef struct _xsltCompilerCtxt xsltCompilerCtxt;
+typedef xsltCompilerCtxt *xsltCompilerCtxtPtr;
+struct _xsltCompilerCtxt {
+    void *errorCtxt;            /* user specific error context */
+    /*
+    * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
+    xsltErrorSeverityType errSeverity;		
+    int warnings;		/* TODO: number of warnings found at
+                                   compilation */
+    int errors;			/* TODO: number of errors found at
+                                   compilation */
+    xmlDictPtr dict;
+    xsltStylesheetPtr style;
+    int simplified; /* whether this is a simplified stylesheet */
+    /* TODO: structured/unstructured error contexts. */
+    int depth; /* Current depth of processing */
+    
+    xsltCompilerNodeInfoPtr inode;
+    xsltCompilerNodeInfoPtr inodeList;
+    xsltCompilerNodeInfoPtr inodeLast;
+    xsltPointerListPtr tmpList; /* Used for various purposes */
+    /*
+    * The XSLT version as specified by the stylesheet's root element.
+    */
+    int isInclude;
+    int hasForwardsCompat; /* whether forwards-compatible mode was used
+			     in a parsing episode */
+    int maxNodeInfos; /* TEMP TODO: just for the interest */
+    int maxLREs;  /* TEMP TODO: just for the interest */
+    /* 
+    * In order to keep the old behaviour, applying strict rules of
+    * the spec can be turned off. This has effect only on special
+    * mechanisms like whitespace-stripping in the stylesheet.
+    */
+    int strict;
+    xsltPrincipalStylesheetDataPtr psData;
+#ifdef XSLT_REFACTORED_XPATHCOMP
+    xmlXPathContextPtr xpathCtxt;
+#endif
+    xsltStyleItemUknownPtr unknownItem;
+    int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */
+    xsltNsAliasPtr nsAliases;
+    xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
+    xsltVarInfoPtr ivar; /* topmost local variable/param. */
+};   
+
+#else /* XSLT_REFACTORED */
+/*
+* The old structures before refactoring.
+*/
+
+/**
+ * _xsltStylePreComp:
+ *
+ * The in-memory structure corresponding to XSLT stylesheet constructs
+ * precomputed data.
+ */
+struct _xsltStylePreComp {
+    xsltElemPreCompPtr next;	/* chained list */
+    xsltStyleType type;		/* type of the element */
+    xsltTransformFunction func; /* handling function */
+    xmlNodePtr inst;		/* the instruction */
+
+    /*
+     * Pre computed values.
+     */
+
+    const xmlChar *stype;       /* sort */
+    int      has_stype;		/* sort */
+    int      number;		/* sort */
+    const xmlChar *order;	/* sort */
+    int      has_order;		/* sort */
+    int      descending;	/* sort */
+    const xmlChar *lang;	/* sort */
+    int      has_lang;		/* sort */
+    const xmlChar *case_order;	/* sort */
+    int      lower_first;	/* sort */
+
+    const xmlChar *use;		/* copy, element */
+    int      has_use;		/* copy, element */
+
+    int      noescape;		/* text */
+
+    const xmlChar *name;	/* element, attribute, pi */
+    int      has_name;		/* element, attribute, pi */
+    const xmlChar *ns;		/* element */
+    int      has_ns;		/* element */
+
+    const xmlChar *mode;	/* apply-templates */
+    const xmlChar *modeURI;	/* apply-templates */
+
+    const xmlChar *test;	/* if */
+
+    xsltTemplatePtr templ;	/* call-template */
+
+    const xmlChar *select;	/* sort, copy-of, value-of, apply-templates */
+
+    int      ver11;		/* document */
+    const xmlChar *filename;	/* document URL */
+    int      has_filename;	/* document */
+
+    xsltNumberData numdata;	/* number */
+
+    xmlXPathCompExprPtr comp;	/* a precompiled XPath expression */
+    xmlNsPtr *nsList;		/* the namespaces in scope */
+    int nsNr;			/* the number of namespaces in scope */
+};
+
+#endif /* XSLT_REFACTORED */
+
+
+#define XSLT_VAR_GLOBAL 1<<0
+#define XSLT_VAR_IN_SELECT 1<<1
+#define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable)
+/*
+ * The in-memory structure corresponding to an XSLT Variable
+ * or Param.
+ */
+typedef struct _xsltStackElem xsltStackElem;
+typedef xsltStackElem *xsltStackElemPtr;
+struct _xsltStackElem {
+    struct _xsltStackElem *next;/* chained list */
+    xsltStylePreCompPtr comp;   /* the compiled form */
+    int computed;		/* was the evaluation done */
+    const xmlChar *name;	/* the local part of the name QName */
+    const xmlChar *nameURI;	/* the URI part of the name QName */
+    const xmlChar *select;	/* the eval string */
+    xmlNodePtr tree;		/* the sequence constructor if no eval
+				    string or the location */
+    xmlXPathObjectPtr value;	/* The value if computed */
+    xmlDocPtr fragment;		/* The Result Tree Fragments (needed for XSLT 1.0)
+				   which are bound to the variable's lifetime. */
+    int level;                  /* the depth in the tree;
+                                   -1 if persistent (e.g. a given xsl:with-param) */
+    xsltTransformContextPtr context; /* The transformation context; needed to cache
+                                        the variables */
+    int flags;
+};
+
+#ifdef XSLT_REFACTORED
+
+struct _xsltPrincipalStylesheetData {
+    /*
+    * Namespace dictionary for ns-prefixes and ns-names:
+    * TODO: Shared between stylesheets, and XPath mechanisms.
+    *   Not used yet.
+    */
+    xmlDictPtr namespaceDict;
+    /*
+    * Global list of in-scope namespaces.
+    */
+    xsltPointerListPtr inScopeNamespaces;
+    /*
+    * Global list of information for [xsl:]excluded-result-prefixes.
+    */
+    xsltPointerListPtr exclResultNamespaces;
+    /*
+    * Global list of information for [xsl:]extension-element-prefixes.
+    */
+    xsltPointerListPtr extElemNamespaces;
+    xsltEffectiveNsPtr effectiveNs;
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+    /*
+    * Namespace name map to get rid of string comparison of namespace names.
+    */
+    xsltNsMapPtr nsMap;
+#endif
+};
+
+    
+#endif
+/*
+ * Note that we added a @compCtxt field to anchor an stylesheet compilation
+ * context, since, due to historical reasons, various compile-time function
+ * take only the stylesheet as argument and not a compilation context.
+ */
+struct _xsltStylesheet {
+    /*
+     * The stylesheet import relation is kept as a tree.
+     */
+    struct _xsltStylesheet *parent;
+    struct _xsltStylesheet *next;
+    struct _xsltStylesheet *imports;
+
+    xsltDocumentPtr docList;		/* the include document list */
+
+    /*
+     * General data on the style sheet document.
+     */
+    xmlDocPtr doc;		/* the parsed XML stylesheet */
+    xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and
+				   preserve space elements */
+    int             stripAll;	/* strip-space * (1) preserve-space * (-1) */
+    xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */
+
+    /*
+     * Global variable or parameters.
+     */
+    xsltStackElemPtr variables; /* linked list of param and variables */
+
+    /*
+     * Template descriptions.
+     */
+    xsltTemplatePtr templates;	/* the ordered list of templates */
+    void *templatesHash;	/* hash table or wherever compiled templates
+				   informations are stored */
+    void *rootMatch;		/* template based on / */
+    void *keyMatch;		/* template based on key() */
+    void *elemMatch;		/* template based on * */
+    void *attrMatch;		/* template based on @* */
+    void *parentMatch;		/* template based on .. */
+    void *textMatch;		/* template based on text() */
+    void *piMatch;		/* template based on processing-instruction() */
+    void *commentMatch;		/* template based on comment() */
+    
+    /*
+     * Namespace aliases.
+     * NOTE: Not used in the refactored code.
+     */
+    xmlHashTablePtr nsAliases;	/* the namespace alias hash tables */
+
+    /*
+     * Attribute sets.
+     */
+    xmlHashTablePtr attributeSets;/* the attribute sets hash tables */
+
+    /*
+     * Namespaces.
+     * TODO: Eliminate this.
+     */
+    xmlHashTablePtr nsHash;     /* the set of namespaces in use:
+                                   ATTENTION: This is used for
+                                   execution of XPath expressions; unfortunately
+                                   it restricts the stylesheet to have distinct
+                                   prefixes.
+				   TODO: We need to get rid of this.    
+				 */
+    void           *nsDefs;     /* ATTENTION TODO: This is currently used to store
+				   xsltExtDefPtr (in extensions.c) and
+                                   *not* xmlNsPtr.
+				 */
+
+    /*
+     * Key definitions.
+     */
+    void *keys;			/* key definitions */
+
+    /*
+     * Output related stuff.
+     */
+    xmlChar *method;		/* the output method */
+    xmlChar *methodURI;		/* associated namespace if any */
+    xmlChar *version;		/* version string */
+    xmlChar *encoding;		/* encoding string */
+    int omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
+
+    /* 
+     * Number formatting.
+     */
+    xsltDecimalFormatPtr decimalFormat;
+    int standalone;             /* standalone = "yes" | "no" */
+    xmlChar *doctypePublic;     /* doctype-public string */
+    xmlChar *doctypeSystem;     /* doctype-system string */
+    int indent;			/* should output being indented */
+    xmlChar *mediaType;		/* media-type string */
+
+    /*
+     * Precomputed blocks.
+     */
+    xsltElemPreCompPtr preComps;/* list of precomputed blocks */
+    int warnings;		/* number of warnings found at compilation */
+    int errors;			/* number of errors found at compilation */
+
+    xmlChar  *exclPrefix;	/* last excluded prefixes */
+    xmlChar **exclPrefixTab;	/* array of excluded prefixes */
+    int       exclPrefixNr;	/* number of excluded prefixes in scope */
+    int       exclPrefixMax;	/* size of the array */
+
+    void     *_private;		/* user defined data */
+
+    /*
+     * Extensions.
+     */
+    xmlHashTablePtr extInfos;	/* the extension data */
+    int		    extrasNr;	/* the number of extras required */
+
+    /*
+     * For keeping track of nested includes
+     */
+    xsltDocumentPtr includes;	/* points to last nested include */
+
+    /*
+     * dictionary: shared between stylesheet, context and documents.
+     */
+    xmlDictPtr dict;
+    /*
+     * precompiled attribute value templates.
+     */
+    void *attVTs;
+    /*
+     * if namespace-alias has an alias for the default stylesheet prefix
+     * NOTE: Not used in the refactored code.
+     */
+    const xmlChar *defaultAlias;
+    /*
+     * bypass pre-processing (already done) (used in imports)
+     */
+    int nopreproc;
+    /*
+     * all document text strings were internalized
+     */
+    int internalized;
+    /*
+     * Literal Result Element as Stylesheet c.f. section 2.3
+     */
+    int literal_result;
+    /*
+    * The principal stylesheet
+    */
+    xsltStylesheetPtr principal;
+#ifdef XSLT_REFACTORED
+    /*
+    * Compilation context used during compile-time.
+    */
+    xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
+
+    xsltPrincipalStylesheetDataPtr principalData;    
+#endif
+};
+
+typedef struct _xsltTransformCache xsltTransformCache;
+typedef xsltTransformCache *xsltTransformCachePtr;
+struct _xsltTransformCache {
+    xmlDocPtr RVT;
+    int nbRVT;
+    xsltStackElemPtr stackItems;
+    int nbStackItems;
+#ifdef XSLT_DEBUG_PROFILE_CACHE
+    int dbgCachedRVTs;
+    int dbgReusedRVTs;
+    int dbgCachedVars;
+    int dbgReusedVars;
+#endif
+};
+
+/*
+ * The in-memory structure corresponding to an XSLT Transformation.
+ */
+typedef enum {
+    XSLT_OUTPUT_XML = 0,
+    XSLT_OUTPUT_HTML,
+    XSLT_OUTPUT_TEXT
+} xsltOutputType;
+
+typedef enum {
+    XSLT_STATE_OK = 0,
+    XSLT_STATE_ERROR,
+    XSLT_STATE_STOPPED
+} xsltTransformState;
+
+struct _xsltTransformContext {
+    xsltStylesheetPtr style;		/* the stylesheet used */
+    xsltOutputType type;		/* the type of output */
+
+    xsltTemplatePtr  templ;		/* the current template */
+    int              templNr;		/* Nb of templates in the stack */
+    int              templMax;		/* Size of the templtes stack */
+    xsltTemplatePtr *templTab;		/* the template stack */
+
+    xsltStackElemPtr  vars;		/* the current variable list */
+    int               varsNr;		/* Nb of variable list in the stack */
+    int               varsMax;		/* Size of the variable list stack */
+    xsltStackElemPtr *varsTab;		/* the variable list stack */
+    int               varsBase;		/* the var base for current templ */
+
+    /*
+     * Extensions
+     */
+    xmlHashTablePtr   extFunctions;	/* the extension functions */
+    xmlHashTablePtr   extElements;	/* the extension elements */
+    xmlHashTablePtr   extInfos;		/* the extension data */
+
+    const xmlChar *mode;		/* the current mode */
+    const xmlChar *modeURI;		/* the current mode URI */
+
+    xsltDocumentPtr docList;		/* the document list */
+
+    xsltDocumentPtr document;		/* the current source document; can be NULL if an RTF */
+    xmlNodePtr node;			/* the current node being processed */
+    xmlNodeSetPtr nodeList;		/* the current node list */
+    /* xmlNodePtr current;			the node */
+
+    xmlDocPtr output;			/* the resulting document */
+    xmlNodePtr insert;			/* the insertion node */
+
+    xmlXPathContextPtr xpathCtxt;	/* the XPath context */
+    xsltTransformState state;		/* the current state */
+
+    /*
+     * Global variables
+     */
+    xmlHashTablePtr   globalVars;	/* the global variables and params */
+
+    xmlNodePtr inst;			/* the instruction in the stylesheet */
+
+    int xinclude;			/* should XInclude be processed */
+
+    const char *      outputFile;	/* the output URI if known */
+
+    int profile;                        /* is this run profiled */
+    long             prof;		/* the current profiled value */
+    int              profNr;		/* Nb of templates in the stack */
+    int              profMax;		/* Size of the templtaes stack */
+    long            *profTab;		/* the profile template stack */
+
+    void            *_private;		/* user defined data */
+
+    int              extrasNr;		/* the number of extras used */
+    int              extrasMax;		/* the number of extras allocated */
+    xsltRuntimeExtraPtr extras;		/* extra per runtime informations */
+
+    xsltDocumentPtr  styleList;		/* the stylesheet docs list */
+    void                 * sec;		/* the security preferences if any */
+
+    xmlGenericErrorFunc  error;		/* a specific error handler */
+    void              * errctx;		/* context for the error handler */
+
+    xsltSortFunc      sortfunc;		/* a ctxt specific sort routine */
+
+    /*
+     * handling of temporary Result Value Tree
+     * (XSLT 1.0 term: "Result Tree Fragment")
+     */
+    xmlDocPtr       tmpRVT;		/* list of RVT without persistance */
+    xmlDocPtr       persistRVT;		/* list of persistant RVTs */
+    int             ctxtflags;          /* context processing flags */
+
+    /*
+     * Speed optimization when coalescing text nodes
+     */
+    const xmlChar  *lasttext;		/* last text node content */
+    unsigned int    lasttsize;		/* last text node size */
+    unsigned int    lasttuse;		/* last text node use */
+    /*
+     * Per Context Debugging
+     */
+    int debugStatus;			/* the context level debug status */
+    unsigned long* traceCode;		/* pointer to the variable holding the mask */
+
+    int parserOptions;			/* parser options xmlParserOption */
+
+    /*
+     * dictionary: shared between stylesheet, context and documents.
+     */
+    xmlDictPtr dict;
+    xmlDocPtr		tmpDoc; /* Obsolete; not used in the library. */
+    /*
+     * all document text strings are internalized
+     */
+    int internalized;
+    int nbKeys;
+    int hasTemplKeyPatterns;
+    xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */
+    xmlNodePtr initialContextNode;
+    xmlDocPtr initialContextDoc;
+    xsltTransformCachePtr cache;
+    void *contextVariable; /* the current variable item */
+    xmlDocPtr localRVT; /* list of local tree fragments; will be freed when
+			   the instruction which created the fragment
+                           exits */
+    xmlDocPtr localRVTBase;
+    int keyInitLevel;   /* Needed to catch recursive keys issues */
+};
+
+/**
+ * CHECK_STOPPED:
+ *
+ * Macro to check if the XSLT processing should be stopped.
+ * Will return from the function.
+ */
+#define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
+
+/**
+ * CHECK_STOPPEDE:
+ *
+ * Macro to check if the XSLT processing should be stopped.
+ * Will goto the error: label.
+ */
+#define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
+
+/**
+ * CHECK_STOPPED0:
+ *
+ * Macro to check if the XSLT processing should be stopped.
+ * Will return from the function with a 0 value.
+ */
+#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
+
+/*
+ * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
+ * possible incompatibilities between function pointers and object
+ * pointers.  It is defined in libxml/hash.h within recent versions
+ * of libxml2, but is put here for compatibility.
+ */
+#ifndef XML_CAST_FPTR
+/**
+ * XML_CAST_FPTR:
+ * @fptr:  pointer to a function
+ *
+ * Macro to do a casting from an object pointer to a
+ * function pointer without encountering a warning from
+ * gcc
+ *
+ * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
+ * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
+ * so it is disabled now
+ */
+
+#define XML_CAST_FPTR(fptr) fptr
+#endif
+/*
+ * Functions associated to the internal types
+xsltDecimalFormatPtr	xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
+						   xmlChar *name);
+ */
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltNewStylesheet	(void);
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltParseStylesheetFile	(const xmlChar* filename);
+XSLTPUBFUN void XSLTCALL			
+			xsltFreeStylesheet	(xsltStylesheetPtr style);
+XSLTPUBFUN int XSLTCALL			
+			xsltIsBlank		(xmlChar *str);
+XSLTPUBFUN void XSLTCALL			
+			xsltFreeStackElemList	(xsltStackElemPtr elem);
+XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL	
+			xsltDecimalFormatGetByName(xsltStylesheetPtr style,
+						 xmlChar *name);
+
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltParseStylesheetProcess(xsltStylesheetPtr ret,
+						 xmlDocPtr doc);
+XSLTPUBFUN void XSLTCALL			
+			xsltParseStylesheetOutput(xsltStylesheetPtr style,
+						 xmlNodePtr cur);
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltParseStylesheetDoc	(xmlDocPtr doc);
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltParseStylesheetImportedDoc(xmlDocPtr doc,
+						xsltStylesheetPtr style);
+XSLTPUBFUN xsltStylesheetPtr XSLTCALL	
+			xsltLoadStylesheetPI	(xmlDocPtr doc);
+XSLTPUBFUN void XSLTCALL 			
+			xsltNumberFormat	(xsltTransformContextPtr ctxt,
+						 xsltNumberDataPtr data,
+						 xmlNodePtr node);
+XSLTPUBFUN xmlXPathError XSLTCALL		 
+			xsltFormatNumberConversion(xsltDecimalFormatPtr self,
+						 xmlChar *format,
+						 double number,
+						 xmlChar **result);
+
+XSLTPUBFUN void XSLTCALL			
+			xsltParseTemplateContent(xsltStylesheetPtr style,
+						 xmlNodePtr templ);
+XSLTPUBFUN int XSLTCALL			
+			xsltAllocateExtra	(xsltStylesheetPtr style);
+XSLTPUBFUN int XSLTCALL			
+			xsltAllocateExtraCtxt	(xsltTransformContextPtr ctxt);
+/*
+ * Extra functions for Result Value Trees
+ */
+XSLTPUBFUN xmlDocPtr XSLTCALL		
+			xsltCreateRVT		(xsltTransformContextPtr ctxt);
+XSLTPUBFUN int XSLTCALL			
+			xsltRegisterTmpRVT	(xsltTransformContextPtr ctxt,
+						 xmlDocPtr RVT);
+XSLTPUBFUN int XSLTCALL			
+			xsltRegisterLocalRVT	(xsltTransformContextPtr ctxt,
+						 xmlDocPtr RVT);
+XSLTPUBFUN int XSLTCALL			
+			xsltRegisterPersistRVT	(xsltTransformContextPtr ctxt,
+						 xmlDocPtr RVT);
+XSLTPUBFUN int XSLTCALL
+			xsltExtensionInstructionResultRegister(
+						 xsltTransformContextPtr ctxt,
+						 xmlXPathObjectPtr obj);
+XSLTPUBFUN int XSLTCALL
+			xsltExtensionInstructionResultFinalize(
+						 xsltTransformContextPtr ctxt);
+XSLTPUBFUN void XSLTCALL
+			xsltFreeRVTs		(xsltTransformContextPtr ctxt);
+XSLTPUBFUN void XSLTCALL
+			xsltReleaseRVT		(xsltTransformContextPtr ctxt,
+						 xmlDocPtr RVT);
+XSLTPUBFUN int XSLTCALL
+			xsltTransStorageAdd	(xsltTransformContextPtr ctxt,
+						 void *id,
+						 void *data);
+XSLTPUBFUN void * XSLTCALL
+			xsltTransStorageRemove	(xsltTransformContextPtr ctxt,
+						 void *id);
+
+/*
+ * Extra functions for Attribute Value Templates
+ */
+XSLTPUBFUN void XSLTCALL
+			xsltCompileAttr		(xsltStylesheetPtr style,
+						 xmlAttrPtr attr);
+XSLTPUBFUN xmlChar * XSLTCALL
+			xsltEvalAVT		(xsltTransformContextPtr ctxt,
+						 void *avt,
+						 xmlNodePtr node);
+XSLTPUBFUN void XSLTCALL
+			xsltFreeAVTList		(void *avt);
+
+/*
+ * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
+ */
+
+XSLTPUBFUN void XSLTCALL
+			xsltUninit		(void);
+
+/************************************************************************
+ *									*
+ *  Compile-time functions for *internal* use only                      *
+ *									*
+ ************************************************************************/
+
+#ifdef XSLT_REFACTORED  
+XSLTPUBFUN void XSLTCALL
+			xsltParseSequenceConstructor(
+						 xsltCompilerCtxtPtr cctxt,
+						 xmlNodePtr start);
+XSLTPUBFUN int XSLTCALL
+			xsltParseAnyXSLTElem	(xsltCompilerCtxtPtr cctxt,
+						 xmlNodePtr elem);
+#ifdef XSLT_REFACTORED_XSLT_NSCOMP
+XSLTPUBFUN int XSLTCALL
+			xsltRestoreDocumentNamespaces(
+						 xsltNsMapPtr ns,
+						 xmlDocPtr doc);
+#endif
+#endif /* XSLT_REFACTORED */
+
+/************************************************************************
+ *									*
+ *  Transformation-time functions for *internal* use only               *
+ *									*
+ ************************************************************************/
+XSLTPUBFUN int XSLTCALL
+			xsltInitCtxtKey		(xsltTransformContextPtr ctxt,
+						 xsltDocumentPtr doc,
+						 xsltKeyDefPtr keyd);
+XSLTPUBFUN int XSLTCALL
+			xsltInitAllDocKeys	(xsltTransformContextPtr ctxt);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_H__ */
+
diff --git a/third_party/libxslt/libxslt/xsltconfig.h b/third_party/libxslt/libxslt/xsltconfig.h
new file mode 100644
index 0000000..c22264d
--- /dev/null
+++ b/third_party/libxslt/libxslt/xsltconfig.h
@@ -0,0 +1,159 @@
+/*
+ * Summary: compile-time version informations for the XSLT engine
+ * Description: compile-time version informations for the XSLT engine
+ *              this module is autogenerated.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLTCONFIG_H__
+#define __XML_XSLTCONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * LIBXSLT_DOTTED_VERSION:
+ *
+ * the version string like "1.2.3"
+ */
+#define LIBXSLT_DOTTED_VERSION "1.1.24"
+
+/**
+ * LIBXSLT_VERSION:
+ *
+ * the version number: 1.2.3 value is 10203
+ */
+#define LIBXSLT_VERSION 10124
+
+/**
+ * LIBXSLT_VERSION_STRING:
+ *
+ * the version number string, 1.2.3 value is "10203"
+ */
+#define LIBXSLT_VERSION_STRING "10124"
+
+/**
+ * LIBXSLT_VERSION_EXTRA:
+ *
+ * extra version information, used to show a CVS compilation
+ */
+#define	LIBXSLT_VERSION_EXTRA ""
+
+/**
+ * WITH_XSLT_DEBUG:
+ *
+ * Activate the compilation of the debug reporting. Speed penalty
+ * is insignifiant and being able to run xsltpoc -v is useful. On
+ * by default unless --without-debug is passed to configure
+ */
+#if 1
+#define WITH_XSLT_DEBUG
+#endif
+
+#if 0
+/**
+ * DEBUG_MEMORY:
+ *
+ * should be activated only when debugging libxslt. It replaces the
+ * allocator with a collect and debug shell to the libc allocator.
+ * Use configure --with-mem-debug to activate it on both library
+ */
+#define DEBUG_MEMORY
+
+/**
+ * DEBUG_MEMORY_LOCATION:
+ *
+ * should be activated only when debugging libxslt.
+ * DEBUG_MEMORY_LOCATION should be activated only when libxml has
+ * been configured with --with-debug-mem too
+ */
+#define DEBUG_MEMORY_LOCATION
+#endif
+
+/**
+ * XSLT_NEED_TRIO:
+ *
+ * should be activated if the existing libc library lacks some of the
+ * string formatting function, in that case reuse the Trio ones already
+ * compiled in the libxml2 library.
+ */
+
+#if 0
+#define XSLT_NEED_TRIO
+#endif
+#ifdef __VMS
+#define HAVE_MATH_H 1
+#define HAVE_SYS_STAT_H 1
+#ifndef XSLT_NEED_TRIO
+#define XSLT_NEED_TRIO
+#endif
+#endif
+
+#ifdef	XSLT_NEED_TRIO
+#define	TRIO_REPLACE_STDIO
+#endif
+
+/**
+ * WITH_XSLT_DEBUGGER:
+ *
+ * Activate the compilation of the debugger support. Speed penalty
+ * is insignifiant.
+ * On by default unless --without-debugger is passed to configure
+ */
+#if 1
+#ifndef WITH_DEBUGGER
+#define WITH_DEBUGGER
+#endif
+#endif
+
+/**
+ * WITH_MODULES:
+ *
+ * Whether module support is configured into libxslt
+ * Note: no default module path for win32 platforms
+ */
+#if 0
+#ifndef WITH_MODULES
+#define WITH_MODULES
+#endif
+#define LIBXSLT_DEFAULT_PLUGINS_PATH() "NULL"
+#endif
+
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * This macro is used to flag unused function parameters to GCC
+ */
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include 
+#endif
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/**
+ * LIBXSLT_PUBLIC:
+ *
+ * This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows
+ */
+#if !defined LIBXSLT_PUBLIC
+#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
+#define LIBXSLT_PUBLIC __declspec(dllimport)
+#else
+#define LIBXSLT_PUBLIC
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLTCONFIG_H__ */
diff --git a/third_party/libxslt/libxslt/xsltconfig.h.in b/third_party/libxslt/libxslt/xsltconfig.h.in
new file mode 100644
index 0000000..a8b5acf
--- /dev/null
+++ b/third_party/libxslt/libxslt/xsltconfig.h.in
@@ -0,0 +1,159 @@
+/*
+ * Summary: compile-time version informations for the XSLT engine
+ * Description: compile-time version informations for the XSLT engine
+ *              this module is autogenerated.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_XSLTCONFIG_H__
+#define __XML_XSLTCONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * LIBXSLT_DOTTED_VERSION:
+ *
+ * the version string like "1.2.3"
+ */
+#define LIBXSLT_DOTTED_VERSION "@VERSION@"
+
+/**
+ * LIBXSLT_VERSION:
+ *
+ * the version number: 1.2.3 value is 10203
+ */
+#define LIBXSLT_VERSION @LIBXSLT_VERSION_NUMBER@
+
+/**
+ * LIBXSLT_VERSION_STRING:
+ *
+ * the version number string, 1.2.3 value is "10203"
+ */
+#define LIBXSLT_VERSION_STRING "@LIBXSLT_VERSION_NUMBER@"
+
+/**
+ * LIBXSLT_VERSION_EXTRA:
+ *
+ * extra version information, used to show a CVS compilation
+ */
+#define	LIBXSLT_VERSION_EXTRA "@LIBXSLT_VERSION_EXTRA@"
+
+/**
+ * WITH_XSLT_DEBUG:
+ *
+ * Activate the compilation of the debug reporting. Speed penalty
+ * is insignifiant and being able to run xsltpoc -v is useful. On
+ * by default unless --without-debug is passed to configure
+ */
+#if @WITH_XSLT_DEBUG@
+#define WITH_XSLT_DEBUG
+#endif
+
+#if @WITH_MEM_DEBUG@
+/**
+ * DEBUG_MEMORY:
+ *
+ * should be activated only when debugging libxslt. It replaces the
+ * allocator with a collect and debug shell to the libc allocator.
+ * Use configure --with-mem-debug to activate it on both library
+ */
+#define DEBUG_MEMORY
+
+/**
+ * DEBUG_MEMORY_LOCATION:
+ *
+ * should be activated only when debugging libxslt.
+ * DEBUG_MEMORY_LOCATION should be activated only when libxml has
+ * been configured with --with-debug-mem too
+ */
+#define DEBUG_MEMORY_LOCATION
+#endif
+
+/**
+ * XSLT_NEED_TRIO:
+ *
+ * should be activated if the existing libc library lacks some of the
+ * string formatting function, in that case reuse the Trio ones already
+ * compiled in the libxml2 library.
+ */
+
+#if @WITH_TRIO@
+#define XSLT_NEED_TRIO
+#endif
+#ifdef __VMS
+#define HAVE_MATH_H 1
+#define HAVE_SYS_STAT_H 1
+#ifndef XSLT_NEED_TRIO
+#define XSLT_NEED_TRIO
+#endif
+#endif
+
+#ifdef	XSLT_NEED_TRIO
+#define	TRIO_REPLACE_STDIO
+#endif
+
+/**
+ * WITH_XSLT_DEBUGGER:
+ *
+ * Activate the compilation of the debugger support. Speed penalty
+ * is insignifiant.
+ * On by default unless --without-debugger is passed to configure
+ */
+#if @WITH_DEBUGGER@
+#ifndef WITH_DEBUGGER
+#define WITH_DEBUGGER
+#endif
+#endif
+
+/**
+ * WITH_MODULES:
+ *
+ * Whether module support is configured into libxslt
+ * Note: no default module path for win32 platforms
+ */
+#if @WITH_MODULES@
+#ifndef WITH_MODULES
+#define WITH_MODULES
+#endif
+#define LIBXSLT_DEFAULT_PLUGINS_PATH() "@LIBXSLT_DEFAULT_PLUGINS_PATH@"
+#endif
+
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * This macro is used to flag unused function parameters to GCC
+ */
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include 
+#endif
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/**
+ * LIBXSLT_PUBLIC:
+ *
+ * This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows
+ */
+#if !defined LIBXSLT_PUBLIC
+#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
+#define LIBXSLT_PUBLIC __declspec(dllimport)
+#else
+#define LIBXSLT_PUBLIC
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLTCONFIG_H__ */
diff --git a/third_party/libxslt/libxslt/xsltexports.h b/third_party/libxslt/libxslt/xsltexports.h
new file mode 100644
index 0000000..825c122
--- /dev/null
+++ b/third_party/libxslt/libxslt/xsltexports.h
@@ -0,0 +1,142 @@
+/*
+ * Summary: macros for marking symbols as exportable/importable.
+ * Description: macros for marking symbols as exportable/importable.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Igor Zlatkovic 
+ */
+
+#ifndef __XSLT_EXPORTS_H__
+#define __XSLT_EXPORTS_H__
+
+/**
+ * XSLTPUBFUN:
+ * XSLTPUBFUN, XSLTPUBVAR, XSLTCALL
+ *
+ * Macros which declare an exportable function, an exportable variable and
+ * the calling convention used for functions.
+ *
+ * Please use an extra block for every platform/compiler combination when
+ * modifying this, rather than overlong #ifdef lines. This helps
+ * readability as well as the fact that different compilers on the same
+ * platform might need different definitions.
+ */
+
+/**
+ * XSLTPUBFUN:
+ *
+ * Macros which declare an exportable function
+ */
+#define XSLTPUBFUN
+/**
+ * XSLTPUBVAR:
+ *
+ * Macros which declare an exportable variable
+ */
+#define XSLTPUBVAR extern
+/**
+ * XSLTCALL:
+ *
+ * Macros which declare the called convention for exported functions
+ */
+#define XSLTCALL
+
+/** DOC_DISABLE */
+
+/* Windows platform with MS compiler */
+#if defined(_WIN32) && defined(_MSC_VER)
+  #undef XSLTPUBFUN
+  #undef XSLTPUBVAR
+  #undef XSLTCALL
+  #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
+    #define XSLTPUBFUN __declspec(dllexport)
+    #define XSLTPUBVAR __declspec(dllexport)
+  #else
+    #define XSLTPUBFUN
+    #if !defined(LIBXSLT_STATIC)
+      #define XSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define XSLTPUBVAR extern
+    #endif
+  #endif
+  #define XSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Windows platform with Borland compiler */
+#if defined(_WIN32) && defined(__BORLANDC__)
+  #undef XSLTPUBFUN
+  #undef XSLTPUBVAR
+  #undef XSLTCALL
+  #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
+    #define XSLTPUBFUN __declspec(dllexport)
+    #define XSLTPUBVAR __declspec(dllexport) extern
+  #else
+    #define XSLTPUBFUN
+    #if !defined(LIBXSLT_STATIC)
+      #define XSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define XSLTPUBVAR extern
+    #endif
+  #endif
+  #define XSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Windows platform with GNU compiler (Mingw) */
+#if defined(_WIN32) && defined(__MINGW32__)
+  #undef XSLTPUBFUN
+  #undef XSLTPUBVAR
+  #undef XSLTCALL
+/*
+  #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
+*/
+  #if !defined(LIBXSLT_STATIC)
+    #define XSLTPUBFUN __declspec(dllexport)
+    #define XSLTPUBVAR __declspec(dllexport) extern
+  #else
+    #define XSLTPUBFUN
+    #if !defined(LIBXSLT_STATIC)
+      #define XSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define XSLTPUBVAR extern
+    #endif
+  #endif
+  #define XSLTCALL __cdecl
+  #if !defined _REENTRANT
+    #define _REENTRANT
+  #endif
+#endif
+
+/* Cygwin platform, GNU compiler */
+#if defined(_WIN32) && defined(__CYGWIN__)
+  #undef XSLTPUBFUN
+  #undef XSLTPUBVAR
+  #undef XSLTCALL
+  #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
+    #define XSLTPUBFUN __declspec(dllexport)
+    #define XSLTPUBVAR __declspec(dllexport)
+  #else
+    #define XSLTPUBFUN
+    #if !defined(LIBXSLT_STATIC)
+      #define XSLTPUBVAR __declspec(dllimport) extern
+    #else
+      #define XSLTPUBVAR
+    #endif
+  #endif
+  #define XSLTCALL __cdecl
+#endif
+
+/* Compatibility */
+#if !defined(LIBXSLT_PUBLIC)
+#define LIBXSLT_PUBLIC XSLTPUBVAR
+#endif
+
+#endif /* __XSLT_EXPORTS_H__ */
+
+
diff --git a/third_party/libxslt/libxslt/xsltutils.c b/third_party/libxslt/libxslt/xsltutils.c
new file mode 100644
index 0000000..603b22e
--- /dev/null
+++ b/third_party/libxslt/libxslt/xsltutils.c
@@ -0,0 +1,2265 @@
+/*
+ * xsltutils.c: Utilities for the XSL Transformation 1.0 engine
+ *
+ * Reference:
+ *   http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+
+#define IN_LIBXSLT
+#include "libxslt.h"
+
+#ifndef	XSLT_NEED_TRIO
+#include 
+#else
+#include 
+#endif
+
+#include 
+#ifdef HAVE_SYS_TIME_H
+#include 
+#endif
+#ifdef HAVE_UNISTD_H
+#include 
+#endif
+#ifdef HAVE_STDLIB_H
+#include 
+#endif
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "xsltutils.h"
+#include "templates.h"
+#include "xsltInternals.h"
+#include "imports.h"
+#include "transform.h"
+
+/* gettimeofday on Windows ??? */
+#if defined(WIN32) && !defined(__CYGWIN__)
+#ifdef _MSC_VER
+#include 
+#pragma comment(lib, "ws2_32.lib")
+#define gettimeofday(p1,p2)
+#define HAVE_GETTIMEOFDAY
+#define XSLT_WIN32_PERFORMANCE_COUNTER
+#endif /* _MS_VER */
+#endif /* WIN32 */
+
+/************************************************************************
+ * 									*
+ * 			Convenience function				*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltGetCNsProp:
+ * @style: the stylesheet
+ * @node:  the node
+ * @name:  the attribute name
+ * @nameSpace:  the URI of the namespace
+ *
+ * Similar to xmlGetNsProp() but with a slightly different semantic
+ *
+ * Search and get the value of an attribute associated to a node
+ * This attribute has to be anchored in the namespace specified,
+ * or has no namespace and the element is in that namespace.
+ *
+ * This does the entity substitution.
+ * This function looks in DTD attribute declaration for #FIXED or
+ * default declaration values unless DTD use has been turned off.
+ *
+ * Returns the attribute value or NULL if not found. The string is allocated
+ *         in the stylesheet dictionary.
+ */
+const xmlChar *
+xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node,
+              const xmlChar *name, const xmlChar *nameSpace) {
+    xmlAttrPtr prop;
+    xmlDocPtr doc;
+    xmlNsPtr ns;
+    xmlChar *tmp;
+    const xmlChar *ret;
+
+    if ((node == NULL) || (style == NULL) || (style->dict == NULL))
+	return(NULL);
+
+    prop = node->properties;
+    if (nameSpace == NULL) {
+        return xmlGetProp(node, name);
+    }
+    while (prop != NULL) {
+	/*
+	 * One need to have
+	 *   - same attribute names
+	 *   - and the attribute carrying that namespace
+	 */
+        if ((xmlStrEqual(prop->name, name)) &&
+	    (((prop->ns == NULL) && (node->ns != NULL) &&
+	      (xmlStrEqual(node->ns->href, nameSpace))) ||
+	     ((prop->ns != NULL) &&
+	      (xmlStrEqual(prop->ns->href, nameSpace))))) {
+
+	    tmp = xmlNodeListGetString(node->doc, prop->children, 1);
+	    if (tmp == NULL)
+	        ret = xmlDictLookup(style->dict, BAD_CAST "", 0);
+	    else {
+	        ret = xmlDictLookup(style->dict, tmp, -1);
+		xmlFree(tmp);
+	    }
+	    return ret;
+        }
+	prop = prop->next;
+    }
+    tmp = NULL;
+    /*
+     * Check if there is a default declaration in the internal
+     * or external subsets
+     */
+    doc =  node->doc;
+    if (doc != NULL) {
+        if (doc->intSubset != NULL) {
+	    xmlAttributePtr attrDecl;
+
+	    attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+	    if ((attrDecl == NULL) && (doc->extSubset != NULL))
+		attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+		
+	    if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+	        /*
+		 * The DTD declaration only allows a prefix search
+		 */
+		ns = xmlSearchNs(doc, node, attrDecl->prefix);
+		if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace)))
+		    return(xmlDictLookup(style->dict,
+		                         attrDecl->defaultValue, -1));
+	    }
+	}
+    }
+    return(NULL);
+}
+/**
+ * xsltGetNsProp:
+ * @node:  the node
+ * @name:  the attribute name
+ * @nameSpace:  the URI of the namespace
+ *
+ * Similar to xmlGetNsProp() but with a slightly different semantic
+ *
+ * Search and get the value of an attribute associated to a node
+ * This attribute has to be anchored in the namespace specified,
+ * or has no namespace and the element is in that namespace.
+ *
+ * This does the entity substitution.
+ * This function looks in DTD attribute declaration for #FIXED or
+ * default declaration values unless DTD use has been turned off.
+ *
+ * Returns the attribute value or NULL if not found.
+ *     It's up to the caller to free the memory.
+ */
+xmlChar *
+xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+    xmlAttrPtr prop;
+    xmlDocPtr doc;
+    xmlNsPtr ns;
+
+    if (node == NULL)
+	return(NULL);
+
+    prop = node->properties;
+    /*
+    * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former
+    * is not namespace-aware and will return an attribute with equal
+    * name regardless of its namespace.
+    * Example:
+    *   
+    *   So this would return "myName" even if an attribute @name
+    *   in the XSLT was requested.
+    */
+    if (nameSpace == NULL)
+	return(xmlGetProp(node, name));
+    while (prop != NULL) {
+	/*
+	 * One need to have
+	 *   - same attribute names
+	 *   - and the attribute carrying that namespace
+	 */
+        if ((xmlStrEqual(prop->name, name)) &&
+	    (((prop->ns == NULL) && (node->ns != NULL) &&
+	      (xmlStrEqual(node->ns->href, nameSpace))) ||
+	     ((prop->ns != NULL) &&
+	      (xmlStrEqual(prop->ns->href, nameSpace))))) {
+	    xmlChar *ret;
+
+	    ret = xmlNodeListGetString(node->doc, prop->children, 1);
+	    if (ret == NULL) return(xmlStrdup((xmlChar *)""));
+	    return(ret);
+        }
+	prop = prop->next;
+    }
+
+    /*
+     * Check if there is a default declaration in the internal
+     * or external subsets
+     */
+    doc =  node->doc;
+    if (doc != NULL) {
+        if (doc->intSubset != NULL) {
+	    xmlAttributePtr attrDecl;
+
+	    attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+	    if ((attrDecl == NULL) && (doc->extSubset != NULL))
+		attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+		
+	    if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+	        /*
+		 * The DTD declaration only allows a prefix search
+		 */
+		ns = xmlSearchNs(doc, node, attrDecl->prefix);
+		if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace)))
+		    return(xmlStrdup(attrDecl->defaultValue));
+	    }
+	}
+    }
+    return(NULL);
+}
+
+/**
+ * xsltGetUTF8Char:
+ * @utf:  a sequence of UTF-8 encoded bytes
+ * @len:  a pointer to @bytes len
+ *
+ * Read one UTF8 Char from @utf
+ * Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately
+ * and use the original API
+ *
+ * Returns the char value or -1 in case of error and update @len with the
+ *        number of bytes used
+ */
+int
+xsltGetUTF8Char(const unsigned char *utf, int *len) {
+    unsigned int c;
+
+    if (utf == NULL)
+	goto error;
+    if (len == NULL)
+	goto error;
+    if (*len < 1)
+	goto error;
+
+    c = utf[0];
+    if (c & 0x80) {
+	if (*len < 2)
+	    goto error;
+	if ((utf[1] & 0xc0) != 0x80)
+	    goto error;
+	if ((c & 0xe0) == 0xe0) {
+	    if (*len < 3)
+		goto error;
+	    if ((utf[2] & 0xc0) != 0x80)
+		goto error;
+	    if ((c & 0xf0) == 0xf0) {
+		if (*len < 4)
+		    goto error;
+		if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
+		    goto error;
+		*len = 4;
+		/* 4-byte code */
+		c = (utf[0] & 0x7) << 18;
+		c |= (utf[1] & 0x3f) << 12;
+		c |= (utf[2] & 0x3f) << 6;
+		c |= utf[3] & 0x3f;
+	    } else {
+	      /* 3-byte code */
+		*len = 3;
+		c = (utf[0] & 0xf) << 12;
+		c |= (utf[1] & 0x3f) << 6;
+		c |= utf[2] & 0x3f;
+	    }
+	} else {
+	  /* 2-byte code */
+	    *len = 2;
+	    c = (utf[0] & 0x1f) << 6;
+	    c |= utf[1] & 0x3f;
+	}
+    } else {
+	/* 1-byte code */
+	*len = 1;
+    }
+    return(c);
+
+error:
+    if (len != NULL)
+	*len = 0;
+    return(-1);
+}
+
+#ifdef XSLT_REFACTORED
+
+/**
+ * xsltPointerListAddSize:
+ * @list: the pointer list structure
+ * @item: the item to be stored
+ * @initialSize: the initial size of the list
+ *
+ * Adds an item to the list.
+ *
+ * Returns the position of the added item in the list or
+ *         -1 in case of an error.
+ */
+int
+xsltPointerListAddSize(xsltPointerListPtr list,		       
+		       void *item,
+		       int initialSize)
+{
+    if (list->items == NULL) {
+	if (initialSize <= 0)
+	    initialSize = 1;
+	list->items = (void **) xmlMalloc(
+	    initialSize * sizeof(void *));
+	if (list->items == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltPointerListAddSize: memory allocation failure.\n");
+	    return(-1);
+	}
+	list->number = 0;
+	list->size = initialSize;
+    } else if (list->size <= list->number) {
+	list->size *= 2;
+	list->items = (void **) xmlRealloc(list->items,
+	    list->size * sizeof(void *));
+	if (list->items == NULL) {
+	    xsltGenericError(xsltGenericErrorContext,
+	     "xsltPointerListAddSize: memory re-allocation failure.\n");
+	    list->size = 0;
+	    return(-1);
+	}
+    }
+    list->items[list->number++] = item;
+    return(0);
+}
+
+/**
+ * xsltPointerListCreate:
+ * @initialSize: the initial size for the list
+ *
+ * Creates an xsltPointerList structure.
+ *
+ * Returns a xsltPointerList structure or NULL in case of an error.
+ */
+xsltPointerListPtr
+xsltPointerListCreate(int initialSize)
+{
+    xsltPointerListPtr ret;
+
+    ret = xmlMalloc(sizeof(xsltPointerList));
+    if (ret == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsltPointerListCreate: memory allocation failure.\n");
+	return (NULL);
+    }
+    memset(ret, 0, sizeof(xsltPointerList));
+    if (initialSize > 0) {
+	xsltPointerListAddSize(ret, NULL, initialSize);
+	ret->number = 0;
+    }
+    return (ret);
+}
+
+/**
+ * xsltPointerListFree:
+ * @list: pointer to the list to be freed
+ *
+ * Frees the xsltPointerList structure. This does not free
+ * the content of the list.
+ */
+void
+xsltPointerListFree(xsltPointerListPtr list)
+{
+    if (list == NULL)
+	return;
+    if (list->items != NULL)
+	xmlFree(list->items);
+    xmlFree(list);
+}
+
+/**
+ * xsltPointerListClear:
+ * @list: pointer to the list to be cleared
+ *
+ * Resets the list, but does not free the allocated array
+ * and does not free the content of the list.
+ */
+void
+xsltPointerListClear(xsltPointerListPtr list)
+{
+    if (list->items != NULL) {
+	xmlFree(list->items);
+	list->items = NULL;
+    }
+    list->number = 0;
+    list->size = 0;
+}
+
+#endif /* XSLT_REFACTORED */
+
+/************************************************************************
+ * 									*
+ * 		Handling of XSLT stylesheets messages			*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltMessage:
+ * @ctxt:  an XSLT processing context
+ * @node:  The current node
+ * @inst:  The node containing the message instruction
+ *
+ * Process and xsl:message construct
+ */
+void
+xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
+    xmlGenericErrorFunc error = xsltGenericError;
+    void *errctx = xsltGenericErrorContext;
+    xmlChar *prop, *message;
+    int terminate = 0;
+
+    if ((ctxt == NULL) || (inst == NULL))
+	return;
+
+    if (ctxt->error != NULL) {
+	error = ctxt->error;
+	errctx = ctxt->errctx;
+    }
+
+    prop = xmlGetNsProp(inst, (const xmlChar *)"terminate", NULL);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+	    terminate = 1;
+	} else if (xmlStrEqual(prop, (const xmlChar *)"no")) {
+	    terminate = 0;
+	} else {
+	    error(errctx,
+		"xsl:message : terminate expecting 'yes' or 'no'\n");
+	    ctxt->state = XSLT_STATE_ERROR;
+	}
+	xmlFree(prop);
+    }
+    message = xsltEvalTemplateString(ctxt, node, inst);
+    if (message != NULL) {
+	int len = xmlStrlen(message);
+
+	error(errctx, "%s", (const char *)message);
+	if ((len > 0) && (message[len - 1] != '\n'))
+	    error(errctx, "\n");
+	xmlFree(message);
+    }
+    if (terminate)
+	ctxt->state = XSLT_STATE_STOPPED;
+}
+
+/************************************************************************
+ * 									*
+ * 		Handling of out of context errors			*
+ * 									*
+ ************************************************************************/
+
+#define XSLT_GET_VAR_STR(msg, str) {				\
+    int       size;						\
+    int       chars;						\
+    char      *larger;						\
+    va_list   ap;						\
+								\
+    str = (char *) xmlMalloc(150);				\
+    if (str == NULL) 						\
+	return;							\
+								\
+    size = 150;							\
+								\
+    while (size < 64000) {					\
+	va_start(ap, msg);					\
+  	chars = vsnprintf(str, size, msg, ap);			\
+	va_end(ap);						\
+	if ((chars > -1) && (chars < size))			\
+	    break;						\
+	if (chars > -1)						\
+	    size += chars + 1;					\
+	else							\
+	    size += 100;					\
+	if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
+	    xmlFree(str);					\
+	    return;						\
+	}							\
+	str = larger;						\
+    }								\
+}
+/**
+ * xsltGenericErrorDefaultFunc:
+ * @ctx:  an error context
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ * 
+ * Default handler for out of context error messages.
+ */
+static void
+xsltGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
+    va_list args;
+
+    if (xsltGenericErrorContext == NULL)
+	xsltGenericErrorContext = (void *) stderr;
+
+    va_start(args, msg);
+    vfprintf((FILE *)xsltGenericErrorContext, msg, args);
+    va_end(args);
+}
+
+xmlGenericErrorFunc xsltGenericError = xsltGenericErrorDefaultFunc;
+void *xsltGenericErrorContext = NULL;
+
+
+/**
+ * xsltSetGenericErrorFunc:
+ * @ctx:  the new error handling context
+ * @handler:  the new handler function
+ *
+ * Function to reset the handler and the error context for out of
+ * context error messages.
+ * This simply means that @handler will be called for subsequent
+ * error messages while not parsing nor validating. And @ctx will
+ * be passed as first argument to @handler
+ * One can simply force messages to be emitted to another FILE * than
+ * stderr by setting @ctx to this file handle and @handler to NULL.
+ */
+void
+xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
+    xsltGenericErrorContext = ctx;
+    if (handler != NULL)
+	xsltGenericError = handler;
+    else
+	xsltGenericError = xsltGenericErrorDefaultFunc;
+}
+
+/**
+ * xsltGenericDebugDefaultFunc:
+ * @ctx:  an error context
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ * 
+ * Default handler for out of context error messages.
+ */
+static void
+xsltGenericDebugDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
+    va_list args;
+
+    if (xsltGenericDebugContext == NULL)
+	return;
+
+    va_start(args, msg);
+    vfprintf((FILE *)xsltGenericDebugContext, msg, args);
+    va_end(args);
+}
+
+xmlGenericErrorFunc xsltGenericDebug = xsltGenericDebugDefaultFunc;
+void *xsltGenericDebugContext = NULL;
+
+
+/**
+ * xsltSetGenericDebugFunc:
+ * @ctx:  the new error handling context
+ * @handler:  the new handler function
+ *
+ * Function to reset the handler and the error context for out of
+ * context error messages.
+ * This simply means that @handler will be called for subsequent
+ * error messages while not parsing or validating. And @ctx will
+ * be passed as first argument to @handler
+ * One can simply force messages to be emitted to another FILE * than
+ * stderr by setting @ctx to this file handle and @handler to NULL.
+ */
+void
+xsltSetGenericDebugFunc(void *ctx, xmlGenericErrorFunc handler) {
+    xsltGenericDebugContext = ctx;
+    if (handler != NULL)
+	xsltGenericDebug = handler;
+    else
+	xsltGenericDebug = xsltGenericDebugDefaultFunc;
+}
+
+/**
+ * xsltPrintErrorContext:
+ * @ctxt:  the transformation context
+ * @style:  the stylesheet
+ * @node:  the current node being processed
+ *
+ * Display the context of an error.
+ */
+void
+xsltPrintErrorContext(xsltTransformContextPtr ctxt,
+	              xsltStylesheetPtr style, xmlNodePtr node) {
+    int line = 0;
+    const xmlChar *file = NULL;
+    const xmlChar *name = NULL;
+    const char *type = "error";
+    xmlGenericErrorFunc error = xsltGenericError;
+    void *errctx = xsltGenericErrorContext;
+
+    if (ctxt != NULL) {
+	ctxt->state = XSLT_STATE_ERROR;
+	if (ctxt->error != NULL) {
+	    error = ctxt->error;
+	    errctx = ctxt->errctx;
+	}
+    }
+    if ((node == NULL) && (ctxt != NULL))
+	node = ctxt->inst;
+
+    if (node != NULL)  {
+	if ((node->type == XML_DOCUMENT_NODE) ||
+	    (node->type == XML_HTML_DOCUMENT_NODE)) {
+	    xmlDocPtr doc = (xmlDocPtr) node;
+
+	    file = doc->URL;
+	} else {
+	    line = xmlGetLineNo(node);
+	    if ((node->doc != NULL) && (node->doc->URL != NULL))
+		file = node->doc->URL;
+	    if (node->name != NULL)
+		name = node->name;
+	}
+    } 
+    
+    if (ctxt != NULL)
+	type = "runtime error";
+    else if (style != NULL) {
+#ifdef XSLT_REFACTORED
+	if (XSLT_CCTXT(style)->errSeverity == XSLT_ERROR_SEVERITY_WARNING)
+	    type = "compilation warning";
+	else
+	    type = "compilation error";
+#else
+	type = "compilation error";
+#endif
+    }
+
+    if ((file != NULL) && (line != 0) && (name != NULL))
+	error(errctx, "%s: file %s line %d element %s\n",
+	      type, file, line, name);
+    else if ((file != NULL) && (name != NULL))
+	error(errctx, "%s: file %s element %s\n", type, file, name);
+    else if ((file != NULL) && (line != 0))
+	error(errctx, "%s: file %s line %d\n", type, file, line);
+    else if (file != NULL)
+	error(errctx, "%s: file %s\n", type, file);
+    else if (name != NULL)
+	error(errctx, "%s: element %s\n", type, name);
+    else
+	error(errctx, "%s\n", type);
+}
+
+/**
+ * xsltSetTransformErrorFunc:
+ * @ctxt:  the XSLT transformation context
+ * @ctx:  the new error handling context
+ * @handler:  the new handler function
+ *
+ * Function to reset the handler and the error context for out of
+ * context error messages specific to a given XSLT transromation.
+ *
+ * This simply means that @handler will be called for subsequent
+ * error messages while running the transformation.
+ */
+void
+xsltSetTransformErrorFunc(xsltTransformContextPtr ctxt,
+                          void *ctx, xmlGenericErrorFunc handler)
+{
+    ctxt->error = handler;
+    ctxt->errctx = ctx;
+}
+
+/**
+ * xsltTransformError:
+ * @ctxt:  an XSLT transformation context
+ * @style:  the XSLT stylesheet used
+ * @node:  the current node in the stylesheet
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ *
+ * Display and format an error messages, gives file, line, position and
+ * extra parameters, will use the specific transformation context if available
+ */
+void
+xsltTransformError(xsltTransformContextPtr ctxt,
+		   xsltStylesheetPtr style,
+		   xmlNodePtr node,
+		   const char *msg, ...) {
+    xmlGenericErrorFunc error = xsltGenericError;
+    void *errctx = xsltGenericErrorContext;
+    char * str;
+
+    if (ctxt != NULL) {
+	ctxt->state = XSLT_STATE_ERROR;
+	if (ctxt->error != NULL) {
+	    error = ctxt->error;
+	    errctx = ctxt->errctx;
+	}
+    }
+    if ((node == NULL) && (ctxt != NULL))
+	node = ctxt->inst;
+    xsltPrintErrorContext(ctxt, style, node);
+    XSLT_GET_VAR_STR(msg, str);
+    error(errctx, "%s", str);
+    if (str != NULL)
+	xmlFree(str);
+}
+
+/************************************************************************
+ * 									*
+ * 				QNames					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltSplitQName:
+ * @dict: a dictionary
+ * @name:  the full QName
+ * @prefix: the return value
+ *
+ * Split QNames into prefix and local names, both allocated from a dictionary.
+ *
+ * Returns: the localname or NULL in case of error.
+ */
+const xmlChar *
+xsltSplitQName(xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix) {
+    int len = 0;
+    const xmlChar *ret = NULL;
+
+    *prefix = NULL;
+    if ((name == NULL) || (dict == NULL)) return(NULL);
+    if (name[0] == ':')
+        return(xmlDictLookup(dict, name, -1));
+    while ((name[len] != 0) && (name[len] != ':')) len++;
+    if (name[len] == 0) return(xmlDictLookup(dict, name, -1));
+    *prefix = xmlDictLookup(dict, name, len);
+    ret = xmlDictLookup(dict, &name[len + 1], -1);
+    return(ret);
+}
+
+/**
+ * xsltGetQNameURI:
+ * @node:  the node holding the QName
+ * @name:  pointer to the initial QName value
+ *
+ * This function analyzes @name, if the name contains a prefix,
+ * the function seaches the associated namespace in scope for it.
+ * It will also replace @name value with the NCName, the old value being
+ * freed.
+ * Errors in the prefix lookup are signalled by setting @name to NULL.
+ *
+ * NOTE: the namespace returned is a pointer to the place where it is
+ *       defined and hence has the same lifespan as the document holding it.
+ *
+ * Returns the namespace URI if there is a prefix, or NULL if @name is
+ *         not prefixed.
+ */
+const xmlChar *
+xsltGetQNameURI(xmlNodePtr node, xmlChar ** name)
+{
+    int len = 0;
+    xmlChar *qname;
+    xmlNsPtr ns;
+
+    if (name == NULL)
+	return(NULL);
+    qname = *name;
+    if ((qname == NULL) || (*qname == 0))
+	return(NULL);
+    if (node == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+		         "QName: no element for namespace lookup %s\n",
+			 qname);
+	xmlFree(qname);
+	*name = NULL;
+	return(NULL);
+    }
+
+    /* nasty but valid */
+    if (qname[0] == ':')
+	return(NULL);
+
+    /*
+     * we are not trying to validate but just to cut, and yes it will
+     * work even if this is a set of UTF-8 encoded chars
+     */
+    while ((qname[len] != 0) && (qname[len] != ':')) 
+	len++;
+    
+    if (qname[len] == 0)
+	return(NULL);
+
+    /*
+     * handle xml: separately, this one is magical
+     */
+    if ((qname[0] == 'x') && (qname[1] == 'm') &&
+        (qname[2] == 'l') && (qname[3] == ':')) {
+	if (qname[4] == 0)
+	    return(NULL);
+        *name = xmlStrdup(&qname[4]);
+	xmlFree(qname);
+	return(XML_XML_NAMESPACE);
+    }
+
+    qname[len] = 0;
+    ns = xmlSearchNs(node->doc, node, qname);
+    if (ns == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+		"%s:%s : no namespace bound to prefix %s\n",
+		         qname, &qname[len + 1], qname);
+	*name = NULL;
+	xmlFree(qname);
+	return(NULL);
+    }
+    *name = xmlStrdup(&qname[len + 1]);
+    xmlFree(qname);
+    return(ns->href);
+}
+
+/**
+ * xsltGetQNameURI2:
+ * @style:  stylesheet pointer
+ * @node:   the node holding the QName
+ * @name:   pointer to the initial QName value
+ *
+ * This function is similar to xsltGetQNameURI, but is used when
+ * @name is a dictionary entry.
+ *
+ * Returns the namespace URI if there is a prefix, or NULL if @name is
+ * not prefixed.
+ */
+const xmlChar *
+xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node,
+		 const xmlChar **name) {
+    int len = 0;
+    xmlChar *qname;
+    xmlNsPtr ns;
+
+    if (name == NULL)
+        return(NULL);
+    qname = (xmlChar *)*name;
+    if ((qname == NULL) || (*qname == 0))
+        return(NULL);
+    if (node == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+                         "QName: no element for namespace lookup %s\n",
+                          qname);
+	*name = NULL;
+	return(NULL);
+    }
+
+    /*
+     * we are not trying to validate but just to cut, and yes it will
+     * work even if this is a set of UTF-8 encoded chars
+     */
+    while ((qname[len] != 0) && (qname[len] != ':'))
+        len++;
+
+    if (qname[len] == 0)
+        return(NULL);
+
+    /*
+     * handle xml: separately, this one is magical
+     */
+    if ((qname[0] == 'x') && (qname[1] == 'm') &&
+        (qname[2] == 'l') && (qname[3] == ':')) {
+        if (qname[4] == 0)
+            return(NULL);
+        *name = xmlDictLookup(style->dict, &qname[4], -1);
+        return(XML_XML_NAMESPACE);
+    }
+
+    qname = xmlStrndup(*name, len);
+    ns = xmlSearchNs(node->doc, node, qname);
+    if (ns == NULL) {
+	if (style) {
+	    xsltTransformError(NULL, style, node,
+		"No namespace bound to prefix '%s'.\n",
+		qname);
+	    style->errors++;
+	} else {
+	    xsltGenericError(xsltGenericErrorContext,
+                "%s : no namespace bound to prefix %s\n",
+		*name, qname);
+	}
+        *name = NULL;
+        xmlFree(qname);
+        return(NULL);
+    }
+    *name = xmlDictLookup(style->dict, (*name)+len+1, -1);
+    xmlFree(qname);
+    return(ns->href);
+}
+										      
+/************************************************************************
+ * 									*
+ * 				Sorting					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltDocumentSortFunction:
+ * @list:  the node set
+ *
+ * reorder the current node list @list accordingly to the document order
+ * This function is slow, obsolete and should not be used anymore.
+ */
+void
+xsltDocumentSortFunction(xmlNodeSetPtr list) {
+    int i, j;
+    int len, tst;
+    xmlNodePtr node;
+
+    if (list == NULL)
+	return;
+    len = list->nodeNr;
+    if (len <= 1)
+	return;
+    /* TODO: sort is really not optimized, does it needs to ? */
+    for (i = 0;i < len -1;i++) {
+	for (j = i + 1; j < len; j++) {
+	    tst = xmlXPathCmpNodes(list->nodeTab[i], list->nodeTab[j]);
+	    if (tst == -1) {
+		node = list->nodeTab[i];
+		list->nodeTab[i] = list->nodeTab[j];
+		list->nodeTab[j] = node;
+	    }
+	}
+    }
+}
+
+/**
+ * xsltComputeSortResult:
+ * @ctxt:  a XSLT process context
+ * @sort:  node list
+ *
+ * reorder the current node list accordingly to the set of sorting
+ * requirement provided by the array of nodes.
+ *
+ * Returns a ordered XPath nodeset or NULL in case of error.
+ */
+xmlXPathObjectPtr *
+xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemSortPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    xmlXPathObjectPtr *results = NULL;
+    xmlNodeSetPtr list = NULL;
+    xmlXPathObjectPtr res;
+    int len = 0;
+    int i;    
+    xmlNodePtr oldNode;
+    xmlNodePtr oldInst;
+    int	oldPos, oldSize ;
+    int oldNsNr;
+    xmlNsPtr *oldNamespaces;
+
+    comp = sort->psvi;
+    if (comp == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsl:sort : compilation failed\n");
+	return(NULL);
+    }
+
+    if ((comp->select == NULL) || (comp->comp == NULL))
+	return(NULL);
+
+    list = ctxt->nodeList;
+    if ((list == NULL) || (list->nodeNr <= 1))
+	return(NULL);
+
+    len = list->nodeNr;
+
+    /* TODO: xsl:sort lang attribute */
+    /* TODO: xsl:sort case-order attribute */
+
+
+    results = xmlMalloc(len * sizeof(xmlXPathObjectPtr));
+    if (results == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsltComputeSortResult: memory allocation failure\n");
+	return(NULL);
+    }
+
+    oldNode = ctxt->node;
+    oldInst = ctxt->inst;
+    oldPos = ctxt->xpathCtxt->proximityPosition;
+    oldSize = ctxt->xpathCtxt->contextSize;
+    oldNsNr = ctxt->xpathCtxt->nsNr;
+    oldNamespaces = ctxt->xpathCtxt->namespaces;
+    for (i = 0;i < len;i++) {
+	ctxt->inst = sort;
+	ctxt->xpathCtxt->contextSize = len;
+	ctxt->xpathCtxt->proximityPosition = i + 1;
+	ctxt->node = list->nodeTab[i];
+	ctxt->xpathCtxt->node = ctxt->node;
+#ifdef XSLT_REFACTORED
+	if (comp->inScopeNs != NULL) {
+	    ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
+	    ctxt->xpathCtxt->nsNr = comp->inScopeNs->xpathNumber;
+	} else {
+	    ctxt->xpathCtxt->namespaces = NULL;
+	    ctxt->xpathCtxt->nsNr = 0;
+	}
+#else
+	ctxt->xpathCtxt->namespaces = comp->nsList;
+	ctxt->xpathCtxt->nsNr = comp->nsNr;
+#endif
+	res = xmlXPathCompiledEval(comp->comp, ctxt->xpathCtxt);
+	if (res != NULL) {
+	    if (res->type != XPATH_STRING)
+		res = xmlXPathConvertString(res);
+	    if (comp->number)
+		res = xmlXPathConvertNumber(res);
+	    res->index = i;	/* Save original pos for dupl resolv */
+	    if (comp->number) {
+		if (res->type == XPATH_NUMBER) {
+		    results[i] = res;
+		} else {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    xsltGenericDebug(xsltGenericDebugContext,
+			"xsltComputeSortResult: select didn't evaluate to a number\n");
+#endif
+		    results[i] = NULL;
+		}
+	    } else {
+		if (res->type == XPATH_STRING) {
+		    results[i] = res;
+		} else {
+#ifdef WITH_XSLT_DEBUG_PROCESS
+		    xsltGenericDebug(xsltGenericDebugContext,
+			"xsltComputeSortResult: select didn't evaluate to a string\n");
+#endif
+		    results[i] = NULL;
+		}
+	    }
+	} else {
+	    ctxt->state = XSLT_STATE_STOPPED;
+	    results[i] = NULL;
+	}
+    }
+    ctxt->node = oldNode;
+    ctxt->inst = oldInst;
+    ctxt->xpathCtxt->contextSize = oldSize;
+    ctxt->xpathCtxt->proximityPosition = oldPos;
+    ctxt->xpathCtxt->nsNr = oldNsNr;
+    ctxt->xpathCtxt->namespaces = oldNamespaces;
+
+    return(results);
+}
+
+/**
+ * xsltDefaultSortFunction:
+ * @ctxt:  a XSLT process context
+ * @sorts:  array of sort nodes
+ * @nbsorts:  the number of sorts in the array
+ *
+ * reorder the current node list accordingly to the set of sorting
+ * requirement provided by the arry of nodes.
+ */
+void	
+xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
+	           int nbsorts) {
+#ifdef XSLT_REFACTORED
+    xsltStyleItemSortPtr comp;
+#else
+    xsltStylePreCompPtr comp;
+#endif
+    xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT];
+    xmlXPathObjectPtr *results = NULL, *res;
+    xmlNodeSetPtr list = NULL;
+    int descending, number, desc, numb;
+    int len = 0;
+    int i, j, incr;
+    int tst;
+    int depth;
+    xmlNodePtr node;
+    xmlXPathObjectPtr tmp;    
+    int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT];
+
+    if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) ||
+	(nbsorts >= XSLT_MAX_SORT))
+	return;
+    if (sorts[0] == NULL)
+	return;
+    comp = sorts[0]->psvi;
+    if (comp == NULL)
+	return;
+
+    list = ctxt->nodeList;
+    if ((list == NULL) || (list->nodeNr <= 1))
+	return; /* nothing to do */
+
+    for (j = 0; j < nbsorts; j++) {
+	comp = sorts[j]->psvi;
+	tempstype[j] = 0;
+	if ((comp->stype == NULL) && (comp->has_stype != 0)) {
+	    comp->stype =
+		xsltEvalAttrValueTemplate(ctxt, sorts[j],
+					  (const xmlChar *) "data-type",
+					  XSLT_NAMESPACE);
+	    if (comp->stype != NULL) {
+		tempstype[j] = 1;
+		if (xmlStrEqual(comp->stype, (const xmlChar *) "text"))
+		    comp->number = 0;
+		else if (xmlStrEqual(comp->stype, (const xmlChar *) "number"))
+		    comp->number = 1;
+		else {
+		    xsltTransformError(ctxt, NULL, sorts[j],
+			  "xsltDoSortFunction: no support for data-type = %s\n",
+				     comp->stype);
+		    comp->number = 0; /* use default */
+		}
+	    }
+	}
+	temporder[j] = 0;
+	if ((comp->order == NULL) && (comp->has_order != 0)) {
+	    comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j],
+						    (const xmlChar *) "order",
+						    XSLT_NAMESPACE);
+	    if (comp->order != NULL) {
+		temporder[j] = 1;
+		if (xmlStrEqual(comp->order, (const xmlChar *) "ascending"))
+		    comp->descending = 0;
+		else if (xmlStrEqual(comp->order,
+				     (const xmlChar *) "descending"))
+		    comp->descending = 1;
+		else {
+		    xsltTransformError(ctxt, NULL, sorts[j],
+			     "xsltDoSortFunction: invalid value %s for order\n",
+				     comp->order);
+		    comp->descending = 0; /* use default */
+		}
+	    }
+	}
+    }
+
+    len = list->nodeNr;
+
+    resultsTab[0] = xsltComputeSortResult(ctxt, sorts[0]);
+    for (i = 1;i < XSLT_MAX_SORT;i++)
+	resultsTab[i] = NULL;
+
+    results = resultsTab[0];
+
+    comp = sorts[0]->psvi;
+    descending = comp->descending;
+    number = comp->number;
+    if (results == NULL)
+	return;
+
+    /* Shell's sort of node-set */
+    for (incr = len / 2; incr > 0; incr /= 2) {
+	for (i = incr; i < len; i++) {
+	    j = i - incr;
+	    if (results[i] == NULL)
+		continue;
+	    
+	    while (j >= 0) {
+		if (results[j] == NULL)
+		    tst = 1;
+		else {
+		    if (number) {
+			/* We make NaN smaller than number in accordance
+			   with XSLT spec */
+			if (xmlXPathIsNaN(results[j]->floatval)) {
+			    if (xmlXPathIsNaN(results[j + incr]->floatval))
+				tst = 0;
+			    else
+				tst = -1;
+			} else if (xmlXPathIsNaN(results[j + incr]->floatval))
+			    tst = 1;
+			else if (results[j]->floatval ==
+				results[j + incr]->floatval)
+			    tst = 0;
+			else if (results[j]->floatval > 
+				results[j + incr]->floatval)
+			    tst = 1;
+			else tst = -1;
+		    } else {
+			tst = xmlStrcmp(results[j]->stringval,
+				     results[j + incr]->stringval); 
+		    }
+		    if (descending)
+			tst = -tst;
+		}
+		if (tst == 0) {
+		    /*
+		     * Okay we need to use multi level sorts
+		     */
+		    depth = 1;
+		    while (depth < nbsorts) {
+			if (sorts[depth] == NULL)
+			    break;
+			comp = sorts[depth]->psvi;
+			if (comp == NULL)
+			    break;
+			desc = comp->descending;
+			numb = comp->number;
+
+			/*
+			 * Compute the result of the next level for the
+			 * full set, this might be optimized ... or not
+			 */
+			if (resultsTab[depth] == NULL) 
+			    resultsTab[depth] = xsltComputeSortResult(ctxt,
+				                        sorts[depth]);
+			res = resultsTab[depth];
+			if (res == NULL) 
+			    break;
+			if (res[j] == NULL) {
+			    if (res[j+incr] != NULL)
+				tst = 1;
+			} else {
+			    if (numb) {
+				/* We make NaN smaller than number in
+				   accordance with XSLT spec */
+				if (xmlXPathIsNaN(res[j]->floatval)) {
+				    if (xmlXPathIsNaN(res[j +
+				    		incr]->floatval))
+					tst = 0;
+				    else
+				        tst = -1;
+				} else if (xmlXPathIsNaN(res[j + incr]->
+						floatval))
+				    tst = 1;
+				else if (res[j]->floatval == res[j + incr]->
+						floatval)
+				    tst = 0;
+				else if (res[j]->floatval > 
+					res[j + incr]->floatval)
+				    tst = 1;
+				else tst = -1;
+			    } else {
+				tst = xmlStrcmp(res[j]->stringval,
+					     res[j + incr]->stringval); 
+			    }
+			    if (desc)
+				tst = -tst;
+			}
+
+			/*
+			 * if we still can't differenciate at this level
+			 * try one level deeper.
+			 */
+			if (tst != 0)
+			    break;
+			depth++;
+		    }
+		}
+		if (tst == 0) {
+		    tst = results[j]->index > results[j + incr]->index;
+		}
+		if (tst > 0) {
+		    tmp = results[j];
+		    results[j] = results[j + incr];
+		    results[j + incr] = tmp;
+		    node = list->nodeTab[j];
+		    list->nodeTab[j] = list->nodeTab[j + incr];
+		    list->nodeTab[j + incr] = node;
+		    depth = 1;
+		    while (depth < nbsorts) {
+			if (sorts[depth] == NULL)
+			    break;
+			if (resultsTab[depth] == NULL)
+			    break;
+			res = resultsTab[depth];
+			tmp = res[j];
+			res[j] = res[j + incr];
+			res[j + incr] = tmp;
+			depth++;
+		    }
+		    j -= incr;
+		} else
+		    break;
+	    }
+	}
+    }
+
+    for (j = 0; j < nbsorts; j++) {
+	comp = sorts[j]->psvi;
+	if (tempstype[j] == 1) {
+	    /* The data-type needs to be recomputed each time */
+	    xmlFree((void *)(comp->stype));
+	    comp->stype = NULL;
+	}
+	if (temporder[j] == 1) {
+	    /* The order needs to be recomputed each time */
+	    xmlFree((void *)(comp->order));
+	    comp->order = NULL;
+	}
+	if (resultsTab[j] != NULL) {
+	    for (i = 0;i < len;i++)
+		xmlXPathFreeObject(resultsTab[j][i]);
+	    xmlFree(resultsTab[j]);
+	}
+    }
+}
+
+
+static xsltSortFunc xsltSortFunction = xsltDefaultSortFunction;
+
+/**
+ * xsltDoSortFunction:
+ * @ctxt:  a XSLT process context
+ * @sorts:  array of sort nodes
+ * @nbsorts:  the number of sorts in the array
+ *
+ * reorder the current node list accordingly to the set of sorting
+ * requirement provided by the arry of nodes.
+ * This is a wrapper function, the actual function used is specified
+ * using xsltSetCtxtSortFunc() to set the context specific sort function,
+ * or xsltSetSortFunc() to set the global sort function.
+ * If a sort function is set on the context, this will get called.
+ * Otherwise the global sort function is called.
+ */
+void
+xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
+                   int nbsorts)
+{
+    if (ctxt->sortfunc != NULL)
+	(ctxt->sortfunc)(ctxt, sorts, nbsorts);
+    else if (xsltSortFunction != NULL)
+        xsltSortFunction(ctxt, sorts, nbsorts);
+}
+
+/**
+ * xsltSetSortFunc:
+ * @handler:  the new handler function
+ *
+ * Function to reset the global handler for XSLT sorting.
+ * If the handler is NULL, the default sort function will be used.
+ */
+void
+xsltSetSortFunc(xsltSortFunc handler) {
+    if (handler != NULL)
+	xsltSortFunction = handler;
+    else
+	xsltSortFunction = xsltDefaultSortFunction;
+}
+
+/**
+ * xsltSetCtxtSortFunc:
+ * @ctxt:  a XSLT process context
+ * @handler:  the new handler function
+ *
+ * Function to set the handler for XSLT sorting
+ * for the specified context. 
+ * If the handler is NULL, then the global
+ * sort function will be called
+ */
+void 
+xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) {
+    ctxt->sortfunc = handler;
+}
+
+/************************************************************************
+ * 									*
+ * 				Parsing options				*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltSetCtxtParseOptions:
+ * @ctxt:  a XSLT process context
+ * @options:  a combination of libxml2 xmlParserOption
+ * 
+ * Change the default parser option passed by the XSLT engine to the 
+ * parser when using document() loading.
+ *
+ * Returns the previous options or -1 in case of error
+ */
+int 
+xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options)
+{
+    int oldopts;
+
+    if (ctxt == NULL)
+        return(-1);
+    oldopts = ctxt->parserOptions;
+    if (ctxt->xinclude)
+        oldopts |= XML_PARSE_XINCLUDE;
+    ctxt->parserOptions = options;
+    if (options & XML_PARSE_XINCLUDE)
+        ctxt->xinclude = 1;
+    else
+        ctxt->xinclude = 0;
+    return(oldopts);
+}
+
+/************************************************************************
+ * 									*
+ * 				Output					*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltSaveResultTo:
+ * @buf:  an output buffer
+ * @result:  the result xmlDocPtr
+ * @style:  the stylesheet
+ *
+ * Save the result @result obtained by applying the @style stylesheet
+ * to an I/O output channel @buf
+ *
+ * Returns the number of byte written or -1 in case of failure.
+ */
+int
+xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
+	       xsltStylesheetPtr style) {
+    const xmlChar *encoding;
+    int base;
+    const xmlChar *method;
+    int indent;
+
+    if ((buf == NULL) || (result == NULL) || (style == NULL))
+	return(-1);
+    if ((result->children == NULL) ||
+	((result->children->type == XML_DTD_NODE) &&
+	 (result->children->next == NULL)))
+	return(0);
+
+    if ((style->methodURI != NULL) &&
+	((style->method == NULL) ||
+	 (!xmlStrEqual(style->method, (const xmlChar *) "xhtml")))) {
+        xsltGenericError(xsltGenericErrorContext,
+		"xsltSaveResultTo : unknown ouput method\n");
+        return(-1);
+    }
+
+    base = buf->written;
+
+    XSLT_GET_IMPORT_PTR(method, style, method)
+    XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+    XSLT_GET_IMPORT_INT(indent, style, indent);
+
+    if ((method == NULL) && (result->type == XML_HTML_DOCUMENT_NODE))
+	method = (const xmlChar *) "html";
+
+    if ((method != NULL) &&
+	(xmlStrEqual(method, (const xmlChar *) "html"))) {
+	if (encoding != NULL) {
+	    htmlSetMetaEncoding(result, (const xmlChar *) encoding);
+	} else {
+	    htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8");
+	}
+	if (indent == -1)
+	    indent = 1;
+	htmlDocContentDumpFormatOutput(buf, result, (const char *) encoding,
+		                       indent);
+	xmlOutputBufferFlush(buf);
+    } else if ((method != NULL) &&
+	(xmlStrEqual(method, (const xmlChar *) "xhtml"))) {
+	if (encoding != NULL) {
+	    htmlSetMetaEncoding(result, (const xmlChar *) encoding);
+	} else {
+	    htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8");
+	}
+	htmlDocContentDumpOutput(buf, result, (const char *) encoding);
+	xmlOutputBufferFlush(buf);
+    } else if ((method != NULL) &&
+	       (xmlStrEqual(method, (const xmlChar *) "text"))) {
+	xmlNodePtr cur;
+
+	cur = result->children;
+	while (cur != NULL) {
+	    if (cur->type == XML_TEXT_NODE)
+		xmlOutputBufferWriteString(buf, (const char *) cur->content);
+
+	    /*
+	     * Skip to next node
+	     */
+	    if (cur->children != NULL) {
+		if ((cur->children->type != XML_ENTITY_DECL) &&
+		    (cur->children->type != XML_ENTITY_REF_NODE) &&
+		    (cur->children->type != XML_ENTITY_NODE)) {
+		    cur = cur->children;
+		    continue;
+		}
+	    }
+	    if (cur->next != NULL) {
+		cur = cur->next;
+		continue;
+	    }
+	    
+	    do {
+		cur = cur->parent;
+		if (cur == NULL)
+		    break;
+		if (cur == (xmlNodePtr) style->doc) {
+		    cur = NULL;
+		    break;
+		}
+		if (cur->next != NULL) {
+		    cur = cur->next;
+		    break;
+		}
+	    } while (cur != NULL);
+	}
+	xmlOutputBufferFlush(buf);
+    } else {
+	int omitXmlDecl;
+	int standalone;
+
+	XSLT_GET_IMPORT_INT(omitXmlDecl, style, omitXmlDeclaration);
+	XSLT_GET_IMPORT_INT(standalone, style, standalone);
+
+	if (omitXmlDecl != 1) {
+	    xmlOutputBufferWriteString(buf, "version != NULL) 
+		xmlBufferWriteQuotedString(buf->buffer, result->version);
+	    else
+		xmlOutputBufferWriteString(buf, "\"1.0\"");
+	    if (encoding == NULL) {
+		if (result->encoding != NULL)
+		    encoding = result->encoding;
+		else if (result->charset != XML_CHAR_ENCODING_UTF8)
+		    encoding = (const xmlChar *)
+			       xmlGetCharEncodingName((xmlCharEncoding)
+			                              result->charset);
+	    }
+	    if (encoding != NULL) {
+		xmlOutputBufferWriteString(buf, " encoding=");
+		xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
+	    }
+	    switch (standalone) {
+		case 0:
+		    xmlOutputBufferWriteString(buf, " standalone=\"no\"");
+		    break;
+		case 1:
+		    xmlOutputBufferWriteString(buf, " standalone=\"yes\"");
+		    break;
+		default:
+		    break;
+	    }
+	    xmlOutputBufferWriteString(buf, "?>\n");
+	}
+	if (result->children != NULL) {
+	    xmlNodePtr child = result->children;
+
+	    while (child != NULL) {
+		xmlNodeDumpOutput(buf, result, child, 0, (indent == 1),
+			          (const char *) encoding);
+		if ((child->type == XML_DTD_NODE) ||
+		    ((child->type == XML_COMMENT_NODE) &&
+		     (child->next != NULL)))
+		    xmlOutputBufferWriteString(buf, "\n");
+		child = child->next;
+	    }
+	    xmlOutputBufferWriteString(buf, "\n");
+	}
+	xmlOutputBufferFlush(buf);
+    }
+    return(buf->written - base);
+}
+
+/**
+ * xsltSaveResultToFilename:
+ * @URL:  a filename or URL
+ * @result:  the result xmlDocPtr
+ * @style:  the stylesheet
+ * @compression:  the compression factor (0 - 9 included)
+ *
+ * Save the result @result obtained by applying the @style stylesheet
+ * to a file or @URL
+ *
+ * Returns the number of byte written or -1 in case of failure.
+ */
+int
+xsltSaveResultToFilename(const char *URL, xmlDocPtr result,
+			 xsltStylesheetPtr style, int compression) {
+    xmlOutputBufferPtr buf;
+    const xmlChar *encoding;
+    int ret;
+
+    if ((URL == NULL) || (result == NULL) || (style == NULL))
+	return(-1);
+    if (result->children == NULL)
+	return(0);
+
+    XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+    if (encoding != NULL) {
+	xmlCharEncodingHandlerPtr encoder;
+
+	encoder = xmlFindCharEncodingHandler((char *)encoding);
+	if ((encoder != NULL) &&
+	    (xmlStrEqual((const xmlChar *)encoder->name,
+			 (const xmlChar *) "UTF-8")))
+	    encoder = NULL;
+	buf = xmlOutputBufferCreateFilename(URL, encoder, compression);
+    } else {
+	buf = xmlOutputBufferCreateFilename(URL, NULL, compression);
+    }
+    if (buf == NULL)
+	return(-1);
+    xsltSaveResultTo(buf, result, style);
+    ret = xmlOutputBufferClose(buf);
+    return(ret);
+}
+
+/**
+ * xsltSaveResultToFile:
+ * @file:  a FILE * I/O
+ * @result:  the result xmlDocPtr
+ * @style:  the stylesheet
+ *
+ * Save the result @result obtained by applying the @style stylesheet
+ * to an open FILE * I/O.
+ * This does not close the FILE @file
+ *
+ * Returns the number of bytes written or -1 in case of failure.
+ */
+int
+xsltSaveResultToFile(FILE *file, xmlDocPtr result, xsltStylesheetPtr style) {
+    xmlOutputBufferPtr buf;
+    const xmlChar *encoding;
+    int ret;
+
+    if ((file == NULL) || (result == NULL) || (style == NULL))
+	return(-1);
+    if (result->children == NULL)
+	return(0);
+
+    XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+    if (encoding != NULL) {
+	xmlCharEncodingHandlerPtr encoder;
+
+	encoder = xmlFindCharEncodingHandler((char *)encoding);
+	if ((encoder != NULL) &&
+	    (xmlStrEqual((const xmlChar *)encoder->name,
+			 (const xmlChar *) "UTF-8")))
+	    encoder = NULL;
+	buf = xmlOutputBufferCreateFile(file, encoder);
+    } else {
+	buf = xmlOutputBufferCreateFile(file, NULL);
+    }
+
+    if (buf == NULL)
+	return(-1);
+    xsltSaveResultTo(buf, result, style);
+    ret = xmlOutputBufferClose(buf);
+    return(ret);
+}
+
+/**
+ * xsltSaveResultToFd:
+ * @fd:  a file descriptor
+ * @result:  the result xmlDocPtr
+ * @style:  the stylesheet
+ *
+ * Save the result @result obtained by applying the @style stylesheet
+ * to an open file descriptor
+ * This does not close the descriptor.
+ *
+ * Returns the number of bytes written or -1 in case of failure.
+ */
+int
+xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) {
+    xmlOutputBufferPtr buf;
+    const xmlChar *encoding;
+    int ret;
+
+    if ((fd < 0) || (result == NULL) || (style == NULL))
+	return(-1);
+    if (result->children == NULL)
+	return(0);
+
+    XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+    if (encoding != NULL) {
+	xmlCharEncodingHandlerPtr encoder;
+
+	encoder = xmlFindCharEncodingHandler((char *)encoding);
+	if ((encoder != NULL) &&
+	    (xmlStrEqual((const xmlChar *)encoder->name,
+			 (const xmlChar *) "UTF-8")))
+	    encoder = NULL;
+	buf = xmlOutputBufferCreateFd(fd, encoder);
+    } else {
+	buf = xmlOutputBufferCreateFd(fd, NULL);
+    }
+    if (buf == NULL)
+	return(-1);
+    xsltSaveResultTo(buf, result, style);
+    ret = xmlOutputBufferClose(buf);
+    return(ret);
+}
+
+/**
+ * xsltSaveResultToString:
+ * @doc_txt_ptr:  Memory pointer for allocated XML text
+ * @doc_txt_len:  Length of the generated XML text
+ * @result:  the result xmlDocPtr
+ * @style:  the stylesheet
+ *
+ * Save the result @result obtained by applying the @style stylesheet
+ * to a new allocated string.
+ *
+ * Returns 0 in case of success and -1 in case of error
+ */
+int
+xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, 
+		       xmlDocPtr result, xsltStylesheetPtr style) {
+    xmlOutputBufferPtr buf;
+    const xmlChar *encoding;
+
+    *doc_txt_ptr = NULL;
+    *doc_txt_len = 0;
+    if (result->children == NULL)
+	return(0);
+
+    XSLT_GET_IMPORT_PTR(encoding, style, encoding)
+    if (encoding != NULL) {
+	xmlCharEncodingHandlerPtr encoder;
+
+	encoder = xmlFindCharEncodingHandler((char *)encoding);
+	if ((encoder != NULL) &&
+	    (xmlStrEqual((const xmlChar *)encoder->name,
+			 (const xmlChar *) "UTF-8")))
+	    encoder = NULL;
+	buf = xmlAllocOutputBuffer(encoder);
+    } else {
+	buf = xmlAllocOutputBuffer(NULL);
+    }
+    if (buf == NULL)
+	return(-1);
+    xsltSaveResultTo(buf, result, style);
+    if (buf->conv != NULL) {
+	*doc_txt_len = buf->conv->use;
+	*doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
+    } else {
+	*doc_txt_len = buf->buffer->use;
+	*doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
+    }
+    (void)xmlOutputBufferClose(buf);
+    return 0;
+}
+
+/************************************************************************
+ * 									*
+ * 		Generating profiling informations			*
+ * 									*
+ ************************************************************************/
+
+static long calibration = -1;
+
+/**
+ * xsltCalibrateTimestamps:
+ *
+ * Used for to calibrate the xsltTimestamp() function
+ * Should work if launched at startup and we don't loose our quantum :-)
+ *
+ * Returns the number of milliseconds used by xsltTimestamp()
+ */
+static long
+xsltCalibrateTimestamps(void) {
+    register int i;
+
+    for (i = 0;i < 999;i++)
+	xsltTimestamp();
+    return(xsltTimestamp() / 1000);
+}
+
+/**
+ * xsltCalibrateAdjust:
+ * @delta:  a negative dealy value found
+ *
+ * Used for to correct the calibration for xsltTimestamp()
+ */
+void
+xsltCalibrateAdjust(long delta) {
+    calibration += delta;
+}
+
+/**
+ * xsltTimestamp:
+ *
+ * Used for gathering profiling data
+ *
+ * Returns the number of tenth of milliseconds since the beginning of the
+ * profiling
+ */
+long
+xsltTimestamp(void)
+{
+#ifdef XSLT_WIN32_PERFORMANCE_COUNTER
+    BOOL ok;
+    LARGE_INTEGER performanceCount;
+    LARGE_INTEGER performanceFrequency;
+    LONGLONG quadCount;
+    double seconds;
+    static LONGLONG startupQuadCount = 0;
+    static LONGLONG startupQuadFreq = 0;
+
+    ok = QueryPerformanceCounter(&performanceCount);
+    if (!ok)
+        return 0;
+    quadCount = performanceCount.QuadPart;
+    if (calibration < 0) {
+        calibration = 0;
+        ok = QueryPerformanceFrequency(&performanceFrequency);
+        if (!ok)
+            return 0;
+        startupQuadFreq = performanceFrequency.QuadPart;
+        startupQuadCount = quadCount;
+        return (0);
+    }
+    if (startupQuadFreq == 0)
+        return 0;
+    seconds = (quadCount - startupQuadCount) / (double) startupQuadFreq;
+    return (long) (seconds * XSLT_TIMESTAMP_TICS_PER_SEC);
+
+#else /* XSLT_WIN32_PERFORMANCE_COUNTER */
+#ifdef HAVE_GETTIMEOFDAY
+    static struct timeval startup;
+    struct timeval cur;
+    long tics;
+
+    if (calibration < 0) {
+        gettimeofday(&startup, NULL);
+        calibration = 0;
+        calibration = xsltCalibrateTimestamps();
+        gettimeofday(&startup, NULL);
+        return (0);
+    }
+
+    gettimeofday(&cur, NULL);
+    tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
+    tics += (cur.tv_usec - startup.tv_usec) /
+                          (1000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
+    
+    tics -= calibration;
+    return(tics);
+#else
+
+    /* Neither gettimeofday() nor Win32 performance counter available */
+
+    return (0);
+
+#endif /* HAVE_GETTIMEOFDAY */
+#endif /* XSLT_WIN32_PERFORMANCE_COUNTER */
+}
+
+#define MAX_TEMPLATES 10000
+
+/**
+ * xsltSaveProfiling:
+ * @ctxt:  an XSLT context
+ * @output:  a FILE * for saving the informations
+ *
+ * Save the profiling informations on @output
+ */
+void
+xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
+    int nb, i,j;
+    int max;
+    int total;
+    long totalt;
+    xsltTemplatePtr *templates;
+    xsltStylesheetPtr style;
+    xsltTemplatePtr template;
+
+    if ((output == NULL) || (ctxt == NULL))
+	return;
+    if (ctxt->profile == 0)
+	return;
+
+    nb = 0;
+    max = MAX_TEMPLATES;
+    templates = xmlMalloc(max * sizeof(xsltTemplatePtr));
+    if (templates == NULL)
+	return;
+
+    style = ctxt->style;
+    while (style != NULL) {
+	template = style->templates;
+	while (template != NULL) {
+	    if (nb >= max)
+		break;
+
+	    if (template->nbCalls > 0)
+		templates[nb++] = template;
+	    template = template->next;
+	}
+
+	style = xsltNextImport(style);
+    }
+
+    for (i = 0;i < nb -1;i++) {
+	for (j = i + 1; j < nb; j++) {
+	    if ((templates[i]->time <= templates[j]->time) ||
+		((templates[i]->time == templates[j]->time) &&
+	         (templates[i]->nbCalls <= templates[j]->nbCalls))) {
+		template = templates[j];
+		templates[j] = templates[i];
+		templates[i] = template;
+	    }
+	}
+    }
+
+    fprintf(output, "%6s%20s%20s%10s  Calls Tot 100us Avg\n\n",
+	    "number", "match", "name", "mode");
+    total = 0;
+    totalt = 0;
+    for (i = 0;i < nb;i++) {
+	fprintf(output, "%5d ", i);
+	if (templates[i]->match != NULL) {
+	    if (xmlStrlen(templates[i]->match) > 20)
+		fprintf(output, "%s\n%26s", templates[i]->match, "");
+	    else
+		fprintf(output, "%20s", templates[i]->match);
+	} else {
+	    fprintf(output, "%20s", "");
+	}
+	if (templates[i]->name != NULL) {
+	    if (xmlStrlen(templates[i]->name) > 20)
+		fprintf(output, "%s\n%46s", templates[i]->name, "");
+	    else
+		fprintf(output, "%20s", templates[i]->name);
+	} else {
+	    fprintf(output, "%20s", "");
+	}
+	if (templates[i]->mode != NULL) {
+	    if (xmlStrlen(templates[i]->mode) > 10)
+		fprintf(output, "%s\n%56s", templates[i]->mode, "");
+	    else
+		fprintf(output, "%10s", templates[i]->mode);
+	} else {
+	    fprintf(output, "%10s", "");
+	}
+	fprintf(output, " %6d", templates[i]->nbCalls);
+	fprintf(output, " %6ld %6ld\n", templates[i]->time,
+		templates[i]->time / templates[i]->nbCalls);
+	total += templates[i]->nbCalls;
+	totalt += templates[i]->time;
+    }
+    fprintf(output, "\n%30s%26s %6d %6ld\n", "Total", "", total, totalt);
+
+    xmlFree(templates);
+}
+
+/************************************************************************
+ * 									*
+ * 		Fetching profiling informations				*
+ * 									*
+ ************************************************************************/
+
+/**
+ * xsltGetProfileInformation:
+ * @ctxt:  a transformation context
+ *
+ * This function should be called after the transformation completed
+ * to extract template processing profiling informations if availble.
+ * The informations are returned as an XML document tree like
+ * 
+ * 
+ *