[librttopo] 02/06: Imported Upstream version 1.0.0~rc3

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sat May 7 10:51:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository librttopo.

commit 7fe69a69c9857dd411f14ad9de368e3a42e62c8f
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat May 7 12:36:00 2016 +0200

    Imported Upstream version 1.0.0~rc3
---
 .editorconfig                 |    20 +
 .gitignore                    |    34 +
 .gitlab-ci.yml                |    15 +
 CREDITS                       |     7 +
 ChangeLog                     |   716 ++
 HOWTO_RELEASE                 |    11 +
 Makefile.am                   |    15 +-
 Makefile.in                   |   856 --
 README.md                     |     7 +-
 aclocal.m4                    |  1219 ---
 autogen.sh                    |    95 +
 compile                       |   347 -
 config.guess                  |  1558 ----
 config.sub                    |  1791 ----
 configure                     | 20020 ----------------------------------------
 configure.ac                  |     2 +-
 depcomp                       |   791 --
 doc/BUILDING-ON-WINDOWS.md    |    46 +
 headers/Makefile.in           |   562 --
 headers/librttopo.h           |     4 +-
 headers/librttopo_geom.h      |  2202 -----
 headers/librttopo_geom.h.in   |   340 +-
 install-sh                    |   527 --
 ltmain.sh                     |  9661 -------------------
 m4/libtool.m4                 |  7997 ----------------
 m4/ltoptions.m4               |   384 -
 m4/ltsugar.m4                 |   123 -
 m4/ltversion.m4               |    23 -
 m4/lt~obsolete.m4             |    98 -
 missing                       |   215 -
 src/Makefile.in               |   753 --
 src/box2d.c                   |     6 +-
 src/bytebuffer.c              |   378 +-
 src/bytebuffer.h              |     8 +-
 src/g_box.c                   |   926 +-
 src/g_serialized.c            |  1968 ++--
 src/g_util.c                  |   312 +-
 src/librttopo_geom_internal.h |    38 +-
 src/measures.c                |  3606 ++++----
 src/measures.h                |    24 +-
 src/measures3d.c              |  2010 ++--
 src/measures3d.h              |    22 +-
 src/ptarray.c                 |  2630 +++---
 src/rtalgorithm.c             |  1276 +--
 src/rtcircstring.c            |   330 +-
 src/rtcollection.c            |   842 +-
 src/rtcompound.c              |   380 +-
 src/rtcurvepoly.c             |   196 +-
 src/rtgeodetic.c              |  5060 +++++-----
 src/rtgeodetic.h              |    14 +-
 src/rtgeom.c                  |  3080 +++----
 src/rtgeom_api.c              |   942 +-
 src/rtgeom_debug.c            |   224 +-
 src/rtgeom_geos.c             |  2255 ++---
 src/rtgeom_geos_clean.c       |  1658 ++--
 src/rtgeom_geos_node.c        |   390 +-
 src/rtgeom_geos_split.c       |   832 +-
 src/rtgeom_log.h              |     4 +-
 src/rtgeom_topo.c             |    16 +-
 src/rthomogenize.c            |   346 +-
 src/rtin_geojson.c            |   938 +-
 src/rtin_twkb.c               |   940 +-
 src/rtin_wkb.c                |  1134 +--
 src/rtiterator.c              |   278 +-
 src/rtline.c                  |   680 +-
 src/rtlinearreferencing.c     |  2308 ++---
 src/rtmline.c                 |   134 +-
 src/rtmpoint.c                |   114 +-
 src/rtmpoly.c                 |    28 +-
 src/rtout_encoded_polyline.c  |   152 +-
 src/rtout_geojson.c           |   878 +-
 src/rtout_gml.c               |  2846 +++---
 src/rtout_kml.c               |   256 +-
 src/rtout_svg.c               |   776 +-
 src/rtout_twkb.c              |   946 +-
 src/rtout_twkb.h              |    30 +-
 src/rtout_wkb.c               |  1278 +--
 src/rtout_wkt.c               |   968 +-
 src/rtout_x3d.c               |  1230 +--
 src/rtpoint.c                 |   228 +-
 src/rtpoly.c                  |   732 +-
 src/rtprint.c                 |   672 +-
 src/rtpsurface.c              |   276 +-
 src/rtspheroid.c              |   978 +-
 src/rtstroke.c                |  1366 +--
 src/rttin.c                   |   248 +-
 src/rttopo_config.h           |   169 -
 src/rttopo_config.h.in        |   168 -
 src/rttree.c                  |   336 +-
 src/rttree.h                  |    18 +-
 src/rttriangle.c              |   172 +-
 src/rtutil.c                  |   354 +-
 src/stringbuffer.c            |   360 +-
 src/stringbuffer.h            |     6 +-
 src/varint.c                  |   214 +-
 95 files changed, 26957 insertions(+), 75466 deletions(-)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..12c5e0e
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,20 @@
+# http://editorconfig.org
+
+# top-most EditorConfig file
+root = true
+
+# these are the defaults
+[*]
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+# C files want space
+[*.{c,h}]
+indent_style = space
+indent_size = 2
+
+# Makefiles want tab indentation
+[{Makefile.in,Makefile}]
+indent_style = tab
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1300bcc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
+*.zip
+*.gz
+*.ine
+*.ce
+*.he
+*.o
+*.lo
+*.la
+.libs/
+.deps/
+compile
+depcomp
+missing
+src/stamp-h1
+aclocal.m4
+rttopo.pc
+m4/
+Makefile
+Makefile.in
+autom4te.cache/
+config.guess
+config.log
+config.status
+config.sub
+configure
+install-sh
+librttopo_geom.h
+libtool
+ltmain.sh
+rtin_wkt_lex.c
+rtin_wkt_parse.c
+rtin_wkt_parse.h
+rttopo_config.h
+rttopo_config.h.in
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..3b43abb
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,15 @@
+test:
+  script:
+    - apt-get update -qq
+    - apt-get install -y build-essential autoconf libtool
+    - apt-get install -y zip # for make dist which also produces .zip
+    - apt-get install -y git2cl # for make dist which creates ChangeLog
+    - echo deb http://ftp.debian.org/debian sid main >> /etc/apt/sources.list
+    - apt-get update -qq
+    - apt-cache search libgeos
+    - apt-get install -t sid -y libgeos-dev
+    - geos-config --version || true
+    - ./autogen.sh
+    - ./configure
+    - make
+    - make distcheck
diff --git a/CREDITS b/CREDITS
index bf6185c..718a7f3 100644
--- a/CREDITS
+++ b/CREDITS
@@ -5,4 +5,11 @@ The library is based on version 2.2 of PostGIS's liblwgeom,
 which had contributions by many individual and corporate contributions,
 see http://postgis.net/docs/manual-2.2/postgis_introduction.html
 
+Debian packages were created by Bas Couwenberg
+
+Project Steering Committee is formed by:
+
+    Andrea Peri (Regione Toscana)
+    Sandro Santilli (PostGIS)
+    Alessandro Furieri (Spatialite)
 
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..ac72b8c
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,716 @@
+2016-05-07  Sandro Santilli <strk at keybit.net>
+
+	* HOWTO_RELEASE, Makefile.am: Rework ChangeLog generation rule Generation target is now "cl" and also works when build dir is not
+	below source dir.  ChangeLog is pushed to repo.
+
+2016-05-07  Sandro Santilli <strk at keybit.net>
+
+	* .gitignore: Ignore more generated files
+
+2016-05-07  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Set version to 1.0.0-RC3 (and update admin email)
+
+2016-05-07  Sandro Santilli <strk at keybit.net>
+
+	* src/rtutil.c: Release GEOS context on rtgeom_finish Patch by Alessandro Furieri
+
+2016-05-07  Sandro Santilli <strk at keybit.net>
+
+	* headers/librttopo_geom.h.in: Rewrite the introductory section of
+	docs
+
+2016-05-06  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_geos.c: Do not override pre-initialized GEOS handler in
+	rttopo context Fixes leaks of GEOS contexts.  Thanks Alessandro Furieri for
+	spotting this.
+
+2016-05-06  Sandro Santilli <strk at keybit.net>
+
+	* .editorconfig, headers/librttopo.h, headers/librttopo_geom.h.in,
+	src/box2d.c, src/bytebuffer.c, src/bytebuffer.h, src/g_box.c,
+	src/g_serialized.c, src/g_util.c, src/librttopo_geom_internal.h,
+	src/measures.c, src/measures.h, src/measures3d.c, src/measures3d.h,
+	src/ptarray.c, src/rtalgorithm.c, src/rtcircstring.c,
+	src/rtcollection.c, src/rtcompound.c, src/rtcurvepoly.c,
+	src/rtgeodetic.c, src/rtgeodetic.h, src/rtgeom.c, src/rtgeom_api.c,
+	src/rtgeom_debug.c, src/rtgeom_geos.c, src/rtgeom_geos_clean.c,
+	src/rtgeom_geos_node.c, src/rtgeom_geos_split.c, src/rtgeom_log.h,
+	src/rtgeom_topo.c, src/rthomogenize.c, src/rtin_geojson.c,
+	src/rtin_twkb.c, src/rtin_wkb.c, src/rtiterator.c, src/rtline.c,
+	src/rtlinearreferencing.c, src/rtmline.c, src/rtmpoint.c,
+	src/rtmpoly.c, src/rtout_encoded_polyline.c, src/rtout_geojson.c,
+	src/rtout_gml.c, src/rtout_kml.c, src/rtout_svg.c,
+	src/rtout_twkb.c, src/rtout_twkb.h, src/rtout_wkb.c,
+	src/rtout_wkt.c, src/rtout_x3d.c, src/rtpoint.c, src/rtpoly.c,
+	src/rtprint.c, src/rtpsurface.c, src/rtspheroid.c, src/rtstroke.c,
+	src/rttin.c, src/rttree.c, src/rttree.h, src/rttriangle.c,
+	src/rtutil.c, src/stringbuffer.c, src/stringbuffer.h, src/varint.c: 
+	Style only commit: use 2-spaces instead of tabs, trim ending
+	newlines
+
+2016-05-03  Sandro Santilli <strk at keybit.net>
+
+	* HOWTO_RELEASE: Add upload destination
+
+2016-05-01  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: Have gitlab-ci install git2cl
+
+2016-05-01  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.am: Include an auto-generated ChangeLog file in
+	distribution Closes #9
+
+2016-04-30  Sandro Santilli <strk at keybit.net>
+
+	* CREDITS: Add PSC info
+
+2016-04-30  Sandro Santilli <strk at keybit.net>
+
+	* CREDITS: Add Bas credits
+
+2016-04-30  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Add link to development mailing list
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Use markdown link for windows build reference
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.am, README.md, doc/BUILDING-ON-WINDOWS.md: Add windows
+	build instructions
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: Install zip tool for dist
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* HOWTO_RELEASE: Tweak instruction to push annotated tag
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* HOWTO_RELEASE: Add HOWTO_RELEASE file This is not distributed as part of the tarball
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: Have gitlab-ci run distcheck The 'distcheck' rule will test for install/uninstall targets
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Add license info
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* CREDITS, Makefile.am, doc/g_serialized.txt, g_serialized.txt: Add
+	credits, move g_serialized under doc
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Set version to 1.0.0-RC2
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Drop trailing newlines, as per .editorconfig
+
+2016-04-26  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.am: Distribute DATASTORES.md
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* README.md, doc/DATASTORES.md: Add list of known data stores
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Reword about section
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* src/rtprint.c: Do not use dynamic arrays
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Reword the About part
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.am, README.md, README.topo: Merge the two readmes, add
+	info about building
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* src/Makefile.am: Remove unexistent file from noinst_HEADERS
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* makefile.vc, nmake.opt: Add build scripts for MSVC Files provided by Alessandro Furieri
+
+2016-04-25  Sandro Santilli <strk at keybit.net>
+
+	* src/Makefile.am, src/rtgeodetic_tree.c, src/rtgeodetic_tree.h: 
+	Drop unused geodetic tree files
+
+2016-04-25  Alessandro Furieri <a.furieri at lqt.it>
+
+	* .gitignore, Makefile, Makefile.am, Version.config, aclocal.m4,
+	autogen.sh, configure.ac, headers/Makefile.am, headers/librttopo.h,
+	headers/librttopo_geom.h.in, macros/intltool.m4, macros/lib-ld.m4,
+	macros/lib-link.m4, macros/lib-prefix.m4, macros/libtool.m4,
+	macros/ltoptions.m4, macros/ltsugar.m4, macros/ltversion.m4,
+	macros/lt~obsolete.m4, macros/po.m4, macros/progtest.m4,
+	rttopo.pc.in, src/Makefile.am, src/Makefile.in, src/librttopo.h,
+	src/librttopo_geom.h.in, src/librttopo_geom_internal.h,
+	src/rttopo_config.h.in: Switch to automake based builds
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/librttopo_geom.h.in: Update copyright info
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/librttopo_geom.h.in: Remove trailing spaces
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Update copyright notice
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Remove trailing spaces
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* .editorconfig: Add an EditorConfig configuration See http://editorconfig.org/
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Add last port info
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Fix debug print
+
+2016-04-21  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: rtt_AddEdge*: avoid db access for edges known
+	to be dangling
+
+2016-04-20  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Fix bogus port of side-location-conflict check Rectifies 891d7bb0b5f25bf73ccd3a304febd96b59279527
+
+2016-04-20  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Improves snapping robustness See http://trac.osgeo.org/postgis/ticket/3402
+
+2016-04-20  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Fixes geometry-intersects-edge exception when
+	snapping twice to the same pointset.  See http://trac.osgeo.org/postgis/ticket/3412
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Add a mention of the gilab.com mirror
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Add link to osgeo/gogs as official code repo
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac, src/Makefile.in, src/box2d.c, src/bytebuffer.c,
+	src/bytebuffer.h, src/g_box.c, src/g_serialized.c, src/g_util.c,
+	src/librttopo.h, src/librttopo_geom.h.in,
+	src/librttopo_geom_internal.h, src/librttopo_internal.h,
+	src/measures.c, src/measures.h, src/measures3d.c, src/measures3d.h,
+	src/ptarray.c, src/rtalgorithm.c, src/rtcircstring.c,
+	src/rtcollection.c, src/rtcompound.c, src/rtcurvepoly.c,
+	src/rtgeodetic.c, src/rtgeodetic.h, src/rtgeodetic_tree.c,
+	src/rtgeodetic_tree.h, src/rtgeom.c, src/rtgeom_api.c,
+	src/rtgeom_debug.c, src/rtgeom_geos.c, src/rtgeom_geos.h,
+	src/rtgeom_geos_clean.c, src/rtgeom_geos_node.c,
+	src/rtgeom_geos_split.c, src/rtgeom_log.h, src/rtgeom_topo.c,
+	src/rthomogenize.c, src/rtin_geojson.c, src/rtin_twkb.c,
+	src/rtin_wkb.c, src/rtiterator.c, src/rtline.c,
+	src/rtlinearreferencing.c, src/rtmcurve.c, src/rtmline.c,
+	src/rtmpoint.c, src/rtmpoly.c, src/rtmsurface.c,
+	src/rtout_encoded_polyline.c, src/rtout_geojson.c, src/rtout_gml.c,
+	src/rtout_kml.c, src/rtout_svg.c, src/rtout_twkb.c,
+	src/rtout_twkb.h, src/rtout_wkb.c, src/rtout_wkt.c,
+	src/rtout_x3d.c, src/rtpoint.c, src/rtpoly.c, src/rtprint.c,
+	src/rtpsurface.c, src/rtspheroid.c, src/rtstroke.c, src/rttin.c,
+	src/rttopo_config.h.in, src/rttree.c, src/rttree.h,
+	src/rttriangle.c, src/rtutil.c, src/stringbuffer.c,
+	src/stringbuffer.h, src/varint.c, src/varint.h: Update homepage to
+	use osgeo/gogs
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* src/box2d.c, src/rtgeodetic_tree.c, src/rtgeodetic_tree.h,
+	src/rtprint.c, src/rttopo_config.h.in, src/rttree.c, src/rttree.h,
+	src/rtutil.c: Add missing copyright notices
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* src/librttopo_geom.h.in, src/rtutil.c: Add rtgeom_finish function,
+	and improve dox for rtgeom_init
+
+2016-04-19  Sandro Santilli <strk at keybit.net>
+
+	* src/rtutil.c: Allow calling rtgeom_init with all null pointers
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Fix crash on face-collapsing edge change See https://trac.osgeo.org/postgis/ticket/3463
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Check for side-location conflicts when adding a
+	new edge It is possible to trigger such failure adding an edge to a corrupted
+	topology. Test added.  See https://trac.osgeo.org/postgis/ticket/3464
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: PRId64 to RTTFMT_ELEMID
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* src/rtgeom_topo.c: Give more decimal digits in edge-motion
+	collision detection point
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* .gitignore, README.topo, configure.ac, src/Makefile.in,
+	src/box2d.c, src/bytebuffer.c, src/g_box.c, src/g_serialized.c,
+	src/g_util.c, src/librtgeom.h.in, src/librtgeom_internal.h,
+	src/librtgeom_topo.h, src/librtgeom_topo_internal.h,
+	src/librttopo.h, src/librttopo_geom.h.in,
+	src/librttopo_geom_internal.h, src/librttopo_internal.h,
+	src/measures.h, src/ptarray.c, src/rtalgorithm.c,
+	src/rtcircstring.c, src/rtcollection.c, src/rtcompound.c,
+	src/rtcurvepoly.c, src/rtgeodetic.c, src/rtgeodetic_tree.c,
+	src/rtgeom.c, src/rtgeom_api.c, src/rtgeom_debug.c,
+	src/rtgeom_geos.c, src/rtgeom_geos.h, src/rtgeom_geos_clean.c,
+	src/rtgeom_geos_node.c, src/rtgeom_geos_split.c, src/rtgeom_log.h,
+	src/rtgeom_topo.c, src/rthomogenize.c, src/rtin_geojson.c,
+	src/rtin_twkb.c, src/rtin_wkb.c, src/rtiterator.c, src/rtline.c,
+	src/rtlinearreferencing.c, src/rtmcurve.c, src/rtmline.c,
+	src/rtmpoint.c, src/rtmpoly.c, src/rtmsurface.c,
+	src/rtout_encoded_polyline.c, src/rtout_geojson.c, src/rtout_gml.c,
+	src/rtout_kml.c, src/rtout_svg.c, src/rtout_twkb.h,
+	src/rtout_wkb.c, src/rtout_wkt.c, src/rtout_x3d.c, src/rtpoint.c,
+	src/rtpoly.c, src/rtprint.c, src/rtpsurface.c, src/rtspheroid.c,
+	src/rtstroke.c, src/rttin.c, src/rttree.c, src/rttriangle.c,
+	src/rtutil.c, src/stringbuffer.c, src/stringbuffer.h, src/varint.c,
+	src/varint.h: Rename librtgeom to librttopo Renames:  librtgeom.h to librttopo_geom.h  librtgeom_internal.h to librttopo_geom_internal.h  librtgeom_topo*.h to librttopo*.h  librtgeom.{so,a} to librttopo.{so,a} See #1
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Require GEOS-3.5.0 as the minimum version
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: Install geos-3.5.0
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Update build badge
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* Makefile: Do not make "clean" and "uninstall" dependent on running
+	configure Fixes #2
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* src/Makefile.in: Include varint module in the build
+
+2016-04-18  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Drop references to PostGIS/liblwgeom
+
+2015-12-15  Sandro Santilli <strk at keybit.net>
+
+	* Makefile: Add missing Makefile
+
+2015-12-15  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: See which version of GEOS are available
+
+2015-12-15  Sandro Santilli <strk at keybit.net>
+
+	* src/Makefile.in: Fix clean rule
+
+2015-12-15  Sandro Santilli <strk at keybit.net>
+
+	* src/librtgeom.h.in, src/rtutil.c: Remove the possibility to use a
+	pre-initialized GEOS context This is to allow for intercepting geos messages from the library,
+	which would otherwise require changing the passed context.
+
+2015-12-14  Sandro Santilli <strk at keybit.net>
+
+	* .gitignore: Ignore the right Makefile, not the root one
+
+2015-12-14  Sandro Santilli <strk at keybit.net>
+
+	* src/box2d.c, src/bytebuffer.c, src/bytebuffer.h, src/g_box.c,
+	src/g_serialized.c, src/g_util.c, src/librtgeom.h.in,
+	src/librtgeom_internal.h, src/librtgeom_topo.h,
+	src/librtgeom_topo_internal.h, src/measures.c, src/measures.h,
+	src/measures3d.c, src/measures3d.h, src/ptarray.c,
+	src/rtalgorithm.c, src/rtcircstring.c, src/rtcollection.c,
+	src/rtcompound.c, src/rtcurvepoly.c, src/rtgeodetic.c,
+	src/rtgeodetic.h, src/rtgeodetic_tree.c, src/rtgeodetic_tree.h,
+	src/rtgeom.c, src/rtgeom_api.c, src/rtgeom_debug.c,
+	src/rtgeom_geos.c, src/rtgeom_geos.h, src/rtgeom_geos_clean.c,
+	src/rtgeom_geos_node.c, src/rtgeom_geos_split.c, src/rtgeom_log.h,
+	src/rtgeom_topo.c, src/rthomogenize.c, src/rtin_geojson.c,
+	src/rtin_twkb.c, src/rtin_wkb.c, src/rtiterator.c, src/rtline.c,
+	src/rtlinearreferencing.c, src/rtmcurve.c, src/rtmline.c,
+	src/rtmpoint.c, src/rtmpoly.c, src/rtmsurface.c,
+	src/rtout_encoded_polyline.c, src/rtout_geojson.c, src/rtout_gml.c,
+	src/rtout_kml.c, src/rtout_svg.c, src/rtout_twkb.c,
+	src/rtout_twkb.h, src/rtout_wkb.c, src/rtout_wkt.c,
+	src/rtout_x3d.c, src/rtpoint.c, src/rtpoly.c, src/rtprint.c,
+	src/rtpsurface.c, src/rtspheroid.c, src/rtstroke.c, src/rttin.c,
+	src/rttopo_config.h.in, src/rttree.c, src/rttree.h,
+	src/rttriangle.c, src/rtutil.c, src/snprintf.c, src/stringbuffer.c,
+	src/stringbuffer.h, src/varint.c, src/varint.h: Update copyright
+	headers
+
+2015-12-14  Sandro Santilli <strk at keybit.net>
+
+	* COPYING: Add COPYING file
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* README.md: Add build status badge
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* TODO: Remove done item
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* src/librtgeom.h.in, src/librtgeom_internal.h, src/rtutil.c: Fix
+	re-entrancy of custom allocators and loggers
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* TODO: Updated
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, box2d.c, bytebuffer.c, bytebuffer.h, configure.ac,
+	g_box.c, g_serialized.c, g_util.c, librtgeom.h.in,
+	librtgeom_internal.h, librtgeom_topo.h, librtgeom_topo_internal.h,
+	measures.c, measures.h, measures3d.c, measures3d.h, ptarray.c,
+	rtalgorithm.c, rtcircstring.c, rtcollection.c, rtcompound.c,
+	rtcurvepoly.c, rtgeodetic.c, rtgeodetic.h, rtgeodetic_tree.c,
+	rtgeodetic_tree.h, rtgeom.c, rtgeom_api.c, rtgeom_debug.c,
+	rtgeom_geos.c, rtgeom_geos.h, rtgeom_geos_clean.c,
+	rtgeom_geos_node.c, rtgeom_geos_split.c, rtgeom_log.h,
+	rtgeom_topo.c, rthomogenize.c, rtin_geojson.c, rtin_twkb.c,
+	rtin_wkb.c, rtiterator.c, rtline.c, rtlinearreferencing.c,
+	rtmcurve.c, rtmline.c, rtmpoint.c, rtmpoly.c, rtmsurface.c,
+	rtout_encoded_polyline.c, rtout_geojson.c, rtout_gml.c,
+	rtout_kml.c, rtout_svg.c, rtout_twkb.c, rtout_twkb.h, rtout_wkb.c,
+	rtout_wkt.c, rtout_x3d.c, rtpoint.c, rtpoly.c, rtprint.c,
+	rtpsurface.c, rtspheroid.c, rtstroke.c, rttin.c,
+	rttopo_config.h.in, rttree.c, rttree.h, rttriangle.c, rtutil.c,
+	snprintf.c, src/Makefile.in, src/box2d.c, src/bytebuffer.c,
+	src/bytebuffer.h, src/g_box.c, src/g_serialized.c, src/g_util.c,
+	src/librtgeom.h.in, src/librtgeom_internal.h, src/librtgeom_topo.h,
+	src/librtgeom_topo_internal.h, src/measures.c, src/measures.h,
+	src/measures3d.c, src/measures3d.h, src/ptarray.c,
+	src/rtalgorithm.c, src/rtcircstring.c, src/rtcollection.c,
+	src/rtcompound.c, src/rtcurvepoly.c, src/rtgeodetic.c,
+	src/rtgeodetic.h, src/rtgeodetic_tree.c, src/rtgeodetic_tree.h,
+	src/rtgeom.c, src/rtgeom_api.c, src/rtgeom_debug.c,
+	src/rtgeom_geos.c, src/rtgeom_geos.h, src/rtgeom_geos_clean.c,
+	src/rtgeom_geos_node.c, src/rtgeom_geos_split.c, src/rtgeom_log.h,
+	src/rtgeom_topo.c, src/rthomogenize.c, src/rtin_geojson.c,
+	src/rtin_twkb.c, src/rtin_wkb.c, src/rtiterator.c, src/rtline.c,
+	src/rtlinearreferencing.c, src/rtmcurve.c, src/rtmline.c,
+	src/rtmpoint.c, src/rtmpoly.c, src/rtmsurface.c,
+	src/rtout_encoded_polyline.c, src/rtout_geojson.c, src/rtout_gml.c,
+	src/rtout_kml.c, src/rtout_svg.c, src/rtout_twkb.c,
+	src/rtout_twkb.h, src/rtout_wkb.c, src/rtout_wkt.c,
+	src/rtout_x3d.c, src/rtpoint.c, src/rtpoly.c, src/rtprint.c,
+	src/rtpsurface.c, src/rtspheroid.c, src/rtstroke.c, src/rttin.c,
+	src/rttopo_config.h.in, src/rttree.c, src/rttree.h,
+	src/rttriangle.c, src/rtutil.c, src/snprintf.c, src/stringbuffer.c,
+	src/stringbuffer.h, src/varint.c, src/varint.h, stringbuffer.c,
+	stringbuffer.h, varint.c, varint.h: Move sources under a src/ dir
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in, librtgeom_internal.h, ptarray.c, rtgeom.c: Prefix
+	AFFINE
+
+2015-12-12  Sandro Santilli <strk at keybit.net>
+
+	* g_box.c, g_serialized.c, librtgeom.h.in, measures.c,
+	measures3d.c, ptarray.c, rtalgorithm.c, rtcircstring.c,
+	rtcompound.c, rtgeodetic.c, rtgeodetic_tree.c, rtgeom.c,
+	rtgeom_api.c, rtgeom_geos.c, rtgeom_geos_clean.c,
+	rtgeom_geos_split.c, rtgeom_topo.c, rtin_twkb.c, rtin_wkb.c,
+	rtiterator.c, rtline.c, rtlinearreferencing.c, rtmpoint.c,
+	rtout_encoded_polyline.c, rtout_geojson.c, rtout_gml.c,
+	rtout_kml.c, rtout_svg.c, rtout_twkb.c, rtout_wkb.c, rtout_wkt.c,
+	rtout_x3d.c, rtpoint.c, rtprint.c, rtpsurface.c, rtspheroid.c,
+	rtstroke.c, rttin.c, rttree.c, rttriangle.c: Prefix getPoint* with
+	rt_
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, librtgeom.h.in, rtgeodetic.c, rtgeodetic.h,
+	rtgeodetic_tree.c, rtgeodetic_tree.h, rtspheroid.c: Revert "Remove
+	geodetic and spheroid functions" This reverts commit cb34f54ca9c15ad2d65eac67dfdd5e94eae475f3.  Conflicts: 	Makefile.in Also adapted all signatures to re-entrancy mode.  Closes #1
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* TODO: Add more missing symbols from spatialite
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* TODO: Add list of function to expose to public API
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* macros/codeset.m4, macros/gettext.m4, macros/gtk-2.0.m4,
+	macros/iconv.m4, macros/intl.m4, macros/intldir.m4,
+	macros/intlmacosx.m4, macros/nls.m4: Remove some unused macros
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, aclocal.m4, configure.ac, librtgeom_internal.h,
+	macros/ac_proj4_version.m4, rtgeom_transform.c: Drop PROJ4
+	dependency, and reprojection support
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac: Relax GEOS requirement to accept 3.4.0 (mainly for
+	gitlab testing)
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* configure.ac, librtgeom.h.in, librtgeom_internal.h,
+	rtgeom_geos.h, rtgeom_geos_split.c: Ensure only the re-entrant API
+	is used Raises GEOS requirement to 3.5.0
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* .gitlab-ci.yml: Stop using lsb_release on gitlab-ci
+
+2015-12-11  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom_internal.h, rtgeom_geos.c, rtgeom_geos.h,
+	rtgeom_geos_clean.c, rtgeom_geos_node.c, rtgeom_geos_split.c,
+	rtgeom_topo.c: Make handling of GEOS errors re-entrant
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom_topo.h: Add info about how to create RTCTX
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in, rtgeom_geos.c, rtgeom_geos.h,
+	rtgeom_geos_clean.c, rtgeom_geos_node.c, rtgeom_geos_split.c: Switch
+	to reentrant GEOS interface in rtgeom
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in, rtgeom_api.c, rtutil.c: Add RTCTX initializing
+	functions
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom_internal.h, librtgeom_topo_internal.h, rtgeom_geos.c,
+	rtgeom_geos.h, rtgeom_topo.c: Switch to reentrant GEOS interface in
+	rtgeom_topo
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom_topo.h, rtgeom_topo.c: Take RTCTX at
+	rtt_CreateBackendIface time
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* box2d.c, bytebuffer.c, bytebuffer.h, g_box.c, g_serialized.c,
+	g_util.c, librtgeom.h.in, librtgeom_internal.h, librtgeom_topo.h,
+	measures.c, measures.h, measures3d.c, measures3d.h, ptarray.c,
+	rtalgorithm.c, rtcircstring.c, rtcollection.c, rtcompound.c,
+	rtcurvepoly.c, rtgeom.c, rtgeom_api.c, rtgeom_debug.c,
+	rtgeom_geos.c, rtgeom_geos.h, rtgeom_geos_clean.c,
+	rtgeom_geos_node.c, rtgeom_geos_split.c, rtgeom_log.h,
+	rtgeom_topo.c, rtgeom_transform.c, rthomogenize.c, rtin_geojson.c,
+	rtin_twkb.c, rtin_wkb.c, rtiterator.c, rtline.c,
+	rtlinearreferencing.c, rtmline.c, rtmpoint.c, rtmpoly.c,
+	rtout_encoded_polyline.c, rtout_geojson.c, rtout_gml.c,
+	rtout_kml.c, rtout_svg.c, rtout_twkb.c, rtout_twkb.h, rtout_wkb.c,
+	rtout_wkt.c, rtout_x3d.c, rtpoint.c, rtpoly.c, rtprint.c,
+	rtpsurface.c, rtstroke.c, rttin.c, rttree.c, rttree.h,
+	rttriangle.c, rtutil.c, stringbuffer.c, stringbuffer.h, varint.c,
+	varint.h: Made all RTCTX params const
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* rtgeom_log.h, rtgeom_topo.c, rtutil.c: Const correct
+	rtnotice/rtdebug
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* g_box.c: do not redefine isfinite
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, librtgeom.h.in, rtgeom_geos.h,
+	rtgeom_geos_cluster.c, rtin_encoded_polyline.c, rtunionfind.c,
+	rtunionfind.h: Remove polyline encoding and clustering functions
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* box2d.c, bytebuffer.c, bytebuffer.h, g_box.c, g_serialized.c,
+	g_util.c, librtgeom.h.in, librtgeom_internal.h, librtgeom_topo.h,
+	librtgeom_topo_internal.h, measures.c, measures.h, measures3d.c,
+	measures3d.h, ptarray.c, rtalgorithm.c, rtcircstring.c,
+	rtcollection.c, rtcompound.c, rtcurvepoly.c, rtgeom.c,
+	rtgeom_api.c, rtgeom_debug.c, rtgeom_geos.c, rtgeom_geos.h,
+	rtgeom_geos_clean.c, rtgeom_geos_cluster.c, rtgeom_geos_node.c,
+	rtgeom_geos_split.c, rtgeom_log.h, rtgeom_topo.c,
+	rtgeom_transform.c, rthomogenize.c, rtin_encoded_polyline.c,
+	rtin_geojson.c, rtin_twkb.c, rtin_wkb.c, rtiterator.c, rtline.c,
+	rtlinearreferencing.c, rtmline.c, rtmpoint.c, rtmpoly.c,
+	rtout_encoded_polyline.c, rtout_geojson.c, rtout_gml.c,
+	rtout_kml.c, rtout_svg.c, rtout_twkb.c, rtout_twkb.h, rtout_wkb.c,
+	rtout_wkt.c, rtout_x3d.c, rtpoint.c, rtpoly.c, rtprint.c,
+	rtpsurface.c, rtstroke.c, rttin.c, rttree.c, rttree.h,
+	rttriangle.c, rtunionfind.c, rtunionfind.h, rtutil.c,
+	stringbuffer.c, stringbuffer.h, varint.c, varint.h: Add RTCTX
+	argument to all exposed functions
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, effectivearea.c, effectivearea.h: Drop effective area
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* rtgeom_geos.c: Use custom geos error reporter
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* rtgeom_log.h, stringbuffer.h: Include internal header
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, librtgeom.h.in, rtgeodetic.c, rtgeodetic.h,
+	rtgeodetic_tree.c, rtgeodetic_tree.h, rtspheroid.c: Remove geodetic
+	and spheroid functions
+
+2015-12-10  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, librtgeom.h.in, rtin_wkt.c, rtin_wkt.h,
+	rtin_wkt_lex.l, rtin_wkt_parse.y: Remove WKT parser
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in, librtgeom_internal.h: Add RTCTX typedef
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in: Fix librtgeom.h build rule
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* effectivearea.c, g_box.c, g_serialized.c, g_util.c,
+	librtgeom.h.in, ptarray.c, rtcircstring.c, rtcollection.c,
+	rtcompound.c, rtgeodetic.c, rtgeom.c, rtgeom_api.c, rtgeom_debug.c,
+	rtgeom_geos.c, rtgeom_geos_clean.c, rtgeom_geos_node.c,
+	rtgeom_geos_split.c, rthomogenize.c, rtin_geojson.c, rtin_wkt.c,
+	rtline.c, rtlinearreferencing.c, rtmline.c, rtout_geojson.c,
+	rtout_gml.c, rtout_kml.c, rtout_twkb.c, rtout_wkb.c, rtout_wkt.c,
+	rtout_x3d.c, rtpoint.c, rtpoly.c, rtpsurface.c, rtstroke.c,
+	rttin.c, rttriangle.c: Prefix TYPMOD and FLAG macros
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* effectivearea.c, effectivearea.h, g_box.c, g_serialized.c,
+	librtgeom.h.in, librtgeom_internal.h, measures.c, measures.h,
+	measures3d.c, measures3d.h, ptarray.c, rtalgorithm.c,
+	rtcircstring.c, rtcollection.c, rtcompound.c, rtgeodetic.c,
+	rtgeodetic.h, rtgeodetic_tree.c, rtgeodetic_tree.h, rtgeom.c,
+	rtgeom_api.c, rtgeom_geos.c, rtgeom_geos.h, rtgeom_geos_clean.c,
+	rtgeom_geos_split.c, rtgeom_topo.c, rtgeom_transform.c,
+	rtin_encoded_polyline.c, rtin_geojson.c, rtin_twkb.c, rtin_wkb.c,
+	rtin_wkt.c, rtin_wkt.h, rtin_wkt_parse.y, rtiterator.c, rtline.c,
+	rtlinearreferencing.c, rtmpoint.c, rtout_encoded_polyline.c,
+	rtout_geojson.c, rtout_gml.c, rtout_kml.c, rtout_svg.c,
+	rtout_twkb.c, rtout_wkb.c, rtout_wkt.c, rtout_x3d.c, rtpoint.c,
+	rtpoly.c, rtspheroid.c, rtstroke.c, rttree.c, rttree.h,
+	rttriangle.c: Prefix POINTARRAY
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* box2d.c, effectivearea.c, g_box.c, g_serialized.c,
+	librtgeom.h.in, librtgeom_internal.h, librtgeom_topo.h, measures.c,
+	measures.h, measures3d.c, measures3d.h, ptarray.c, rtalgorithm.c,
+	rtcircstring.c, rtcollection.c, rtcompound.c, rtgeodetic.c,
+	rtgeodetic.h, rtgeodetic_tree.c, rtgeodetic_tree.h, rtgeom.c,
+	rtgeom_api.c, rtgeom_geos.c, rtgeom_geos.h, rtgeom_geos_cluster.c,
+	rtgeom_geos_split.c, rtgeom_topo.c, rtgeom_transform.c,
+	rtin_encoded_polyline.c, rtin_geojson.c, rtin_twkb.c, rtin_wkb.c,
+	rtin_wkt.c, rtiterator.c, rtline.c, rtlinearreferencing.c,
+	rtmpoint.c, rtout_encoded_polyline.c, rtout_geojson.c, rtout_gml.c,
+	rtout_kml.c, rtout_svg.c, rtout_x3d.c, rtpoint.c, rtpoly.c,
+	rtprint.c, rtpsurface.c, rtspheroid.c, rtstroke.c, rttin.c,
+	rttree.c, rttree.h, rttriangle.c: Prefix GBOX and POINT*
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in: Remove unused macros
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* librtgeom.h.in, librtgeom_internal.h, rtgeom.c, rthomogenize.c: 
+	Prefix NUMTYPES
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* bytebuffer.c, g_serialized.c, g_serialized.txt, librtgeom.h.in,
+	librtgeom_internal.h, rtgeom.c, rtgeom_topo.c, rtin_twkb.c,
+	rtin_wkb.c, rtin_wkt.c, rtin_wkt.h, rtin_wkt_lex.l,
+	rtin_wkt_parse.y, rtout_wkb.c, rtout_wkt.c: Prefix WKT/WKB macros
+	with "RT"
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* effectivearea.c, g_box.c, g_serialized.c, g_util.c,
+	librtgeom.h.in, librtgeom_internal.h, measures.c, measures3d.c,
+	rtalgorithm.c, rtcircstring.c, rtcollection.c, rtcompound.c,
+	rtcurvepoly.c, rtgeodetic.c, rtgeodetic_tree.c, rtgeom.c,
+	rtgeom_debug.c, rtgeom_geos.c, rtgeom_geos_clean.c,
+	rtgeom_geos_cluster.c, rtgeom_geos_node.c, rtgeom_geos_split.c,
+	rtgeom_topo.c, rtgeom_transform.c, rthomogenize.c, rtin_geojson.c,
+	rtin_twkb.c, rtin_wkb.c, rtin_wkt.c, rtin_wkt_parse.y,
+	rtiterator.c, rtline.c, rtlinearreferencing.c, rtmline.c,
+	rtmpoint.c, rtmpoly.c, rtout_encoded_polyline.c, rtout_geojson.c,
+	rtout_gml.c, rtout_kml.c, rtout_svg.c, rtout_twkb.c, rtout_twkb.h,
+	rtout_wkb.c, rtout_wkt.c, rtout_x3d.c, rtpoint.c, rtpoly.c,
+	rtpsurface.c, rtspheroid.c, rtstroke.c, rttin.c, rttriangle.c: 
+	Prefix geometry type macros with RT
+
+2015-12-09  Sandro Santilli <strk at keybit.net>
+
+	* Makefile.in, configure.ac, rtgeom_sfcgal.c, rtgeom_sfcgal.h: 
+	Remove SFCGAL support
+
+2015-12-01  Sandro Santilli <strk at keybit.net>
+
+	* Initial import
+
diff --git a/HOWTO_RELEASE b/HOWTO_RELEASE
new file mode 100644
index 0000000..da92e13
--- /dev/null
+++ b/HOWTO_RELEASE
@@ -0,0 +1,11 @@
+- Set version in configure.ac
+- Run make distcheck, fix if needed
+- Commit all of the above
+- Regenerate ChangeLog (make cl) and commit again
+- Commit and push to repository, confirm bots are all happy
+- Add annotated tag: git tag -sa librttopo-<version>
+- Push annotated tag to repository: git push <remote> librttopo-<version>
+- Create release artifacts: make dist
+- Upload release artifacts to upload.osgeo.org
+- Update websites (to be defined)
+- Announce on discuss at lists.osgeo.org
diff --git a/Makefile.am b/Makefile.am
index 281c5cf..f044fcb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,12 +2,21 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = src headers
 
-EXTRA_DIST = makefile.vc nmake.opt \
-	README.md CREDITS \
-  doc/DATASTORES.md doc/g_serialized.txt
+EXTRA_DIST = \
+  ChangeLog \
+  CREDITS \
+  doc/BUILDING-ON-WINDOWS.md \
+  doc/DATASTORES.md \
+  doc/g_serialized.txt \
+  makefile.vc \
+  nmake.opt \
+	README.md
 
 AUTOMAKE_OPTIONS = dist-zip foreign
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = rttopo.pc
 
+cl:
+	cd $(srcdir) && git2cl > ChangeLog
+
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 7f80e89..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,856 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in 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.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/configure $(am__configure_deps) \
-	$(srcdir)/rttopo.pc.in COPYING TODO compile config.guess \
-	config.sub depcomp install-sh missing ltmain.sh
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/rttopo_config.h
-CONFIG_CLEAN_FILES = rttopo.pc
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
-	ctags-recursive dvi-recursive html-recursive info-recursive \
-	install-data-recursive install-dvi-recursive \
-	install-exec-recursive install-html-recursive \
-	install-info-recursive install-pdf-recursive \
-	install-ps-recursive install-recursive installcheck-recursive \
-	installdirs-recursive pdf-recursive ps-recursive \
-	tags-recursive uninstall-recursive
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
-DATA = $(pkgconfig_DATA)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
-  $(RECURSIVE_TARGETS) \
-  $(RECURSIVE_CLEAN_TARGETS) \
-  $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	cscope distdir dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-CSCOPE = cscope
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
-  if test -d "$(distdir)"; then \
-    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
-      && rm -rf "$(distdir)" \
-      || { sleep 5 && rm -rf "$(distdir)"; }; \
-  else :; fi
-am__post_remove_distdir = $(am__remove_distdir)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-DIST_ARCHIVES = $(distdir).tar.gz $(distdir).zip
-GZIP_ENV = --best
-DIST_TARGETS = dist-gzip dist-zip
-distuninstallcheck_listfiles = find . -type f -print
-am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
-  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
-distcleancheck_listfiles = find . -type f -print
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GEOSCONFIG = @GEOSCONFIG@
-GEOS_CFLAGS = @GEOS_CFLAGS@
-GEOS_LDFLAGS = @GEOS_LDFLAGS@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBRTGEOM_VERSION = @LIBRTGEOM_VERSION@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-RTGEOM_GEOS_VERSION = @RTGEOM_GEOS_VERSION@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SRID_MAX = @SRID_MAX@
-SRID_USR_MAX = @SRID_USR_MAX@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src headers
-EXTRA_DIST = makefile.vc nmake.opt \
-	README.md CREDITS \
-  doc/DATASTORES.md doc/g_serialized.txt
-
-AUTOMAKE_OPTIONS = dist-zip foreign
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = rttopo.pc
-all: all-recursive
-
-.SUFFIXES:
-am--refresh: Makefile
-	@:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
-	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    echo ' $(SHELL) ./config.status'; \
-	    $(SHELL) ./config.status;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	$(SHELL) ./config.status --recheck
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	$(am__cd) $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-$(am__aclocal_m4_deps):
-rttopo.pc: $(top_builddir)/config.status $(srcdir)/rttopo.pc.in
-	cd $(top_builddir) && $(SHELL) ./config.status $@
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-distclean-libtool:
-	-rm -f libtool config.lt
-install-pkgconfigDATA: $(pkgconfig_DATA)
-	@$(NORMAL_INSTALL)
-	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
-	fi; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
-	done
-
-uninstall-pkgconfigDATA:
-	@$(NORMAL_UNINSTALL)
-	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-#     (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
-	@fail=; \
-	if $(am__make_keepgoing); then \
-	  failcom='fail=yes'; \
-	else \
-	  failcom='exit 1'; \
-	fi; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscope: cscope.files
-	test ! -s cscope.files \
-	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
-clean-cscope:
-	-rm -f cscope.files
-cscope.files: clean-cscope cscopelist
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
-
-distdir: $(DISTFILES)
-	$(am__remove_distdir)
-	test -d "$(distdir)" || mkdir "$(distdir)"
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    $(am__make_dryrun) \
-	      || test -d "$(distdir)/$$subdir" \
-	      || $(MKDIR_P) "$(distdir)/$$subdir" \
-	      || exit 1; \
-	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-	    $(am__relativize); \
-	    new_distdir=$$reldir; \
-	    dir1=$$subdir; dir2="$(top_distdir)"; \
-	    $(am__relativize); \
-	    new_top_distdir=$$reldir; \
-	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-	    ($(am__cd) $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$new_top_distdir" \
-	        distdir="$$new_distdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-		am__skip_mode_fix=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-	-test -n "$(am__skip_mode_fix)" \
-	|| find "$(distdir)" -type d ! -perm -755 \
-		-exec chmod u+rwx,go+rx {} \; -o \
-	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
-	|| chmod -R a+r "$(distdir)"
-dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__post_remove_distdir)
-
-dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__post_remove_distdir)
-
-dist-lzip: distdir
-	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-	$(am__post_remove_distdir)
-
-dist-xz: distdir
-	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-	$(am__post_remove_distdir)
-
-dist-tarZ: distdir
-	@echo WARNING: "Support for shar distribution archives is" \
-	               "deprecated." >&2
-	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__post_remove_distdir)
-
-dist-shar: distdir
-	@echo WARNING: "Support for distribution archives compressed with" \
-		       "legacy program 'compress' is deprecated." >&2
-	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__post_remove_distdir)
-dist-zip: distdir
-	-rm -f $(distdir).zip
-	zip -rq $(distdir).zip $(distdir)
-	$(am__post_remove_distdir)
-
-dist dist-all:
-	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
-	$(am__post_remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration.  Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
-	case '$(DIST_ARCHIVES)' in \
-	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
-	*.tar.bz2*) \
-	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lz*) \
-	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
-	*.tar.xz*) \
-	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
-	*.tar.Z*) \
-	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
-	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
-	*.zip*) \
-	  unzip $(distdir).zip ;;\
-	esac
-	chmod -R a-w $(distdir)
-	chmod u+w $(distdir)
-	mkdir $(distdir)/_build $(distdir)/_inst
-	chmod a-w $(distdir)
-	test -d $(distdir)/_build || exit 0; \
-	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
-	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-	  && am__cwd=`pwd` \
-	  && $(am__cd) $(distdir)/_build \
-	  && ../configure \
-	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
-	    $(DISTCHECK_CONFIGURE_FLAGS) \
-	    --srcdir=.. --prefix="$$dc_install_base" \
-	  && $(MAKE) $(AM_MAKEFLAGS) \
-	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
-	  && $(MAKE) $(AM_MAKEFLAGS) check \
-	  && $(MAKE) $(AM_MAKEFLAGS) install \
-	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
-	        distuninstallcheck \
-	  && chmod -R a-w "$$dc_install_base" \
-	  && ({ \
-	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
-	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
-	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
-	  && rm -rf "$$dc_destdir" \
-	  && $(MAKE) $(AM_MAKEFLAGS) dist \
-	  && rm -rf $(DIST_ARCHIVES) \
-	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
-	  && cd "$$am__cwd" \
-	  || exit 1
-	$(am__post_remove_distdir)
-	@(echo "$(distdir) archives ready for distribution: "; \
-	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
-	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
-distuninstallcheck:
-	@test -n '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: trying to run $@ with an empty' \
-	       '$$(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	$(am__cd) '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
-	   || { echo "ERROR: files left after uninstall:" ; \
-	        if test -n "$(DESTDIR)"; then \
-	          echo "  (check DESTDIR support)"; \
-	        fi ; \
-	        $(distuninstallcheck_listfiles) ; \
-	        exit 1; } >&2
-distcleancheck: distclean
-	@if test '$(srcdir)' = . ; then \
-	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
-	  exit 1 ; \
-	fi
-	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
-	  || { echo "ERROR: files left in build directory after distclean:" ; \
-	       $(distcleancheck_listfiles) ; \
-	       exit 1; } >&2
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(DATA)
-installdirs: installdirs-recursive
-installdirs-am:
-	for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
-	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-libtool \
-	distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-pkgconfigDATA
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf $(top_srcdir)/autom4te.cache
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-pkgconfigDATA
-
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
-	am--refresh check check-am clean clean-cscope clean-generic \
-	clean-libtool cscope cscopelist-am ctags ctags-am dist \
-	dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
-	dist-xz dist-zip distcheck distclean distclean-generic \
-	distclean-libtool distclean-tags distcleancheck distdir \
-	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-pkgconfigDATA install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am uninstall-pkgconfigDATA
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/README.md b/README.md
index e564c26..2ba0b8f 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,9 @@ Official code repository is https://git.osgeo.org/gogs/rttopo/librttopo.
 A mirror exists at https://gitlab.com/rttopo/rttopo, automatically
 updated on every push to the official repository.
 
+Development mailing list:
+https://lists.osgeo.org/mailman/listinfo/librttopo-dev
+
 ## Building, testing, installing
 
 ### Unix
@@ -36,11 +39,11 @@ Using Autotools:
     ${srcdir}/configure # in build dir
     make # build
     make check # test
-    make install # install
+    make install # or install-strip
 
 ### Microsoft Windows
 
-TODO
+See [separate document](doc/BUILDING-ON-WINDOWS.md)
 
 ## Using
 
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index a7a23c7..0000000
--- a/aclocal.m4
+++ /dev/null
@@ -1,1219 +0,0 @@
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
-
-# Copyright (C) 1996-2013 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_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
-[m4_warning([this file was generated for autoconf 2.69.
-You have another version of autoconf.  It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-
-# Copyright (C) 2002-2013 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.14'
-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.14.1], [],
-      [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 AM_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.14.1])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
-
-# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
-
-# Copyright (C) 2001-2013 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-2013 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_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ([2.52])dnl
- m4_if([$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
-m4_define([_AM_COND_VALUE_$1], [$2])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-2013 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.
-
-
-# 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", "OBJC", "OBJCXX", "UPC", or "GJC".
-# 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
-
-m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
-      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
-      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-      [$1], [OBJCXX], [depcc="$OBJCXX" 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".
-  rm -rf conftest.dir
-  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
-  am__universal=false
-  m4_case([$1], [CC],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac],
-    [CXX],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac])
-
-  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 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # 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.  Also, some Intel
-    # versions had trouble with output in subdirs.
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    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
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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], [dnl
-AS_HELP_STRING(
-  [--enable-dependency-tracking],
-  [do not reject slow dependency extractors])
-AS_HELP_STRING(
-  [--disable-dependency-tracking],
-  [speeds up one-time build])])
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-  am__nodep='_no'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
-])
-
-# Generate code to set up dependency tracking.              -*- Autoconf -*-
-
-# Copyright (C) 1999-2013 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_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[{
-  # Older Autoconf quotes --file arguments for eval, but not when files
-  # are listed without --file.  Let's play safe and only enable the eval
-  # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
-  shift
-  for mf
-  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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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"`
-    # 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'`; 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"])
-])
-
-# Do all the work for Automake.                             -*- Autoconf -*-
-
-# Copyright (C) 1996-2013 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 macro actually does too much.  Some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
-m4_define([AC_PROG_CC],
-m4_defn([AC_PROG_CC])
-[_AM_PROG_CC_C_O
-])
-
-# 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.65])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],
-[AC_DIAGNOSE([obsolete],
-             [$0: two- and three-arguments forms are deprecated.])
-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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
-  [ok:ok],,
-  [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])
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-# For better backward compatibility.  To be removed once Automake 1.9.x
-# dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
-AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# 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])],
-		  [m4_define([AC_PROG_CC],
-			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES([CXX])],
-		  [m4_define([AC_PROG_CXX],
-			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES([OBJC])],
-		  [m4_define([AC_PROG_OBJC],
-			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
-		  [_AM_DEPENDENCIES([OBJCXX])],
-		  [m4_define([AC_PROG_OBJCXX],
-			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
-])
-AC_REQUIRE([AM_SILENT_RULES])dnl
-dnl The testsuite driver may need to know about EXEEXT, so add the
-dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
-dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
-  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-
-# POSIX will say in a future version that running "rm -f" with no argument
-# is OK; and we want to be able to make that assumption in our Makefile
-# recipes.  So use an aggressive probe to check that the usage we want is
-# actually supported "in the wild" to an acceptable degree.
-# See automake bug#10828.
-# To make any issue more visible, cause the running configure to be aborted
-# by default if the 'rm' program in use doesn't match our expectations; the
-# user can still override this though.
-if rm -f && rm -fr && rm -rf; then : OK; else
-  cat >&2 <<'END'
-Oops!
-
-Your 'rm' program seems unable to run without file operands specified
-on the command line, even when the '-f' option is present.  This is contrary
-to the behaviour of most rm programs out there, and not conforming with
-the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
-
-Please tell bug-automake at gnu.org about your system, including the value
-of your $PATH and any error possibly output before this message.  This
-can help us improve future automake versions.
-
-END
-  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
-    echo 'Configuration will proceed anyway, since you have set the' >&2
-    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
-    echo >&2
-  else
-    cat >&2 <<'END'
-Aborting the configuration process, to ensure you take notice of the issue.
-
-You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
-
-If you want to complete the configuration process using your problematic
-'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
-to "yes", and re-run configure.
-
-END
-    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
-  fi
-fi])
-
-dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
-# 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_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001-2013 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
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
-  esac
-fi
-AC_SUBST([install_sh])])
-
-# Copyright (C) 2003-2013 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.
-
-# 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])])
-
-# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
-# From Jim Meyering
-
-# Copyright (C) 1996-2013 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_MAINTAINER_MODE([DEFAULT-MODE])
-# ----------------------------------
-# Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless 'enable' is passed literally.
-# For symmetry, 'disable' may be passed as well.  Anyway, the user
-# can override the default with the --enable/--disable switch.
-AC_DEFUN([AM_MAINTAINER_MODE],
-[m4_case(m4_default([$1], [disable]),
-       [enable], [m4_define([am_maintainer_other], [disable])],
-       [disable], [m4_define([am_maintainer_other], [enable])],
-       [m4_define([am_maintainer_other], [enable])
-        m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
-  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
-  AC_ARG_ENABLE([maintainer-mode],
-    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
-      am_maintainer_other[ make rules and dependencies not useful
-      (and sometimes confusing) to the casual installer])],
-    [USE_MAINTAINER_MODE=$enableval],
-    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
-  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
-  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
-  MAINT=$MAINTAINER_MODE_TRUE
-  AC_SUBST([MAINT])dnl
-]
-)
-
-# Check to see how 'make' treats includes.	            -*- Autoconf -*-
-
-# Copyright (C) 2001-2013 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_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.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
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-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-2013 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_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 is modern enough.
-# If it is, 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
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --is-lightweight"; then
-  am_missing_run="$MISSING "
-else
-  am_missing_run=
-  AC_MSG_WARN(['missing' script is too old or missing])
-fi
-])
-
-#  -*- Autoconf -*-
-# Obsolete and "removed" macros, that must however still report explicit
-# error messages when used, to smooth transition.
-#
-# Copyright (C) 1996-2013 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.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
-AC_CONFIG_HEADERS($@)])
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_PROG_CC
-am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
-AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should simply use the 'AC][_PROG_CC' macro instead.
-Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
-but upon 'ac_cv_prog_cc_stdc'.])])
-
-AC_DEFUN([AM_C_PROTOTYPES],
-         [AC_FATAL([automatic de-ANSI-fication support has been removed])])
-AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
-
-# Helper functions for option handling.                     -*- Autoconf -*-
-
-# Copyright (C) 2001-2013 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_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],
-[m4_foreach_w([_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])])
-
-# Copyright (C) 1999-2013 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_CC_C_O
-# ---------------
-# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
-# to automatically call this.
-AC_DEFUN([_AM_PROG_CC_C_O],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-AC_LANG_PUSH([C])dnl
-AC_CACHE_CHECK(
-  [whether $CC understands -c and -o together],
-  [am_cv_prog_cc_c_o],
-  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-  # Make sure it works both with $CC and with simple cc.
-  # Following AC_PROG_CC_C_O, we do the test twice because some
-  # compilers refuse to overwrite an existing .o file with -o,
-  # though they will create one.
-  am_cv_prog_cc_c_o=yes
-  for am_i in 1 2; do
-    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
-         && test -f conftest2.$ac_objext; then
-      : OK
-    else
-      am_cv_prog_cc_c_o=no
-      break
-    fi
-  done
-  rm -f core conftest*
-  unset am_i])
-if test "$am_cv_prog_cc_c_o" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
-AC_LANG_POP([C])])
-
-# For backward compatibility.
-AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
-
-# Copyright (C) 2001-2013 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_RUN_LOG(COMMAND)
-# -------------------
-# Run COMMAND, save the exit status in ac_status, and log it.
-# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
-AC_DEFUN([AM_RUN_LOG],
-[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
-   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   (exit $ac_status); }])
-
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
-
-# Copyright (C) 1996-2013 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_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[[\\\"\#\$\&\'\`$am_lf]]*)
-    AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
-  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
-esac
-
-# 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 (
-   am_has_slept=no
-   for am_try in 1 2; do
-     echo "timestamp, slept: $am_has_slept" > conftest.file
-     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
-     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
-     if test "$[2]" = conftest.file || test $am_try -eq 2; then
-       break
-     fi
-     # Just in case.
-     sleep 1
-     am_has_slept=yes
-   done
-   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])
-# If we didn't sleep, we still need to ensure time stamps of config.status and
-# generated files are strictly newer.
-am_sleep_pid=
-if grep 'slept: no' conftest.file >/dev/null 2>&1; then
-  ( sleep 1 ) &
-  am_sleep_pid=$!
-fi
-AC_CONFIG_COMMANDS_PRE(
-  [AC_MSG_CHECKING([that generated files are newer than configure])
-   if test -n "$am_sleep_pid"; then
-     # Hide warnings about reused PIDs.
-     wait $am_sleep_pid 2>/dev/null
-   fi
-   AC_MSG_RESULT([done])])
-rm -f conftest.file
-])
-
-# Copyright (C) 2009-2013 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_SILENT_RULES([DEFAULT])
-# --------------------------
-# Enable less verbose build rules; with the default set to DEFAULT
-# ("yes" being less verbose, "no" or empty being verbose).
-AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules], [dnl
-AS_HELP_STRING(
-  [--enable-silent-rules],
-  [less verbose build output (undo: "make V=1")])
-AS_HELP_STRING(
-  [--disable-silent-rules],
-  [verbose build output (undo: "make V=0")])dnl
-])
-case $enable_silent_rules in @%:@ (((
-  yes) AM_DEFAULT_VERBOSITY=0;;
-   no) AM_DEFAULT_VERBOSITY=1;;
-    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
-esac
-dnl
-dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
-dnl do not support nested variable expansions.
-dnl See automake bug#9928 and bug#10237.
-am_make=${MAKE-make}
-AC_CACHE_CHECK([whether $am_make supports nested variables],
-   [am_cv_make_support_nested_variables],
-   [if AS_ECHO([['TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-	@$(TRUE)
-.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi])
-if test $am_cv_make_support_nested_variables = yes; then
-  dnl Using '$V' instead of '$(V)' breaks IRIX make.
-  AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AC_SUBST([AM_V])dnl
-AM_SUBST_NOTMAKE([AM_V])dnl
-AC_SUBST([AM_DEFAULT_V])dnl
-AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
-AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
-AM_BACKSLASH='\'
-AC_SUBST([AM_BACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
-])
-
-# Copyright (C) 2001-2013 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-2013 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 outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball.                            -*- Autoconf -*-
-
-# Copyright (C) 2004-2013 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_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.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
-
-# We'll loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-
-m4_if([$1], [v7],
-  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-
-  [m4_case([$1],
-    [ustar],
-     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
-      # There is notably a 21 bits limit for the UID and the GID.  In fact,
-      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
-      # and bug#13588).
-      am_max_uid=2097151 # 2^21 - 1
-      am_max_gid=$am_max_uid
-      # The $UID and $GID variables are not portable, so we need to resort
-      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
-      # below are definitely unexpected, so allow the users to see them
-      # (that is, avoid stderr redirection).
-      am_uid=`id -u || echo unknown`
-      am_gid=`id -g || echo unknown`
-      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
-      if test $am_uid -le $am_max_uid; then
-         AC_MSG_RESULT([yes])
-      else
-         AC_MSG_RESULT([no])
-         _am_tools=none
-      fi
-      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
-      if test $am_gid -le $am_max_gid; then
-         AC_MSG_RESULT([yes])
-      else
-        AC_MSG_RESULT([no])
-        _am_tools=none
-      fi],
-
-  [pax],
-    [],
-
-  [m4_fatal([Unknown tar format])])
-
-  AC_MSG_CHECKING([how to create a $1 tar archive])
-
-  # Go ahead even if we have the value already cached.  We do so because we
-  # need to set the values for the 'am__tar' and 'am__untar' variables.
-  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
-
-  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 <conftest.tar])
-      AM_RUN_LOG([cat conftest.dir/file])
-      grep GrepMe conftest.dir/file >/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
-
-m4_include([m4/libtool.m4])
-m4_include([m4/ltoptions.m4])
-m4_include([m4/ltsugar.m4])
-m4_include([m4/ltversion.m4])
-m4_include([m4/lt~obsolete.m4])
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..18c9374
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# rttopo bootstrapping script
+#
+giveup()
+{
+        echo
+        echo "  Something went wrong, giving up!"
+        echo
+        exit 1
+}
+
+OSTYPE=`uname -s`
+
+AUTOCONF=`which autoconf 2>/dev/null`
+if [ ! ${AUTOCONF} ]; then
+    echo "Missing autoconf!"
+    exit
+fi
+AUTOCONF_VER=`${AUTOCONF} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
+
+AUTOHEADER=`which autoheader 2>/dev/null`
+if [ ! ${AUTOHEADER} ]; then
+    echo "Missing autoheader!"
+    exit
+fi
+
+for aclocal in aclocal aclocal-1.10 aclocal-1.9; do
+    ACLOCAL=`which $aclocal 2>/dev/null`
+    if test -x "${ACLOCAL}"; then
+        break;
+    fi
+done
+if [ ! ${ACLOCAL} ]; then
+    echo "Missing aclocal!"
+    exit
+fi
+ACLOCAL_VER=`${ACLOCAL} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
+
+for automake in automake automake-1.10 automake-1.9; do
+    AUTOMAKE=`which $automake 2>/dev/null`
+    if test -x "${AUTOMAKE}"; then
+        break;
+    fi
+done
+if [ ! ${AUTOMAKE} ]; then
+    echo "Missing automake!"
+    exit
+fi
+AUTOMAKE_VER=`${AUTOMAKE} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
+
+for libtoolize in libtoolize glibtoolize; do
+    LIBTOOLIZE=`which $libtoolize 2>/dev/null`
+    if test -x "${LIBTOOLIZE}"; then
+        break;
+    fi
+done
+if [ ! ${LIBTOOLIZE} ]; then
+    echo "Missing libtoolize!"
+    exit
+fi
+LIBTOOLIZE_VER=`${LIBTOOLIZE} --version | grep -E "^.*[0-9]\.[0-9]" | sed 's/^.* //'`
+
+AMOPTS="--add-missing --copy -Woverride"
+if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then
+   AMOPTS=$AMOPTS" --include-deps";
+fi
+
+LTOPTS="--force --copy"
+echo "* Running ${LIBTOOLIZE} (${LIBTOOLIZE_VER})"
+echo "   OPTIONS = ${LTOPTS}"
+${LIBTOOLIZE} ${LTOPTS} || giveup
+
+echo "* Running $ACLOCAL (${ACLOCAL_VER})"
+${ACLOCAL} -I m4 || giveup
+
+echo "* Running ${AUTOHEADER} (${AUTOCONF_VER})"
+${AUTOHEADER} || giveup
+
+echo "* Running ${AUTOMAKE} (${AUTOMAKE_VER})"
+echo "   OPTIONS = ${AMOPTS}"
+${AUTOMAKE} ${AMOPTS} || giveup
+
+echo "* Running ${AUTOCONF} (${AUTOCONF_VER})"
+${AUTOCONF} || giveup
+
+if test -f "${PWD}/configure"; then
+    echo "======================================"
+    echo "Now you are ready to run './configure'"
+    echo "======================================"
+else
+    echo "  Failed to generate ./configure script!"
+    giveup
+fi
+
diff --git a/compile b/compile
deleted file mode 100755
index 531136b..0000000
--- a/compile
+++ /dev/null
@@ -1,347 +0,0 @@
-#! /bin/sh
-# Wrapper for compilers which do not understand '-c -o'.
-
-scriptversion=2012-10-14.11; # UTC
-
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
-# Written by Tom Tromey <tromey at cygnus.com>.
-#
-# 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, see <http://www.gnu.org/licenses/>.
-
-# 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 <bug-automake at gnu.org> or send patches to
-# <automake-patches at gnu.org>.
-
-nl='
-'
-
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent tools from complaining about whitespace usage.
-IFS=" ""	$nl"
-
-file_conv=
-
-# func_file_conv build_file lazy
-# Convert a $build file to $host form and store it in $file
-# Currently only supports Windows hosts. If the determined conversion
-# type is listed in (the comma separated) LAZY, no conversion will
-# take place.
-func_file_conv ()
-{
-  file=$1
-  case $file in
-    / | /[!/]*) # absolute file, and not a UNC file
-      if test -z "$file_conv"; then
-	# lazily determine how to convert abs files
-	case `uname -s` in
-	  MINGW*)
-	    file_conv=mingw
-	    ;;
-	  CYGWIN*)
-	    file_conv=cygwin
-	    ;;
-	  *)
-	    file_conv=wine
-	    ;;
-	esac
-      fi
-      case $file_conv/,$2, in
-	*,$file_conv,*)
-	  ;;
-	mingw/*)
-	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
-	  ;;
-	cygwin/*)
-	  file=`cygpath -m "$file" || echo "$file"`
-	  ;;
-	wine/*)
-	  file=`winepath -w "$file" || echo "$file"`
-	  ;;
-      esac
-      ;;
-  esac
-}
-
-# func_cl_dashL linkdir
-# Make cl look for libraries in LINKDIR
-func_cl_dashL ()
-{
-  func_file_conv "$1"
-  if test -z "$lib_path"; then
-    lib_path=$file
-  else
-    lib_path="$lib_path;$file"
-  fi
-  linker_opts="$linker_opts -LIBPATH:$file"
-}
-
-# func_cl_dashl library
-# Do a library search-path lookup for cl
-func_cl_dashl ()
-{
-  lib=$1
-  found=no
-  save_IFS=$IFS
-  IFS=';'
-  for dir in $lib_path $LIB
-  do
-    IFS=$save_IFS
-    if $shared && test -f "$dir/$lib.dll.lib"; then
-      found=yes
-      lib=$dir/$lib.dll.lib
-      break
-    fi
-    if test -f "$dir/$lib.lib"; then
-      found=yes
-      lib=$dir/$lib.lib
-      break
-    fi
-    if test -f "$dir/lib$lib.a"; then
-      found=yes
-      lib=$dir/lib$lib.a
-      break
-    fi
-  done
-  IFS=$save_IFS
-
-  if test "$found" != yes; then
-    lib=$lib.lib
-  fi
-}
-
-# func_cl_wrapper cl arg...
-# Adjust compile command to suit cl
-func_cl_wrapper ()
-{
-  # Assume a capable shell
-  lib_path=
-  shared=:
-  linker_opts=
-  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'.
-	  eat=1
-	  case $2 in
-	    *.o | *.[oO][bB][jJ])
-	      func_file_conv "$2"
-	      set x "$@" -Fo"$file"
-	      shift
-	      ;;
-	    *)
-	      func_file_conv "$2"
-	      set x "$@" -Fe"$file"
-	      shift
-	      ;;
-	  esac
-	  ;;
-	-I)
-	  eat=1
-	  func_file_conv "$2" mingw
-	  set x "$@" -I"$file"
-	  shift
-	  ;;
-	-I*)
-	  func_file_conv "${1#-I}" mingw
-	  set x "$@" -I"$file"
-	  shift
-	  ;;
-	-l)
-	  eat=1
-	  func_cl_dashl "$2"
-	  set x "$@" "$lib"
-	  shift
-	  ;;
-	-l*)
-	  func_cl_dashl "${1#-l}"
-	  set x "$@" "$lib"
-	  shift
-	  ;;
-	-L)
-	  eat=1
-	  func_cl_dashL "$2"
-	  ;;
-	-L*)
-	  func_cl_dashL "${1#-L}"
-	  ;;
-	-static)
-	  shared=false
-	  ;;
-	-Wl,*)
-	  arg=${1#-Wl,}
-	  save_ifs="$IFS"; IFS=','
-	  for flag in $arg; do
-	    IFS="$save_ifs"
-	    linker_opts="$linker_opts $flag"
-	  done
-	  IFS="$save_ifs"
-	  ;;
-	-Xlinker)
-	  eat=1
-	  linker_opts="$linker_opts $2"
-	  ;;
-	-*)
-	  set x "$@" "$1"
-	  shift
-	  ;;
-	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
-	  func_file_conv "$1"
-	  set x "$@" -Tp"$file"
-	  shift
-	  ;;
-	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
-	  func_file_conv "$1" mingw
-	  set x "$@" "$file"
-	  shift
-	  ;;
-	*)
-	  set x "$@" "$1"
-	  shift
-	  ;;
-      esac
-    fi
-    shift
-  done
-  if test -n "$linker_opts"; then
-    linker_opts="-link$linker_opts"
-  fi
-  exec "$@" $linker_opts
-  exit 1
-}
-
-eat=
-
-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 <bug-automake at gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "compile $scriptversion"
-    exit $?
-    ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
-    func_cl_wrapper "$@"      # Doesn't return...
-    ;;
-esac
-
-ofile=
-cfile=
-
-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 's|^.*[\\/]||; s|^[a-zA-Z]:||; 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
-  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
-elif test -f "${cofile}bj"; then
-  test "${cofile}bj" = "$ofile" || 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-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/config.guess b/config.guess
deleted file mode 100755
index b79252d..0000000
--- a/config.guess
+++ /dev/null
@@ -1,1558 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
-
-timestamp='2013-06-10'
-
-# 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 3 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, see <http://www.gnu.org/licenses/>.
-#
-# 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 Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
-
-
-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 <config-patches at gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2013 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 at 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
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
-	# If the system lacks a compiler, then just pick glibc.
-	# We could probably try harder.
-	LIBC=gnu
-
-	eval $set_cc_for_build
-	cat <<-EOF > $dummy.c
-	#include <features.h>
-	#if defined(__UCLIBC__)
-	LIBC=uclibc
-	#elif defined(__dietlibc__)
-	LIBC=dietlibc
-	#else
-	LIBC=gnu
-	#endif
-	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	;;
-esac
-
-# 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 tuples: *-*-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 -q __ELF__
-		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 ;;
-    *:Bitrig:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_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'`
-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-	exitcode=$?
-	trap '' 0
-	exit $exitcode ;;
-    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 at 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 ;;
-    s390x:SunOS:*:*)
-	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux${UNAME_RELEASE}
-	exit ;;
-    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	eval $set_cc_for_build
-	SUN_ARCH="i386"
-	# If there is a compiler, see if it is configured for 64-bit objects.
-	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
-	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		grep IS_64BIT_ARCH >/dev/null
-	    then
-		SUN_ARCH="x86_64"
-	    fi
-	fi
-	echo ${SUN_ARCH}-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 <stdio.h>  /* 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 <sys/systemcfg.h>
-
-		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:*:[4567])
-	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 <stdlib.h>
-		#include <unistd.h>
-
-		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 -q __LP64__
-	    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 <unistd.h>
-	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:*:*)
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
-	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	esac
-	exit ;;
-    i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
-	exit ;;
-    *:MINGW64*:*)
-	echo ${UNAME_MACHINE}-pc-mingw64
-	exit ;;
-    *:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
-	exit ;;
-    i*:windows32*:*)
-	# uname -m includes "-pc" on this system.
-	echo ${UNAME_MACHINE}-mingw32
-	exit ;;
-    i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
-	exit ;;
-    *:Interix*:*)
-	case ${UNAME_MACHINE} in
-	    x86)
-		echo i586-pc-interix${UNAME_RELEASE}
-		exit ;;
-	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix${UNAME_RELEASE}
-		exit ;;
-	    IA64)
-		echo ia64-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 ;;
-    8664:Windows_NT:*)
-	echo x86_64-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-${LIBC}`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/[-(].*//'`-${LIBC}
-	exit ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
-	exit ;;
-    aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    aarch64_be:Linux:*:*)
-	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	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 -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    arc:Linux:*:* | arceb:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    arm*:Linux:*:*)
-	eval $set_cc_for_build
-	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
-	    | grep -q __ARM_EABI__
-	then
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	else
-	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
-		| grep -q __ARM_PCS_VFP
-	    then
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
-	    else
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
-	    fi
-	fi
-	exit ;;
-    avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
-	exit ;;
-    crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
-	exit ;;
-    frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    i*86:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
-	exit ;;
-    ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    mips:Linux:*:* | mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef ${UNAME_MACHINE}
-	#undef ${UNAME_MACHINE}el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=${UNAME_MACHINE}el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=${UNAME_MACHINE}
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
-	;;
-    or1k:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    or32:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    padre:Linux:*:*)
-	echo sparc-unknown-linux-${LIBC}
-	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-${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-${LIBC} ;;
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
-	esac
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-${LIBC}
-	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-${LIBC}
-	exit ;;
-    ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-${LIBC}
-	exit ;;
-    ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-${LIBC}
-	exit ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
-	exit ;;
-    sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
-	exit ;;
-    x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	exit ;;
-    xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
-	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.[02]*:*)
-	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' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-	elif /bin/uname -X 2>/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 i586.
-	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
-	# this is a cross-build.
-	echo i586-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; } ;;
-    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
-	OS_REL='.3'
-	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; }
-	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; 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.[02]*:*)
-	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 <Richard.M.Bartel at ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
-    *:UNIX_System_V:4*:FTX*)
-	# From Gerald Hewes <hewes at openmarket.com>.
-	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
-    *:*:*:FTX*)
-	# From seanf at swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
-    i*86:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
-	exit ;;
-    *:VOS:*:*)
-	# From Paul.Green at 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 ;;
-    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
-	echo i586-pc-haiku
-	exit ;;
-    x86_64:Haiku:*:*)
-	echo x86_64-unknown-haiku
-	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
-	eval $set_cc_for_build
-	if test "$UNAME_PROCESSOR" = unknown ; then
-	    UNAME_PROCESSOR=powerpc
-	fi
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		grep IS_64BIT_ARCH >/dev/null
-	    then
-		case $UNAME_PROCESSOR in
-		    i386) UNAME_PROCESSOR=x86_64 ;;
-		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
-		esac
-	    fi
-	fi
-	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 ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk${UNAME_RELEASE}
-	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 ;;
-    i*86:AROS:*:*)
-	echo ${UNAME_MACHINE}-pc-aros
-	exit ;;
-    x86_64:VMkernel:*:*)
-	echo ${UNAME_MACHINE}-unknown-esx
-	exit ;;
-esac
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#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 <sys/param.h>
-  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 <sys/param.h>
-#  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 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches at gnu.org> 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/config.sub b/config.sub
deleted file mode 100755
index 9633db7..0000000
--- a/config.sub
+++ /dev/null
@@ -1,1791 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
-
-timestamp='2013-08-10'
-
-# 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 3 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, see <http://www.gnu.org/licenses/>.
-#
-# 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 Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
-#
-# 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.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# 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 <config-patches at gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2013 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-android* | linux-dietlibc | linux-newlib* | \
-  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  android-linux)
-    os=-linux-android
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
-    ;;
-  *)
-    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 | -microblaze*)
-		os=
-		basic_machine=$1
-		;;
-	-bluegene*)
-		os=-cnk
-		;;
-	-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*178)
-		os=-lynxos178
-		;;
-	-lynx*5)
-		os=-lynxos5
-		;;
-	-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 \
-	| aarch64 | aarch64_be \
-	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-	| am33_2.0 \
-	| arc | arceb \
-	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
-	| avr | avr32 \
-	| be32 | be64 \
-	| bfin \
-	| c4x | c8051 | clipper \
-	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| hexagon \
-	| i370 | i860 | i960 | ia64 \
-	| ip2k | iq2000 \
-	| le32 | le64 \
-	| lm32 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
-	| mips | mipsbe | mipseb | mipsel | mipsle \
-	| mips16 \
-	| mips64 | mips64el \
-	| mips64octeon | mips64octeonel \
-	| mips64orion | mips64orionel \
-	| mips64r5900 | mips64r5900el \
-	| mips64vr | mips64vrel \
-	| mips64vr4100 | mips64vr4100el \
-	| mips64vr4300 | mips64vr4300el \
-	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
-	| mipsisa32 | mipsisa32el \
-	| mipsisa32r2 | mipsisa32r2el \
-	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
-	| mipsisa64sb1 | mipsisa64sb1el \
-	| mipsisa64sr71k | mipsisa64sr71kel \
-	| mipsr5900 | mipsr5900el \
-	| mipstx39 | mipstx39el \
-	| mn10200 | mn10300 \
-	| moxie \
-	| mt \
-	| msp430 \
-	| nds32 | nds32le | nds32be \
-	| nios | nios2 | nios2eb | nios2el \
-	| ns16k | ns32k \
-	| open8 \
-	| or1k | or32 \
-	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle \
-	| pyramid \
-	| rl78 | rx \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | 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 \
-	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
-	| ubicom32 \
-	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
-	| we32k \
-	| x86 | xc16x | xstormy16 | xtensa \
-	| z8k | z80)
-		basic_machine=$basic_machine-unknown
-		;;
-	c54x)
-		basic_machine=tic54x-unknown
-		;;
-	c55x)
-		basic_machine=tic55x-unknown
-		;;
-	c6x)
-		basic_machine=tic6x-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
-
-	strongarm | thumb | xscale)
-		basic_machine=arm-unknown
-		;;
-	xgate)
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	xscaleeb)
-		basic_machine=armeb-unknown
-		;;
-
-	xscaleel)
-		basic_machine=armel-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-* \
-	| aarch64-* | aarch64_be-* \
-	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
-	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* | avr32-* \
-	| be32-* | be64-* \
-	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* \
-	| c8051-* | 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-* \
-	| hexagon-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| le32-* | le64-* \
-	| lm32-* \
-	| m32c-* | m32r-* | m32rle-* \
-	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
-	| microblaze-* | microblazeel-* \
-	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-	| mips16-* \
-	| mips64-* | mips64el-* \
-	| mips64octeon-* | mips64octeonel-* \
-	| mips64orion-* | mips64orionel-* \
-	| mips64r5900-* | mips64r5900el-* \
-	| mips64vr-* | mips64vrel-* \
-	| mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* \
-	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
-	| mipsisa32-* | mipsisa32el-* \
-	| mipsisa32r2-* | mipsisa32r2el-* \
-	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
-	| mipsisa64sb1-* | mipsisa64sb1el-* \
-	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
-	| mipsr5900-* | mipsr5900el-* \
-	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
-	| msp430-* \
-	| nds32-* | nds32le-* | nds32be-* \
-	| nios-* | nios2-* | nios2eb-* | nios2el-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| open8-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
-	| pyramid-* \
-	| rl78-* | romp-* | rs6000-* | rx-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx?-* \
-	| tahoe-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile*-* \
-	| tron-* \
-	| ubicom32-* \
-	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
-	| vax-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* \
-	| xstormy16-* | xtensa*-* \
-	| ymp-* \
-	| z8k-* | z80-*)
-		;;
-	# Recognize the basic CPU types without company name, with glob match.
-	xtensa*)
-		basic_machine=$basic_machine-unknown
-		;;
-	# 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
-		;;
-	aros)
-		basic_machine=i386-pc
-		os=-aros
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	blackfin)
-		basic_machine=bfin-unknown
-		os=-linux
-		;;
-	blackfin-*)
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	bluegene*)
-		basic_machine=powerpc-ibm
-		os=-cnk
-		;;
-	c54x-*)
-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	c55x-*)
-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	c6x-*)
-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	c90)
-		basic_machine=c90-cray
-		os=-unicos
-		;;
-	cegcc)
-		basic_machine=arm-unknown
-		os=-cegcc
-		;;
-	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
-		;;
-	cr16 | cr16-*)
-		basic_machine=cr16-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
-		;;
-	dicos)
-		basic_machine=i686-pc
-		os=-dicos
-		;;
-	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*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
-		;;
-	m68knommu)
-		basic_machine=m68k-unknown
-		os=-linux
-		;;
-	m68knommu-*)
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	microblaze*)
-		basic_machine=microblaze-xilinx
-		;;
-	mingw64)
-		basic_machine=x86_64-pc
-		os=-mingw64
-		;;
-	mingw32)
-		basic_machine=i686-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-/'`
-		;;
-	msys)
-		basic_machine=i686-pc
-		os=-msys
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	nacl)
-		basic_machine=le32-unknown
-		os=-nacl
-		;;
-	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
-		;;
-	neo-tandem)
-		basic_machine=neo-tandem
-		;;
-	nse-tandem)
-		basic_machine=nse-tandem
-		;;
-	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
-		;;
-	parisc)
-		basic_machine=hppa-unknown
-		os=-linux
-		;;
-	parisc-*)
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	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 | ppcbe)	basic_machine=powerpc-unknown
-		;;
-	ppc-* | ppcbe-*)
-		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 | rdos64)
-		basic_machine=x86_64-pc
-		os=-rdos
-		;;
-	rdos32)
-		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
-		;;
-	strongarm-* | thumb-*)
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	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
-		;;
-	tile*)
-		basic_machine=$basic_machine-unknown
-		os=-linux-gnu
-		;;
-	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
-		;;
-	xscale-* | xscalee[bl]-*)
-		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
-		;;
-	ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	z80-*-coff)
-		basic_machine=z80-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[24]aeb | 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.
-	-auroraux)
-		os=-auroraux
-		;;
-	-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* | -cnk* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* | -plan9* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -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* | -cegcc* \
-	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-musl* | -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* | -es*)
-	# 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
-		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
-	-dicos*)
-		os=-dicos
-		;;
-	-nacl*)
-		;;
-	-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
-		;;
-	c8051-*)
-		os=-elf
-		;;
-	hexagon-*)
-		os=-elf
-		;;
-	tic54x-*)
-		os=-coff
-		;;
-	tic55x-*)
-		os=-coff
-		;;
-	tic6x-*)
-		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
-		;;
-	m68*-cisco)
-		os=-aout
-		;;
-	mep-*)
-		os=-elf
-		;;
-	mips*-cisco)
-		os=-elf
-		;;
-	mips*-*)
-		os=-elf
-		;;
-	or1k-*)
-		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
-				;;
-			-cnk*|-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/configure b/configure
deleted file mode 100755
index 8dc4271..0000000
--- a/configure
+++ /dev/null
@@ -1,20020 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for librttopo 1.0.0-RC2.
-#
-# Report bugs to <strk at keybit.net>.
-#
-#
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
-#
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-	expr "X$arg" : "X\\(.*\\)$as_nl";
-	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-      PATH_SEPARATOR=';'
-  }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-  done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# Use a proper internal environment variable to ensure we don't fall
-  # into an infinite loop, continuously re-executing ourselves.
-  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
-    _as_can_reexec=no; export _as_can_reexec;
-    # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
-  fi
-  # We don't want this to propagate to other subprocesses.
-          { _as_can_reexec=; unset _as_can_reexec;}
-if test "x$CONFIG_SHELL" = x; then
-  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '\${1+\"\$@\"}'='\"\$@\"'
-  setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-"
-  as_required="as_fn_return () { (exit \$1); }
-as_fn_success () { as_fn_return 0; }
-as_fn_failure () { as_fn_return 1; }
-as_fn_ret_success () { return 0; }
-as_fn_ret_failure () { return 1; }
-
-exitcode=0
-as_fn_success || { exitcode=1; echo as_fn_success failed.; }
-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-
-else
-  exitcode=1; echo positional parameters were not saved.
-fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
-  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
-  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
-  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1
-
-  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
-      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
-  if (eval "$as_required") 2>/dev/null; then :
-  as_have_required=yes
-else
-  as_have_required=no
-fi
-  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_found=false
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  as_found=:
-  case $as_dir in #(
-	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     # Try only shells that exist, to save several forks.
-	     as_shell=$as_dir/$as_base
-	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
-  CONFIG_SHELL=$as_shell as_have_required=yes
-		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
-  break 2
-fi
-fi
-	   done;;
-       esac
-  as_found=false
-done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
-	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
-  CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
-IFS=$as_save_IFS
-
-
-      if test "x$CONFIG_SHELL" != x; then :
-  export CONFIG_SHELL
-             # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
-fi
-
-    if test x$as_have_required = xno; then :
-  $as_echo "$0: This script requires a shell more modern than all"
-  $as_echo "$0: the shells that I found on your system."
-  if test x${ZSH_VERSION+set} = xset ; then
-    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
-    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
-  else
-    $as_echo "$0: Please tell bug-autoconf at gnu.org and strk at keybit.net
-$0: about your system, including any error possibly output
-$0: before this message. Then install a modern shell, or
-$0: manually run the script under such a shell if you do
-$0: have one."
-  fi
-  exit 1
-fi
-fi
-fi
-SHELL=${CONFIG_SHELL-/bin/sh}
-export SHELL
-# Unset more variables known to interfere with behavior of common tools.
-CLICOLOR_FORCE= GREP_OPTIONS=
-unset CLICOLOR_FORCE GREP_OPTIONS
-
-## --------------------- ##
-## M4sh Shell Functions. ##
-## --------------------- ##
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
-  { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
-  return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
-  set +e
-  as_fn_set_status $1
-  exit $1
-} # as_fn_exit
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || eval $as_mkdir_p || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_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 ||
-$as_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" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-  eval 'as_fn_append ()
-  {
-    eval $1+=\$2
-  }'
-else
-  as_fn_append ()
-  {
-    eval $1=\$$1\$2
-  }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-  eval 'as_fn_arith ()
-  {
-    as_val=$(( $* ))
-  }'
-else
-  as_fn_arith ()
-  {
-    as_val=`expr "$@" || test $? -eq 1`
-  }
-fi # as_fn_arith
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
-  fi
-  $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
-} # as_fn_error
-
-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
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-
-  as_lineno_1=$LINENO as_lineno_1a=$LINENO
-  as_lineno_2=$LINENO as_lineno_2a=$LINENO
-  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
-  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
-
-  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
-  # already done that, so ensure we don't try to do so again and fall
-  # in an infinite loop.  This has already happened in practice.
-  _as_can_reexec=no; export _as_can_reexec
-  # 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
-}
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
-  case `echo 'xy\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  xy)  ECHO_C='\c';;
-  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
-       ECHO_T='	';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -pR'
-  fi
-else
-  as_ln_s='cp -pR'
-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='mkdir -p "$as_dir"'
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# 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'"
-
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, old GNU/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=
-
-# Identity of this package.
-PACKAGE_NAME='librttopo'
-PACKAGE_TARNAME='librttopo'
-PACKAGE_VERSION='1.0.0-RC2'
-PACKAGE_STRING='librttopo 1.0.0-RC2'
-PACKAGE_BUGREPORT='strk at keybit.net'
-PACKAGE_URL=''
-
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='am__EXEEXT_FALSE
-am__EXEEXT_TRUE
-LTLIBOBJS
-SRID_USR_MAX
-SRID_MAX
-RTGEOM_GEOS_VERSION
-GEOS_CFLAGS
-GEOS_LDFLAGS
-GEOSCONFIG
-LIBOBJS
-CXXCPP
-OTOOL64
-OTOOL
-LIPO
-NMEDIT
-DSYMUTIL
-MANIFEST_TOOL
-RANLIB
-ac_ct_AR
-AR
-NM
-ac_ct_DUMPBIN
-DUMPBIN
-LD
-FGREP
-SED
-LIBTOOL
-OBJDUMP
-DLLTOOL
-AS
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-LN_S
-am__fastdepCXX_FALSE
-am__fastdepCXX_TRUE
-CXXDEPMODE
-ac_ct_CXX
-CXXFLAGS
-CXX
-EGREP
-GREP
-CPP
-am__fastdepCC_FALSE
-am__fastdepCC_TRUE
-CCDEPMODE
-am__nodep
-AMDEPBACKSLASH
-AMDEP_FALSE
-AMDEP_TRUE
-am__quote
-am__include
-DEPDIR
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-LIBRTGEOM_VERSION
-MAINT
-MAINTAINER_MODE_FALSE
-MAINTAINER_MODE_TRUE
-AM_BACKSLASH
-AM_DEFAULT_VERBOSITY
-AM_DEFAULT_V
-AM_V
-am__untar
-am__tar
-AMTAR
-am__leading_dot
-SET_MAKE
-AWK
-mkdir_p
-MKDIR_P
-INSTALL_STRIP_PROGRAM
-STRIP
-install_sh
-MAKEINFO
-AUTOHEADER
-AUTOMAKE
-AUTOCONF
-ACLOCAL
-VERSION
-PACKAGE
-CYGPATH_W
-am__isrc
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_URL
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-enable_silent_rules
-enable_maintainer_mode
-enable_dependency_tracking
-enable_shared
-enable_static
-with_pic
-enable_fast_install
-with_gnu_ld
-with_sysroot
-enable_libtool_lock
-with_geosconfig
-'
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP
-CXX
-CXXFLAGS
-CCC
-CXXCPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-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_TARNAME}'
-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= ;;
-  *)    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_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
-
-  -enable-* | --enable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=\$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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=\$ac_optarg ;;
-
-  -without-* | --without-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=no ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    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 ;;
-
-  -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
-    ;;
-
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    case $ac_envvar in #(
-      '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
-    esac
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
-  *)
-    # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error $? "missing argument to $ac_option"
-fi
-
-if test -n "$ac_unrecognized_opts"; then
-  case $enable_option_checking in
-    no) ;;
-    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
-  esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
-		datadir sysconfdir sharedstatedir localstatedir includedir \
-		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
-do
-  eval ac_val=\$$ac_var
-  # Remove trailing slashes.
-  case $ac_val in
-    */ )
-      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
-      eval $ac_var=\$ac_val;;
-  esac
-  # Be sure to have absolute directory names.
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-  esac
-  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
-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
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error $? "working directory cannot be determined"
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error $? "pwd does not report name of working directory"
-
-
-# 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 -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_myself" : 'X\(//\)[^/]' \| \
-	 X"$as_myself" : 'X\(//\)$' \| \
-	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
-    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 .."
-  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
-	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 librttopo 1.0.0-RC2 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/librttopo]
-  --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
-  case $ac_init_help in
-     short | recursive ) echo "Configuration of librttopo 1.0.0-RC2:";;
-   esac
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-option-checking  ignore unrecognized --enable/--with options
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-silent-rules   less verbose build output (undo: "make V=1")
-  --disable-silent-rules  verbose build output (undo: "make V=0")
-  --enable-maintainer-mode
-                          enable make rules and dependencies not useful (and
-                          sometimes confusing) to the casual installer
-  --enable-dependency-tracking
-                          do not reject slow dependency extractors
-  --disable-dependency-tracking
-                          speeds up one-time build
-  --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-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
-                          both]
-  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
-  --with-geosconfig=FILE  specify an alternative geos-config file
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  CPP         C preprocessor
-  CXX         C++ compiler command
-  CXXFLAGS    C++ compiler flags
-  CXXCPP      C++ preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <strk at keybit.net>.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" ||
-      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
-      continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-librttopo configure 1.0.0-RC2
-generated by GNU Autoconf 2.69
-
-Copyright (C) 2012 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
-
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
-
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
-  if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-    ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_cpp
-
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_header_compiler=yes
-else
-  ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  ac_header_preproc=yes
-else
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
-  yes:no: )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------ ##
-## Report this to strk at keybit.net ##
-## ------------------------------ ##"
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
-# ac_fn_cxx_try_compile LINENO
-# ----------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
-  if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_compile
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* 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 $2 ();
-/* 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_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_cxx_try_cpp LINENO
-# ------------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-    ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_cpp
-
-# ac_fn_cxx_try_link LINENO
-# -------------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_link
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=no"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof ($2))
-	 return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
-	    return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  eval "$3=yes"
-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
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-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 librttopo $as_me 1.0.0-RC2, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
-  done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
-    2)
-      as_fn_append 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
-      as_fn_append ac_configure_args " '$ac_arg'"
-      ;;
-    esac
-  done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset 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
-
-    $as_echo "## ---------------- ##
-## Cache variables. ##
-## ---------------- ##"
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) { eval $ac_var=; 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
-
-    $as_echo "## ----------------- ##
-## Output variables. ##
-## ----------------- ##"
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
-## File substitutions. ##
-## ------------------- ##"
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	$as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      $as_echo "## ----------- ##
-## confdefs.h. ##
-## ----------- ##"
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; as_fn_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
-
-$as_echo "/* confdefs.h */" > 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
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
-else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file" \
-      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
-  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.  DJGPP emulates it as a regular file.
-  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	# differences in whitespace do not lead to failure.
-	ac_old_val_w=`echo x $ac_old_val`
-	ac_new_val_w=`echo x $ac_new_val`
-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	  ac_cache_corrupted=:
-	else
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-	  eval $ac_var=\$ac_old_val
-	fi
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_ext=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
-
-
-
-am__api_version='1.14'
-
-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
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
-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.
-
-
-# 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.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$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
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
-  done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
-$as_echo_n "checking whether build environment is sane... " >&6; }
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
-esac
-case $srcdir in
-  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
-esac
-
-# 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 (
-   am_has_slept=no
-   for am_try in 1 2; do
-     echo "timestamp, slept: $am_has_slept" > conftest.file
-     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
-     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".
-	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-  alias in your environment" "$LINENO" 5
-     fi
-     if test "$2" = conftest.file || test $am_try -eq 2; then
-       break
-     fi
-     # Just in case.
-     sleep 1
-     am_has_slept=yes
-   done
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   as_fn_error $? "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-# If we didn't sleep, we still need to ensure time stamps of config.status and
-# generated files are strictly newer.
-am_sleep_pid=
-if grep 'slept: no' conftest.file >/dev/null 2>&1; then
-  ( sleep 1 ) &
-  am_sleep_pid=$!
-fi
-
-rm -f conftest.file
-
-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 $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --is-lightweight"; then
-  am_missing_run="$MISSING "
-else
-  am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
-fi
-
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
-  esac
-fi
-
-# 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
-$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-if test -z "$MKDIR_P"; then
-  if ${ac_cv_path_mkdir+:} false; then :
-  $as_echo_n "(cached) " >&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
-	   as_fn_executable_p "$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
-
-  test -d ./--version && rmdir ./--version
-  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.
-    MKDIR_P="$ac_install_sh -d"
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
-$as_echo "$MKDIR_P" >&6; }
-
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
-  $as_echo_n "(cached) " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-
-# Check whether --enable-silent-rules was given.
-if test "${enable_silent_rules+set}" = set; then :
-  enableval=$enable_silent_rules;
-fi
-
-case $enable_silent_rules in # (((
-  yes) AM_DEFAULT_VERBOSITY=0;;
-   no) AM_DEFAULT_VERBOSITY=1;;
-    *) AM_DEFAULT_VERBOSITY=1;;
-esac
-am_make=${MAKE-make}
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
-$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
-if ${am_cv_make_support_nested_variables+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if $as_echo 'TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-	@$(TRUE)
-.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
-$as_echo "$am_cv_make_support_nested_variables" >&6; }
-if test $am_cv_make_support_nested_variables = yes; then
-    AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AM_BACKSLASH='\'
-
-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
-    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
-  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='librttopo'
- VERSION='1.0.0-RC2'
-
-
-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"}
-
-# For better backward compatibility.  To be removed once Automake 1.9.x
-# dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
-mkdir_p='$(MKDIR_P)'
-
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AMTAR='$${TAR-tar}'
-
-
-# We'll loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar  pax cpio none'
-
-am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
-
-
-
-
-
-
-# POSIX will say in a future version that running "rm -f" with no argument
-# is OK; and we want to be able to make that assumption in our Makefile
-# recipes.  So use an aggressive probe to check that the usage we want is
-# actually supported "in the wild" to an acceptable degree.
-# See automake bug#10828.
-# To make any issue more visible, cause the running configure to be aborted
-# by default if the 'rm' program in use doesn't match our expectations; the
-# user can still override this though.
-if rm -f && rm -fr && rm -rf; then : OK; else
-  cat >&2 <<'END'
-Oops!
-
-Your 'rm' program seems unable to run without file operands specified
-on the command line, even when the '-f' option is present.  This is contrary
-to the behaviour of most rm programs out there, and not conforming with
-the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
-
-Please tell bug-automake at gnu.org about your system, including the value
-of your $PATH and any error possibly output before this message.  This
-can help us improve future automake versions.
-
-END
-  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
-    echo 'Configuration will proceed anyway, since you have set the' >&2
-    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
-    echo >&2
-  else
-    cat >&2 <<'END'
-Aborting the configuration process, to ensure you take notice of the issue.
-
-You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
-
-If you want to complete the configuration process using your problematic
-'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
-to "yes", and re-run configure.
-
-END
-    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
-  fi
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
-$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
-    # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then :
-  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
-else
-  USE_MAINTAINER_MODE=no
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
-$as_echo "$USE_MAINTAINER_MODE" >&6; }
-   if test $USE_MAINTAINER_MODE = yes; then
-  MAINTAINER_MODE_TRUE=
-  MAINTAINER_MODE_FALSE='#'
-else
-  MAINTAINER_MODE_TRUE='#'
-  MAINTAINER_MODE_FALSE=
-fi
-
-  MAINT=$MAINTAINER_MODE_TRUE
-
-
-ac_config_headers="$ac_config_headers src/rttopo_config.h"
-
-
-# disabling debug support
-
-$as_echo "#define NDEBUG 1" >>confdefs.h
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define LIBRTGEOM_VERSION "$VERSION"
-_ACEOF
-
-
-
-
-$as_echo "#define RTGEOM_DEBUG_LEVEL 1" >>confdefs.h
-
-
-cat >>confdefs.h <<_ACEOF
-#define RTGEOM_DEBUG_LEVEL 0
-_ACEOF
-
-
-# Checks for header files.
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_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='\'
-  am__nodep='_no'
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-	;;
-    [ab].out )
-	# We found the default executable, but exeext='' is most
-	# certainly right.
-	break;;
-    *.* )
-	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
-	break;;
-    * )
-	break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-ac_exeext=$ac_cv_exeext
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  break;;
-    * ) break;;
-  esac
-done
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
-  { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-  if { ac_try='./conftest$ac_cv_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* 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"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
-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_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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
-$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
-if ${am_cv_prog_cc_c_o+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-  # Make sure it works both with $CC and with simple cc.
-  # Following AC_PROG_CC_C_O, we do the test twice because some
-  # compilers refuse to overwrite an existing .o file with -o,
-  # though they will create one.
-  am_cv_prog_cc_c_o=yes
-  for am_i in 1 2; do
-    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
-   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } \
-         && test -f conftest2.$ac_objext; then
-      : OK
-    else
-      am_cv_prog_cc_c_o=no
-      break
-    fi
-  done
-  rm -f core conftest*
-  unset am_i
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
-$as_echo "$am_cv_prog_cc_c_o" >&6; }
-if test "$am_cv_prog_cc_c_o" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-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
-
-
-depcc="$CC"   am_compiler_list=
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CC_dependencies_compiler_type+:} false; then :
-  $as_echo_n "(cached) " >&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".
-  rm -rf conftest.dir
-  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
-  am__universal=false
-  case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac
-
-  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 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # 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.  Also, some Intel
-    # versions had trouble with output in subdirs.
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    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
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
-$as_echo "$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
-
-
-
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-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
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  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"
-      as_fn_executable_p "$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
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_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
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    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
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  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"
-      as_fn_executable_p "$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
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_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
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    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
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#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
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# 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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in stdlib.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDLIB_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find stdlib.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in stdio.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdio_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDIO_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find stdio.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in string.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
-if test "x$ac_cv_header_string_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STRING_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find string.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in math.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default"
-if test "x$ac_cv_header_math_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_MATH_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find math.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in float.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default"
-if test "x$ac_cv_header_float_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_FLOAT_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find float.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in inttypes.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default"
-if test "x$ac_cv_header_inttypes_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_INTTYPES_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find inttypes.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in stdint.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdint_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDINT_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find stdint.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in ctype.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default"
-if test "x$ac_cv_header_ctype_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_CTYPE_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find ctype.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in errno.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
-if test "x$ac_cv_header_errno_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_ERRNO_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find errno.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in assert.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "assert.h" "ac_cv_header_assert_h" "$ac_includes_default"
-if test "x$ac_cv_header_assert_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_ASSERT_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find assert.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-for ac_header in stdarg.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdarg_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDARG_H 1
-_ACEOF
-
-else
-  as_fn_error $? "cannot find stdarg.h, bailing out" "$LINENO" 5
-fi
-
-done
-
-
-
-# Checks for programs.
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
-  if test -n "$CCC"; then
-    CXX=$CCC
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CXX"; then
-  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CXX="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CXX=$ac_ct_CXX
-  fi
-fi
-
-  fi
-fi
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GXX=yes
-else
-  GXX=
-fi
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
-$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-   ac_cxx_werror_flag=yes
-   ac_cv_prog_cxx_g=no
-   CXXFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_cv_prog_cxx_g=yes
-else
-  CXXFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-	 CXXFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ac_cv_prog_cxx_g=yes
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
-$as_echo "$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS=$ac_save_CXXFLAGS
-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=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="$CXX"  am_compiler_list=
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
-  $as_echo_n "(cached) " >&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".
-  rm -rf conftest.dir
-  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
-  am__universal=false
-  case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac
-
-  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 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # 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.  Also, some Intel
-    # versions had trouble with output in subdirs.
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    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
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
-$as_echo "$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
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* 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"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
-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_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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
-$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
-if ${am_cv_prog_cc_c_o+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-  # Make sure it works both with $CC and with simple cc.
-  # Following AC_PROG_CC_C_O, we do the test twice because some
-  # compilers refuse to overwrite an existing .o file with -o,
-  # though they will create one.
-  am_cv_prog_cc_c_o=yes
-  for am_i in 1 2; do
-    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
-   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } \
-         && test -f conftest2.$ac_objext; then
-      : OK
-    else
-      am_cv_prog_cc_c_o=no
-      break
-    fi
-  done
-  rm -f core conftest*
-  unset am_i
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
-$as_echo "$am_cv_prog_cc_c_o" >&6; }
-if test "$am_cv_prog_cc_c_o" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-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
-
-
-depcc="$CC"   am_compiler_list=
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CC_dependencies_compiler_type+:} false; then :
-  $as_echo_n "(cached) " >&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".
-  rm -rf conftest.dir
-  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
-  am__universal=false
-  case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac
-
-  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 10 /bin/sh.
-      echo '/* dummy */' > sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # 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.  Also, some Intel
-    # versions had trouble with output in subdirs.
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    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
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok '-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
-$as_echo "$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
-
-
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-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
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
-  $as_echo_n "(cached) " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
-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
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
-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
-
-
-enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AS+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AS="${ac_tool_prefix}as"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-AS=$ac_cv_prog_AS
-if test -n "$AS"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
-$as_echo "$AS" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AS"; then
-  ac_ct_AS=$AS
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AS+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_AS"; then
-  ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_AS="as"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AS=$ac_cv_prog_ac_ct_AS
-if test -n "$ac_ct_AS"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
-$as_echo "$ac_ct_AS" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_AS" = x; then
-    AS="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AS=$ac_ct_AS
-  fi
-else
-  AS="$ac_cv_prog_AS"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DLLTOOL=$ac_ct_DLLTOOL
-  fi
-else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OBJDUMP"; then
-  ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
-  ac_ct_OBJDUMP=$OBJDUMP
-  # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OBJDUMP"; then
-  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
-else
-  OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
-
-  ;;
-esac
-
-test -z "$AS" && AS=as
-
-
-
-
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
-
-
-case `pwd` in
-  *\ * | *\	*)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
-
-
-
-macro_version='2.4.2'
-macro_revision='1.3337'
-
-
-
-
-
-
-
-
-
-
-
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-# Backslashify metacharacters that are still active within
-# double-quoted strings.
-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 delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
-$as_echo_n "checking how to print strings... " >&6; }
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO ""
-}
-
-case "$ECHO" in
-  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
-$as_echo "printf" >&6; } ;;
-  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
-$as_echo "print -r" >&6; } ;;
-  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
-$as_echo "cat" >&6; } ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
-$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
-     for ac_i in 1 2 3 4 5 6 7; do
-       ac_script="$ac_script$as_nl$ac_script"
-     done
-     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     { ac_script=; unset ac_script;}
-     if test -z "$SED"; then
-  ac_path_SED_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
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_SED" || continue
-# Check for GNU ac_path_SED and select it if it is found.
-  # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
-  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo '' >> "conftest.nl"
-    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_SED_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_SED="$ac_path_SED"
-      ac_path_SED_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_SED_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
-  fi
-else
-  ac_cv_path_SED=$SED
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
-$as_echo "$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
-  rm -f conftest.sed
-
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
-$as_echo_n "checking for fgrep... " >&6; }
-if ${ac_cv_path_FGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
-   then ac_cv_path_FGREP="$GREP -F"
-   else
-     if test -z "$FGREP"; then
-  ac_path_FGREP_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 fgrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_FGREP" || continue
-# Check for GNU ac_path_FGREP and select it if it is found.
-  # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'FGREP' >> "conftest.nl"
-    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_FGREP="$ac_path_FGREP"
-      ac_path_FGREP_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_FGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_FGREP=$FGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
-$as_echo "$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
-
-
-test -z "$GREP" && GREP=grep
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# 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.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if ${lt_cv_path_LD+:} false; then :
-  $as_echo_n "(cached) " >&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 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
-$as_echo "$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if ${lt_cv_path_NM+:} false; then :
-  $as_echo_n "(cached) " >&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
-  : ${lt_cv_path_NM=no}
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in dumpbin "link -dump"
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DUMPBIN"; then
-  ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$DUMPBIN" && break
-  done
-fi
-if test -z "$DUMPBIN"; then
-  ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in dumpbin "link -dump"
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DUMPBIN"; then
-  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_DUMPBIN" && break
-done
-
-  if test "x$ac_ct_DUMPBIN" = x; then
-    DUMPBIN=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DUMPBIN=$ac_ct_DUMPBIN
-  fi
-fi
-
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
-
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if ${lt_cv_nm_interface+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
-  cat conftest.out >&5
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
-
-# find the maximum length of command line arguments
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
-$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if ${lt_cv_sys_max_cmd_len+:} false; then :
-  $as_echo_n "(cached) " >&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* | cegcc*)
-    # 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;
-    ;;
-
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    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
-    ;;
-
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
-  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" && \
-	test undefined != "$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
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
-$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
-$as_echo "none" >&6; }
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-
-
-
-
-
-
-: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
-
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-
-
-
-
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
-$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
-if ${lt_cv_to_host_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-
-fi
-
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
-$as_echo "$lt_cv_to_host_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
-$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
-if ${lt_cv_to_tool_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  #assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-
-fi
-
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
-$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
-$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if ${lt_cv_ld_reload_flag+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_reload_flag='-r'
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
-$as_echo "$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
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
-  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
-
-
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OBJDUMP"; then
-  ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
-  ac_ct_OBJDUMP=$OBJDUMP
-  # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OBJDUMP"; then
-  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
-else
-  OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
-$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if ${lt_cv_deplibs_check_method+:} false; then :
-  $as_echo_n "(cached) " >&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
-aix[4-9]*)
-  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.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && 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
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-cegcc*)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
-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
-  ;;
-
-haiku*)
-  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])(-bit)?( [LM]SB)? 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 glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd* | netbsdelf*-gnu)
-  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=pass_all
-  ;;
-
-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
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  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
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
-$as_echo "$lt_cv_deplibs_check_method" >&6; }
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
-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 test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DLLTOOL=$ac_ct_DLLTOOL
-  fi
-else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
-$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
-if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
-$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in ar
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$AR" && break
-  done
-fi
-if test -z "$AR"; then
-  ac_ct_AR=$AR
-  for ac_prog in ar
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_AR="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_AR" && break
-done
-
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AR=$ac_ct_AR
-  fi
-fi
-
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
-$as_echo_n "checking for archiver @FILE support... " >&6; }
-if ${lt_cv_ar_at_file+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ar_at_file=no
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
-      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
-$as_echo "$lt_cv_ar_at_file" >&6; }
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-test -z "$STRIP" && STRIP=:
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:${as_lineno-$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-test -z "$RANLIB" && RANLIB=:
-
-
-
-
-
-
-# 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 \$tool_oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# 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 for command to grab the raw symbol name followed by C symbol from nm.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
-$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if ${lt_cv_sys_global_symbol_pipe+:} false; then :
-  $as_echo_n "(cached) " >&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]*\)'
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[BCDT]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[ABCDEGRST]'
-  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
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[ABCDGIRSTW]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
-
-# 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
-
-# Try without a prefix underscore, 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.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK '"\
-"     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
-
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$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=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && 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 <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
-
-	  cat <<_LT_EOF >> conftest.$ac_ext
-
-/* The mapping between symbol names and symbols.  */
-LT_DLSYM_CONST struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_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 -rf 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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-fi
-
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
-$as_echo_n "checking for sysroot... " >&6; }
-
-# Check whether --with-sysroot was given.
-if test "${with_sysroot+set}" = set; then :
-  withval=$with_sysroot;
-else
-  with_sysroot=no
-fi
-
-
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
-   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
-   ;;
-esac
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
-$as_echo "${lt_sysroot:-no}" >&6; }
-
-
-
-
-
-# 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\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; 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 '$LINENO' "configure"' > conftest.$ac_ext
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; 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*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; 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*)
-	    case `/usr/bin/file conftest.o` in
-	      *x86-64*)
-		LD="${LD-ld} -m elf32_x86_64"
-		;;
-	      *)
-		LD="${LD-ld} -m elf_i386"
-		;;
-	    esac
-	    ;;
-	  powerpc64le-*)
-	    LD="${LD-ld} -m elf32lppclinux"
-	    ;;
-	  powerpc64-*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	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"
-	    ;;
-	  powerpcle-*)
-	    LD="${LD-ld} -m elf64lppc"
-	    ;;
-	  powerpc-*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    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"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
-$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if ${lt_cv_cc_needs_belf+:} false; then :
-  $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  lt_cv_cc_needs_belf=yes
-else
-  lt_cv_cc_needs_belf=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
-$as_echo "$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
-  ;;
-*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
-
-need_locks="$enable_libtool_lock"
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
-set dummy ${ac_tool_prefix}mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$MANIFEST_TOOL"; then
-  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
-if test -n "$MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
-$as_echo "$MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
-  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
-  # Extract the first word of "mt", so it can be a program name with args.
-set dummy mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_MANIFEST_TOOL"; then
-  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
-if test -n "$ac_ct_MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
-$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_MANIFEST_TOOL" = x; then
-    MANIFEST_TOOL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
-  fi
-else
-  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
-fi
-
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
-$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
-if ${lt_cv_path_mainfest_tool+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&5
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
-$as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-
-
-
-
-
-
-  case $host_os in
-    rhapsody* | darwin*)
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DSYMUTIL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DSYMUTIL"; then
-  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-DSYMUTIL=$ac_cv_prog_DSYMUTIL
-if test -n "$DSYMUTIL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
-$as_echo "$DSYMUTIL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DSYMUTIL"; then
-  ac_ct_DSYMUTIL=$DSYMUTIL
-  # Extract the first word of "dsymutil", so it can be a program name with args.
-set dummy dsymutil; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DSYMUTIL"; then
-  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
-if test -n "$ac_ct_DSYMUTIL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
-$as_echo "$ac_ct_DSYMUTIL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_DSYMUTIL" = x; then
-    DSYMUTIL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DSYMUTIL=$ac_ct_DSYMUTIL
-  fi
-else
-  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
-fi
-
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_NMEDIT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$NMEDIT"; then
-  ac_cv_prog_NMEDIT="$NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-NMEDIT=$ac_cv_prog_NMEDIT
-if test -n "$NMEDIT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
-$as_echo "$NMEDIT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_NMEDIT"; then
-  ac_ct_NMEDIT=$NMEDIT
-  # Extract the first word of "nmedit", so it can be a program name with args.
-set dummy nmedit; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_NMEDIT"; then
-  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
-if test -n "$ac_ct_NMEDIT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
-$as_echo "$ac_ct_NMEDIT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_NMEDIT" = x; then
-    NMEDIT=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    NMEDIT=$ac_ct_NMEDIT
-  fi
-else
-  NMEDIT="$ac_cv_prog_NMEDIT"
-fi
-
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
-set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_LIPO+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$LIPO"; then
-  ac_cv_prog_LIPO="$LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-LIPO=$ac_cv_prog_LIPO
-if test -n "$LIPO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
-$as_echo "$LIPO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_LIPO"; then
-  ac_ct_LIPO=$LIPO
-  # Extract the first word of "lipo", so it can be a program name with args.
-set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_LIPO"; then
-  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_LIPO="lipo"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
-if test -n "$ac_ct_LIPO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
-$as_echo "$ac_ct_LIPO" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_LIPO" = x; then
-    LIPO=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LIPO=$ac_ct_LIPO
-  fi
-else
-  LIPO="$ac_cv_prog_LIPO"
-fi
-
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OTOOL"; then
-  ac_cv_prog_OTOOL="$OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OTOOL=$ac_cv_prog_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OTOOL"; then
-  ac_ct_OTOOL=$OTOOL
-  # Extract the first word of "otool", so it can be a program name with args.
-set dummy otool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OTOOL"; then
-  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OTOOL="otool"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
-if test -n "$ac_ct_OTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
-$as_echo "$ac_ct_OTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OTOOL" = x; then
-    OTOOL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OTOOL=$ac_ct_OTOOL
-  fi
-else
-  OTOOL="$ac_cv_prog_OTOOL"
-fi
-
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL64+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OTOOL64"; then
-  ac_cv_prog_OTOOL64="$OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OTOOL64=$ac_cv_prog_OTOOL64
-if test -n "$OTOOL64"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
-$as_echo "$OTOOL64" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OTOOL64"; then
-  ac_ct_OTOOL64=$OTOOL64
-  # Extract the first word of "otool64", so it can be a program name with args.
-set dummy otool64; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OTOOL64"; then
-  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OTOOL64="otool64"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
-if test -n "$ac_ct_OTOOL64"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
-$as_echo "$ac_ct_OTOOL64" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OTOOL64" = x; then
-    OTOOL64=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OTOOL64=$ac_ct_OTOOL64
-  fi
-else
-  OTOOL64="$ac_cv_prog_OTOOL64"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
-$as_echo_n "checking for -single_module linker flag... " >&6; }
-if ${lt_cv_apple_cc_single_mod+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&5
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&5
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&5
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
-$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
-$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if ${lt_cv_ld_exported_symbols_list+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  lt_cv_ld_exported_symbols_list=yes
-else
-  lt_cv_ld_exported_symbols_list=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-	LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
-$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
-$as_echo_n "checking for -force_load linker flag... " >&6; }
-if ${lt_cv_ld_force_load+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
-      echo "$AR cru libconftest.a conftest.o" >&5
-      $AR cru libconftest.a conftest.o 2>&5
-      echo "$RANLIB libconftest.a" >&5
-      $RANLIB libconftest.a 2>&5
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&5
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&5
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
-$as_echo "$lt_cv_ld_force_load" >&6; }
-    case $host_os in
-    rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[012]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-
-for ac_header in dlfcn.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
-"
-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DLFCN_H 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-
-
-
-
-
-# Set options
-
-
-
-        enable_dlopen=no
-
-
-
-            # 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 --with-pic was given.
-if test "${with_pic+set}" = set; then :
-  withval=$with_pic; lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
-else
-  pic_mode=default
-fi
-
-
-test -z "$pic_mode" && pic_mode=default
-
-
-
-
-
-
-
-  # 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
-
-
-
-
-
-
-
-
-
-
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-test -z "$LN_S" && LN_S="ln -s"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
-$as_echo_n "checking for objdir... " >&6; }
-if ${lt_cv_objdir+:} false; then :
-  $as_echo_n "(cached) " >&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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
-$as_echo "$lt_cv_objdir" >&6; }
-objdir=$lt_cv_objdir
-
-
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define LT_OBJDIR "$lt_cv_objdir/"
-_ACEOF
-
-
-
-
-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
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
-
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-
-
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
-$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
-  $as_echo_n "(cached) " >&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 <<_LT_EOF 1>&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 at gnu.org
-
-_LT_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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
-
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
-$as_echo_n "checking for file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
-  $as_echo_n "(cached) " >&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 <<_LT_EOF 1>&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 at gnu.org
-
-_LT_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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  else
-    MAGIC_CMD=:
-  fi
-fi
-
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-
-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 the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$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 -r conftest*
-
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-
-lt_prog_compiler_no_builtin_flag=
-
-if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
-  *)
-    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
-  esac
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
-  $as_echo_n "(cached) " >&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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-$as_echo "$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=
-
-
-  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*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic='-fPIC'
-        ;;
-      m68k)
-            # 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'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # 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'
-      ;;
-
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static=
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='-fPIC'
-	;;
-      esac
-      ;;
-
-    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
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      lt_prog_compiler_pic='-fPIC'
-      ;;
-    esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      lt_prog_compiler_wl='-Xlinker '
-      if test -n "$lt_prog_compiler_pic"; then
-        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
-      fi
-      ;;
-    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
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # 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'
-      ;;
-
-    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-KPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-fPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='--shared'
-	lt_prog_compiler_static='--static'
-	;;
-      nagfor*)
-	# NAG Fortran compiler
-	lt_prog_compiler_wl='-Wl,-Wl,,'
-	lt_prog_compiler_pic='-PIC'
-	lt_prog_compiler_static='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
-        # 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'
-        ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-qpic'
-	lt_prog_compiler_static='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
-	  # 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=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Qoption ld '
-	  ;;
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
-	  ;;
-        *Intel*\ [CF]*Compiler*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fPIC'
-	  lt_prog_compiler_static='-static'
-	  ;;
-	*Portland\ Group*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fpic'
-	  lt_prog_compiler_static='-Bstatic'
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    newsos6)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
-
-    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* | sunf77* | sunf90* | sunf95*)
-	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
-
-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
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
-$as_echo "$lt_cv_prog_compiler_pic" >&6; }
-lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_pic_works=yes
-     fi
-   fi
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
-
-if test x"$lt_cv_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
-
-
-
-
-
-
-
-
-
-
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if ${lt_cv_prog_compiler_static_works+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
-$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
-
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
-    :
-else
-    lt_prog_compiler_static=
-fi
-
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o+:} false; then :
-  $as_echo_n "(cached) " >&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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o+:} false; then :
-  $as_echo_n "(cached) " >&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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_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
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
-
-  runpath_var=
-  allow_undefined_flag=
-  always_export_symbols=no
-  archive_cmds=
-  archive_expsym_cmds=
-  compiler_needs_object=no
-  enable_shared_with_static_runtimes=no
-  export_dynamic_flag_spec=
-  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic=no
-  hardcode_direct=no
-  hardcode_direct_absolute=no
-  hardcode_libdir_flag_spec=
-  hardcode_libdir_separator=
-  hardcode_minus_L=no
-  hardcode_shlibpath_var=unsupported
-  inherit_rpath=no
-  link_all_deplibs=unknown
-  module_cmds=
-  module_expsym_cmds=
-  old_archive_from_new_cmds=
-  old_archive_from_expsyms_cmds=
-  thread_safe_flag_spec=
-  whole_archive_flag_spec=
-  # 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_|_GLOBAL__F[ID]_.*'
-  # 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.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # 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
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    link_all_deplibs=no
-    ;;
-  esac
-
-  ld_shlibs=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
-	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = 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>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
-      *\ [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
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            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
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> 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* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec='-L$libdir'
-      export_dynamic_flag_spec='${wl}--export-all-symbols'
-      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/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
-
-      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
-      ;;
-
-    haiku*)
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      link_all_deplibs=yes
-      ;;
-
-    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* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=' $pic_flag'
-	tmp_sharedflag='-shared'
-	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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# 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; func_echo_all \"$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' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  whole_archive_flag_spec=
-	  tmp_sharedflag='--shared' ;;
-	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  ;;
-	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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; 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
-
-	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; 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~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        ld_shlibs=no
-      fi
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      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 $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $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 <<_LT_EOF 1>&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.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $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
-	;;
-	*)
-	  # 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.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	    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
-      ;;
-
-    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 $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $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
-      ;;
-
-    aix[4-9]*)
-      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
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
-	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") || (\$ 2 == "W")) && (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].*|aix[5-9]*)
-	  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_direct_absolute=yes
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      file_list_spec='${wl}-f,'
-
-      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
-	link_all_deplibs=no
-      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
-
-      export_dynamic_flag_spec='${wl}-bexpall'
-      # 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.
-        if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_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 "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-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 func_echo_all "${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.
-	 if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_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 "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-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'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    whole_archive_flag_spec='$convenience'
-	  fi
-	  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*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            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
-        ;;
-      esac
-      ;;
-
-    bsdi[45]*)
-      export_dynamic_flag_spec=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # 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.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	hardcode_libdir_flag_spec=' '
-	allow_undefined_flag=unsupported
-	always_export_symbols=yes
-	file_list_spec='@'
-	# 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 $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
-	enable_shared_with_static_runtimes=yes
-	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	old_postinstall_cmds='chmod 644 $oldlib'
-	postlink_cmds='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	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 `func_echo_all "$deplibs" | $SED '\''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'
-	enable_shared_with_static_runtimes=yes
-	;;
-      esac
-      ;;
-
-    darwin* | rhapsody*)
-
-
-  archive_cmds_need_lc=no
-  hardcode_direct=no
-  hardcode_automatic=yes
-  hardcode_shlibpath_var=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
-  else
-    whole_archive_flag_spec=''
-  fi
-  link_all_deplibs=yes
-  allow_undefined_flag="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-
-  else
-  ld_shlibs=no
-  fi
-
-      ;;
-
-    dgux*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=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 $pic_flag -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 $pic_flag ${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 && test "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared $pic_flag ${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
-	hardcode_direct_absolute=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 && test "$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 $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -shared $pic_flag ${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'
-	  ;;
-	*)
-
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
-$as_echo_n "checking if $CC understands -b... " >&6; }
-if ${lt_cv_prog_compiler__b+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler__b=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS -b"
-   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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler__b=yes
-       fi
-     else
-       lt_cv_prog_compiler__b=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
-$as_echo "$lt_cv_prog_compiler__b" >&6; }
-
-if test x"$lt_cv_prog_compiler__b" = xyes; then
-    archive_cmds='$CC -b ${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
-
-	  ;;
-	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_direct=no
-	  hardcode_shlibpath_var=no
-	  ;;
-	*)
-	  hardcode_direct=yes
-	  hardcode_direct_absolute=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 $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
-$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
-if ${lt_cv_irix_exported_symbol+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int foo (void) { return 0; }
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  lt_cv_irix_exported_symbol=yes
-else
-  lt_cv_irix_exported_symbol=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
-$as_echo "$lt_cv_irix_exported_symbol" >&6; }
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      inherit_rpath=yes
-      link_all_deplibs=yes
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      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
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct=yes
-	hardcode_shlibpath_var=no
-	hardcode_direct_absolute=yes
-	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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      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} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${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='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-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; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_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
-      archive_cmds_need_lc='no'
-      hardcode_libdir_separator=:
-      ;;
-
-    solaris*)
-      no_undefined_flag=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${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 $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  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'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  archive_cmds='$CC -G${allow_undefined_flag} -h $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 -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      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='${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,$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
-      ;;
-
-    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
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
-$as_echo "$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
-
-with_gnu_ld=$with_gnu_ld
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#
-# 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.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } 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\":${as_lineno-$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=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	  then
-	    lt_cv_archive_cmds_need_lc=no
-	  else
-	    lt_cv_archive_cmds_need_lc=yes
-	  fi
-	  allow_undefined_flag=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
-      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
-
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
-    # 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 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
-  # 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; }
-}'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
-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 # correct to gnu/linux during the next big refactor
-  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'
-  ;;
-
-aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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<name>.so
-      # instead of lib<name>.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*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    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=`func_echo_all "$lib" | $SED '\''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'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    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~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    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="$sys_lib_search_path_spec /usr/lib/w32api"
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    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
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
-        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
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # 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'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # 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}${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 # correct to gnu/linux during the next big refactor
-  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
-  ;;
-
-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[23].*) 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
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  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=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  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'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-	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 glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
-fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # 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
-
-  # 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;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $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'
-  ;;
-
-netbsdelf*-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
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_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 # correct to gnu/linux during the next big refactor
-  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=qnx
-  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=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-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 # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-  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
-      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 # correct to gnu/linux during the next big refactor
-    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
-  shlibpath_overrides_runpath=yes
-  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'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    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'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
-$as_echo "$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
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" ||
-   test -n "$runpath_var" ||
-   test "X$hardcode_automatic" = "Xyes" ; then
-
-  # We can hardcode non-existent 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_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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
-$as_echo "$hardcode_action" >&6; }
-
-if test "$hardcode_action" = relink ||
-   test "$inherit_rpath" = yes; 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
-
-
-
-
-
-
-  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* | cegcc*)
-    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
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dl_dlopen=yes
-else
-  ac_cv_lib_dl_dlopen=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; 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
-
-    ;;
-
-  *)
-    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
-$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if ${ac_cv_lib_dld_shl_load+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dld_shl_load=yes
-else
-  ac_cv_lib_dld_shl_load=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
-$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
-else
-  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dl_dlopen=yes
-else
-  ac_cv_lib_dl_dlopen=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
-$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if ${ac_cv_lib_svld_dlopen+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsvld  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_svld_dlopen=yes
-else
-  ac_cv_lib_svld_dlopen=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
-$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
-$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if ${ac_cv_lib_dld_dld_link+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dld_dld_link=yes
-else
-  ac_cv_lib_dld_dld_link=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
-$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
-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"
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
-$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self+:} false; then :
-  $as_echo_n "(cached) " >&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 <<_LT_EOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#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
-
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 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;
-          else puts (dlerror ());
-	}
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}
-_LT_EOF
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
-$as_echo "$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\"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
-$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self_static+:} false; then :
-  $as_echo_n "(cached) " >&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 <<_LT_EOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#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
-
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 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;
-          else puts (dlerror ());
-	}
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}
-_LT_EOF
-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
-$as_echo "$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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-striplib=
-old_striplib=
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
-$as_echo_n "checking whether stripping libraries is possible... " >&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"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "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"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-    ;;
-  *)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    ;;
-  esac
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-  # Report which library types will actually be built
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&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
-    ;;
-
-  aix[4-9]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
-
-
-
-
-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"
-
-      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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
-$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
-if test -z "$CXXCPP"; then
-  if ${ac_cv_prog_CXXCPP+:} false; then :
-  $as_echo_n "(cached) " >&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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
-$as_echo "$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 <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-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
-
-else
-  _lt_caught_CXX_error=yes
-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
-
-archive_cmds_need_lc_CXX=no
-allow_undefined_flag_CXX=
-always_export_symbols_CXX=no
-archive_expsym_cmds_CXX=
-compiler_needs_object_CXX=no
-export_dynamic_flag_spec_CXX=
-hardcode_direct_CXX=no
-hardcode_direct_absolute_CXX=no
-hardcode_libdir_flag_spec_CXX=
-hardcode_libdir_separator_CXX=
-hardcode_minus_L_CXX=no
-hardcode_shlibpath_var_CXX=unsupported
-hardcode_automatic_CXX=no
-inherit_rpath_CXX=no
-module_cmds_CXX=
-module_expsym_cmds_CXX=
-link_all_deplibs_CXX=unknown
-old_archive_cmds_CXX=$old_archive_cmds
-reload_flag_CXX=$reload_flag
-reload_cmds_CXX=$reload_cmds
-no_undefined_flag_CXX=
-whole_archive_flag_spec_CXX=
-enable_shared_with_static_runtimes_CXX=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-objext_CXX=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
-  # 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 -r conftest*
-
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
-  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++"}
-  CFLAGS=$CXXFLAGS
-  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 "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-
-
-  if test -n "$compiler"; then
-    # We don't want -fno-exception when 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.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if ${lt_cv_path_LD+:} false; then :
-  $as_echo_n "(cached) " >&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 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
-$as_echo "$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 $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        archive_expsym_cmds_CXX='$CC $pic_flag -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 -v "^Configured with:" | $GREP "\-L"'
-
-    else
-      GXX=no
-      with_gnu_ld=no
-      wlarc=
-    fi
-
-    # PORTME: fill in a description of your system's C++ link characteristics
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
-    ld_shlibs_CXX=yes
-    case $host_os in
-      aix3*)
-        # FIXME: insert proper C++ library support
-        ld_shlibs_CXX=no
-        ;;
-      aix[4-9]*)
-        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].*|aix[5-9]*)
-	    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_direct_absolute_CXX=yes
-        hardcode_libdir_separator_CXX=':'
-        link_all_deplibs_CXX=yes
-        file_list_spec_CXX='${wl}-f,'
-
-        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
-
-        export_dynamic_flag_spec_CXX='${wl}-bexpall'
-        # 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.
-          if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath__CXX=`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 "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__CXX
-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 func_echo_all "${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.
-	    if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath__CXX=`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 "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__CXX
-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'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      whole_archive_flag_spec_CXX='$convenience'
-	    fi
-	    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 <jrb3 at best.com> 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* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  hardcode_libdir_flag_spec_CXX=' '
-	  allow_undefined_flag_CXX=unsupported
-	  always_export_symbols_CXX=yes
-	  file_list_spec_CXX='@'
-	  # 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_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
-	  enable_shared_with_static_runtimes_CXX=yes
-	  # Don't use ranlib
-	  old_postinstall_cmds_CXX='chmod 644 $oldlib'
-	  postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  hardcode_libdir_flag_spec_CXX='-L$libdir'
-	  export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
-	  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
-	  ;;
-	esac
-	;;
-      darwin* | rhapsody*)
-
-
-  archive_cmds_need_lc_CXX=no
-  hardcode_direct_CXX=no
-  hardcode_automatic_CXX=yes
-  hardcode_shlibpath_var_CXX=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
-  else
-    whole_archive_flag_spec_CXX=''
-  fi
-  link_all_deplibs_CXX=yes
-  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      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${_lt_dsymutil}"
-      archive_expsym_cmds_CXX="sed '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${_lt_dar_export_syms}${_lt_dsymutil}"
-    fi
-
-  else
-  ld_shlibs_CXX=no
-  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
-        ;;
-
-      freebsd2.*)
-        # 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
-        ;;
-
-      haiku*)
-        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        link_all_deplibs_CXX=yes
-        ;;
-
-      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) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-            ;;
-          *)
-            if test "$GXX" = yes; then
-              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${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_direct_absolute_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; func_echo_all "$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 $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          *)
-	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${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" && func_echo_all "-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 $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	      else
-	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${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=:
-        inherit_rpath_CXX=yes
-        ;;
-
-      linux* | k*bsd*-gnu | kopensolaris*-gnu | 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; func_echo_all "$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* | ecpc* )
-	    # 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* | pgcpp*)
-            # Portland Group C++ compiler
-	    case `$CC -V` in
-	    *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
-	      prelink_cmds_CXX='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
-	      old_archive_cmds_CXX='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
-	      archive_cmds_CXX='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      archive_expsym_cmds_CXX='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    *) # Version 6 and above use weak symbols
-	      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'
-	      ;;
-	    esac
-
-	    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; func_echo_all \"$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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed'
-	    ;;
-	  xl* | mpixl* | bgxl*)
-	    # IBM XL 8.0 on PPC, with GNU ld
-	    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-	    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
-	      archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	    fi
-	    ;;
-	  *)
-	    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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	      compiler_needs_object_CXX=yes
-
-	      # Not sure whether something based on
-	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
-
-	      # 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::"'
-	;;
-
-      *nto* | *qnx*)
-        ld_shlibs_CXX=yes
-	;;
-
-      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
-	  hardcode_direct_absolute_CXX=yes
-	  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=func_echo_all
-	else
-	  ld_shlibs_CXX=no
-	fi
-	;;
-
-      osf3* | 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.
-	    case $host in
-	      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
-	      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
-	    esac
-	    ;;
-          RCC*)
-	    # Rational C++ 2.4.1
-	    # FIXME: insert proper C++ library support
-	    ld_shlibs_CXX=no
-	    ;;
-          cxx*)
-	    case $host in
-	      osf3*)
-	        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" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-		;;
-	      *)
-	        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" && func_echo_all "-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'
-		;;
-	    esac
-
-	    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=`func_echo_all "$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; func_echo_all "$list"'
-	    ;;
-	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	      case $host in
-	        osf3*)
-	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	        *)
-	          archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	      esac
-
-	      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 -v "^Configured with:" | $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* | sunCC*)
-	    # 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='func_echo_all'
-
-	    # 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 $pic_flag -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 $pic_flag -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 -v "^Configured with:" | $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 -v "^Configured with:" | $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.
-	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='${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,$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'
-	    old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
-	      '"$old_archive_cmds_CXX"
-	    reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
-	      '"$reload_cmds_CXX"
-	    ;;
-	  *)
-	    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
-      ;;
-
-      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
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
-$as_echo "$ld_shlibs_CXX" >&6; }
-    test "$ld_shlibs_CXX" = no && can_build_shared=no
-
-    GCC_CXX="$GXX"
-    LD_CXX="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    # 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=
-
-cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-_LT_EOF
-
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; 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
-
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${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
-       fi
-
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
-       if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} 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
-       prev=
-       ;;
-
-    *.lto.$objext) ;; # Ignore GCC LTO objects
-    *.$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
-CFLAGS=$_lt_libdeps_save_CFLAGS
-
-# 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* | sunCC*)
-    # 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
- compiler_lib_search_dirs_CXX=
-if test -n "${compiler_lib_search_path_CXX}"; then
- compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    lt_prog_compiler_wl_CXX=
-lt_prog_compiler_pic_CXX=
-lt_prog_compiler_static_CXX=
-
-
-  # 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*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic_CXX='-fPIC'
-        ;;
-      m68k)
-            # 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'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
-      # 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=
-      ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static_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 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	;;
-      *)
-	lt_prog_compiler_pic_CXX='-fPIC'
-	;;
-      esac
-      ;;
-    *qnx* | *nto*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic_CXX='-fPIC -shared'
-      ;;
-    *)
-      lt_prog_compiler_pic_CXX='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[4-9]*)
-	# 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_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
-	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# 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_CXX='-DDLL_EXPORT'
-	;;
-      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 | kopensolaris*-gnu | gnu*)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    lt_prog_compiler_wl_CXX='--backend -Wl,'
-	    lt_prog_compiler_pic_CXX='-fPIC'
-	    ;;
-	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    lt_prog_compiler_static_CXX='-static'
-	    ;;
-	  icpc* )
-	    # Intel C++, used to be incompatible with GCC.
-	    # ICC 10 doesn't accept -KPIC any more.
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-fPIC'
-	    lt_prog_compiler_static_CXX='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # 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'
-	    ;;
-	  xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-qpic'
-	    lt_prog_compiler_static_CXX='-qstaticlink'
-	    ;;
-	  *)
-	    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* | netbsdelf*-gnu)
-	;;
-      *qnx* | *nto*)
-        # QNX uses GNU C++, but need to define -shared option too, otherwise
-        # it will coredump.
-        lt_prog_compiler_pic_CXX='-fPIC -shared'
-        ;;
-      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* | sunCC*)
-	    # 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
-	;;
-      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
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	lt_prog_compiler_can_build_shared_CXX=no
-	;;
-    esac
-  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
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
-lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_CXX"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_pic_works_CXX=yes
-     fi
-   fi
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
-
-if test x"$lt_cv_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
-
-
-
-
-
-#
-# 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\"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_CXX=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_CXX=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
-
-if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
-    :
-else
-    lt_prog_compiler_static_CXX=
-fi
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
-  $as_echo_n "(cached) " >&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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
-  $as_echo_n "(cached) " >&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:$LINENO: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 ..
-   $RM -r conftest
-   $RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-$as_echo "$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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_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
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
-
-  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  case $host_os in
-  aix[4-9]*)
-    # 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
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
-    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") || (\$ 2 == "W")) && (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* | cegcc*)
-    case $cc_basename in
-    cl*)
-      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
-      ;;
-    esac
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    link_all_deplibs_CXX=no
-    ;;
-  *)
-    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
-  esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
-$as_echo "$ld_shlibs_CXX" >&6; }
-test "$ld_shlibs_CXX" = no && can_build_shared=no
-
-with_gnu_ld_CXX=$with_gnu_ld
-
-
-
-
-
-
-#
-# 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.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } 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\":${as_lineno-$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=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	  then
-	    lt_cv_archive_cmds_need_lc_CXX=no
-	  else
-	    lt_cv_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*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
-      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&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 # correct to gnu/linux during the next big refactor
-  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'
-  ;;
-
-aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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<name>.so
-      # instead of lib<name>.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*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    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=`func_echo_all "$lib" | $SED '\''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'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    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~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    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}'
-
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    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
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
-        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
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # 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'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # 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}${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 # correct to gnu/linux during the next big refactor
-  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
-  ;;
-
-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[23].*) 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
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  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=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  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'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-	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 glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
-	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
-fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # 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
-
-  # 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;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $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'
-  ;;
-
-netbsdelf*-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
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_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 # correct to gnu/linux during the next big refactor
-  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=qnx
-  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=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-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 # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-  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
-      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 # correct to gnu/linux during the next big refactor
-    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
-  shlibpath_overrides_runpath=yes
-  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'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    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'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
-$as_echo "$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
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&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-existent 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_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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
-$as_echo "$hardcode_action_CXX" >&6; }
-
-if test "$hardcode_action_CXX" = relink ||
-   test "$inherit_rpath_CXX" = yes; 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
-
-
-
-
-
-
-
-  fi # test -n "$compiler"
-
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-  LDCXX=$LD
-  LD=$lt_save_LD
-  GCC=$lt_save_GCC
-  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
-fi # test "$_lt_caught_CXX_error" != 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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-        ac_config_commands="$ac_config_commands libtool"
-
-
-
-
-# Only expand once:
-
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this sort of thing.  */
-  typedef int charset[2];
-  const charset cs = { 0, 0 };
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this sort of thing.  */
-    char tx;
-    char *t = &tx;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; } bx;
-    struct s *b = &bx; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_const=yes
-else
-  ac_cv_c_const=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-$as_echo "#define const /**/" >>confdefs.h
-
-fi
-
-ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if ${ac_cv_header_time+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_time=yes
-else
-  ac_cv_header_time=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if ${ac_cv_struct_tm+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <time.h>
-
-int
-main ()
-{
-struct tm tm;
-				     int *p = &tm.tm_sec;
-				     return !p;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_struct_tm=time.h
-else
-  ac_cv_struct_tm=sys/time.h
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
-if test $ac_cv_struct_tm = sys/time.h; then
-
-$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
-$as_echo_n "checking for working volatile... " >&6; }
-if ${ac_cv_c_volatile+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-volatile int x;
-int * volatile y = (int *) 0;
-return !x && !y;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_volatile=yes
-else
-  ac_cv_c_volatile=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
-$as_echo "$ac_cv_c_volatile" >&6; }
-if test $ac_cv_c_volatile = no; then
-
-$as_echo "#define volatile /**/" >>confdefs.h
-
-fi
-
-
-# Checks for library functions.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-echo >conftest.file
-if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-     /* Linux will dereference the symlink and fail, as required by POSIX.
-	That is better in the sense that it means we will not
-	have to compile and use the lstat wrapper.  */
-     return lstat ("conftest.sym/", &sbuf) == 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_lstat_dereferences_slashed_symlink=yes
-else
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-else
-  # If the `ln -s' command failed, then we probably don't even
-  # have an lstat function.
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f conftest.sym conftest.file
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-
-test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
-
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
-
-
-if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
-  case " $LIBOBJS " in
-  *" lstat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
- ;;
-esac
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat accepts an empty string" >&5
-$as_echo_n "checking whether lstat accepts an empty string... " >&6; }
-if ${ac_cv_func_lstat_empty_string_bug+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_lstat_empty_string_bug=yes
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-  return lstat ("", &sbuf) == 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_lstat_empty_string_bug=no
-else
-  ac_cv_func_lstat_empty_string_bug=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_empty_string_bug" >&5
-$as_echo "$ac_cv_func_lstat_empty_string_bug" >&6; }
-if test $ac_cv_func_lstat_empty_string_bug = yes; then
-  case " $LIBOBJS " in
-  *" lstat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
- ;;
-esac
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LSTAT_EMPTY_STRING_BUG 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-echo >conftest.file
-if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-     /* Linux will dereference the symlink and fail, as required by POSIX.
-	That is better in the sense that it means we will not
-	have to compile and use the lstat wrapper.  */
-     return lstat ("conftest.sym/", &sbuf) == 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_lstat_dereferences_slashed_symlink=yes
-else
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-else
-  # If the `ln -s' command failed, then we probably don't even
-  # have an lstat function.
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f conftest.sym conftest.file
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-
-test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
-
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
-
-
-if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
-  case " $LIBOBJS " in
-  *" lstat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
- ;;
-esac
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
-$as_echo_n "checking for working memcmp... " >&6; }
-if ${ac_cv_func_memcmp_working+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_memcmp_working=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-
-  /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = '\100', c1 = '\200', c2 = '\201';
-  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    return 1;
-
-  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
-     or more and with at least one buffer not starting on a 4-byte boundary.
-     William Lewis provided this test program.   */
-  {
-    char foo[21];
-    char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
-      {
-	char *a = foo + i;
-	char *b = bar + i;
-	strcpy (a, "--------01111111");
-	strcpy (b, "--------10000000");
-	if (memcmp (a, b, 16) >= 0)
-	  return 1;
-      }
-    return 0;
-  }
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_memcmp_working=yes
-else
-  ac_cv_func_memcmp_working=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
-$as_echo "$ac_cv_func_memcmp_working" >&6; }
-test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
-  *" memcmp.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
- ;;
-esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
-$as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if ${ac_cv_func_stat_empty_string_bug+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_stat_empty_string_bug=yes
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-  return stat ("", &sbuf) == 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_stat_empty_string_bug=no
-else
-  ac_cv_func_stat_empty_string_bug=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
-$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
-if test $ac_cv_func_stat_empty_string_bug = yes; then
-  case " $LIBOBJS " in
-  *" stat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS stat.$ac_objext"
- ;;
-esac
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STAT_EMPTY_STRING_BUG 1
-_ACEOF
-
-fi
-
-for ac_func in strftime
-do :
-  ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
-if test "x$ac_cv_func_strftime" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STRFTIME 1
-_ACEOF
-
-else
-  # strftime is in -lintl on SCO UNIX.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
-$as_echo_n "checking for strftime in -lintl... " >&6; }
-if ${ac_cv_lib_intl_strftime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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 strftime ();
-int
-main ()
-{
-return strftime ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_intl_strftime=yes
-else
-  ac_cv_lib_intl_strftime=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
-$as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test "x$ac_cv_lib_intl_strftime" = xyes; then :
-  $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
-
-LIBS="-lintl $LIBS"
-fi
-
-fi
-done
-
-for ac_func in memset sqrt strcasecmp strerror strncasecmp strstr fdatasync ftruncate getcwd gettimeofday localtime_r memmove strerror
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-ac_config_files="$ac_config_files Makefile src/Makefile headers/Makefile headers/librttopo_geom.h rttopo.pc"
-
-
-#-----------------------------------------------------------------------
-#   --with-geosconfig
-#
-
-# Check whether --with-geosconfig was given.
-if test "${with_geosconfig+set}" = set; then :
-  withval=$with_geosconfig; GEOSCONFIG="$withval"
-else
-  GEOSCONFIG=""
-fi
-
-if test "x$GEOSCONFIG" = "x"; then
-    # GEOSCONFIG was not specified, so search within the current path
-    # Extract the first word of "geos-config", so it can be a program name with args.
-set dummy geos-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GEOSCONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $GEOSCONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_GEOSCONFIG="$GEOSCONFIG" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_GEOSCONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-GEOSCONFIG=$ac_cv_path_GEOSCONFIG
-if test -n "$GEOSCONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GEOSCONFIG" >&5
-$as_echo "$GEOSCONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    # If we couldn't find geos-config, display an error
-    if test "x$GEOSCONFIG" = "x"; then
-            as_fn_error $? "could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter." "$LINENO" 5
-    fi
-else
-    # GEOSCONFIG was specified; display a message to the user
-    if test "x$GEOSCONFIG" = "xyes"; then
-            as_fn_error $? "you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config" "$LINENO" 5
-    else
-            if test -f $GEOSCONFIG; then
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using user-specified geos-config file: $GEOSCONFIG" >&5
-$as_echo "Using user-specified geos-config file: $GEOSCONFIG" >&6; }
-            else
-                    as_fn_error $? "the user-specified geos-config file $GEOSCONFIG does not exist" "$LINENO" 5
-            fi
-    fi
-fi
-# Extract the linker and include flags
-GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
-GEOS_CFLAGS=-I`$GEOSCONFIG --includes`
-
-
-# Ensure that we can parse geos_c.h
-CPPFLAGS_SAVE="$CPPFLAGS"
-CPPFLAGS="$GEOS_CFLAGS"
-for ac_header in geos_c.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "geos_c.h" "ac_cv_header_geos_c_h" "$ac_includes_default"
-if test "x$ac_cv_header_geos_c_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GEOS_C_H 1
-_ACEOF
-
-else
-  as_fn_error $? "could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig" "$LINENO" 5
-fi
-
-done
-
-CPPFLAGS="$CPPFLAGS_SAVE"
-# Ensure we can link against libgeos_c
-LIBS_SAVE="$LIBS"
-LIBS="$GEOS_LDFLAGS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing GEOSContext_setErrorMessageHandler_r" >&5
-$as_echo_n "checking for library containing GEOSContext_setErrorMessageHandler_r... " >&6; }
-if ${ac_cv_search_GEOSContext_setErrorMessageHandler_r+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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 GEOSContext_setErrorMessageHandler_r ();
-int
-main ()
-{
-return GEOSContext_setErrorMessageHandler_r ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' geos_c; 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
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_GEOSContext_setErrorMessageHandler_r=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_GEOSContext_setErrorMessageHandler_r+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_GEOSContext_setErrorMessageHandler_r+:} false; then :
-
-else
-  ac_cv_search_GEOSContext_setErrorMessageHandler_r=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_GEOSContext_setErrorMessageHandler_r" >&5
-$as_echo "$ac_cv_search_GEOSContext_setErrorMessageHandler_r" >&6; }
-ac_res=$ac_cv_search_GEOSContext_setErrorMessageHandler_r
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
-  as_fn_error $? "could not find libgeos_c (or obsolete 'libgeos_c' < v.3.5.0 found) - you may need to specify the directory of a geos-config file using --with-geosconfig" "$LINENO" 5
-fi
-
-LIBS="$LIBS_SAVE"
-LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c"
-GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[^0-9]//g'`
-GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[^0-9]//g'`
-RTGEOM_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
-
-cat >>confdefs.h <<_ACEOF
-#define RTGEOM_GEOS_VERSION $RTGEOM_GEOS_VERSION
-_ACEOF
-
-
-
-# SRID stuff
-SRID_MAX=999999
-SRID_USR_MAX=998999
-
-
-
-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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) { eval $ac_var=; 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
-    if test "x$cache_file" != "x/dev/null"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
-      if test ! -f "$cache_file" || test -h "$cache_file"; then
-	cat confcache >"$cache_file"
-      else
-        case $cache_file in #(
-        */* | ?:*)
-	  mv -f confcache "$cache_file"$$ &&
-	  mv -f "$cache_file"$$ "$cache_file" ;; #(
-        *)
-	  mv -f confcache "$cache_file" ;;
-	esac
-      fi
-    fi
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_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=`$as_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.
-  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
-$as_echo_n "checking that generated files are newer than configure... " >&6; }
-   if test -n "$am_sleep_pid"; then
-     # Hide warnings about reused PIDs.
-     wait $am_sleep_pid 2>/dev/null
-   fi
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
-$as_echo "done" >&6; }
- if test -n "$EXEEXT"; then
-  am__EXEEXT_TRUE=
-  am__EXEEXT_FALSE='#'
-else
-  am__EXEEXT_TRUE='#'
-  am__EXEEXT_FALSE=
-fi
-
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
-  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  as_fn_error $? "conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
-  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-
-: "${CONFIG_STATUS=./config.status}"
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-as_write_fail=0
-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
-#! $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}
-export SHELL
-_ASEOF
-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-	expr "X$arg" : "X\\(.*\\)$as_nl";
-	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-      PATH_SEPARATOR=';'
-  }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-  done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
-  fi
-  $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
-  return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
-  set +e
-  as_fn_set_status $1
-  exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
-  { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-  eval 'as_fn_append ()
-  {
-    eval $1+=\$2
-  }'
-else
-  as_fn_append ()
-  {
-    eval $1=\$$1\$2
-  }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-  eval 'as_fn_arith ()
-  {
-    as_val=$(( $* ))
-  }'
-else
-  as_fn_arith ()
-  {
-    as_val=`expr "$@" || test $? -eq 1`
-  }
-fi # as_fn_arith
-
-
-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
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
-# 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
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
-  case `echo 'xy\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  xy)  ECHO_C='\c';;
-  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
-       ECHO_T='	';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -pR'
-  fi
-else
-  as_ln_s='cp -pR'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || eval $as_mkdir_p || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_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 ||
-$as_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" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p='mkdir -p "$as_dir"'
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# 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
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-_ASEOF
-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 librttopo $as_me 1.0.0-RC2, which was
-generated by GNU Autoconf 2.69.  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
-
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-case $ac_config_headers in *"
-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
-esac
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# 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_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration.  Unless the files
-and actions are specified as TAGs, all are instantiated by default.
-
-Usage: $0 [OPTION]... [TAG]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
-      --config     print configuration, then exit
-  -q, --quiet, --silent
-                   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 <strk at keybit.net>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
-ac_cs_version="\\
-librttopo config.status 1.0.0-RC2
-configured by $0, generated by GNU Autoconf 2.69,
-  with options \\"\$ac_cs_config\\"
-
-Copyright (C) 2012 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'
-AWK='$AWK'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-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=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=
-    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 )
-    $as_echo "$ac_cs_version"; exit ;;
-  --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    '') as_fn_error $? "missing file argument" ;;
-    esac
-    as_fn_append CONFIG_FILES " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    as_fn_error $? "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
-  --help | --hel | -h )
-    $as_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.
-  -*) as_fn_error $? "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
-
-  *) as_fn_append 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 || ac_write_fail=1
-if \$ac_cs_recheck; then
-  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-  shift
-  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
-  CONFIG_SHELL='$SHELL'
-  export CONFIG_SHELL
-  exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-
-
-# 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
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
-DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
-macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
-enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
-SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
-ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
-PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
-host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
-host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
-host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
-build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
-build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
-build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
-SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
-Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
-GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
-EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
-FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
-LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
-NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
-LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
-exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
-file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
-want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
-sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
-AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
-archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
-STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
-lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
-CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
-compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
-GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
-nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
-lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
-objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
-need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
-MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
-LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
-libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
-postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
-need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
-version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
-install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
-striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
-predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
-postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
-predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
-postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
-LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
-reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
-reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
-GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
-inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
-always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
-predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
-postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
-
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in AS \
-DLLTOOL \
-OBJDUMP \
-SHELL \
-ECHO \
-PATH_SEPARATOR \
-SED \
-GREP \
-EGREP \
-FGREP \
-LD \
-NM \
-LN_S \
-lt_SP2NL \
-lt_NL2SP \
-reload_flag \
-deplibs_check_method \
-file_magic_cmd \
-file_magic_glob \
-want_nocaseglob \
-sharedlib_from_linklib_cmd \
-AR \
-AR_FLAGS \
-archiver_list_spec \
-STRIP \
-RANLIB \
-CC \
-CFLAGS \
-compiler \
-lt_cv_sys_global_symbol_pipe \
-lt_cv_sys_global_symbol_to_cdecl \
-lt_cv_sys_global_symbol_to_c_name_address \
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-nm_file_list_spec \
-lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_pic \
-lt_prog_compiler_wl \
-lt_prog_compiler_static \
-lt_cv_prog_compiler_c_o \
-need_locks \
-MANIFEST_TOOL \
-DSYMUTIL \
-NMEDIT \
-LIPO \
-OTOOL \
-OTOOL64 \
-shrext_cmds \
-export_dynamic_flag_spec \
-whole_archive_flag_spec \
-compiler_needs_object \
-with_gnu_ld \
-allow_undefined_flag \
-no_undefined_flag \
-hardcode_libdir_flag_spec \
-hardcode_libdir_separator \
-exclude_expsyms \
-include_expsyms \
-file_list_spec \
-variables_saved_for_relink \
-libname_spec \
-library_names_spec \
-soname_spec \
-install_override_mode \
-finish_eval \
-old_striplib \
-striplib \
-compiler_lib_search_dirs \
-predep_objects \
-postdep_objects \
-predeps \
-postdeps \
-compiler_lib_search_path \
-LD_CXX \
-reload_flag_CXX \
-compiler_CXX \
-lt_prog_compiler_no_builtin_flag_CXX \
-lt_prog_compiler_pic_CXX \
-lt_prog_compiler_wl_CXX \
-lt_prog_compiler_static_CXX \
-lt_cv_prog_compiler_c_o_CXX \
-export_dynamic_flag_spec_CXX \
-whole_archive_flag_spec_CXX \
-compiler_needs_object_CXX \
-with_gnu_ld_CXX \
-allow_undefined_flag_CXX \
-no_undefined_flag_CXX \
-hardcode_libdir_flag_spec_CXX \
-hardcode_libdir_separator_CXX \
-exclude_expsyms_CXX \
-include_expsyms_CXX \
-file_list_spec_CXX \
-compiler_lib_search_dirs_CXX \
-predep_objects_CXX \
-postdep_objects_CXX \
-predeps_CXX \
-postdeps_CXX \
-compiler_lib_search_path_CXX; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in reload_cmds \
-old_postinstall_cmds \
-old_postuninstall_cmds \
-old_archive_cmds \
-extract_expsyms_cmds \
-old_archive_from_new_cmds \
-old_archive_from_expsyms_cmds \
-archive_cmds \
-archive_expsym_cmds \
-module_cmds \
-module_expsym_cmds \
-export_symbols_cmds \
-prelink_cmds \
-postlink_cmds \
-postinstall_cmds \
-postuninstall_cmds \
-finish_cmds \
-sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec \
-reload_cmds_CXX \
-old_archive_cmds_CXX \
-old_archive_from_new_cmds_CXX \
-old_archive_from_expsyms_cmds_CXX \
-archive_cmds_CXX \
-archive_expsym_cmds_CXX \
-module_cmds_CXX \
-module_expsym_cmds_CXX \
-export_symbols_cmds_CXX \
-prelink_cmds_CXX \
-postlink_cmds_CXX; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-ac_aux_dir='$ac_aux_dir'
-xsi_shell='$xsi_shell'
-lt_shell_append='$lt_shell_append'
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-
-    PACKAGE='$PACKAGE'
-    VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
-    RM='$RM'
-    ofile='$ofile'
-
-
-
-
-
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "src/rttopo_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/rttopo_config.h" ;;
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-    "headers/Makefile") CONFIG_FILES="$CONFIG_FILES headers/Makefile" ;;
-    "headers/librttopo_geom.h") CONFIG_FILES="$CONFIG_FILES headers/librttopo_geom.h" ;;
-    "rttopo.pc") CONFIG_FILES="$CONFIG_FILES rttopo.pc" ;;
-
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
-  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= ac_tmp=
-  trap 'exit_status=$?
-  : "${ac_tmp:=$tmp}"
-  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
-' 0
-  trap 'as_fn_exit 1' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
-  eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
-else
-  ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
-_ACEOF
-
-
-{
-  echo "cat >conf$$subs.awk <<_ACEOF" &&
-  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
-  echo "_ACEOF"
-} >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-
-  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
-  if test $ac_delim_n = $ac_delim_num; then
-    break
-  elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\)..*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\)..*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
-  N
-  s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
-  for (key in S) S_is_set[key] = 1
-  FS = ""
-
-}
-{
-  line = $ 0
-  nfields = split(line, field, "@")
-  substed = 0
-  len = length(field[1])
-  for (i = 2; i < nfields; i++) {
-    key = field[i]
-    keylen = length(key)
-    if (S_is_set[key]) {
-      value = S[key]
-      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
-      len += length(value) + length(field[++i])
-      substed = 1
-    } else
-      len += 1 + keylen
-  }
-
-  print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
-  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
-  cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
-# ${srcdir} and @srcdir@ entries 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[	 ]*=[	 ]*/{
-h
-s///
-s/^/:/
-s/[	 ]*$/:/
-s/:\$(srcdir):/:/g
-s/:\${srcdir}:/:/g
-s/:@srcdir@:/:/g
-s/^:*//
-s/:*$//
-x
-s/\(=[	 ]*\).*/\1/
-G
-s/\n//
-s/^[^=]*=[	 ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-# Set up the scripts for CONFIG_HEADERS section.
-# No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
-if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
-BEGIN {
-_ACEOF
-
-# Transform confdefs.h into an awk script `defines.awk', embedded as
-# here-document in config.status, that substitutes the proper values into
-# config.h.in to produce config.h.
-
-# Create a delimiter string that does not exist in confdefs.h, to ease
-# handling of long lines.
-ac_delim='%!_!# '
-for ac_last_try in false false :; do
-  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_tt"; then
-    break
-  elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-
-# For the awk script, D is an array of macro values keyed by name,
-# likewise P contains macro parameters if any.  Preserve backslash
-# newline sequences.
-
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-sed -n '
-s/.\{148\}/&'"$ac_delim"'/g
-t rset
-:rset
-s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
-t def
-d
-:def
-s/\\$//
-t bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3"/p
-s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
-d
-:bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3\\\\\\n"\\/p
-t cont
-s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
-t cont
-d
-:cont
-n
-s/.\{148\}/&'"$ac_delim"'/g
-t clear
-:clear
-s/\\$//
-t bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/"/p
-d
-:bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
-b cont
-' <confdefs.h | sed '
-s/'"$ac_delim"'/"\\\
-"/g' >>$CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-  for (key in D) D_is_set[key] = 1
-  FS = ""
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
-  line = \$ 0
-  split(line, arg, " ")
-  if (arg[1] == "#") {
-    defundef = arg[2]
-    mac1 = arg[3]
-  } else {
-    defundef = substr(arg[1], 2)
-    mac1 = arg[2]
-  }
-  split(mac1, mac2, "(") #)
-  macro = mac2[1]
-  prefix = substr(line, 1, index(line, defundef) - 1)
-  if (D_is_set[macro]) {
-    # Preserve the white space surrounding the "#".
-    print prefix "define", macro P[macro] D[macro]
-    next
-  } else {
-    # 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.
-    if (defundef == "undef") {
-      print "/*", prefix defundef, macro, "*/"
-      next
-    }
-  }
-}
-{ print }
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
-fi # test -n "$CONFIG_HEADERS"
-
-
-eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
-shift
-for ac_tag
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
-  :[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="$ac_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 ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
-      esac
-      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      as_fn_append 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 '`
-	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
-	`' by configure.'
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
-    fi
-    # Neutralize special characters interpreted by sed in replacement strings.
-    case $configure_input in #(
-    *\&* | *\|* | *\\* )
-       ac_sed_conf_input=`$as_echo "$configure_input" |
-       sed 's/[\\\\&|]/\\\\&/g'`;; #(
-    *) ac_sed_conf_input=$configure_input;;
-    esac
-
-    case $ac_tag in
-    *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
-    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 ||
-$as_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"; as_fn_mkdir_p
-  ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-  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 || ac_write_fail=1
-# 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=
-ac_sed_dataroot='
-/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-  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 || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;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
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
-      "$ac_tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined" >&5
-$as_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 "$ac_tmp/stdin"
-  case $ac_file in
-  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
-  esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-  if test x"$ac_file" != x-; then
-    {
-      $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
-    } >"$ac_tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f "$ac_file"
-      mv "$ac_tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    fi
-  else
-    $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5
-  fi
-# Compute "$ac_file"'s index in $config_headers.
-_am_arg="$ac_file"
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$_am_arg" : 'X\(//\)[^/]' \| \
-	 X"$_am_arg" : 'X\(//\)$' \| \
-	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$_am_arg" |
-    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)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
-$as_echo "$as_me: executing $ac_file commands" >&6;}
- ;;
-  esac
-
-
-  case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Older Autoconf quotes --file arguments for eval, but not when files
-  # are listed without --file.  Let's play safe and only enable the eval
-  # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
-  shift
-  for mf
-  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 -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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 ||
-$as_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"`
-    # 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'`; 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 ||
-$as_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; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
-  done
-}
- ;;
-    "libtool":C)
-
-    # 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
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-# The names of the tagged configurations supported by this script.
-available_tags="CXX "
-
-# ### BEGIN LIBTOOL CONFIG
-
-# Assembler program.
-AS=$lt_AS
-
-# DLL creation program.
-DLLTOOL=$lt_DLLTOOL
-
-# Object dumper program.
-OBJDUMP=$lt_OBJDUMP
-
-# Which release of libtool.m4 was used?
-macro_version=$macro_version
-macro_revision=$macro_revision
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# What type of objects to build.
-pic_mode=$pic_mode
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that protects backslashes.
-ECHO=$lt_ECHO
-
-# The PATH separator for the build system.
-PATH_SEPARATOR=$lt_PATH_SEPARATOR
-
-# 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
-
-# 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//"
-
-# A grep program that handles long lines.
-GREP=$lt_GREP
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# A literal string matcher.
-FGREP=$lt_FGREP
-
-# A BSD- or MS-compatible name lister.
-NM=$lt_NM
-
-# Whether we need soft or hard links.
-LN_S=$lt_LN_S
-
-# What is the maximum length of a command?
-max_cmd_len=$max_cmd_len
-
-# Object file suffix (normally "o").
-objext=$ac_objext
-
-# Executable file suffix (normally "").
-exeext=$exeext
-
-# whether the shell understands "unset".
-lt_unset=$lt_unset
-
-# turn spaces into newlines.
-SP2NL=$lt_lt_SP2NL
-
-# turn newlines into spaces.
-NL2SP=$lt_lt_NL2SP
-
-# convert \$build file names to \$host format.
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-
-# convert \$build files to toolchain format.
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-
-# 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
-
-# How to find potential files when deplibs_check_method = "file_magic".
-file_magic_glob=$lt_file_magic_glob
-
-# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
-want_nocaseglob=$lt_want_nocaseglob
-
-# Command to associate shared and link libraries.
-sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
-
-# The archiver.
-AR=$lt_AR
-
-# Flags to create an archive.
-AR_FLAGS=$lt_AR_FLAGS
-
-# How to feed a file listing to the archiver.
-archiver_list_spec=$lt_archiver_list_spec
-
-# A symbol stripping program.
-STRIP=$lt_STRIP
-
-# Commands used to install an old-style archive.
-RANLIB=$lt_RANLIB
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# Whether to use a lock for old archive extraction.
-lock_old_archive_extraction=$lock_old_archive_extraction
-
-# A C compiler.
-LTCC=$lt_CC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_CFLAGS
-
-# 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
-
-# Transform the output of nm in a C name address pair when lib prefix is needed.
-global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
-
-# Specify filename containing input files for \$NM.
-nm_file_list_spec=$lt_nm_file_list_spec
-
-# The root where to search for dependent libraries,and in which our libraries should be installed.
-lt_sysroot=$lt_sysroot
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# Used to examine libraries when file_magic_cmd begins with "file".
-MAGIC_CMD=$MAGIC_CMD
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Manifest tool.
-MANIFEST_TOOL=$lt_MANIFEST_TOOL
-
-# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
-DSYMUTIL=$lt_DSYMUTIL
-
-# Tool to change global to local symbols on Mac OS X.
-NMEDIT=$lt_NMEDIT
-
-# Tool to manipulate fat objects and archives on Mac OS X.
-LIPO=$lt_LIPO
-
-# ldd/readelf like tool for Mach-O binaries on Mac OS X.
-OTOOL=$lt_OTOOL
-
-# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
-OTOOL64=$lt_OTOOL64
-
-# Old archive suffix (normally "a").
-libext=$libext
-
-# Shared library suffix (normally ".so").
-shrext_cmds=$lt_shrext_cmds
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at link time.
-variables_saved_for_relink=$lt_variables_saved_for_relink
-
-# 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
-
-# Library versioning type.
-version_type=$version_type
-
-# Shared library runtime path variable.
-runpath_var=$runpath_var
-
-# Shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# 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
-
-# Permission mode override for installation of shared libraries.
-install_override_mode=$lt_install_override_mode
-
-# Command to use after installation of a shared archive.
-postinstall_cmds=$lt_postinstall_cmds
-
-# Command to use after uninstallation of a shared archive.
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# As "finish_cmds", except a single script fragment to be evaled but
-# not shown.
-finish_eval=$lt_finish_eval
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# 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
-
-# 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
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-
-# The linker used to build libraries.
-LD=$lt_LD
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds
-
-# A language specific compiler.
-CC=$lt_compiler
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o
-
-# 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
-
-# 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
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object
-
-# 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 a shared archive.
-archive_cmds=$lt_archive_cmds
-archive_expsym_cmds=$lt_archive_expsym_cmds
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds
-module_expsym_cmds=$lt_module_expsym_cmds
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag
-
-# 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
-
-# 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 DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute
-
-# 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
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs
-
-# 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
-
-# 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
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds
-
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects
-postdep_objects=$lt_postdep_objects
-predeps=$lt_predeps
-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
-
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_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
-_LT_EOF
-    ;;
-  esac
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-
-  # 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)
-
-  if test x"$xsi_shell" = xyes; then
-  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\    # positional parameters, so assign one to ordinary parameter first.\
-\    func_stripname_result=${3}\
-\    func_stripname_result=${func_stripname_result#"${1}"}\
-\    func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\    func_split_long_opt_name=${1%%=*}\
-\    func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\    func_split_short_opt_arg=${1#??}\
-\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\    case ${1} in\
-\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\      *)    func_lo2o_result=${1} ;;\
-\    esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
-    func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
-    func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
-    func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
-    eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\    func_quote_for_eval "${2}"\
-\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
-   mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-
-
-    cat <<_LT_EOF >> "$ofile"
-
-# ### BEGIN LIBTOOL TAG CONFIG: CXX
-
-# The linker used to build libraries.
-LD=$lt_LD_CXX
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag_CXX
-reload_cmds=$lt_reload_cmds_CXX
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds_CXX
-
-# A language specific compiler.
-CC=$lt_compiler_CXX
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC_CXX
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_CXX
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_CXX
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_CXX
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
-
-# 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
-
-# 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
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object_CXX
-
-# 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 a shared archive.
-archive_cmds=$lt_archive_cmds_CXX
-archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds_CXX
-module_expsym_cmds=$lt_module_expsym_cmds_CXX
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld_CXX
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_CXX
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_CXX
-
-# 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
-
-# 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 DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute_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
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath_CXX
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_CXX
-
-# 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
-
-# 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
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds_CXX
-
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds_CXX
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec_CXX
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_CXX
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects_CXX
-postdep_objects=$lt_postdep_objects_CXX
-predeps=$lt_predeps_CXX
-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
-
-# ### END LIBTOOL TAG CONFIG: CXX
-_LT_EOF
-
- ;;
-
-  esac
-done # for ac_tag
-
-
-as_fn_exit 0
-_ACEOF
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
-
-
-# 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 || as_fn_exit 1
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
-
diff --git a/configure.ac b/configure.ac
index 91221cb..a820c31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT(librttopo, 1.0.0-RC2, strk at keybit.net)
+AC_INIT(librttopo, 1.0.0-RC3, strk at kbt.io)
 AC_LANG(C)
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/depcomp b/depcomp
deleted file mode 100755
index 4ebd5b3..0000000
--- a/depcomp
+++ /dev/null
@@ -1,791 +0,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2013-05-30.07; # UTC
-
-# Copyright (C) 1999-2013 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, see <http://www.gnu.org/licenses/>.
-
-# 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 <oliva at dcc.unicamp.br>.
-
-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 outputting dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake at gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
-# Get the directory component of the given path, and save it in the
-# global variables '$dir'.  Note that this directory component will
-# be either empty or ending with a '/' character.  This is deliberate.
-set_dir_from ()
-{
-  case $1 in
-    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
-      *) dir=;;
-  esac
-}
-
-# Get the suffix-stripped basename of the given path, and save it the
-# global variable '$base'.
-set_base_from ()
-{
-  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
-}
-
-# If no dependency file was actually created by the compiler invocation,
-# we still have to create a dummy depfile, to avoid errors with the
-# Makefile "include basename.Plo" scheme.
-make_dummy_depfile ()
-{
-  echo "#dummy" > "$depfile"
-}
-
-# Factor out some common post-processing of the generated depfile.
-# Requires the auxiliary global variable '$tmpdepfile' to be set.
-aix_post_process_depfile ()
-{
-  # If the compiler actually managed to produce a dependency file,
-  # post-process it.
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form 'foo.o: dependency.h'.
-    # Do two passes, one to just change these to
-    #   $object: dependency.h
-    # and one to simply output
-    #   dependency.h:
-    # which is needed to avoid the deleted-header problem.
-    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
-      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
-    } > "$depfile"
-    rm -f "$tmpdepfile"
-  else
-    make_dummy_depfile
-  fi
-}
-
-# A tabulation character.
-tab='	'
-# A newline character.
-nl='
-'
-# Character ranges might be problematic outside the C locale.
-# These definitions help.
-upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
-lower=abcdefghijklmnopqrstuvwxyz
-digits=0123456789
-alpha=${upper}${lower}
-
-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"
-
-# Avoid interferences from the environment.
-gccflag= dashmflag=
-
-# 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
-
-cygpath_u="cygpath -u -f -"
-if test "$depmode" = msvcmsys; then
-  # This is just like msvisualcpp but w/o cygpath translation.
-  # Just convert the backslash-escaped backslashes to single forward
-  # slashes to satisfy depend.m4
-  cygpath_u='sed s,\\\\,/,g'
-  depmode=msvisualcpp
-fi
-
-if test "$depmode" = msvc7msys; then
-  # This is just like msvc7 but w/o cygpath translation.
-  # Just convert the backslash-escaped backslashes to single forward
-  # slashes to satisfy depend.m4
-  cygpath_u='sed s,\\\\,/,g'
-  depmode=msvc7
-fi
-
-if test "$depmode" = xlc; then
-  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
-  gccflag=-qmakedep=gcc,-MF
-  depmode=gcc
-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 -ne 0; then
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
-## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
-## (see the conditional assignment to $gccflag above).
-## 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).  Also, it might not be
-##   supported by the other compilers which use the 'gcc' depmode.
-## - 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 -ne 0; then
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  # 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.
-## 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.  hp depmode also adds that space, but also prefixes the VPATH
-## to the object.  Take care to not repeat it in the output.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-  tr ' ' "$nl" < "$tmpdepfile" \
-    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -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 -ne 0; then
-    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 ' ' "$nl" < "$tmpdepfile" \
-      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
-      | tr "$nl" ' ' >> "$depfile"
-    echo >> "$depfile"
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' "$nl" < "$tmpdepfile" \
-      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-      >> "$depfile"
-  else
-    make_dummy_depfile
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-xlc)
-  # 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
-  ;;
-
-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.
-  set_dir_from "$object"
-  set_base_from "$object"
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$base.u
-    tmpdepfile3=$dir.libs/$base.u
-    "$@" -Wc,-M
-  else
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$dir$base.u
-    tmpdepfile3=$dir$base.u
-    "$@" -M
-  fi
-  stat=$?
-  if test $stat -ne 0; then
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-    exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  aix_post_process_depfile
-  ;;
-
-tcc)
-  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
-  # FIXME: That version still under development at the moment of writing.
-  #        Make that this statement remains true also for stable, released
-  #        versions.
-  # It will wrap lines (doesn't matter whether long or short) with a
-  # trailing '\', as in:
-  #
-  #   foo.o : \
-  #    foo.c \
-  #    foo.h \
-  #
-  # It will put a trailing '\' even on the last line, and will use leading
-  # spaces rather than leading tabs (at least since its commit 0394caf7
-  # "Emit spaces for -MD").
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -ne 0; then
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
-  # We have to change lines of the first kind to '$object: \'.
-  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
-  # And for each line of the second kind, we have to emit a 'dep.h:'
-  # dummy dependency, to avoid the deleted-header problem.
-  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-## The order of this option in the case statement is important, since the
-## shell code in configure will try each of these formats in the order
-## listed in this file.  A plain '-MD' option would be understood by many
-## compilers, so we must ensure this comes after the gcc and icc options.
-pgcc)
-  # Portland's C compiler understands '-MD'.
-  # Will always output deps to 'file.d' where file is the root name of the
-  # source file under compilation, even if file resides in a subdirectory.
-  # The object file name does not affect the name of the '.d' file.
-  # pgcc 10.2 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using '\' :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-  set_dir_from "$object"
-  # Use the source, not the object, to determine the base name, since
-  # that's sadly what pgcc will do too.
-  set_base_from "$source"
-  tmpdepfile=$base.d
-
-  # For projects that build the same source file twice into different object
-  # files, the pgcc approach of using the *source* file root name can cause
-  # problems in parallel builds.  Use a locking strategy to avoid stomping on
-  # the same $tmpdepfile.
-  lockdir=$base.d-lock
-  trap "
-    echo '$0: caught signal, cleaning up...' >&2
-    rmdir '$lockdir'
-    exit 1
-  " 1 2 13 15
-  numtries=100
-  i=$numtries
-  while test $i -gt 0; do
-    # mkdir is a portable test-and-set.
-    if mkdir "$lockdir" 2>/dev/null; then
-      # This process acquired the lock.
-      "$@" -MD
-      stat=$?
-      # Release the lock.
-      rmdir "$lockdir"
-      break
-    else
-      # If the lock is being held by a different process, wait
-      # until the winning process is done or we timeout.
-      while test -d "$lockdir" && test $i -gt 0; do
-        sleep 1
-        i=`expr $i - 1`
-      done
-    fi
-    i=`expr $i - 1`
-  done
-  trap - 1 2 13 15
-  if test $i -le 0; then
-    echo "$0: failed to acquire lock after $numtries attempts" >&2
-    echo "$0: check lockdir '$lockdir'" >&2
-    exit 1
-  fi
-
-  if test $stat -ne 0; then
-    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.
-  set_dir_from  "$object"
-  set_base_from "$object"
-  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 -ne 0; then
-     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,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add 'dependent.h:' lines.
-    sed -ne '2,${
-               s/^ *//
-               s/ \\*$//
-               s/$/:/
-               p
-             }' "$tmpdepfile" >> "$depfile"
-  else
-    make_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.
-  set_dir_from  "$object"
-  set_base_from "$object"
-
-  if test "$libtool" = yes; then
-    # Libtool 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$base.o.d          # libtool 1.5
-    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
-    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
-    "$@" -Wc,-MD
-  else
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir$base.d
-    tmpdepfile3=$dir$base.d
-    "$@" -MD
-  fi
-
-  stat=$?
-  if test $stat -ne 0; then
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-    exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  # Same post-processing that is required for AIX mode.
-  aix_post_process_depfile
-  ;;
-
-msvc7)
-  if test "$libtool" = yes; then
-    showIncludes=-Wc,-showIncludes
-  else
-    showIncludes=-showIncludes
-  fi
-  "$@" $showIncludes > "$tmpdepfile"
-  stat=$?
-  grep -v '^Note: including file: ' "$tmpdepfile"
-  if test $stat -ne 0; then
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  # The first sed program below extracts the file names and escapes
-  # backslashes for cygpath.  The second sed program outputs the file
-  # name when reading, but also accumulates all include files in the
-  # hold buffer in order to output them again at the end.  This only
-  # works with sed implementations that can handle large buffers.
-  sed < "$tmpdepfile" -n '
-/^Note: including file:  *\(.*\)/ {
-  s//\1/
-  s/\\/\\\\/g
-  p
-}' | $cygpath_u | sort -u | sed -n '
-s/ /\\ /g
-s/\(.*\)/'"$tab"'\1 \\/p
-s/.\(.*\) \\/\1:/
-H
-$ {
-  s/.*/'"$tab"'/
-  G
-  p
-}' >> "$depfile"
-  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
-  rm -f "$tmpdepfile"
-  ;;
-
-msvc7msys)
-  # 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
-  ;;
-
-#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 "X$1" != 'X--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|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this sed invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  tr ' ' "$nl" < "$tmpdepfile" \
-    | 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 "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no eat=no
-  for arg
-  do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    if test $eat = yes; then
-      eat=no
-      continue
-    fi
-    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.
-    -arch)
-      eat=yes ;;
-    -*|$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"
-  # makedepend may prepend the VPATH from the source file name to the object.
-  # No need to regex-escape $object, excess matching of '.' is harmless.
-  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process the last invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed '1,2d' "$tmpdepfile" \
-    | tr ' ' "$nl" \
-    | 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 "X$1" != 'X--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.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-        set fnord "$@"
-        shift
-        shift
-        ;;
-    *)
-        set fnord "$@" "$arg"
-        shift
-        shift
-        ;;
-    esac
-  done
-  "$@" -E 2>/dev/null |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
-  echo "$tab" >> "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvcmsys)
-  # 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
-  ;;
-
-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-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/doc/BUILDING-ON-WINDOWS.md b/doc/BUILDING-ON-WINDOWS.md
new file mode 100644
index 0000000..a263c63
--- /dev/null
+++ b/doc/BUILDING-ON-WINDOWS.md
@@ -0,0 +1,46 @@
+Building on Windows
+===================
+
+On Windows systems you can choose between two different compilers:
+- MinGW / MSYS
+  This represents a smart porting of a minimalistic Linux-like
+  development toolkit
+- Microsoft Visual Studio .NET (aka MSVC)
+  This is the standard platform development toolkit from Microsoft.
+
+# Using MinGW / MSYS
+
+We assume that you have already installed the MinGW compiler and the
+MSYS shell.
+Building 'librttopo' under Windows is then more or less like building
+on any other UNIX-like system. If you have unpacked the sources as
+C:\librttpopo-<version>, then the required steps are:
+
+  cd c:/librttopo-<version>
+  export "CFLAGS=-I/usr/local/include"
+  export "LDFLAGS=-L/usr/local/lib"
+  ./configure
+  make
+  make install
+  # or (in order to save some disk space)
+  make install-strip
+
+
+# Using Microsoft Visual Studio .NET
+
+We assume that you have already installed Visual Studio enabling the
+command
+line tools. Note that you are expected to the Visual Studio command
+prompt shell
+rather than the GUI build environment. If you have unpacked the
+sources as
+C:\librttpopo-<version>, then the required steps are:
+
+  cd c:\librttopo-<version>
+  nmake /f makefile.vc
+  nmake /f makefile.vc install
+
+Please note: the MSVC build configuration is based on the OSGeo4W
+distribution. Any depending library (e.g. GEOS) is expected to be
+already installed on C:\OSGeo4W
+
diff --git a/headers/Makefile.in b/headers/Makefile.in
deleted file mode 100644
index 596eff3..0000000
--- a/headers/Makefile.in
+++ /dev/null
@@ -1,562 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in 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.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = headers
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(srcdir)/librttopo_geom.h.in $(nobase_include_HEADERS)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/rttopo_config.h
-CONFIG_CLEAN_FILES = librttopo_geom.h
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(includedir)"
-HEADERS = $(nobase_include_HEADERS)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GEOSCONFIG = @GEOSCONFIG@
-GEOS_CFLAGS = @GEOS_CFLAGS@
-GEOS_LDFLAGS = @GEOS_LDFLAGS@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBRTGEOM_VERSION = @LIBRTGEOM_VERSION@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-RTGEOM_GEOS_VERSION = @RTGEOM_GEOS_VERSION@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SRID_MAX = @SRID_MAX@
-SRID_USR_MAX = @SRID_USR_MAX@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-nobase_include_HEADERS = librttopo_geom.h librttopo.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign headers/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign headers/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-librttopo_geom.h: $(top_builddir)/config.status $(srcdir)/librttopo_geom.h.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-install-nobase_includeHEADERS: $(nobase_include_HEADERS)
-	@$(NORMAL_INSTALL)
-	@list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-	fi; \
-	$(am__nobase_list) | while read dir files; do \
-	  xfiles=; for file in $$files; do \
-	    if test -f "$$file"; then xfiles="$$xfiles $$file"; \
-	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
-	  test -z "$$xfiles" || { \
-	    test "x$$dir" = x. || { \
-	      echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
-	      $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
-	    echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
-	    $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \
-	done
-
-uninstall-nobase_includeHEADERS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
-	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(HEADERS)
-installdirs:
-	for dir in "$(DESTDIR)$(includedir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-nobase_includeHEADERS
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-nobase_includeHEADERS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool cscopelist-am ctags ctags-am distclean \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man \
-	install-nobase_includeHEADERS install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am uninstall-nobase_includeHEADERS
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/headers/librttopo.h b/headers/librttopo.h
index 41956e6..4012037 100644
--- a/headers/librttopo.h
+++ b/headers/librttopo.h
@@ -401,7 +401,7 @@ typedef struct RTT_BE_CALLBACKS_T {
    *        as a result of edge splitting, or -1 if the old edge was
    *        modified rather than replaced.
    *
-	 * @return 1 on success, 0 on error
+   * @return 1 on success, 0 on error
    *
    * @note on splitting an edge, the new edges both have the
    *       same direction as the original one. If a second new edge was
@@ -538,7 +538,7 @@ typedef struct RTT_BE_CALLBACKS_T {
    *        as a result of face splitting, or -1 if the old face was
    *        modified rather than replaced.
    *
-	 * @return 1 on success, 0 on error (@see lastErroMessage)
+   * @return 1 on success, 0 on error (@see lastErroMessage)
    *
    */
   int (*updateTopoGeomFaceSplit) (
diff --git a/headers/librttopo_geom.h b/headers/librttopo_geom.h
deleted file mode 100644
index 200374b..0000000
--- a/headers/librttopo_geom.h
+++ /dev/null
@@ -1,2202 +0,0 @@
-/**********************************************************************
- *
- * rttopo - topology library
- * http://git.osgeo.org/gogs/rttopo/librttopo
- *
- * rttopo 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.
- *
- * rttopo 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 rttopo.  If not, see <http://www.gnu.org/licenses/>.
- *
- **********************************************************************
- *
- * Copyright 2011-2016 Sandro Santilli <strk at keybit.net>
- * Copyright 2011 Paul Ramsey <pramsey at cleverelephant.ca>
- * Copyright 2007-2008 Mark Cave-Ayland
- * Copyright 2001-2006 Refractions Research Inc.
- *
- **********************************************************************/
-
-
-
-#ifndef _LIBRTGEOM_H
-#define _LIBRTGEOM_H 1
-
-#define GEOS_USE_ONLY_R_API 1
-#include <geos_c.h>
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdint.h>
-
-/**
-* @file librttopo_geom.h
-*
-* This library is the generic geometry handling section of PostGIS. The geometry
-* objects, constructors, destructors, and a set of spatial processing functions,
-* are implemented here.
-*
-* The library is designed for use in non-PostGIS applications if necessary. The
-* units tests at cunit/cu_tester.c and the loader/dumper programs at
-* ../loader/shp2pgsql.c are examples of non-PostGIS applications using librtgeom.
-*
-* Programs using this library can install their custom memory managers and error
-* handlers by calling the rtgeom_set_handlers(const RTCTX *ctx) function, otherwise the default
-* ones will be used.
-*/
-
-/**
-* Return types for functions with status returns.
-*/
-#define RT_TRUE 1
-#define RT_FALSE 0
-#define RT_UNKNOWN 2
-#define RT_FAILURE 0
-#define RT_SUCCESS 1
-
-/**
-* RTRTTYPE numbers
-*/
-#define	RTPOINTTYPE                1
-#define	RTLINETYPE                 2
-#define	RTPOLYGONTYPE              3
-#define	RTMULTIPOINTTYPE           4
-#define	RTMULTILINETYPE            5
-#define	RTMULTIPOLYGONTYPE         6
-#define	RTCOLLECTIONTYPE           7
-#define RTCIRCSTRINGTYPE           8
-#define RTCOMPOUNDTYPE             9
-#define RTCURVEPOLYTYPE           10
-#define RTMULTICURVETYPE          11
-#define RTMULTISURFACETYPE        12
-#define RTPOLYHEDRALSURFACETYPE   13
-#define RTTRIANGLETYPE            14
-#define RTTINTYPE                 15
-
-#define RTNUMTYPES                16
-
-/**
-* Flags applied in EWKB to indicate Z/M dimensions and
-* presence/absence of SRID and bounding boxes
-*/
-#define RTWKBZOFFSET  0x80000000
-#define RTWKBMOFFSET  0x40000000
-#define RTWKBSRIDFLAG 0x20000000
-#define RTWKBBBOXFLAG 0x10000000
-
-/** Ordinate names */
-typedef enum RTORD_T {
-  RTORD_X = 0,
-  RTORD_Y = 1,
-  RTORD_Z = 2,
-  RTORD_M = 3
-} RTORD;
-
-/**
-* Macros for manipulating the 'flags' byte. A uint8_t used as follows:
-* ---RGBMZ
-* Three unused bits, followed by ReadOnly, Geodetic, HasBBox, HasM and HasZ flags.
-*/
-#define RTFLAGS_GET_Z(flags) ((flags) & 0x01)
-#define RTFLAGS_GET_M(flags) (((flags) & 0x02)>>1)
-#define RTFLAGS_GET_BBOX(flags) (((flags) & 0x04)>>2)
-#define RTFLAGS_GET_GEODETIC(flags) (((flags) & 0x08)>>3)
-#define RTFLAGS_GET_READONLY(flags) (((flags) & 0x10)>>4)
-#define RTFLAGS_GET_SOLID(flags) (((flags) & 0x20)>>5)
-#define RTFLAGS_SET_Z(flags, value) ((flags) = (value) ? ((flags) | 0x01) : ((flags) & 0xFE))
-#define RTFLAGS_SET_M(flags, value) ((flags) = (value) ? ((flags) | 0x02) : ((flags) & 0xFD))
-#define RTFLAGS_SET_BBOX(flags, value) ((flags) = (value) ? ((flags) | 0x04) : ((flags) & 0xFB))
-#define RTFLAGS_SET_GEODETIC(flags, value) ((flags) = (value) ? ((flags) | 0x08) : ((flags) & 0xF7))
-#define RTFLAGS_SET_READONLY(flags, value) ((flags) = (value) ? ((flags) | 0x10) : ((flags) & 0xEF))
-#define RTFLAGS_SET_SOLID(flags, value) ((flags) = (value) ? ((flags) | 0x20) : ((flags) & 0xDF))
-#define RTFLAGS_NDIMS(flags) (2 + RTFLAGS_GET_Z(flags) + RTFLAGS_GET_M(flags))
-#define RTFLAGS_GET_ZM(flags) (RTFLAGS_GET_M(flags) + RTFLAGS_GET_Z(flags) * 2)
-#define RTFLAGS_NDIMS_BOX(flags) (RTFLAGS_GET_GEODETIC(flags) ? 3 : RTFLAGS_NDIMS(flags))
-
-/**
-* Macros for manipulating the 'typemod' int. An int32_t used as follows:
-* Plus/minus = Top bit.
-* Spare bits = Next 2 bits.
-* SRID = Next 21 bits.
-* RTTYPE = Next 6 bits.
-* ZM Flags = Bottom 2 bits.
-*/
-
-#define RTTYPMOD_GET_SRID(typmod) ((((typmod) & 0x1FFFFF00)<<3)>>11)
-#define RTTYPMOD_SET_SRID(typmod, srid) ((typmod) = (((typmod) & 0xE00000FF) | ((srid & 0x001FFFFF)<<8)))
-#define RTTYPMOD_GET_TYPE(typmod) ((typmod & 0x000000FC)>>2)
-#define RTTYPMOD_SET_TYPE(typmod, type) ((typmod) = (typmod & 0xFFFFFF03) | ((type & 0x0000003F)<<2))
-#define RTTYPMOD_GET_Z(typmod) ((typmod & 0x00000002)>>1)
-#define RTTYPMOD_SET_Z(typmod) ((typmod) = typmod | 0x00000002)
-#define RTTYPMOD_GET_M(typmod) (typmod & 0x00000001)
-#define RTTYPMOD_SET_M(typmod) ((typmod) = typmod | 0x00000001)
-#define RTTYPMOD_GET_NDIMS(typmod) (2+RTTYPMOD_GET_Z(typmod)+RTTYPMOD_GET_M(typmod))
-
-/**
-* Maximum allowed SRID value in serialized geometry.
-* Currently we are using 21 bits (2097152) of storage for SRID.
-*/
-#define SRID_MAXIMUM 999999
-
-/**
- * Maximum valid SRID value for the user
- * We reserve 1000 values for internal use
- */
-#define SRID_USER_MAXIMUM 998999
-
-/** Unknown SRID value */
-#define SRID_UNKNOWN 0
-#define SRID_IS_UNKNOWN(x) ((int)x<=0)
-
-/*
-** EPSG WGS84 geographics, OGC standard default SRS, better be in
-** the SPATIAL_REF_SYS table!
-*/
-#define SRID_DEFAULT 4326
-
-#ifndef __GNUC__
-# define __attribute__(x)
-#endif
-
-/**
- * RT library context
- */
-typedef struct RTCTX_T RTCTX;
-
-/**
- * Global functions for memory/logging handlers.
- */
-typedef void* (*rtallocator)(size_t size);
-typedef void* (*rtreallocator)(void *mem, size_t size);
-typedef void (*rtfreeor)(void* mem);
-typedef void (*rtreporter)(const char* fmt, va_list ap, void *arg)
-  __attribute__ (( format(printf, 1, 0) ));
-typedef void (*rtdebuglogger)(int level, const char* fmt, va_list ap, void *arg)
-  __attribute__ (( format(printf, 2,0) ));
-
-
-/**
- * Initialize the library with custom memory management functions
- * you want your application to use.
- * @param allocator function for allocating memory,
- *                  or NULL to use the default
- * @param reallocator function for reallocating memory,
- *                    or NULL to use the default
- * @param freeor function for release memory,
- *               or NULL to use the default
- * @return a context object to use in subsequent calls
- *         to the library
- * @see rtgeom_finish to destroy the created context
- * @ingroup system
- */
-RTCTX *rtgeom_init(rtallocator allocator,
-                   rtreallocator reallocator,
-                   rtfreeor freeor);
-
-/**
- * Deinitialize the library, releasing all context memory
- *
- * @param ctx a context returned by rtgeom_init
- *
- */
-void rtgeom_finish(RTCTX *ctx);
-
-/** Return rtgeom version string (not to be freed) */
-const char* rtgeom_version(void);
-
-
-/**
-* Return a valid SRID from an arbitrary integer
-* Raises a notice if what comes out is different from
-* what went in.
-* Raises an error if SRID value is out of bounds.
-*/
-extern int clamp_srid(const RTCTX *ctx, int srid);
-
-/* Raise an rterror if srids do not match */
-void error_if_srid_mismatch(const RTCTX *ctx, int srid1, int srid2);
-
-/**
- * This functions are called by programs which want to set up
- * custom handling for error reporting
- */
-extern void rtgeom_set_error_logger(RTCTX *ctx,
-          rtreporter logger, void *arg);
-extern void rtgeom_set_notice_logger(RTCTX *ctx,
-          rtreporter logger, void *arg);
-extern void rtgeom_set_debug_logger(RTCTX *ctx,
-          rtdebuglogger logger, void *arg);
-
-/**
- * Request interruption of any running code
- *
- * Safe for use from signal handlers
- *
- * Interrupted code will (as soon as it finds out
- * to be interrupted) cleanup and return as soon as possible.
- *
- * The return value from interrupted code is undefined,
- * it is the caller responsibility to not take it in consideration.
- *
- */
-extern void rtgeom_request_interrupt(const RTCTX *ctx);
-
-/**
- * Cancel any interruption request
- */
-extern void rtgeom_cancel_interrupt(const RTCTX *ctx);
-
-/**
- * Install a callback to be called periodically during
- * algorithm execution. Mostly only needed on WIN32 to
- * dispatch queued signals.
- *
- * The callback is invoked before checking for interrupt
- * being requested, so you can request interruption from
- * the callback, if you want (see rtgeom_request_interrupt).
- *
- */
-typedef void (rtinterrupt_callback)();
-extern rtinterrupt_callback *rtgeom_register_interrupt_callback(const RTCTX *ctx, rtinterrupt_callback *);
-
-/******************************************************************/
-
-typedef struct {
-	double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
-} RTAFFINE;
-
-/******************************************************************/
-
-typedef struct
-{
-	double xmin, ymin, zmin;
-	double xmax, ymax, zmax;
-	int32_t srid;
-}
-BOX3D;
-
-/******************************************************************
-* RTGBOX structure.
-* We include the flags (information about dimensinality),
-* so we don't have to constantly pass them
-* into functions that use the RTGBOX.
-*/
-typedef struct
-{
-	uint8_t flags;
-	double xmin;
-	double xmax;
-	double ymin;
-	double ymax;
-	double zmin;
-	double zmax;
-	double mmin;
-	double mmax;
-} RTGBOX;
-
-
-/******************************************************************
-* SPHEROID
-*
-*  Standard definition of an ellipsoid (what wkt calls a spheroid)
-*    f = (a-b)/a
-*    e_sq = (a*a - b*b)/(a*a)
-*    b = a - fa
-*/
-typedef struct
-{
-	double	a;	/* semimajor axis */
-	double	b; 	/* semiminor axis b = (a - fa) */
-	double	f;	/* flattening f = (a-b)/a */
-	double	e;	/* eccentricity (first) */
-	double	e_sq;	/* eccentricity squared (first) e_sq = (a*a-b*b)/(a*a) */
-	double  radius;  /* spherical average radius = (2*a+b)/3 */
-	char	name[20];  /* name of ellipse */
-}
-SPHEROID;
-
-/******************************************************************
-* RTPOINT2D, POINT3D, RTPOINT3DM, RTPOINT4D
-*/
-typedef struct
-{
-	double x, y;
-}
-RTPOINT2D;
-
-typedef struct
-{
-	double x, y, z;
-}
-RTPOINT3DZ;
-
-typedef struct
-{
-	double x, y, z;
-}
-POINT3D;
-
-typedef struct
-{
-	double x, y, m;
-}
-RTPOINT3DM;
-
-typedef struct
-{
-	double x, y, z, m;
-}
-RTPOINT4D;
-
-/******************************************************************
-*  RTPOINTARRAY
-*  Point array abstracts a lot of the complexity of points and point lists.
-*  It handles 2d/3d translation
-*    (2d points converted to 3d will have z=0 or NaN)
-*  DO NOT MIX 2D and 3D POINTS! EVERYTHING* is either one or the other
-*/
-typedef struct
-{
-	/* Array of POINT 2D, 3D or 4D, possibly missaligned. */
-	uint8_t *serialized_pointlist;
-
-	/* Use RTFLAGS_* macros to handle */
-	uint8_t  flags;
-
-	int npoints;   /* how many points we are currently storing */
-	int maxpoints; /* how many points we have space for in serialized_pointlist */
-}
-RTPOINTARRAY;
-
-/******************************************************************
-* GSERIALIZED
-*/
-typedef struct
-{
-	uint32_t size; /* For PgSQL use only, use VAR* macros to manipulate. */
-	uint8_t srid[3]; /* 24 bits of SRID */
-	uint8_t flags; /* HasZ, HasM, HasBBox, IsGeodetic, IsReadOnly */
-	uint8_t data[1]; /* See gserialized.txt */
-} GSERIALIZED;
-
-
-/******************************************************************
-* RTGEOM (any geometry type)
-*
-* Abstract type, note that 'type', 'bbox' and 'srid' are available in
-* all geometry variants.
-*/
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	void *data;
-}
-RTGEOM;
-
-/* RTPOINTYPE */
-typedef struct
-{
-	uint8_t type; /* RTPOINTTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *point;  /* hide 2d/3d (this will be an array of 1 point) */
-}
-RTPOINT; /* "light-weight point" */
-
-/* RTLINETYPE */
-typedef struct
-{
-	uint8_t type; /* RTLINETYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points; /* array of POINT3D */
-}
-RTLINE; /* "light-weight line" */
-
-/* TRIANGLE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points;
-}
-RTTRIANGLE;
-
-/* RTCIRCSTRINGTYPE */
-typedef struct
-{
-	uint8_t type; /* RTCIRCSTRINGTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points; /* array of POINT(3D/3DM) */
-}
-RTCIRCSTRING; /* "light-weight circularstring" */
-
-/* RTPOLYGONTYPE */
-typedef struct
-{
-	uint8_t type; /* RTPOLYGONTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int nrings;   /* how many rings we are currently storing */
-	int maxrings; /* how many rings we have space for in **rings */
-	RTPOINTARRAY **rings; /* list of rings (list of points) */
-}
-RTPOLY; /* "light-weight polygon" */
-
-/* RTMULTIPOINTTYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOINT **geoms;
-}
-RTMPOINT;
-
-/* RTMULTILINETYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTLINE **geoms;
-}
-RTMLINE;
-
-/* RTMULTIPOLYGONTYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOLY **geoms;
-}
-RTMPOLY;
-
-/* RTCOLLECTIONTYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
-}
-RTCOLLECTION;
-
-/* RTCOMPOUNDTYPE */
-typedef struct
-{
-	uint8_t type; /* RTCOMPOUNDTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
-}
-RTCOMPOUND; /* "light-weight compound line" */
-
-/* RTCURVEPOLYTYPE */
-typedef struct
-{
-	uint8_t type; /* RTCURVEPOLYTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int nrings;    /* how many rings we are currently storing */
-	int maxrings;  /* how many rings we have space for in **rings */
-	RTGEOM **rings; /* list of rings (list of points) */
-}
-RTCURVEPOLY; /* "light-weight polygon" */
-
-/* MULTICURVE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
-}
-RTMCURVE;
-
-/* RTMULTISURFACETYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
-}
-RTMSURFACE;
-
-/* RTPOLYHEDRALSURFACETYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOLY **geoms;
-}
-RTPSURFACE;
-
-/* RTTINTYPE */
-typedef struct
-{
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTTRIANGLE **geoms;
-}
-RTTIN;
-
-/* Casts RTGEOM->RT* (return NULL if cast is illegal) */
-extern RTMPOLY *rtgeom_as_rtmpoly(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTMLINE *rtgeom_as_rtmline(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTMPOINT *rtgeom_as_rtmpoint(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTCOLLECTION *rtgeom_as_rtcollection(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTPOLY *rtgeom_as_rtpoly(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTLINE *rtgeom_as_rtline(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTPOINT *rtgeom_as_rtpoint(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTCIRCSTRING *rtgeom_as_rtcircstring(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTCURVEPOLY *rtgeom_as_rtcurvepoly(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTCOMPOUND *rtgeom_as_rtcompound(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTPSURFACE *rtgeom_as_rtpsurface(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTTRIANGLE *rtgeom_as_rttriangle(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTTIN *rtgeom_as_rttin(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTGEOM *rtgeom_as_multi(const RTCTX *ctx, const RTGEOM *rtgeom);
-extern RTGEOM *rtgeom_as_curve(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/* Casts RT*->RTGEOM (artays cast) */
-extern RTGEOM *rttin_as_rtgeom(const RTCTX *ctx, const RTTIN *obj);
-extern RTGEOM *rttriangle_as_rtgeom(const RTCTX *ctx, const RTTRIANGLE *obj);
-extern RTGEOM *rtpsurface_as_rtgeom(const RTCTX *ctx, const RTPSURFACE *obj);
-extern RTGEOM *rtmpoly_as_rtgeom(const RTCTX *ctx, const RTMPOLY *obj);
-extern RTGEOM *rtmline_as_rtgeom(const RTCTX *ctx, const RTMLINE *obj);
-extern RTGEOM *rtmpoint_as_rtgeom(const RTCTX *ctx, const RTMPOINT *obj);
-extern RTGEOM *rtcollection_as_rtgeom(const RTCTX *ctx, const RTCOLLECTION *obj);
-extern RTGEOM *rtcircstring_as_rtgeom(const RTCTX *ctx, const RTCIRCSTRING *obj);
-extern RTGEOM *rtcompound_as_rtgeom(const RTCTX *ctx, const RTCOMPOUND *obj);
-extern RTGEOM *rtcurvepoly_as_rtgeom(const RTCTX *ctx, const RTCURVEPOLY *obj);
-extern RTGEOM *rtpoly_as_rtgeom(const RTCTX *ctx, const RTPOLY *obj);
-extern RTGEOM *rtline_as_rtgeom(const RTCTX *ctx, const RTLINE *obj);
-extern RTGEOM *rtpoint_as_rtgeom(const RTCTX *ctx, const RTPOINT *obj);
-
-
-extern RTCOLLECTION* rtcollection_add_rtgeom(const RTCTX *ctx, RTCOLLECTION *col, const RTGEOM *geom);
-extern RTMPOINT* rtmpoint_add_rtpoint(const RTCTX *ctx, RTMPOINT *mobj, const RTPOINT *obj);
-extern RTMLINE* rtmline_add_rtline(const RTCTX *ctx, RTMLINE *mobj, const RTLINE *obj);
-extern RTMPOLY* rtmpoly_add_rtpoly(const RTCTX *ctx, RTMPOLY *mobj, const RTPOLY *obj);
-extern RTPSURFACE* rtpsurface_add_rtpoly(const RTCTX *ctx, RTPSURFACE *mobj, const RTPOLY *obj);
-extern RTTIN* rttin_add_rttriangle(const RTCTX *ctx, RTTIN *mobj, const RTTRIANGLE *obj);
-
-
-
-/***********************************************************************
-** Utility functions for flag byte and srid_flag integer.
-*/
-
-/**
-* Construct a new flags char.
-*/
-extern uint8_t gflags(const RTCTX *ctx, int hasz, int hasm, int geodetic);
-
-/**
-* Extract the geometry type from the serialized form (it hides in
-* the anonymous data area, so this is a handy function).
-*/
-extern uint32_t gserialized_get_type(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Returns the size in bytes to read from toast to get the basic
-* information from a geometry: GSERIALIZED struct, bbox and type
-*/
-extern uint32_t gserialized_max_header_size(const RTCTX *ctx);
-
-/**
-* Extract the SRID from the serialized form (it is packed into
-* three bytes so this is a handy function).
-*/
-extern int32_t gserialized_get_srid(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Write the SRID into the serialized form (it is packed into
-* three bytes so this is a handy function).
-*/
-extern void gserialized_set_srid(const RTCTX *ctx, GSERIALIZED *g, int32_t srid);
-
-/**
-* Check if a #GSERIALIZED is empty without deserializing first.
-* Only checks if the number of elements of the parent geometry
-* is zero, will not catch collections of empty, eg:
-* GEOMETRYCOLLECTION(POINT EMPTY)
-*/
-extern int gserialized_is_empty(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Check if a #GSERIALIZED has a bounding box without deserializing first.
-*/
-extern int gserialized_has_bbox(const RTCTX *ctx, const GSERIALIZED *gser);
-
-/**
-* Check if a #GSERIALIZED has a Z ordinate.
-*/
-extern int gserialized_has_z(const RTCTX *ctx, const GSERIALIZED *gser);
-
-/**
-* Check if a #GSERIALIZED has an M ordinate.
-*/
-extern int gserialized_has_m(const RTCTX *ctx, const GSERIALIZED *gser);
-
-/**
-* Check if a #GSERIALIZED is a geography.
-*/
-extern int gserialized_is_geodetic(const RTCTX *ctx, const GSERIALIZED *gser);
-
-/**
-* Return a number indicating presence of Z and M coordinates.
-* 0 = None, 1 = M, 2 = Z, 3 = ZM
-*/
-extern int gserialized_get_zm(const RTCTX *ctx, const GSERIALIZED *gser);
-
-/**
-* Return the number of dimensions (2, 3, 4) in a geometry
-*/
-extern int gserialized_ndims(const RTCTX *ctx, const GSERIALIZED *gser);
-
-
-/**
-* Call this function to drop BBOX and SRID
-* from RTGEOM. If RTGEOM type is *not* flagged
-* with the HASBBOX flag and has a bbox, it
-* will be released.
-*/
-extern void rtgeom_drop_bbox(const RTCTX *ctx, RTGEOM *rtgeom);
-extern void rtgeom_drop_srid(const RTCTX *ctx, RTGEOM *rtgeom);
-
-/**
- * Compute a bbox if not already computed
- *
- * After calling this function rtgeom->bbox is only
- * NULL if the geometry is empty.
- */
-extern void rtgeom_add_bbox(const RTCTX *ctx, RTGEOM *rtgeom);
-/**
-* Compute a box for geom and all sub-geometries, if not already computed
-*/
-extern void rtgeom_add_bbox_deep(const RTCTX *ctx, RTGEOM *rtgeom, RTGBOX *gbox);
-
-/**
- * Get a non-empty geometry bounding box, computing and
- * caching it if not already there
- *
- * NOTE: empty geometries don't have a bounding box so
- *       you'd still get a NULL for them.
- */
-extern const RTGBOX *rtgeom_get_bbox(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/**
-* Determine whether a RTGEOM can contain sub-geometries or not
-*/
-extern int rtgeom_is_collection(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/******************************************************************/
-/* Functions that work on type numbers */
-
-/**
-* Determine whether a type number is a collection or not
-*/
-extern int rttype_is_collection(const RTCTX *ctx, uint8_t type);
-
-/**
-* Given an rttype number, what homogeneous collection can hold it?
-*/
-extern int rttype_get_collectiontype(const RTCTX *ctx, uint8_t type);
-
-/**
-* Return the type name string associated with a type number
-* (e.g. Point, LineString, Polygon)
-*/
-extern const char *rttype_name(const RTCTX *ctx, uint8_t type);
-
-
-/******************************************************************/
-
-/*
- * copies a point from the point array into the parameter point
- * will set point's z=0 (or NaN) if pa is 2d
- * will set point's m=0 (or NaN) if pa is 3d or 2d
- * NOTE: point is a real POINT3D *not* a pointer
- */
-extern RTPOINT4D rt_getPoint4d(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/*
- * copies a point from the point array into the parameter point
- * will set point's z=0 (or NaN) if pa is 2d
- * will set point's m=0 (or NaN) if pa is 3d or 2d
- * NOTE: this will modify the point4d pointed to by 'point'.
- */
-extern int rt_getPoint4d_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT4D *point);
-
-/*
- * copies a point from the point array into the parameter point
- * will set point's z=0 (or NaN) if pa is 2d
- * NOTE: point is a real POINT3D *not* a pointer
- */
-extern RTPOINT3DZ rt_getPoint3dz(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-extern RTPOINT3DM rt_getPoint3dm(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/*
- * copies a point from the point array into the parameter point
- * will set point's z=0 (or NaN) if pa is 2d
- * NOTE: this will modify the point3d pointed to by 'point'.
- */
-extern int rt_getPoint3dz_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DZ *point);
-extern int rt_getPoint3dm_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DM *point);
-
-
-/*
- * copies a point from the point array into the parameter point
- * z value (if present is not returned)
- * NOTE: point is a real POINT3D *not* a pointer
- */
-extern RTPOINT2D rt_getPoint2d(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/*
- * copies a point from the point array into the parameter point
- * z value (if present is not returned)
- * NOTE: this will modify the point2d pointed to by 'point'.
- */
-extern int rt_getPoint2d_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT2D *point);
-
-/**
-* Returns a RTPOINT2D pointer into the RTPOINTARRAY serialized_ptlist,
-* suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the
-* values, only read them.
-*/
-extern const RTPOINT2D* rt_getPoint2d_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/**
-* Returns a RTPOINT3DZ pointer into the RTPOINTARRAY serialized_ptlist,
-* suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the
-* values, only read them.
-*/
-extern const RTPOINT3DZ* rt_getPoint3dz_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/**
-* Returns a RTPOINT4D pointer into the RTPOINTARRAY serialized_ptlist,
-* suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the
-* values, only read them.
-*/
-extern const RTPOINT4D* rt_getPoint4d_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/*
- * set point N to the given value
- * NOTE that the pointarray can be of any
- * dimension, the appropriate ordinate values
- * will be extracted from it
- *
- * N must be a valid point index
- */
-extern void ptarray_set_point4d(const RTCTX *ctx, RTPOINTARRAY *pa, int n, const RTPOINT4D *p4d);
-
-/*
- * get a pointer to nth point of a RTPOINTARRAY
- * You'll need to cast it to appropriate dimensioned point.
- * Note that if you cast to a higher dimensional point you'll
- * possibly corrupt the RTPOINTARRAY.
- *
- * WARNING: Don't cast this to a POINT !
- * it would not be reliable due to memory alignment constraints
- */
-extern uint8_t *rt_getPoint_internal(const RTCTX *ctx, const RTPOINTARRAY *pa, int n);
-
-/*
- * size of point represeneted in the RTPOINTARRAY
- * 16 for 2d, 24 for 3d, 32 for 4d
- */
-extern int ptarray_point_size(const RTCTX *ctx, const RTPOINTARRAY *pa);
-
-
-/**
-* Construct an empty pointarray, allocating storage and setting
-* the npoints, but not filling in any information. Should be used in conjunction
-* with ptarray_set_point4d to fill in the information in the array.
-*/
-extern RTPOINTARRAY* ptarray_construct(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints);
-
-/**
-* Construct a new #RTPOINTARRAY, <em>copying</em> in the data from ptlist
-*/
-extern RTPOINTARRAY* ptarray_construct_copy_data(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints, const uint8_t *ptlist);
-
-/**
-* Construct a new #RTPOINTARRAY, <em>referencing</em> to the data from ptlist
-*/
-extern RTPOINTARRAY* ptarray_construct_reference_data(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints, uint8_t *ptlist);
-
-/**
-* Create a new #RTPOINTARRAY with no points. Allocate enough storage
-* to hold maxpoints vertices before having to reallocate the storage
-* area.
-*/
-extern RTPOINTARRAY* ptarray_construct_empty(const RTCTX *ctx, char hasz, char hasm, uint32_t maxpoints);
-
-/**
-* Append a point to the end of an existing #RTPOINTARRAY
-* If allow_duplicate is RT_TRUE, then a duplicate point will
-* not be added.
-*/
-extern int ptarray_append_point(const RTCTX *ctx, RTPOINTARRAY *pa, const RTPOINT4D *pt, int allow_duplicates);
-
-/**
- * Append a #RTPOINTARRAY, pa2 to the end of an existing #RTPOINTARRAY, pa1.
- *
- * If gap_tolerance is >= 0 then the end point of pa1 will be checked for
- * being within gap_tolerance 2d distance from start point of pa2 or an
- * error will be raised and RT_FAILURE returned.
- * A gap_tolerance < 0 disables the check.
- *
- * If end point of pa1 and start point of pa2 are 2d-equal, then pa2 first
- * point will not be appended.
- */
-extern int ptarray_append_ptarray(const RTCTX *ctx, RTPOINTARRAY *pa1, RTPOINTARRAY *pa2, double gap_tolerance);
-
-/**
-* Insert a point into an existing #RTPOINTARRAY. Zero
-* is the index of the start of the array.
-*/
-extern int ptarray_insert_point(const RTCTX *ctx, RTPOINTARRAY *pa, const RTPOINT4D *p, int where);
-
-/**
-* Remove a point from an existing #RTPOINTARRAY. Zero
-* is the index of the start of the array.
-*/
-extern int ptarray_remove_point(const RTCTX *ctx, RTPOINTARRAY *pa, int where);
-
-/**
- * @brief Add a point in a pointarray.
- *
- * @param pa the source RTPOINTARRAY
- * @param p the point to add
- * @param pdims number of ordinates in p (2..4)
- * @param where to insert the point. 0 prepends, pa->npoints appends
- *
- * @returns a newly constructed RTPOINTARRAY using a newly allocated buffer
- *          for the actual points, or NULL on error.
- */
-extern RTPOINTARRAY *ptarray_addPoint(const RTCTX *ctx, const RTPOINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where);
-
-/**
- * @brief Remove a point from a pointarray.
- * 	@param which -  is the offset (starting at 0)
- * @return #RTPOINTARRAY is newly allocated
- */
-extern RTPOINTARRAY *ptarray_removePoint(const RTCTX *ctx, RTPOINTARRAY *pa, uint32_t where);
-
-/**
- * @brief Merge two given RTPOINTARRAY and returns a pointer
- * on the new aggregate one.
- * Warning: this function free the two inputs RTPOINTARRAY
- * @return #RTPOINTARRAY is newly allocated
- */
-extern RTPOINTARRAY *ptarray_merge(const RTCTX *ctx, RTPOINTARRAY *pa1, RTPOINTARRAY *pa2);
-
-extern int ptarray_is_closed(const RTCTX *ctx, const RTPOINTARRAY *pa);
-extern int ptarray_is_closed_2d(const RTCTX *ctx, const RTPOINTARRAY *pa);
-extern int ptarray_is_closed_3d(const RTCTX *ctx, const RTPOINTARRAY *pa);
-extern int ptarray_is_closed_z(const RTCTX *ctx, const RTPOINTARRAY *pa);
-extern void ptarray_longitude_shift(const RTCTX *ctx, RTPOINTARRAY *pa);
-extern int ptarray_isccw(const RTCTX *ctx, const RTPOINTARRAY *pa);
-extern void ptarray_reverse(const RTCTX *ctx, RTPOINTARRAY *pa);
-extern RTPOINTARRAY* ptarray_flip_coordinates(const RTCTX *ctx, RTPOINTARRAY *pa);
-
-/**
- * @d1 start location (distance from start / total distance)
- * @d2   end location (distance from start / total distance)
- * @param tolerance snap to vertices at locations < tolerance away from given ones
- */
-extern RTPOINTARRAY *ptarray_substring(const RTCTX *ctx, RTPOINTARRAY *pa, double d1, double d2,
-                                                          double tolerance);
-
-
-/**
-* Strip out the Z/M components of an #RTGEOM
-*/
-extern RTGEOM* rtgeom_force_2d(const RTCTX *ctx, const RTGEOM *geom);
-extern RTGEOM* rtgeom_force_3dz(const RTCTX *ctx, const RTGEOM *geom);
-extern RTGEOM* rtgeom_force_3dm(const RTCTX *ctx, const RTGEOM *geom);
-extern RTGEOM* rtgeom_force_4d(const RTCTX *ctx, const RTGEOM *geom);
-
-extern RTGEOM* rtgeom_simplify(const RTCTX *ctx, const RTGEOM *igeom, double dist, int preserve_collapsed);
-extern RTGEOM* rtgeom_set_effective_area(const RTCTX *ctx, const RTGEOM *igeom, int set_area, double area);
-
-/*
- * Force to use SFS 1.1 geometry type
- * (rather than SFS 1.2 and/or SQL/MM)
- */
-extern RTGEOM* rtgeom_force_sfs(const RTCTX *ctx, RTGEOM *geom, int version);
-
-
-/*--------------------------------------------------------
- * all the base types (point/line/polygon) will have a
- * basic constructor, basic de-serializer, basic serializer,
- * bounding box finder and (TODO) serialized form size finder.
- *--------------------------------------------------------*/
-
-/*
- * convenience functions to hide the RTPOINTARRAY
- */
-extern int rtpoint_getPoint2d_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT2D *out);
-extern int rtpoint_getPoint3dz_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT3DZ *out);
-extern int rtpoint_getPoint3dm_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT3DM *out);
-extern int rtpoint_getPoint4d_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT4D *out);
-
-/******************************************************************
- * RTLINE functions
- ******************************************************************/
-
-/**
- * Add a RTPOINT to an RTLINE
- */
-extern int rtline_add_rtpoint(const RTCTX *ctx, RTLINE *line, RTPOINT *point, int where);
-
-/******************************************************************
- * RTPOLY functions
- ******************************************************************/
-
-/**
-* Add a ring, allocating extra space if necessary. The polygon takes
-* ownership of the passed point array.
-*/
-extern int rtpoly_add_ring(const RTCTX *ctx, RTPOLY *poly, RTPOINTARRAY *pa);
-
-/**
-* Add a ring, allocating extra space if necessary. The curvepolygon takes
-* ownership of the passed point array.
-*/
-extern int rtcurvepoly_add_ring(const RTCTX *ctx, RTCURVEPOLY *poly, RTGEOM *ring);
-
-/**
-* Add a component, allocating extra space if necessary. The compoundcurve
-* takes owership of the passed geometry.
-*/
-extern int rtcompound_add_rtgeom(const RTCTX *ctx, RTCOMPOUND *comp, RTGEOM *geom);
-
-/**
-* Construct an equivalent compound curve from a linestring.
-* Compound curves can have linear components, so this works fine
-*/
-extern RTCOMPOUND* rtcompound_construct_from_rtline(const RTCTX *ctx, const RTLINE *rtpoly);
-
-/**
-* Construct an equivalent curve polygon from a polygon. Curve polygons
-* can have linear rings as their rings, so this works fine (in theory?)
-*/
-extern RTCURVEPOLY* rtcurvepoly_construct_from_rtpoly(const RTCTX *ctx, RTPOLY *rtpoly);
-
-
-/******************************************************************
- * RTGEOM functions
- ******************************************************************/
-
-extern int rtcollection_ngeoms(const RTCTX *ctx, const RTCOLLECTION *col);
-
-/* Given a generic geometry/collection, return the "simplest" form. */
-extern RTGEOM *rtgeom_homogenize(const RTCTX *ctx, const RTGEOM *geom);
-
-
-/******************************************************************
- * RTMULTIx and RTCOLLECTION functions
- ******************************************************************/
-
-RTGEOM *rtcollection_getsubgeom(const RTCTX *ctx, RTCOLLECTION *col, int gnum);
-RTCOLLECTION* rtcollection_extract(const RTCTX *ctx, RTCOLLECTION *col, int type);
-
-
-/******************************************************************
- * SERIALIZED FORM functions
- ******************************************************************/
-
-/**
-* Set the SRID on an RTGEOM
-* For collections, only the parent gets an SRID, all
-* the children get SRID_UNKNOWN.
-*/
-extern void rtgeom_set_srid(const RTCTX *ctx, RTGEOM *geom, int srid);
-
-/*------------------------------------------------------
- * other stuff
- *
- * handle the double-to-float conversion.  The results of this
- * will usually be a slightly bigger box because of the difference
- * between float8 and float4 representations.
- */
-
-extern BOX3D* box3d_from_gbox(const RTCTX *ctx, const RTGBOX *gbox);
-extern RTGBOX* box3d_to_gbox(const RTCTX *ctx, const BOX3D *b3d);
-
-void expand_box3d(BOX3D *box, double d);
-
-
-/****************************************************************
- * MEMORY MANAGEMENT
- ****************************************************************/
-
-/*
-* The *_free family of functions frees *all* memory associated
-* with the pointer. When the recursion gets to the level of the
-* RTPOINTARRAY, the RTPOINTARRAY is only freed if it is not flagged
-* as "read only". RTGEOMs constructed on top of GSERIALIZED
-* from PgSQL use read only point arrays.
-*/
-
-extern void ptarray_free(const RTCTX *ctx, RTPOINTARRAY *pa);
-extern void rtpoint_free(const RTCTX *ctx, RTPOINT *pt);
-extern void rtline_free(const RTCTX *ctx, RTLINE *line);
-extern void rtpoly_free(const RTCTX *ctx, RTPOLY *poly);
-extern void rttriangle_free(const RTCTX *ctx, RTTRIANGLE *triangle);
-extern void rtmpoint_free(const RTCTX *ctx, RTMPOINT *mpt);
-extern void rtmline_free(const RTCTX *ctx, RTMLINE *mline);
-extern void rtmpoly_free(const RTCTX *ctx, RTMPOLY *mpoly);
-extern void rtpsurface_free(const RTCTX *ctx, RTPSURFACE *psurf);
-extern void rttin_free(const RTCTX *ctx, RTTIN *tin);
-extern void rtcollection_free(const RTCTX *ctx, RTCOLLECTION *col);
-extern void rtcircstring_free(const RTCTX *ctx, RTCIRCSTRING *curve);
-extern void rtgeom_free(const RTCTX *ctx, RTGEOM *geom);
-
-/*
-* The *_release family of functions frees the RTGEOM structures
-* surrounding the RTPOINTARRAYs but leaves the RTPOINTARRAYs
-* intact. Useful when re-shaping geometries between types,
-* or splicing geometries together.
-*/
-
-extern void rtpoint_release(const RTCTX *ctx, RTPOINT *rtpoint);
-extern void rtline_release(const RTCTX *ctx, RTLINE *rtline);
-extern void rtpoly_release(const RTCTX *ctx, RTPOLY *rtpoly);
-extern void rttriangle_release(const RTCTX *ctx, RTTRIANGLE *rttriangle);
-extern void rtcircstring_release(const RTCTX *ctx, RTCIRCSTRING *rtcirc);
-extern void rtmpoint_release(const RTCTX *ctx, RTMPOINT *rtpoint);
-extern void rtmline_release(const RTCTX *ctx, RTMLINE *rtline);
-extern void rtmpoly_release(const RTCTX *ctx, RTMPOLY *rtpoly);
-extern void rtpsurface_release(RTPSURFACE *rtpsurface);
-extern void rttin_release(RTTIN *rttin);
-extern void rtcollection_release(const RTCTX *ctx, RTCOLLECTION *rtcollection);
-extern void rtgeom_release(const RTCTX *ctx, RTGEOM *rtgeom);
-
-
-/****************************************************************
-* Utility
-****************************************************************/
-
-extern void printBOX3D(const RTCTX *ctx, BOX3D *b);
-extern void printPA(const RTCTX *ctx, RTPOINTARRAY *pa);
-extern void printRTPOINT(const RTCTX *ctx, RTPOINT *point);
-extern void printRTLINE(const RTCTX *ctx, RTLINE *line);
-extern void printRTPOLY(const RTCTX *ctx, RTPOLY *poly);
-extern void printRTTRIANGLE(const RTCTX *ctx, RTTRIANGLE *triangle);
-extern void printRTPSURFACE(const RTCTX *ctx, RTPSURFACE *psurf);
-extern void printRTTIN(const RTCTX *ctx, RTTIN *tin);
-
-extern float  next_float_down(const RTCTX *ctx, double d);
-extern float  next_float_up(const RTCTX *ctx, double d);
-extern double next_double_down(const RTCTX *ctx, float d);
-extern double next_double_up(const RTCTX *ctx, float d);
-
-/* general utilities 2D */
-extern double  distance2d_pt_pt(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2);
-extern double  distance2d_sqr_pt_pt(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2);
-extern double  distance2d_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A, const RTPOINT2D *B);
-extern double  distance2d_sqr_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A, const RTPOINT2D *B);
-extern RTGEOM* rtgeom_closest_line(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern RTGEOM* rtgeom_furthest_line(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern RTGEOM* rtgeom_closest_point(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern RTGEOM* rtgeom_furthest_point(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern double  rtgeom_mindistance2d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern double  rtgeom_mindistance2d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance);
-extern double  rtgeom_maxdistance2d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern double  rtgeom_maxdistance2d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance);
-
-/* 3D */
-extern double distance3d_pt_pt(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2);
-extern double distance3d_pt_seg(const POINT3D *p, const POINT3D *A, const POINT3D *B);
-
-extern RTGEOM* rtgeom_furthest_line_3d(const RTCTX *ctx, RTGEOM *rt1, RTGEOM *rt2);
-extern RTGEOM* rtgeom_closest_line_3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern RTGEOM* rtgeom_closest_point_3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-
-
-extern double rtgeom_mindistance3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern double rtgeom_mindistance3d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance);
-extern double rtgeom_maxdistance3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2);
-extern double rtgeom_maxdistance3d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance);
-
-extern double rtgeom_area(const RTCTX *ctx, const RTGEOM *geom);
-extern double rtgeom_length(const RTCTX *ctx, const RTGEOM *geom);
-extern double rtgeom_length_2d(const RTCTX *ctx, const RTGEOM *geom);
-extern double rtgeom_perimeter(const RTCTX *ctx, const RTGEOM *geom);
-extern double rtgeom_perimeter_2d(const RTCTX *ctx, const RTGEOM *geom);
-extern void rtgeom_affine(const RTCTX *ctx, RTGEOM *geom, const RTAFFINE *affine);
-extern void rtgeom_scale(const RTCTX *ctx, RTGEOM *geom, const RTPOINT4D *factors);
-extern int rtgeom_dimension(const RTCTX *ctx, const RTGEOM *geom);
-
-extern RTPOINT* rtline_get_rtpoint(const RTCTX *ctx, const RTLINE *line, int where);
-extern RTPOINT* rtcircstring_get_rtpoint(const RTCTX *ctx, const RTCIRCSTRING *circ, int where);
-
-extern RTPOINT* rtcompound_get_startpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp);
-extern RTPOINT* rtcompound_get_endpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp);
-extern RTPOINT* rtcompound_get_rtpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp, int where);
-
-
-extern double ptarray_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts);
-extern double ptarray_length(const RTCTX *ctx, const RTPOINTARRAY *pts);
-extern double ptarray_arc_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts);
-
-
-extern int pt_in_ring_2d(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINTARRAY *ring);
-extern int azimuth_pt_pt(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, double *ret);
-extern int rtpoint_inside_circle(const RTCTX *ctx, const RTPOINT *p, double cx, double cy, double rad);
-extern void rtgeom_reverse(const RTCTX *ctx, RTGEOM *rtgeom);
-extern void rtline_reverse(const RTCTX *ctx, RTLINE *line);
-extern void rtpoly_reverse(const RTCTX *ctx, RTPOLY *poly);
-extern void rttriangle_reverse(const RTCTX *ctx, RTTRIANGLE *triangle);
-extern char* rtgeom_summary(const RTCTX *ctx, const RTGEOM *rtgeom, int offset);
-extern char* rtpoint_to_latlon(const RTCTX *ctx, const RTPOINT *p, const char *format);
-extern int rtgeom_startpoint(const RTCTX *ctx, const RTGEOM* rtgeom, RTPOINT4D* pt);
-
-/**
-* Ensure the outer ring is clockwise oriented and all inner rings
-* are counter-clockwise.
-*/
-extern void rtgeom_force_clockwise(const RTCTX *ctx, RTGEOM *rtgeom);
-extern void rtpoly_force_clockwise(const RTCTX *ctx, RTPOLY *poly);
-extern void rttriangle_force_clockwise(const RTCTX *ctx, RTTRIANGLE *triangle);
-
-
-extern void interpolate_point4d(const RTCTX *ctx, RTPOINT4D *A, RTPOINT4D *B, RTPOINT4D *I, double F);
-
-void rtgeom_longitude_shift(const RTCTX *ctx, RTGEOM *rtgeom);
-
-
-/**
-* @brief Check whether or not a rtgeom is big enough to warrant a bounding box.
-*
-* Check whether or not a rtgeom is big enough to warrant a bounding box
-* when stored in the serialized form on disk. Currently only points are
-* considered small enough to not require a bounding box, because the
-* index operations can generate a large number of box-retrieval operations
-* when scanning keys.
-*/
-extern int rtgeom_needs_bbox(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Count the total number of vertices in any #RTGEOM.
-*/
-extern int rtgeom_count_vertices(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Count the total number of rings in any #RTGEOM. Multipolygons
-* and other collections get counted, not the same as OGC st_numrings.
-*/
-extern int rtgeom_count_rings(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return true or false depending on whether a geometry has
-* a valid SRID set.
-*/
-extern int rtgeom_has_srid(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return true or false depending on whether a geometry is an "empty"
-* geometry (no vertices members)
-*/
-extern int rtgeom_is_empty(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return true or false depending on whether a geometry is a linear
-* feature that closes on itself.
-*/
-extern int rtgeom_is_closed(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return the dimensionality (relating to point/line/poly) of an rtgeom
-*/
-extern int rtgeom_dimensionality(const RTCTX *ctx, RTGEOM *geom);
-
-/* Is rtgeom1 geometrically equal to rtgeom2 ? */
-char rtgeom_same(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2);
-char ptarray_same(const RTCTX *ctx, const RTPOINTARRAY *pa1, const RTPOINTARRAY *pa2);
-char rtpoint_same(const RTCTX *ctx, const RTPOINT *p1, const RTPOINT *p2);
-char rtline_same(const RTCTX *ctx, const RTLINE *p1, const RTLINE *p2);
-char rtpoly_same(const RTCTX *ctx, const RTPOLY *p1, const RTPOLY *p2);
-char rttriangle_same(const RTCTX *ctx, const RTTRIANGLE *p1, const RTTRIANGLE *p2);
-char rtcollection_same(const RTCTX *ctx, const RTCOLLECTION *p1, const RTCOLLECTION *p2);
-char rtcircstring_same(const RTCTX *ctx, const RTCIRCSTRING *p1, const RTCIRCSTRING *p2);
-
-
-/**
- * @brief Clone RTGEOM object. Serialized point lists are not copied.
- *
- * #RTGBOX are copied
- *
- * @see ptarray_clone
- */
-extern RTGEOM *rtgeom_clone(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/**
-* Deep clone an RTGEOM, everything is copied
-*/
-extern RTGEOM *rtgeom_clone_deep(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/* TODO Move to Internal */
-RTPOINT *rtpoint_clone(const RTCTX *ctx, const RTPOINT *rtgeom);
-RTPOINTARRAY *ptarray_clone_deep(const RTCTX *ctx, const RTPOINTARRAY *ptarray);
-
-
-/*
-* Geometry constructors. These constructors to not copy the point arrays
-* passed to them, they just take references, so do not free them out
-* from underneath the geometries.
-*/
-extern RTPOINT* rtpoint_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *point);
-extern RTMPOINT *rtmpoint_construct(const RTCTX *ctx, int srid, const RTPOINTARRAY *pa);
-extern RTLINE* rtline_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points);
-extern RTCIRCSTRING* rtcircstring_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points);
-extern RTPOLY* rtpoly_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, uint32_t nrings, RTPOINTARRAY **points);
-extern RTCURVEPOLY* rtcurvepoly_construct(int srid, RTGBOX *bbox, uint32_t nrings, RTGEOM **geoms);
-extern RTTRIANGLE* rttriangle_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points);
-extern RTCOLLECTION* rtcollection_construct(const RTCTX *ctx, uint8_t type, int srid, RTGBOX *bbox, uint32_t ngeoms, RTGEOM **geoms);
-/*
-* Empty geometry constructors.
-*/
-extern RTGEOM* rtgeom_construct_empty(const RTCTX *ctx, uint8_t type, int srid, char hasz, char hasm);
-extern RTPOINT* rtpoint_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTLINE* rtline_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTPOLY* rtpoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTCURVEPOLY* rtcurvepoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTCIRCSTRING* rtcircstring_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTCOMPOUND* rtcompound_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTTRIANGLE* rttriangle_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTMPOINT* rtmpoint_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTMLINE* rtmline_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTMPOLY* rtmpoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm);
-extern RTCOLLECTION* rtcollection_construct_empty(const RTCTX *ctx, uint8_t type, int srid, char hasz, char hasm);
-
-
-/* Other constructors */
-extern RTPOINT *rtpoint_make2d(const RTCTX *ctx, int srid, double x, double y);
-extern RTPOINT *rtpoint_make3dz(const RTCTX *ctx, int srid, double x, double y, double z);
-extern RTPOINT *rtpoint_make3dm(const RTCTX *ctx, int srid, double x, double y, double m);
-extern RTPOINT *rtpoint_make4d(const RTCTX *ctx, int srid, double x, double y, double z, double m);
-extern RTPOINT *rtpoint_make(const RTCTX *ctx, int srid, int hasz, int hasm, const RTPOINT4D *p);
-extern RTLINE *rtline_from_rtgeom_array(const RTCTX *ctx, int srid, uint32_t ngeoms, RTGEOM **geoms);
-extern RTLINE *rtline_from_ptarray(const RTCTX *ctx, int srid, uint32_t npoints, RTPOINT **points); /* TODO: deprecate */
-extern RTLINE *rtline_from_rtmpoint(const RTCTX *ctx, int srid, const RTMPOINT *mpoint);
-extern RTLINE *rtline_addpoint(RTLINE *line, RTPOINT *point, uint32_t where);
-extern RTLINE *rtline_removepoint(const RTCTX *ctx, RTLINE *line, uint32_t which);
-extern void rtline_setPoint4d(const RTCTX *ctx, RTLINE *line, uint32_t which, RTPOINT4D *newpoint);
-extern RTPOLY *rtpoly_from_rtlines(const RTCTX *ctx, const RTLINE *shell, uint32_t nholes, const RTLINE **holes);
-extern RTTRIANGLE *rttriangle_from_rtline(const RTCTX *ctx, const RTLINE *shell);
-
-
-/* Some point accessors */
-extern double rtpoint_get_x(const RTCTX *ctx, const RTPOINT *point);
-extern double rtpoint_get_y(const RTCTX *ctx, const RTPOINT *point);
-extern double rtpoint_get_z(const RTCTX *ctx, const RTPOINT *point);
-extern double rtpoint_get_m(const RTCTX *ctx, const RTPOINT *point);
-
-/**
-* Return SRID number
-*/
-extern int32_t rtgeom_get_srid(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return RTRTTYPE number
-*/
-extern uint32_t rtgeom_get_type(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return #RT_TRUE if geometry has Z ordinates
-*/
-extern int rtgeom_has_z(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return #RT_TRUE if geometry has M ordinates.
-*/
-extern int rtgeom_has_m(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Return the number of dimensions (2, 3, 4) in a geometry
-*/
-extern int rtgeom_ndims(const RTCTX *ctx, const RTGEOM *geom);
-
-/*
- * Given a point, returns the location of closest point on pointarray
- * as a fraction of total length (0: first point -- 1: last point).
- *
- * If not-null, the third argument will be set to the actual distance
- * of the point from the pointarray.
- */
-extern double ptarray_locate_point(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT4D *pt, double *dist, RTPOINT4D *p_located);
-
-/**
-* Add a measure dimension to a line, interpolating linearly from the start
-* to the end value.
-*/
-extern RTLINE *rtline_measured_from_rtline(const RTCTX *ctx, const RTLINE *rtline, double m_start, double m_end);
-extern RTMLINE* rtmline_measured_from_rtmline(const RTCTX *ctx, const RTMLINE *rtmline, double m_start, double m_end);
-
-/**
-* Determine the location(s) along a measured line where m occurs and
-* return as a multipoint. Offset to left (positive) or right (negative).
-*/
-extern RTGEOM* rtgeom_locate_along(const RTCTX *ctx, const RTGEOM *rtin, double m, double offset);
-
-/**
-* Determine the segments along a measured line that fall within the m-range
-* given. Return as a multiline or geometrycollection.
-* Offset to left (positive) or right (negative).
-*/
-extern RTCOLLECTION* rtgeom_locate_between(const RTCTX *ctx, const RTGEOM *rtin, double from, double to, double offset);
-
-/**
-* Find the measure value at the location on the line closest to the point.
-*/
-extern double rtgeom_interpolate_point(const RTCTX *ctx, const RTGEOM *rtin, const RTPOINT *rtpt);
-
-/**
-* Find the time of closest point of approach
-*
-* @param mindist if not null will be set to the minimum distance between
-*                the trajectories at the closest point of approach.
-*
-* @return the time value in which the minimum distance was reached, -1
-*         if inputs are invalid (rterror is called in that case),
-*         -2 if the trajectories do not share any point in time.
-*/
-extern double rtgeom_tcpa(const RTCTX *ctx, const RTGEOM *g1, const RTGEOM *g2, double *mindist);
-
-/**
-* Is the closest point of approach within a distance ?
-*
-* @return RT_TRUE or RT_FALSE
-*/
-extern int rtgeom_cpa_within(const RTCTX *ctx, const RTGEOM *g1, const RTGEOM *g2, double maxdist);
-
-/**
-* Return RT_TRUE or RT_FALSE depending on whether or not a geometry is
-* a linestring with measure value growing from start to end vertex
-*/
-extern int rtgeom_is_trajectory(const RTCTX *ctx, const RTGEOM *geom);
-extern int rtline_is_trajectory(const RTCTX *ctx, const RTLINE *geom);
-
-/*
- * Ensure every segment is at most 'dist' long.
- * Returned RTGEOM might is unchanged if a POINT.
- */
-extern RTGEOM *rtgeom_segmentize2d(const RTCTX *ctx, RTGEOM *line, double dist);
-extern RTPOINTARRAY *ptarray_segmentize2d(const RTCTX *ctx, const RTPOINTARRAY *ipa, double dist);
-extern RTLINE *rtline_segmentize2d(const RTCTX *ctx, RTLINE *line, double dist);
-extern RTPOLY *rtpoly_segmentize2d(const RTCTX *ctx, RTPOLY *line, double dist);
-extern RTCOLLECTION *rtcollection_segmentize2d(const RTCTX *ctx, RTCOLLECTION *coll, double dist);
-
-/**
-* Calculate the GeoHash (http://geohash.org) string for a geometry. Caller must free.
-*/
-char *rtgeom_geohash(const RTCTX *ctx, const RTGEOM *rtgeom, int precision);
-unsigned int geohash_point_as_int(const RTCTX *ctx, RTPOINT2D *pt);
-
-
-/**
-* The return values of rtline_crossing_direction(const RTCTX *ctx)
-*/
-enum RTCG_LINE_CROSS_TYPE {
-    LINE_NO_CROSS = 0,
-    LINE_CROSS_LEFT = -1,
-    LINE_CROSS_RIGHT = 1,
-    LINE_MULTICROSS_END_LEFT = -2,
-    LINE_MULTICROSS_END_RIGHT = 2,
-    LINE_MULTICROSS_END_SAME_FIRST_LEFT = -3,
-    LINE_MULTICROSS_END_SAME_FIRST_RIGHT = 3
-};
-
-/**
-* Given two lines, characterize how (and if) they cross each other
-*/
-int rtline_crossing_direction(const RTCTX *ctx, const RTLINE *l1, const RTLINE *l2);
-
-/**
-* Given a geometry clip  based on the from/to range of one of its ordinates (x, y, z, m). Use for m- and z- clipping.
-*/
-RTCOLLECTION* rtgeom_clip_to_ordinate_range(const RTCTX *ctx, const RTGEOM *rtin, char ordinate, double from, double to, double offset);
-
-/**
- * Macros for specifying GML options.
- * @{
- */
-/** For GML3 only, include srsDimension attribute in output */
-#define RT_GML_IS_DIMS     (1<<0)
-/** For GML3 only, declare that datas are lat/lon. Swaps axis order */
-#define RT_GML_IS_DEGREE   (1<<1)
-/** For GML3, use <LineString> rather than <Curve> for lines */
-#define RT_GML_SHORTLINE   (1<<2)
-/** For GML2 and GML3, output only extent of geometry */
-#define RT_GML_EXTENT      (1<<4)
-
-
-#define IS_DIMS(x) ((x) & RT_GML_IS_DIMS)
-#define IS_DEGREE(x) ((x) & RT_GML_IS_DEGREE)
-/** @} */
-
-/**
- * Macros for specifying X3D options.
- * @{
- */
-/** For flip X/Y coordinates to Y/X */
-#define RT_X3D_FLIP_XY     (1<<0)
-#define RT_X3D_USE_GEOCOORDS     (1<<1)
-#define X3D_USE_GEOCOORDS(x) ((x) & RT_X3D_USE_GEOCOORDS)
-
-
-
-extern char* rtgeom_to_gml2(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, const char *prefix);
-extern char* rtgeom_extent_to_gml2(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, const char *prefix);
-/**
- * @param opts output options bitfield, see RT_GML macros for meaning
- */
-extern char* rtgeom_extent_to_gml3(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, int opts, const char *prefix);
-extern char* rtgeom_to_gml3(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id);
-extern char* rtgeom_to_kml2(const RTCTX *ctx, const RTGEOM *geom, int precision, const char *prefix);
-extern char* rtgeom_to_geojson(const RTCTX *ctx, const RTGEOM *geo, char *srs, int precision, int has_bbox);
-extern char* rtgeom_to_svg(const RTCTX *ctx, const RTGEOM *geom, int precision, int relative);
-extern char* rtgeom_to_x3d3(const RTCTX *ctx, const RTGEOM *geom, char *srs, int precision, int opts, const char *defid);
-
-/**
- * Create an RTGEOM object from a GeoJSON representation
- *
- * @param geojson the GeoJSON input
- * @param srs output parameter. Will be set to a newly allocated
- *            string holding the spatial reference string, or NULL
- *            if no such parameter is found in input.
- *            If not null, the pointer must be freed with rtfree.
- */
-extern RTGEOM* rtgeom_from_geojson(const RTCTX *ctx, const char *geojson, char **srs);
-
-/**
-* Initialize a spheroid object for use in geodetic functions.
-*/
-extern void spheroid_init(const RTCTX *ctx, SPHEROID *s, double a, double b);
-
-/**
-* Calculate the geodetic distance from rtgeom1 to rtgeom2 on the spheroid.
-* A spheroid with major axis == minor axis will be treated as a sphere.
-* Pass in a tolerance in spheroid units.
-*/
-extern double rtgeom_distance_spheroid(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2, const SPHEROID *spheroid, double tolerance);
-
-/**
-* Calculate the location of a point on a spheroid, give a start point, bearing and distance.
-*/
-extern RTPOINT* rtgeom_project_spheroid(const RTCTX *ctx, const RTPOINT *r, const SPHEROID *spheroid, double distance, double azimuth);
-
-/**
-* Derive a new geometry with vertices added to ensure no vertex is more
-* than max_seg_length (in radians) from any other vertex.
-*/
-extern RTGEOM* rtgeom_segmentize_sphere(const RTCTX *ctx, const RTGEOM *rtg_in, double max_seg_length);
-
-/**
-* Calculate the bearing between two points on a spheroid.
-*/
-extern double rtgeom_azumith_spheroid(const RTCTX *ctx, const RTPOINT *r, const RTPOINT *s, const SPHEROID *spheroid);
-
-/**
-* Calculate the geodetic area of a rtgeom on the sphere. The result
-* will be multiplied by the average radius of the supplied spheroid.
-*/
-extern double rtgeom_area_sphere(const RTCTX *ctx, const RTGEOM *rtgeom, const SPHEROID *spheroid);
-
-/**
-* Calculate the geodetic area of a rtgeom on the spheroid. The result
-* will have the squared units of the spheroid axes.
-*/
-extern double rtgeom_area_spheroid(const RTCTX *ctx, const RTGEOM *rtgeom, const SPHEROID *spheroid);
-
-/**
-* Calculate the geodetic length of a rtgeom on the unit sphere. The result
-* will have to by multiplied by the real radius to get the real length.
-*/
-extern double rtgeom_length_spheroid(const RTCTX *ctx, const RTGEOM *geom, const SPHEROID *s);
-
-/**
-* Calculate covers predicate for two rtgeoms on the sphere. Currently
-* only handles point-in-polygon.
-*/
-extern int rtgeom_covers_rtgeom_sphere(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2);
-
-/**
-* Remove repeated points!
-*/
-extern RTGEOM* rtgeom_remove_repeated_points(const RTCTX *ctx, const RTGEOM *in, double tolerance);
-
-extern char rttriangle_is_repeated_points(const RTCTX *ctx, RTTRIANGLE *triangle);
-
-/**
- * Swap ordinate values in every vertex of the geometry.
- *
- * Ordinates to swap are specified using an index with meaning:
- * 0=x, 1=y, 2=z, 3=m
- *
- * Swapping an existing ordinate with an unexisting one results
- * in undefined value being written in the existing ordinate.
- * Caller should verify and prevent such calls.
- *
- * Availability: 2.2.0
- */
-extern void rtgeom_swap_ordinates(const RTCTX *ctx, RTGEOM *in, RTORD o1, RTORD o2);
-
-/**
-* Reverse the X and Y coordinate order. Useful for geometries in lat/lon order
-* than need to be converted to lon/lat order.
-*
-* NOTE: uses rtgeom_swap_ordinates internally,
-*       kept for backward compatibility
-*/
-extern RTGEOM* rtgeom_flip_coordinates(const RTCTX *ctx, RTGEOM *in);
-
-struct RTPOINTITERATOR;
-typedef struct RTPOINTITERATOR RTPOINTITERATOR;
-
-/**
- * Create a new RTPOINTITERATOR over supplied RTGEOM*
- */
-extern RTPOINTITERATOR* rtpointiterator_create(const RTCTX *ctx, const RTGEOM* g);
-
-/**
- * Create a new RTPOINTITERATOR over supplied RTGEOM*
- * Supports modification of coordinates during iteration.
- */
-extern RTPOINTITERATOR* rtpointiterator_create_rw(const RTCTX *ctx, RTGEOM* g);
-
-/**
- * Free all memory associated with the iterator
- */
-extern void rtpointiterator_destroy(const RTCTX *ctx, RTPOINTITERATOR* s);
-
-/**
- * Returns RT_TRUE if there is another point available in the iterator.
- */
-extern int rtpointiterator_has_next(const RTCTX *ctx, RTPOINTITERATOR* s);
-
-/**
- * Attempts to replace the next point int the iterator with p, and advances
- * the iterator to the next point.
- * Returns RT_SUCCESS if the assignment was successful, RT_FAILURE otherwise.
- * */
-extern int rtpointiterator_modify_next(const RTCTX *ctx, RTPOINTITERATOR* s, const RTPOINT4D* p);
-
-/**
- * Attempts to assign the next point in the iterator to p, and advances
- * the iterator to the next point.  If p is NULL, the iterator will be
- * advanced without reading a point.
- * Returns RT_SUCCESS if the assignment was successful, RT_FAILURE otherwise.
- * */
-extern int rtpointiterator_next(const RTCTX *ctx, RTPOINTITERATOR* s, RTPOINT4D* p);
-
-/**
- * Attempts to assigns the next point in the iterator to p.  Does not advance.
- * Returns RT_SUCCESS if the assignment was successful, RT_FAILURE otherwise.
- */
-extern int rtpointiterator_peek(const RTCTX *ctx, RTPOINTITERATOR* s, RTPOINT4D* p);
-
-
-/**
-* Convert a single hex digit into the corresponding char
-*/
-extern uint8_t parse_hex(const RTCTX *ctx, char *str);
-
-/**
-* Convert a char into a human readable hex digit
-*/
-extern void deparse_hex(const RTCTX *ctx, uint8_t str, char *result);
-
-
-
-/***********************************************************************
-** Functions for managing serialized forms and bounding boxes.
-*/
-
-/**
-* Calculate the geocentric bounding box directly from the serialized
-* form of the geodetic coordinates. Only accepts serialized geographies
-* flagged as geodetic. Caller is responsible for disposing of the RTGBOX.
-*/
-extern RTGBOX* gserialized_calculate_gbox_geocentric(const GSERIALIZED *g);
-
-/**
-* Calculate the geocentric bounding box directly from the serialized
-* form of the geodetic coordinates. Only accepts serialized geographies
-* flagged as geodetic.
-*/
-int gserialized_calculate_gbox_geocentric_p(const GSERIALIZED *g, RTGBOX *g_box);
-
-/**
-* Return a RTWKT representation of the gserialized geometry.
-* Caller is responsible for disposing of the char*.
-*/
-extern char* gserialized_to_string(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Return a copy of the input serialized geometry.
-*/
-extern GSERIALIZED* gserialized_copy(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Check that coordinates of RTGEOM are all within the geodetic range (-180, -90, 180, 90)
-*/
-extern int rtgeom_check_geodetic(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Gently move coordinates of RTGEOM if they are close enough into geodetic range.
-*/
-extern int rtgeom_nudge_geodetic(const RTCTX *ctx, RTGEOM *geom);
-
-/**
-* Force coordinates of RTGEOM into geodetic range (-180, -90, 180, 90)
-*/
-extern int rtgeom_force_geodetic(const RTCTX *ctx, RTGEOM *geom);
-
-/**
-* Set the RTFLAGS geodetic bit on geometry an all sub-geometries and pointlists
-*/
-extern void rtgeom_set_geodetic(const RTCTX *ctx, RTGEOM *geom, int value);
-
-/**
-* Calculate the geodetic bounding box for an RTGEOM. Z/M coordinates are
-* ignored for this calculation. Pass in non-null, geodetic bounding box for function
-* to fill out. RTGEOM must have been built from a GSERIALIZED to provide
-* double aligned point arrays.
-*/
-extern int rtgeom_calculate_gbox_geodetic(const RTCTX *ctx, const RTGEOM *geom, RTGBOX *gbox);
-
-/**
-* Calculate the 2-4D bounding box of a geometry. Z/M coordinates are honored
-* for this calculation, though for curves they are not included in calculations
-* of curvature.
-*/
-extern int rtgeom_calculate_gbox_cartesian(const RTCTX *ctx, const RTGEOM *rtgeom, RTGBOX *gbox);
-
-/**
-* Calculate bounding box of a geometry, automatically taking into account
-* whether it is cartesian or geodetic.
-*/
-extern int rtgeom_calculate_gbox(const RTCTX *ctx, const RTGEOM *rtgeom, RTGBOX *gbox);
-
-/**
-* New function to read doubles directly from the double* coordinate array
-* of an aligned rtgeom #RTPOINTARRAY (built by de-serializing a #GSERIALIZED).
-*/
-extern int rt_getPoint2d_p_ro(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT2D **point);
-
-/**
-* Calculate geodetic (x/y/z) box and add values to gbox. Return #RT_SUCCESS on success.
-*/
-extern int ptarray_calculate_gbox_geodetic(const RTCTX *ctx, const RTPOINTARRAY *pa, RTGBOX *gbox);
-
-/**
-* Calculate box (x/y) and add values to gbox. Return #RT_SUCCESS on success.
-*/
-extern int ptarray_calculate_gbox_cartesian(const RTCTX *ctx, const RTPOINTARRAY *pa, RTGBOX *gbox );
-
-/**
-* Calculate a spherical point that falls outside the geocentric gbox
-*/
-void gbox_pt_outside(const RTCTX *ctx, const RTGBOX *gbox, RTPOINT2D *pt_outside);
-
-/**
-* Create a new gbox with the dimensionality indicated by the flags. Caller
-* is responsible for freeing.
-*/
-extern RTGBOX* gbox_new(const RTCTX *ctx, uint8_t flags);
-
-/**
-* Zero out all the entries in the #RTGBOX. Useful for cleaning
-* statically allocated gboxes.
-*/
-extern void gbox_init(const RTCTX *ctx, RTGBOX *gbox);
-
-/**
-* Update the merged #RTGBOX to be large enough to include itself and the new box.
-*/
-extern int gbox_merge(const RTCTX *ctx, const RTGBOX *new_box, RTGBOX *merged_box);
-
-/**
-* Update the output #RTGBOX to be large enough to include both inputs.
-*/
-extern int gbox_union(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2, RTGBOX *gout);
-
-/**
-* Move the box minimums down and the maximums up by the distance provided.
-*/
-extern void gbox_expand(const RTCTX *ctx, RTGBOX *g, double d);
-
-/**
-* Initialize a #RTGBOX using the values of the point.
-*/
-extern int gbox_init_point3d(const RTCTX *ctx, const POINT3D *p, RTGBOX *gbox);
-
-/**
-* Update the #RTGBOX to be large enough to include itself and the new point.
-*/
-extern int gbox_merge_point3d(const RTCTX *ctx, const POINT3D *p, RTGBOX *gbox);
-
-/**
-* Return true if the point is inside the gbox
-*/
-extern int gbox_contains_point3d(const RTCTX *ctx, const RTGBOX *gbox, const POINT3D *pt);
-
-/**
-* Allocate a string representation of the #RTGBOX, based on dimensionality of flags.
-*/
-extern char* gbox_to_string(const RTCTX *ctx, const RTGBOX *gbox);
-
-/**
-* Return a copy of the #RTGBOX, based on dimensionality of flags.
-*/
-extern RTGBOX* gbox_copy(const RTCTX *ctx, const RTGBOX *gbox);
-
-/**
-* Warning, do not use this function, it is very particular about inputs.
-*/
-extern RTGBOX* gbox_from_string(const RTCTX *ctx, const char *str);
-
-/**
-* Return #RT_TRUE if the #RTGBOX overlaps, #RT_FALSE otherwise.
-*/
-extern int gbox_overlaps(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
-* Return #RT_TRUE if the #RTGBOX overlaps on the 2d plane, #RT_FALSE otherwise.
-*/
-extern int gbox_overlaps_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
-* Return #RT_TRUE if the first #RTGBOX contains the second on the 2d plane, #RT_FALSE otherwise.
-*/
-extern int  gbox_contains_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
-* Copy the values of original #RTGBOX into duplicate.
-*/
-extern void gbox_duplicate(const RTCTX *ctx, const RTGBOX *original, RTGBOX *duplicate);
-
-/**
-* Return the number of bytes necessary to hold a #RTGBOX of this dimension in
-* serialized form.
-*/
-extern size_t gbox_serialized_size(const RTCTX *ctx, uint8_t flags);
-
-/**
-* Check if 2 given Gbox are the same
-*/
-extern int gbox_same(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
-* Check if 2 given RTGBOX are the same in x and y
-*/
-extern int gbox_same_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
-* Check if two given RTGBOX are the same in x and y, or would round to the same
-* RTGBOX in x and if serialized in GSERIALIZED
-*/
-extern int gbox_same_2d_float(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2);
-
-/**
- * Round given RTGBOX to float boundaries
- *
- * This turns a RTGBOX into the version it would become
- * after a serialize/deserialize round trip.
- */
-extern void gbox_float_round(const RTCTX *ctx, RTGBOX *gbox);
-
-/**
-* Return false if any of the dimensions is NaN or infinite
-*/
-extern int gbox_is_valid(const RTCTX *ctx, const RTGBOX *gbox);
-
-/**
-* Utility function to get type number from string. For example, a string 'POINTZ'
-* would return type of 1 and z of 1 and m of 0. Valid
-*/
-extern int geometry_type_from_string(const RTCTX *ctx, const char *str, uint8_t *type, int *z, int *m);
-
-/**
-* Calculate required memory segment to contain a serialized form of the RTGEOM.
-* Primarily used internally by the serialization code. Exposed to allow the cunit
-* tests to exercise it.
-*/
-extern size_t gserialized_from_rtgeom_size(const RTCTX *ctx, const RTGEOM *geom);
-
-/**
-* Allocate a new #GSERIALIZED from an #RTGEOM. For all non-point types, a bounding
-* box will be calculated and embedded in the serialization. The geodetic flag is used
-* to control the box calculation (cartesian or geocentric). If set, the size pointer
-* will contain the size of the final output, which is useful for setting the PgSQL
-* VARSIZE information.
-*/
-extern GSERIALIZED* gserialized_from_rtgeom(const RTCTX *ctx, RTGEOM *geom, int is_geodetic, size_t *size);
-
-/**
-* Allocate a new #RTGEOM from a #GSERIALIZED. The resulting #RTGEOM will have coordinates
-* that are double aligned and suitable for direct reading using rt_getPoint2d_p_ro
-*/
-extern RTGEOM* rtgeom_from_gserialized(const RTCTX *ctx, const GSERIALIZED *g);
-
-/**
-* Pull a #RTGBOX from the header of a #GSERIALIZED, if one is available. If
-* it is not, calculate it from the geometry. If that doesn't work (null
-* or empty) return RT_FAILURE.
-*/
-extern int gserialized_get_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX *gbox);
-
-
-/**
- * Parser check flags
- *
- *  @see rtgeom_from_wkb
- *  @see rtgeom_from_hexwkb
- */
-#define RT_PARSER_CHECK_MINPOINTS  1
-#define RT_PARSER_CHECK_ODD        2
-#define RT_PARSER_CHECK_CLOSURE    4
-#define RT_PARSER_CHECK_ZCLOSURE   8
-
-#define RT_PARSER_CHECK_NONE   0
-#define RT_PARSER_CHECK_ALL	(RT_PARSER_CHECK_MINPOINTS | RT_PARSER_CHECK_ODD | RT_PARSER_CHECK_CLOSURE)
-
-/**
- * Parser result structure: returns the result of attempting to convert
- * (E)RTWKT/(E)RTWKB to RTGEOM
- */
-typedef struct struct_rtgeom_parser_result
-{
-	const char *wkinput;        /* Copy of pointer to input RTWKT/RTWKB */
-	uint8_t *serialized_rtgeom;   /* Pointer to serialized RTGEOM */
-	int size;                   /* Size of serialized RTGEOM in bytes */
-	RTGEOM *geom;               /* Pointer to RTGEOM struct */
-	const char *message;        /* Error/warning message */
-	int errcode;                /* Error/warning number */
-	int errlocation;            /* Location of error */
-	int parser_check_flags;     /* Bitmask of validity checks run during this parse */
-}
-RTGEOM_PARSER_RESULT;
-
-/*
- * Parser error messages (these must match the message array in rtgparse.c)
- */
-#define PARSER_ERROR_MOREPOINTS     1
-#define PARSER_ERROR_ODDPOINTS      2
-#define PARSER_ERROR_UNCLOSED       3
-#define PARSER_ERROR_MIXDIMS        4
-#define PARSER_ERROR_INVALIDGEOM    5
-#define RTPARSER_ERROR_INVALIDWKBTYPE 6
-#define PARSER_ERROR_INCONTINUOUS   7
-#define PARSER_ERROR_TRIANGLEPOINTS 8
-#define PARSER_ERROR_LESSPOINTS     9
-#define PARSER_ERROR_OTHER          10
-
-
-
-/*
- * Unparser result structure: returns the result of attempting to convert RTGEOM to (E)RTWKT/(E)RTWKB
- */
-typedef struct struct_rtgeom_unparser_result
-{
-	uint8_t *serialized_rtgeom;	/* Copy of pointer to input serialized RTGEOM */
-	char *wkoutput;			/* Pointer to RTWKT or RTWKB output */
-	int size;			/* Size of serialized RTGEOM in bytes */
-	const char *message;		/* Error/warning message */
-	int errlocation;		/* Location of error */
-}
-RTGEOM_UNPARSER_RESULT;
-
-/*
- * Unparser error messages (these must match the message array in rtgunparse.c)
- */
-#define UNPARSER_ERROR_MOREPOINTS 	1
-#define UNPARSER_ERROR_ODDPOINTS	2
-#define UNPARSER_ERROR_UNCLOSED		3
-
-
-/*
-** Variants available for RTWKB and RTWKT output types
-*/
-
-#define RTWKB_ISO 0x01
-#define RTWKB_SFSQL 0x02
-#define RTWKB_EXTENDED 0x04
-#define RTWKB_NDR 0x08
-#define RTWKB_XDR 0x10
-#define RTWKB_HEX 0x20
-#define RTWKB_NO_NPOINTS 0x40 /* Internal use only */
-#define RTWKB_NO_SRID 0x80 /* Internal use only */
-
-#define RTWKT_ISO 0x01
-#define RTWKT_SFSQL 0x02
-#define RTWKT_EXTENDED 0x04
-
-
-/*
-** Variants available for TWKB
-*/
-#define TWKB_BBOX 0x01 /* User wants bboxes */
-#define TWKB_SIZE 0x02 /* User wants sizes */
-#define TWKB_ID 0x04 /* User wants id */
-#define RTTWKB_NO_TYPE 0x10 /* No type because it is a sub geoemtry */
-#define TWKB_NO_ID 0x20 /* No ID because it is a subgeoemtry */
-#define TWKB_DEFAULT_PRECISION 0 /* Aim for 1m (or ft) rounding by default */
-
-/*
-** New parsing and unparsing functions.
-*/
-
-/**
-* @param rtgeom geometry to convert to RTWKT
-* @param variant output format to use (RTWKT_ISO, RTWKT_SFSQL, RTWKT_EXTENDED)
-*/
-extern char*   rtgeom_to_wkt(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, int precision, size_t *size_out);
-
-/**
-* @param rtgeom geometry to convert to RTWKT
-* @param variant output format to use
-*                (RTWKB_ISO, RTWKB_SFSQL, RTWKB_EXTENDED, RTWKB_NDR, RTWKB_XDR)
-*/
-extern uint8_t*  rtgeom_to_wkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, size_t *size_out);
-
-/**
-* @param rtgeom geometry to convert to HEXWKB
-* @param variant output format to use
-*                (RTWKB_ISO, RTWKB_SFSQL, RTWKB_EXTENDED, RTWKB_NDR, RTWKB_XDR)
-*/
-extern char*   rtgeom_to_hexwkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, size_t *size_out);
-
-/**
-* @param rtgeom geometry to convert to EWKT
-*/
-extern char *rtgeom_to_ewkt(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-/**
- * @param check parser check flags, see RT_PARSER_CHECK_* macros
- * @param size length of RTWKB byte buffer
- * @param wkb RTWKB byte buffer
- */
-extern RTGEOM* rtgeom_from_wkb(const RTCTX *ctx, const uint8_t *wkb, const size_t wkb_size, const char check);
-
-/**
- * @param check parser check flags, see RT_PARSER_CHECK_* macros
- */
-extern RTGEOM* rtgeom_from_hexwkb(const RTCTX *ctx, const char *hexwkb, const char check);
-
-extern uint8_t*  bytes_from_hexbytes(const RTCTX *ctx, const char *hexbuf, size_t hexsize);
-
-extern char*   hexbytes_from_bytes(const RTCTX *ctx, uint8_t *bytes, size_t size);
-
-
-/* Memory management */
-extern void *rtalloc(const RTCTX *ctx, size_t size);
-extern void *rtrealloc(const RTCTX *ctx, void *mem, size_t size);
-extern void rtfree(const RTCTX *ctx, void *mem);
-
-/* Utilities */
-extern char *rtmessage_truncate(const RTCTX *ctx, char *str, int startpos, int endpos, int maxlength, int truncdirection);
-
-/*
-* TWKB functions
-*/
-
-/**
- * @param check parser check flags, see RT_PARSER_CHECK_* macros
- * @param size parser check flags, see RT_PARSER_CHECK_* macros
- */
-extern RTGEOM* rtgeom_from_twkb(const RTCTX *ctx, uint8_t *twkb, size_t twkb_size, char check);
-
-/**
- * @param geom input geometry
- * @param variant what variations on TWKB are requested?
- * @param twkb_size returns the length of the output TWKB in bytes if set
- */
-extern uint8_t* rtgeom_to_twkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m, size_t *twkb_size);
-
-extern uint8_t* rtgeom_to_twkb_with_idlist(const RTCTX *ctx, const RTGEOM *geom, int64_t *idlist, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m, size_t *twkb_size);
-
-/*******************************************************************************
- * SQLMM internal functions - TODO: Move into separate header files
- ******************************************************************************/
-
-int rtgeom_has_arc(const RTCTX *ctx, const RTGEOM *geom);
-RTGEOM *rtgeom_stroke(const RTCTX *ctx, const RTGEOM *geom, uint32_t perQuad);
-RTGEOM *rtgeom_unstroke(const RTCTX *ctx, const RTGEOM *geom);
-
-/*******************************************************************************
- * GEOS proxy functions on RTGEOM
- ******************************************************************************/
-
-/** Return GEOS version string (not to be freed) */
-const char* rtgeom_geos_version(void);
-
-/** Convert an RTGEOM to a GEOS Geometry and convert back -- for debug only */
-RTGEOM* rtgeom_geos_noop(const RTCTX *ctx, const RTGEOM *geom) ;
-
-RTGEOM *rtgeom_normalize(const RTCTX *ctx, const RTGEOM *geom);
-RTGEOM *rtgeom_intersection(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2);
-RTGEOM *rtgeom_difference(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2);
-RTGEOM *rtgeom_symdifference(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2);
-RTGEOM *rtgeom_union(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2);
-RTGEOM *rtgeom_linemerge(const RTCTX *ctx, const RTGEOM *geom1);
-RTGEOM *rtgeom_unaryunion(const RTCTX *ctx, const RTGEOM *geom1);
-RTGEOM *rtgeom_clip_by_rect(const RTCTX *ctx, const RTGEOM *geom1, double x0, double y0, double x1, double y1);
-RTCOLLECTION *rtgeom_subdivide(const RTCTX *ctx, const RTGEOM *geom, int maxvertices);
-
-/**
- * Snap vertices and segments of a geometry to another using a given tolerance.
- *
- * @param geom1 the geometry to snap
- * @param geom2 the geometry to snap to
- * @param tolerance the distance under which vertices and segments are snapped
- *
- * Requires GEOS-3.3.0+
- */
-RTGEOM* rtgeom_snap(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2, double tolerance);
-
-/*
- * Return the set of paths shared between two linear geometries,
- * and their direction (same or opposite).
- *
- * @param geom1 a lineal geometry
- * @param geom2 another lineal geometry
- *
- * Requires GEOS-3.3.0+
- */
-RTGEOM* rtgeom_sharedpaths(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2);
-
-/*
- * An offset curve against the input line.
- *
- * @param rtline a lineal geometry
- * @param size offset distance. Offset left if negative and right if positive
- * @param quadsegs number of quadrature segments in curves (try 8)
- * @param joinStyle (1 = round, 2 = mitre, 3 = bevel)
- * @param mitreLimit (try 5.0)
- * @return derived geometry (linestring or multilinestring)
- *
- * Requires GEOS-3.2.0+
- */
-RTGEOM* rtgeom_offsetcurve(const RTCTX *ctx, const RTLINE *rtline, double size, int quadsegs, int joinStyle, double mitreLimit);
-
-/*
- * Return true if the input geometry is "simple" as per OGC defn.
- *
- * @return 1 if simple, 0 if non-simple, -1 on exception (rterror is called
- *         in that case)
- */
-int rtgeom_is_simple(const RTCTX *ctx, const RTGEOM *rtgeom);
-
-
-/*******************************************************************************
- * GEOS-dependent extra functions on RTGEOM
- ******************************************************************************/
-
-/**
- * Take a geometry and return an areal geometry
- * (Polygon or MultiPolygon).
- * Actually a wrapper around GEOSpolygonize,
- * transforming the resulting collection into
- * a valid polygon Geometry.
- */
-RTGEOM* rtgeom_buildarea(const RTCTX *ctx, const RTGEOM *geom) ;
-
-
-/**
- * Attempts to make an invalid geometries valid w/out losing points.
- *
- * NOTE: this is only available when librtgeom is built against
- *       GEOS 3.3.0 or higher
- */
-RTGEOM* rtgeom_make_valid(const RTCTX *ctx, RTGEOM* geom);
-
-/*
- * Split (multi)polygon by line; (multi)line by (multi)line,
- * (multi)point or (multi)polygon boundary.
- *
- * Collections are accepted as first argument.
- * Returns all obtained pieces as a collection.
- */
-RTGEOM* rtgeom_split(const RTCTX *ctx, const RTGEOM* rtgeom_in, const RTGEOM* blade_in);
-
-/*
- * Fully node a set of linestrings, using the least nodes preserving
- * all the input ones.
- *
- * Requires GEOS-3.3.0 or higher
- */
-RTGEOM* rtgeom_node(const RTCTX *ctx, const RTGEOM* rtgeom_in);
-
-/**
- * Take vertices of a geometry and build a delaunay
- * triangulation on them.
- *
- * @param geom the input geometry
- * @param tolerance an optional snapping tolerance for improved tolerance
- * @param edgeOnly if non-zero the result will be a MULTILINESTRING,
- *                 otherwise it'll be a COLLECTION of polygons.
- */
-RTGEOM* rtgeom_delaunay_triangulation(const RTCTX *ctx, const RTGEOM *geom, double tolerance, int edgeOnly);
-
-#endif /* !defined _LIBRTGEOM_H  */
-
diff --git a/headers/librttopo_geom.h.in b/headers/librttopo_geom.h.in
index feba550..bf22b0d 100644
--- a/headers/librttopo_geom.h.in
+++ b/headers/librttopo_geom.h.in
@@ -40,17 +40,13 @@
 /**
 * @file librttopo_geom.h
 *
-* This library is the generic geometry handling section of PostGIS. The geometry
-* objects, constructors, destructors, and a set of spatial processing functions,
-* are implemented here.
+* This library is the generic geometry handling section of librttopo.
+* The geometry objects, constructors, destructors, and a set of spatial
+* processing functions, are implemented here.
 *
-* The library is designed for use in non-PostGIS applications if necessary. The
-* units tests at cunit/cu_tester.c and the loader/dumper programs at
-* ../loader/shp2pgsql.c are examples of non-PostGIS applications using librtgeom.
-*
-* Programs using this library can install their custom memory managers and error
-* handlers by calling the rtgeom_set_handlers(const RTCTX *ctx) function, otherwise the default
-* ones will be used.
+* Programs using this library can install their custom memory managers
+* passing them to the rtgeom_init function, and their custom message
+* handlers using the appropriate rtgeom_set_*_logger functions.
 */
 
 /**
@@ -65,13 +61,13 @@
 /**
 * RTRTTYPE numbers
 */
-#define	RTPOINTTYPE                1
-#define	RTLINETYPE                 2
-#define	RTPOLYGONTYPE              3
-#define	RTMULTIPOINTTYPE           4
-#define	RTMULTILINETYPE            5
-#define	RTMULTIPOLYGONTYPE         6
-#define	RTCOLLECTIONTYPE           7
+#define  RTPOINTTYPE                1
+#define  RTLINETYPE                 2
+#define  RTPOLYGONTYPE              3
+#define  RTMULTIPOINTTYPE           4
+#define  RTMULTILINETYPE            5
+#define  RTMULTIPOLYGONTYPE         6
+#define  RTCOLLECTIONTYPE           7
 #define RTCIRCSTRINGTYPE           8
 #define RTCOMPOUNDTYPE             9
 #define RTCURVEPOLYTYPE           10
@@ -270,16 +266,16 @@ extern rtinterrupt_callback *rtgeom_register_interrupt_callback(const RTCTX *ctx
 /******************************************************************/
 
 typedef struct {
-	double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
+  double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
 } RTAFFINE;
 
 /******************************************************************/
 
 typedef struct
 {
-	double xmin, ymin, zmin;
-	double xmax, ymax, zmax;
-	int32_t srid;
+  double xmin, ymin, zmin;
+  double xmax, ymax, zmax;
+  int32_t srid;
 }
 BOX3D;
 
@@ -291,15 +287,15 @@ BOX3D;
 */
 typedef struct
 {
-	uint8_t flags;
-	double xmin;
-	double xmax;
-	double ymin;
-	double ymax;
-	double zmin;
-	double zmax;
-	double mmin;
-	double mmax;
+  uint8_t flags;
+  double xmin;
+  double xmax;
+  double ymin;
+  double ymax;
+  double zmin;
+  double zmax;
+  double mmin;
+  double mmax;
 } RTGBOX;
 
 
@@ -313,13 +309,13 @@ typedef struct
 */
 typedef struct
 {
-	double	a;	/* semimajor axis */
-	double	b; 	/* semiminor axis b = (a - fa) */
-	double	f;	/* flattening f = (a-b)/a */
-	double	e;	/* eccentricity (first) */
-	double	e_sq;	/* eccentricity squared (first) e_sq = (a*a-b*b)/(a*a) */
-	double  radius;  /* spherical average radius = (2*a+b)/3 */
-	char	name[20];  /* name of ellipse */
+  double  a;  /* semimajor axis */
+  double  b;   /* semiminor axis b = (a - fa) */
+  double  f;  /* flattening f = (a-b)/a */
+  double  e;  /* eccentricity (first) */
+  double  e_sq;  /* eccentricity squared (first) e_sq = (a*a-b*b)/(a*a) */
+  double  radius;  /* spherical average radius = (2*a+b)/3 */
+  char  name[20];  /* name of ellipse */
 }
 SPHEROID;
 
@@ -328,31 +324,31 @@ SPHEROID;
 */
 typedef struct
 {
-	double x, y;
+  double x, y;
 }
 RTPOINT2D;
 
 typedef struct
 {
-	double x, y, z;
+  double x, y, z;
 }
 RTPOINT3DZ;
 
 typedef struct
 {
-	double x, y, z;
+  double x, y, z;
 }
 POINT3D;
 
 typedef struct
 {
-	double x, y, m;
+  double x, y, m;
 }
 RTPOINT3DM;
 
 typedef struct
 {
-	double x, y, z, m;
+  double x, y, z, m;
 }
 RTPOINT4D;
 
@@ -365,14 +361,14 @@ RTPOINT4D;
 */
 typedef struct
 {
-	/* Array of POINT 2D, 3D or 4D, possibly missaligned. */
-	uint8_t *serialized_pointlist;
+  /* Array of POINT 2D, 3D or 4D, possibly missaligned. */
+  uint8_t *serialized_pointlist;
 
-	/* Use RTFLAGS_* macros to handle */
-	uint8_t  flags;
+  /* Use RTFLAGS_* macros to handle */
+  uint8_t  flags;
 
-	int npoints;   /* how many points we are currently storing */
-	int maxpoints; /* how many points we have space for in serialized_pointlist */
+  int npoints;   /* how many points we are currently storing */
+  int maxpoints; /* how many points we have space for in serialized_pointlist */
 }
 RTPOINTARRAY;
 
@@ -381,10 +377,10 @@ RTPOINTARRAY;
 */
 typedef struct
 {
-	uint32_t size; /* For PgSQL use only, use VAR* macros to manipulate. */
-	uint8_t srid[3]; /* 24 bits of SRID */
-	uint8_t flags; /* HasZ, HasM, HasBBox, IsGeodetic, IsReadOnly */
-	uint8_t data[1]; /* See gserialized.txt */
+  uint32_t size; /* For PgSQL use only, use VAR* macros to manipulate. */
+  uint8_t srid[3]; /* 24 bits of SRID */
+  uint8_t flags; /* HasZ, HasM, HasBBox, IsGeodetic, IsReadOnly */
+  uint8_t data[1]; /* See gserialized.txt */
 } GSERIALIZED;
 
 
@@ -396,198 +392,198 @@ typedef struct
 */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	void *data;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  void *data;
 }
 RTGEOM;
 
 /* RTPOINTYPE */
 typedef struct
 {
-	uint8_t type; /* RTPOINTTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *point;  /* hide 2d/3d (this will be an array of 1 point) */
+  uint8_t type; /* RTPOINTTYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  RTPOINTARRAY *point;  /* hide 2d/3d (this will be an array of 1 point) */
 }
 RTPOINT; /* "light-weight point" */
 
 /* RTLINETYPE */
 typedef struct
 {
-	uint8_t type; /* RTLINETYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points; /* array of POINT3D */
+  uint8_t type; /* RTLINETYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  RTPOINTARRAY *points; /* array of POINT3D */
 }
 RTLINE; /* "light-weight line" */
 
 /* TRIANGLE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  RTPOINTARRAY *points;
 }
 RTTRIANGLE;
 
 /* RTCIRCSTRINGTYPE */
 typedef struct
 {
-	uint8_t type; /* RTCIRCSTRINGTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	RTPOINTARRAY *points; /* array of POINT(3D/3DM) */
+  uint8_t type; /* RTCIRCSTRINGTYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  RTPOINTARRAY *points; /* array of POINT(3D/3DM) */
 }
 RTCIRCSTRING; /* "light-weight circularstring" */
 
 /* RTPOLYGONTYPE */
 typedef struct
 {
-	uint8_t type; /* RTPOLYGONTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int nrings;   /* how many rings we are currently storing */
-	int maxrings; /* how many rings we have space for in **rings */
-	RTPOINTARRAY **rings; /* list of rings (list of points) */
+  uint8_t type; /* RTPOLYGONTYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int nrings;   /* how many rings we are currently storing */
+  int maxrings; /* how many rings we have space for in **rings */
+  RTPOINTARRAY **rings; /* list of rings (list of points) */
 }
 RTPOLY; /* "light-weight polygon" */
 
 /* RTMULTIPOINTTYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOINT **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTPOINT **geoms;
 }
 RTMPOINT;
 
 /* RTMULTILINETYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTLINE **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTLINE **geoms;
 }
 RTMLINE;
 
 /* RTMULTIPOLYGONTYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOLY **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTPOLY **geoms;
 }
 RTMPOLY;
 
 /* RTCOLLECTIONTYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTGEOM **geoms;
 }
 RTCOLLECTION;
 
 /* RTCOMPOUNDTYPE */
 typedef struct
 {
-	uint8_t type; /* RTCOMPOUNDTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
+  uint8_t type; /* RTCOMPOUNDTYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTGEOM **geoms;
 }
 RTCOMPOUND; /* "light-weight compound line" */
 
 /* RTCURVEPOLYTYPE */
 typedef struct
 {
-	uint8_t type; /* RTCURVEPOLYTYPE */
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int nrings;    /* how many rings we are currently storing */
-	int maxrings;  /* how many rings we have space for in **rings */
-	RTGEOM **rings; /* list of rings (list of points) */
+  uint8_t type; /* RTCURVEPOLYTYPE */
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int nrings;    /* how many rings we are currently storing */
+  int maxrings;  /* how many rings we have space for in **rings */
+  RTGEOM **rings; /* list of rings (list of points) */
 }
 RTCURVEPOLY; /* "light-weight polygon" */
 
 /* MULTICURVE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTGEOM **geoms;
 }
 RTMCURVE;
 
 /* RTMULTISURFACETYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTGEOM **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTGEOM **geoms;
 }
 RTMSURFACE;
 
 /* RTPOLYHEDRALSURFACETYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTPOLY **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTPOLY **geoms;
 }
 RTPSURFACE;
 
 /* RTTINTYPE */
 typedef struct
 {
-	uint8_t type;
-	uint8_t flags;
-	RTGBOX *bbox;
-	int32_t srid;
-	int ngeoms;   /* how many geometries we are currently storing */
-	int maxgeoms; /* how many geometries we have space for in **geoms */
-	RTTRIANGLE **geoms;
+  uint8_t type;
+  uint8_t flags;
+  RTGBOX *bbox;
+  int32_t srid;
+  int ngeoms;   /* how many geometries we are currently storing */
+  int maxgeoms; /* how many geometries we have space for in **geoms */
+  RTTRIANGLE **geoms;
 }
 RTTIN;
 
@@ -933,7 +929,7 @@ extern RTPOINTARRAY *ptarray_addPoint(const RTCTX *ctx, const RTPOINTARRAY *pa,
 
 /**
  * @brief Remove a point from a pointarray.
- * 	@param which -  is the offset (starting at 0)
+ *   @param which -  is the offset (starting at 0)
  * @return #RTPOINTARRAY is newly allocated
  */
 extern RTPOINTARRAY *ptarray_removePoint(const RTCTX *ctx, RTPOINTARRAY *pa, uint32_t where);
@@ -1918,7 +1914,7 @@ extern int gserialized_get_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX
 #define RT_PARSER_CHECK_ZCLOSURE   8
 
 #define RT_PARSER_CHECK_NONE   0
-#define RT_PARSER_CHECK_ALL	(RT_PARSER_CHECK_MINPOINTS | RT_PARSER_CHECK_ODD | RT_PARSER_CHECK_CLOSURE)
+#define RT_PARSER_CHECK_ALL  (RT_PARSER_CHECK_MINPOINTS | RT_PARSER_CHECK_ODD | RT_PARSER_CHECK_CLOSURE)
 
 /**
  * Parser result structure: returns the result of attempting to convert
@@ -1926,14 +1922,14 @@ extern int gserialized_get_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX
  */
 typedef struct struct_rtgeom_parser_result
 {
-	const char *wkinput;        /* Copy of pointer to input RTWKT/RTWKB */
-	uint8_t *serialized_rtgeom;   /* Pointer to serialized RTGEOM */
-	int size;                   /* Size of serialized RTGEOM in bytes */
-	RTGEOM *geom;               /* Pointer to RTGEOM struct */
-	const char *message;        /* Error/warning message */
-	int errcode;                /* Error/warning number */
-	int errlocation;            /* Location of error */
-	int parser_check_flags;     /* Bitmask of validity checks run during this parse */
+  const char *wkinput;        /* Copy of pointer to input RTWKT/RTWKB */
+  uint8_t *serialized_rtgeom;   /* Pointer to serialized RTGEOM */
+  int size;                   /* Size of serialized RTGEOM in bytes */
+  RTGEOM *geom;               /* Pointer to RTGEOM struct */
+  const char *message;        /* Error/warning message */
+  int errcode;                /* Error/warning number */
+  int errlocation;            /* Location of error */
+  int parser_check_flags;     /* Bitmask of validity checks run during this parse */
 }
 RTGEOM_PARSER_RESULT;
 
@@ -1958,20 +1954,20 @@ RTGEOM_PARSER_RESULT;
  */
 typedef struct struct_rtgeom_unparser_result
 {
-	uint8_t *serialized_rtgeom;	/* Copy of pointer to input serialized RTGEOM */
-	char *wkoutput;			/* Pointer to RTWKT or RTWKB output */
-	int size;			/* Size of serialized RTGEOM in bytes */
-	const char *message;		/* Error/warning message */
-	int errlocation;		/* Location of error */
+  uint8_t *serialized_rtgeom;  /* Copy of pointer to input serialized RTGEOM */
+  char *wkoutput;      /* Pointer to RTWKT or RTWKB output */
+  int size;      /* Size of serialized RTGEOM in bytes */
+  const char *message;    /* Error/warning message */
+  int errlocation;    /* Location of error */
 }
 RTGEOM_UNPARSER_RESULT;
 
 /*
  * Unparser error messages (these must match the message array in rtgunparse.c)
  */
-#define UNPARSER_ERROR_MOREPOINTS 	1
-#define UNPARSER_ERROR_ODDPOINTS	2
-#define UNPARSER_ERROR_UNCLOSED		3
+#define UNPARSER_ERROR_MOREPOINTS   1
+#define UNPARSER_ERROR_ODDPOINTS  2
+#define UNPARSER_ERROR_UNCLOSED    3
 
 
 /*
diff --git a/install-sh b/install-sh
deleted file mode 100755
index 377bb86..0000000
--- a/install-sh
+++ /dev/null
@@ -1,527 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2011-11-20.07; # UTC
-
-# 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.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-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:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -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.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
-
-    -d) dir_arg=true;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-	shift;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
-
-    -o) chowncmd="$chownprog $2"
-	shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t) dst_arg=$2
-	# Protect names problematic for 'test' and other utilities.
-	case $dst_arg in
-	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
-	esac
-	shift;;
-
-    -T) no_target_directory=true;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --)	shift
-	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
-  esac
-  shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; 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 "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-    # Protect names problematic for 'test' and other utilities.
-    case $dst_arg in
-      -* | [=\(\)!]) dst_arg=./$dst_arg;;
-    esac
-  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
-  do_exit='(exit $ret); exit $ret'
-  trap "ret=129; $do_exit" 1
-  trap "ret=130; $do_exit" 2
-  trap "ret=141; $do_exit" 13
-  trap "ret=143; $do_exit" 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 problematic for 'test' and other utilities.
-  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 "$dst_arg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-    dst=$dst_arg
-
-    # 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: $dst_arg: 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-writable 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
-
-      eval "$initialize_posix_glob"
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob set -f
-      set fnord $dstdir
-      shift
-      $posix_glob set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test X"$d" = X && 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"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # 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.
-	{
-	  test ! -f "$dst" ||
-	  $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
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || 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-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index a356aca..0000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,9661 +0,0 @@
-
-# libtool (GNU libtool) 2.4.2
-# Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 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.
-
-# GNU Libtool 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.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-#       --config             show all configuration variables
-#       --debug              enable verbose shell tracing
-#   -n, --dry-run            display commands without modifying any files
-#       --features           display basic configuration information and exit
-#       --mode=MODE          use operation mode MODE
-#       --preserve-dup-deps  don't remove duplicate dependency libraries
-#       --quiet, --silent    don't print informational messages
-#       --no-quiet, --no-silent
-#                            print informational messages (default)
-#       --no-warn            don't display warning messages
-#       --tag=TAG            use configuration variables from tag TAG
-#   -v, --verbose            print more informational messages than default
-#       --no-verbose         don't print the extra informational messages
-#       --version            print version information
-#   -h, --help, --help-all   print short, long, or detailed help message
-#
-# MODE must be one of the following:
-#
-#         clean              remove files from the build directory
-#         compile            compile a source file into a libtool object
-#         execute            automatically set library path, then run a program
-#         finish             complete the installation of libtool libraries
-#         install            install libraries or executables
-#         link               create a library or an executable
-#         uninstall          remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.  When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-#         host-triplet:	$host
-#         shell:		$SHELL
-#         compiler:		$LTCC
-#         compiler flags:		$LTCFLAGS
-#         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
-#         automake:	$automake_version
-#         autoconf:	$autoconf_version
-#
-# Report bugs to <bug-libtool at gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
-
-PROGRAM=libtool
-PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
-TIMESTAMP=""
-package_revision=1.3337
-
-# Be Bourne compatible
-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
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
-
-# NLS nuisances: We save the old values to restore during execute mode.
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
-  eval "if test \"\${$lt_var+set}\" = set; then
-          save_$lt_var=\$$lt_var
-          $lt_var=C
-	  export $lt_var
-	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
-	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
-	fi"
-done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
-
-$lt_unset CDPATH
-
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-
-
-: ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${MAKE="make"}
-: ${MKDIR="mkdir"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" 	$lt_nl"
-
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-} # func_dirname may be replaced by extended shell implementation
-
-
-# func_basename file
-func_basename ()
-{
-    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
-
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-    # Extract subdirectory from the argument.
-    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-    case ${2} in
-      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-    esac
-} # func_stripname may be replaced by extended shell implementation
-
-
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
-		s@/\./@/@g
-		t dotsl
-		s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
-
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-#             value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
-  # Start from root dir and reassemble the path.
-  func_normal_abspath_result=
-  func_normal_abspath_tpath=$1
-  func_normal_abspath_altnamespace=
-  case $func_normal_abspath_tpath in
-    "")
-      # Empty path, that just means $cwd.
-      func_stripname '' '/' "`pwd`"
-      func_normal_abspath_result=$func_stripname_result
-      return
-    ;;
-    # The next three entries are used to spot a run of precisely
-    # two leading slashes without using negated character classes;
-    # we take advantage of case's first-match behaviour.
-    ///*)
-      # Unusual form of absolute path, do nothing.
-    ;;
-    //*)
-      # Not necessarily an ordinary path; POSIX reserves leading '//'
-      # and for example Cygwin uses it to access remote file shares
-      # over CIFS/SMB, so we conserve a leading double slash if found.
-      func_normal_abspath_altnamespace=/
-    ;;
-    /*)
-      # Absolute path, do nothing.
-    ;;
-    *)
-      # Relative path, prepend $cwd.
-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
-    ;;
-  esac
-  # Cancel out all the simple stuff to save iterations.  We also want
-  # the path to end with a slash for ease of parsing, so make sure
-  # there is one (and only one) here.
-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
-  while :; do
-    # Processed it all yet?
-    if test "$func_normal_abspath_tpath" = / ; then
-      # If we ascended to the root using ".." the result may be empty now.
-      if test -z "$func_normal_abspath_result" ; then
-        func_normal_abspath_result=/
-      fi
-      break
-    fi
-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcar"`
-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcdr"`
-    # Figure out what to do with it
-    case $func_normal_abspath_tcomponent in
-      "")
-        # Trailing empty path component, ignore it.
-      ;;
-      ..)
-        # Parent dir; strip last assembled component from result.
-        func_dirname "$func_normal_abspath_result"
-        func_normal_abspath_result=$func_dirname_result
-      ;;
-      *)
-        # Actual path component, append it.
-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
-      ;;
-    esac
-  done
-  # Restore leading double-slash if one was found on entry.
-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
-}
-
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-#             value returned in "$func_relative_path_result"
-func_relative_path ()
-{
-  func_relative_path_result=
-  func_normal_abspath "$1"
-  func_relative_path_tlibdir=$func_normal_abspath_result
-  func_normal_abspath "$2"
-  func_relative_path_tbindir=$func_normal_abspath_result
-
-  # Ascend the tree starting from libdir
-  while :; do
-    # check if we have found a prefix of bindir
-    case $func_relative_path_tbindir in
-      $func_relative_path_tlibdir)
-        # found an exact match
-        func_relative_path_tcancelled=
-        break
-        ;;
-      $func_relative_path_tlibdir*)
-        # found a matching prefix
-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
-        func_relative_path_tcancelled=$func_stripname_result
-        if test -z "$func_relative_path_result"; then
-          func_relative_path_result=.
-        fi
-        break
-        ;;
-      *)
-        func_dirname $func_relative_path_tlibdir
-        func_relative_path_tlibdir=${func_dirname_result}
-        if test "x$func_relative_path_tlibdir" = x ; then
-          # Have to descend all the way to the root!
-          func_relative_path_result=../$func_relative_path_result
-          func_relative_path_tcancelled=$func_relative_path_tbindir
-          break
-        fi
-        func_relative_path_result=../$func_relative_path_result
-        ;;
-    esac
-  done
-
-  # Now calculate path; take care to avoid doubling-up slashes.
-  func_stripname '' '/' "$func_relative_path_result"
-  func_relative_path_result=$func_stripname_result
-  func_stripname '/' '/' "$func_relative_path_tcancelled"
-  if test "x$func_stripname_result" != x ; then
-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
-  fi
-
-  # Normalisation. If bindir is libdir, return empty string,
-  # else relative path ending with a slash; either way, target
-  # file name can be directly appended.
-  if test ! -z "$func_relative_path_result"; then
-    func_stripname './' '' "$func_relative_path_result/"
-    func_relative_path_result=$func_stripname_result
-  fi
-}
-
-# The name of this program:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-
-# Make sure we have an absolute path for reexecution:
-case $progpath in
-  [\\/]*|[A-Za-z]:\\*) ;;
-  *[\\/]*)
-     progdir=$func_dirname_result
-     progdir=`cd "$progdir" && pwd`
-     progpath="$progdir/$progname"
-     ;;
-  *)
-     save_IFS="$IFS"
-     IFS=${PATH_SEPARATOR-:}
-     for progdir in $PATH; do
-       IFS="$save_IFS"
-       test -x "$progdir/$progname" && break
-     done
-     IFS="$save_IFS"
-     test -n "$progdir" || progdir=`pwd`
-     progpath="$progdir/$progname"
-     ;;
-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 that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
-
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes.  A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
-  s/$bs4/&\\
-/g
-  s/^$bs2$dollar/$bs&/
-  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
-  s/\n//g"
-
-# Standard options:
-opt_dry_run=false
-opt_help=false
-opt_quiet=false
-opt_verbose=false
-opt_warning=:
-
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
-}
-
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
-    $opt_verbose && func_echo ${1+"$@"}
-
-    # A bug in bash halts the script if the last line of a function
-    # fails when set -e is in force, so we need another command to
-    # work around that:
-    :
-}
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*"
-}
-
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
-    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
-
-    # bash bug again:
-    :
-}
-
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
-{
-    func_error ${1+"$@"}
-    exit $EXIT_FAILURE
-}
-
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
-    func_error ${1+"$@"}
-    func_fatal_error "$help"
-}
-help="Try \`$progname --help' for more information."  ## default
-
-
-# func_grep expression filename
-# Check whether EXPRESSION matches any line of FILENAME, without output.
-func_grep ()
-{
-    $GREP "$1" "$2" >/dev/null 2>&1
-}
-
-
-# func_mkdir_p directory-path
-# Make sure the entire path to DIRECTORY-PATH is available.
-func_mkdir_p ()
-{
-    my_directory_path="$1"
-    my_dir_list=
-
-    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
-
-      # Protect directory names starting with `-'
-      case $my_directory_path in
-        -*) my_directory_path="./$my_directory_path" ;;
-      esac
-
-      # While some portion of DIR does not yet exist...
-      while test ! -d "$my_directory_path"; do
-        # ...make a list in topmost first order.  Use a colon delimited
-	# list incase some portion of path contains whitespace.
-        my_dir_list="$my_directory_path:$my_dir_list"
-
-        # If the last portion added has no slash in it, the list is done
-        case $my_directory_path in */*) ;; *) break ;; esac
-
-        # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
-      done
-      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
-
-      save_mkdir_p_IFS="$IFS"; IFS=':'
-      for my_dir in $my_dir_list; do
-	IFS="$save_mkdir_p_IFS"
-        # mkdir can fail with a `File exist' error if two processes
-        # try to create one of the directories concurrently.  Don't
-        # stop in that case!
-        $MKDIR "$my_dir" 2>/dev/null || :
-      done
-      IFS="$save_mkdir_p_IFS"
-
-      # Bail out if we (or some other process) failed to create a directory.
-      test -d "$my_directory_path" || \
-        func_fatal_error "Failed to create \`$1'"
-    fi
-}
-
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
-
-    if test "$opt_dry_run" = ":"; then
-      # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
-    else
-
-      # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
-      if test ! -d "$my_tmpdir"; then
-        # Failing that, at least try and use $RANDOM to avoid a race
-        my_tmpdir="${my_template}-${RANDOM-0}$$"
-
-        save_mktempdir_umask=`umask`
-        umask 0077
-        $MKDIR "$my_tmpdir"
-        umask $save_mktempdir_umask
-      fi
-
-      # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || \
-        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
-    fi
-
-    $ECHO "$my_tmpdir"
-}
-
-
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
-{
-    case $1 in
-      *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
-      *)
-        func_quote_for_eval_unquoted_result="$1" ;;
-    esac
-
-    case $func_quote_for_eval_unquoted_result in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting, command substitution and and variable
-      # expansion for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
-        ;;
-      *)
-        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
-    esac
-}
-
-
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
-    case $1 in
-      *[\\\`\"]*)
-	my_arg=`$ECHO "$1" | $SED \
-	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
-      *)
-        my_arg="$1" ;;
-    esac
-
-    case $my_arg in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting and command substitution for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        my_arg="\"$my_arg\""
-        ;;
-    esac
-
-    func_quote_for_expand_result="$my_arg"
-}
-
-
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$my_cmd"
-      my_status=$?
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.  Use the saved locale for evaluation.
-func_show_eval_locale ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$lt_user_locale
-	    $my_cmd"
-      my_status=$?
-      eval "$lt_safe_locale"
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result.  All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
-  case $1 in
-  [0-9]* | *[!a-zA-Z0-9_]*)
-    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
-    ;;
-  * )
-    func_tr_sh_result=$1
-    ;;
-  esac
-}
-
-
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
-    $opt_debug
-
-    $SED -n '/(C)/!b go
-	:more
-	/\./!{
-	  N
-	  s/\n# / /
-	  b more
-	}
-	:go
-	/^# '$PROGRAM' (GNU /,/# warranty; / {
-        s/^# //
-	s/^# *$//
-        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
-        p
-     }' < "$progpath"
-     exit $?
-}
-
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
-{
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/^#  *.*--help/ {
-        s/^# //
-	s/^# *$//
-	s/\$progname/'$progname'/
-	p
-    }' < "$progpath"
-    echo
-    $ECHO "run \`$progname --help | more' for full usage"
-    exit $?
-}
-
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
-func_help ()
-{
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/# Report bugs to/ {
-	:print
-        s/^# //
-	s/^# *$//
-	s*\$progname*'$progname'*
-	s*\$host*'"$host"'*
-	s*\$SHELL*'"$SHELL"'*
-	s*\$LTCC*'"$LTCC"'*
-	s*\$LTCFLAGS*'"$LTCFLAGS"'*
-	s*\$LD*'"$LD"'*
-	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
-	p
-	d
-     }
-     /^# .* home page:/b print
-     /^# General help using/b print
-     ' < "$progpath"
-    ret=$?
-    if test -z "$1"; then
-      exit $ret
-    fi
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
-    $opt_debug
-
-    func_error "missing argument for $1."
-    exit_cmd=exit
-}
-
-
-# func_split_short_opt shortopt
-# Set func_split_short_opt_name and func_split_short_opt_arg shell
-# variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
-{
-    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
-    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
-
-    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
-    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
-
-
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
-{
-    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
-    my_sed_long_arg='1s/^--[^=]*=//'
-
-    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
-    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
-
-exit_cmd=:
-
-
-
-
-
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
-
-# Global variables.
-nonopt=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-    eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
-
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
-    func_quote_for_eval "${2}"
-    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
-
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-    func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
-
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
-
-
-# func_lo2o object
-func_lo2o ()
-{
-    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
-
-
-# func_xform libobj-or-source
-func_xform ()
-{
-    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
-
-
-# func_fatal_configuration arg...
-# Echo program name prefixed message to standard error, followed by
-# a configuration failure hint, and exit.
-func_fatal_configuration ()
-{
-    func_error ${1+"$@"}
-    func_error "See the $PACKAGE documentation for more information."
-    func_fatal_error "Fatal configuration error."
-}
-
-
-# func_config
-# Display the configuration for all the tags in this script.
-func_config ()
-{
-    re_begincf='^# ### BEGIN LIBTOOL'
-    re_endcf='^# ### END LIBTOOL'
-
-    # Default configuration.
-    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
-
-    # Now print the configurations for the tags.
-    for tagname in $taglist; do
-      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
-    done
-
-    exit $?
-}
-
-# func_features
-# Display the features supported by this script.
-func_features ()
-{
-    echo "host: $host"
-    if test "$build_libtool_libs" = yes; then
-      echo "enable shared libraries"
-    else
-      echo "disable shared libraries"
-    fi
-    if test "$build_old_libs" = yes; then
-      echo "enable static libraries"
-    else
-      echo "disable static libraries"
-    fi
-
-    exit $?
-}
-
-# func_enable_tag tagname
-# Verify that TAGNAME is valid, and either flag an error and exit, or
-# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
-# variable here.
-func_enable_tag ()
-{
-  # Global variable:
-  tagname="$1"
-
-  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
-  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
-  sed_extractcf="/$re_begincf/,/$re_endcf/p"
-
-  # Validate tagname.
-  case $tagname in
-    *[!-_A-Za-z0-9,/]*)
-      func_fatal_error "invalid tag name: $tagname"
-      ;;
-  esac
-
-  # Don't test for the "default" C tag, as we know it's
-  # there but not specially marked.
-  case $tagname in
-    CC) ;;
-    *)
-      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
-	taglist="$taglist $tagname"
-
-	# Evaluate the configuration.  Be careful to quote the path
-	# and the sed script, to avoid splitting on whitespace, but
-	# also don't use non-portable quotes within backquotes within
-	# quotes we have to do it in 2 steps:
-	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
-	eval "$extractedcf"
-      else
-	func_error "ignoring unknown tag $tagname"
-      fi
-      ;;
-  esac
-}
-
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
-    fi
-
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
-  shift; set dummy --mode clean ${1+"$@"}; shift
-  ;;
-compile|compil|compi|comp|com|co|c)
-  shift; set dummy --mode compile ${1+"$@"}; shift
-  ;;
-execute|execut|execu|exec|exe|ex|e)
-  shift; set dummy --mode execute ${1+"$@"}; shift
-  ;;
-finish|finis|fini|fin|fi|f)
-  shift; set dummy --mode finish ${1+"$@"}; shift
-  ;;
-install|instal|insta|inst|ins|in|i)
-  shift; set dummy --mode install ${1+"$@"}; shift
-  ;;
-link|lin|li|l)
-  shift; set dummy --mode link ${1+"$@"}; shift
-  ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-  shift; set dummy --mode uninstall ${1+"$@"}; shift
-  ;;
-esac
-
-
-
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
-
-
-# Parse options once, thoroughly.  This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
-  # this just eases exit handling
-  while test $# -gt 0; do
-    opt="$1"
-    shift
-    case $opt in
-      --debug|-x)	opt_debug='set -x'
-			func_echo "enabling shell trace mode"
-			$opt_debug
-			;;
-      --dry-run|--dryrun|-n)
-			opt_dry_run=:
-			;;
-      --config)
-			opt_config=:
-func_config
-			;;
-      --dlopen|-dlopen)
-			optarg="$1"
-			opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
-			shift
-			;;
-      --preserve-dup-deps)
-			opt_preserve_dup_deps=:
-			;;
-      --features)
-			opt_features=:
-func_features
-			;;
-      --finish)
-			opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
-			;;
-      --help)
-			opt_help=:
-			;;
-      --help-all)
-			opt_help_all=:
-opt_help=': help-all'
-			;;
-      --mode)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_mode="$optarg"
-case $optarg in
-  # Valid mode arguments:
-  clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
-  # Catch anything else as an error
-  *) func_error "invalid argument for $opt"
-     exit_cmd=exit
-     break
-     ;;
-esac
-			shift
-			;;
-      --no-silent|--no-quiet)
-			opt_silent=false
-func_append preserve_args " $opt"
-			;;
-      --no-warning|--no-warn)
-			opt_warning=false
-func_append preserve_args " $opt"
-			;;
-      --no-verbose)
-			opt_verbose=false
-func_append preserve_args " $opt"
-			;;
-      --silent|--quiet)
-			opt_silent=:
-func_append preserve_args " $opt"
-        opt_verbose=false
-			;;
-      --verbose|-v)
-			opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
-			;;
-      --tag)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
-			shift
-			;;
-
-      -\?|-h)		func_usage				;;
-      --help)		func_help				;;
-      --version)	func_version				;;
-
-      # Separate optargs to long options:
-      --*=*)
-			func_split_long_opt "$opt"
-			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
-			shift
-			;;
-
-      # Separate non-argument short options:
-      -\?*|-h*|-n*|-v*)
-			func_split_short_opt "$opt"
-			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
-			shift
-			;;
-
-      --)		break					;;
-      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
-      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
-    esac
-  done
-
-  # Validate options:
-
-  # save first non-option argument
-  if test "$#" -gt 0; then
-    nonopt="$opt"
-    shift
-  fi
-
-  # preserve --debug
-  test "$opt_debug" = : || func_append preserve_args " --debug"
-
-  case $host in
-    *cygwin* | *mingw* | *pw32* | *cegcc*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
-      ;;
-  esac
-
-  $opt_help || {
-    # Sanity checks first:
-    func_check_version_match
-
-    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-      func_fatal_configuration "not configured to build any kind of library"
-    fi
-
-    # Darwin sucks
-    eval std_shrext=\"$shrext_cmds\"
-
-    # Only execute mode is allowed to have -dlopen flags.
-    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
-      func_error "unrecognized option \`-dlopen'"
-      $ECHO "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    # Change the help message to a mode-specific one.
-    generic_help="$help"
-    help="Try \`$progname --help --mode=$opt_mode' for more information."
-  }
-
-
-  # Bail if the options were screwed
-  $exit_cmd $EXIT_FAILURE
-}
-
-
-
-
-## ----------- ##
-##    Main.    ##
-## ----------- ##
-
-# func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_lalib_p ()
-{
-    test -f "$1" &&
-      $SED -e 4q "$1" 2>/dev/null \
-        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
-}
-
-# func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function implements the same check as func_lalib_p without
-# resorting to external programs.  To this end, it redirects stdin and
-# closes it afterwards, without saving the original file descriptor.
-# As a safety measure, use it only where a negative result would be
-# fatal anyway.  Works if `file' does not exist.
-func_lalib_unsafe_p ()
-{
-    lalib_p=no
-    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
-	for lalib_p_l in 1 2 3 4
-	do
-	    read lalib_p_line
-	    case "$lalib_p_line" in
-		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
-	    esac
-	done
-	exec 0<&5 5<&-
-    fi
-    test "$lalib_p" = yes
-}
-
-# func_ltwrapper_script_p file
-# True iff FILE is a libtool wrapper script
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_script_p ()
-{
-    func_lalib_p "$1"
-}
-
-# func_ltwrapper_executable_p file
-# True iff FILE is a libtool wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_executable_p ()
-{
-    func_ltwrapper_exec_suffix=
-    case $1 in
-    *.exe) ;;
-    *) func_ltwrapper_exec_suffix=.exe ;;
-    esac
-    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
-}
-
-# func_ltwrapper_scriptname file
-# Assumes file is an ltwrapper_executable
-# uses $file to determine the appropriate filename for a
-# temporary ltwrapper_script.
-func_ltwrapper_scriptname ()
-{
-    func_dirname_and_basename "$1" "" "."
-    func_stripname '' '.exe' "$func_basename_result"
-    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-}
-
-# func_ltwrapper_p file
-# True iff FILE is a libtool wrapper script or wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_p ()
-{
-    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
-}
-
-
-# func_execute_cmds commands fail_cmd
-# Execute tilde-delimited COMMANDS.
-# If FAIL_CMD is given, eval that upon failure.
-# FAIL_CMD may read-access the current command in variable CMD!
-func_execute_cmds ()
-{
-    $opt_debug
-    save_ifs=$IFS; IFS='~'
-    for cmd in $1; do
-      IFS=$save_ifs
-      eval cmd=\"$cmd\"
-      func_show_eval "$cmd" "${2-:}"
-    done
-    IFS=$save_ifs
-}
-
-
-# func_source file
-# Source FILE, adding directory component if necessary.
-# Note that it is not necessary on cygwin/mingw to append a dot to
-# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
-# behavior happens only for exec(3), not for open(2)!  Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
-func_source ()
-{
-    $opt_debug
-    case $1 in
-    */* | *\\*)	. "$1" ;;
-    *)		. "./$1" ;;
-    esac
-}
-
-
-# func_resolve_sysroot PATH
-# Replace a leading = in PATH with a sysroot.  Store the result into
-# func_resolve_sysroot_result
-func_resolve_sysroot ()
-{
-  func_resolve_sysroot_result=$1
-  case $func_resolve_sysroot_result in
-  =*)
-    func_stripname '=' '' "$func_resolve_sysroot_result"
-    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
-    ;;
-  esac
-}
-
-# func_replace_sysroot PATH
-# If PATH begins with the sysroot, replace it with = and
-# store the result into func_replace_sysroot_result.
-func_replace_sysroot ()
-{
-  case "$lt_sysroot:$1" in
-  ?*:"$lt_sysroot"*)
-    func_stripname "$lt_sysroot" '' "$1"
-    func_replace_sysroot_result="=$func_stripname_result"
-    ;;
-  *)
-    # Including no sysroot.
-    func_replace_sysroot_result=$1
-    ;;
-  esac
-}
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
-    $opt_debug
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-	func_append_quoted CC_quoted "$arg"
-      done
-      CC_expanded=`func_echo_all $CC`
-      CC_quoted_expanded=`func_echo_all $CC_quoted`
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
-      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-	for z in $available_tags; do
-	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-	    CC_quoted=
-	    for arg in $CC; do
-	      # Double-quote args containing other shell metacharacters.
-	      func_append_quoted CC_quoted "$arg"
-	    done
-	    CC_expanded=`func_echo_all $CC`
-	    CC_quoted_expanded=`func_echo_all $CC_quoted`
-	    case "$@ " in
-	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
-	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
-	      # The compiler in the base compile command matches
-	      # the one in the tagged configuration.
-	      # Assume this is the tagged configuration we want.
-	      tagname=$z
-	      break
-	      ;;
-	    esac
-	  fi
-	done
-	# If $tagname still isn't set, then no tagged configuration
-	# was found and let the user know that the "--tag" command
-	# line option must be used.
-	if test -z "$tagname"; then
-	  func_echo "unable to infer tagged configuration"
-	  func_fatal_error "specify a tag with \`--tag'"
-#	else
-#	  func_verbose "using $tagname tagged configuration"
-	fi
-	;;
-      esac
-    fi
-}
-
-
-
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
-{
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
-    else
-      write_lobj=none
-    fi
-
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
-    else
-      write_oldobj=none
-    fi
-
-    $opt_dry_run || {
-      cat >${write_libobj}T <<EOF
-# $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object=$write_lobj
-
-# Name of the non-PIC object
-non_pic_object=$write_oldobj
-
-EOF
-      $MV "${write_libobj}T" "${write_libobj}"
-    }
-}
-
-
-##################################################
-# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
-##################################################
-
-# func_convert_core_file_wine_to_w32 ARG
-# Helper function used by file name conversion functions when $build is *nix,
-# and $host is mingw, cygwin, or some other w32 environment. Relies on a
-# correctly configured wine environment available, with the winepath program
-# in $build's $PATH.
-#
-# ARG is the $build file name to be converted to w32 format.
-# Result is available in $func_convert_core_file_wine_to_w32_result, and will
-# be empty on error (or when ARG is empty)
-func_convert_core_file_wine_to_w32 ()
-{
-  $opt_debug
-  func_convert_core_file_wine_to_w32_result="$1"
-  if test -n "$1"; then
-    # Unfortunately, winepath does not exit with a non-zero error code, so we
-    # are forced to check the contents of stdout. On the other hand, if the
-    # command is not found, the shell will set an exit code of 127 and print
-    # *an error message* to stdout. So we must check for both error code of
-    # zero AND non-empty stdout, which explains the odd construction:
-    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
-    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
-      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
-        $SED -e "$lt_sed_naive_backslashify"`
-    else
-      func_convert_core_file_wine_to_w32_result=
-    fi
-  fi
-}
-# end: func_convert_core_file_wine_to_w32
-
-
-# func_convert_core_path_wine_to_w32 ARG
-# Helper function used by path conversion functions when $build is *nix, and
-# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
-# configured wine environment available, with the winepath program in $build's
-# $PATH. Assumes ARG has no leading or trailing path separator characters.
-#
-# ARG is path to be converted from $build format to win32.
-# Result is available in $func_convert_core_path_wine_to_w32_result.
-# Unconvertible file (directory) names in ARG are skipped; if no directory names
-# are convertible, then the result may be empty.
-func_convert_core_path_wine_to_w32 ()
-{
-  $opt_debug
-  # unfortunately, winepath doesn't convert paths, only file names
-  func_convert_core_path_wine_to_w32_result=""
-  if test -n "$1"; then
-    oldIFS=$IFS
-    IFS=:
-    for func_convert_core_path_wine_to_w32_f in $1; do
-      IFS=$oldIFS
-      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
-      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
-        if test -z "$func_convert_core_path_wine_to_w32_result"; then
-          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
-        else
-          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
-        fi
-      fi
-    done
-    IFS=$oldIFS
-  fi
-}
-# end: func_convert_core_path_wine_to_w32
-
-
-# func_cygpath ARGS...
-# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
-# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
-# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
-# (2), returns the Cygwin file name or path in func_cygpath_result (input
-# file name or path is assumed to be in w32 format, as previously converted
-# from $build's *nix or MSYS format). In case (3), returns the w32 file name
-# or path in func_cygpath_result (input file name or path is assumed to be in
-# Cygwin format). Returns an empty string on error.
-#
-# ARGS are passed to cygpath, with the last one being the file name or path to
-# be converted.
-#
-# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
-# environment variable; do not put it in $PATH.
-func_cygpath ()
-{
-  $opt_debug
-  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
-    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
-    if test "$?" -ne 0; then
-      # on failure, ensure result is empty
-      func_cygpath_result=
-    fi
-  else
-    func_cygpath_result=
-    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
-  fi
-}
-#end: func_cygpath
-
-
-# func_convert_core_msys_to_w32 ARG
-# Convert file name or path ARG from MSYS format to w32 format.  Return
-# result in func_convert_core_msys_to_w32_result.
-func_convert_core_msys_to_w32 ()
-{
-  $opt_debug
-  # awkward: cmd appends spaces to result
-  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
-}
-#end: func_convert_core_msys_to_w32
-
-
-# func_convert_file_check ARG1 ARG2
-# Verify that ARG1 (a file name in $build format) was converted to $host
-# format in ARG2. Otherwise, emit an error message, but continue (resetting
-# func_to_host_file_result to ARG1).
-func_convert_file_check ()
-{
-  $opt_debug
-  if test -z "$2" && test -n "$1" ; then
-    func_error "Could not determine host file name corresponding to"
-    func_error "  \`$1'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback:
-    func_to_host_file_result="$1"
-  fi
-}
-# end func_convert_file_check
-
-
-# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
-# Verify that FROM_PATH (a path in $build format) was converted to $host
-# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
-# func_to_host_file_result to a simplistic fallback value (see below).
-func_convert_path_check ()
-{
-  $opt_debug
-  if test -z "$4" && test -n "$3"; then
-    func_error "Could not determine the host path corresponding to"
-    func_error "  \`$3'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback.  This is a deliberately simplistic "conversion" and
-    # should not be "improved".  See libtool.info.
-    if test "x$1" != "x$2"; then
-      lt_replace_pathsep_chars="s|$1|$2|g"
-      func_to_host_path_result=`echo "$3" |
-        $SED -e "$lt_replace_pathsep_chars"`
-    else
-      func_to_host_path_result="$3"
-    fi
-  fi
-}
-# end func_convert_path_check
-
-
-# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
-# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
-# and appending REPL if ORIG matches BACKPAT.
-func_convert_path_front_back_pathsep ()
-{
-  $opt_debug
-  case $4 in
-  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
-    ;;
-  esac
-  case $4 in
-  $2 ) func_append func_to_host_path_result "$3"
-    ;;
-  esac
-}
-# end func_convert_path_front_back_pathsep
-
-
-##################################################
-# $build to $host FILE NAME CONVERSION FUNCTIONS #
-##################################################
-# invoked via `$to_host_file_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# Result will be available in $func_to_host_file_result.
-
-
-# func_to_host_file ARG
-# Converts the file name ARG from $build format to $host format. Return result
-# in func_to_host_file_result.
-func_to_host_file ()
-{
-  $opt_debug
-  $to_host_file_cmd "$1"
-}
-# end func_to_host_file
-
-
-# func_to_tool_file ARG LAZY
-# converts the file name ARG from $build format to toolchain format. Return
-# result in func_to_tool_file_result.  If the conversion in use is listed
-# in (the comma separated) LAZY, no conversion takes place.
-func_to_tool_file ()
-{
-  $opt_debug
-  case ,$2, in
-    *,"$to_tool_file_cmd",*)
-      func_to_tool_file_result=$1
-      ;;
-    *)
-      $to_tool_file_cmd "$1"
-      func_to_tool_file_result=$func_to_host_file_result
-      ;;
-  esac
-}
-# end func_to_tool_file
-
-
-# func_convert_file_noop ARG
-# Copy ARG to func_to_host_file_result.
-func_convert_file_noop ()
-{
-  func_to_host_file_result="$1"
-}
-# end func_convert_file_noop
-
-
-# func_convert_file_msys_to_w32 ARG
-# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_file_result.
-func_convert_file_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_w32
-
-
-# func_convert_file_cygwin_to_w32 ARG
-# Convert file name ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_file_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
-    # LT_CYGPATH in this case.
-    func_to_host_file_result=`cygpath -m "$1"`
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_cygwin_to_w32
-
-
-# func_convert_file_nix_to_w32 ARG
-# Convert file name ARG from *nix to w32 format.  Requires a wine environment
-# and a working winepath. Returns result in func_to_host_file_result.
-func_convert_file_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_file_wine_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_w32
-
-
-# func_convert_file_msys_to_cygwin ARG
-# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_file_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_msys_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_cygwin
-
-
-# func_convert_file_nix_to_cygwin ARG
-# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
-# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
-# in func_to_host_file_result.
-func_convert_file_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
-    func_convert_core_file_wine_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_cygwin
-
-
-#############################################
-# $build to $host PATH CONVERSION FUNCTIONS #
-#############################################
-# invoked via `$to_host_path_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# The result will be available in $func_to_host_path_result.
-#
-# Path separators are also converted from $build format to $host format.  If
-# ARG begins or ends with a path separator character, it is preserved (but
-# converted to $host format) on output.
-#
-# All path conversion functions are named using the following convention:
-#   file name conversion function    : func_convert_file_X_to_Y ()
-#   path conversion function         : func_convert_path_X_to_Y ()
-# where, for any given $build/$host combination the 'X_to_Y' value is the
-# same.  If conversion functions are added for new $build/$host combinations,
-# the two new functions must follow this pattern, or func_init_to_host_path_cmd
-# will break.
-
-
-# func_init_to_host_path_cmd
-# Ensures that function "pointer" variable $to_host_path_cmd is set to the
-# appropriate value, based on the value of $to_host_file_cmd.
-to_host_path_cmd=
-func_init_to_host_path_cmd ()
-{
-  $opt_debug
-  if test -z "$to_host_path_cmd"; then
-    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
-    to_host_path_cmd="func_convert_path_${func_stripname_result}"
-  fi
-}
-
-
-# func_to_host_path ARG
-# Converts the path ARG from $build format to $host format. Return result
-# in func_to_host_path_result.
-func_to_host_path ()
-{
-  $opt_debug
-  func_init_to_host_path_cmd
-  $to_host_path_cmd "$1"
-}
-# end func_to_host_path
-
-
-# func_convert_path_noop ARG
-# Copy ARG to func_to_host_path_result.
-func_convert_path_noop ()
-{
-  func_to_host_path_result="$1"
-}
-# end func_convert_path_noop
-
-
-# func_convert_path_msys_to_w32 ARG
-# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_path_result.
-func_convert_path_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from ARG.  MSYS
-    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
-    # and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_msys_to_w32
-
-
-# func_convert_path_cygwin_to_w32 ARG
-# Convert path ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_path_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_cygwin_to_w32
-
-
-# func_convert_path_nix_to_w32 ARG
-# Convert path ARG from *nix to w32 format.  Requires a wine environment and
-# a working winepath.  Returns result in func_to_host_file_result.
-func_convert_path_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_nix_to_w32
-
-
-# func_convert_path_msys_to_cygwin ARG
-# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_path_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_msys_to_cygwin
-
-
-# func_convert_path_nix_to_cygwin ARG
-# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
-# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
-# func_to_host_file_result.
-func_convert_path_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from
-    # ARG. msys behavior is inconsistent here, cygpath turns them
-    # into '.;' and ';.', and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_nix_to_cygwin
-
-
-# func_mode_compile arg...
-func_mode_compile ()
-{
-    $opt_debug
-    # Get the compilation command and the source file.
-    base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
-    suppress_output=
-    arg_mode=normal
-    libobj=
-    later=
-    pie_flag=
-
-    for arg
-    do
-      case $arg_mode in
-      arg  )
-	# do not "continue".  Instead, add this to base_compile
-	lastarg="$arg"
-	arg_mode=normal
-	;;
-
-      target )
-	libobj="$arg"
-	arg_mode=normal
-	continue
-	;;
-
-      normal )
-	# Accept any command-line options.
-	case $arg in
-	-o)
-	  test -n "$libobj" && \
-	    func_fatal_error "you cannot specify \`-o' more than once"
-	  arg_mode=target
-	  continue
-	  ;;
-
-	-pie | -fpie | -fPIE)
-          func_append pie_flag " $arg"
-	  continue
-	  ;;
-
-	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  func_append later " $arg"
-	  continue
-	  ;;
-
-	-no-suppress)
-	  suppress_opt=no
-	  continue
-	  ;;
-
-	-Xcompiler)
-	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
-	  continue      #  The current "srcfile" will either be retained or
-	  ;;            #  replaced later.  I would guess that would be a bug.
-
-	-Wc,*)
-	  func_stripname '-Wc,' '' "$arg"
-	  args=$func_stripname_result
-	  lastarg=
-	  save_ifs="$IFS"; IFS=','
-	  for arg in $args; do
-	    IFS="$save_ifs"
-	    func_append_quoted lastarg "$arg"
-	  done
-	  IFS="$save_ifs"
-	  func_stripname ' ' '' "$lastarg"
-	  lastarg=$func_stripname_result
-
-	  # Add the arguments to base_compile.
-	  func_append base_compile " $lastarg"
-	  continue
-	  ;;
-
-	*)
-	  # Accept the current argument as the source file.
-	  # The previous "srcfile" becomes the current argument.
-	  #
-	  lastarg="$srcfile"
-	  srcfile="$arg"
-	  ;;
-	esac  #  case $arg
-	;;
-      esac    #  case $arg_mode
-
-      # Aesthetically quote the previous argument.
-      func_append_quoted base_compile "$lastarg"
-    done # for arg
-
-    case $arg_mode in
-    arg)
-      func_fatal_error "you must specify an argument for -Xcompile"
-      ;;
-    target)
-      func_fatal_error "you must specify a target with \`-o'"
-      ;;
-    *)
-      # Get the name of the library object.
-      test -z "$libobj" && {
-	func_basename "$srcfile"
-	libobj="$func_basename_result"
-      }
-      ;;
-    esac
-
-    # Recognize several different file suffixes.
-    # If the user specifies -o file.o, it is replaced with file.lo
-    case $libobj in
-    *.[cCFSifmso] | \
-    *.ada | *.adb | *.ads | *.asm | \
-    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
-      func_xform "$libobj"
-      libobj=$func_xform_result
-      ;;
-    esac
-
-    case $libobj in
-    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
-    *)
-      func_fatal_error "cannot determine name of library object from \`$libobj'"
-      ;;
-    esac
-
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
-	build_old_libs=no
-	continue
-	;;
-
-      -static)
-	build_libtool_libs=no
-	build_old_libs=yes
-	continue
-	;;
-
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
-
-      -prefer-non-pic)
-	pic_mode=no
-	continue
-	;;
-      esac
-    done
-
-    func_quote_for_eval "$libobj"
-    test "X$libobj" != "X$func_quote_for_eval_result" \
-      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
-      && func_warning "libobj name \`$libobj' may not contain shell special characters."
-    func_dirname_and_basename "$obj" "/" ""
-    objname="$func_basename_result"
-    xdir="$func_dirname_result"
-    lobj=${xdir}$objdir/$objname
-
-    test -z "$base_compile" && \
-      func_fatal_help "you must specify a compilation command"
-
-    # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
-      removelist="$obj $lobj $libobj ${libobj}T"
-    else
-      removelist="$lobj $libobj ${libobj}T"
-    fi
-
-    # On Cygwin there's no "real" PIC flag so we must build both object types
-    case $host_os in
-    cygwin* | mingw* | pw32* | os2* | cegcc*)
-      pic_mode=default
-      ;;
-    esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
-      # non-PIC code in shared libraries is not supported
-      pic_mode=default
-    fi
-
-    # Calculate the filename of the output object if compiler does
-    # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
-    else
-      output_obj=
-      need_locks=no
-      lockfile=
-    fi
-
-    # Lock this critical section if it is needed
-    # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-	func_echo "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    elif test "$need_locks" = warn; then
-      if test -f "$lockfile"; then
-	$ECHO "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-      func_append removelist " $output_obj"
-      $ECHO "$srcfile" > "$lockfile"
-    fi
-
-    $opt_dry_run || $RM $removelist
-    func_append removelist " $lockfile"
-    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
-
-    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
-    srcfile=$func_to_tool_file_result
-    func_quote_for_eval "$srcfile"
-    qsrcfile=$func_quote_for_eval_result
-
-    # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
-      # Without this assignment, base_compile gets emptied.
-      fbsd_hideous_sh_bug=$base_compile
-
-      if test "$pic_mode" != no; then
-	command="$base_compile $qsrcfile $pic_flag"
-      else
-	# Don't build PIC code
-	command="$base_compile $qsrcfile"
-      fi
-
-      func_mkdir_p "$xdir$objdir"
-
-      if test -z "$output_obj"; then
-	# Place PIC objects in $objdir
-	func_append command " -o $lobj"
-      fi
-
-      func_show_eval_locale "$command"	\
-          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed, then go on to compile the next one
-      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-	func_show_eval '$MV "$output_obj" "$lobj"' \
-	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-
-      # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-	suppress_output=' >/dev/null 2>&1'
-      fi
-    fi
-
-    # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
-	# Don't build PIC code
-	command="$base_compile $qsrcfile$pie_flag"
-      else
-	command="$base_compile $qsrcfile $pic_flag"
-      fi
-      if test "$compiler_c_o" = yes; then
-	func_append command " -o $obj"
-      fi
-
-      # Suppress compiler output if we already did a PIC compilation.
-      func_append command "$suppress_output"
-      func_show_eval_locale "$command" \
-        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed
-      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-	func_show_eval '$MV "$output_obj" "$obj"' \
-	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-    fi
-
-    $opt_dry_run || {
-      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
-
-      # Unlock the critical section if it was locked
-      if test "$need_locks" != no; then
-	removelist=$lockfile
-        $RM "$lockfile"
-      fi
-    }
-
-    exit $EXIT_SUCCESS
-}
-
-$opt_help || {
-  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
-    # We need to display help for each of the modes.
-    case $opt_mode in
-      "")
-        # Generic help is extracted from the usage comments
-        # at the start of this file.
-        func_help
-        ;;
-
-      clean)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      compile)
-      $ECHO \
-"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
-  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
-  -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to build PIC objects only
-  -prefer-non-pic   try to build non-PIC objects only
-  -shared           do not build a \`.o' file suitable for static linking
-  -static           only build a \`.o' file suitable for static linking
-  -Wc,FLAG          pass FLAG directly to the compiler
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
-        ;;
-
-      execute)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
-  -dlopen FILE      add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
-        ;;
-
-      finish)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
-        ;;
-
-      install)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
-
-The following components of INSTALL-COMMAND are treated specially:
-
-  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
-        ;;
-
-      link)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
-  -all-static       do not do any dynamic linking at all
-  -avoid-version    do not add a version suffix if possible
-  -bindir BINDIR    specify path to binaries directory (for systems where
-                    libraries must be found in the PATH setting at runtime)
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
-  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
-  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-  -export-symbols SYMFILE
-                    try to export only the symbols listed in SYMFILE
-  -export-symbols-regex REGEX
-                    try to export only the symbols matching REGEX
-  -LLIBDIR          search LIBDIR for required installed libraries
-  -lNAME            OUTPUT-FILE requires the installed library libNAME
-  -module           build a library that can dlopened
-  -no-fast-install  disable the fast-install mode
-  -no-install       link a not-installable executable
-  -no-undefined     declare that a library does not refer to external symbols
-  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
-  -release RELEASE  specify package release information
-  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
-  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -shared           only do dynamic linking of libtool libraries
-  -shrext SUFFIX    override the standard shared library file extension
-  -static           do not do any dynamic linking of uninstalled libtool libraries
-  -static-libtool-libs
-                    do not do any dynamic linking of libtool libraries
-  -version-info CURRENT[:REVISION[:AGE]]
-                    specify library version info [each variable defaults to 0]
-  -weak LIBNAME     declare that the target provides the LIBNAME interface
-  -Wc,FLAG
-  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
-  -Wl,FLAG
-  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
-  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename.  Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
-        ;;
-
-      uninstall)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      *)
-        func_fatal_help "invalid operation mode \`$opt_mode'"
-        ;;
-    esac
-
-    echo
-    $ECHO "Try \`$progname --help' for more information about other modes."
-}
-
-# Now that we've collected a possible --mode arg, show help if necessary
-if $opt_help; then
-  if test "$opt_help" = :; then
-    func_mode_help
-  else
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	func_mode_help
-      done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	echo
-	func_mode_help
-      done
-    } |
-    sed '1d
-      /^When reporting/,/^Report/{
-	H
-	d
-      }
-      $x
-      /information about other modes/d
-      /more detailed .*MODE/d
-      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
-  fi
-  exit $?
-fi
-
-
-# func_mode_execute arg...
-func_mode_execute ()
-{
-    $opt_debug
-    # The first argument is the command name.
-    cmd="$nonopt"
-    test -z "$cmd" && \
-      func_fatal_help "you must specify a COMMAND"
-
-    # Handle -dlopen flags immediately.
-    for file in $opt_dlopen; do
-      test -f "$file" \
-	|| func_fatal_help "\`$file' is not a file"
-
-      dir=
-      case $file in
-      *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$lib' is not a valid libtool archive"
-
-	# Read the libtool library.
-	dlname=
-	library_names=
-	func_source "$file"
-
-	# Skip this library if it cannot be dlopened.
-	if test -z "$dlname"; then
-	  # Warn if it was a shared library.
-	  test -n "$library_names" && \
-	    func_warning "\`$file' was not linked with \`-export-dynamic'"
-	  continue
-	fi
-
-	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
-
-	if test -f "$dir/$objdir/$dlname"; then
-	  func_append dir "/$objdir"
-	else
-	  if test ! -f "$dir/$dlname"; then
-	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
-	  fi
-	fi
-	;;
-
-      *.lo)
-	# Just add the directory containing the .lo file.
-	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
-	;;
-
-      *)
-	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
-	continue
-	;;
-      esac
-
-      # Get the absolute pathname.
-      absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
-
-      # Now add the directory to shlibpath_var.
-      if eval "test -z \"\$$shlibpath_var\""; then
-	eval "$shlibpath_var=\"\$dir\""
-      else
-	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
-      fi
-    done
-
-    # This variable tells wrapper scripts just to set shlibpath_var
-    # rather than running their programs.
-    libtool_execute_magic="$magic"
-
-    # Check if any of the arguments is a wrapper script.
-    args=
-    for file
-    do
-      case $file in
-      -* | *.la | *.lo ) ;;
-      *)
-	# Do a test to see if this is really a libtool program.
-	if func_ltwrapper_script_p "$file"; then
-	  func_source "$file"
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	elif func_ltwrapper_executable_p "$file"; then
-	  func_ltwrapper_scriptname "$file"
-	  func_source "$func_ltwrapper_scriptname_result"
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	fi
-	;;
-      esac
-      # Quote arguments (to preserve shell metacharacters).
-      func_append_quoted args "$file"
-    done
-
-    if test "X$opt_dry_run" = Xfalse; then
-      if test -n "$shlibpath_var"; then
-	# Export the shlibpath_var.
-	eval "export $shlibpath_var"
-      fi
-
-      # Restore saved environment variables
-      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-      do
-	eval "if test \"\${save_$lt_var+set}\" = set; then
-                $lt_var=\$save_$lt_var; export $lt_var
-	      else
-		$lt_unset $lt_var
-	      fi"
-      done
-
-      # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	echo "export $shlibpath_var"
-      fi
-      $ECHO "$cmd$args"
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
-    $opt_debug
-    libs=
-    libdirs=
-    admincmds=
-
-    for opt in "$nonopt" ${1+"$@"}
-    do
-      if test -d "$opt"; then
-	func_append libdirs " $opt"
-
-      elif test -f "$opt"; then
-	if func_lalib_unsafe_p "$opt"; then
-	  func_append libs " $opt"
-	else
-	  func_warning "\`$opt' is not a valid libtool archive"
-	fi
-
-      else
-	func_fatal_error "invalid argument \`$opt'"
-      fi
-    done
-
-    if test -n "$libs"; then
-      if test -n "$lt_sysroot"; then
-        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
-        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
-      else
-        sysroot_cmd=
-      fi
-
-      # Remove sysroot references
-      if $opt_dry_run; then
-        for lib in $libs; do
-          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
-        done
-      else
-        tmpdir=`func_mktempdir`
-        for lib in $libs; do
-	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
-	    > $tmpdir/tmp-la
-	  mv -f $tmpdir/tmp-la $lib
-	done
-        ${RM}r "$tmpdir"
-      fi
-    fi
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for libdir in $libdirs; do
-	if test -n "$finish_cmds"; then
-	  # Do each command in the finish commands.
-	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
-'"$cmd"'"'
-	fi
-	if test -n "$finish_eval"; then
-	  # Do the single finish_eval.
-	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || func_append admincmds "
-       $cmds"
-	fi
-      done
-    fi
-
-    # Exit here if they wanted silent mode.
-    $opt_silent && exit $EXIT_SUCCESS
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      echo "----------------------------------------------------------------------"
-      echo "Libraries have been installed in:"
-      for libdir in $libdirs; do
-	$ECHO "   $libdir"
-      done
-      echo
-      echo "If you ever happen to want to link against installed libraries"
-      echo "in a given directory, LIBDIR, you must either use libtool, and"
-      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-      echo "flag during linking and do at least one of the following:"
-      if test -n "$shlibpath_var"; then
-	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-	echo "     during execution"
-      fi
-      if test -n "$runpath_var"; then
-	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-	echo "     during linking"
-      fi
-      if test -n "$hardcode_libdir_flag_spec"; then
-	libdir=LIBDIR
-	eval flag=\"$hardcode_libdir_flag_spec\"
-
-	$ECHO "   - use the \`$flag' linker flag"
-      fi
-      if test -n "$admincmds"; then
-	$ECHO "   - have your system administrator run these commands:$admincmds"
-      fi
-      if test -f /etc/ld.so.conf; then
-	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-      fi
-      echo
-
-      echo "See any operating system documentation about shared libraries for"
-      case $host in
-	solaris2.[6789]|solaris2.1[0-9])
-	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	  echo "pages."
-	  ;;
-	*)
-	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
-	  ;;
-      esac
-      echo "----------------------------------------------------------------------"
-    fi
-    exit $EXIT_SUCCESS
-}
-
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
-
-
-# func_mode_install arg...
-func_mode_install ()
-{
-    $opt_debug
-    # There may be an optional sh(1) argument at the beginning of
-    # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
-       # Allow the use of GNU shtool's install command.
-       case $nonopt in *shtool*) :;; *) false;; esac; then
-      # Aesthetically quote it.
-      func_quote_for_eval "$nonopt"
-      install_prog="$func_quote_for_eval_result "
-      arg=$1
-      shift
-    else
-      install_prog=
-      arg=$nonopt
-    fi
-
-    # The real first argument should be the name of the installation program.
-    # Aesthetically quote it.
-    func_quote_for_eval "$arg"
-    func_append install_prog "$func_quote_for_eval_result"
-    install_shared_prog=$install_prog
-    case " $install_prog " in
-      *[\\\ /]cp\ *) install_cp=: ;;
-      *) install_cp=false ;;
-    esac
-
-    # We need to accept at least all the BSD install flags.
-    dest=
-    files=
-    opts=
-    prev=
-    install_type=
-    isdir=no
-    stripme=
-    no_mode=:
-    for arg
-    do
-      arg2=
-      if test -n "$dest"; then
-	func_append files " $dest"
-	dest=$arg
-	continue
-      fi
-
-      case $arg in
-      -d) isdir=yes ;;
-      -f)
-	if $install_cp; then :; else
-	  prev=$arg
-	fi
-	;;
-      -g | -m | -o)
-	prev=$arg
-	;;
-      -s)
-	stripme=" -s"
-	continue
-	;;
-      -*)
-	;;
-      *)
-	# If the previous option needed an argument, then skip it.
-	if test -n "$prev"; then
-	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
-	    arg2=$install_override_mode
-	    no_mode=false
-	  fi
-	  prev=
-	else
-	  dest=$arg
-	  continue
-	fi
-	;;
-      esac
-
-      # Aesthetically quote the argument.
-      func_quote_for_eval "$arg"
-      func_append install_prog " $func_quote_for_eval_result"
-      if test -n "$arg2"; then
-	func_quote_for_eval "$arg2"
-      fi
-      func_append install_shared_prog " $func_quote_for_eval_result"
-    done
-
-    test -z "$install_prog" && \
-      func_fatal_help "you must specify an install program"
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prev' option requires an argument"
-
-    if test -n "$install_override_mode" && $no_mode; then
-      if $install_cp; then :; else
-	func_quote_for_eval "$install_override_mode"
-	func_append install_shared_prog " -m $func_quote_for_eval_result"
-      fi
-    fi
-
-    if test -z "$files"; then
-      if test -z "$dest"; then
-	func_fatal_help "no file or destination specified"
-      else
-	func_fatal_help "you must specify a destination"
-      fi
-    fi
-
-    # Strip any trailing slash from the destination.
-    func_stripname '' '/' "$dest"
-    dest=$func_stripname_result
-
-    # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
-      destname=
-    else
-      func_dirname_and_basename "$dest" "" "."
-      destdir="$func_dirname_result"
-      destname="$func_basename_result"
-
-      # Not a directory, so check to see that there is only one file specified.
-      set dummy $files; shift
-      test "$#" -gt 1 && \
-	func_fatal_help "\`$dest' is not a directory"
-    fi
-    case $destdir in
-    [\\/]* | [A-Za-z]:[\\/]*) ;;
-    *)
-      for file in $files; do
-	case $file in
-	*.lo) ;;
-	*)
-	  func_fatal_help "\`$destdir' must be an absolute directory name"
-	  ;;
-	esac
-      done
-      ;;
-    esac
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    staticlibs=
-    future_libdirs=
-    current_libdirs=
-    for file in $files; do
-
-      # Do each installation.
-      case $file in
-      *.$libext)
-	# Do the static libraries later.
-	func_append staticlibs " $file"
-	;;
-
-      *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$file' is not a valid libtool archive"
-
-	library_names=
-	old_library=
-	relink_command=
-	func_source "$file"
-
-	# Add the libdir to current_libdirs if it is the destination.
-	if test "X$destdir" = "X$libdir"; then
-	  case "$current_libdirs " in
-	  *" $libdir "*) ;;
-	  *) func_append current_libdirs " $libdir" ;;
-	  esac
-	else
-	  # Note the libdir as a future libdir.
-	  case "$future_libdirs " in
-	  *" $libdir "*) ;;
-	  *) func_append future_libdirs " $libdir" ;;
-	  esac
-	fi
-
-	func_dirname "$file" "/" ""
-	dir="$func_dirname_result"
-	func_append dir "$objdir"
-
-	if test -n "$relink_command"; then
-	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
-
-	  # Don't allow the user to place us outside of our expected
-	  # location b/c this prevents finding dependent libraries that
-	  # are installed to the same prefix.
-	  # At present, this check doesn't affect windows .dll's that
-	  # are installed into $libdir/../bin (currently, that works fine)
-	  # but it's something to keep an eye on.
-	  test "$inst_prefix_dir" = "$destdir" && \
-	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
-
-	  if test -n "$inst_prefix_dir"; then
-	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
-	  else
-	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
-	  fi
-
-	  func_warning "relinking \`$file'"
-	  func_show_eval "$relink_command" \
-	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
-	fi
-
-	# See the names of the shared library.
-	set dummy $library_names; shift
-	if test -n "$1"; then
-	  realname="$1"
-	  shift
-
-	  srcname="$realname"
-	  test -n "$relink_command" && srcname="$realname"T
-
-	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
-	      'exit $?'
-	  tstripme="$stripme"
-	  case $host_os in
-	  cygwin* | mingw* | pw32* | cegcc*)
-	    case $realname in
-	    *.dll.a)
-	      tstripme=""
-	      ;;
-	    esac
-	    ;;
-	  esac
-	  if test -n "$tstripme" && test -n "$striplib"; then
-	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
-	  fi
-
-	  if test "$#" -gt 0; then
-	    # Delete the old symlinks, and create new ones.
-	    # Try `ln -sf' first, because the `ln' binary might depend on
-	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
-	    # so we also need to try rm && ln -s.
-	    for linkname
-	    do
-	      test "$linkname" != "$realname" \
-		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
-	    done
-	  fi
-
-	  # Do each command in the postinstall commands.
-	  lib="$destdir/$realname"
-	  func_execute_cmds "$postinstall_cmds" 'exit $?'
-	fi
-
-	# Install the pseudo-library for information purposes.
-	func_basename "$file"
-	name="$func_basename_result"
-	instname="$dir/$name"i
-	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
-
-	# Maybe install the static library, too.
-	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
-	;;
-
-      *.lo)
-	# Install (i.e. copy) a libtool object.
-
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
-	fi
-
-	# Deduce the name of the destination old-style object file.
-	case $destfile in
-	*.lo)
-	  func_lo2o "$destfile"
-	  staticdest=$func_lo2o_result
-	  ;;
-	*.$objext)
-	  staticdest="$destfile"
-	  destfile=
-	  ;;
-	*)
-	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
-	  ;;
-	esac
-
-	# Install the libtool object if requested.
-	test -n "$destfile" && \
-	  func_show_eval "$install_prog $file $destfile" 'exit $?'
-
-	# Install the old object if enabled.
-	if test "$build_old_libs" = yes; then
-	  # Deduce the name of the old-style object file.
-	  func_lo2o "$file"
-	  staticobj=$func_lo2o_result
-	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
-	fi
-	exit $EXIT_SUCCESS
-	;;
-
-      *)
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
-	fi
-
-	# If the file is missing, and there is a .exe on the end, strip it
-	# because it is most likely a libtool script we actually want to
-	# install
-	stripped_ext=""
-	case $file in
-	  *.exe)
-	    if test ! -f "$file"; then
-	      func_stripname '' '.exe' "$file"
-	      file=$func_stripname_result
-	      stripped_ext=".exe"
-	    fi
-	    ;;
-	esac
-
-	# Do a test to see if this is really a libtool program.
-	case $host in
-	*cygwin* | *mingw*)
-	    if func_ltwrapper_executable_p "$file"; then
-	      func_ltwrapper_scriptname "$file"
-	      wrapper=$func_ltwrapper_scriptname_result
-	    else
-	      func_stripname '' '.exe' "$file"
-	      wrapper=$func_stripname_result
-	    fi
-	    ;;
-	*)
-	    wrapper=$file
-	    ;;
-	esac
-	if func_ltwrapper_script_p "$wrapper"; then
-	  notinst_deplibs=
-	  relink_command=
-
-	  func_source "$wrapper"
-
-	  # Check the variables that should have been set.
-	  test -z "$generated_by_libtool_version" && \
-	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
-
-	  finalize=yes
-	  for lib in $notinst_deplibs; do
-	    # Check to see that each library is installed.
-	    libdir=
-	    if test -f "$lib"; then
-	      func_source "$lib"
-	    fi
-	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
-	    if test -n "$libdir" && test ! -f "$libfile"; then
-	      func_warning "\`$lib' has not been installed in \`$libdir'"
-	      finalize=no
-	    fi
-	  done
-
-	  relink_command=
-	  func_source "$wrapper"
-
-	  outputname=
-	  if test "$fast_install" = no && test -n "$relink_command"; then
-	    $opt_dry_run || {
-	      if test "$finalize" = yes; then
-	        tmpdir=`func_mktempdir`
-		func_basename "$file$stripped_ext"
-		file="$func_basename_result"
-	        outputname="$tmpdir/$file"
-	        # Replace the output file specification.
-	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
-
-	        $opt_silent || {
-	          func_quote_for_expand "$relink_command"
-		  eval "func_echo $func_quote_for_expand_result"
-	        }
-	        if eval "$relink_command"; then :
-	          else
-		  func_error "error: relink \`$file' with the above command before installing it"
-		  $opt_dry_run || ${RM}r "$tmpdir"
-		  continue
-	        fi
-	        file="$outputname"
-	      else
-	        func_warning "cannot relink \`$file'"
-	      fi
-	    }
-	  else
-	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
-	  fi
-	fi
-
-	# remove .exe since cygwin /usr/bin/install will append another
-	# one anyway
-	case $install_prog,$host in
-	*/usr/bin/install*,*cygwin*)
-	  case $file:$destfile in
-	  *.exe:*.exe)
-	    # this is ok
-	    ;;
-	  *.exe:*)
-	    destfile=$destfile.exe
-	    ;;
-	  *:*.exe)
-	    func_stripname '' '.exe' "$destfile"
-	    destfile=$func_stripname_result
-	    ;;
-	  esac
-	  ;;
-	esac
-	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
-	$opt_dry_run || if test -n "$outputname"; then
-	  ${RM}r "$tmpdir"
-	fi
-	;;
-      esac
-    done
-
-    for file in $staticlibs; do
-      func_basename "$file"
-      name="$func_basename_result"
-
-      # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
-      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-      tool_oldlib=$func_to_tool_file_result
-
-      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
-
-      if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
-      fi
-
-      # Do each command in the postinstall commands.
-      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
-    done
-
-    test -n "$future_libdirs" && \
-      func_warning "remember to run \`$progname --finish$future_libdirs'"
-
-    if test -n "$current_libdirs"; then
-      # Maybe just do a dry run.
-      $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
-    else
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
-
-
-# func_generate_dlsyms outputname originator pic_p
-# Extract symbols from dlprefiles and create ${outputname}S.o with
-# a dlpreopen symbol table.
-func_generate_dlsyms ()
-{
-    $opt_debug
-    my_outputname="$1"
-    my_originator="$2"
-    my_pic_p="${3-no}"
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
-    my_dlsyms=
-
-    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-      if test -n "$NM" && test -n "$global_symbol_pipe"; then
-	my_dlsyms="${my_outputname}S.c"
-      else
-	func_error "not configured to extract global symbols from dlpreopened files"
-      fi
-    fi
-
-    if test -n "$my_dlsyms"; then
-      case $my_dlsyms in
-      "") ;;
-      *.c)
-	# Discover the nlist of each of the dlfiles.
-	nlist="$output_objdir/${my_outputname}.nm"
-
-	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
-
-	# Parse the name list into a source file.
-	func_verbose "creating $output_objdir/$my_dlsyms"
-
-	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
-#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
-#endif
-
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
-/* External symbol declarations for the compiler. */\
-"
-
-	if test "$dlself" = yes; then
-	  func_verbose "generating symbol list for \`$output'"
-
-	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
-
-	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
-	  for progfile in $progfiles; do
-	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
-	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
-	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
-	  done
-
-	  if test -n "$exclude_expsyms"; then
-	    $opt_dry_run || {
-	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	    }
-	  fi
-
-	  if test -n "$export_symbols_regex"; then
-	    $opt_dry_run || {
-	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	    }
-	  fi
-
-	  # Prepare the list of exported symbols
-	  if test -z "$export_symbols"; then
-	    export_symbols="$output_objdir/$outputname.exp"
-	    $opt_dry_run || {
-	      $RM $export_symbols
-	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-	      case $host in
-	      *cygwin* | *mingw* | *cegcc* )
-                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
-	        ;;
-	      esac
-	    }
-	  else
-	    $opt_dry_run || {
-	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
-	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	      case $host in
-	        *cygwin* | *mingw* | *cegcc* )
-	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
-	          ;;
-	      esac
-	    }
-	  fi
-	fi
-
-	for dlprefile in $dlprefiles; do
-	  func_verbose "extracting global C symbols from \`$dlprefile'"
-	  func_basename "$dlprefile"
-	  name="$func_basename_result"
-          case $host in
-	    *cygwin* | *mingw* | *cegcc* )
-	      # if an import library, we need to obtain dlname
-	      if func_win32_import_lib_p "$dlprefile"; then
-	        func_tr_sh "$dlprefile"
-	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
-	        dlprefile_dlbasename=""
-	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
-	          # Use subshell, to avoid clobbering current variable values
-	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
-	          if test -n "$dlprefile_dlname" ; then
-	            func_basename "$dlprefile_dlname"
-	            dlprefile_dlbasename="$func_basename_result"
-	          else
-	            # no lafile. user explicitly requested -dlpreopen <import library>.
-	            $sharedlib_from_linklib_cmd "$dlprefile"
-	            dlprefile_dlbasename=$sharedlib_from_linklib_result
-	          fi
-	        fi
-	        $opt_dry_run || {
-	          if test -n "$dlprefile_dlbasename" ; then
-	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
-	          else
-	            func_warning "Could not compute DLL name from $name"
-	            eval '$ECHO ": $name " >> "$nlist"'
-	          fi
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
-	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
-	        }
-	      else # not an import lib
-	        $opt_dry_run || {
-	          eval '$ECHO ": $name " >> "$nlist"'
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	        }
-	      fi
-	    ;;
-	    *)
-	      $opt_dry_run || {
-	        eval '$ECHO ": $name " >> "$nlist"'
-	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	      }
-	    ;;
-          esac
-	done
-
-	$opt_dry_run || {
-	  # Make sure we have at least an empty file.
-	  test -f "$nlist" || : > "$nlist"
-
-	  if test -n "$exclude_expsyms"; then
-	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
-	    $MV "$nlist"T "$nlist"
-	  fi
-
-	  # Try sorting and uniquifying the output.
-	  if $GREP -v "^: " < "$nlist" |
-	      if sort -k 3 </dev/null >/dev/null 2>&1; then
-		sort -k 3
-	      else
-		sort +2
-	      fi |
-	      uniq > "$nlist"S; then
-	    :
-	  else
-	    $GREP -v "^: " < "$nlist" > "$nlist"S
-	  fi
-
-	  if test -f "$nlist"S; then
-	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
-	  else
-	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
-	  fi
-
-	  echo >> "$output_objdir/$my_dlsyms" "\
-
-/* The mapping between symbol names and symbols.  */
-typedef struct {
-  const char *name;
-  void *address;
-} lt_dlsymlist;
-extern LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
-LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
-  { \"$my_originator\", (void *) 0 },"
-
-	  case $need_lib_prefix in
-	  no)
-	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
-	    ;;
-	  *)
-	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
-	    ;;
-	  esac
-	  echo >> "$output_objdir/$my_dlsyms" "\
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt_${my_prefix}_LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
-	} # !$opt_dry_run
-
-	pic_flag_for_symtable=
-	case "$compile_command " in
-	*" -static "*) ;;
-	*)
-	  case $host in
-	  # compiling the symbol table file with pic_flag works around
-	  # a FreeBSD bug that causes programs to crash when -lm is
-	  # linked before any other PIC object.  But we must not use
-	  # pic_flag when linking with -static.  The problem exists in
-	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
-	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
-	  *-*-hpux*)
-	    pic_flag_for_symtable=" $pic_flag"  ;;
-	  *)
-	    if test "X$my_pic_p" != Xno; then
-	      pic_flag_for_symtable=" $pic_flag"
-	    fi
-	    ;;
-	  esac
-	  ;;
-	esac
-	symtab_cflags=
-	for arg in $LTCFLAGS; do
-	  case $arg in
-	  -pie | -fpie | -fPIE) ;;
-	  *) func_append symtab_cflags " $arg" ;;
-	  esac
-	done
-
-	# Now compile the dynamic symbol file.
-	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
-
-	# Clean up the generated files.
-	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
-
-	# Transform the symbol file into the correct name.
-	symfileobj="$output_objdir/${my_outputname}S.$objext"
-	case $host in
-	*cygwin* | *mingw* | *cegcc* )
-	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	  else
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	  fi
-	  ;;
-	*)
-	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	  ;;
-	esac
-	;;
-      *)
-	func_fatal_error "unknown suffix for \`$my_dlsyms'"
-	;;
-      esac
-    else
-      # We keep going just in case the user didn't refer to
-      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
-      # really was required.
-
-      # Nullify the symbol file.
-      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
-    fi
-}
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-# Despite the name, also deal with 64 bit binaries.
-func_win32_libid ()
-{
-  $opt_debug
-  win32_libid_type="unknown"
-  win32_fileres=`file -L $1 2>/dev/null`
-  case $win32_fileres in
-  *ar\ archive\ import\ library*) # definitely import
-    win32_libid_type="x86 archive import"
-    ;;
-  *ar\ archive*) # could be an import, or static
-    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
-    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
-      func_to_tool_file "$1" func_convert_file_msys_to_w32
-      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
-	$SED -n -e '
-	    1,100{
-		/ I /{
-		    s,.*,import,
-		    p
-		    q
-		}
-	    }'`
-      case $win32_nmres in
-      import*)  win32_libid_type="x86 archive import";;
-      *)        win32_libid_type="x86 archive static";;
-      esac
-    fi
-    ;;
-  *DLL*)
-    win32_libid_type="x86 DLL"
-    ;;
-  *executable*) # but shell scripts are "executable" too...
-    case $win32_fileres in
-    *MS\ Windows\ PE\ Intel*)
-      win32_libid_type="x86 DLL"
-      ;;
-    esac
-    ;;
-  esac
-  $ECHO "$win32_libid_type"
-}
-
-# func_cygming_dll_for_implib ARG
-#
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib ()
-{
-  $opt_debug
-  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
-}
-
-# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
-#
-# The is the core of a fallback implementation of a
-# platform-specific function to extract the name of the
-# DLL associated with the specified import library LIBNAME.
-#
-# SECTION_NAME is either .idata$6 or .idata$7, depending
-# on the platform and compiler that created the implib.
-#
-# Echos the name of the DLL associated with the
-# specified import library.
-func_cygming_dll_for_implib_fallback_core ()
-{
-  $opt_debug
-  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
-  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
-    $SED '/^Contents of section '"$match_literal"':/{
-      # Place marker at beginning of archive member dllname section
-      s/.*/====MARK====/
-      p
-      d
-    }
-    # These lines can sometimes be longer than 43 characters, but
-    # are always uninteresting
-    /:[	 ]*file format pe[i]\{,1\}-/d
-    /^In archive [^:]*:/d
-    # Ensure marker is printed
-    /^====MARK====/p
-    # Remove all lines with less than 43 characters
-    /^.\{43\}/!d
-    # From remaining lines, remove first 43 characters
-    s/^.\{43\}//' |
-    $SED -n '
-      # Join marker and all lines until next marker into a single line
-      /^====MARK====/ b para
-      H
-      $ b para
-      b
-      :para
-      x
-      s/\n//g
-      # Remove the marker
-      s/^====MARK====//
-      # Remove trailing dots and whitespace
-      s/[\. \t]*$//
-      # Print
-      /./p' |
-    # we now have a list, one entry per line, of the stringified
-    # contents of the appropriate section of all members of the
-    # archive which possess that section. Heuristic: eliminate
-    # all those which have a first or second character that is
-    # a '.' (that is, objdump's representation of an unprintable
-    # character.) This should work for all archives with less than
-    # 0x302f exports -- but will fail for DLLs whose name actually
-    # begins with a literal '.' or a single character followed by
-    # a '.'.
-    #
-    # Of those that remain, print the first one.
-    $SED -e '/^\./d;/^.\./d;q'
-}
-
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
-  test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
-  test -n "$func_cygming_ms_implib_tmp"
-}
-
-# func_cygming_dll_for_implib_fallback ARG
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-#
-# This fallback implementation is for use when $DLLTOOL
-# does not support the --identify-strict option.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib_fallback ()
-{
-  $opt_debug
-  if func_cygming_gnu_implib_p "$1" ; then
-    # binutils import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
-  elif func_cygming_ms_implib_p "$1" ; then
-    # ms-generated import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
-  else
-    # unknown
-    sharedlib_from_linklib_result=""
-  fi
-}
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
-    $opt_debug
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-    if test "$lock_old_archive_extraction" = yes; then
-      lockfile=$f_ex_an_ar_oldlib.lock
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-	func_echo "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    fi
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
-		   'stat=$?; rm -f "$lockfile"; exit $stat'
-    if test "$lock_old_archive_extraction" = yes; then
-      $opt_dry_run || rm -f "$lockfile"
-    fi
-    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
-     :
-    else
-      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
-    fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
-    $opt_debug
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-	*) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      func_basename "$my_xlib"
-      my_xlib="$func_basename_result"
-      my_xlib_u=$my_xlib
-      while :; do
-        case " $extracted_archives " in
-	*" $my_xlib_u "*)
-	  func_arith $extracted_serial + 1
-	  extracted_serial=$func_arith_result
-	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
-	*) break ;;
-	esac
-      done
-      extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
-
-      func_mkdir_p "$my_xdir"
-
-      case $host in
-      *-darwin*)
-	func_verbose "Extracting $my_xabs"
-	# Do not bother doing anything if just a dry run
-	$opt_dry_run || {
-	  darwin_orig_dir=`pwd`
-	  cd $my_xdir || exit $?
-	  darwin_archive=$my_xabs
-	  darwin_curdir=`pwd`
-	  darwin_base_archive=`basename "$darwin_archive"`
-	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
-	  if test -n "$darwin_arches"; then
-	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
-	    darwin_arch=
-	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
-	      cd "$darwin_curdir"
-	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
-	    done # $darwin_arches
-            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
-	    darwin_file=
-	    darwin_files=
-	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
-	      $LIPO -create -output "$darwin_file" $darwin_files
-	    done # $darwin_filelist
-	    $RM -rf unfat-$$
-	    cd "$darwin_orig_dir"
-	  else
-	    cd $darwin_orig_dir
-	    func_extract_an_archive "$my_xdir" "$my_xabs"
-	  fi # $darwin_arches
-	} # !$opt_dry_run
-	;;
-      *)
-        func_extract_an_archive "$my_xdir" "$my_xabs"
-	;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
-    done
-
-    func_extract_archives_result="$my_oldobjs"
-}
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-	func_emit_wrapper_arg1=${1-no}
-
-	$ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-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
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# 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
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
-  # install mode needs the following variables:
-  generated_by_libtool_version='$macro_version'
-  notinst_deplibs='$notinst_deplibs'
-else
-  # When we are sourced in execute mode, \$file and \$ECHO are already set.
-  if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    file=\"\$0\""
-
-    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
-    $ECHO "\
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-    ECHO=\"$qECHO\"
-  fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's $0 value, followed by "$@".
-lt_option_debug=
-func_parse_lt_options ()
-{
-  lt_script_arg0=\$0
-  shift
-  for lt_opt
-  do
-    case \"\$lt_opt\" in
-    --lt-debug) lt_option_debug=1 ;;
-    --lt-dump-script)
-        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
-        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
-        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
-        cat \"\$lt_dump_D/\$lt_dump_F\"
-        exit 0
-      ;;
-    --lt-*)
-        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
-        exit 1
-      ;;
-    esac
-  done
-
-  # Print the debug banner immediately:
-  if test -n \"\$lt_option_debug\"; then
-    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
-  fi
-}
-
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
-{
-  lt_dump_args_N=1;
-  for lt_arg
-  do
-    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
-    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
-  done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-"
-  case $host in
-  # Backslashes separate directories on plain windows
-  *-*-mingw | *-*-os2* | *-cegcc*)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-    ;;
-
-  *)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-    ;;
-  esac
-  $ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from \$@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
-  case \" \$* \" in
-  *\\ --lt-*)
-    for lt_wr_arg
-    do
-      case \$lt_wr_arg in
-      --lt-*) ;;
-      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-      esac
-      shift
-    done ;;
-  esac
-  func_exec_program_core \${1+\"\$@\"}
-}
-
-  # Parse options
-  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
-
-  # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
-  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
-  # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
-  while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
-
-    # If there was a directory component, then change thisdir.
-    if test \"x\$destdir\" != \"x\$file\"; then
-      case \"\$destdir\" in
-      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
-      *) thisdir=\"\$thisdir/\$destdir\" ;;
-      esac
-    fi
-
-    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
-  done
-
-  # Usually 'no', except on cygwin/mingw when embedded into
-  # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
-  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
-    # special case for '.'
-    if test \"\$thisdir\" = \".\"; then
-      thisdir=\`pwd\`
-    fi
-    # remove .libs from thisdir
-    case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
-    $objdir )   thisdir=. ;;
-    esac
-  fi
-
-  # Try to get the absolute directory name.
-  absdir=\`cd \"\$thisdir\" && pwd\`
-  test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
-	if test "$fast_install" = yes; then
-	  $ECHO "\
-  program=lt-'$outputname'$exeext
-  progdir=\"\$thisdir/$objdir\"
-
-  if test ! -f \"\$progdir/\$program\" ||
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
-       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
-    file=\"\$\$-\$program\"
-
-    if test ! -d \"\$progdir\"; then
-      $MKDIR \"\$progdir\"
-    else
-      $RM \"\$progdir/\$file\"
-    fi"
-
-	  $ECHO "\
-
-    # relink executable if necessary
-    if test -n \"\$relink_command\"; then
-      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
-      else
-	$ECHO \"\$relink_command_output\" >&2
-	$RM \"\$progdir/\$file\"
-	exit 1
-      fi
-    fi
-
-    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
-    { $RM \"\$progdir/\$program\";
-      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
-    $RM \"\$progdir/\$file\"
-  fi"
-	else
-	  $ECHO "\
-  program='$outputname'
-  progdir=\"\$thisdir/$objdir\"
-"
-	fi
-
-	$ECHO "\
-
-  if test -f \"\$progdir/\$program\"; then"
-
-	# fixup the dll searchpath if we need to.
-	#
-	# Fix the DLL searchpath if we need to.  Do this before prepending
-	# to shlibpath, because on Windows, both are PATH and uninstalled
-	# libraries must come first.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
-	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-	  $ECHO "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-	fi
-
-	$ECHO "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-      func_exec_program \${1+\"\$@\"}
-    fi
-  else
-    # The program doesn't exist.
-    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
-    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit 1
-  fi
-fi\
-"
-}
-
-
-# func_emit_cwrapperexe_src
-# emit the source code for a wrapper executable on stdout
-# Must ONLY be called from within func_mode_link because
-# it depends on a number of variable set therein.
-func_emit_cwrapperexe_src ()
-{
-	cat <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-
-   The $output program cannot be directly executed until all the libtool
-   libraries that it depends on are installed.
-
-   This wrapper executable should never be moved out of the build directory.
-   If it is, it will not operate correctly.
-*/
-EOF
-	    cat <<"EOF"
-#ifdef _MSC_VER
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-# include <direct.h>
-# include <process.h>
-# include <io.h>
-#else
-# include <unistd.h>
-# include <stdint.h>
-# ifdef __CYGWIN__
-#  include <io.h>
-# endif
-#endif
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
-# ifdef __STRICT_ANSI__
-int _putenv (const char *);
-# endif
-#elif defined(__CYGWIN__)
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-/* #elif defined (other platforms) ... */
-#endif
-
-/* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-# define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-#  define _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#elif defined(__MINGW32__)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-#elif defined(__CYGWIN__)
-# define HAVE_SETENV
-# define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
-#endif
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH 0
-#endif
-#ifndef S_IXGRP
-# define S_IXGRP 0
-#endif
-
-/* path handling portability macros */
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# define FOPEN_WB "wb"
-# ifndef DIR_SEPARATOR_2
-#  define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-#  define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
-	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#ifndef FOPEN_WB
-# define FOPEN_WB "w"
-#endif
-#ifndef _O_BINARY
-# define _O_BINARY 0
-#endif
-
-#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-#if defined(LT_DEBUGWRAPPER)
-static int lt_debug = 1;
-#else
-static int lt_debug = 0;
-#endif
-
-const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
-
-void *xmalloc (size_t num);
-char *xstrdup (const char *string);
-const char *base_name (const char *name);
-char *find_executable (const char *wrapper);
-char *chase_symlinks (const char *pathspec);
-int make_executable (const char *path);
-int check_executable (const char *path);
-char *strendzap (char *str, const char *pat);
-void lt_debugprintf (const char *file, int line, const char *fmt, ...);
-void lt_fatal (const char *file, int line, const char *message, ...);
-static const char *nonnull (const char *s);
-static const char *nonempty (const char *s);
-void lt_setenv (const char *name, const char *value);
-char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-char **prepare_spawn (char **argv);
-void lt_dump_script (FILE *f);
-EOF
-
-	    cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
-const char * LIB_PATH_VARNAME = "$shlibpath_var";
-EOF
-
-	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_path "$temp_rpath"
-	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
-EOF
-	    else
-	      cat <<"EOF"
-const char * LIB_PATH_VALUE   = "";
-EOF
-	    fi
-
-	    if test -n "$dllsearchpath"; then
-              func_to_host_path "$dllsearchpath:"
-	      cat <<EOF
-const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
-EOF
-	    else
-	      cat <<"EOF"
-const char * EXE_PATH_VARNAME = "";
-const char * EXE_PATH_VALUE   = "";
-EOF
-	    fi
-
-	    if test "$fast_install" = yes; then
-	      cat <<EOF
-const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
-EOF
-	    else
-	      cat <<EOF
-const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
-EOF
-	    fi
-
-
-	    cat <<"EOF"
-
-#define LTWRAPPER_OPTION_PREFIX         "--lt-"
-
-static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
-
-int
-main (int argc, char *argv[])
-{
-  char **newargz;
-  int  newargc;
-  char *tmp_pathspec;
-  char *actual_cwrapper_path;
-  char *actual_cwrapper_name;
-  char *target_name;
-  char *lt_argv_zero;
-  intptr_t rval = 127;
-
-  int i;
-
-  program_name = (char *) xstrdup (base_name (argv[0]));
-  newargz = XMALLOC (char *, argc + 1);
-
-  /* very simple arg parsing; don't want to rely on getopt
-   * also, copy all non cwrapper options to newargz, except
-   * argz[0], which is handled differently
-   */
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
-	{
-EOF
-	    case "$host" in
-	      *mingw* | *cygwin* )
-		# make stdout use "unix" line endings
-		echo "          setmode(1,_O_BINARY);"
-		;;
-	      esac
-
-	    cat <<"EOF"
-	  lt_dump_script (stdout);
-	  return 0;
-	}
-      if (strcmp (argv[i], debug_opt) == 0)
-	{
-          lt_debug = 1;
-          continue;
-	}
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal (__FILE__, __LINE__,
-		    "unrecognized %s option: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-EOF
-	    cat <<EOF
-  /* The GNU banner must be the first non-error debug message */
-  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
-EOF
-	    cat <<"EOF"
-  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
-
-  tmp_pathspec = find_executable (argv[0]);
-  if (tmp_pathspec == NULL)
-    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (before symlink chase) at: %s\n",
-		  tmp_pathspec);
-
-  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (after symlink chase) at: %s\n",
-		  actual_cwrapper_path);
-  XFREE (tmp_pathspec);
-
-  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
-  strendzap (actual_cwrapper_path, actual_cwrapper_name);
-
-  /* wrapper name transforms */
-  strendzap (actual_cwrapper_name, ".exe");
-  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
-  XFREE (actual_cwrapper_name);
-  actual_cwrapper_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  /* target_name transforms -- use actual target program name; might have lt- prefix */
-  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
-  strendzap (target_name, ".exe");
-  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
-  XFREE (target_name);
-  target_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(main) libtool target name: %s\n",
-		  target_name);
-EOF
-
-	    cat <<EOF
-  newargz[0] =
-    XMALLOC (char, (strlen (actual_cwrapper_path) +
-		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
-  strcpy (newargz[0], actual_cwrapper_path);
-  strcat (newargz[0], "$objdir");
-  strcat (newargz[0], "/");
-EOF
-
-	    cat <<"EOF"
-  /* stop here, and copy so we don't have to do this twice */
-  tmp_pathspec = xstrdup (newargz[0]);
-
-  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
-  strcat (newargz[0], actual_cwrapper_name);
-
-  /* DO want the lt- prefix here if it exists, so use target_name */
-  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
-  XFREE (tmp_pathspec);
-  tmp_pathspec = NULL;
-EOF
-
-	    case $host_os in
-	      mingw*)
-	    cat <<"EOF"
-  {
-    char* p;
-    while ((p = strchr (newargz[0], '\\')) != NULL)
-      {
-	*p = '/';
-      }
-    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
-      {
-	*p = '/';
-      }
-  }
-EOF
-	    ;;
-	    esac
-
-	    cat <<"EOF"
-  XFREE (target_name);
-  XFREE (actual_cwrapper_path);
-  XFREE (actual_cwrapper_name);
-
-  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
-  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
-     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
-     because on Windows, both *_VARNAMEs are PATH but uninstalled
-     libraries must come first. */
-  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
-  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
-
-  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
-		  nonnull (lt_argv_zero));
-  for (i = 0; i < newargc; i++)
-    {
-      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
-		      i, nonnull (newargz[i]));
-    }
-
-EOF
-
-	    case $host_os in
-	      mingw*)
-		cat <<"EOF"
-  /* execv doesn't actually work on mingw as expected on unix */
-  newargz = prepare_spawn (newargz);
-  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
-  if (rval == -1)
-    {
-      /* failed to start process */
-      lt_debugprintf (__FILE__, __LINE__,
-		      "(main) failed to launch target \"%s\": %s\n",
-		      lt_argv_zero, nonnull (strerror (errno)));
-      return 127;
-    }
-  return rval;
-EOF
-		;;
-	      *)
-		cat <<"EOF"
-  execv (lt_argv_zero, newargz);
-  return rval; /* =127, but avoids unused variable warning */
-EOF
-		;;
-	    esac
-
-	    cat <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
-  void *p = (void *) malloc (num);
-  if (!p)
-    lt_fatal (__FILE__, __LINE__, "memory exhausted");
-
-  return p;
-}
-
-char *
-xstrdup (const char *string)
-{
-  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
-			  string) : NULL;
-}
-
-const char *
-base_name (const char *name)
-{
-  const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
-    name += 2;
-#endif
-
-  for (base = name; *name; name++)
-    if (IS_DIR_SEPARATOR (*name))
-      base = name + 1;
-  return base;
-}
-
-int
-check_executable (const char *path)
-{
-  struct stat st;
-
-  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
-                  nonempty (path));
-  if ((!path) || (!*path))
-    return 0;
-
-  if ((stat (path, &st) >= 0)
-      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
-    return 1;
-  else
-    return 0;
-}
-
-int
-make_executable (const char *path)
-{
-  int rval = 0;
-  struct stat st;
-
-  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
-                  nonempty (path));
-  if ((!path) || (!*path))
-    return 0;
-
-  if (stat (path, &st) >= 0)
-    {
-      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
-    }
-  return rval;
-}
-
-/* Searches for the full path of the wrapper.  Returns
-   newly allocated full path name if found, NULL otherwise
-   Does not chase symlinks, even on platforms that support them.
-*/
-char *
-find_executable (const char *wrapper)
-{
-  int has_slash = 0;
-  const char *p;
-  const char *p_next;
-  /* static buffer for getcwd */
-  char tmp[LT_PATHMAX + 1];
-  int tmp_len;
-  char *concat_name;
-
-  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
-                  nonempty (wrapper));
-
-  if ((wrapper == NULL) || (*wrapper == '\0'))
-    return NULL;
-
-  /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
-    {
-      concat_name = xstrdup (wrapper);
-      if (check_executable (concat_name))
-	return concat_name;
-      XFREE (concat_name);
-    }
-  else
-    {
-#endif
-      if (IS_DIR_SEPARATOR (wrapper[0]))
-	{
-	  concat_name = xstrdup (wrapper);
-	  if (check_executable (concat_name))
-	    return concat_name;
-	  XFREE (concat_name);
-	}
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-    }
-#endif
-
-  for (p = wrapper; *p; p++)
-    if (*p == '/')
-      {
-	has_slash = 1;
-	break;
-      }
-  if (!has_slash)
-    {
-      /* no slashes; search PATH */
-      const char *path = getenv ("PATH");
-      if (path != NULL)
-	{
-	  for (p = path; *p; p = p_next)
-	    {
-	      const char *q;
-	      size_t p_len;
-	      for (q = p; *q; q++)
-		if (IS_PATH_SEPARATOR (*q))
-		  break;
-	      p_len = q - p;
-	      p_next = (*q == '\0' ? q : q + 1);
-	      if (p_len == 0)
-		{
-		  /* empty path: current directory */
-		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-                              nonnull (strerror (errno)));
-		  tmp_len = strlen (tmp);
-		  concat_name =
-		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-		  memcpy (concat_name, tmp, tmp_len);
-		  concat_name[tmp_len] = '/';
-		  strcpy (concat_name + tmp_len + 1, wrapper);
-		}
-	      else
-		{
-		  concat_name =
-		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
-		  memcpy (concat_name, p, p_len);
-		  concat_name[p_len] = '/';
-		  strcpy (concat_name + p_len + 1, wrapper);
-		}
-	      if (check_executable (concat_name))
-		return concat_name;
-	      XFREE (concat_name);
-	    }
-	}
-      /* not found in PATH; assume curdir */
-    }
-  /* Relative path | not found in path: prepend cwd */
-  if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-              nonnull (strerror (errno)));
-  tmp_len = strlen (tmp);
-  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-  memcpy (concat_name, tmp, tmp_len);
-  concat_name[tmp_len] = '/';
-  strcpy (concat_name + tmp_len + 1, wrapper);
-
-  if (check_executable (concat_name))
-    return concat_name;
-  XFREE (concat_name);
-  return NULL;
-}
-
-char *
-chase_symlinks (const char *pathspec)
-{
-#ifndef S_ISLNK
-  return xstrdup (pathspec);
-#else
-  char buf[LT_PATHMAX];
-  struct stat s;
-  char *tmp_pathspec = xstrdup (pathspec);
-  char *p;
-  int has_symlinks = 0;
-  while (strlen (tmp_pathspec) && !has_symlinks)
-    {
-      lt_debugprintf (__FILE__, __LINE__,
-		      "checking path component for symlinks: %s\n",
-		      tmp_pathspec);
-      if (lstat (tmp_pathspec, &s) == 0)
-	{
-	  if (S_ISLNK (s.st_mode) != 0)
-	    {
-	      has_symlinks = 1;
-	      break;
-	    }
-
-	  /* search backwards for last DIR_SEPARATOR */
-	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
-	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-	    p--;
-	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-	    {
-	      /* no more DIR_SEPARATORS left */
-	      break;
-	    }
-	  *p = '\0';
-	}
-      else
-	{
-	  lt_fatal (__FILE__, __LINE__,
-		    "error accessing file \"%s\": %s",
-		    tmp_pathspec, nonnull (strerror (errno)));
-	}
-    }
-  XFREE (tmp_pathspec);
-
-  if (!has_symlinks)
-    {
-      return xstrdup (pathspec);
-    }
-
-  tmp_pathspec = realpath (pathspec, buf);
-  if (tmp_pathspec == 0)
-    {
-      lt_fatal (__FILE__, __LINE__,
-		"could not follow symlinks for %s", pathspec);
-    }
-  return xstrdup (tmp_pathspec);
-#endif
-}
-
-char *
-strendzap (char *str, const char *pat)
-{
-  size_t len, patlen;
-
-  assert (str != NULL);
-  assert (pat != NULL);
-
-  len = strlen (str);
-  patlen = strlen (pat);
-
-  if (patlen <= len)
-    {
-      str += len - patlen;
-      if (strcmp (str, pat) == 0)
-	*str = '\0';
-    }
-  return str;
-}
-
-void
-lt_debugprintf (const char *file, int line, const char *fmt, ...)
-{
-  va_list args;
-  if (lt_debug)
-    {
-      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
-      va_start (args, fmt);
-      (void) vfprintf (stderr, fmt, args);
-      va_end (args);
-    }
-}
-
-static void
-lt_error_core (int exit_status, const char *file,
-	       int line, const char *mode,
-	       const char *message, va_list ap)
-{
-  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
-  vfprintf (stderr, message, ap);
-  fprintf (stderr, ".\n");
-
-  if (exit_status >= 0)
-    exit (exit_status);
-}
-
-void
-lt_fatal (const char *file, int line, const char *message, ...)
-{
-  va_list ap;
-  va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
-  va_end (ap);
-}
-
-static const char *
-nonnull (const char *s)
-{
-  return s ? s : "(null)";
-}
-
-static const char *
-nonempty (const char *s)
-{
-  return (s && !*s) ? "(empty)" : nonnull (s);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_setenv) setting '%s' to '%s'\n",
-                  nonnull (name), nonnull (value));
-  {
-#ifdef HAVE_SETENV
-    /* always make a copy, for consistency with !HAVE_SETENV */
-    char *str = xstrdup (value);
-    setenv (name, str, 1);
-#else
-    int len = strlen (name) + 1 + strlen (value) + 1;
-    char *str = XMALLOC (char, len);
-    sprintf (str, "%s=%s", name, value);
-    if (putenv (str) != EXIT_SUCCESS)
-      {
-        XFREE (str);
-      }
-#endif
-  }
-}
-
-char *
-lt_extend_str (const char *orig_value, const char *add, int to_end)
-{
-  char *new_value;
-  if (orig_value && *orig_value)
-    {
-      int orig_value_len = strlen (orig_value);
-      int add_len = strlen (add);
-      new_value = XMALLOC (char, add_len + orig_value_len + 1);
-      if (to_end)
-        {
-          strcpy (new_value, orig_value);
-          strcpy (new_value + orig_value_len, add);
-        }
-      else
-        {
-          strcpy (new_value, add);
-          strcpy (new_value + add_len, orig_value);
-        }
-    }
-  else
-    {
-      new_value = xstrdup (add);
-    }
-  return new_value;
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      /* some systems can't cope with a ':'-terminated path #' */
-      int len = strlen (new_value);
-      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
-        {
-          new_value[len-1] = '\0';
-        }
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-void
-lt_update_lib_path (const char *name, const char *value)
-{
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-EOF
-	    case $host_os in
-	      mingw*)
-		cat <<"EOF"
-
-/* Prepares an argument vector before calling spawn().
-   Note that spawn() does not by itself call the command interpreter
-     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
-      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-         GetVersionEx(&v);
-         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
-      }) ? "cmd.exe" : "command.com").
-   Instead it simply concatenates the arguments, separated by ' ', and calls
-   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
-   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
-   special way:
-   - Space and tab are interpreted as delimiters. They are not treated as
-     delimiters if they are surrounded by double quotes: "...".
-   - Unescaped double quotes are removed from the input. Their only effect is
-     that within double quotes, space and tab are treated like normal
-     characters.
-   - Backslashes not followed by double quotes are not special.
-   - But 2*n+1 backslashes followed by a double quote become
-     n backslashes followed by a double quote (n >= 0):
-       \" -> "
-       \\\" -> \"
-       \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-char **
-prepare_spawn (char **argv)
-{
-  size_t argc;
-  char **new_argv;
-  size_t i;
-
-  /* Count number of arguments.  */
-  for (argc = 0; argv[argc] != NULL; argc++)
-    ;
-
-  /* Allocate new argument vector.  */
-  new_argv = XMALLOC (char *, argc + 1);
-
-  /* Put quoted arguments into the new argument vector.  */
-  for (i = 0; i < argc; i++)
-    {
-      const char *string = argv[i];
-
-      if (string[0] == '\0')
-	new_argv[i] = xstrdup ("\"\"");
-      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
-	{
-	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
-	  size_t length;
-	  unsigned int backslashes;
-	  const char *s;
-	  char *quoted_string;
-	  char *p;
-
-	  length = 0;
-	  backslashes = 0;
-	  if (quote_around)
-	    length++;
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		length += backslashes + 1;
-	      length++;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    length += backslashes + 1;
-
-	  quoted_string = XMALLOC (char, length + 1);
-
-	  p = quoted_string;
-	  backslashes = 0;
-	  if (quote_around)
-	    *p++ = '"';
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		{
-		  unsigned int j;
-		  for (j = backslashes + 1; j > 0; j--)
-		    *p++ = '\\';
-		}
-	      *p++ = c;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    {
-	      unsigned int j;
-	      for (j = backslashes; j > 0; j--)
-		*p++ = '\\';
-	      *p++ = '"';
-	    }
-	  *p = '\0';
-
-	  new_argv[i] = quoted_string;
-	}
-      else
-	new_argv[i] = (char *) string;
-    }
-  new_argv[argc] = NULL;
-
-  return new_argv;
-}
-EOF
-		;;
-	    esac
-
-            cat <<"EOF"
-void lt_dump_script (FILE* f)
-{
-EOF
-	    func_emit_wrapper yes |
-	      $SED -n -e '
-s/^\(.\{79\}\)\(..*\)/\1\
-\2/
-h
-s/\([\\"]\)/\\\1/g
-s/$/\\n/
-s/\([^\n]*\).*/  fputs ("\1", f);/p
-g
-D'
-            cat <<"EOF"
-}
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# func_win32_import_lib_p ARG
-# True if ARG is an import lib, as indicated by $file_magic_cmd
-func_win32_import_lib_p ()
-{
-    $opt_debug
-    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
-    *import*) : ;;
-    *) false ;;
-    esac
-}
-
-# func_mode_link arg...
-func_mode_link ()
-{
-    $opt_debug
-    case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-      # It is impossible to link a dll without this setting, and
-      # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
-      # flag for every libtool invocation.
-      # allow_undefined=no
-
-      # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
-      # even a static library is built.  For now, we need to specify
-      # -no-undefined on the libtool link line when we can be certain
-      # that all symbols are satisfied, otherwise we get a static library.
-      allow_undefined=yes
-      ;;
-    *)
-      allow_undefined=yes
-      ;;
-    esac
-    libtool_args=$nonopt
-    base_compile="$nonopt $@"
-    compile_command=$nonopt
-    finalize_command=$nonopt
-
-    compile_rpath=
-    finalize_rpath=
-    compile_shlibpath=
-    finalize_shlibpath=
-    convenience=
-    old_convenience=
-    deplibs=
-    old_deplibs=
-    compiler_flags=
-    linker_flags=
-    dllsearchpath=
-    lib_search_path=`pwd`
-    inst_prefix_dir=
-    new_inherited_linker_flags=
-
-    avoid_version=no
-    bindir=
-    dlfiles=
-    dlprefiles=
-    dlself=no
-    export_dynamic=no
-    export_symbols=
-    export_symbols_regex=
-    generated=
-    libobjs=
-    ltlibs=
-    module=no
-    no_install=no
-    objs=
-    non_pic_objects=
-    precious_files_regex=
-    prefer_static_libs=no
-    preload=no
-    prev=
-    prevarg=
-    release=
-    rpath=
-    xrpath=
-    perm_rpath=
-    temp_rpath=
-    thread_safe=no
-    vinfo=
-    vinfo_number=no
-    weak_libs=
-    single_module="${wl}-single_module"
-    func_infer_tag $base_compile
-
-    # We need to know -static, to get the right output filenames.
-    for arg
-    do
-      case $arg in
-      -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
-	build_old_libs=no
-	break
-	;;
-      -all-static | -static | -static-libtool-libs)
-	case $arg in
-	-all-static)
-	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
-	    func_warning "complete static linking is impossible in this configuration"
-	  fi
-	  if test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	-static)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=built
-	  ;;
-	-static-libtool-libs)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	esac
-	build_libtool_libs=no
-	build_old_libs=yes
-	break
-	;;
-      esac
-    done
-
-    # See if our shared archives depend on static archives.
-    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
-    # Go through the arguments, transforming them on the way.
-    while test "$#" -gt 0; do
-      arg="$1"
-      shift
-      func_quote_for_eval "$arg"
-      qarg=$func_quote_for_eval_unquoted_result
-      func_append libtool_args " $func_quote_for_eval_result"
-
-      # If the previous option needs an argument, assign it.
-      if test -n "$prev"; then
-	case $prev in
-	output)
-	  func_append compile_command " @OUTPUT@"
-	  func_append finalize_command " @OUTPUT@"
-	  ;;
-	esac
-
-	case $prev in
-	bindir)
-	  bindir="$arg"
-	  prev=
-	  continue
-	  ;;
-	dlfiles|dlprefiles)
-	  if test "$preload" = no; then
-	    # Add the symbol object into the linking commands.
-	    func_append compile_command " @SYMFILE@"
-	    func_append finalize_command " @SYMFILE@"
-	    preload=yes
-	  fi
-	  case $arg in
-	  *.la | *.lo) ;;  # We handle these cases below.
-	  force)
-	    if test "$dlself" = no; then
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  self)
-	    if test "$prev" = dlprefiles; then
-	      dlself=yes
-	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
-	      dlself=yes
-	    else
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  *)
-	    if test "$prev" = dlfiles; then
-	      func_append dlfiles " $arg"
-	    else
-	      func_append dlprefiles " $arg"
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  esac
-	  ;;
-	expsyms)
-	  export_symbols="$arg"
-	  test -f "$arg" \
-	    || func_fatal_error "symbol file \`$arg' does not exist"
-	  prev=
-	  continue
-	  ;;
-	expsyms_regex)
-	  export_symbols_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	framework)
-	  case $host in
-	    *-*-darwin*)
-	      case "$deplibs " in
-		*" $qarg.ltframework "*) ;;
-		*) func_append deplibs " $qarg.ltframework" # this is fixed later
-		   ;;
-	      esac
-	      ;;
-	  esac
-	  prev=
-	  continue
-	  ;;
-	inst_prefix)
-	  inst_prefix_dir="$arg"
-	  prev=
-	  continue
-	  ;;
-	objectlist)
-	  if test -f "$arg"; then
-	    save_arg=$arg
-	    moreargs=
-	    for fil in `cat "$save_arg"`
-	    do
-#	      func_append moreargs " $fil"
-	      arg=$fil
-	      # A libtool-controlled object.
-
-	      # Check to see that this really is a libtool object.
-	      if func_lalib_unsafe_p "$arg"; then
-		pic_object=
-		non_pic_object=
-
-		# Read the .lo file
-		func_source "$arg"
-
-		if test -z "$pic_object" ||
-		   test -z "$non_pic_object" ||
-		   test "$pic_object" = none &&
-		   test "$non_pic_object" = none; then
-		  func_fatal_error "cannot find name of object for \`$arg'"
-		fi
-
-		# Extract subdirectory from the argument.
-		func_dirname "$arg" "/" ""
-		xdir="$func_dirname_result"
-
-		if test "$pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  pic_object="$xdir$pic_object"
-
-		  if test "$prev" = dlfiles; then
-		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      func_append dlfiles " $pic_object"
-		      prev=
-		      continue
-		    else
-		      # If libtool objects are unsupported, then we need to preload.
-		      prev=dlprefiles
-		    fi
-		  fi
-
-		  # CHECK ME:  I think I busted this.  -Ossama
-		  if test "$prev" = dlprefiles; then
-		    # Preload the old-style object.
-		    func_append dlprefiles " $pic_object"
-		    prev=
-		  fi
-
-		  # A PIC object.
-		  func_append libobjs " $pic_object"
-		  arg="$pic_object"
-		fi
-
-		# Non-PIC object.
-		if test "$non_pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  non_pic_object="$xdir$non_pic_object"
-
-		  # A standard non-PIC object
-		  func_append non_pic_objects " $non_pic_object"
-		  if test -z "$pic_object" || test "$pic_object" = none ; then
-		    arg="$non_pic_object"
-		  fi
-		else
-		  # If the PIC object exists, use it instead.
-		  # $xdir was prepended to $pic_object above.
-		  non_pic_object="$pic_object"
-		  func_append non_pic_objects " $non_pic_object"
-		fi
-	      else
-		# Only an error if not doing a dry-run.
-		if $opt_dry_run; then
-		  # Extract subdirectory from the argument.
-		  func_dirname "$arg" "/" ""
-		  xdir="$func_dirname_result"
-
-		  func_lo2o "$arg"
-		  pic_object=$xdir$objdir/$func_lo2o_result
-		  non_pic_object=$xdir$func_lo2o_result
-		  func_append libobjs " $pic_object"
-		  func_append non_pic_objects " $non_pic_object"
-	        else
-		  func_fatal_error "\`$arg' is not a valid libtool object"
-		fi
-	      fi
-	    done
-	  else
-	    func_fatal_error "link input file \`$arg' does not exist"
-	  fi
-	  arg=$save_arg
-	  prev=
-	  continue
-	  ;;
-	precious_regex)
-	  precious_files_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	release)
-	  release="-$arg"
-	  prev=
-	  continue
-	  ;;
-	rpath | xrpath)
-	  # We need an absolute path.
-	  case $arg in
-	  [\\/]* | [A-Za-z]:[\\/]*) ;;
-	  *)
-	    func_fatal_error "only absolute run-paths are allowed"
-	    ;;
-	  esac
-	  if test "$prev" = rpath; then
-	    case "$rpath " in
-	    *" $arg "*) ;;
-	    *) func_append rpath " $arg" ;;
-	    esac
-	  else
-	    case "$xrpath " in
-	    *" $arg "*) ;;
-	    *) func_append xrpath " $arg" ;;
-	    esac
-	  fi
-	  prev=
-	  continue
-	  ;;
-	shrext)
-	  shrext_cmds="$arg"
-	  prev=
-	  continue
-	  ;;
-	weak)
-	  func_append weak_libs " $arg"
-	  prev=
-	  continue
-	  ;;
-	xcclinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $qarg"
-	  prev=
-	  func_append compile_command " $qarg"
-	  func_append finalize_command " $qarg"
-	  continue
-	  ;;
-	xcompiler)
-	  func_append compiler_flags " $qarg"
-	  prev=
-	  func_append compile_command " $qarg"
-	  func_append finalize_command " $qarg"
-	  continue
-	  ;;
-	xlinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $wl$qarg"
-	  prev=
-	  func_append compile_command " $wl$qarg"
-	  func_append finalize_command " $wl$qarg"
-	  continue
-	  ;;
-	*)
-	  eval "$prev=\"\$arg\""
-	  prev=
-	  continue
-	  ;;
-	esac
-      fi # test -n "$prev"
-
-      prevarg="$arg"
-
-      case $arg in
-      -all-static)
-	if test -n "$link_static_flag"; then
-	  # See comment for -static flag below, for more details.
-	  func_append compile_command " $link_static_flag"
-	  func_append finalize_command " $link_static_flag"
-	fi
-	continue
-	;;
-
-      -allow-undefined)
-	# FIXME: remove this flag sometime in the future.
-	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
-	;;
-
-      -avoid-version)
-	avoid_version=yes
-	continue
-	;;
-
-      -bindir)
-	prev=bindir
-	continue
-	;;
-
-      -dlopen)
-	prev=dlfiles
-	continue
-	;;
-
-      -dlpreopen)
-	prev=dlprefiles
-	continue
-	;;
-
-      -export-dynamic)
-	export_dynamic=yes
-	continue
-	;;
-
-      -export-symbols | -export-symbols-regex)
-	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	  func_fatal_error "more than one -exported-symbols argument is not allowed"
-	fi
-	if test "X$arg" = "X-export-symbols"; then
-	  prev=expsyms
-	else
-	  prev=expsyms_regex
-	fi
-	continue
-	;;
-
-      -framework)
-	prev=framework
-	continue
-	;;
-
-      -inst-prefix-dir)
-	prev=inst_prefix
-	continue
-	;;
-
-      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
-      # so, if we see these flags be careful not to treat them like -L
-      -L[A-Z][A-Z]*:*)
-	case $with_gcc/$host in
-	no/*-*-irix* | /*-*-irix*)
-	  func_append compile_command " $arg"
-	  func_append finalize_command " $arg"
-	  ;;
-	esac
-	continue
-	;;
-
-      -L*)
-	func_stripname "-L" '' "$arg"
-	if test -z "$func_stripname_result"; then
-	  if test "$#" -gt 0; then
-	    func_fatal_error "require no space between \`-L' and \`$1'"
-	  else
-	    func_fatal_error "need path for \`-L' option"
-	  fi
-	fi
-	func_resolve_sysroot "$func_stripname_result"
-	dir=$func_resolve_sysroot_result
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  absdir=`cd "$dir" && pwd`
-	  test -z "$absdir" && \
-	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
-	  dir="$absdir"
-	  ;;
-	esac
-	case "$deplibs " in
-	*" -L$dir "* | *" $arg "*)
-	  # Will only happen for absolute or sysroot arguments
-	  ;;
-	*)
-	  # Preserve sysroot, but never include relative directories
-	  case $dir in
-	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
-	    *) func_append deplibs " -L$dir" ;;
-	  esac
-	  func_append lib_search_path " $dir"
-	  ;;
-	esac
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$dir:"*) ;;
-	  ::) dllsearchpath=$dir;;
-	  *) func_append dllsearchpath ":$dir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
-	  esac
-	  ;;
-	esac
-	continue
-	;;
-
-      -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
-	    # These systems don't actually have a C or math library (as such)
-	    continue
-	    ;;
-	  *-*-os2*)
-	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C and math libraries are in the System framework
-	    func_append deplibs " System.ltframework"
-	    continue
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  esac
-	elif test "X$arg" = "X-lc_r"; then
-	 case $host in
-	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	   # Do not include libc_r directly, use -pthread flag.
-	   continue
-	   ;;
-	 esac
-	fi
-	func_append deplibs " $arg"
-	continue
-	;;
-
-      -module)
-	module=yes
-	continue
-	;;
-
-      # Tru64 UNIX uses -model [arg] to determine the layout of C++
-      # classes, name mangling, and exception handling.
-      # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot|--sysroot)
-	func_append compiler_flags " $arg"
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-	prev=xcompiler
-	continue
-	;;
-
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	func_append compiler_flags " $arg"
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-	case "$new_inherited_linker_flags " in
-	    *" $arg "*) ;;
-	    * ) func_append new_inherited_linker_flags " $arg" ;;
-	esac
-	continue
-	;;
-
-      -multi_module)
-	single_module="${wl}-multi_module"
-	continue
-	;;
-
-      -no-fast-install)
-	fast_install=no
-	continue
-	;;
-
-      -no-install)
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
-	  # The PATH hackery in wrapper scripts is required on Windows
-	  # and Darwin in order for the loader to find any dlls it needs.
-	  func_warning "\`-no-install' is ignored for $host"
-	  func_warning "assuming \`-no-fast-install' instead"
-	  fast_install=no
-	  ;;
-	*) no_install=yes ;;
-	esac
-	continue
-	;;
-
-      -no-undefined)
-	allow_undefined=no
-	continue
-	;;
-
-      -objectlist)
-	prev=objectlist
-	continue
-	;;
-
-      -o) prev=output ;;
-
-      -precious-files-regex)
-	prev=precious_regex
-	continue
-	;;
-
-      -release)
-	prev=release
-	continue
-	;;
-
-      -rpath)
-	prev=rpath
-	continue
-	;;
-
-      -R)
-	prev=xrpath
-	continue
-	;;
-
-      -R*)
-	func_stripname '-R' '' "$arg"
-	dir=$func_stripname_result
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	=*)
-	  func_stripname '=' '' "$dir"
-	  dir=$lt_sysroot$func_stripname_result
-	  ;;
-	*)
-	  func_fatal_error "only absolute run-paths are allowed"
-	  ;;
-	esac
-	case "$xrpath " in
-	*" $dir "*) ;;
-	*) func_append xrpath " $dir" ;;
-	esac
-	continue
-	;;
-
-      -shared)
-	# The effects of -shared are defined in a previous loop.
-	continue
-	;;
-
-      -shrext)
-	prev=shrext
-	continue
-	;;
-
-      -static | -static-libtool-libs)
-	# The effects of -static are defined in a previous loop.
-	# We used to do the same as -all-static on platforms that
-	# didn't have a PIC flag, but the assumption that the effects
-	# would be equivalent was wrong.  It would break on at least
-	# Digital Unix and AIX.
-	continue
-	;;
-
-      -thread-safe)
-	thread_safe=yes
-	continue
-	;;
-
-      -version-info)
-	prev=vinfo
-	continue
-	;;
-
-      -version-number)
-	prev=vinfo
-	vinfo_number=yes
-	continue
-	;;
-
-      -weak)
-        prev=weak
-	continue
-	;;
-
-      -Wc,*)
-	func_stripname '-Wc,' '' "$arg"
-	args=$func_stripname_result
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-	  func_append arg " $func_quote_for_eval_result"
-	  func_append compiler_flags " $func_quote_for_eval_result"
-	done
-	IFS="$save_ifs"
-	func_stripname ' ' '' "$arg"
-	arg=$func_stripname_result
-	;;
-
-      -Wl,*)
-	func_stripname '-Wl,' '' "$arg"
-	args=$func_stripname_result
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-	  func_append arg " $wl$func_quote_for_eval_result"
-	  func_append compiler_flags " $wl$func_quote_for_eval_result"
-	  func_append linker_flags " $func_quote_for_eval_result"
-	done
-	IFS="$save_ifs"
-	func_stripname ' ' '' "$arg"
-	arg=$func_stripname_result
-	;;
-
-      -Xcompiler)
-	prev=xcompiler
-	continue
-	;;
-
-      -Xlinker)
-	prev=xlinker
-	continue
-	;;
-
-      -XCClinker)
-	prev=xcclinker
-	continue
-	;;
-
-      # -msg_* for osf cc
-      -msg_*)
-	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-
-      # Flags to be passed through unchanged, with rationale:
-      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
-      # -r[0-9][0-9]*        specify processor for the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
-      # +DA*, +DD*           enable 64-bit mode for the HP compiler
-      # -q*                  compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
-      # -F/path              path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
-      # @file                GCC response files
-      # -tp=*                Portland pgcc target processor selection
-      # --sysroot=*          for sysroot support
-      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
-        func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-        func_append compile_command " $arg"
-        func_append finalize_command " $arg"
-        func_append compiler_flags " $arg"
-        continue
-        ;;
-
-      # Some other compiler flag.
-      -* | +*)
-        func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-
-      *.$objext)
-	# A standard object.
-	func_append objs " $arg"
-	;;
-
-      *.lo)
-	# A libtool-controlled object.
-
-	# Check to see that this really is a libtool object.
-	if func_lalib_unsafe_p "$arg"; then
-	  pic_object=
-	  non_pic_object=
-
-	  # Read the .lo file
-	  func_source "$arg"
-
-	  if test -z "$pic_object" ||
-	     test -z "$non_pic_object" ||
-	     test "$pic_object" = none &&
-	     test "$non_pic_object" = none; then
-	    func_fatal_error "cannot find name of object for \`$arg'"
-	  fi
-
-	  # Extract subdirectory from the argument.
-	  func_dirname "$arg" "/" ""
-	  xdir="$func_dirname_result"
-
-	  if test "$pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    pic_object="$xdir$pic_object"
-
-	    if test "$prev" = dlfiles; then
-	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		func_append dlfiles " $pic_object"
-		prev=
-		continue
-	      else
-		# If libtool objects are unsupported, then we need to preload.
-		prev=dlprefiles
-	      fi
-	    fi
-
-	    # CHECK ME:  I think I busted this.  -Ossama
-	    if test "$prev" = dlprefiles; then
-	      # Preload the old-style object.
-	      func_append dlprefiles " $pic_object"
-	      prev=
-	    fi
-
-	    # A PIC object.
-	    func_append libobjs " $pic_object"
-	    arg="$pic_object"
-	  fi
-
-	  # Non-PIC object.
-	  if test "$non_pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    non_pic_object="$xdir$non_pic_object"
-
-	    # A standard non-PIC object
-	    func_append non_pic_objects " $non_pic_object"
-	    if test -z "$pic_object" || test "$pic_object" = none ; then
-	      arg="$non_pic_object"
-	    fi
-	  else
-	    # If the PIC object exists, use it instead.
-	    # $xdir was prepended to $pic_object above.
-	    non_pic_object="$pic_object"
-	    func_append non_pic_objects " $non_pic_object"
-	  fi
-	else
-	  # Only an error if not doing a dry-run.
-	  if $opt_dry_run; then
-	    # Extract subdirectory from the argument.
-	    func_dirname "$arg" "/" ""
-	    xdir="$func_dirname_result"
-
-	    func_lo2o "$arg"
-	    pic_object=$xdir$objdir/$func_lo2o_result
-	    non_pic_object=$xdir$func_lo2o_result
-	    func_append libobjs " $pic_object"
-	    func_append non_pic_objects " $non_pic_object"
-	  else
-	    func_fatal_error "\`$arg' is not a valid libtool object"
-	  fi
-	fi
-	;;
-
-      *.$libext)
-	# An archive.
-	func_append deplibs " $arg"
-	func_append old_deplibs " $arg"
-	continue
-	;;
-
-      *.la)
-	# A libtool-controlled library.
-
-	func_resolve_sysroot "$arg"
-	if test "$prev" = dlfiles; then
-	  # This library was specified with -dlopen.
-	  func_append dlfiles " $func_resolve_sysroot_result"
-	  prev=
-	elif test "$prev" = dlprefiles; then
-	  # The library was specified with -dlpreopen.
-	  func_append dlprefiles " $func_resolve_sysroot_result"
-	  prev=
-	else
-	  func_append deplibs " $func_resolve_sysroot_result"
-	fi
-	continue
-	;;
-
-      # Some other compiler argument.
-      *)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-      esac # arg
-
-      # Now actually substitute the argument into the commands.
-      if test -n "$arg"; then
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-      fi
-    done # argument parsing loop
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prevarg' option requires an argument"
-
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
-      eval arg=\"$export_dynamic_flag_spec\"
-      func_append compile_command " $arg"
-      func_append finalize_command " $arg"
-    fi
-
-    oldlibs=
-    # calculate the name of the file, without its directory
-    func_basename "$output"
-    outputname="$func_basename_result"
-    libobjs_save="$libobjs"
-
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
-    else
-      shlib_search_path=
-    fi
-    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
-    func_dirname "$output" "/" ""
-    output_objdir="$func_dirname_result$objdir"
-    func_to_tool_file "$output_objdir/"
-    tool_output_objdir=$func_to_tool_file_result
-    # Create the object directory.
-    func_mkdir_p "$output_objdir"
-
-    # Determine the type of output
-    case $output in
-    "")
-      func_fatal_help "you must specify an output file"
-      ;;
-    *.$libext) linkmode=oldlib ;;
-    *.lo | *.$objext) linkmode=obj ;;
-    *.la) linkmode=lib ;;
-    *) linkmode=prog ;; # Anything else should be a program.
-    esac
-
-    specialdeplibs=
-
-    libs=
-    # Find all interdependent deplibs by searching for libraries
-    # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
-      if $opt_preserve_dup_deps ; then
-	case "$libs " in
-	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
-	esac
-      fi
-      func_append libs " $deplib"
-    done
-
-    if test "$linkmode" = lib; then
-      libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
-      # Compute libraries that are listed more than once in $predeps
-      # $postdeps and mark them as special (i.e., whose duplicates are
-      # not to be eliminated).
-      pre_post_deps=
-      if $opt_duplicate_compiler_generated_deps; then
-	for pre_post_dep in $predeps $postdeps; do
-	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
-	  esac
-	  func_append pre_post_deps " $pre_post_dep"
-	done
-      fi
-      pre_post_deps=
-    fi
-
-    deplibs=
-    newdependency_libs=
-    newlib_search_path=
-    need_relink=no # whether we're linking any uninstalled libtool libraries
-    notinst_deplibs= # not-installed libtool libraries
-    notinst_path= # paths that contain not-installed libtool libraries
-
-    case $linkmode in
-    lib)
-	passes="conv dlpreopen link"
-	for file in $dlfiles $dlprefiles; do
-	  case $file in
-	  *.la) ;;
-	  *)
-	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
-	    ;;
-	  esac
-	done
-	;;
-    prog)
-	compile_deplibs=
-	finalize_deplibs=
-	alldeplibs=no
-	newdlfiles=
-	newdlprefiles=
-	passes="conv scan dlopen dlpreopen link"
-	;;
-    *)  passes="conv"
-	;;
-    esac
-
-    for pass in $passes; do
-      # The preopen pass in lib mode reverses $deplibs; put it back here
-      # so that -L comes before libs that need it for instance...
-      if test "$linkmode,$pass" = "lib,link"; then
-	## FIXME: Find the place where the list is rebuilt in the wrong
-	##        order, and fix it there properly
-        tmp_deplibs=
-	for deplib in $deplibs; do
-	  tmp_deplibs="$deplib $tmp_deplibs"
-	done
-	deplibs="$tmp_deplibs"
-      fi
-
-      if test "$linkmode,$pass" = "lib,link" ||
-	 test "$linkmode,$pass" = "prog,scan"; then
-	libs="$deplibs"
-	deplibs=
-      fi
-      if test "$linkmode" = prog; then
-	case $pass in
-	dlopen) libs="$dlfiles" ;;
-	dlpreopen) libs="$dlprefiles" ;;
-	link)
-	  libs="$deplibs %DEPLIBS%"
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-	  ;;
-	esac
-      fi
-      if test "$linkmode,$pass" = "lib,dlpreopen"; then
-	# Collect and forward deplibs of preopened libtool libs
-	for lib in $dlprefiles; do
-	  # Ignore non-libtool-libs
-	  dependency_libs=
-	  func_resolve_sysroot "$lib"
-	  case $lib in
-	  *.la)	func_source "$func_resolve_sysroot_result" ;;
-	  esac
-
-	  # Collect preopened libtool deplibs, except any this library
-	  # has declared as weak libs
-	  for deplib in $dependency_libs; do
-	    func_basename "$deplib"
-            deplib_base=$func_basename_result
-	    case " $weak_libs " in
-	    *" $deplib_base "*) ;;
-	    *) func_append deplibs " $deplib" ;;
-	    esac
-	  done
-	done
-	libs="$dlprefiles"
-      fi
-      if test "$pass" = dlopen; then
-	# Collect dlpreopened libraries
-	save_deplibs="$deplibs"
-	deplibs=
-      fi
-
-      for deplib in $libs; do
-	lib=
-	found=no
-	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    func_append compiler_flags " $deplib"
-	    if test "$linkmode" = lib ; then
-		case "$new_inherited_linker_flags " in
-		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
-		esac
-	    fi
-	  fi
-	  continue
-	  ;;
-	-l*)
-	  if test "$linkmode" != lib && test "$linkmode" != prog; then
-	    func_warning "\`-l' is ignored for archives/objects"
-	    continue
-	  fi
-	  func_stripname '-l' '' "$deplib"
-	  name=$func_stripname_result
-	  if test "$linkmode" = lib; then
-	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
-	  else
-	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
-	  fi
-	  for searchdir in $searchdirs; do
-	    for search_ext in .la $std_shrext .so .a; do
-	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
-	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
-		else
-		  found=no
-		fi
-		break 2
-	      fi
-	    done
-	  done
-	  if test "$found" != yes; then
-	    # deplib doesn't seem to be a libtool library
-	    if test "$linkmode,$pass" = "prog,link"; then
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      deplibs="$deplib $deplibs"
-	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    continue
-	  else # deplib is a libtool library
-	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
-	    # We need to do some special things here, and not later.
-	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	      case " $predeps $postdeps " in
-	      *" $deplib "*)
-		if func_lalib_p "$lib"; then
-		  library_names=
-		  old_library=
-		  func_source "$lib"
-		  for l in $old_library $library_names; do
-		    ll="$l"
-		  done
-		  if test "X$ll" = "X$old_library" ; then # only static version available
-		    found=no
-		    func_dirname "$lib" "" "."
-		    ladir="$func_dirname_result"
-		    lib=$ladir/$old_library
-		    if test "$linkmode,$pass" = "prog,link"; then
-		      compile_deplibs="$deplib $compile_deplibs"
-		      finalize_deplibs="$deplib $finalize_deplibs"
-		    else
-		      deplibs="$deplib $deplibs"
-		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-		    fi
-		    continue
-		  fi
-		fi
-		;;
-	      *) ;;
-	      esac
-	    fi
-	  fi
-	  ;; # -l
-	*.ltframework)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    deplibs="$deplib $deplibs"
-	    if test "$linkmode" = lib ; then
-		case "$new_inherited_linker_flags " in
-		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
-		esac
-	    fi
-	  fi
-	  continue
-	  ;;
-	-L*)
-	  case $linkmode in
-	  lib)
-	    deplibs="$deplib $deplibs"
-	    test "$pass" = conv && continue
-	    newdependency_libs="$deplib $newdependency_libs"
-	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
-	    ;;
-	  prog)
-	    if test "$pass" = conv; then
-	      deplibs="$deplib $deplibs"
-	      continue
-	    fi
-	    if test "$pass" = scan; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
-	    ;;
-	  *)
-	    func_warning "\`-L' is ignored for archives/objects"
-	    ;;
-	  esac # linkmode
-	  continue
-	  ;; # -L
-	-R*)
-	  if test "$pass" = link; then
-	    func_stripname '-R' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    dir=$func_resolve_sysroot_result
-	    # Make sure the xrpath contains only unique directories.
-	    case "$xrpath " in
-	    *" $dir "*) ;;
-	    *) func_append xrpath " $dir" ;;
-	    esac
-	  fi
-	  deplibs="$deplib $deplibs"
-	  continue
-	  ;;
-	*.la)
-	  func_resolve_sysroot "$deplib"
-	  lib=$func_resolve_sysroot_result
-	  ;;
-	*.$libext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	    continue
-	  fi
-	  case $linkmode in
-	  lib)
-	    # Linking convenience modules into shared libraries is allowed,
-	    # but linking other static libraries is non-portable.
-	    case " $dlpreconveniencelibs " in
-	    *" $deplib "*) ;;
-	    *)
-	      valid_a_lib=no
-	      case $deplibs_check_method in
-		match_pattern*)
-		  set dummy $deplibs_check_method; shift
-		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
-		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		    valid_a_lib=yes
-		  fi
-		;;
-		pass_all)
-		  valid_a_lib=yes
-		;;
-	      esac
-	      if test "$valid_a_lib" != yes; then
-		echo
-		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because the file extensions .$libext of this argument makes me believe"
-		echo "*** that it is just a static archive that I should not use here."
-	      else
-		echo
-		$ECHO "*** Warning: Linking the shared library $output against the"
-		$ECHO "*** static library $deplib is not portable!"
-		deplibs="$deplib $deplibs"
-	      fi
-	      ;;
-	    esac
-	    continue
-	    ;;
-	  prog)
-	    if test "$pass" != link; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    continue
-	    ;;
-	  esac # linkmode
-	  ;; # *.$libext
-	*.lo | *.$objext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	  elif test "$linkmode" = prog; then
-	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
-	      # If there is no dlopen support or we're linking statically,
-	      # we need to preload.
-	      func_append newdlprefiles " $deplib"
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      func_append newdlfiles " $deplib"
-	    fi
-	  fi
-	  continue
-	  ;;
-	%DEPLIBS%)
-	  alldeplibs=yes
-	  continue
-	  ;;
-	esac # case $deplib
-
-	if test "$found" = yes || test -f "$lib"; then :
-	else
-	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
-	fi
-
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$lib" \
-	  || func_fatal_error "\`$lib' is not a valid libtool archive"
-
-	func_dirname "$lib" "" "."
-	ladir="$func_dirname_result"
-
-	dlname=
-	dlopen=
-	dlpreopen=
-	libdir=
-	library_names=
-	old_library=
-	inherited_linker_flags=
-	# If the library was installed with an old release of libtool,
-	# it will not redefine variables installed, or shouldnotlink
-	installed=yes
-	shouldnotlink=no
-	avoidtemprpath=
-
-
-	# Read the .la file
-	func_source "$lib"
-
-	# Convert "-framework foo" to "foo.ltframework"
-	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
-	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
-	    case " $new_inherited_linker_flags " in
-	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
-	    esac
-	  done
-	fi
-	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	if test "$linkmode,$pass" = "lib,link" ||
-	   test "$linkmode,$pass" = "prog,scan" ||
-	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && func_append dlfiles " $dlopen"
-	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
-	fi
-
-	if test "$pass" = conv; then
-	  # Only check for convenience libraries
-	  deplibs="$lib $deplibs"
-	  if test -z "$libdir"; then
-	    if test -z "$old_library"; then
-	      func_fatal_error "cannot find name of link library for \`$lib'"
-	    fi
-	    # It is a libtool convenience library, so add in its objects.
-	    func_append convenience " $ladir/$objdir/$old_library"
-	    func_append old_convenience " $ladir/$objdir/$old_library"
-	    tmp_libs=
-	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-	      if $opt_preserve_dup_deps ; then
-		case "$tmp_libs " in
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
-		esac
-	      fi
-	      func_append tmp_libs " $deplib"
-	    done
-	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
-	    func_fatal_error "\`$lib' is not a convenience library"
-	  fi
-	  continue
-	fi # $pass = conv
-
-
-	# Get the name of the library we link against.
-	linklib=
-	if test -n "$old_library" &&
-	   { test "$prefer_static_libs" = yes ||
-	     test "$prefer_static_libs,$installed" = "built,no"; }; then
-	  linklib=$old_library
-	else
-	  for l in $old_library $library_names; do
-	    linklib="$l"
-	  done
-	fi
-	if test -z "$linklib"; then
-	  func_fatal_error "cannot find name of link library for \`$lib'"
-	fi
-
-	# This library was specified with -dlopen.
-	if test "$pass" = dlopen; then
-	  if test -z "$libdir"; then
-	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
-	  fi
-	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
-	    # If there is no dlname, no dlopen support or we're linking
-	    # statically, we need to preload.  We also need to preload any
-	    # dependent libraries so libltdl's deplib preloader doesn't
-	    # bomb out in the load deplibs phase.
-	    func_append dlprefiles " $lib $dependency_libs"
-	  else
-	    func_append newdlfiles " $lib"
-	  fi
-	  continue
-	fi # $pass = dlopen
-
-	# We need an absolute path.
-	case $ladir in
-	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
-	*)
-	  abs_ladir=`cd "$ladir" && pwd`
-	  if test -z "$abs_ladir"; then
-	    func_warning "cannot determine absolute directory name of \`$ladir'"
-	    func_warning "passing it literally to the linker, although it might fail"
-	    abs_ladir="$ladir"
-	  fi
-	  ;;
-	esac
-	func_basename "$lib"
-	laname="$func_basename_result"
-
-	# Find the relevant object directory and library name.
-	if test "X$installed" = Xyes; then
-	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    func_warning "library \`$lib' was moved."
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    libdir="$abs_ladir"
-	  else
-	    dir="$lt_sysroot$libdir"
-	    absdir="$lt_sysroot$libdir"
-	  fi
-	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
-	else
-	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
-	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
-	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
-	  fi
-	fi # $installed = yes
-	func_stripname 'lib' '.la' "$laname"
-	name=$func_stripname_result
-
-	# This library was specified with -dlpreopen.
-	if test "$pass" = dlpreopen; then
-	  if test -z "$libdir" && test "$linkmode" = prog; then
-	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
-	  fi
-	  case "$host" in
-	    # special handling for platforms with PE-DLLs.
-	    *cygwin* | *mingw* | *cegcc* )
-	      # Linker will automatically link against shared library if both
-	      # static and shared are present.  Therefore, ensure we extract
-	      # symbols from the import library if a shared library is present
-	      # (otherwise, the dlopen module name will be incorrect).  We do
-	      # this by putting the import library name into $newdlprefiles.
-	      # We recover the dlopen module name by 'saving' the la file
-	      # name in a special purpose variable, and (later) extracting the
-	      # dlname from the la file.
-	      if test -n "$dlname"; then
-	        func_tr_sh "$dir/$linklib"
-	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
-	        func_append newdlprefiles " $dir/$linklib"
-	      else
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      fi
-	    ;;
-	    * )
-	      # Prefer using a static library (so that no silly _DYNAMIC symbols
-	      # are required to link).
-	      if test -n "$old_library"; then
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      # Otherwise, use the dlname, so that lt_dlopen finds it.
-	      elif test -n "$dlname"; then
-	        func_append newdlprefiles " $dir/$dlname"
-	      else
-	        func_append newdlprefiles " $dir/$linklib"
-	      fi
-	    ;;
-	  esac
-	fi # $pass = dlpreopen
-
-	if test -z "$libdir"; then
-	  # Link the convenience library
-	  if test "$linkmode" = lib; then
-	    deplibs="$dir/$old_library $deplibs"
-	  elif test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$dir/$old_library $compile_deplibs"
-	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
-	  else
-	    deplibs="$lib $deplibs" # used for prog,scan pass
-	  fi
-	  continue
-	fi
-
-
-	if test "$linkmode" = prog && test "$pass" != link; then
-	  func_append newlib_search_path " $ladir"
-	  deplibs="$lib $deplibs"
-
-	  linkalldeplibs=no
-	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
-	     test "$build_libtool_libs" = no; then
-	    linkalldeplibs=yes
-	  fi
-
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    case $deplib in
-	    -L*) func_stripname '-L' '' "$deplib"
-	         func_resolve_sysroot "$func_stripname_result"
-	         func_append newlib_search_path " $func_resolve_sysroot_result"
-		 ;;
-	    esac
-	    # Need to link against all dependency_libs?
-	    if test "$linkalldeplibs" = yes; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      # Need to hardcode shared library paths
-	      # or/and link against static libraries
-	      newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    if $opt_preserve_dup_deps ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
-	      esac
-	    fi
-	    func_append tmp_libs " $deplib"
-	  done # for deplib
-	  continue
-	fi # $linkmode = prog...
-
-	if test "$linkmode,$pass" = "prog,link"; then
-	  if test -n "$library_names" &&
-	     { { test "$prefer_static_libs" = no ||
-	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
-	       test -z "$old_library"; }; then
-	    # We need to hardcode the library path
-	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
-	      # Make sure the rpath contains only unique directories.
-	      case "$temp_rpath:" in
-	      *"$absdir:"*) ;;
-	      *) func_append temp_rpath "$absdir:" ;;
-	      esac
-	    fi
-
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
-	      esac
-	      ;;
-	    esac
-	  fi # $linkmode,$pass = prog,link...
-
-	  if test "$alldeplibs" = yes &&
-	     { test "$deplibs_check_method" = pass_all ||
-	       { test "$build_libtool_libs" = yes &&
-		 test -n "$library_names"; }; }; then
-	    # We only need to search for static libraries
-	    continue
-	  fi
-	fi
-
-	link_static=no # Whether the deplib will be linked statically
-	use_static_libs=$prefer_static_libs
-	if test "$use_static_libs" = built && test "$installed" = yes; then
-	  use_static_libs=no
-	fi
-	if test -n "$library_names" &&
-	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
-	  case $host in
-	  *cygwin* | *mingw* | *cegcc*)
-	      # No point in relinking DLLs because paths are not encoded
-	      func_append notinst_deplibs " $lib"
-	      need_relink=no
-	    ;;
-	  *)
-	    if test "$installed" = no; then
-	      func_append notinst_deplibs " $lib"
-	      need_relink=yes
-	    fi
-	    ;;
-	  esac
-	  # This is a shared library
-
-	  # Warn about portability, can't link against -module's on some
-	  # systems (darwin).  Don't bleat about dlopened modules though!
-	  dlopenmodule=""
-	  for dlpremoduletest in $dlprefiles; do
-	    if test "X$dlpremoduletest" = "X$lib"; then
-	      dlopenmodule="$dlpremoduletest"
-	      break
-	    fi
-	  done
-	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    echo
-	    if test "$linkmode" = prog; then
-	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
-	    else
-	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
-	    fi
-	    $ECHO "*** $linklib is not portable!"
-	  fi
-	  if test "$linkmode" = lib &&
-	     test "$hardcode_into_libs" = yes; then
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
-	      esac
-	      ;;
-	    esac
-	  fi
-
-	  if test -n "$old_archive_from_expsyms_cmds"; then
-	    # figure out the soname
-	    set dummy $library_names
-	    shift
-	    realname="$1"
-	    shift
-	    libname=`eval "\\$ECHO \"$libname_spec\""`
-	    # use dlname if we got it. it's perfectly good, no?
-	    if test -n "$dlname"; then
-	      soname="$dlname"
-	    elif test -n "$soname_spec"; then
-	      # bleh windows
-	      case $host in
-	      *cygwin* | mingw* | *cegcc*)
-	        func_arith $current - $age
-		major=$func_arith_result
-		versuffix="-$major"
-		;;
-	      esac
-	      eval soname=\"$soname_spec\"
-	    else
-	      soname="$realname"
-	    fi
-
-	    # Make a new name for the extract_expsyms_cmds to use
-	    soroot="$soname"
-	    func_basename "$soroot"
-	    soname="$func_basename_result"
-	    func_stripname 'lib' '.dll' "$soname"
-	    newlib=libimp-$func_stripname_result.a
-
-	    # If the library has no export list, then create one now
-	    if test -f "$output_objdir/$soname-def"; then :
-	    else
-	      func_verbose "extracting exported symbol list from \`$soname'"
-	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
-	    fi
-
-	    # Create $newlib
-	    if test -f "$output_objdir/$newlib"; then :; else
-	      func_verbose "generating import library for \`$soname'"
-	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
-	    fi
-	    # make sure the library variables are pointing to the new library
-	    dir=$output_objdir
-	    linklib=$newlib
-	  fi # test -n "$old_archive_from_expsyms_cmds"
-
-	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    lib_linked=yes
-	    case $hardcode_action in
-	    immediate | unsupported)
-	      if test "$hardcode_direct" = no; then
-		add="$dir/$linklib"
-		case $host in
-		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
-		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-		    *-*-unixware7*) add_dir="-L$dir" ;;
-		  *-*-darwin* )
-		    # if the lib is a (non-dlopened) module then we can not
-		    # link against it, someone is ignoring the earlier warnings
-		    if /usr/bin/file -L $add 2> /dev/null |
-			 $GREP ": [^:]* bundle" >/dev/null ; then
-		      if test "X$dlopenmodule" != "X$lib"; then
-			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
-			if test -z "$old_library" ; then
-			  echo
-			  echo "*** And there doesn't seem to be a static archive available"
-			  echo "*** The link will probably fail, sorry"
-			else
-			  add="$dir/$old_library"
-			fi
-		      elif test -n "$old_library"; then
-			add="$dir/$old_library"
-		      fi
-		    fi
-		esac
-	      elif test "$hardcode_minus_L" = no; then
-		case $host in
-		*-*-sunos*) add_shlibpath="$dir" ;;
-		esac
-		add_dir="-L$dir"
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = no; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    relink)
-	      if test "$hardcode_direct" = yes &&
-	         test "$hardcode_direct_absolute" = no; then
-		add="$dir/$linklib"
-	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$absdir"
-		# Try looking first in the location we're being installed to.
-		if test -n "$inst_prefix_dir"; then
-		  case $libdir in
-		    [\\/]*)
-		      func_append add_dir " -L$inst_prefix_dir$libdir"
-		      ;;
-		  esac
-		fi
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = yes; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    *) lib_linked=no ;;
-	    esac
-
-	    if test "$lib_linked" != yes; then
-	      func_fatal_configuration "unsupported hardcode properties"
-	    fi
-
-	    if test -n "$add_shlibpath"; then
-	      case :$compile_shlibpath: in
-	      *":$add_shlibpath:"*) ;;
-	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
-	      esac
-	    fi
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	      if test "$hardcode_direct" != yes &&
-		 test "$hardcode_minus_L" != yes &&
-		 test "$hardcode_shlibpath_var" = yes; then
-		case :$finalize_shlibpath: in
-		*":$libdir:"*) ;;
-		*) func_append finalize_shlibpath "$libdir:" ;;
-		esac
-	      fi
-	    fi
-	  fi
-
-	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    # Finalize command for both is simple: just hardcode it.
-	    if test "$hardcode_direct" = yes &&
-	       test "$hardcode_direct_absolute" = no; then
-	      add="$libdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
-	      add="-l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
-	      case :$finalize_shlibpath: in
-	      *":$libdir:"*) ;;
-	      *) func_append finalize_shlibpath "$libdir:" ;;
-	      esac
-	      add="-l$name"
-	    elif test "$hardcode_automatic" = yes; then
-	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
-		add="$inst_prefix_dir$libdir/$linklib"
-	      else
-		add="$libdir/$linklib"
-	      fi
-	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
-	      # Try looking first in the location we're being installed to.
-	      if test -n "$inst_prefix_dir"; then
-		case $libdir in
-		  [\\/]*)
-		    func_append add_dir " -L$inst_prefix_dir$libdir"
-		    ;;
-		esac
-	      fi
-	      add="-l$name"
-	    fi
-
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
-	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	    fi
-	  fi
-	elif test "$linkmode" = prog; then
-	  # Here we assume that one of hardcode_direct or hardcode_minus_L
-	  # is not unsupported.  This is valid on all known static and
-	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
-	    compile_deplibs="$dir/$linklib $compile_deplibs"
-	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
-	  else
-	    compile_deplibs="-l$name -L$dir $compile_deplibs"
-	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
-	  fi
-	elif test "$build_libtool_libs" = yes; then
-	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
-	    # We're trying link a shared library against a static one
-	    # but the system doesn't support it.
-
-	    # Just print a warning and add the library to dependency_libs so
-	    # that the program can be linked against the static library.
-	    echo
-	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    echo "*** I have the capability to make that library automatically link in when"
-	    echo "*** you link to this library.  But I can only do this if you have a"
-	    echo "*** shared version of the library, which you do not appear to have."
-	    if test "$module" = yes; then
-	      echo "*** But as you try to build a module library, libtool will still create "
-	      echo "*** a static module, that should work as long as the dlopening application"
-	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
-	      if test -z "$global_symbol_pipe"; then
-		echo
-		echo "*** However, this would only work if libtool was able to extract symbol"
-		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		echo "*** not find such a program.  So, this module is probably useless."
-		echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	      fi
-	      if test "$build_old_libs" = no; then
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  else
-	    deplibs="$dir/$old_library $deplibs"
-	    link_static=yes
-	  fi
-	fi # link shared/static library?
-
-	if test "$linkmode" = lib; then
-	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
-	       test "$link_static" = yes; }; then
-	    # Extract -R from dependency_libs
-	    temp_deplibs=
-	    for libdir in $dependency_libs; do
-	      case $libdir in
-	      -R*) func_stripname '-R' '' "$libdir"
-	           temp_xrpath=$func_stripname_result
-		   case " $xrpath " in
-		   *" $temp_xrpath "*) ;;
-		   *) func_append xrpath " $temp_xrpath";;
-		   esac;;
-	      *) func_append temp_deplibs " $libdir";;
-	      esac
-	    done
-	    dependency_libs="$temp_deplibs"
-	  fi
-
-	  func_append newlib_search_path " $absdir"
-	  # Link against this library
-	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
-	  # ... and its dependency_libs
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    newdependency_libs="$deplib $newdependency_libs"
-	    case $deplib in
-              -L*) func_stripname '-L' '' "$deplib"
-                   func_resolve_sysroot "$func_stripname_result";;
-              *) func_resolve_sysroot "$deplib" ;;
-            esac
-	    if $opt_preserve_dup_deps ; then
-	      case "$tmp_libs " in
-	      *" $func_resolve_sysroot_result "*)
-                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
-	      esac
-	    fi
-	    func_append tmp_libs " $func_resolve_sysroot_result"
-	  done
-
-	  if test "$link_all_deplibs" != no; then
-	    # Add the search paths of all dependency libraries
-	    for deplib in $dependency_libs; do
-	      path=
-	      case $deplib in
-	      -L*) path="$deplib" ;;
-	      *.la)
-	        func_resolve_sysroot "$deplib"
-	        deplib=$func_resolve_sysroot_result
-	        func_dirname "$deplib" "" "."
-		dir=$func_dirname_result
-		# We need an absolute path.
-		case $dir in
-		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-		*)
-		  absdir=`cd "$dir" && pwd`
-		  if test -z "$absdir"; then
-		    func_warning "cannot determine absolute directory name of \`$dir'"
-		    absdir="$dir"
-		  fi
-		  ;;
-		esac
-		if $GREP "^installed=no" $deplib > /dev/null; then
-		case $host in
-		*-*-darwin*)
-		  depdepl=
-		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-		  if test -n "$deplibrary_names" ; then
-		    for tmp in $deplibrary_names ; do
-		      depdepl=$tmp
-		    done
-		    if test -f "$absdir/$objdir/$depdepl" ; then
-		      depdepl="$absdir/$objdir/$depdepl"
-		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
-                      if test -z "$darwin_install_name"; then
-                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
-                      fi
-		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
-		      path=
-		    fi
-		  fi
-		  ;;
-		*)
-		  path="-L$absdir/$objdir"
-		  ;;
-		esac
-		else
-		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		  test -z "$libdir" && \
-		    func_fatal_error "\`$deplib' is not a valid libtool archive"
-		  test "$absdir" != "$libdir" && \
-		    func_warning "\`$deplib' seems to be moved"
-
-		  path="-L$absdir"
-		fi
-		;;
-	      esac
-	      case " $deplibs " in
-	      *" $path "*) ;;
-	      *) deplibs="$path $deplibs" ;;
-	      esac
-	    done
-	  fi # link_all_deplibs != no
-	fi # linkmode = lib
-      done # for deplib in $libs
-      if test "$pass" = link; then
-	if test "$linkmode" = "prog"; then
-	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
-	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
-	else
-	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	fi
-      fi
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
-	# Link the dlpreopened libraries before other libraries
-	for deplib in $save_deplibs; do
-	  deplibs="$deplib $deplibs"
-	done
-      fi
-      if test "$pass" != dlopen; then
-	if test "$pass" != conv; then
-	  # Make sure lib_search_path contains only unique directories.
-	  lib_search_path=
-	  for dir in $newlib_search_path; do
-	    case "$lib_search_path " in
-	    *" $dir "*) ;;
-	    *) func_append lib_search_path " $dir" ;;
-	    esac
-	  done
-	  newlib_search_path=
-	fi
-
-	if test "$linkmode,$pass" != "prog,link"; then
-	  vars="deplibs"
-	else
-	  vars="compile_deplibs finalize_deplibs"
-	fi
-	for var in $vars dependency_libs; do
-	  # Add libraries to $var in reverse order
-	  eval tmp_libs=\"\$$var\"
-	  new_libs=
-	  for deplib in $tmp_libs; do
-	    # FIXME: Pedantically, this is the right thing to do, so
-	    #        that some nasty dependency loop isn't accidentally
-	    #        broken:
-	    #new_libs="$deplib $new_libs"
-	    # Pragmatically, this seems to cause very few problems in
-	    # practice:
-	    case $deplib in
-	    -L*) new_libs="$deplib $new_libs" ;;
-	    -R*) ;;
-	    *)
-	      # And here is the reason: when a library appears more
-	      # than once as an explicit dependence of a library, or
-	      # is implicitly linked in more than once by the
-	      # compiler, it is considered special, and multiple
-	      # occurrences thereof are not removed.  Compare this
-	      # with having the same library being listed as a
-	      # dependency of multiple other libraries: in this case,
-	      # we know (pedantically, we assume) the library does not
-	      # need to be listed more than once, so we keep only the
-	      # last copy.  This is not always right, but it is rare
-	      # enough that we require users that really mean to play
-	      # such unportable linking tricks to link the library
-	      # using -Wl,-lname, so that libtool does not consider it
-	      # for duplicate removal.
-	      case " $specialdeplibs " in
-	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
-	      *)
-		case " $new_libs " in
-		*" $deplib "*) ;;
-		*) new_libs="$deplib $new_libs" ;;
-		esac
-		;;
-	      esac
-	      ;;
-	    esac
-	  done
-	  tmp_libs=
-	  for deplib in $new_libs; do
-	    case $deplib in
-	    -L*)
-	      case " $tmp_libs " in
-	      *" $deplib "*) ;;
-	      *) func_append tmp_libs " $deplib" ;;
-	      esac
-	      ;;
-	    *) func_append tmp_libs " $deplib" ;;
-	    esac
-	  done
-	  eval $var=\"$tmp_libs\"
-	done # for var
-      fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
-      tmp_libs=
-      for i in $dependency_libs ; do
-	case " $predeps $postdeps $compiler_lib_search_path " in
-	*" $i "*)
-	  i=""
-	  ;;
-	esac
-	if test -n "$i" ; then
-	  func_append tmp_libs " $i"
-	fi
-      done
-      dependency_libs=$tmp_libs
-    done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
-    fi
-    if test "$linkmode" = prog || test "$linkmode" = lib; then
-      dlprefiles="$newdlprefiles"
-    fi
-
-    case $linkmode in
-    oldlib)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for archives"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for archives" ;;
-      esac
-
-      test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for archives"
-
-      test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for archives"
-
-      test -n "$vinfo" && \
-	func_warning "\`-version-info/-version-number' is ignored for archives"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for archives"
-
-      test -n "$export_symbols$export_symbols_regex" && \
-	func_warning "\`-export-symbols' is ignored for archives"
-
-      # Now set the variables for building old libraries.
-      build_libtool_libs=no
-      oldlibs="$output"
-      func_append objs "$old_deplibs"
-      ;;
-
-    lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
-      case $outputname in
-      lib*)
-	func_stripname 'lib' '.la' "$outputname"
-	name=$func_stripname_result
-	eval shared_ext=\"$shrext_cmds\"
-	eval libname=\"$libname_spec\"
-	;;
-      *)
-	test "$module" = no && \
-	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
-
-	if test "$need_lib_prefix" != no; then
-	  # Add the "lib" prefix for modules if required
-	  func_stripname '' '.la' "$outputname"
-	  name=$func_stripname_result
-	  eval shared_ext=\"$shrext_cmds\"
-	  eval libname=\"$libname_spec\"
-	else
-	  func_stripname '' '.la' "$outputname"
-	  libname=$func_stripname_result
-	fi
-	;;
-      esac
-
-      if test -n "$objs"; then
-	if test "$deplibs_check_method" != pass_all; then
-	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
-	else
-	  echo
-	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
-	  $ECHO "*** objects $objs is not portable!"
-	  func_append libobjs " $objs"
-	fi
-      fi
-
-      test "$dlself" != no && \
-	func_warning "\`-dlopen self' is ignored for libtool libraries"
-
-      set dummy $rpath
-      shift
-      test "$#" -gt 1 && \
-	func_warning "ignoring multiple \`-rpath's for a libtool library"
-
-      install_libdir="$1"
-
-      oldlibs=
-      if test -z "$rpath"; then
-	if test "$build_libtool_libs" = yes; then
-	  # Building a libtool convenience library.
-	  # Some compilers have problems with a `.al' extension so
-	  # convenience libraries should have the same extension an
-	  # archive normally would.
-	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
-	  build_libtool_libs=convenience
-	  build_old_libs=yes
-	fi
-
-	test -n "$vinfo" && \
-	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
-
-	test -n "$release" && \
-	  func_warning "\`-release' is ignored for convenience libraries"
-      else
-
-	# Parse the version information argument.
-	save_ifs="$IFS"; IFS=':'
-	set dummy $vinfo 0 0 0
-	shift
-	IFS="$save_ifs"
-
-	test -n "$7" && \
-	  func_fatal_help "too many parameters to \`-version-info'"
-
-	# convert absolute version numbers to libtool ages
-	# this retains compatibility with .la files and attempts
-	# to make the code below a bit more comprehensible
-
-	case $vinfo_number in
-	yes)
-	  number_major="$1"
-	  number_minor="$2"
-	  number_revision="$3"
-	  #
-	  # There are really only two kinds -- those that
-	  # use the current revision as the major version
-	  # and those that subtract age and use age as
-	  # a minor version.  But, then there is irix
-	  # which has an extra 1 added just for fun
-	  #
-	  case $version_type in
-	  # correct linux to gnu/linux during the next big refactor
-	  darwin|linux|osf|windows|none)
-	    func_arith $number_major + $number_minor
-	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_revision"
-	    ;;
-	  freebsd-aout|freebsd-elf|qnx|sunos)
-	    current="$number_major"
-	    revision="$number_minor"
-	    age="0"
-	    ;;
-	  irix|nonstopux)
-	    func_arith $number_major + $number_minor
-	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_minor"
-	    lt_irix_increment=no
-	    ;;
-	  *)
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
-	    ;;
-	  esac
-	  ;;
-	no)
-	  current="$1"
-	  revision="$2"
-	  age="$3"
-	  ;;
-	esac
-
-	# Check that each of the things are valid numbers.
-	case $current in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "CURRENT \`$current' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	case $revision in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "REVISION \`$revision' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	case $age in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "AGE \`$age' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	if test "$age" -gt "$current"; then
-	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	fi
-
-	# Calculate the version variables.
-	major=
-	versuffix=
-	verstring=
-	case $version_type in
-	none) ;;
-
-	darwin)
-	  # Like Linux, but with the current version available in
-	  # verstring for coding it into the library header
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
-	  # Darwin ld doesn't like 0 for these options...
-	  func_arith $current + 1
-	  minor_current=$func_arith_result
-	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
-	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
-	  ;;
-
-	freebsd-aout)
-	  major=".$current"
-	  versuffix=".$current.$revision";
-	  ;;
-
-	freebsd-elf)
-	  major=".$current"
-	  versuffix=".$current"
-	  ;;
-
-	irix | nonstopux)
-	  if test "X$lt_irix_increment" = "Xno"; then
-	    func_arith $current - $age
-	  else
-	    func_arith $current - $age + 1
-	  fi
-	  major=$func_arith_result
-
-	  case $version_type in
-	    nonstopux) verstring_prefix=nonstopux ;;
-	    *)         verstring_prefix=sgi ;;
-	  esac
-	  verstring="$verstring_prefix$major.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$revision
-	  while test "$loop" -ne 0; do
-	    func_arith $revision - $loop
-	    iface=$func_arith_result
-	    func_arith $loop - 1
-	    loop=$func_arith_result
-	    verstring="$verstring_prefix$major.$iface:$verstring"
-	  done
-
-	  # Before this point, $major must not contain `.'.
-	  major=.$major
-	  versuffix="$major.$revision"
-	  ;;
-
-	linux) # correct to gnu/linux during the next big refactor
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
-	  ;;
-
-	osf)
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix=".$current.$age.$revision"
-	  verstring="$current.$age.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$age
-	  while test "$loop" -ne 0; do
-	    func_arith $current - $loop
-	    iface=$func_arith_result
-	    func_arith $loop - 1
-	    loop=$func_arith_result
-	    verstring="$verstring:${iface}.0"
-	  done
-
-	  # Make executables depend on our current version.
-	  func_append verstring ":${current}.0"
-	  ;;
-
-	qnx)
-	  major=".$current"
-	  versuffix=".$current"
-	  ;;
-
-	sunos)
-	  major=".$current"
-	  versuffix=".$current.$revision"
-	  ;;
-
-	windows)
-	  # Use '-' rather than '.', since we only want one
-	  # extension on DOS 8.3 filesystems.
-	  func_arith $current - $age
-	  major=$func_arith_result
-	  versuffix="-$major"
-	  ;;
-
-	*)
-	  func_fatal_configuration "unknown library version type \`$version_type'"
-	  ;;
-	esac
-
-	# Clear the version info if we defaulted, and they specified a release.
-	if test -z "$vinfo" && test -n "$release"; then
-	  major=
-	  case $version_type in
-	  darwin)
-	    # we can't check for "0.0" in archive_cmds due to quoting
-	    # problems, so we reset it completely
-	    verstring=
-	    ;;
-	  *)
-	    verstring="0.0"
-	    ;;
-	  esac
-	  if test "$need_version" = no; then
-	    versuffix=
-	  else
-	    versuffix=".0.0"
-	  fi
-	fi
-
-	# Remove version info from name if versioning should be avoided
-	if test "$avoid_version" = yes && test "$need_version" = no; then
-	  major=
-	  versuffix=
-	  verstring=""
-	fi
-
-	# Check to see if the archive will have undefined symbols.
-	if test "$allow_undefined" = yes; then
-	  if test "$allow_undefined_flag" = unsupported; then
-	    func_warning "undefined symbols not allowed in $host shared libraries"
-	    build_libtool_libs=no
-	    build_old_libs=yes
-	  fi
-	else
-	  # Don't allow undefined symbols.
-	  allow_undefined_flag="$no_undefined_flag"
-	fi
-
-      fi
-
-      func_generate_dlsyms "$libname" "$libname" "yes"
-      func_append libobjs " $symfileobj"
-      test "X$libobjs" = "X " && libobjs=
-
-      if test "$opt_mode" != relink; then
-	# Remove our outputs, but don't remove object files since they
-	# may have been created when compiling PIC objects.
-	removelist=
-	tempremovelist=`$ECHO "$output_objdir/*"`
-	for p in $tempremovelist; do
-	  case $p in
-	    *.$objext | *.gcno)
-	       ;;
-	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
-		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-		 then
-		   continue
-		 fi
-	       fi
-	       func_append removelist " $p"
-	       ;;
-	    *) ;;
-	  esac
-	done
-	test -n "$removelist" && \
-	  func_show_eval "${RM}r \$removelist"
-      fi
-
-      # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	func_append oldlibs " $output_objdir/$libname.$libext"
-
-	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
-      fi
-
-      # Eliminate all temporary directories.
-      #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
-      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
-      #done
-
-      if test -n "$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	temp_xrpath=
-	for libdir in $xrpath; do
-	  func_replace_sysroot "$libdir"
-	  func_append temp_xrpath " -R$func_replace_sysroot_result"
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
-	  esac
-	done
-	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
-	  dependency_libs="$temp_xrpath $dependency_libs"
-	fi
-      fi
-
-      # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
-      dlfiles=
-      for lib in $old_dlfiles; do
-	case " $dlprefiles $dlfiles " in
-	*" $lib "*) ;;
-	*) func_append dlfiles " $lib" ;;
-	esac
-      done
-
-      # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
-      dlprefiles=
-      for lib in $old_dlprefiles; do
-	case "$dlprefiles " in
-	*" $lib "*) ;;
-	*) func_append dlprefiles " $lib" ;;
-	esac
-      done
-
-      if test "$build_libtool_libs" = yes; then
-	if test -n "$rpath"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
-	    # these systems don't actually have a c library (as such)!
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C library is in the System framework
-	    func_append deplibs " System.ltframework"
-	    ;;
-	  *-*-netbsd*)
-	    # Don't link with libc until the a.out ld.so is fixed.
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    ;;
-	  *)
-	    # Add libc to deplibs on all other systems if necessary.
-	    if test "$build_libtool_need_lc" = "yes"; then
-	      func_append deplibs " -lc"
-	    fi
-	    ;;
-	  esac
-	fi
-
-	# Transform deplibs into only deplibs that can be linked in shared.
-	name_save=$name
-	libname_save=$libname
-	release_save=$release
-	versuffix_save=$versuffix
-	major_save=$major
-	# I'm not sure if I'm treating the release correctly.  I think
-	# release should show up in the -l (ie -lgmp5) so we don't want to
-	# add it in twice.  Is that correct?
-	release=""
-	versuffix=""
-	major=""
-	newdeplibs=
-	droppeddeps=no
-	case $deplibs_check_method in
-	pass_all)
-	  # Don't check for shared/static.  Everything works.
-	  # This might be a little naive.  We might want to check
-	  # whether the library exists or not.  But this is on
-	  # osf3 & osf4 and I'm not really sure... Just
-	  # implementing what was already the behavior.
-	  newdeplibs=$deplibs
-	  ;;
-	test_compile)
-	  # This code stresses the "libraries are programs" paradigm to its
-	  # limits. Maybe even breaks it.  We compile a program, linking it
-	  # against the deplibs as a proxy for the library.  Then we can check
-	  # whether they linked in statically or dynamically with ldd.
-	  $opt_dry_run || $RM conftest.c
-	  cat > conftest.c <<EOF
-	  int main() { return 0; }
-EOF
-	  $opt_dry_run || $RM conftest
-	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
-	    ldd_output=`ldd conftest`
-	    for i in $deplibs; do
-	      case $i in
-	      -l*)
-		func_stripname -l '' "$i"
-		name=$func_stripname_result
-		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		  case " $predeps $postdeps " in
-		  *" $i "*)
-		    func_append newdeplibs " $i"
-		    i=""
-		    ;;
-		  esac
-		fi
-		if test -n "$i" ; then
-		  libname=`eval "\\$ECHO \"$libname_spec\""`
-		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-		  set dummy $deplib_matches; shift
-		  deplib_match=$1
-		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    func_append newdeplibs " $i"
-		  else
-		    droppeddeps=yes
-		    echo
-		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    echo "*** I have the capability to make that library automatically link in when"
-		    echo "*** you link to this library.  But I can only do this if you have a"
-		    echo "*** shared version of the library, which I believe you do not have"
-		    echo "*** because a test_compile did reveal that the linker did not use it for"
-		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
-		  fi
-		fi
-		;;
-	      *)
-		func_append newdeplibs " $i"
-		;;
-	      esac
-	    done
-	  else
-	    # Error occurred in the first compile.  Let's try to salvage
-	    # the situation: Compile a separate program for each library.
-	    for i in $deplibs; do
-	      case $i in
-	      -l*)
-		func_stripname -l '' "$i"
-		name=$func_stripname_result
-		$opt_dry_run || $RM conftest
-		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
-		  ldd_output=`ldd conftest`
-		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		    case " $predeps $postdeps " in
-		    *" $i "*)
-		      func_append newdeplibs " $i"
-		      i=""
-		      ;;
-		    esac
-		  fi
-		  if test -n "$i" ; then
-		    libname=`eval "\\$ECHO \"$libname_spec\""`
-		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-		    set dummy $deplib_matches; shift
-		    deplib_match=$1
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      func_append newdeplibs " $i"
-		    else
-		      droppeddeps=yes
-		      echo
-		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      echo "*** I have the capability to make that library automatically link in when"
-		      echo "*** you link to this library.  But I can only do this if you have a"
-		      echo "*** shared version of the library, which you do not appear to have"
-		      echo "*** because a test_compile did reveal that the linker did not use this one"
-		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
-		    fi
-		  fi
-		else
-		  droppeddeps=yes
-		  echo
-		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  echo "*** make it link in!  You will probably need to install it or some"
-		  echo "*** library that it depends on before this library will be fully"
-		  echo "*** functional.  Installing it before continuing would be even better."
-		fi
-		;;
-	      *)
-		func_append newdeplibs " $i"
-		;;
-	      esac
-	    done
-	  fi
-	  ;;
-	file_magic*)
-	  set dummy $deplibs_check_method; shift
-	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    case $a_deplib in
-	    -l*)
-	      func_stripname -l '' "$a_deplib"
-	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval "\\$ECHO \"$libname_spec\""`
-		if test -n "$file_magic_glob"; then
-		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
-		else
-		  libnameglob=$libname
-		fi
-		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  if test "$want_nocaseglob" = yes; then
-		    shopt -s nocaseglob
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		    $nocaseglob
-		  else
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		  fi
-		  for potent_lib in $potential_libs; do
-		      # Follow soft links.
-		      if ls -lLd "$potent_lib" 2>/dev/null |
-			 $GREP " -> " >/dev/null; then
-			continue
-		      fi
-		      # The statement above tries to avoid entering an
-		      # endless loop below, in case of cyclic links.
-		      # We might still enter an endless loop, since a link
-		      # loop can be closed while we follow links,
-		      # but so what?
-		      potlib="$potent_lib"
-		      while test -h "$potlib" 2>/dev/null; do
-			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
-			case $potliblink in
-			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
-			esac
-		      done
-		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
-			 $SED -e 10q |
-			 $EGREP "$file_magic_regex" > /dev/null; then
-			func_append newdeplibs " $a_deplib"
-			a_deplib=""
-			break 2
-		      fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		echo
-		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
-		else
-		  $ECHO "*** with $libname and none of the candidates passed a file format test"
-		  $ECHO "*** using a file magic. Last file checked: $potlib"
-		fi
-	      fi
-	      ;;
-	    *)
-	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
-	      ;;
-	    esac
-	  done # Gone through all deplibs.
-	  ;;
-	match_pattern*)
-	  set dummy $deplibs_check_method; shift
-	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    case $a_deplib in
-	    -l*)
-	      func_stripname -l '' "$a_deplib"
-	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval "\\$ECHO \"$libname_spec\""`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
-		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      func_append newdeplibs " $a_deplib"
-		      a_deplib=""
-		      break 2
-		    fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		echo
-		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
-		else
-		  $ECHO "*** with $libname and none of the candidates passed a file format test"
-		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
-		fi
-	      fi
-	      ;;
-	    *)
-	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
-	      ;;
-	    esac
-	  done # Gone through all deplibs.
-	  ;;
-	none | unknown | *)
-	  newdeplibs=""
-	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
-	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	    for i in $predeps $postdeps ; do
-	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
-	    done
-	  fi
-	  case $tmp_deplibs in
-	  *[!\	\ ]*)
-	    echo
-	    if test "X$deplibs_check_method" = "Xnone"; then
-	      echo "*** Warning: inter-library dependencies are not supported in this platform."
-	    else
-	      echo "*** Warning: inter-library dependencies are not known to be supported."
-	    fi
-	    echo "*** All declared inter-library dependencies are being dropped."
-	    droppeddeps=yes
-	    ;;
-	  esac
-	  ;;
-	esac
-	versuffix=$versuffix_save
-	major=$major_save
-	release=$release_save
-	libname=$libname_save
-	name=$name_save
-
-	case $host in
-	*-*-rhapsody* | *-*-darwin1.[012])
-	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
-	  ;;
-	esac
-
-	if test "$droppeddeps" = yes; then
-	  if test "$module" = yes; then
-	    echo
-	    echo "*** Warning: libtool could not satisfy all declared inter-library"
-	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    echo "*** a static module, that should work as long as the dlopening"
-	    echo "*** application is linked with the -dlopen flag."
-	    if test -z "$global_symbol_pipe"; then
-	      echo
-	      echo "*** However, this would only work if libtool was able to extract symbol"
-	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      echo "*** not find such a program.  So, this module is probably useless."
-	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	    fi
-	    if test "$build_old_libs" = no; then
-	      oldlibs="$output_objdir/$libname.$libext"
-	      build_libtool_libs=module
-	      build_old_libs=yes
-	    else
-	      build_libtool_libs=no
-	    fi
-	  else
-	    echo "*** The inter-library dependencies that have been dropped here will be"
-	    echo "*** automatically added whenever a program is linked with this library"
-	    echo "*** or is declared to -dlopen it."
-
-	    if test "$allow_undefined" = no; then
-	      echo
-	      echo "*** Since this library must not contain undefined symbols,"
-	      echo "*** because either the platform does not support them or"
-	      echo "*** it was explicitly requested with -no-undefined,"
-	      echo "*** libtool will only create a static version of it."
-	      if test "$build_old_libs" = no; then
-		oldlibs="$output_objdir/$libname.$libext"
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  fi
-	fi
-	# Done checking deplibs!
-	deplibs=$newdeplibs
-      fi
-      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
-      case $host in
-	*-*-darwin*)
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  ;;
-      esac
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $deplibs " in
-	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
-	  esac
-	  ;;
-	*) func_append new_libs " $deplib" ;;
-	esac
-      done
-      deplibs="$new_libs"
-
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
-      # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-	# Remove ${wl} instances when linking with ld.
-	# FIXME: should test the right _cmds variable.
-	case $archive_cmds in
-	  *\$LD\ *) wl= ;;
-        esac
-	if test "$hardcode_into_libs" = yes; then
-	  # Hardcode the library paths
-	  hardcode_libdirs=
-	  dep_rpath=
-	  rpath="$finalize_rpath"
-	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
-	  for libdir in $rpath; do
-	    if test -n "$hardcode_libdir_flag_spec"; then
-	      if test -n "$hardcode_libdir_separator"; then
-		func_replace_sysroot "$libdir"
-		libdir=$func_replace_sysroot_result
-		if test -z "$hardcode_libdirs"; then
-		  hardcode_libdirs="$libdir"
-		else
-		  # Just accumulate the unique libdirs.
-		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		    ;;
-		  *)
-		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
-		    ;;
-		  esac
-		fi
-	      else
-		eval flag=\"$hardcode_libdir_flag_spec\"
-		func_append dep_rpath " $flag"
-	      fi
-	    elif test -n "$runpath_var"; then
-	      case "$perm_rpath " in
-	      *" $libdir "*) ;;
-	      *) func_append perm_rpath " $libdir" ;;
-	      esac
-	    fi
-	  done
-	  # Substitute the hardcoded libdirs into the rpath.
-	  if test -n "$hardcode_libdir_separator" &&
-	     test -n "$hardcode_libdirs"; then
-	    libdir="$hardcode_libdirs"
-	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
-	  fi
-	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
-	    # We should set the runpath_var.
-	    rpath=
-	    for dir in $perm_rpath; do
-	      func_append rpath "$dir:"
-	    done
-	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
-	  fi
-	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
-	fi
-
-	shlibpath="$finalize_shlibpath"
-	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
-	if test -n "$shlibpath"; then
-	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
-	fi
-
-	# Get the real and link names of the library.
-	eval shared_ext=\"$shrext_cmds\"
-	eval library_names=\"$library_names_spec\"
-	set dummy $library_names
-	shift
-	realname="$1"
-	shift
-
-	if test -n "$soname_spec"; then
-	  eval soname=\"$soname_spec\"
-	else
-	  soname="$realname"
-	fi
-	if test -z "$dlname"; then
-	  dlname=$soname
-	fi
-
-	lib="$output_objdir/$realname"
-	linknames=
-	for link
-	do
-	  func_append linknames " $link"
-	done
-
-	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
-	test "X$libobjs" = "X " && libobjs=
-
-	delfiles=
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
-	  export_symbols="$output_objdir/$libname.uexp"
-	  func_append delfiles " $export_symbols"
-	fi
-
-	orig_export_symbols=
-	case $host_os in
-	cygwin* | mingw* | cegcc*)
-	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
-	    # exporting using user supplied symfile
-	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
-	      # and it's NOT already a .def file. Must figure out
-	      # which of the given symbols are data symbols and tag
-	      # them as such. So, trigger use of export_symbols_cmds.
-	      # export_symbols gets reassigned inside the "prepare
-	      # the list of exported symbols" if statement, so the
-	      # include_expsyms logic still works.
-	      orig_export_symbols="$export_symbols"
-	      export_symbols=
-	      always_export_symbols=yes
-	    fi
-	  fi
-	  ;;
-	esac
-
-	# Prepare the list of exported symbols
-	if test -z "$export_symbols"; then
-	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-	    func_verbose "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $opt_dry_run || $RM $export_symbols
-	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd1 in $cmds; do
-	      IFS="$save_ifs"
-	      # Take the normal branch if the nm_file_list_spec branch
-	      # doesn't work or if tool conversion is not needed.
-	      case $nm_file_list_spec~$to_tool_file_cmd in
-		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
-		  try_normal_branch=yes
-		  eval cmd=\"$cmd1\"
-		  func_len " $cmd"
-		  len=$func_len_result
-		  ;;
-		*)
-		  try_normal_branch=no
-		  ;;
-	      esac
-	      if test "$try_normal_branch" = yes \
-		 && { test "$len" -lt "$max_cmd_len" \
-		      || test "$max_cmd_len" -le -1; }
-	      then
-		func_show_eval "$cmd" 'exit $?'
-		skipped_export=false
-	      elif test -n "$nm_file_list_spec"; then
-		func_basename "$output"
-		output_la=$func_basename_result
-		save_libobjs=$libobjs
-		save_output=$output
-		output=${output_objdir}/${output_la}.nm
-		func_to_tool_file "$output"
-		libobjs=$nm_file_list_spec$func_to_tool_file_result
-		func_append delfiles " $output"
-		func_verbose "creating $NM input file list: $output"
-		for obj in $save_libobjs; do
-		  func_to_tool_file "$obj"
-		  $ECHO "$func_to_tool_file_result"
-		done > "$output"
-		eval cmd=\"$cmd1\"
-		func_show_eval "$cmd" 'exit $?'
-		output=$save_output
-		libobjs=$save_libobjs
-		skipped_export=false
-	      else
-		# The command line is too long to execute in one step.
-		func_verbose "using reloadable object file for export list..."
-		skipped_export=:
-		# Break out early, otherwise skipped_export may be
-		# set to false by a later but shorter cmd.
-		break
-	      fi
-	    done
-	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
-	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-	fi
-
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  tmp_export_symbols="$export_symbols"
-	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
-	fi
-
-	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
-	  # The given exports_symbols file has to be filtered, so filter it.
-	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	  # 's' commands which not all seds can handle. GNU sed should be fine
-	  # though. Also, the filter scales superlinearly with the number of
-	  # global variables. join(1) would be nice here, but unfortunately
-	  # isn't a blessed tool.
-	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
-	  export_symbols=$output_objdir/$libname.def
-	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-	fi
-
-	tmp_deplibs=
-	for test_deplib in $deplibs; do
-	  case " $convenience " in
-	  *" $test_deplib "*) ;;
-	  *)
-	    func_append tmp_deplibs " $test_deplib"
-	    ;;
-	  esac
-	done
-	deplibs="$tmp_deplibs"
-
-	if test -n "$convenience"; then
-	  if test -n "$whole_archive_flag_spec" &&
-	    test "$compiler_needs_object" = yes &&
-	    test -z "$libobjs"; then
-	    # extract the archives, so we have objects to list.
-	    # TODO: could optimize this to just extract one archive.
-	    whole_archive_flag_spec=
-	  fi
-	  if test -n "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	    test "X$libobjs" = "X " && libobjs=
-	  else
-	    gentop="$output_objdir/${outputname}x"
-	    func_append generated " $gentop"
-
-	    func_extract_archives $gentop $convenience
-	    func_append libobjs " $func_extract_archives_result"
-	    test "X$libobjs" = "X " && libobjs=
-	  fi
-	fi
-
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-	  eval flag=\"$thread_safe_flag_spec\"
-	  func_append linker_flags " $flag"
-	fi
-
-	# Make a backup of the uninstalled library when relinking
-	if test "$opt_mode" = relink; then
-	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
-	fi
-
-	# Do each of the archive commands.
-	if test "$module" = yes && test -n "$module_cmds" ; then
-	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	    eval test_cmds=\"$module_expsym_cmds\"
-	    cmds=$module_expsym_cmds
-	  else
-	    eval test_cmds=\"$module_cmds\"
-	    cmds=$module_cmds
-	  fi
-	else
-	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	    eval test_cmds=\"$archive_expsym_cmds\"
-	    cmds=$archive_expsym_cmds
-	  else
-	    eval test_cmds=\"$archive_cmds\"
-	    cmds=$archive_cmds
-	  fi
-	fi
-
-	if test "X$skipped_export" != "X:" &&
-	   func_len " $test_cmds" &&
-	   len=$func_len_result &&
-	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  :
-	else
-	  # The command line is too long to link in one step, link piecewise
-	  # or, if using GNU ld and skipped_export is not :, use a linker
-	  # script.
-
-	  # Save the value of $output and $libobjs because we want to
-	  # use them later.  If we have whole_archive_flag_spec, we
-	  # want to use save_libobjs as it was before
-	  # whole_archive_flag_spec was expanded, because we can't
-	  # assume the linker understands whole_archive_flag_spec.
-	  # This may have to be revisited, in case too many
-	  # convenience libraries get linked in and end up exceeding
-	  # the spec.
-	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	  fi
-	  save_output=$output
-	  func_basename "$output"
-	  output_la=$func_basename_result
-
-	  # Clear the reloadable object creation command queue and
-	  # initialize k to one.
-	  test_cmds=
-	  concat_cmds=
-	  objlist=
-	  last_robj=
-	  k=1
-
-	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
-	    output=${output_objdir}/${output_la}.lnkscript
-	    func_verbose "creating GNU ld script: $output"
-	    echo 'INPUT (' > $output
-	    for obj in $save_libobjs
-	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
-	    done
-	    echo ')' >> $output
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$func_to_tool_file_result
-	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
-	    output=${output_objdir}/${output_la}.lnk
-	    func_verbose "creating linker input file list: $output"
-	    : > $output
-	    set x $save_libobjs
-	    shift
-	    firstobj=
-	    if test "$compiler_needs_object" = yes; then
-	      firstobj="$1 "
-	      shift
-	    fi
-	    for obj
-	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
-	    done
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
-	  else
-	    if test -n "$save_libobjs"; then
-	      func_verbose "creating reloadable object files..."
-	      output=$output_objdir/$output_la-${k}.$objext
-	      eval test_cmds=\"$reload_cmds\"
-	      func_len " $test_cmds"
-	      len0=$func_len_result
-	      len=$len0
-
-	      # Loop over the list of objects to be linked.
-	      for obj in $save_libobjs
-	      do
-		func_len " $obj"
-		func_arith $len + $func_len_result
-		len=$func_arith_result
-		if test "X$objlist" = X ||
-		   test "$len" -lt "$max_cmd_len"; then
-		  func_append objlist " $obj"
-		else
-		  # The command $test_cmds is almost too long, add a
-		  # command to the queue.
-		  if test "$k" -eq 1 ; then
-		    # The first file doesn't have a previous command to add.
-		    reload_objs=$objlist
-		    eval concat_cmds=\"$reload_cmds\"
-		  else
-		    # All subsequent reloadable object files will link in
-		    # the last one created.
-		    reload_objs="$objlist $last_robj"
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
-		  fi
-		  last_robj=$output_objdir/$output_la-${k}.$objext
-		  func_arith $k + 1
-		  k=$func_arith_result
-		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=" $obj"
-		  func_len " $last_robj"
-		  func_arith $len0 + $func_len_result
-		  len=$func_arith_result
-		fi
-	      done
-	      # Handle the remaining objects by creating one last
-	      # reloadable object file.  All subsequent reloadable object
-	      # files will link in the last one created.
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      reload_objs="$objlist $last_robj"
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
-	      if test -n "$last_robj"; then
-	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
-	      fi
-	      func_append delfiles " $output"
-
-	    else
-	      output=
-	    fi
-
-	    if ${skipped_export-false}; then
-	      func_verbose "generating symbol list for \`$libname.la'"
-	      export_symbols="$output_objdir/$libname.exp"
-	      $opt_dry_run || $RM $export_symbols
-	      libobjs=$output
-	      # Append the command to create the export file.
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
-	      if test -n "$last_robj"; then
-		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
-	      fi
-	    fi
-
-	    test -n "$save_libobjs" &&
-	      func_verbose "creating a temporary reloadable object file: $output"
-
-	    # Loop through the commands generated above and execute them.
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $concat_cmds; do
-	      IFS="$save_ifs"
-	      $opt_silent || {
-		  func_quote_for_expand "$cmd"
-		  eval "func_echo $func_quote_for_expand_result"
-	      }
-	      $opt_dry_run || eval "$cmd" || {
-		lt_exit=$?
-
-		# Restore the uninstalled library and exit
-		if test "$opt_mode" = relink; then
-		  ( cd "$output_objdir" && \
-		    $RM "${realname}T" && \
-		    $MV "${realname}U" "$realname" )
-		fi
-
-		exit $lt_exit
-	      }
-	    done
-	    IFS="$save_ifs"
-
-	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
-	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-
-          if ${skipped_export-false}; then
-	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	      tmp_export_symbols="$export_symbols"
-	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
-	    fi
-
-	    if test -n "$orig_export_symbols"; then
-	      # The given exports_symbols file has to be filtered, so filter it.
-	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	      # 's' commands which not all seds can handle. GNU sed should be fine
-	      # though. Also, the filter scales superlinearly with the number of
-	      # global variables. join(1) would be nice here, but unfortunately
-	      # isn't a blessed tool.
-	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
-	      export_symbols=$output_objdir/$libname.def
-	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-	    fi
-	  fi
-
-	  libobjs=$output
-	  # Restore the value of output.
-	  output=$save_output
-
-	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	    test "X$libobjs" = "X " && libobjs=
-	  fi
-	  # Expand the library linking commands again to reset the
-	  # value of $libobjs for piecewise linking.
-
-	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
-	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	      cmds=$module_expsym_cmds
-	    else
-	      cmds=$module_cmds
-	    fi
-	  else
-	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	      cmds=$archive_expsym_cmds
-	    else
-	      cmds=$archive_cmds
-	    fi
-	  fi
-	fi
-
-	if test -n "$delfiles"; then
-	  # Append the command to remove temporary files to $cmds.
-	  eval cmds=\"\$cmds~\$RM $delfiles\"
-	fi
-
-	# Add any objects from preloaded convenience libraries
-	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
-
-	  func_extract_archives $gentop $dlprefiles
-	  func_append libobjs " $func_extract_archives_result"
-	  test "X$libobjs" = "X " && libobjs=
-	fi
-
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $opt_silent || {
-	    func_quote_for_expand "$cmd"
-	    eval "func_echo $func_quote_for_expand_result"
-	  }
-	  $opt_dry_run || eval "$cmd" || {
-	    lt_exit=$?
-
-	    # Restore the uninstalled library and exit
-	    if test "$opt_mode" = relink; then
-	      ( cd "$output_objdir" && \
-	        $RM "${realname}T" && \
-		$MV "${realname}U" "$realname" )
-	    fi
-
-	    exit $lt_exit
-	  }
-	done
-	IFS="$save_ifs"
-
-	# Restore the uninstalled library and exit
-	if test "$opt_mode" = relink; then
-	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
-
-	  if test -n "$convenience"; then
-	    if test -z "$whole_archive_flag_spec"; then
-	      func_show_eval '${RM}r "$gentop"'
-	    fi
-	  fi
-
-	  exit $EXIT_SUCCESS
-	fi
-
-	# Create links to the real library.
-	for linkname in $linknames; do
-	  if test "$realname" != "$linkname"; then
-	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
-	  fi
-	done
-
-	# If -module or -export-dynamic was specified, set the dlname.
-	if test "$module" = yes || test "$export_dynamic" = yes; then
-	  # On all known operating systems, these are identical.
-	  dlname="$soname"
-	fi
-      fi
-      ;;
-
-    obj)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for objects"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for objects" ;;
-      esac
-
-      test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for objects"
-
-      test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for objects"
-
-      test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for objects"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for objects"
-
-      case $output in
-      *.lo)
-	test -n "$objs$old_deplibs" && \
-	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
-
-	libobj=$output
-	func_lo2o "$libobj"
-	obj=$func_lo2o_result
-	;;
-      *)
-	libobj=
-	obj="$output"
-	;;
-      esac
-
-      # Delete the old objects.
-      $opt_dry_run || $RM $obj $libobj
-
-      # Objects from convenience libraries.  This assumes
-      # single-version convenience libraries.  Whenever we create
-      # different ones for PIC/non-PIC, this we'll have to duplicate
-      # the extraction.
-      reload_conv_objs=
-      gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
-      if test -n "$convenience"; then
-	if test -n "$whole_archive_flag_spec"; then
-	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
-	else
-	  gentop="$output_objdir/${obj}x"
-	  func_append generated " $gentop"
-
-	  func_extract_archives $gentop $convenience
-	  reload_conv_objs="$reload_objs $func_extract_archives_result"
-	fi
-      fi
-
-      # If we're not building shared, we need to use non_pic_objs
-      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
-
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
-      output="$obj"
-      func_execute_cmds "$reload_cmds" 'exit $?'
-
-      # Exit if we aren't doing a library object file.
-      if test -z "$libobj"; then
-	if test -n "$gentop"; then
-	  func_show_eval '${RM}r "$gentop"'
-	fi
-
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$build_libtool_libs" != yes; then
-	if test -n "$gentop"; then
-	  func_show_eval '${RM}r "$gentop"'
-	fi
-
-	# Create an invalid libtool object if no PIC, so that we don't
-	# accidentally link it into a program.
-	# $show "echo timestamp > $libobj"
-	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-	# Only do commands if we really have different PIC objects.
-	reload_objs="$libobjs $reload_conv_objs"
-	output="$libobj"
-	func_execute_cmds "$reload_cmds" 'exit $?'
-      fi
-
-      if test -n "$gentop"; then
-	func_show_eval '${RM}r "$gentop"'
-      fi
-
-      exit $EXIT_SUCCESS
-      ;;
-
-    prog)
-      case $host in
-	*cygwin*) func_stripname '' '.exe' "$output"
-	          output=$func_stripname_result.exe;;
-      esac
-      test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for programs"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for programs"
-
-      test "$preload" = yes \
-        && test "$dlopen_support" = unknown \
-	&& test "$dlopen_self" = unknown \
-	&& test "$dlopen_self_static" = unknown && \
-	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
-
-      case $host in
-      *-*-rhapsody* | *-*-darwin1.[012])
-	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
-	;;
-      esac
-
-      case $host in
-      *-*-darwin*)
-	# Don't allow lazy linking, it breaks C++ global constructors
-	# But is supposedly fixed on 10.4 or later (yay!).
-	if test "$tagname" = CXX ; then
-	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
-	    10.[0123])
-	      func_append compile_command " ${wl}-bind_at_load"
-	      func_append finalize_command " ${wl}-bind_at_load"
-	    ;;
-	  esac
-	fi
-	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	;;
-      esac
-
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $compile_deplibs " in
-	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $compile_deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
-	  esac
-	  ;;
-	*) func_append new_libs " $deplib" ;;
-	esac
-      done
-      compile_deplibs="$new_libs"
-
-
-      func_append compile_command " $compile_deplibs"
-      func_append finalize_command " $finalize_deplibs"
-
-      if test -n "$rpath$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	for libdir in $rpath $xrpath; do
-	  # This is the magic to use -rpath.
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
-	  esac
-	done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) func_append perm_rpath " $libdir" ;;
-	  esac
-	fi
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$libdir:"*) ;;
-	  ::) dllsearchpath=$libdir;;
-	  *) func_append dllsearchpath ":$libdir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
-	  esac
-	  ;;
-	esac
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$finalize_perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) func_append finalize_perm_rpath " $libdir" ;;
-	  esac
-	fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
-      fi
-
-      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
-
-      # template prelinking step
-      if test -n "$prelink_cmds"; then
-	func_execute_cmds "$prelink_cmds" 'exit $?'
-      fi
-
-      wrappers_required=yes
-      case $host in
-      *cegcc* | *mingw32ce*)
-        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
-      *cygwin* | *mingw* )
-        if test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      *)
-        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      esac
-      if test "$wrappers_required" = no; then
-	# Replace the output file specification.
-	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
-	link_command="$compile_command$compile_rpath"
-
-	# We have no uninstalled library dependencies, so finalize right now.
-	exit_status=0
-	func_show_eval "$link_command" 'exit_status=$?'
-
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
-	# Delete the generated files.
-	if test -f "$output_objdir/${outputname}S.${objext}"; then
-	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
-	fi
-
-	exit $exit_status
-      fi
-
-      if test -n "$compile_shlibpath$finalize_shlibpath"; then
-	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
-      fi
-      if test -n "$finalize_shlibpath"; then
-	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
-
-      compile_var=
-      finalize_var=
-      if test -n "$runpath_var"; then
-	if test -n "$perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $perm_rpath; do
-	    func_append rpath "$dir:"
-	  done
-	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-	if test -n "$finalize_perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $finalize_perm_rpath; do
-	    func_append rpath "$dir:"
-	  done
-	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-      fi
-
-      if test "$no_install" = yes; then
-	# We don't need to create a wrapper script.
-	link_command="$compile_var$compile_command$compile_rpath"
-	# Replace the output file specification.
-	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
-	# Delete the old output file.
-	$opt_dry_run || $RM $output
-	# Link the executable and exit
-	func_show_eval "$link_command" 'exit $?'
-
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$hardcode_action" = relink; then
-	# Fast installation is not supported
-	link_command="$compile_var$compile_command$compile_rpath"
-	relink_command="$finalize_var$finalize_command$finalize_rpath"
-
-	func_warning "this platform does not like uninstalled shared libraries"
-	func_warning "\`$output' will be relinked during installation"
-      else
-	if test "$fast_install" != no; then
-	  link_command="$finalize_var$compile_command$finalize_rpath"
-	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
-	  else
-	    # fast_install is set to needless
-	    relink_command=
-	  fi
-	else
-	  link_command="$compile_var$compile_command$compile_rpath"
-	  relink_command="$finalize_var$finalize_command$finalize_rpath"
-	fi
-      fi
-
-      # Replace the output file specification.
-      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
-      # Delete the old output files.
-      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
-      func_show_eval "$link_command" 'exit $?'
-
-      if test -n "$postlink_cmds"; then
-	func_to_tool_file "$output_objdir/$outputname"
-	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	func_execute_cmds "$postlink_cmds" 'exit $?'
-      fi
-
-      # Now create the wrapper script.
-      func_verbose "creating $output"
-
-      # Quote the relink command for shipping.
-      if test -n "$relink_command"; then
-	# Preserve any variables that may affect compiler behavior
-	for var in $variables_saved_for_relink; do
-	  if eval test -z \"\${$var+set}\"; then
-	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-	  elif eval var_value=\$$var; test -z "$var_value"; then
-	    relink_command="$var=; export $var; $relink_command"
-	  else
-	    func_quote_for_eval "$var_value"
-	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-	  fi
-	done
-	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
-      fi
-
-      # Only actually do things if not in dry run mode.
-      $opt_dry_run || {
-	# win32 will think the script is a binary if it has
-	# a .exe suffix, so we strip it off here.
-	case $output in
-	  *.exe) func_stripname '' '.exe' "$output"
-	         output=$func_stripname_result ;;
-	esac
-	# test for cygwin because mv fails w/o .exe extensions
-	case $host in
-	  *cygwin*)
-	    exeext=.exe
-	    func_stripname '' '.exe' "$outputname"
-	    outputname=$func_stripname_result ;;
-	  *) exeext= ;;
-	esac
-	case $host in
-	  *cygwin* | *mingw* )
-	    func_dirname_and_basename "$output" "" "."
-	    output_name=$func_basename_result
-	    output_path=$func_dirname_result
-	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
-	    cwrapper="$output_path/$output_name.exe"
-	    $RM $cwrappersource $cwrapper
-	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
-	    func_emit_cwrapperexe_src > $cwrappersource
-
-	    # The wrapper executable is built using the $host compiler,
-	    # because it contains $host paths and files. If cross-
-	    # compiling, it, like the target executable, must be
-	    # executed on the $host or under an emulation environment.
-	    $opt_dry_run || {
-	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
-	      $STRIP $cwrapper
-	    }
-
-	    # Now, create the wrapper script for func_source use:
-	    func_ltwrapper_scriptname $cwrapper
-	    $RM $func_ltwrapper_scriptname_result
-	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
-	    $opt_dry_run || {
-	      # note: this script will not be executed, so do not chmod.
-	      if test "x$build" = "x$host" ; then
-		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
-	      else
-		func_emit_wrapper no > $func_ltwrapper_scriptname_result
-	      fi
-	    }
-	  ;;
-	  * )
-	    $RM $output
-	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
-
-	    func_emit_wrapper no > $output
-	    chmod +x $output
-	  ;;
-	esac
-      }
-      exit $EXIT_SUCCESS
-      ;;
-    esac
-
-    # See if we need to build an old-fashioned archive.
-    for oldlib in $oldlibs; do
-
-      if test "$build_libtool_libs" = convenience; then
-	oldobjs="$libobjs_save $symfileobj"
-	addlibs="$convenience"
-	build_libtool_libs=no
-      else
-	if test "$build_libtool_libs" = module; then
-	  oldobjs="$libobjs_save"
-	  build_libtool_libs=no
-	else
-	  oldobjs="$old_deplibs $non_pic_objects"
-	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    func_append oldobjs " $symfileobj"
-	  fi
-	fi
-	addlibs="$old_convenience"
-      fi
-
-      if test -n "$addlibs"; then
-	gentop="$output_objdir/${outputname}x"
-	func_append generated " $gentop"
-
-	func_extract_archives $gentop $addlibs
-	func_append oldobjs " $func_extract_archives_result"
-      fi
-
-      # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-	cmds=$old_archive_from_new_cmds
-      else
-
-	# Add any objects from preloaded convenience libraries
-	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
-
-	  func_extract_archives $gentop $dlprefiles
-	  func_append oldobjs " $func_extract_archives_result"
-	fi
-
-	# POSIX demands no paths to be encoded in archives.  We have
-	# to avoid creating archives with duplicate basenames if we
-	# might have to extract them afterwards, e.g., when creating a
-	# static archive out of a convenience library, or when linking
-	# the entirety of a libtool archive into another (currently
-	# not supported by libtool).
-	if (for obj in $oldobjs
-	    do
-	      func_basename "$obj"
-	      $ECHO "$func_basename_result"
-	    done | sort | sort -uc >/dev/null 2>&1); then
-	  :
-	else
-	  echo "copying selected object files to avoid basename conflicts..."
-	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
-	  func_mkdir_p "$gentop"
-	  save_oldobjs=$oldobjs
-	  oldobjs=
-	  counter=1
-	  for obj in $save_oldobjs
-	  do
-	    func_basename "$obj"
-	    objbase="$func_basename_result"
-	    case " $oldobjs " in
-	    " ") oldobjs=$obj ;;
-	    *[\ /]"$objbase "*)
-	      while :; do
-		# Make sure we don't pick an alternate name that also
-		# overlaps.
-		newobj=lt$counter-$objbase
-		func_arith $counter + 1
-		counter=$func_arith_result
-		case " $oldobjs " in
-		*[\ /]"$newobj "*) ;;
-		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
-		esac
-	      done
-	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      func_append oldobjs " $gentop/$newobj"
-	      ;;
-	    *) func_append oldobjs " $obj" ;;
-	    esac
-	  done
-	fi
-	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-	tool_oldlib=$func_to_tool_file_result
-	eval cmds=\"$old_archive_cmds\"
-
-	func_len " $cmds"
-	len=$func_len_result
-	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  cmds=$old_archive_cmds
-	elif test -n "$archiver_list_spec"; then
-	  func_verbose "using command file archive linking..."
-	  for obj in $oldobjs
-	  do
-	    func_to_tool_file "$obj"
-	    $ECHO "$func_to_tool_file_result"
-	  done > $output_objdir/$libname.libcmd
-	  func_to_tool_file "$output_objdir/$libname.libcmd"
-	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
-	  cmds=$old_archive_cmds
-	else
-	  # the command line is too long to link in one step, link in parts
-	  func_verbose "using piecewise archive linking..."
-	  save_RANLIB=$RANLIB
-	  RANLIB=:
-	  objlist=
-	  concat_cmds=
-	  save_oldobjs=$oldobjs
-	  oldobjs=
-	  # Is there a better way of finding the last object in the list?
-	  for obj in $save_oldobjs
-	  do
-	    last_oldobj=$obj
-	  done
-	  eval test_cmds=\"$old_archive_cmds\"
-	  func_len " $test_cmds"
-	  len0=$func_len_result
-	  len=$len0
-	  for obj in $save_oldobjs
-	  do
-	    func_len " $obj"
-	    func_arith $len + $func_len_result
-	    len=$func_arith_result
-	    func_append objlist " $obj"
-	    if test "$len" -lt "$max_cmd_len"; then
-	      :
-	    else
-	      # the above command should be used before it gets too long
-	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
-		RANLIB=$save_RANLIB
-	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-	      objlist=
-	      len=$len0
-	    fi
-	  done
-	  RANLIB=$save_RANLIB
-	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
-	    eval cmds=\"\$concat_cmds\"
-	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
-	fi
-      fi
-      func_execute_cmds "$cmds" 'exit $?'
-    done
-
-    test -n "$generated" && \
-      func_show_eval "${RM}r$generated"
-
-    # Now create the libtool archive.
-    case $output in
-    *.la)
-      old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
-      func_verbose "creating $output"
-
-      # Preserve any variables that may affect compiler behavior
-      for var in $variables_saved_for_relink; do
-	if eval test -z \"\${$var+set}\"; then
-	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-	elif eval var_value=\$$var; test -z "$var_value"; then
-	  relink_command="$var=; export $var; $relink_command"
-	else
-	  func_quote_for_eval "$var_value"
-	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-	fi
-      done
-      # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
-	relink_command=
-      fi
-
-      # Only create the output if not a dry run.
-      $opt_dry_run || {
-	for installed in no yes; do
-	  if test "$installed" = yes; then
-	    if test -z "$install_libdir"; then
-	      break
-	    fi
-	    output="$output_objdir/$outputname"i
-	    # Replace all uninstalled libtool libraries with the installed ones
-	    newdependency_libs=
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      *.la)
-		func_basename "$deplib"
-		name="$func_basename_result"
-		func_resolve_sysroot "$deplib"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
-		;;
-	      -L*)
-		func_stripname -L '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -L$func_replace_sysroot_result"
-		;;
-	      -R*)
-		func_stripname -R '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -R$func_replace_sysroot_result"
-		;;
-	      *) func_append newdependency_libs " $deplib" ;;
-	      esac
-	    done
-	    dependency_libs="$newdependency_libs"
-	    newdlfiles=
-
-	    for lib in $dlfiles; do
-	      case $lib in
-	      *.la)
-	        func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
-		;;
-	      *) func_append newdlfiles " $lib" ;;
-	      esac
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-	      *.la)
-		# Only pass preopened files to the pseudo-archive (for
-		# eventual linking with the app. that links it) if we
-		# didn't already link the preopened objects directly into
-		# the library:
-		func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
-		;;
-	      esac
-	    done
-	    dlprefiles="$newdlprefiles"
-	  else
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      func_append newdlfiles " $abs"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      func_append newdlprefiles " $abs"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  fi
-	  $RM $output
-	  # place dlname in correct position for cygwin
-	  # In fact, it would be nice if we could use this code for all target
-	  # systems that can't hard-code library paths into their executables
-	  # and that have no shared library path variable independent of PATH,
-	  # but it turns out we can't easily determine that from inspecting
-	  # libtool variables, so we have to hard-code the OSs to which it
-	  # applies here; at the moment, that means platforms that use the PE
-	  # object format with DLL files.  See the long comment at the top of
-	  # tests/bindir.at for full details.
-	  tdlname=$dlname
-	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
-	      # If a -bindir argument was supplied, place the dll there.
-	      if test "x$bindir" != x ;
-	      then
-		func_relative_path "$install_libdir" "$bindir"
-		tdlname=$func_relative_path_result$dlname
-	      else
-		# Otherwise fall back on heuristic.
-		tdlname=../bin/$dlname
-	      fi
-	      ;;
-	  esac
-	  $ECHO > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags='$new_inherited_linker_flags'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Names of additional weak libraries provided by this library
-weak_library_names='$weak_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
-	  if test "$installed" = no && test "$need_relink" = yes; then
-	    $ECHO >> $output "\
-relink_command=\"$relink_command\""
-	  fi
-	done
-      }
-
-      # Do a symbolic link so that the libtool archive can be found in
-      # LD_LIBRARY_PATH before the program is installed.
-      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
-      ;;
-    esac
-    exit $EXIT_SUCCESS
-}
-
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
-    func_mode_link ${1+"$@"}
-
-
-# func_mode_uninstall arg...
-func_mode_uninstall ()
-{
-    $opt_debug
-    RM="$nonopt"
-    files=
-    rmforce=
-    exit_status=0
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case $arg in
-      -f) func_append RM " $arg"; rmforce=yes ;;
-      -*) func_append RM " $arg" ;;
-      *) func_append files " $arg" ;;
-      esac
-    done
-
-    test -z "$RM" && \
-      func_fatal_help "you must specify an RM program"
-
-    rmdirs=
-
-    for file in $files; do
-      func_dirname "$file" "" "."
-      dir="$func_dirname_result"
-      if test "X$dir" = X.; then
-	odir="$objdir"
-      else
-	odir="$dir/$objdir"
-      fi
-      func_basename "$file"
-      name="$func_basename_result"
-      test "$opt_mode" = uninstall && odir="$dir"
-
-      # Remember odir for removal later, being careful to avoid duplicates
-      if test "$opt_mode" = clean; then
-	case " $rmdirs " in
-	  *" $odir "*) ;;
-	  *) func_append rmdirs " $odir" ;;
-	esac
-      fi
-
-      # Don't error if the file doesn't exist and rm -f was used.
-      if { test -L "$file"; } >/dev/null 2>&1 ||
-	 { test -h "$file"; } >/dev/null 2>&1 ||
-	 test -f "$file"; then
-	:
-      elif test -d "$file"; then
-	exit_status=1
-	continue
-      elif test "$rmforce" = yes; then
-	continue
-      fi
-
-      rmfiles="$file"
-
-      case $name in
-      *.la)
-	# Possibly a libtool archive, so verify it.
-	if func_lalib_p "$file"; then
-	  func_source $dir/$name
-
-	  # Delete the libtool libraries and symlinks.
-	  for n in $library_names; do
-	    func_append rmfiles " $odir/$n"
-	  done
-	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
-
-	  case "$opt_mode" in
-	  clean)
-	    case " $library_names " in
-	    *" $dlname "*) ;;
-	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
-	    esac
-	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
-	    ;;
-	  uninstall)
-	    if test -n "$library_names"; then
-	      # Do each command in the postuninstall commands.
-	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-	    fi
-
-	    if test -n "$old_library"; then
-	      # Do each command in the old_postuninstall commands.
-	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-	    fi
-	    # FIXME: should reinstall the best remaining shared library.
-	    ;;
-	  esac
-	fi
-	;;
-
-      *.lo)
-	# Possibly a libtool object, so verify it.
-	if func_lalib_p "$file"; then
-
-	  # Read the .lo file
-	  func_source $dir/$name
-
-	  # Add PIC object to the list of files to remove.
-	  if test -n "$pic_object" &&
-	     test "$pic_object" != none; then
-	    func_append rmfiles " $dir/$pic_object"
-	  fi
-
-	  # Add non-PIC object to the list of files to remove.
-	  if test -n "$non_pic_object" &&
-	     test "$non_pic_object" != none; then
-	    func_append rmfiles " $dir/$non_pic_object"
-	  fi
-	fi
-	;;
-
-      *)
-	if test "$opt_mode" = clean ; then
-	  noexename=$name
-	  case $file in
-	  *.exe)
-	    func_stripname '' '.exe' "$file"
-	    file=$func_stripname_result
-	    func_stripname '' '.exe' "$name"
-	    noexename=$func_stripname_result
-	    # $file with .exe has already been added to rmfiles,
-	    # add $file without .exe
-	    func_append rmfiles " $file"
-	    ;;
-	  esac
-	  # Do a test to see if this is a libtool program.
-	  if func_ltwrapper_p "$file"; then
-	    if func_ltwrapper_executable_p "$file"; then
-	      func_ltwrapper_scriptname "$file"
-	      relink_command=
-	      func_source $func_ltwrapper_scriptname_result
-	      func_append rmfiles " $func_ltwrapper_scriptname_result"
-	    else
-	      relink_command=
-	      func_source $dir/$noexename
-	    fi
-
-	    # note $name still contains .exe if it was in $file originally
-	    # as does the version of $file that was added into $rmfiles
-	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
-	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      func_append rmfiles " $odir/lt-$name"
-	    fi
-	    if test "X$noexename" != "X$name" ; then
-	      func_append rmfiles " $odir/lt-${noexename}.c"
-	    fi
-	  fi
-	fi
-	;;
-      esac
-      func_show_eval "$RM $rmfiles" 'exit_status=1'
-    done
-
-    # Try to remove the ${objdir}s in the directories where we deleted files
-    for dir in $rmdirs; do
-      if test -d "$dir"; then
-	func_show_eval "rmdir $dir >/dev/null 2>&1"
-      fi
-    done
-
-    exit $exit_status
-}
-
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
-    func_mode_uninstall ${1+"$@"}
-
-test -z "$opt_mode" && {
-  help="$generic_help"
-  func_fatal_help "you must specify a MODE"
-}
-
-test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$opt_mode'"
-
-if test -n "$exec_cmd"; then
-  eval exec "$exec_cmd"
-  exit $EXIT_FAILURE
-fi
-
-exit $exit_status
-
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them.  This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration.  But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
-# vi:sw=2
-
diff --git a/m4/libtool.m4 b/m4/libtool.m4
deleted file mode 100644
index d7c043f..0000000
--- a/m4/libtool.m4
+++ /dev/null
@@ -1,7997 +0,0 @@
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-# 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.
-
-m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-])
-
-# serial 57 LT_INIT
-
-
-# LT_PREREQ(VERSION)
-# ------------------
-# Complain and exit if this libtool version is less that VERSION.
-m4_defun([LT_PREREQ],
-[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
-       [m4_default([$3],
-		   [m4_fatal([Libtool version $1 or higher is required],
-		             63)])],
-       [$2])])
-
-
-# _LT_CHECK_BUILDDIR
-# ------------------
-# Complain if the absolute build directory name contains unusual characters
-m4_defun([_LT_CHECK_BUILDDIR],
-[case `pwd` in
-  *\ * | *\	*)
-    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
-esac
-])
-
-
-# LT_INIT([OPTIONS])
-# ------------------
-AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-AC_BEFORE([$0], [LT_LANG])dnl
-AC_BEFORE([$0], [LT_OUTPUT])dnl
-AC_BEFORE([$0], [LTDL_INIT])dnl
-m4_require([_LT_CHECK_BUILDDIR])dnl
-
-dnl Autoconf doesn't catch unexpanded LT_ macros by default:
-m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
-m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
-dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
-dnl unless we require an AC_DEFUNed macro:
-AC_REQUIRE([LTOPTIONS_VERSION])dnl
-AC_REQUIRE([LTSUGAR_VERSION])dnl
-AC_REQUIRE([LTVERSION_VERSION])dnl
-AC_REQUIRE([LTOBSOLETE_VERSION])dnl
-m4_require([_LT_PROG_LTMAIN])dnl
-
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
-dnl Parse OPTIONS
-_LT_SET_OPTIONS([$0], [$1])
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-_LT_SETUP
-
-# Only expand once:
-m4_define([LT_INIT])
-])# LT_INIT
-
-# Old names:
-AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
-AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
-dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-m4_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 "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-])
-
-
-# _LT_FILEUTILS_DEFAULTS
-# ----------------------
-# It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
-m4_defun([_LT_FILEUTILS_DEFAULTS],
-[: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-])# _LT_FILEUTILS_DEFAULTS
-
-
-# _LT_SETUP
-# ---------
-m4_defun([_LT_SETUP],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
-_LT_DECL([], [host_alias], [0], [The host system])dnl
-_LT_DECL([], [host], [0])dnl
-_LT_DECL([], [host_os], [0])dnl
-dnl
-_LT_DECL([], [build_alias], [0], [The build system])dnl
-_LT_DECL([], [build], [0])dnl
-_LT_DECL([], [build_os], [0])dnl
-dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-test -z "$LN_S" && LN_S="ln -s"
-_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
-dnl
-AC_REQUIRE([LT_CMD_MAX_LEN])dnl
-_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
-_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
-dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
-m4_require([_LT_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
-
-_LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-])
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-_LT_CHECK_OBJDIR
-
-m4_require([_LT_TAG_COMPILER])dnl
-
-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
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    _LT_PATH_MAGIC
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-LT_SUPPORTED_TAG([CC])
-_LT_LANG_C_CONFIG
-_LT_LANG_DEFAULT_CONFIG
-_LT_CONFIG_COMMANDS
-])# _LT_SETUP
-
-
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-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 delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
-# _LT_PROG_LTMAIN
-# ---------------
-# Note that this code is called both from `configure', and `config.status'
-# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
-# so we pass a copy along to make sure it has a sensible value anyway.
-m4_defun([_LT_PROG_LTMAIN],
-[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
-_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
-])# _LT_PROG_LTMAIN
-
-
-## ------------------------------------- ##
-## Accumulate code for creating libtool. ##
-## ------------------------------------- ##
-
-# So that we can recreate a full libtool script including additional
-# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
-# label.
-
-
-# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
-# ----------------------------------------
-# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL_INIT],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_INIT])
-
-
-# _LT_CONFIG_LIBTOOL([COMMANDS])
-# ------------------------------
-# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
-
-
-# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
-# -----------------------------------------------------
-m4_defun([_LT_CONFIG_SAVE_COMMANDS],
-[_LT_CONFIG_LIBTOOL([$1])
-_LT_CONFIG_LIBTOOL_INIT([$2])
-])
-
-
-# _LT_FORMAT_COMMENT([COMMENT])
-# -----------------------------
-# Add leading comment marks to the start of each line, and a trailing
-# full-stop to the whole comment if one is not present already.
-m4_define([_LT_FORMAT_COMMENT],
-[m4_ifval([$1], [
-m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
-              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
-)])
-
-
-
-## ------------------------ ##
-## FIXME: Eliminate VARNAME ##
-## ------------------------ ##
-
-
-# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
-# -------------------------------------------------------------------
-# CONFIGNAME is the name given to the value in the libtool script.
-# VARNAME is the (base) name used in the configure script.
-# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
-# VARNAME.  Any other value will be used directly.
-m4_define([_LT_DECL],
-[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
-    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
-	[m4_ifval([$1], [$1], [$2])])
-    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
-    m4_ifval([$4],
-	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
-    lt_dict_add_subkey([lt_decl_dict], [$2],
-	[tagged?], [m4_ifval([$5], [yes], [no])])])
-])
-
-
-# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
-# --------------------------------------------------------
-m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
-
-
-# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_tag_varnames],
-[_lt_decl_filter([tagged?], [yes], $@)])
-
-
-# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
-# ---------------------------------------------------------
-m4_define([_lt_decl_filter],
-[m4_case([$#],
-  [0], [m4_fatal([$0: too few arguments: $#])],
-  [1], [m4_fatal([$0: too few arguments: $#: $1])],
-  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
-  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
-  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
-])
-
-
-# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
-# --------------------------------------------------
-m4_define([lt_decl_quote_varnames],
-[_lt_decl_filter([value], [1], $@)])
-
-
-# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_dquote_varnames],
-[_lt_decl_filter([value], [2], $@)])
-
-
-# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
-    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
-    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
-
-
-# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_all_varnames],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_if([$2], [],
-	   m4_quote(lt_decl_varnames),
-	m4_quote(m4_shift($@))))[]dnl
-])
-m4_define([_lt_decl_all_varnames],
-[lt_join($@, lt_decl_varnames_tagged([$1],
-			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
-])
-
-
-# _LT_CONFIG_STATUS_DECLARE([VARNAME])
-# ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
-# must have a single quote delimited value for this to work.
-m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
-
-
-# _LT_CONFIG_STATUS_DECLARATIONS
-# ------------------------------
-# We delimit libtool config variables with single quotes, so when
-# we write them to config.status, we have to be sure to quote all
-# embedded single quotes properly.  In configure, this macro expands
-# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
-#
-#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
-m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
-    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAGS
-# ----------------
-# Output comment and list of tags supported by the script
-m4_defun([_LT_LIBTOOL_TAGS],
-[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
-])
-
-
-# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
-# -----------------------------------
-# Extract the dictionary values for VARNAME (optionally with TAG) and
-# expand to a commented shell variable setting:
-#
-#    # Some comment about what VAR is for.
-#    visible_name=$lt_internal_name
-m4_define([_LT_LIBTOOL_DECLARE],
-[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
-					   [description])))[]dnl
-m4_pushdef([_libtool_name],
-    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
-m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
-    [0], [_libtool_name=[$]$1],
-    [1], [_libtool_name=$lt_[]$1],
-    [2], [_libtool_name=$lt_[]$1],
-    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
-m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
-])
-
-
-# _LT_LIBTOOL_CONFIG_VARS
-# -----------------------
-# Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
-# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
-# section) are produced by _LT_LIBTOOL_TAG_VARS.
-m4_defun([_LT_LIBTOOL_CONFIG_VARS],
-[m4_foreach([_lt_var],
-    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAG_VARS(TAG)
-# -------------------------
-m4_define([_LT_LIBTOOL_TAG_VARS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
-
-
-# _LT_TAGVAR(VARNAME, [TAGNAME])
-# ------------------------------
-m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
-
-
-# _LT_CONFIG_COMMANDS
-# -------------------
-# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
-# variables for single and double quote escaping we saved from calls
-# to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
-# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
-m4_defun([_LT_CONFIG_COMMANDS],
-[AC_PROVIDE_IFELSE([LT_OUTPUT],
-	dnl If the libtool generation code has been placed in $CONFIG_LT,
-	dnl instead of duplicating it all over again into config.status,
-	dnl then we will have config.status run $CONFIG_LT later, so it
-	dnl needs to know what name is stored there:
-        [AC_CONFIG_COMMANDS([libtool],
-            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
-    dnl If the libtool generation code is destined for config.status,
-    dnl expand the accumulated commands and init code now:
-    [AC_CONFIG_COMMANDS([libtool],
-        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
-])#_LT_CONFIG_COMMANDS
-
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
-[
-
-# 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
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-_LT_CONFIG_STATUS_DECLARATIONS
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-_LT_OUTPUT_LIBTOOL_INIT
-])
-
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script.  The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
-
-# LT_OUTPUT
-# ---------
-# This macro allows early generation of the libtool script (before
-# AC_OUTPUT is called), incase it is used in configure for compilation
-# tests.
-AC_DEFUN([LT_OUTPUT],
-[: ${CONFIG_LT=./config.lt}
-AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-lt_cl_silent=false
-exec AS_MESSAGE_LOG_FD>>config.log
-{
-  echo
-  AS_BOX([Running $as_me.])
-} >&AS_MESSAGE_LOG_FD
-
-lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
-for use in further configure time tests before the real libtool is
-generated.
-
-Usage: $[0] [[OPTIONS]]
-
-  -h, --help      print this help, then exit
-  -V, --version   print version number, then exit
-  -q, --quiet     do not print progress messages
-  -d, --debug     don't remove temporary files
-
-Report bugs to <bug-libtool at gnu.org>."
-
-lt_cl_version="\
-m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
-m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by $[0], generated by m4_PACKAGE_STRING.
-
-Copyright (C) 2011 Free Software Foundation, Inc.
-This config.lt script is free software; the Free Software Foundation
-gives unlimited permision to copy, distribute and modify it."
-
-while test $[#] != 0
-do
-  case $[1] in
-    --version | --v* | -V )
-      echo "$lt_cl_version"; exit 0 ;;
-    --help | --h* | -h )
-      echo "$lt_cl_help"; exit 0 ;;
-    --debug | --d* | -d )
-      debug=: ;;
-    --quiet | --q* | --silent | --s* | -q )
-      lt_cl_silent=: ;;
-
-    -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
-
-    *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
-  esac
-  shift
-done
-
-if $lt_cl_silent; then
-  exec AS_MESSAGE_FD>/dev/null
-fi
-_LTEOF
-
-cat >>"$CONFIG_LT" <<_LTEOF
-_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AC_MSG_NOTICE([creating $ofile])
-_LT_OUTPUT_LIBTOOL_COMMANDS
-AS_EXIT(0)
-_LTEOF
-chmod +x "$CONFIG_LT"
-
-# configure is writing to config.log, but config.lt does its own redirection,
-# appending to config.log, which fails on DOS, as config.log is still kept
-# open by configure.  Here we exec the FD to /dev/null, effectively closing
-# config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
-  lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
-])# LT_OUTPUT
-
-
-# _LT_CONFIG(TAG)
-# ---------------
-# If TAG is the built-in tag, 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 TAG from the
-# matching tagged config vars.
-m4_defun([_LT_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_CONFIG_SAVE_COMMANDS([
-  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
-  m4_if(_LT_TAG, [C], [
-    # 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
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-_LT_COPYING
-_LT_LIBTOOL_TAGS
-
-# ### BEGIN LIBTOOL CONFIG
-_LT_LIBTOOL_CONFIG_VARS
-_LT_LIBTOOL_TAG_VARS
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_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
-_LT_EOF
-    ;;
-  esac
-
-  _LT_PROG_LTMAIN
-
-  # 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)
-
-  _LT_PROG_REPLACE_SHELLFNS
-
-   mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-],
-[cat <<_LT_EOF >> "$ofile"
-
-dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
-dnl in a comment (ie after a #).
-# ### BEGIN LIBTOOL TAG CONFIG: $1
-_LT_LIBTOOL_TAG_VARS(_LT_TAG)
-# ### END LIBTOOL TAG CONFIG: $1
-_LT_EOF
-])dnl /m4_if
-],
-[m4_if([$1], [], [
-    PACKAGE='$PACKAGE'
-    VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
-    RM='$RM'
-    ofile='$ofile'], [])
-])dnl /_LT_CONFIG_SAVE_COMMANDS
-])# _LT_CONFIG
-
-
-# LT_SUPPORTED_TAG(TAG)
-# ---------------------
-# Trace this macro to discover what tags are supported by the libtool
-# --tag option, using:
-#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
-AC_DEFUN([LT_SUPPORTED_TAG], [])
-
-
-# C support is built-in for now
-m4_define([_LT_LANG_C_enabled], [])
-m4_define([_LT_TAGS], [])
-
-
-# LT_LANG(LANG)
-# -------------
-# Enable libtool support for the given language if not already enabled.
-AC_DEFUN([LT_LANG],
-[AC_BEFORE([$0], [LT_OUTPUT])dnl
-m4_case([$1],
-  [C],			[_LT_LANG(C)],
-  [C++],		[_LT_LANG(CXX)],
-  [Go],			[_LT_LANG(GO)],
-  [Java],		[_LT_LANG(GCJ)],
-  [Fortran 77],		[_LT_LANG(F77)],
-  [Fortran],		[_LT_LANG(FC)],
-  [Windows Resource],	[_LT_LANG(RC)],
-  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
-    [_LT_LANG($1)],
-    [m4_fatal([$0: unsupported language: "$1"])])])dnl
-])# LT_LANG
-
-
-# _LT_LANG(LANGNAME)
-# ------------------
-m4_defun([_LT_LANG],
-[m4_ifdef([_LT_LANG_]$1[_enabled], [],
-  [LT_SUPPORTED_TAG([$1])dnl
-  m4_append([_LT_TAGS], [$1 ])dnl
-  m4_define([_LT_LANG_]$1[_enabled], [])dnl
-  _LT_LANG_$1_CONFIG($1)])dnl
-])# _LT_LANG
-
-
-m4_ifndef([AC_PROG_GO], [
-############################################################
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-############################################################
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC],     [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
-  fi
-fi
-if test -z "$GOC"; then
-  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
-# _LT_LANG_DEFAULT_CONFIG
-# -----------------------
-m4_defun([_LT_LANG_DEFAULT_CONFIG],
-[AC_PROVIDE_IFELSE([AC_PROG_CXX],
-  [LT_LANG(CXX)],
-  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_F77],
-  [LT_LANG(F77)],
-  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_FC],
-  [LT_LANG(FC)],
-  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
-
-dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
-dnl pulling things in needlessly.
-AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-  [LT_LANG(GCJ)],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-    [LT_LANG(GCJ)],
-    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
-      [LT_LANG(GCJ)],
-      [m4_ifdef([AC_PROG_GCJ],
-	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([A][M_PROG_GCJ],
-	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([LT_PROG_GCJ],
-	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
-
-AC_PROVIDE_IFELSE([AC_PROG_GO],
-  [LT_LANG(GO)],
-  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
-AC_PROVIDE_IFELSE([LT_PROG_RC],
-  [LT_LANG(RC)],
-  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
-])# _LT_LANG_DEFAULT_CONFIG
-
-# Obsolete macros:
-AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
-dnl AC_DEFUN([AC_LIBTOOL_F77], [])
-dnl AC_DEFUN([AC_LIBTOOL_FC], [])
-dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
-
-
-# _LT_TAG_COMPILER
-# ----------------
-m4_defun([_LT_TAG_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
-_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
-_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])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_TAG_COMPILER
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-m4_defun([_LT_COMPILER_BOILERPLATE],
-[m4_require([_LT_DECL_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.
-m4_defun([_LT_LINKER_BOILERPLATE],
-[m4_require([_LT_DECL_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 -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# -------------------------
-m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-    AC_CHECK_TOOL([LIPO], [lipo], [:])
-    AC_CHECK_TOOL([OTOOL], [otool], [:])
-    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
-    _LT_DECL([], [DSYMUTIL], [1],
-      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
-    _LT_DECL([], [NMEDIT], [1],
-      [Tool to change global to local symbols on Mac OS X])
-    _LT_DECL([], [LIPO], [1],
-      [Tool to manipulate fat objects and archives on Mac OS X])
-    _LT_DECL([], [OTOOL], [1],
-      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
-    _LT_DECL([], [OTOOL64], [1],
-      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi])
-
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-	[lt_cv_ld_exported_symbols_list=yes],
-	[lt_cv_ld_exported_symbols_list=no])
-	LDFLAGS="$save_LDFLAGS"
-    ])
-
-    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
-      [lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
-      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
-      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[[012]]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
-# Checks for linker and compiler features on darwin
-m4_defun([_LT_DARWIN_LINKER_FEATURES],
-[
-  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_automatic, $1)=yes
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
-                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
-  else
-    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  fi
-  _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_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${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed '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${_lt_dar_export_syms}${_lt_dsymutil}"
-    fi
-],[])
-  else
-  _LT_TAGVAR(ld_shlibs, $1)=no
-  fi
-])
-
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
-# 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.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
-  lt_aix_libpath_sed='[
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }]'
-  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`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 "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi],[])
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
-  fi
-  ])
-  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
-])# _LT_SYS_MODULE_PATH_AIX
-
-
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
-
-
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*" 
-}
-
-case "$ECHO" in
-  printf*) AC_MSG_RESULT([printf]) ;;
-  print*) AC_MSG_RESULT([print -r]) ;;
-  *) AC_MSG_RESULT([cat]) ;;
-esac
-
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
-  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test "X`printf %s $ECHO`" = "X$ECHO" \
-      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
-
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
-
-
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted.  We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   AC_MSG_RESULT([${with_sysroot}])
-   AC_MSG_ERROR([The sysroot must be an absolute path.])
-   ;;
-esac
-
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
-
-# _LT_ENABLE_LOCK
-# ---------------
-m4_defun([_LT_ENABLE_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-  [AS_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 '$LINENO' "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*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|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*)
-	    case `/usr/bin/file conftest.o` in
-	      *x86-64*)
-		LD="${LD-ld} -m elf32_x86_64"
-		;;
-	      *)
-		LD="${LD-ld} -m elf_i386"
-		;;
-	    esac
-	    ;;
-	  powerpc64le-*)
-	    LD="${LD-ld} -m elf32lppclinux"
-	    ;;
-	  powerpc64-*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	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"
-	    ;;
-	  powerpcle-*)
-	    LD="${LD-ld} -m elf64lppc"
-	    ;;
-	  powerpc-*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    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_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[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
-  ;;
-*-*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*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
-
-need_locks="$enable_libtool_lock"
-])# _LT_ENABLE_LOCK
-
-
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
-  [lt_cv_ar_at_file=no
-   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-     [echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
-      AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-     ])
-  ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
-  [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
-# _LT_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
-
-AC_CHECK_TOOL(STRIP, strip, :)
-test -z "$STRIP" && STRIP=:
-_LT_DECL([], [STRIP], [1], [A symbol stripping program])
-
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-test -z "$RANLIB" && RANLIB=:
-_LT_DECL([], [RANLIB], [1],
-    [Commands used to install an old-style archive])
-
-# 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 \$tool_oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-_LT_DECL([], [old_postinstall_cmds], [2])
-_LT_DECL([], [old_postuninstall_cmds], [2])
-_LT_TAGDECL([], [old_archive_cmds], [2],
-    [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
-    [Whether to use a lock for old archive extraction])
-])# _LT_CMD_OLD_ARCHIVE
-
-
-# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([_LT_COMPILER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   m4_if([$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:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
-    m4_if([$5], , :, [$5])
-else
-    m4_if([$6], , :, [$6])
-fi
-])# _LT_COMPILER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
-
-
-# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                  [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------
-# Check whether the given linker option works
-AC_DEFUN([_LT_LINKER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_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 "$_lt_linker_boilerplate" | $SED '/^$/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 -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$4], , :, [$4])
-else
-    m4_if([$5], , :, [$5])
-fi
-])# _LT_LINKER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
-
-
-# LT_CMD_MAX_LEN
-#---------------
-AC_DEFUN([LT_CMD_MAX_LEN],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# 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* | cegcc*)
-    # 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;
-    ;;
-
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    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
-    ;;
-
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
-  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" && \
-	test undefined != "$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
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      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
-max_cmd_len=$lt_cv_sys_max_cmd_len
-_LT_DECL([], [max_cmd_len], [0],
-    [What is the maximum length of a command?])
-])# LT_CMD_MAX_LEN
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
-
-
-# _LT_HEADER_DLFCN
-# ----------------
-m4_defun([_LT_HEADER_DLFCN],
-[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
-])# _LT_HEADER_DLFCN
-
-
-# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ----------------------------------------------------------------
-m4_defun([_LT_TRY_DLOPEN_SELF],
-[m4_require([_LT_HEADER_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 <<_LT_EOF
-[#line $LINENO "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#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
-
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 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;
-          else puts (dlerror ());
-	}
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}]
-_LT_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_TRY_DLOPEN_SELF
-
-
-# LT_SYS_DLOPEN_SELF
-# ------------------
-AC_DEFUN([LT_SYS_DLOPEN_SELF],
-[m4_require([_LT_HEADER_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* | cegcc*)
-    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="-ldld"],
-	[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="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  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_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_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
-_LT_DECL([dlopen_support], [enable_dlopen], [0],
-	 [Whether dlopen is supported])
-_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
-	 [Whether dlopen of programs is supported])
-_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
-	 [Whether dlopen of statically linked programs is supported])
-])# LT_SYS_DLOPEN_SELF
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
-
-
-# _LT_COMPILER_C_O([TAGNAME])
-# ---------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler.
-# This macro does not hard code the compiler like AC_PROG_CC_C_O.
-m4_defun([_LT_COMPILER_C_O],
-[m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_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:$LINENO: $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:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_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 ..
-   $RM -r conftest
-   $RM conftest*
-])
-_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
-	[Does compiler simultaneously support -c and -o options?])
-])# _LT_COMPILER_C_O
-
-
-# _LT_COMPILER_FILE_LOCKS([TAGNAME])
-# ----------------------------------
-# Check to see if we can do hard links to lock some files if needed
-m4_defun([_LT_COMPILER_FILE_LOCKS],
-[m4_require([_LT_ENABLE_LOCK])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_COMPILER_C_O([$1])
-
-hard_links="nottested"
-if test "$_LT_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
-_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
-])# _LT_COMPILER_FILE_LOCKS
-
-
-# _LT_CHECK_OBJDIR
-# ----------------
-m4_defun([_LT_CHECK_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
-_LT_DECL([], [objdir], [0],
-         [The name of the directory that contains temporary libtool files])dnl
-m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
-])# _LT_CHECK_OBJDIR
-
-
-# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
-# --------------------------------------
-# Check hardcoding attributes.
-m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
-   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$_LT_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_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; 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
-_LT_TAGDECL([], [hardcode_action], [0],
-    [How to hardcode a shared library path into an executable])
-])# _LT_LINKER_HARDCODE_LIBPATH
-
-
-# _LT_CMD_STRIPLIB
-# ----------------
-m4_defun([_LT_CMD_STRIPLIB],
-[m4_require([_LT_DECL_EGREP])
-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
-_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
-_LT_DECL([], [striplib], [1])
-])# _LT_CMD_STRIPLIB
-
-
-# _LT_SYS_DYNAMIC_LINKER([TAG])
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-m4_defun([_LT_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-m4_if([$1],
-	[], [
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
-    # 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 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
-  # 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; }
-}'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-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 # correct to gnu/linux during the next big refactor
-  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'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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<name>.so
-      # instead of lib<name>.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*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    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=`func_echo_all "$lib" | $SED '\''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'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    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~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    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}'
-m4_if([$1], [],[
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    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
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH.
-        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
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # 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'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # 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}${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 # correct to gnu/linux during the next big refactor
-  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
-  ;;
-
-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[[23]].*) 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
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  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=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  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'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[[3-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-	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 glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
-    [lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-	 [lt_cv_shlibpath_overrides_runpath=yes])])
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-    ])
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # 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
-
-  # 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;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $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'
-  ;;
-
-netbsdelf*-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
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_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 # correct to gnu/linux during the next big refactor
-  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=qnx
-  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=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-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 # correct to gnu/linux during the next big refactor
-  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 # correct to gnu/linux during the next big refactor
-  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
-      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 # correct to gnu/linux during the next big refactor
-    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
-  shlibpath_overrides_runpath=yes
-  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'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    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'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  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
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-_LT_DECL([], [variables_saved_for_relink], [1],
-    [Variables whose values should be saved in libtool wrapper scripts and
-    restored at link time])
-_LT_DECL([], [need_lib_prefix], [0],
-    [Do we need the "lib" prefix for modules?])
-_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
-_LT_DECL([], [version_type], [0], [Library versioning type])
-_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
-_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
-_LT_DECL([], [shlibpath_overrides_runpath], [0],
-    [Is shlibpath searched before the hard-coded library search path?])
-_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
-_LT_DECL([], [library_names_spec], [1],
-    [[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]])
-_LT_DECL([], [soname_spec], [1],
-    [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
-    [Permission mode override for installation of shared libraries])
-_LT_DECL([], [postinstall_cmds], [2],
-    [Command to use after installation of a shared archive])
-_LT_DECL([], [postuninstall_cmds], [2],
-    [Command to use after uninstallation of a shared archive])
-_LT_DECL([], [finish_cmds], [2],
-    [Commands used to finish a libtool library installation in a directory])
-_LT_DECL([], [finish_eval], [1],
-    [[As "finish_cmds", except a single script fragment to be evaled but
-    not shown]])
-_LT_DECL([], [hardcode_into_libs], [0],
-    [Whether we should hardcode library paths into libraries])
-_LT_DECL([], [sys_lib_search_path_spec], [2],
-    [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
-])# _LT_SYS_DYNAMIC_LINKER
-
-
-# _LT_PATH_TOOL_PREFIX(TOOL)
-# --------------------------
-# find a file program which can recognize shared library
-AC_DEFUN([_LT_PATH_TOOL_PREFIX],
-[m4_require([_LT_DECL_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="m4_if([$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 <<_LT_EOF 1>&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 at gnu.org
-
-_LT_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
-_LT_DECL([], [MAGIC_CMD], [0],
-	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
-])# _LT_PATH_TOOL_PREFIX
-
-# Old name:
-AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
-
-
-# _LT_PATH_MAGIC
-# --------------
-# find a file program which can recognize a shared library
-m4_defun([_LT_PATH_MAGIC],
-[_LT_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
-    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# _LT_PATH_MAGIC
-
-
-# LT_PATH_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([LT_PATH_LD],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
-
-AC_ARG_WITH([gnu-ld],
-    [AS_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])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 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-_LT_PATH_LD_GNU
-AC_SUBST([LD])
-
-_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
-])# LT_PATH_LD
-
-# Old names:
-AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
-AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_LD], [])
-dnl AC_DEFUN([AC_PROG_LD], [])
-
-
-# _LT_PATH_LD_GNU
-#- --------------
-m4_defun([_LT_PATH_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# _LT_PATH_LD_GNU
-
-
-# _LT_CMD_RELOAD
-# --------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-m4_defun([_LT_CMD_RELOAD],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-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
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
-  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
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
-])# _LT_CMD_RELOAD
-
-
-# _LT_CHECK_MAGIC_METHOD
-# ----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_MAGIC_METHOD],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[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
-aix[[4-9]]*)
-  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.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && 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
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-cegcc*)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
-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
-  ;;
-
-haiku*)
-  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])(-bit)?( [LM]SB)? 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 glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd* | netbsdelf*-gnu)
-  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=pass_all
-  ;;
-
-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
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  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
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
-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
-
-_LT_DECL([], [deplibs_check_method], [1],
-    [Method to check whether dependent libraries are shared objects])
-_LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
-    [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
-    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
-])# _LT_CHECK_MAGIC_METHOD
-
-
-# LT_PATH_NM
-# ----------
-# find the pathname to a BSD- or MS-compatible name lister
-AC_DEFUN([LT_PATH_NM],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_CACHE_CHECK([for BSD- or MS-compatible name lister (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
-  : ${lt_cv_path_NM=no}
-fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
-  AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-AC_SUBST([NM])
-_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
-
-AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
-  [lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
-  cat conftest.out >&AS_MESSAGE_LOG_FD
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*])
-])# LT_PATH_NM
-
-# Old names:
-AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
-AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_NM], [])
-dnl AC_DEFUN([AC_PROG_NM], [])
-
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
-    [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
-  [lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
-
-# LT_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-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_SUBST([LIBM])
-])# LT_LIB_M
-
-# Old name:
-AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_CHECK_LIBM], [])
-
-
-# _LT_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------
-m4_defun([_LT_COMPILER_NO_RTTI],
-[m4_require([_LT_TAG_COMPILER])dnl
-
-_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
-  esac
-
-  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
-	[Compiler flag to turn off builtin functions])
-])# _LT_COMPILER_NO_RTTI
-
-
-# _LT_CMD_GLOBAL_SYMBOLS
-# ----------------------
-m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-
-# 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]]*\)'
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  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
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
-
-# 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
-
-# Try without a prefix underscore, 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.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK ['"\
-"     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx]"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $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 <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT@&t at _DLSYM_CONST
-#else
-# define LT@&t at _DLSYM_CONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
-
-	  cat <<_LT_EOF >> conftest.$ac_ext
-
-/* The mapping between symbol names and symbols.  */
-LT@&t at _DLSYM_CONST struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[[]] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_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_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_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 -rf 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
-
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
-    [Take the output of nm and produce a listing of raw symbols and C names])
-_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
-    [Transform the output of nm in a proper C declaration])
-_LT_DECL([global_symbol_to_c_name_address],
-    [lt_cv_sys_global_symbol_to_c_name_address], [1],
-    [Transform the output of nm in a C name address pair])
-_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
-    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
-    [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
-    [Specify filename containing input files for $NM])
-]) # _LT_CMD_GLOBAL_SYMBOLS
-
-
-# _LT_COMPILER_PIC([TAGNAME])
-# ---------------------------
-m4_defun([_LT_COMPILER_PIC],
-[m4_require([_LT_TAG_COMPILER])dnl
-_LT_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_TAGVAR(lt_prog_compiler_static, $1)=
-
-m4_if([$1], [CXX], [
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
-      # 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
-      m4_if([$1], [GCJ], [],
-	[_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $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_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *qnx* | *nto*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_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
-	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# 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).
-	m4_if([$1], [GCJ], [],
-	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-	;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_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_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  icpc* )
-	    # Intel C++, used to be incompatible with GCC.
-	    # ICC 10 doesn't accept -KPIC any more.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_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_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd* | netbsdelf*-gnu)
-	;;
-      *qnx* | *nto*)
-        # QNX uses GNU C++, but need to define -shared option too, otherwise
-        # it will coredump.
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-        ;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_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_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # 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
-      m4_if([$1], [GCJ], [],
-	[_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    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_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
-      fi
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # 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).
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_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_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
-	;;
-      nagfor*)
-	# NAG Fortran compiler
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	  ;;
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-        *Intel*\ [[CF]]*Compiler*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	  ;;
-	*Portland\ Group*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
-    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
-    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
-	[Additional compiler flags for building library objects])
-
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
-_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
-_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
-	[Compiler flag to prevent dynamic linking])
-])# _LT_COMPILER_PIC
-
-
-# _LT_LINKER_SHLIBS([TAGNAME])
-# ----------------------------
-# See if the linker supports building shared libraries.
-m4_defun([_LT_LINKER_SHLIBS],
-[AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-m4_if([$1], [CXX], [
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  case $host_os in
-  aix[[4-9]]*)
-    # 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
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
-    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_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_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-    ;;
-  cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-      ;;
-    esac
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
-  *)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
-  esac
-], [
-  runpath_var=
-  _LT_TAGVAR(allow_undefined_flag, $1)=
-  _LT_TAGVAR(always_export_symbols, $1)=no
-  _LT_TAGVAR(archive_cmds, $1)=
-  _LT_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_TAGVAR(compiler_needs_object, $1)=no
-  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(hardcode_automatic, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
-  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(inherit_rpath, $1)=no
-  _LT_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_TAGVAR(module_cmds, $1)=
-  _LT_TAGVAR(module_expsym_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_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_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # 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.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # 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
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
-  esac
-
-  _LT_TAGVAR(ld_shlibs, $1)=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
-	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = 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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
-      *\ [[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
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=no
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_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_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_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    interix[[3-9]]*)
-      _LT_TAGVAR(hardcode_direct, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_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_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_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* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=' $pic_flag'
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$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' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; then
-          _LT_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
-
-	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    _LT_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~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        _LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $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_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&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.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_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_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
-	;;
-	*)
-	  # 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.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_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_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_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_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      _LT_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_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_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      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
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_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]].*|aix[[5-9]]*)
-	  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_TAGVAR(archive_cmds, $1)=''
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-      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_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_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-	_LT_TAGVAR(link_all_deplibs, $1)=no
-      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
-
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_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 func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_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_SYS_MODULE_PATH_AIX([$1])
-	 _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  fi
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_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*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    bsdi[[45]]*)
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # 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.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	_LT_TAGVAR(always_export_symbols, $1)=yes
-	_LT_TAGVAR(file_list_spec, $1)='@'
-	# 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_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_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_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	# FIXME: Should let the user specify the lib program.
-	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	;;
-      esac
-      ;;
-
-    darwin* | rhapsody*)
-      _LT_DARWIN_LINKER_FEATURES($1)
-      ;;
-
-    dgux*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $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_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${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_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	_LT_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_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	m4_if($1, [], [
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  _LT_LINKER_OPTION([if $CC understands -b],
-	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
-	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
-	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   AC_LINK_IFELSE(
-	     [AC_LANG_SOURCE(
-	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
-			      [C++], [[int foo (void) { return 0; }]],
-			      [Fortran 77], [[
-      subroutine foo
-      end]],
-			      [Fortran], [[
-      subroutine foo
-      end]])])],
-	      [lt_cv_irix_exported_symbol=yes],
-	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(inherit_rpath, $1)=yes
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_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_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_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'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_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} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_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_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_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_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_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_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
-])
-AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
-
-_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
-_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
-_LT_DECL([], [extract_expsyms_cmds], [2],
-    [The commands to extract the exported symbol list from a shared archive])
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_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_CACHE_CHECK([whether -lc should be explicitly linked in],
-	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
-	[$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_TAGVAR(lt_prog_compiler_wl, $1)
-	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-	  _LT_TAGVAR(allow_undefined_flag, $1)=
-	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-	  then
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	  else
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  fi
-	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-	])
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
-    [Whether or not to add -lc for building shared libraries])
-_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
-    [enable_shared_with_static_runtimes], [0],
-    [Whether or not to disallow shared libs when runtime libs are static])
-_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
-    [Compiler flag to allow reflexive dlopens])
-_LT_TAGDECL([], [whole_archive_flag_spec], [1],
-    [Compiler flag to generate shared objects directly from archives])
-_LT_TAGDECL([], [compiler_needs_object], [1],
-    [Whether the compiler copes with passing no objects directly])
-_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
-    [Create an old-style archive from a shared archive])
-_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
-    [Create a temporary old-style archive to link instead of a shared archive])
-_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
-_LT_TAGDECL([], [archive_expsym_cmds], [2])
-_LT_TAGDECL([], [module_cmds], [2],
-    [Commands used to build a loadable module if different from building
-    a shared archive.])
-_LT_TAGDECL([], [module_expsym_cmds], [2])
-_LT_TAGDECL([], [with_gnu_ld], [1],
-    [Whether we are building with GNU ld or not])
-_LT_TAGDECL([], [allow_undefined_flag], [1],
-    [Flag that allows shared libraries with undefined symbols to be built])
-_LT_TAGDECL([], [no_undefined_flag], [1],
-    [Flag that enforces no undefined symbols])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
-    [Flag to hardcode $libdir into a binary during linking.
-    This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_separator], [1],
-    [Whether we need a single "-rpath" flag with a separated argument])
-_LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary])
-_LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
-    library is relocated])
-_LT_TAGDECL([], [hardcode_minus_L], [0],
-    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
-    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_automatic], [0],
-    [Set to "yes" if building a shared library automatically hardcodes DIR
-    into the library and all subsequent libraries and executables linked
-    against it])
-_LT_TAGDECL([], [inherit_rpath], [0],
-    [Set to yes if linker adds runtime paths of dependent libraries
-    to runtime path list])
-_LT_TAGDECL([], [link_all_deplibs], [0],
-    [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [always_export_symbols], [0],
-    [Set to "yes" if exported symbols are required])
-_LT_TAGDECL([], [export_symbols_cmds], [2],
-    [The commands to list exported symbols])
-_LT_TAGDECL([], [exclude_expsyms], [1],
-    [Symbols that should not be listed in the preloaded symbols])
-_LT_TAGDECL([], [include_expsyms], [1],
-    [Symbols that must always be exported])
-_LT_TAGDECL([], [prelink_cmds], [2],
-    [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
-    [Commands necessary for finishing linking programs])
-_LT_TAGDECL([], [file_list_spec], [1],
-    [Specify filename containing input files])
-dnl FIXME: Not yet implemented
-dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
-dnl    [Compiler flag to generate thread safe objects])
-])# _LT_LINKER_SHLIBS
-
-
-# _LT_LANG_C_CONFIG([TAG])
-# ------------------------
-# Ensure that the configuration variables for a C compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_C_CONFIG],
-[m4_require([_LT_DECL_EGREP])dnl
-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_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_TAG_COMPILER
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_SYS_DYNAMIC_LINKER($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
-  _LT_CMD_STRIPLIB
-
-  # 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
-    ;;
-
-  aix[[4-9]]*)
-    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_CONFIG($1)
-fi
-AC_LANG_POP
-CC="$lt_save_CC"
-])# _LT_LANG_C_CONFIG
-
-
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-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
-else
-  _lt_caught_CXX_error=yes
-fi
-
-AC_LANG_PUSH(C++)
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(compiler_needs_object, $1)=no
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
-  # 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_TAG_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_CFLAGS=$CFLAGS
-  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++"}
-  CFLAGS=$CXXFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    # We don't want -fno-exception when compiling C++ code, so set the
-    # no_builtin_flag separately
-    if test "$GXX" = yes; then
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-    else
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-    fi
-
-    if test "$GXX" = yes; then
-      # Set up default GNU C++ configuration
-
-      LT_PATH_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_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-        else
-          _LT_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_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 -v "^Configured with:" | $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_TAGVAR(ld_shlibs, $1)=yes
-    case $host_os in
-      aix3*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-      aix[[4-9]]*)
-        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]].*|aix[[5-9]]*)
-	    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_TAGVAR(archive_cmds, $1)=''
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-        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_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_TAGVAR(hardcode_minus_L, $1)=yes
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	    _LT_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
-
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-        # It seems that -bexpall does not export symbols beginning with
-        # underscore (_), so it is better to generate a list of symbols to
-	# export.
-        _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok'
-          # Determine the default libpath from the value encoded in an empty
-          # executable.
-          _LT_SYS_MODULE_PATH_AIX([$1])
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-          _LT_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 func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-        else
-          if test "$host_cpu" = ia64; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	    _LT_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_SYS_MODULE_PATH_AIX([$1])
-	    _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    fi
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	    # This is similar to how AIX traditionally builds its shared
-	    # libraries.
-	    _LT_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_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	  # support --undefined.  This deserves some investigation.  FIXME
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      chorus*)
-        case $cc_basename in
-          *)
-	  # FIXME: insert proper C++ library support
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	  ;;
-        esac
-        ;;
-
-      cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=yes
-	  _LT_TAGVAR(file_list_spec, $1)='@'
-	  # 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_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	  # Don't use ranlib
-	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=no
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_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_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_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	  ;;
-	esac
-	;;
-      darwin* | rhapsody*)
-        _LT_DARWIN_LINKER_FEATURES($1)
-	;;
-
-      dgux*)
-        case $cc_basename in
-          ec++*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          ghcx*)
-	    # Green Hills C++ Compiler
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      freebsd2.*)
-        # C++ shared libraries reported to be fairly broken before
-	# switch to ELF
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      freebsd-elf*)
-        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        ;;
-
-      freebsd* | dragonfly*)
-        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-        # conventions
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-        ;;
-
-      haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        ;;
-
-      hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_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_TAGVAR(ld_shlibs, $1)=no
-            ;;
-          aCC*)
-            _LT_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) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-            ;;
-          *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${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_TAGVAR(ld_shlibs, $1)=no
-            fi
-            ;;
-        esac
-        ;;
-
-      hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-          case $host_cpu in
-            hppa*64*|ia64*)
-              ;;
-            *)
-	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-              ;;
-          esac
-        fi
-        case $host_cpu in
-          hppa*64*|ia64*)
-            _LT_TAGVAR(hardcode_direct, $1)=no
-            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-            ;;
-          *)
-            _LT_TAGVAR(hardcode_direct, $1)=yes
-            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-            _LT_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_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          aCC*)
-	    case $host_cpu in
-	      hppa*64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      ia64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      *)
-	        _LT_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; func_echo_all "$list"'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test $with_gnu_ld = no; then
-	        case $host_cpu in
-	          hppa*64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${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_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      interix[[3-9]]*)
-	_LT_TAGVAR(hardcode_direct, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_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_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_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_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-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_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_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
-	      fi
-	    fi
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-	    ;;
-        esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(inherit_rpath, $1)=yes
-        ;;
-
-      linux* | k*bsd*-gnu | kopensolaris*-gnu | 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_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_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; func_echo_all "$list"'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_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_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	    ;;
-	  icpc* | ecpc* )
-	    # 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_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_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_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_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_TAGVAR(archive_cmds_need_lc, $1)=no
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    ;;
-          pgCC* | pgcpp*)
-            # Portland Group C++ compiler
-	    case `$CC -V` in
-	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
-	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
-	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
-	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    *) # Version 6 and above use weak symbols
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_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'
-	      ;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-            ;;
-	  cxx*)
-	    # Compaq C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	    _LT_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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed'
-	    ;;
-	  xl* | mpixl* | bgxl*)
-	    # IBM XL 8.0 on PPC, with GNU ld
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
-	      _LT_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 -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	    fi
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	      _LT_TAGVAR(compiler_needs_object, $1)=yes
-
-	      # Not sure whether something based on
-	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
-
-	      # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-
-      lynxos*)
-        # FIXME: insert proper C++ library support
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      m88k*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      mvs*)
-        case $cc_basename in
-          cxx*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	  *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	esac
-	;;
-
-      netbsd*)
-        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-	  wlarc=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_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::"'
-	;;
-
-      *nto* | *qnx*)
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-	;;
-
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      openbsd*)
-	if test -f /usr/libexec/ld.so; then
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-	  _LT_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_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_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-	  fi
-	  output_verbose_link_cmd=func_echo_all
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      osf3* | 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_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Archives containing C++ object files must be created using
-	    # the KAI C++ compiler.
-	    case $host in
-	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
-	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
-	    esac
-	    ;;
-          RCC*)
-	    # Rational C++ 2.4.1
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          cxx*)
-	    case $host in
-	      osf3*)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-		;;
-	      *)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-		;;
-	    esac
-
-	    _LT_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=`func_echo_all "$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; func_echo_all "$list"'
-	    ;;
-	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	      case $host in
-	        osf3*)
-	          _LT_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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	      esac
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	      _LT_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 -v "^Configured with:" | $GREP "\-L"'
-
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      psos*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      sunos4*)
-        case $cc_basename in
-          CC*)
-	    # Sun C++ 4.x
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          lcc*)
-	    # Lucid
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      solaris*)
-        case $cc_basename in
-          CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
-	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	    _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	    _LT_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_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	        ;;
-	    esac
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-
-	    output_verbose_link_cmd='func_echo_all'
-
-	    # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	    ;;
-          gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_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_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -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 -v "^Configured with:" | $GREP "\-L"'
-	      else
-	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	        # platform.
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_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 -v "^Configured with:" | $GREP "\-L"'
-	      fi
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	      case $host_os in
-		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-		*)
-		  _LT_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_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      case $cc_basename in
-        CC*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_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.
-	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-	_LT_TAGVAR(link_all_deplibs, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-	runpath_var='LD_RUN_PATH'
-
-	case $cc_basename in
-          CC*)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
-	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
-	    ;;
-	  *)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$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_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      vxworks*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      *)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-    esac
-
-    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-  LDCXX=$LD
-  LD=$lt_save_LD
-  GCC=$lt_save_GCC
-  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
-fi # test "$_lt_caught_CXX_error" != yes
-
-AC_LANG_POP
-])# _LT_LANG_CXX_CONFIG
-
-
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
-# _LT_SYS_HIDDEN_LIBDEPS([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.
-m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
-# Dependencies to place before and after the object being linked:
-_LT_TAGVAR(predep_objects, $1)=
-_LT_TAGVAR(postdep_objects, $1)=
-_LT_TAGVAR(predeps, $1)=
-_LT_TAGVAR(postdeps, $1)=
-_LT_TAGVAR(compiler_lib_search_path, $1)=
-
-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...
-m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
-int a;
-void foo (void) { a = 0; }
-_LT_EOF
-], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-_LT_EOF
-], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-_LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
-])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); 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
-
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${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
-       fi
-
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
-       if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} 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 "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_TAGVAR(postdeps, $1)"; then
-	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       prev=
-       ;;
-
-    *.lto.$objext) ;; # Ignore GCC LTO objects
-    *.$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 "$_LT_TAGVAR(predep_objects, $1)"; then
-	   _LT_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-	   _LT_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
-
-# PORTME: override above test on systems where it is broken
-m4_if([$1], [CXX],
-[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.
-  _LT_TAGVAR(predep_objects,$1)=
-  _LT_TAGVAR(postdep_objects,$1)=
-  _LT_TAGVAR(postdeps,$1)=
-  ;;
-
-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
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC* | sunCC*)
-    # 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_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-
-case " $_LT_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
-    [The directories searched by this compiler when creating a shared library])
-_LT_TAGDECL([], [predep_objects], [1],
-    [Dependencies to place before and after the objects being linked to
-    create a shared library])
-_LT_TAGDECL([], [postdep_objects], [1])
-_LT_TAGDECL([], [predeps], [1])
-_LT_TAGDECL([], [postdeps], [1])
-_LT_TAGDECL([], [compiler_lib_search_path], [1],
-    [The library search path used internally by the compiler when linking
-    a shared library])
-])# _LT_SYS_HIDDEN_LIBDEPS
-
-
-# _LT_LANG_F77_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a Fortran 77 compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_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_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # 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_TAG_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_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-  GCC=$G77
-  if test -n "$compiler"; then
-    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
-        ;;
-      aix[[4-9]]*)
-	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_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_LANG_FC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for a Fortran compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
-  # 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_TAG_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_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${FC-"f95"}
-  CFLAGS=$FCFLAGS
-  compiler=$CC
-  GCC=$ac_cv_fc_compiler_gnu
-
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    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
-        ;;
-      aix[[4-9]]*)
-	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_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
-
-AC_LANG_POP
-])# _LT_LANG_FC_CONFIG
-
-
-# _LT_LANG_GCJ_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Java Compiler compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GCJ_CONFIG],
-[AC_REQUIRE([LT_PROG_GCJ])dnl
-AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_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_TAG_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_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GCJ_CONFIG
-
-
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
-AC_LANG_SAVE
-
-# Source file extension for Go test sources.
-ac_ext=go
-
-# Object file extension for compiled Go test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_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_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_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_TAG_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_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
-
-
-# LT_PROG_GCJ
-# -----------
-AC_DEFUN([LT_PROG_GCJ],
-[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
-  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
-    [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-      AC_SUBST(GCJFLAGS)])])[]dnl
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
-
-
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
-
-
-# LT_PROG_RC
-# ----------
-AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres,)
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_RC], [])
-
-
-# _LT_DECL_EGREP
-# --------------
-# If we don't have a new enough Autoconf to choose the best grep
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_EGREP],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_REQUIRE([AC_PROG_FGREP])dnl
-test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
-dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
-AC_SUBST([GREP])
-])
-
-
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
-
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
-
-# _LT_DECL_SED
-# ------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-m4_defun([_LT_DECL_SED],
-[AC_PROG_SED
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
-_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
-    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
-])# _LT_DECL_SED
-
-m4_ifndef([AC_PROG_SED], [
-############################################################
-# 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.                               #
-############################################################
-
-m4_defun([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])
-])#AC_PROG_SED
-])#m4_ifndef
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_SED], [])
-
-
-# _LT_CHECK_SHELL_FEATURES
-# ------------------------
-# Find out whether the shell is Bourne or XSI compatible,
-# or has some other useful features.
-m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
-_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
-])# _LT_CHECK_SHELL_FEATURES
-
-
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
-         [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
-         [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
deleted file mode 100644
index 5d9acd8..0000000
--- a/m4/ltoptions.m4
+++ /dev/null
@@ -1,384 +0,0 @@
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# 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 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-## --------------------------------- ##
-## Macros to handle LT_INIT options. ##
-## --------------------------------- ##
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_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=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_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=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_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=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-## ----------------- ##
-## LTDL_INIT Options ##
-## ----------------- ##
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
deleted file mode 100644
index 9000a05..0000000
--- a/m4/ltsugar.m4
+++ /dev/null
@@ -1,123 +0,0 @@
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# 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 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
deleted file mode 100644
index 07a8602..0000000
--- a/m4/ltversion.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# 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.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
deleted file mode 100644
index c573da9..0000000
--- a/m4/lt~obsolete.m4
+++ /dev/null
@@ -1,98 +0,0 @@
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# 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 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/missing b/missing
deleted file mode 100755
index db98974..0000000
--- a/missing
+++ /dev/null
@@ -1,215 +0,0 @@
-#! /bin/sh
-# Common wrapper for a few potentially missing GNU programs.
-
-scriptversion=2013-10-28.13; # UTC
-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
-# Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 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, 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, see <http://www.gnu.org/licenses/>.
-
-# 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.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try '$0 --help' for more information"
-  exit 1
-fi
-
-case $1 in
-
-  --is-lightweight)
-    # Used by our autoconf macros to check whether the available missing
-    # script is modern enough.
-    exit 0
-    ;;
-
-  --run)
-    # Back-compat with the calling convention used by older automake.
-    shift
-    ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
-to PROGRAM being missing or too old.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-
-Supported PROGRAM values:
-  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
-  bison     yacc      flex         lex       help2man
-
-Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
-'g' are ignored when checking the name.
-
-Send bug reports to <bug-automake at gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: unknown '$1' option"
-    echo 1>&2 "Try '$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# Run the given program, remember its exit status.
-"$@"; st=$?
-
-# If it succeeded, we are done.
-test $st -eq 0 && exit 0
-
-# Also exit now if we it failed (or wasn't found), and '--version' was
-# passed; such an option is passed most likely to detect whether the
-# program is present and works.
-case $2 in --version|--help) exit $st;; esac
-
-# Exit code 63 means version mismatch.  This often happens when the user
-# tries to use an ancient version of a tool on a file that requires a
-# minimum version.
-if test $st -eq 63; then
-  msg="probably too old"
-elif test $st -eq 127; then
-  # Program was missing.
-  msg="missing on your system"
-else
-  # Program was found and executed, but failed.  Give up.
-  exit $st
-fi
-
-perl_URL=http://www.perl.org/
-flex_URL=http://flex.sourceforge.net/
-gnu_software_URL=http://www.gnu.org/software
-
-program_details ()
-{
-  case $1 in
-    aclocal|automake)
-      echo "The '$1' program is part of the GNU Automake package:"
-      echo "<$gnu_software_URL/automake>"
-      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
-      echo "<$gnu_software_URL/autoconf>"
-      echo "<$gnu_software_URL/m4/>"
-      echo "<$perl_URL>"
-      ;;
-    autoconf|autom4te|autoheader)
-      echo "The '$1' program is part of the GNU Autoconf package:"
-      echo "<$gnu_software_URL/autoconf/>"
-      echo "It also requires GNU m4 and Perl in order to run:"
-      echo "<$gnu_software_URL/m4/>"
-      echo "<$perl_URL>"
-      ;;
-  esac
-}
-
-give_advice ()
-{
-  # Normalize program name to check for.
-  normalized_program=`echo "$1" | sed '
-    s/^gnu-//; t
-    s/^gnu//; t
-    s/^g//; t'`
-
-  printf '%s\n' "'$1' is $msg."
-
-  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
-  case $normalized_program in
-    autoconf*)
-      echo "You should only need it if you modified 'configure.ac',"
-      echo "or m4 files included by it."
-      program_details 'autoconf'
-      ;;
-    autoheader*)
-      echo "You should only need it if you modified 'acconfig.h' or"
-      echo "$configure_deps."
-      program_details 'autoheader'
-      ;;
-    automake*)
-      echo "You should only need it if you modified 'Makefile.am' or"
-      echo "$configure_deps."
-      program_details 'automake'
-      ;;
-    aclocal*)
-      echo "You should only need it if you modified 'acinclude.m4' or"
-      echo "$configure_deps."
-      program_details 'aclocal'
-      ;;
-   autom4te*)
-      echo "You might have modified some maintainer files that require"
-      echo "the 'autom4te' program to be rebuilt."
-      program_details 'autom4te'
-      ;;
-    bison*|yacc*)
-      echo "You should only need it if you modified a '.y' file."
-      echo "You may want to install the GNU Bison package:"
-      echo "<$gnu_software_URL/bison/>"
-      ;;
-    lex*|flex*)
-      echo "You should only need it if you modified a '.l' file."
-      echo "You may want to install the Fast Lexical Analyzer package:"
-      echo "<$flex_URL>"
-      ;;
-    help2man*)
-      echo "You should only need it if you modified a dependency" \
-           "of a man page."
-      echo "You may want to install the GNU Help2man package:"
-      echo "<$gnu_software_URL/help2man/>"
-    ;;
-    makeinfo*)
-      echo "You should only need it if you modified a '.texi' file, or"
-      echo "any other file indirectly affecting the aspect of the manual."
-      echo "You might want to install the Texinfo package:"
-      echo "<$gnu_software_URL/texinfo/>"
-      echo "The spurious makeinfo call might also be the consequence of"
-      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
-      echo "want to install GNU make:"
-      echo "<$gnu_software_URL/make/>"
-      ;;
-    *)
-      echo "You might have modified some files without having the proper"
-      echo "tools for further handling them.  Check the 'README' file, it"
-      echo "often tells you about the needed prerequisites for installing"
-      echo "this package.  You may also peek at any GNU archive site, in"
-      echo "case some other package contains this missing '$1' program."
-      ;;
-  esac
-}
-
-give_advice "$1" | sed -e '1s/^/WARNING: /' \
-                       -e '2,$s/^/         /' >&2
-
-# Propagate the correct exit status (expected to be 127 for a program
-# not found, 63 for a program that failed due to version mismatch).
-exit $st
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/src/Makefile.in b/src/Makefile.in
deleted file mode 100644
index 5b819b6..0000000
--- a/src/Makefile.in
+++ /dev/null
@@ -1,753 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in 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.
-
- at SET_MAKE@
-
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(srcdir)/rttopo_config.h.in $(top_srcdir)/depcomp \
-	$(noinst_HEADERS)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = rttopo_config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(libdir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-librttopo_la_DEPENDENCIES =
-am_librttopo_la_OBJECTS = box2d.lo bytebuffer.lo g_box.lo \
-	g_serialized.lo g_util.lo measures3d.lo measures.lo ptarray.lo \
-	rtalgorithm.lo rtcircstring.lo rtcollection.lo rtcompound.lo \
-	rtcurvepoly.lo rtgeodetic.lo rtgeom_api.lo rtgeom.lo \
-	rtgeom_debug.lo rtgeom_geos.lo rtgeom_geos_clean.lo \
-	rtgeom_geos_node.lo rtgeom_geos_split.lo rtgeom_topo.lo \
-	rthomogenize.lo rtin_geojson.lo rtin_twkb.lo rtin_wkb.lo \
-	rtiterator.lo rtlinearreferencing.lo rtline.lo rtmcurve.lo \
-	rtmline.lo rtmpoint.lo rtmpoly.lo rtmsurface.lo \
-	rtout_encoded_polyline.lo rtout_geojson.lo rtout_gml.lo \
-	rtout_kml.lo rtout_svg.lo rtout_twkb.lo rtout_wkb.lo \
-	rtout_wkt.lo rtout_x3d.lo rtpoint.lo rtpoly.lo rtprint.lo \
-	rtpsurface.lo rtspheroid.lo rtstroke.lo rttin.lo rttree.lo \
-	rttriangle.lo rtutil.lo stringbuffer.lo varint.lo
-librttopo_la_OBJECTS = $(am_librttopo_la_OBJECTS)
-AM_V_lt = $(am__v_lt_ at AM_V@)
-am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-librttopo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(librttopo_la_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I. at am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_ at AM_V@)
-am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(librttopo_la_SOURCES)
-DIST_SOURCES = $(librttopo_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-HEADERS = $(noinst_HEADERS)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
-	$(LISP)rttopo_config.h.in
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GEOSCONFIG = @GEOSCONFIG@
-GEOS_CFLAGS = @GEOS_CFLAGS@
-GEOS_LDFLAGS = @GEOS_LDFLAGS@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBRTGEOM_VERSION = @LIBRTGEOM_VERSION@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-RTGEOM_GEOS_VERSION = @RTGEOM_GEOS_VERSION@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SRID_MAX = @SRID_MAX@
-SRID_USR_MAX = @SRID_USR_MAX@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/headers
-lib_LTLIBRARIES = librttopo.la
-librttopo_la_SOURCES = box2d.c bytebuffer.c g_box.c \
-	g_serialized.c g_util.c measures3d.c measures.c \
-	ptarray.c rtalgorithm.c rtcircstring.c rtcollection.c \
-	rtcompound.c rtcurvepoly.c rtgeodetic.c \
-	rtgeom_api.c rtgeom.c rtgeom_debug.c rtgeom_geos.c \
-	rtgeom_geos_clean.c rtgeom_geos_node.c rtgeom_geos_split.c \
-	rtgeom_topo.c rthomogenize.c rtin_geojson.c rtin_twkb.c \
-	rtin_wkb.c rtiterator.c rtlinearreferencing.c rtline.c \
-	rtmcurve.c rtmline.c rtmpoint.c rtmpoly.c rtmsurface.c \
-	rtout_encoded_polyline.c rtout_geojson.c rtout_gml.c \
-	rtout_kml.c rtout_svg.c rtout_twkb.c rtout_wkb.c \
-	rtout_wkt.c rtout_x3d.c rtpoint.c rtpoly.c rtprint.c \
-	rtpsurface.c rtspheroid.c rtstroke.c rttin.c rttree.c \
-	rttriangle.c rtutil.c stringbuffer.c varint.c
-
-librttopo_la_LDFLAGS = -version-info 1:0:0 -no-undefined
-librttopo_la_LIBADD = -lm
-noinst_HEADERS = bytebuffer.h librttopo_geom_internal.h \
-	librttopo_internal.h measures3d.h measures.h \
-	rtgeodetic.h rtgeom_geos.h \
-	rtgeom_log.h rtout_twkb.h rttopo_config.h \
-	rttree.h stringbuffer.h varint.h
-
-all: rttopo_config.h
-	$(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-rttopo_config.h: stamp-h1
-	@test -f $@ || rm -f stamp-h1
-	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
-
-stamp-h1: $(srcdir)/rttopo_config.h.in $(top_builddir)/config.status
-	@rm -f stamp-h1
-	cd $(top_builddir) && $(SHELL) ./config.status src/rttopo_config.h
-$(srcdir)/rttopo_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
-	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
-	rm -f stamp-h1
-	touch $@
-
-distclean-hdr:
-	-rm -f rttopo_config.h stamp-h1
-
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
-	}
-
-uninstall-libLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
-	done
-
-clean-libLTLIBRARIES:
-	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
-
-librttopo.la: $(librttopo_la_OBJECTS) $(librttopo_la_DEPENDENCIES) $(EXTRA_librttopo_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(librttopo_la_LINK) -rpath $(libdir) $(librttopo_la_OBJECTS) $(librttopo_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/box2d.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bytebuffer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g_box.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g_serialized.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/g_util.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/measures.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/measures3d.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ptarray.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtalgorithm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtcircstring.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtcollection.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtcompound.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtcurvepoly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeodetic.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_api.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_debug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_geos.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_geos_clean.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_geos_node.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_geos_split.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtgeom_topo.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rthomogenize.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtin_geojson.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtin_twkb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtin_wkb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtiterator.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtline.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtlinearreferencing.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtmcurve.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtmline.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtmpoint.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtmpoly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtmsurface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_encoded_polyline.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_geojson.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_gml.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_kml.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_svg.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_twkb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_wkb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_wkt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtout_x3d.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtpoint.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtpoly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtprint.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtpsurface.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtspheroid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtstroke.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rttin.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rttree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rttriangle.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rtutil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stringbuffer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varint.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS) rttopo_config.h
-installdirs:
-	for dir in "$(DESTDIR)$(libdir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
-	mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-hdr distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-libLTLIBRARIES
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-libLTLIBRARIES
-
-.MAKE: all install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-hdr distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-libLTLIBRARIES \
-	install-man install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am uninstall-libLTLIBRARIES
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/box2d.c b/src/box2d.c
index 3576f1b..3e2b423 100644
--- a/src/box2d.c
+++ b/src/box2d.c
@@ -43,7 +43,7 @@
 RTGBOX *
 box2d_clone(const RTCTX *ctx, const RTGBOX *in)
 {
-	RTGBOX *ret = rtalloc(ctx, sizeof(RTGBOX));
-	memcpy(ret, in, sizeof(RTGBOX));
-	return ret;
+  RTGBOX *ret = rtalloc(ctx, sizeof(RTGBOX));
+  memcpy(ret, in, sizeof(RTGBOX));
+  return ret;
 }
diff --git a/src/bytebuffer.c b/src/bytebuffer.c
index ec953b5..d4b55a4 100644
--- a/src/bytebuffer.c
+++ b/src/bytebuffer.c
@@ -31,74 +31,74 @@
 /**
 * Allocate a new bytebuffer_t. Use bytebuffer_destroy to free.
 */
-bytebuffer_t* 
+bytebuffer_t*
 bytebuffer_create(const RTCTX *ctx)
 {
-	RTDEBUG(2,"Entered bytebuffer_create");
-	return bytebuffer_create_with_size(ctx, BYTEBUFFER_STARTSIZE);
+  RTDEBUG(2,"Entered bytebuffer_create");
+  return bytebuffer_create_with_size(ctx, BYTEBUFFER_STARTSIZE);
 }
 
 /**
 * Allocate a new bytebuffer_t. Use bytebuffer_destroy to free.
 */
-bytebuffer_t* 
+bytebuffer_t*
 bytebuffer_create_with_size(const RTCTX *ctx, size_t size)
 {
-	RTDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
-	bytebuffer_t *s;
-
-	s = rtalloc(ctx, sizeof(bytebuffer_t));
-	s->buf_start = rtalloc(ctx, size);
-	s->readcursor = s->writecursor = s->buf_start;
-	s->capacity = size;
-	memset(s->buf_start,0,size);
-	RTDEBUGF(4,"We create a buffer on %p of %d bytes", s->buf_start, size);
-	return s;
+  RTDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
+  bytebuffer_t *s;
+
+  s = rtalloc(ctx, sizeof(bytebuffer_t));
+  s->buf_start = rtalloc(ctx, size);
+  s->readcursor = s->writecursor = s->buf_start;
+  s->capacity = size;
+  memset(s->buf_start,0,size);
+  RTDEBUGF(4,"We create a buffer on %p of %d bytes", s->buf_start, size);
+  return s;
 }
 
 /**
 * Allocate just the internal buffer of an existing bytebuffer_t
 * struct. Useful for allocating short-lived bytebuffers off the stack.
 */
-void 
+void
 bytebuffer_init_with_size(const RTCTX *ctx, bytebuffer_t *b, size_t size)
 {
-	b->buf_start = rtalloc(ctx, size);
-	b->readcursor = b->writecursor = b->buf_start;
-	b->capacity = size;
-	memset(b->buf_start, 0, size);
+  b->buf_start = rtalloc(ctx, size);
+  b->readcursor = b->writecursor = b->buf_start;
+  b->capacity = size;
+  memset(b->buf_start, 0, size);
 }
 
 /**
 * Free the bytebuffer_t and all memory managed within it.
 */
-void 
+void
 bytebuffer_destroy(const RTCTX *ctx, bytebuffer_t *s)
 {
-	RTDEBUG(2,"Entered bytebuffer_destroy");
-	RTDEBUGF(4,"The buffer has used %d bytes",bytebuffer_getlength(ctx, s));
-	
-	if ( s->buf_start ) 
-	{
-		RTDEBUGF(4,"let's free buf_start %p",s->buf_start);
-		rtfree(ctx, s->buf_start);
-		RTDEBUG(4,"buf_start is freed");
-	}
-	if ( s ) 
-	{
-		rtfree(ctx, s);		
-		RTDEBUG(4,"bytebuffer_t is freed");
-	}
-	return;
+  RTDEBUG(2,"Entered bytebuffer_destroy");
+  RTDEBUGF(4,"The buffer has used %d bytes",bytebuffer_getlength(ctx, s));
+
+  if ( s->buf_start )
+  {
+    RTDEBUGF(4,"let's free buf_start %p",s->buf_start);
+    rtfree(ctx, s->buf_start);
+    RTDEBUG(4,"buf_start is freed");
+  }
+  if ( s )
+  {
+    rtfree(ctx, s);
+    RTDEBUG(4,"bytebuffer_t is freed");
+  }
+  return;
 }
 
 /**
 * Set the read cursor to the beginning
 */
-void 
+void
 bytebuffer_reset_reading(const RTCTX *ctx, bytebuffer_t *s)
 {
-	s->readcursor = s->buf_start;
+  s->readcursor = s->buf_start;
 }
 
 /**
@@ -106,105 +106,105 @@ bytebuffer_reset_reading(const RTCTX *ctx, bytebuffer_t *s)
 * without the expense of freeing and re-allocating a new
 * bytebuffer_t.
 */
-void 
+void
 bytebuffer_clear(const RTCTX *ctx, bytebuffer_t *s)
 {
-	s->readcursor = s->writecursor = s->buf_start;
+  s->readcursor = s->writecursor = s->buf_start;
 }
 
 /**
 * If necessary, expand the bytebuffer_t internal buffer to accomodate the
 * specified additional size.
 */
-static inline void 
+static inline void
 bytebuffer_makeroom(const RTCTX *ctx, bytebuffer_t *s, size_t size_to_add)
 {
-	RTDEBUGF(2,"Entered bytebuffer_makeroom with space need of %d", size_to_add);
-	size_t current_write_size = (s->writecursor - s->buf_start);
-	size_t capacity = s->capacity;
-	size_t required_size = current_write_size + size_to_add;
-
-	RTDEBUGF(2,"capacity = %d and required size = %d",capacity ,required_size);
-	while (capacity < required_size)
-		capacity *= 2;
-
-	if ( capacity > s->capacity )
-	{
-		RTDEBUGF(4,"We need to realloc more memory. New capacity is %d", capacity);
-		s->buf_start = rtrealloc(ctx, s->buf_start, capacity);
-		s->capacity = capacity;
-		s->writecursor = s->buf_start + current_write_size;
-		s->readcursor = s->buf_start + (s->readcursor - s->buf_start);
-	}
-	return;
+  RTDEBUGF(2,"Entered bytebuffer_makeroom with space need of %d", size_to_add);
+  size_t current_write_size = (s->writecursor - s->buf_start);
+  size_t capacity = s->capacity;
+  size_t required_size = current_write_size + size_to_add;
+
+  RTDEBUGF(2,"capacity = %d and required size = %d",capacity ,required_size);
+  while (capacity < required_size)
+    capacity *= 2;
+
+  if ( capacity > s->capacity )
+  {
+    RTDEBUGF(4,"We need to realloc more memory. New capacity is %d", capacity);
+    s->buf_start = rtrealloc(ctx, s->buf_start, capacity);
+    s->capacity = capacity;
+    s->writecursor = s->buf_start + current_write_size;
+    s->readcursor = s->buf_start + (s->readcursor - s->buf_start);
+  }
+  return;
 }
 
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_byte(const RTCTX *ctx, bytebuffer_t *s, const uint8_t val)
-{	
-	RTDEBUGF(2,"Entered bytebuffer_append_byte with value %d", val);	
-	bytebuffer_makeroom(ctx, s, 1);
-	*(s->writecursor)=val;
-	s->writecursor += 1;
-	return;
+{
+  RTDEBUGF(2,"Entered bytebuffer_append_byte with value %d", val);
+  bytebuffer_makeroom(ctx, s, 1);
+  *(s->writecursor)=val;
+  s->writecursor += 1;
+  return;
 }
 
 
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_bulk(const RTCTX *ctx, bytebuffer_t *s, void * start, size_t size)
-{	
-	RTDEBUGF(2,"bytebuffer_append_bulk with size %d",size);	
-	bytebuffer_makeroom(ctx, s, size);
-	memcpy(s->writecursor, start, size);
-	s->writecursor += size;
-	return;
+{
+  RTDEBUGF(2,"bytebuffer_append_bulk with size %d",size);
+  bytebuffer_makeroom(ctx, s, size);
+  memcpy(s->writecursor, start, size);
+  s->writecursor += size;
+  return;
 }
 
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_bytebuffer(const RTCTX *ctx, bytebuffer_t *write_to,bytebuffer_t *write_from )
-{	
-	RTDEBUG(2,"bytebuffer_append_bytebuffer");	
-	size_t size = bytebuffer_getlength(ctx, write_from);
-	bytebuffer_makeroom(ctx, write_to, size);
-	memcpy(write_to->writecursor, write_from->buf_start, size);
-	write_to->writecursor += size;
-	return;
+{
+  RTDEBUG(2,"bytebuffer_append_bytebuffer");
+  size_t size = bytebuffer_getlength(ctx, write_from);
+  bytebuffer_makeroom(ctx, write_to, size);
+  memcpy(write_to->writecursor, write_from->buf_start, size);
+  write_to->writecursor += size;
+  return;
 }
 
 
 /**
 * Writes a signed varInt to the buffer
 */
-void 
+void
 bytebuffer_append_varint(const RTCTX *ctx, bytebuffer_t *b, const int64_t val)
-{	
-	size_t size;
-	bytebuffer_makeroom(ctx, b, 8);
-	size = varint_s64_encode_buf(ctx, val, b->writecursor);
-	b->writecursor += size;
-	return;
+{
+  size_t size;
+  bytebuffer_makeroom(ctx, b, 8);
+  size = varint_s64_encode_buf(ctx, val, b->writecursor);
+  b->writecursor += size;
+  return;
 }
 
 /**
 * Writes a unsigned varInt to the buffer
 */
-void 
+void
 bytebuffer_append_uvarint(const RTCTX *ctx, bytebuffer_t *b, const uint64_t val)
-{	
-	size_t size;
-	bytebuffer_makeroom(ctx, b, 8);
-	size = varint_u64_encode_buf(ctx, val, b->writecursor);
-	b->writecursor += size;
-	return;
+{
+  size_t size;
+  bytebuffer_makeroom(ctx, b, 8);
+  size = varint_u64_encode_buf(ctx, val, b->writecursor);
+  b->writecursor += size;
+  return;
 }
 
 
@@ -214,38 +214,38 @@ bytebuffer_append_uvarint(const RTCTX *ctx, bytebuffer_t *b, const uint64_t val)
 void
 bytebuffer_append_int(const RTCTX *ctx, bytebuffer_t *buf, const int val, int swap)
 {
-	RTDEBUGF(2,"Entered bytebuffer_append_int with value %d, swap = %d", val, swap);	
-	
-	RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
-	char *iptr = (char*)(&val);
-	int i = 0;
-
-	if ( sizeof(int) != RTWKB_INT_SIZE )
-	{
-		rterror(ctx, "Machine int size is not %d bytes!", RTWKB_INT_SIZE);
-	}
-	
-	bytebuffer_makeroom(ctx, buf, RTWKB_INT_SIZE);
-	/* Machine/request arch mismatch, so flip byte order */
-	if ( swap)
-	{
-		RTDEBUG(4,"Ok, let's do the swaping thing");	
-		for ( i = 0; i < RTWKB_INT_SIZE; i++ )
-		{
-			*(buf->writecursor) = iptr[RTWKB_INT_SIZE - 1 - i];
-			buf->writecursor += 1;
-		}
-	}
-	/* If machine arch and requested arch match, don't flip byte order */
-	else
-	{
-		RTDEBUG(4,"Ok, let's do the memcopying thing");		
-		memcpy(buf->writecursor, iptr, RTWKB_INT_SIZE);
-		buf->writecursor += RTWKB_INT_SIZE;
-	}
-	
-	RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
-	return;
+  RTDEBUGF(2,"Entered bytebuffer_append_int with value %d, swap = %d", val, swap);
+
+  RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
+  char *iptr = (char*)(&val);
+  int i = 0;
+
+  if ( sizeof(int) != RTWKB_INT_SIZE )
+  {
+    rterror(ctx, "Machine int size is not %d bytes!", RTWKB_INT_SIZE);
+  }
+
+  bytebuffer_makeroom(ctx, buf, RTWKB_INT_SIZE);
+  /* Machine/request arch mismatch, so flip byte order */
+  if ( swap)
+  {
+    RTDEBUG(4,"Ok, let's do the swaping thing");
+    for ( i = 0; i < RTWKB_INT_SIZE; i++ )
+    {
+      *(buf->writecursor) = iptr[RTWKB_INT_SIZE - 1 - i];
+      buf->writecursor += 1;
+    }
+  }
+  /* If machine arch and requested arch match, don't flip byte order */
+  else
+  {
+    RTDEBUG(4,"Ok, let's do the memcopying thing");
+    memcpy(buf->writecursor, iptr, RTWKB_INT_SIZE);
+    buf->writecursor += RTWKB_INT_SIZE;
+  }
+
+  RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
+  return;
 
 }
 
@@ -259,73 +259,73 @@ bytebuffer_append_int(const RTCTX *ctx, bytebuffer_t *buf, const int val, int sw
 void
 bytebuffer_append_double(const RTCTX *ctx, bytebuffer_t *buf, const double val, int swap)
 {
-	RTDEBUGF(2,"Entered bytebuffer_append_double with value %lf swap = %d", val, swap);	
-	
-	RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
-	char *dptr = (char*)(&val);
-	int i = 0;
-
-	if ( sizeof(double) != RTWKB_DOUBLE_SIZE )
-	{
-		rterror(ctx, "Machine double size is not %d bytes!", RTWKB_DOUBLE_SIZE);
-	}
-
-	bytebuffer_makeroom(ctx, buf, RTWKB_DOUBLE_SIZE);
-	
-	/* Machine/request arch mismatch, so flip byte order */
-	if ( swap )
-	{
-		RTDEBUG(4,"Ok, let's do the swapping thing");		
-		for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
-		{
-			*(buf->writecursor) = dptr[RTWKB_DOUBLE_SIZE - 1 - i];
-			buf->writecursor += 1;
-		}
-	}
-	/* If machine arch and requested arch match, don't flip byte order */
-	else
-	{
-		RTDEBUG(4,"Ok, let's do the memcopying thing");			
-		memcpy(buf->writecursor, dptr, RTWKB_DOUBLE_SIZE);
-		buf->writecursor += RTWKB_DOUBLE_SIZE;
-	}
-	
-	RTDEBUG(4,"Return from bytebuffer_append_double");		
-	return;
+  RTDEBUGF(2,"Entered bytebuffer_append_double with value %lf swap = %d", val, swap);
+
+  RTDEBUGF(4,"buf_start = %p and write_cursor=%p", buf->buf_start,buf->writecursor);
+  char *dptr = (char*)(&val);
+  int i = 0;
+
+  if ( sizeof(double) != RTWKB_DOUBLE_SIZE )
+  {
+    rterror(ctx, "Machine double size is not %d bytes!", RTWKB_DOUBLE_SIZE);
+  }
+
+  bytebuffer_makeroom(ctx, buf, RTWKB_DOUBLE_SIZE);
+
+  /* Machine/request arch mismatch, so flip byte order */
+  if ( swap )
+  {
+    RTDEBUG(4,"Ok, let's do the swapping thing");
+    for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
+    {
+      *(buf->writecursor) = dptr[RTWKB_DOUBLE_SIZE - 1 - i];
+      buf->writecursor += 1;
+    }
+  }
+  /* If machine arch and requested arch match, don't flip byte order */
+  else
+  {
+    RTDEBUG(4,"Ok, let's do the memcopying thing");
+    memcpy(buf->writecursor, dptr, RTWKB_DOUBLE_SIZE);
+    buf->writecursor += RTWKB_DOUBLE_SIZE;
+  }
+
+  RTDEBUG(4,"Return from bytebuffer_append_double");
+  return;
 
 }
 
 /**
 * Reads a signed varInt from the buffer
 */
-int64_t 
+int64_t
 bytebuffer_read_varint(const RTCTX *ctx, bytebuffer_t *b)
 {
-	size_t size;
-	int64_t val = varint_s64_decode(ctx, b->readcursor, b->buf_start + b->capacity, &size);
-	b->readcursor += size;
-	return val;
+  size_t size;
+  int64_t val = varint_s64_decode(ctx, b->readcursor, b->buf_start + b->capacity, &size);
+  b->readcursor += size;
+  return val;
 }
 
 /**
 * Reads a unsigned varInt from the buffer
 */
-uint64_t 
+uint64_t
 bytebuffer_read_uvarint(const RTCTX *ctx, bytebuffer_t *b)
-{	
-	size_t size;
-	uint64_t val = varint_u64_decode(ctx, b->readcursor, b->buf_start + b->capacity, &size);
-	b->readcursor += size;
-	return val;
+{
+  size_t size;
+  uint64_t val = varint_u64_decode(ctx, b->readcursor, b->buf_start + b->capacity, &size);
+  b->readcursor += size;
+  return val;
 }
 
 /**
 * Returns the length of the current buffer
 */
-size_t 
+size_t
 bytebuffer_getlength(const RTCTX *ctx, bytebuffer_t *s)
 {
-	return (size_t) (s->writecursor - s->buf_start);
+  return (size_t) (s->writecursor - s->buf_start);
 }
 
 
@@ -336,23 +336,23 @@ bytebuffer_getlength(const RTCTX *ctx, bytebuffer_t *s)
 bytebuffer_t*
 bytebuffer_merge(const RTCTX *ctx, bytebuffer_t **buff_array, int nbuffers)
 {
-	size_t total_size = 0, current_size, acc_size = 0;
-	int i;
-	for ( i = 0; i < nbuffers; i++ )
-	{
-		total_size += bytebuffer_getlength(ctx, buff_array[i]);
-	}
-		
-	bytebuffer_t *res = bytebuffer_create_with_size(ctx, total_size);
-	for ( i = 0; i < nbuffers; i++)
-	{
-		current_size = bytebuffer_getlength(ctx, buff_array[i]);
-		memcpy(res->buf_start+acc_size, buff_array[i]->buf_start, current_size);
-		acc_size += current_size;
-	}
-	res->writecursor = res->buf_start + total_size;
-	res->readcursor = res->buf_start;
-	return res;
+  size_t total_size = 0, current_size, acc_size = 0;
+  int i;
+  for ( i = 0; i < nbuffers; i++ )
+  {
+    total_size += bytebuffer_getlength(ctx, buff_array[i]);
+  }
+
+  bytebuffer_t *res = bytebuffer_create_with_size(ctx, total_size);
+  for ( i = 0; i < nbuffers; i++)
+  {
+    current_size = bytebuffer_getlength(ctx, buff_array[i]);
+    memcpy(res->buf_start+acc_size, buff_array[i]->buf_start, current_size);
+    acc_size += current_size;
+  }
+  res->writecursor = res->buf_start + total_size;
+  res->readcursor = res->buf_start;
+  return res;
 }
 
 
diff --git a/src/bytebuffer.h b/src/bytebuffer.h
index fe7b257..321f971 100644
--- a/src/bytebuffer.h
+++ b/src/bytebuffer.h
@@ -37,10 +37,10 @@
 
 typedef struct
 {
-	size_t capacity;
-	uint8_t *buf_start;
-	uint8_t *writecursor;	
-	uint8_t *readcursor;	
+  size_t capacity;
+  uint8_t *buf_start;
+  uint8_t *writecursor;
+  uint8_t *readcursor;
 }
 bytebuffer_t;
 
diff --git a/src/g_box.c b/src/g_box.c
index 76b1d0b..036d1b4 100644
--- a/src/g_box.c
+++ b/src/g_box.c
@@ -34,138 +34,138 @@
 
 RTGBOX* gbox_new(const RTCTX *ctx, uint8_t flags)
 {
-	RTGBOX *g = (RTGBOX*)rtalloc(ctx, sizeof(RTGBOX));
-	gbox_init(ctx, g);
-	g->flags = flags;
-	return g;
+  RTGBOX *g = (RTGBOX*)rtalloc(ctx, sizeof(RTGBOX));
+  gbox_init(ctx, g);
+  g->flags = flags;
+  return g;
 }
 
 void gbox_init(const RTCTX *ctx, RTGBOX *gbox)
 {
-	memset(gbox, 0, sizeof(RTGBOX));
+  memset(gbox, 0, sizeof(RTGBOX));
 }
 
 RTGBOX* gbox_clone(const RTCTX *ctx, const RTGBOX *gbox)
 {
-	RTGBOX *g = rtalloc(ctx, sizeof(RTGBOX));
-	memcpy(g, gbox, sizeof(RTGBOX));
-	return g;
+  RTGBOX *g = rtalloc(ctx, sizeof(RTGBOX));
+  memcpy(g, gbox, sizeof(RTGBOX));
+  return g;
 }
 
 /* TODO to be removed */
 BOX3D* box3d_from_gbox(const RTCTX *ctx, const RTGBOX *gbox)
 {
-	BOX3D *b;
-	assert(gbox);
-	
-	b = rtalloc(ctx, sizeof(BOX3D));
+  BOX3D *b;
+  assert(gbox);
 
-	b->xmin = gbox->xmin;
-	b->xmax = gbox->xmax;
-	b->ymin = gbox->ymin;
-	b->ymax = gbox->ymax;
+  b = rtalloc(ctx, sizeof(BOX3D));
 
-	if ( RTFLAGS_GET_Z(gbox->flags) )
-	{
-		b->zmin = gbox->zmin;
-		b->zmax = gbox->zmax;
-	}
-	else
-	{
-		b->zmin = b->zmax = 0.0;
-	}
+  b->xmin = gbox->xmin;
+  b->xmax = gbox->xmax;
+  b->ymin = gbox->ymin;
+  b->ymax = gbox->ymax;
 
-	b->srid = SRID_UNKNOWN;
- 	return b;	
+  if ( RTFLAGS_GET_Z(gbox->flags) )
+  {
+    b->zmin = gbox->zmin;
+    b->zmax = gbox->zmax;
+  }
+  else
+  {
+    b->zmin = b->zmax = 0.0;
+  }
+
+  b->srid = SRID_UNKNOWN;
+   return b;
 }
 
 /* TODO to be removed */
 RTGBOX* box3d_to_gbox(const RTCTX *ctx, const BOX3D *b3d)
 {
-	RTGBOX *b;
-	assert(b3d);
-	
-	b = rtalloc(ctx, sizeof(RTGBOX));
+  RTGBOX *b;
+  assert(b3d);
+
+  b = rtalloc(ctx, sizeof(RTGBOX));
 
-	b->xmin = b3d->xmin;
-	b->xmax = b3d->xmax;
-	b->ymin = b3d->ymin;
-	b->ymax = b3d->ymax;
-	b->zmin = b3d->zmin;
-	b->zmax = b3d->zmax;
+  b->xmin = b3d->xmin;
+  b->xmax = b3d->xmax;
+  b->ymin = b3d->ymin;
+  b->ymax = b3d->ymax;
+  b->zmin = b3d->zmin;
+  b->zmax = b3d->zmax;
 
- 	return b;
+   return b;
 }
 
 void gbox_expand(const RTCTX *ctx, RTGBOX *g, double d)
 {
-	g->xmin -= d;
-	g->xmax += d;
-	g->ymin -= d;
-	g->ymax += d;
-	if ( RTFLAGS_GET_Z(g->flags) )
-	{
-		g->zmin -= d;
-		g->zmax += d;
-	}
-	if ( RTFLAGS_GET_M(g->flags) )
-	{
-		g->mmin -= d;
-		g->mmax += d;
-	}
+  g->xmin -= d;
+  g->xmax += d;
+  g->ymin -= d;
+  g->ymax += d;
+  if ( RTFLAGS_GET_Z(g->flags) )
+  {
+    g->zmin -= d;
+    g->zmax += d;
+  }
+  if ( RTFLAGS_GET_M(g->flags) )
+  {
+    g->mmin -= d;
+    g->mmax += d;
+  }
 }
 
 int gbox_union(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2, RTGBOX *gout)
 {
-	if ( ( ! g1 ) && ( ! g2 ) )
-		return RT_FALSE;
+  if ( ( ! g1 ) && ( ! g2 ) )
+    return RT_FALSE;
+
+  if  ( ! g1 )
+  {
+    memcpy(gout, g2, sizeof(RTGBOX));
+    return RT_TRUE;
+  }
+  if ( ! g2 )
+  {
+    memcpy(gout, g1, sizeof(RTGBOX));
+    return RT_TRUE;
+  }
 
-	if  ( ! g1 )
-	{
-		memcpy(gout, g2, sizeof(RTGBOX));
-		return RT_TRUE;
-	}
-	if ( ! g2 )
-	{
-		memcpy(gout, g1, sizeof(RTGBOX));
-		return RT_TRUE;
-	}
-	
-	gout->flags = g1->flags;
+  gout->flags = g1->flags;
 
-	gout->xmin = FP_MIN(g1->xmin, g2->xmin);
-	gout->xmax = FP_MAX(g1->xmax, g2->xmax);
+  gout->xmin = FP_MIN(g1->xmin, g2->xmin);
+  gout->xmax = FP_MAX(g1->xmax, g2->xmax);
 
-	gout->ymin = FP_MIN(g1->ymin, g2->ymin);
-	gout->ymax = FP_MAX(g1->ymax, g2->ymax);
-	
-	gout->zmin = FP_MIN(g1->zmin, g2->zmin);
-	gout->zmax = FP_MAX(g1->zmax, g2->zmax);
+  gout->ymin = FP_MIN(g1->ymin, g2->ymin);
+  gout->ymax = FP_MAX(g1->ymax, g2->ymax);
 
-	return RT_TRUE;
+  gout->zmin = FP_MIN(g1->zmin, g2->zmin);
+  gout->zmax = FP_MAX(g1->zmax, g2->zmax);
+
+  return RT_TRUE;
 }
 
 int gbox_same(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 {
-	if (RTFLAGS_GET_ZM(g1->flags) != RTFLAGS_GET_ZM(g2->flags))
-		return RT_FALSE;
+  if (RTFLAGS_GET_ZM(g1->flags) != RTFLAGS_GET_ZM(g2->flags))
+    return RT_FALSE;
 
-	if (!gbox_same_2d(ctx, g1, g2)) return RT_FALSE;
+  if (!gbox_same_2d(ctx, g1, g2)) return RT_FALSE;
 
-	if (RTFLAGS_GET_Z(g1->flags) && (g1->zmin != g2->zmin || g1->zmax != g2->zmax))
-		return RT_FALSE;
-	if (RTFLAGS_GET_M(g1->flags) && (g1->mmin != g2->mmin || g1->mmax != g2->mmax))
-		return RT_FALSE;
+  if (RTFLAGS_GET_Z(g1->flags) && (g1->zmin != g2->zmin || g1->zmax != g2->zmax))
+    return RT_FALSE;
+  if (RTFLAGS_GET_M(g1->flags) && (g1->mmin != g2->mmin || g1->mmax != g2->mmax))
+    return RT_FALSE;
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 int gbox_same_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 {
     if (g1->xmin == g2->xmin && g1->ymin == g2->ymin &&
         g1->xmax == g2->xmax && g1->ymax == g2->ymax)
-		return RT_TRUE;
-	return RT_FALSE;
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 int gbox_same_2d_float(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
@@ -180,165 +180,165 @@ int gbox_same_2d_float(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 
 int gbox_is_valid(const RTCTX *ctx, const RTGBOX *gbox)
 {
-	/* X */
-	if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
-	     ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
-		return RT_FALSE;
-		
-	/* Y */
-	if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
-	     ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
-		return RT_FALSE;
-		
-	/* Z */
-	if ( RTFLAGS_GET_GEODETIC(gbox->flags) || RTFLAGS_GET_Z(gbox->flags) )
-	{
-		if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
-		     ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
-			return RT_FALSE;
-	}
-
-	/* M */
-	if ( RTFLAGS_GET_M(gbox->flags) )
-	{
-		if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
-		     ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
-			return RT_FALSE;
-	}
-	
-	return RT_TRUE;		
+  /* X */
+  if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
+       ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
+    return RT_FALSE;
+
+  /* Y */
+  if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
+       ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
+    return RT_FALSE;
+
+  /* Z */
+  if ( RTFLAGS_GET_GEODETIC(gbox->flags) || RTFLAGS_GET_Z(gbox->flags) )
+  {
+    if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
+         ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
+      return RT_FALSE;
+  }
+
+  /* M */
+  if ( RTFLAGS_GET_M(gbox->flags) )
+  {
+    if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
+         ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
+      return RT_FALSE;
+  }
+
+  return RT_TRUE;
 }
 
 int gbox_merge_point3d(const RTCTX *ctx, const POINT3D *p, RTGBOX *gbox)
 {
-	if ( gbox->xmin > p->x ) gbox->xmin = p->x;
-	if ( gbox->ymin > p->y ) gbox->ymin = p->y;
-	if ( gbox->zmin > p->z ) gbox->zmin = p->z;
-	if ( gbox->xmax < p->x ) gbox->xmax = p->x;
-	if ( gbox->ymax < p->y ) gbox->ymax = p->y;
-	if ( gbox->zmax < p->z ) gbox->zmax = p->z;
-	return RT_SUCCESS;
+  if ( gbox->xmin > p->x ) gbox->xmin = p->x;
+  if ( gbox->ymin > p->y ) gbox->ymin = p->y;
+  if ( gbox->zmin > p->z ) gbox->zmin = p->z;
+  if ( gbox->xmax < p->x ) gbox->xmax = p->x;
+  if ( gbox->ymax < p->y ) gbox->ymax = p->y;
+  if ( gbox->zmax < p->z ) gbox->zmax = p->z;
+  return RT_SUCCESS;
 }
 
 int gbox_init_point3d(const RTCTX *ctx, const POINT3D *p, RTGBOX *gbox)
 {
-	gbox->xmin = gbox->xmax = p->x;
-	gbox->ymin = gbox->ymax = p->y;
-	gbox->zmin = gbox->zmax = p->z;
-	return RT_SUCCESS;
+  gbox->xmin = gbox->xmax = p->x;
+  gbox->ymin = gbox->ymax = p->y;
+  gbox->zmin = gbox->zmax = p->z;
+  return RT_SUCCESS;
 }
 
 int gbox_contains_point3d(const RTCTX *ctx, const RTGBOX *gbox, const POINT3D *pt)
 {
-	if ( gbox->xmin > pt->x || gbox->ymin > pt->y || gbox->zmin > pt->z ||
-	        gbox->xmax < pt->x || gbox->ymax < pt->y || gbox->zmax < pt->z )
-	{
-		return RT_FALSE;
-	}
-	return RT_TRUE;
+  if ( gbox->xmin > pt->x || gbox->ymin > pt->y || gbox->zmin > pt->z ||
+          gbox->xmax < pt->x || gbox->ymax < pt->y || gbox->zmax < pt->z )
+  {
+    return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 int gbox_merge(const RTCTX *ctx, const RTGBOX *new_box, RTGBOX *merge_box)
 {
-	assert(merge_box);
+  assert(merge_box);
 
-	if ( RTFLAGS_GET_ZM(merge_box->flags) != RTFLAGS_GET_ZM(new_box->flags) )
-		return RT_FAILURE;
+  if ( RTFLAGS_GET_ZM(merge_box->flags) != RTFLAGS_GET_ZM(new_box->flags) )
+    return RT_FAILURE;
 
-	if ( new_box->xmin < merge_box->xmin) merge_box->xmin = new_box->xmin;
-	if ( new_box->ymin < merge_box->ymin) merge_box->ymin = new_box->ymin;
-	if ( new_box->xmax > merge_box->xmax) merge_box->xmax = new_box->xmax;
-	if ( new_box->ymax > merge_box->ymax) merge_box->ymax = new_box->ymax;
+  if ( new_box->xmin < merge_box->xmin) merge_box->xmin = new_box->xmin;
+  if ( new_box->ymin < merge_box->ymin) merge_box->ymin = new_box->ymin;
+  if ( new_box->xmax > merge_box->xmax) merge_box->xmax = new_box->xmax;
+  if ( new_box->ymax > merge_box->ymax) merge_box->ymax = new_box->ymax;
 
-	if ( RTFLAGS_GET_Z(merge_box->flags) || RTFLAGS_GET_GEODETIC(merge_box->flags) )
-	{
-		if ( new_box->zmin < merge_box->zmin) merge_box->zmin = new_box->zmin;
-		if ( new_box->zmax > merge_box->zmax) merge_box->zmax = new_box->zmax;
-	}
-	if ( RTFLAGS_GET_M(merge_box->flags) )
-	{
-		if ( new_box->mmin < merge_box->mmin) merge_box->mmin = new_box->mmin;
-		if ( new_box->mmax > merge_box->mmax) merge_box->mmax = new_box->mmax;
-	}
+  if ( RTFLAGS_GET_Z(merge_box->flags) || RTFLAGS_GET_GEODETIC(merge_box->flags) )
+  {
+    if ( new_box->zmin < merge_box->zmin) merge_box->zmin = new_box->zmin;
+    if ( new_box->zmax > merge_box->zmax) merge_box->zmax = new_box->zmax;
+  }
+  if ( RTFLAGS_GET_M(merge_box->flags) )
+  {
+    if ( new_box->mmin < merge_box->mmin) merge_box->mmin = new_box->mmin;
+    if ( new_box->mmax > merge_box->mmax) merge_box->mmax = new_box->mmax;
+  }
 
-	return RT_SUCCESS;
+  return RT_SUCCESS;
 }
 
 int gbox_overlaps(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 {
 
-	/* Make sure our boxes are consistent */
-	if ( RTFLAGS_GET_GEODETIC(g1->flags) != RTFLAGS_GET_GEODETIC(g2->flags) )
-		rterror(ctx, "gbox_overlaps: cannot compare geodetic and non-geodetic boxes");
-
-	/* Check X/Y first */
-	if ( g1->xmax < g2->xmin || g1->ymax < g2->ymin ||
-	     g1->xmin > g2->xmax || g1->ymin > g2->ymax )
-		return RT_FALSE;
-
-	/* Deal with the geodetic case special: we only compare the geodetic boxes (x/y/z) */
-	/* Never the M dimension */
-	if ( RTFLAGS_GET_GEODETIC(g1->flags) && RTFLAGS_GET_GEODETIC(g2->flags) )
-	{
-		if ( g1->zmax < g2->zmin || g1->zmin > g2->zmax )
-			return RT_FALSE;
-		else
-			return RT_TRUE;		
-	}
-		
-	/* If both geodetic or both have Z, check Z */
-	if ( RTFLAGS_GET_Z(g1->flags) && RTFLAGS_GET_Z(g2->flags) )
-	{
-		if ( g1->zmax < g2->zmin || g1->zmin > g2->zmax )
-			return RT_FALSE;
-	}
-	
-	/* If both have M, check M */
-	if ( RTFLAGS_GET_M(g1->flags) && RTFLAGS_GET_M(g2->flags) )
-	{
-		if ( g1->mmax < g2->mmin || g1->mmin > g2->mmax )
-			return RT_FALSE;
-	}
-	
-	return RT_TRUE;
-}
-
-int 
+  /* Make sure our boxes are consistent */
+  if ( RTFLAGS_GET_GEODETIC(g1->flags) != RTFLAGS_GET_GEODETIC(g2->flags) )
+    rterror(ctx, "gbox_overlaps: cannot compare geodetic and non-geodetic boxes");
+
+  /* Check X/Y first */
+  if ( g1->xmax < g2->xmin || g1->ymax < g2->ymin ||
+       g1->xmin > g2->xmax || g1->ymin > g2->ymax )
+    return RT_FALSE;
+
+  /* Deal with the geodetic case special: we only compare the geodetic boxes (x/y/z) */
+  /* Never the M dimension */
+  if ( RTFLAGS_GET_GEODETIC(g1->flags) && RTFLAGS_GET_GEODETIC(g2->flags) )
+  {
+    if ( g1->zmax < g2->zmin || g1->zmin > g2->zmax )
+      return RT_FALSE;
+    else
+      return RT_TRUE;
+  }
+
+  /* If both geodetic or both have Z, check Z */
+  if ( RTFLAGS_GET_Z(g1->flags) && RTFLAGS_GET_Z(g2->flags) )
+  {
+    if ( g1->zmax < g2->zmin || g1->zmin > g2->zmax )
+      return RT_FALSE;
+  }
+
+  /* If both have M, check M */
+  if ( RTFLAGS_GET_M(g1->flags) && RTFLAGS_GET_M(g2->flags) )
+  {
+    if ( g1->mmax < g2->mmin || g1->mmin > g2->mmax )
+      return RT_FALSE;
+  }
+
+  return RT_TRUE;
+}
+
+int
 gbox_overlaps_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 {
 
-	/* Make sure our boxes are consistent */
-	if ( RTFLAGS_GET_GEODETIC(g1->flags) != RTFLAGS_GET_GEODETIC(g2->flags) )
-		rterror(ctx, "gbox_overlaps: cannot compare geodetic and non-geodetic boxes");
+  /* Make sure our boxes are consistent */
+  if ( RTFLAGS_GET_GEODETIC(g1->flags) != RTFLAGS_GET_GEODETIC(g2->flags) )
+    rterror(ctx, "gbox_overlaps: cannot compare geodetic and non-geodetic boxes");
 
-	/* Check X/Y first */
-	if ( g1->xmax < g2->xmin || g1->ymax < g2->ymin ||
-	     g1->xmin > g2->xmax || g1->ymin > g2->ymax )
-		return RT_FALSE;
-		
-	return RT_TRUE;
+  /* Check X/Y first */
+  if ( g1->xmax < g2->xmin || g1->ymax < g2->ymin ||
+       g1->xmin > g2->xmax || g1->ymin > g2->ymax )
+    return RT_FALSE;
+
+  return RT_TRUE;
 }
 
-int 
+int
 gbox_contains_2d(const RTCTX *ctx, const RTGBOX *g1, const RTGBOX *g2)
 {
-	if ( ( g2->xmin < g1->xmin ) || ( g2->xmax > g1->xmax ) ||
-	     ( g2->ymin < g1->ymin ) || ( g2->ymax > g1->ymax ) )
-	{
-		return RT_FALSE;
-	}
-	return RT_TRUE;
+  if ( ( g2->xmin < g1->xmin ) || ( g2->xmax > g1->xmax ) ||
+       ( g2->ymin < g1->ymin ) || ( g2->ymax > g1->ymax ) )
+  {
+    return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
-int 
+int
 gbox_contains_point2d(const RTCTX *ctx, const RTGBOX *g, const RTPOINT2D *p)
 {
-	if ( ( g->xmin <= p->x ) && ( g->xmax >= p->x ) &&
-	     ( g->ymin <= p->y ) && ( g->ymax >= p->y ) )
-	{
-		return RT_TRUE;
-	}
-	return RT_FALSE;
+  if ( ( g->xmin <= p->x ) && ( g->xmax >= p->x ) &&
+       ( g->ymin <= p->y ) && ( g->ymax >= p->y ) )
+  {
+    return RT_TRUE;
+  }
+  return RT_FALSE;
 }
 
 /**
@@ -347,85 +347,85 @@ gbox_contains_point2d(const RTCTX *ctx, const RTGBOX *g, const RTPOINT2D *p)
 */
 RTGBOX* gbox_from_string(const RTCTX *ctx, const char *str)
 {
-	const char *ptr = str;
-	char *nextptr;
-	char *gbox_start = strstr(str, "RTGBOX((");
-	RTGBOX *gbox = gbox_new(ctx, gflags(ctx, 0,0,1));
-	if ( ! gbox_start ) return NULL; /* No header found */
-	ptr += 6;
-	gbox->xmin = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	ptr = nextptr + 1;
-	gbox->ymin = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	ptr = nextptr + 1;
-	gbox->zmin = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	ptr = nextptr + 3;
-	gbox->xmax = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	ptr = nextptr + 1;
-	gbox->ymax = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	ptr = nextptr + 1;
-	gbox->zmax = strtod(ptr, &nextptr);
-	if ( ptr == nextptr ) return NULL; /* No double found */
-	return gbox;
+  const char *ptr = str;
+  char *nextptr;
+  char *gbox_start = strstr(str, "RTGBOX((");
+  RTGBOX *gbox = gbox_new(ctx, gflags(ctx, 0,0,1));
+  if ( ! gbox_start ) return NULL; /* No header found */
+  ptr += 6;
+  gbox->xmin = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  ptr = nextptr + 1;
+  gbox->ymin = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  ptr = nextptr + 1;
+  gbox->zmin = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  ptr = nextptr + 3;
+  gbox->xmax = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  ptr = nextptr + 1;
+  gbox->ymax = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  ptr = nextptr + 1;
+  gbox->zmax = strtod(ptr, &nextptr);
+  if ( ptr == nextptr ) return NULL; /* No double found */
+  return gbox;
 }
 
 char* gbox_to_string(const RTCTX *ctx, const RTGBOX *gbox)
 {
-	static int sz = 128;
-	char *str = NULL;
-
-	if ( ! gbox )
-		return strdup("NULL POINTER");
-
-	str = (char*)rtalloc(ctx, sz);
-
-	if ( RTFLAGS_GET_GEODETIC(gbox->flags) )
-	{
-		snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
-		return str;
-	}
-	if ( RTFLAGS_GET_Z(gbox->flags) && RTFLAGS_GET_M(gbox->flags) )
-	{
-		snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->zmax, gbox->mmax);
-		return str;
-	}
-	if ( RTFLAGS_GET_Z(gbox->flags) )
-	{
-		snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
-		return str;
-	}
-	if ( RTFLAGS_GET_M(gbox->flags) )
-	{
-		snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->mmax);
-		return str;
-	}
-	snprintf(str, sz, "RTGBOX((%.8g,%.8g),(%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->xmax, gbox->ymax);
-	return str;
+  static int sz = 128;
+  char *str = NULL;
+
+  if ( ! gbox )
+    return strdup("NULL POINTER");
+
+  str = (char*)rtalloc(ctx, sz);
+
+  if ( RTFLAGS_GET_GEODETIC(gbox->flags) )
+  {
+    snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
+    return str;
+  }
+  if ( RTFLAGS_GET_Z(gbox->flags) && RTFLAGS_GET_M(gbox->flags) )
+  {
+    snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->zmax, gbox->mmax);
+    return str;
+  }
+  if ( RTFLAGS_GET_Z(gbox->flags) )
+  {
+    snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
+    return str;
+  }
+  if ( RTFLAGS_GET_M(gbox->flags) )
+  {
+    snprintf(str, sz, "RTGBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->mmax);
+    return str;
+  }
+  snprintf(str, sz, "RTGBOX((%.8g,%.8g),(%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->xmax, gbox->ymax);
+  return str;
 }
 
 RTGBOX* gbox_copy(const RTCTX *ctx, const RTGBOX *box)
 {
-	RTGBOX *copy = (RTGBOX*)rtalloc(ctx, sizeof(RTGBOX));
-	memcpy(copy, box, sizeof(RTGBOX));
-	return copy;
+  RTGBOX *copy = (RTGBOX*)rtalloc(ctx, sizeof(RTGBOX));
+  memcpy(copy, box, sizeof(RTGBOX));
+  return copy;
 }
 
 void gbox_duplicate(const RTCTX *ctx, const RTGBOX *original, RTGBOX *duplicate)
 {
-	assert(duplicate);
-	memcpy(duplicate, original, sizeof(RTGBOX));
+  assert(duplicate);
+  memcpy(duplicate, original, sizeof(RTGBOX));
 }
 
 size_t gbox_serialized_size(const RTCTX *ctx, uint8_t flags)
 {
-	if ( RTFLAGS_GET_GEODETIC(flags) )
-		return 6 * sizeof(float);
-	else
-		return 2 * RTFLAGS_NDIMS(flags) * sizeof(float);
+  if ( RTFLAGS_GET_GEODETIC(flags) )
+    return 6 * sizeof(float);
+  else
+    return 2 * RTFLAGS_NDIMS(flags) * sizeof(float);
 }
 
 
@@ -435,275 +435,275 @@ size_t gbox_serialized_size(const RTCTX *ctx, uint8_t flags)
 
 int rt_arc_calculate_gbox_cartesian_2d(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3, RTGBOX *gbox)
 {
-	RTPOINT2D xmin, ymin, xmax, ymax;
-	RTPOINT2D C;
-	int A2_side;
-	double radius_A;
+  RTPOINT2D xmin, ymin, xmax, ymax;
+  RTPOINT2D C;
+  int A2_side;
+  double radius_A;
 
-	RTDEBUG(2, "rt_arc_calculate_gbox_cartesian_2d called.");
+  RTDEBUG(2, "rt_arc_calculate_gbox_cartesian_2d called.");
 
-	radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
+  radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
 
-	/* Negative radius signals straight line, p1/p2/p3 are colinear */
-	if (radius_A < 0.0)
-	{
+  /* Negative radius signals straight line, p1/p2/p3 are colinear */
+  if (radius_A < 0.0)
+  {
         gbox->xmin = FP_MIN(A1->x, A3->x);
         gbox->ymin = FP_MIN(A1->y, A3->y);
         gbox->xmax = FP_MAX(A1->x, A3->x);
         gbox->ymax = FP_MAX(A1->y, A3->y);
-	    return RT_SUCCESS;
-	}
-
-	/* Matched start/end points imply circle */
-	if ( A1->x == A3->x && A1->y == A3->y )
-	{
-		gbox->xmin = C.x - radius_A;
-		gbox->ymin = C.y - radius_A;
-		gbox->xmax = C.x + radius_A;
-		gbox->ymax = C.y + radius_A;
-		return RT_SUCCESS;
-	}
-
-	/* First approximation, bounds of start/end points */
+      return RT_SUCCESS;
+  }
+
+  /* Matched start/end points imply circle */
+  if ( A1->x == A3->x && A1->y == A3->y )
+  {
+    gbox->xmin = C.x - radius_A;
+    gbox->ymin = C.y - radius_A;
+    gbox->xmax = C.x + radius_A;
+    gbox->ymax = C.y + radius_A;
+    return RT_SUCCESS;
+  }
+
+  /* First approximation, bounds of start/end points */
     gbox->xmin = FP_MIN(A1->x, A3->x);
     gbox->ymin = FP_MIN(A1->y, A3->y);
     gbox->xmax = FP_MAX(A1->x, A3->x);
     gbox->ymax = FP_MAX(A1->y, A3->y);
 
-	/* Create points for the possible extrema */
-	xmin.x = C.x - radius_A;
-	xmin.y = C.y;
-	ymin.x = C.x;
-	ymin.y = C.y - radius_A;
-	xmax.x = C.x + radius_A;
-	xmax.y = C.y;
-	ymax.x = C.x;
-	ymax.y = C.y + radius_A;
+  /* Create points for the possible extrema */
+  xmin.x = C.x - radius_A;
+  xmin.y = C.y;
+  ymin.x = C.x;
+  ymin.y = C.y - radius_A;
+  xmax.x = C.x + radius_A;
+  xmax.y = C.y;
+  ymax.x = C.x;
+  ymax.y = C.y + radius_A;
 
-	/* Divide the circle into two parts, one on each side of a line
-	   joining p1 and p3. The circle extrema on the same side of that line
-	   as p2 is on, are also the extrema of the bbox. */
+  /* Divide the circle into two parts, one on each side of a line
+     joining p1 and p3. The circle extrema on the same side of that line
+     as p2 is on, are also the extrema of the bbox. */
 
-	A2_side = rt_segment_side(ctx, A1, A3, A2);
+  A2_side = rt_segment_side(ctx, A1, A3, A2);
 
-	if ( A2_side == rt_segment_side(ctx, A1, A3, &xmin) )
-		gbox->xmin = xmin.x;
+  if ( A2_side == rt_segment_side(ctx, A1, A3, &xmin) )
+    gbox->xmin = xmin.x;
 
-	if ( A2_side == rt_segment_side(ctx, A1, A3, &ymin) )
-		gbox->ymin = ymin.y;
+  if ( A2_side == rt_segment_side(ctx, A1, A3, &ymin) )
+    gbox->ymin = ymin.y;
 
-	if ( A2_side == rt_segment_side(ctx, A1, A3, &xmax) )
-		gbox->xmax = xmax.x;
+  if ( A2_side == rt_segment_side(ctx, A1, A3, &xmax) )
+    gbox->xmax = xmax.x;
 
-	if ( A2_side == rt_segment_side(ctx, A1, A3, &ymax) )
-		gbox->ymax = ymax.y;
+  if ( A2_side == rt_segment_side(ctx, A1, A3, &ymax) )
+    gbox->ymax = ymax.y;
 
-	return RT_SUCCESS;
+  return RT_SUCCESS;
 }
 
 
 static int rt_arc_calculate_gbox_cartesian(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2, const RTPOINT4D *p3, RTGBOX *gbox)
 {
-	int rv;
+  int rv;
 
-	RTDEBUG(2, "rt_arc_calculate_gbox_cartesian called.");
+  RTDEBUG(2, "rt_arc_calculate_gbox_cartesian called.");
 
-	rv = rt_arc_calculate_gbox_cartesian_2d(ctx, (RTPOINT2D*)p1, (RTPOINT2D*)p2, (RTPOINT2D*)p3, gbox);
+  rv = rt_arc_calculate_gbox_cartesian_2d(ctx, (RTPOINT2D*)p1, (RTPOINT2D*)p2, (RTPOINT2D*)p3, gbox);
     gbox->zmin = FP_MIN(p1->z, p3->z);
     gbox->mmin = FP_MIN(p1->m, p3->m);
     gbox->zmax = FP_MAX(p1->z, p3->z);
     gbox->mmax = FP_MAX(p1->m, p3->m);
-	return rv;
+  return rv;
 }
 
 int ptarray_calculate_gbox_cartesian(const RTCTX *ctx, const RTPOINTARRAY *pa, RTGBOX *gbox )
 {
-	int i;
-	RTPOINT4D p;
-	int has_z, has_m;
-
-	if ( ! pa ) return RT_FAILURE;
-	if ( ! gbox ) return RT_FAILURE;
-	if ( pa->npoints < 1 ) return RT_FAILURE;
-
-	has_z = RTFLAGS_GET_Z(pa->flags);
-	has_m = RTFLAGS_GET_M(pa->flags);
-	gbox->flags = gflags(ctx, has_z, has_m, 0);
-	RTDEBUGF(4, "ptarray_calculate_gbox Z: %d M: %d", has_z, has_m);
-
-	rt_getPoint4d_p(ctx, pa, 0, &p);
-	gbox->xmin = gbox->xmax = p.x;
-	gbox->ymin = gbox->ymax = p.y;
-	if ( has_z )
-		gbox->zmin = gbox->zmax = p.z;
-	if ( has_m )
-		gbox->mmin = gbox->mmax = p.m;
-
-	for ( i = 1 ; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		gbox->xmin = FP_MIN(gbox->xmin, p.x);
-		gbox->xmax = FP_MAX(gbox->xmax, p.x);
-		gbox->ymin = FP_MIN(gbox->ymin, p.y);
-		gbox->ymax = FP_MAX(gbox->ymax, p.y);
-		if ( has_z )
-		{
-			gbox->zmin = FP_MIN(gbox->zmin, p.z);
-			gbox->zmax = FP_MAX(gbox->zmax, p.z);
-		}
-		if ( has_m )
-		{
-			gbox->mmin = FP_MIN(gbox->mmin, p.m);
-			gbox->mmax = FP_MAX(gbox->mmax, p.m);
-		}
-	}
-	return RT_SUCCESS;
+  int i;
+  RTPOINT4D p;
+  int has_z, has_m;
+
+  if ( ! pa ) return RT_FAILURE;
+  if ( ! gbox ) return RT_FAILURE;
+  if ( pa->npoints < 1 ) return RT_FAILURE;
+
+  has_z = RTFLAGS_GET_Z(pa->flags);
+  has_m = RTFLAGS_GET_M(pa->flags);
+  gbox->flags = gflags(ctx, has_z, has_m, 0);
+  RTDEBUGF(4, "ptarray_calculate_gbox Z: %d M: %d", has_z, has_m);
+
+  rt_getPoint4d_p(ctx, pa, 0, &p);
+  gbox->xmin = gbox->xmax = p.x;
+  gbox->ymin = gbox->ymax = p.y;
+  if ( has_z )
+    gbox->zmin = gbox->zmax = p.z;
+  if ( has_m )
+    gbox->mmin = gbox->mmax = p.m;
+
+  for ( i = 1 ; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    gbox->xmin = FP_MIN(gbox->xmin, p.x);
+    gbox->xmax = FP_MAX(gbox->xmax, p.x);
+    gbox->ymin = FP_MIN(gbox->ymin, p.y);
+    gbox->ymax = FP_MAX(gbox->ymax, p.y);
+    if ( has_z )
+    {
+      gbox->zmin = FP_MIN(gbox->zmin, p.z);
+      gbox->zmax = FP_MAX(gbox->zmax, p.z);
+    }
+    if ( has_m )
+    {
+      gbox->mmin = FP_MIN(gbox->mmin, p.m);
+      gbox->mmax = FP_MAX(gbox->mmax, p.m);
+    }
+  }
+  return RT_SUCCESS;
 }
 
 static int rtcircstring_calculate_gbox_cartesian(const RTCTX *ctx, RTCIRCSTRING *curve, RTGBOX *gbox)
 {
-	uint8_t flags = gflags(ctx, RTFLAGS_GET_Z(curve->flags), RTFLAGS_GET_M(curve->flags), 0);
-	RTGBOX tmp;
-	RTPOINT4D p1, p2, p3;
-	int i;
+  uint8_t flags = gflags(ctx, RTFLAGS_GET_Z(curve->flags), RTFLAGS_GET_M(curve->flags), 0);
+  RTGBOX tmp;
+  RTPOINT4D p1, p2, p3;
+  int i;
 
-	if ( ! curve ) return RT_FAILURE;
-	if ( curve->points->npoints < 3 ) return RT_FAILURE;
+  if ( ! curve ) return RT_FAILURE;
+  if ( curve->points->npoints < 3 ) return RT_FAILURE;
 
-	tmp.flags = flags;
+  tmp.flags = flags;
 
-	/* Initialize */
-	gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = FLT_MAX;
-	gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1*FLT_MAX;
+  /* Initialize */
+  gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = FLT_MAX;
+  gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1*FLT_MAX;
 
-	for ( i = 2; i < curve->points->npoints; i += 2 )
-	{
-		rt_getPoint4d_p(ctx, curve->points, i-2, &p1);
-		rt_getPoint4d_p(ctx, curve->points, i-1, &p2);
-		rt_getPoint4d_p(ctx, curve->points, i, &p3);
+  for ( i = 2; i < curve->points->npoints; i += 2 )
+  {
+    rt_getPoint4d_p(ctx, curve->points, i-2, &p1);
+    rt_getPoint4d_p(ctx, curve->points, i-1, &p2);
+    rt_getPoint4d_p(ctx, curve->points, i, &p3);
 
-		if (rt_arc_calculate_gbox_cartesian(ctx, &p1, &p2, &p3, &tmp) == RT_FAILURE)
-			continue;
+    if (rt_arc_calculate_gbox_cartesian(ctx, &p1, &p2, &p3, &tmp) == RT_FAILURE)
+      continue;
 
-		gbox_merge(ctx, &tmp, gbox);
-	}
+    gbox_merge(ctx, &tmp, gbox);
+  }
 
-	return RT_SUCCESS;
+  return RT_SUCCESS;
 }
 
 static int rtpoint_calculate_gbox_cartesian(const RTCTX *ctx, RTPOINT *point, RTGBOX *gbox)
 {
-	if ( ! point ) return RT_FAILURE;
-	return ptarray_calculate_gbox_cartesian(ctx,  point->point, gbox );
+  if ( ! point ) return RT_FAILURE;
+  return ptarray_calculate_gbox_cartesian(ctx,  point->point, gbox );
 }
 
 static int rtline_calculate_gbox_cartesian(const RTCTX *ctx, RTLINE *line, RTGBOX *gbox)
 {
-	if ( ! line ) return RT_FAILURE;
-	return ptarray_calculate_gbox_cartesian(ctx,  line->points, gbox );
+  if ( ! line ) return RT_FAILURE;
+  return ptarray_calculate_gbox_cartesian(ctx,  line->points, gbox );
 }
 
 static int rttriangle_calculate_gbox_cartesian(const RTCTX *ctx, RTTRIANGLE *triangle, RTGBOX *gbox)
 {
-	if ( ! triangle ) return RT_FAILURE;
-	return ptarray_calculate_gbox_cartesian(ctx,  triangle->points, gbox );
+  if ( ! triangle ) return RT_FAILURE;
+  return ptarray_calculate_gbox_cartesian(ctx,  triangle->points, gbox );
 }
 
 static int rtpoly_calculate_gbox_cartesian(const RTCTX *ctx, RTPOLY *poly, RTGBOX *gbox)
 {
-	if ( ! poly ) return RT_FAILURE;
-	if ( poly->nrings == 0 ) return RT_FAILURE;
-	/* Just need to check outer ring */
-	return ptarray_calculate_gbox_cartesian(ctx,  poly->rings[0], gbox );
+  if ( ! poly ) return RT_FAILURE;
+  if ( poly->nrings == 0 ) return RT_FAILURE;
+  /* Just need to check outer ring */
+  return ptarray_calculate_gbox_cartesian(ctx,  poly->rings[0], gbox );
 }
 
 static int rtcollection_calculate_gbox_cartesian(const RTCTX *ctx, RTCOLLECTION *coll, RTGBOX *gbox)
 {
-	RTGBOX subbox;
-	int i;
-	int result = RT_FAILURE;
-	int first = RT_TRUE;
-	assert(coll);
-	if ( (coll->ngeoms == 0) || !gbox)
-		return RT_FAILURE;
-
-	subbox.flags = coll->flags;
-
-	for ( i = 0; i < coll->ngeoms; i++ )
-	{
-		if ( rtgeom_calculate_gbox_cartesian(ctx, (RTGEOM*)(coll->geoms[i]), &subbox) == RT_SUCCESS )
-		{
-			/* Keep a copy of the sub-bounding box for later 
-			if ( coll->geoms[i]->bbox ) 
-				rtfree(ctx, coll->geoms[i]->bbox);
-			coll->geoms[i]->bbox = gbox_copy(ctx, &subbox); */
-			if ( first )
-			{
-				gbox_duplicate(ctx, &subbox, gbox);
-				first = RT_FALSE;
-			}
-			else
-			{
-				gbox_merge(ctx, &subbox, gbox);
-			}
-			result = RT_SUCCESS;
-		}
-	}
-	return result;
+  RTGBOX subbox;
+  int i;
+  int result = RT_FAILURE;
+  int first = RT_TRUE;
+  assert(coll);
+  if ( (coll->ngeoms == 0) || !gbox)
+    return RT_FAILURE;
+
+  subbox.flags = coll->flags;
+
+  for ( i = 0; i < coll->ngeoms; i++ )
+  {
+    if ( rtgeom_calculate_gbox_cartesian(ctx, (RTGEOM*)(coll->geoms[i]), &subbox) == RT_SUCCESS )
+    {
+      /* Keep a copy of the sub-bounding box for later
+      if ( coll->geoms[i]->bbox )
+        rtfree(ctx, coll->geoms[i]->bbox);
+      coll->geoms[i]->bbox = gbox_copy(ctx, &subbox); */
+      if ( first )
+      {
+        gbox_duplicate(ctx, &subbox, gbox);
+        first = RT_FALSE;
+      }
+      else
+      {
+        gbox_merge(ctx, &subbox, gbox);
+      }
+      result = RT_SUCCESS;
+    }
+  }
+  return result;
 }
 
 int rtgeom_calculate_gbox_cartesian(const RTCTX *ctx, const RTGEOM *rtgeom, RTGBOX *gbox)
 {
-	if ( ! rtgeom ) return RT_FAILURE;
-	RTDEBUGF(4, "rtgeom_calculate_gbox got type (%d) - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
-
-	switch (rtgeom->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_calculate_gbox_cartesian(ctx, (RTPOINT *)rtgeom, gbox);
-	case RTLINETYPE:
-		return rtline_calculate_gbox_cartesian(ctx, (RTLINE *)rtgeom, gbox);
-	case RTCIRCSTRINGTYPE:
-		return rtcircstring_calculate_gbox_cartesian(ctx, (RTCIRCSTRING *)rtgeom, gbox);
-	case RTPOLYGONTYPE:
-		return rtpoly_calculate_gbox_cartesian(ctx, (RTPOLY *)rtgeom, gbox);
-	case RTTRIANGLETYPE:
-		return rttriangle_calculate_gbox_cartesian(ctx, (RTTRIANGLE *)rtgeom, gbox);
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_calculate_gbox_cartesian(ctx, (RTCOLLECTION *)rtgeom, gbox);
-	}
-	/* Never get here, please. */
-	rterror(ctx, "unsupported type (%d) - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
-	return RT_FAILURE;
+  if ( ! rtgeom ) return RT_FAILURE;
+  RTDEBUGF(4, "rtgeom_calculate_gbox got type (%d) - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
+
+  switch (rtgeom->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_calculate_gbox_cartesian(ctx, (RTPOINT *)rtgeom, gbox);
+  case RTLINETYPE:
+    return rtline_calculate_gbox_cartesian(ctx, (RTLINE *)rtgeom, gbox);
+  case RTCIRCSTRINGTYPE:
+    return rtcircstring_calculate_gbox_cartesian(ctx, (RTCIRCSTRING *)rtgeom, gbox);
+  case RTPOLYGONTYPE:
+    return rtpoly_calculate_gbox_cartesian(ctx, (RTPOLY *)rtgeom, gbox);
+  case RTTRIANGLETYPE:
+    return rttriangle_calculate_gbox_cartesian(ctx, (RTTRIANGLE *)rtgeom, gbox);
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_calculate_gbox_cartesian(ctx, (RTCOLLECTION *)rtgeom, gbox);
+  }
+  /* Never get here, please. */
+  rterror(ctx, "unsupported type (%d) - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
+  return RT_FAILURE;
 }
 
 void gbox_float_round(const RTCTX *ctx, RTGBOX *gbox)
 {
-	gbox->xmin = next_float_down(ctx, gbox->xmin);
-	gbox->xmax = next_float_up(ctx, gbox->xmax);
+  gbox->xmin = next_float_down(ctx, gbox->xmin);
+  gbox->xmax = next_float_up(ctx, gbox->xmax);
 
-	gbox->ymin = next_float_down(ctx, gbox->ymin);
-	gbox->ymax = next_float_up(ctx, gbox->ymax);
+  gbox->ymin = next_float_down(ctx, gbox->ymin);
+  gbox->ymax = next_float_up(ctx, gbox->ymax);
 
-	if ( RTFLAGS_GET_M(gbox->flags) )
-	{
-		gbox->mmin = next_float_down(ctx, gbox->mmin);
-		gbox->mmax = next_float_up(ctx, gbox->mmax);
-	}
+  if ( RTFLAGS_GET_M(gbox->flags) )
+  {
+    gbox->mmin = next_float_down(ctx, gbox->mmin);
+    gbox->mmax = next_float_up(ctx, gbox->mmax);
+  }
 
-	if ( RTFLAGS_GET_Z(gbox->flags) )
-	{
-		gbox->zmin = next_float_down(ctx, gbox->zmin);
-		gbox->zmax = next_float_up(ctx, gbox->zmax);
-	}
+  if ( RTFLAGS_GET_Z(gbox->flags) )
+  {
+    gbox->zmin = next_float_down(ctx, gbox->zmin);
+    gbox->zmax = next_float_up(ctx, gbox->zmax);
+  }
 }
 
diff --git a/src/g_serialized.c b/src/g_serialized.c
index f029556..037663b 100644
--- a/src/g_serialized.c
+++ b/src/g_serialized.c
@@ -33,184 +33,184 @@
 
 int gserialized_has_bbox(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	return RTFLAGS_GET_BBOX(gser->flags);
+  return RTFLAGS_GET_BBOX(gser->flags);
 }
 
 int gserialized_has_z(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	return RTFLAGS_GET_Z(gser->flags);
+  return RTFLAGS_GET_Z(gser->flags);
 }
 
 int gserialized_has_m(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	return RTFLAGS_GET_M(gser->flags);
+  return RTFLAGS_GET_M(gser->flags);
 }
 
 int gserialized_get_zm(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	return 2 * RTFLAGS_GET_Z(gser->flags) + RTFLAGS_GET_M(gser->flags);
+  return 2 * RTFLAGS_GET_Z(gser->flags) + RTFLAGS_GET_M(gser->flags);
 }
 
 int gserialized_ndims(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	return RTFLAGS_NDIMS(gser->flags);
+  return RTFLAGS_NDIMS(gser->flags);
 }
 
 int gserialized_is_geodetic(const RTCTX *ctx, const GSERIALIZED *gser)
 {
-	  return RTFLAGS_GET_GEODETIC(gser->flags);
+    return RTFLAGS_GET_GEODETIC(gser->flags);
 }
- 
-uint32_t gserialized_max_header_size(const RTCTX *ctx) 
+
+uint32_t gserialized_max_header_size(const RTCTX *ctx)
 {
-	/* read GSERIALIZED size + max bbox according gbox_serialized_size(ctx, 2 + Z + M) + 1 int for type */
-	return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(int);
+  /* read GSERIALIZED size + max bbox according gbox_serialized_size(ctx, 2 + Z + M) + 1 int for type */
+  return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(int);
 }
 
 uint32_t gserialized_get_type(const RTCTX *ctx, const GSERIALIZED *s)
 {
-	uint32_t *ptr;
-	assert(s);
-	ptr = (uint32_t*)(s->data);
-	RTDEBUG(4,"entered");
-	if ( RTFLAGS_GET_BBOX(s->flags) )
-	{
-		RTDEBUGF(4,"skipping forward past bbox (%d bytes)",gbox_serialized_size(ctx, s->flags));
-		ptr += (gbox_serialized_size(ctx, s->flags) / sizeof(uint32_t));
-	}
-	return *ptr;
+  uint32_t *ptr;
+  assert(s);
+  ptr = (uint32_t*)(s->data);
+  RTDEBUG(4,"entered");
+  if ( RTFLAGS_GET_BBOX(s->flags) )
+  {
+    RTDEBUGF(4,"skipping forward past bbox (%d bytes)",gbox_serialized_size(ctx, s->flags));
+    ptr += (gbox_serialized_size(ctx, s->flags) / sizeof(uint32_t));
+  }
+  return *ptr;
 }
 
 int32_t gserialized_get_srid(const RTCTX *ctx, const GSERIALIZED *s)
 {
-	int32_t srid = 0;
-	srid = srid | (s->srid[0] << 16);
-	srid = srid | (s->srid[1] << 8);
-	srid = srid | s->srid[2];
-	/* Only the first 21 bits are set. Slide up and back to pull
-	   the negative bits down, if we need them. */
-	srid = (srid<<11)>>11;
-	
-	/* 0 is our internal unknown value. We'll map back and forth here for now */
-	if ( srid == 0 ) 
-		return SRID_UNKNOWN;
-	else
-		return clamp_srid(ctx, srid);
+  int32_t srid = 0;
+  srid = srid | (s->srid[0] << 16);
+  srid = srid | (s->srid[1] << 8);
+  srid = srid | s->srid[2];
+  /* Only the first 21 bits are set. Slide up and back to pull
+     the negative bits down, if we need them. */
+  srid = (srid<<11)>>11;
+
+  /* 0 is our internal unknown value. We'll map back and forth here for now */
+  if ( srid == 0 )
+    return SRID_UNKNOWN;
+  else
+    return clamp_srid(ctx, srid);
 }
 
 void gserialized_set_srid(const RTCTX *ctx, GSERIALIZED *s, int32_t srid)
 {
-	RTDEBUGF(3, "Called with srid = %d", srid);
-
-	srid = clamp_srid(ctx, srid);
-
-	/* 0 is our internal unknown value.
-	 * We'll map back and forth here for now */
-	if ( srid == SRID_UNKNOWN )
-		srid = 0;
-		
-	s->srid[0] = (srid & 0x001F0000) >> 16;
-	s->srid[1] = (srid & 0x0000FF00) >> 8;
-	s->srid[2] = (srid & 0x000000FF);
+  RTDEBUGF(3, "Called with srid = %d", srid);
+
+  srid = clamp_srid(ctx, srid);
+
+  /* 0 is our internal unknown value.
+   * We'll map back and forth here for now */
+  if ( srid == SRID_UNKNOWN )
+    srid = 0;
+
+  s->srid[0] = (srid & 0x001F0000) >> 16;
+  s->srid[1] = (srid & 0x0000FF00) >> 8;
+  s->srid[2] = (srid & 0x000000FF);
 }
 
 GSERIALIZED* gserialized_copy(const RTCTX *ctx, const GSERIALIZED *g)
 {
-	GSERIALIZED *g_out = NULL;
-	assert(g);
-	g_out = (GSERIALIZED*)rtalloc(ctx, SIZE_GET(g->size));
-	memcpy((uint8_t*)g_out,(uint8_t*)g,SIZE_GET(g->size));
-	return g_out;
+  GSERIALIZED *g_out = NULL;
+  assert(g);
+  g_out = (GSERIALIZED*)rtalloc(ctx, SIZE_GET(g->size));
+  memcpy((uint8_t*)g_out,(uint8_t*)g,SIZE_GET(g->size));
+  return g_out;
 }
 
 static size_t gserialized_is_empty_recurse(const RTCTX *ctx, const uint8_t *p, int *isempty);
 static size_t gserialized_is_empty_recurse(const RTCTX *ctx, const uint8_t *p, int *isempty)
 {
-	int i;
-	int32_t type, num;
-
-	memcpy(&type, p, 4);
-	memcpy(&num, p+4, 4);
-	
-	if ( rttype_is_collection(ctx, type) )
-	{
-		size_t lz = 8;
-		for ( i = 0; i < num; i++ )
-		{
-			lz += gserialized_is_empty_recurse(ctx, p+lz, isempty);
-			if ( ! *isempty )
-				return lz;
-		}
-		*isempty = RT_TRUE;
-		return lz;
-	}
-	else
-	{
-		*isempty = (num == 0 ? RT_TRUE : RT_FALSE);
-		return 8;
-	}
+  int i;
+  int32_t type, num;
+
+  memcpy(&type, p, 4);
+  memcpy(&num, p+4, 4);
+
+  if ( rttype_is_collection(ctx, type) )
+  {
+    size_t lz = 8;
+    for ( i = 0; i < num; i++ )
+    {
+      lz += gserialized_is_empty_recurse(ctx, p+lz, isempty);
+      if ( ! *isempty )
+        return lz;
+    }
+    *isempty = RT_TRUE;
+    return lz;
+  }
+  else
+  {
+    *isempty = (num == 0 ? RT_TRUE : RT_FALSE);
+    return 8;
+  }
 }
 
 int gserialized_is_empty(const RTCTX *ctx, const GSERIALIZED *g)
 {
-	uint8_t *p = (uint8_t*)g;
-	int isempty = 0;
-	assert(g);
+  uint8_t *p = (uint8_t*)g;
+  int isempty = 0;
+  assert(g);
 
-	p += 8; /* Skip varhdr and srid/flags */
-	if( RTFLAGS_GET_BBOX(g->flags) )
-		p += gbox_serialized_size(ctx, g->flags); /* Skip the box */
+  p += 8; /* Skip varhdr and srid/flags */
+  if( RTFLAGS_GET_BBOX(g->flags) )
+    p += gbox_serialized_size(ctx, g->flags); /* Skip the box */
 
-	gserialized_is_empty_recurse(ctx, p, &isempty);
-	return isempty;
+  gserialized_is_empty_recurse(ctx, p, &isempty);
+  return isempty;
 }
 
 char* gserialized_to_string(const RTCTX *ctx, const GSERIALIZED *g)
 {
-	return rtgeom_to_wkt(ctx, rtgeom_from_gserialized(ctx, g), RTWKT_ISO, 12, 0);
+  return rtgeom_to_wkt(ctx, rtgeom_from_gserialized(ctx, g), RTWKT_ISO, 12, 0);
 }
 
 int gserialized_read_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX *gbox)
 {
 
-	/* Null input! */
-	if ( ! ( g && gbox ) ) return RT_FAILURE;
-
-	/* Initialize the flags on the box */
-	gbox->flags = g->flags;
-
-	/* Has pre-calculated box */
-	if ( RTFLAGS_GET_BBOX(g->flags) )
-	{
-		int i = 0;
-		float *fbox = (float*)(g->data);
-		gbox->xmin = fbox[i++];
-		gbox->xmax = fbox[i++];
-		gbox->ymin = fbox[i++];
-		gbox->ymax = fbox[i++];
-
-		/* Geodetic? Read next dimension (geocentric Z) and return */
-		if ( RTFLAGS_GET_GEODETIC(g->flags) )
-		{
-			gbox->zmin = fbox[i++];
-			gbox->zmax = fbox[i++];
-			return RT_SUCCESS;
-		}
-		/* Cartesian? Read extra dimensions (if there) and return */
-		if ( RTFLAGS_GET_Z(g->flags) )
-		{
-			gbox->zmin = fbox[i++];
-			gbox->zmax = fbox[i++];
-		}
-		if ( RTFLAGS_GET_M(g->flags) )
-		{
-			gbox->mmin = fbox[i++];
-			gbox->mmax = fbox[i++];
-		}
-		return RT_SUCCESS;
-	}
-
-	return RT_FAILURE;
+  /* Null input! */
+  if ( ! ( g && gbox ) ) return RT_FAILURE;
+
+  /* Initialize the flags on the box */
+  gbox->flags = g->flags;
+
+  /* Has pre-calculated box */
+  if ( RTFLAGS_GET_BBOX(g->flags) )
+  {
+    int i = 0;
+    float *fbox = (float*)(g->data);
+    gbox->xmin = fbox[i++];
+    gbox->xmax = fbox[i++];
+    gbox->ymin = fbox[i++];
+    gbox->ymax = fbox[i++];
+
+    /* Geodetic? Read next dimension (geocentric Z) and return */
+    if ( RTFLAGS_GET_GEODETIC(g->flags) )
+    {
+      gbox->zmin = fbox[i++];
+      gbox->zmax = fbox[i++];
+      return RT_SUCCESS;
+    }
+    /* Cartesian? Read extra dimensions (if there) and return */
+    if ( RTFLAGS_GET_Z(g->flags) )
+    {
+      gbox->zmin = fbox[i++];
+      gbox->zmax = fbox[i++];
+    }
+    if ( RTFLAGS_GET_M(g->flags) )
+    {
+      gbox->mmin = fbox[i++];
+      gbox->mmax = fbox[i++];
+    }
+    return RT_SUCCESS;
+  }
+
+  return RT_FAILURE;
 }
 
 /*
@@ -219,164 +219,164 @@ int gserialized_read_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX *gbox
 */
 static int gserialized_peek_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX *gbox)
 {
-	uint32_t type = gserialized_get_type(ctx, g);
-
-	/* Peeking doesn't help if you already have a box or are geodetic */
-	if ( RTFLAGS_GET_GEODETIC(g->flags) || RTFLAGS_GET_BBOX(g->flags) )
-	{
-		return RT_FAILURE;
-	}
-	
-	/* Boxes of points are easy peasy */
-	if ( type == RTPOINTTYPE )
-	{
-		int i = 1; /* Start past <pointtype><padding> */
-		double *dptr = (double*)(g->data);
-
-		/* Read the empty flag */
-		int *iptr = (int*)(g->data);
-		int isempty = (iptr[1] == 0);
-
-		/* EMPTY point has no box */
-		if ( isempty ) return RT_FAILURE;
-
-		gbox->xmin = gbox->xmax = dptr[i++];
-		gbox->ymin = gbox->ymax = dptr[i++];
-		if ( RTFLAGS_GET_Z(g->flags) )
-		{
-			gbox->zmin = gbox->zmax = dptr[i++];
-		}
-		if ( RTFLAGS_GET_M(g->flags) )
-		{
-			gbox->mmin = gbox->mmax = dptr[i++];
-		}
-		gbox_float_round(ctx, gbox);
-		return RT_SUCCESS;
-	}
-	/* We can calculate the box of a two-point cartesian line trivially */
-	else if ( type == RTLINETYPE )
-	{
-		int ndims = RTFLAGS_NDIMS(g->flags);
-		int i = 0; /* Start at <linetype><npoints> */
-		double *dptr = (double*)(g->data);
-		int *iptr = (int*)(g->data);
-		int npoints = iptr[1]; /* Read the npoints */
-	
-		/* This only works with 2-point lines */
-		if ( npoints != 2 )
-			return RT_FAILURE;
-		
-		/* Advance to X */
-		/* Past <linetype><npoints> */
-		i++;
-		gbox->xmin = FP_MIN(dptr[i], dptr[i+ndims]);
-		gbox->xmax = FP_MAX(dptr[i], dptr[i+ndims]);
-	
-		/* Advance to Y */
-		i++;
-		gbox->ymin = FP_MIN(dptr[i], dptr[i+ndims]);
-		gbox->ymax = FP_MAX(dptr[i], dptr[i+ndims]);
-	
-		if ( RTFLAGS_GET_Z(g->flags) )
-		{
-			/* Advance to Z */
-			i++;
-			gbox->zmin = FP_MIN(dptr[i], dptr[i+ndims]);
-			gbox->zmax = FP_MAX(dptr[i], dptr[i+ndims]);
-		}
-		if ( RTFLAGS_GET_M(g->flags) )
-		{
-			/* Advance to M */
-			i++;
-			gbox->mmin = FP_MIN(dptr[i], dptr[i+ndims]);
-			gbox->mmax = FP_MAX(dptr[i], dptr[i+ndims]);
-		}
-		gbox_float_round(ctx, gbox);
-		return RT_SUCCESS;
-	}
-	/* We can also do single-entry multi-points */
-	else if ( type == RTMULTIPOINTTYPE )
-	{
-		int i = 0; /* Start at <multipointtype><ngeoms> */
-		double *dptr = (double*)(g->data);
-		int *iptr = (int*)(g->data);
-		int ngeoms = iptr[1]; /* Read the ngeoms */
-	
-		/* This only works with single-entry multipoints */
-		if ( ngeoms != 1 )
-			return RT_FAILURE;
-
-		/* Move forward two doubles (four ints) */
-		/* Past <multipointtype><ngeoms> */
-		/* Past <pointtype><emtpyflat> */
-		i += 2;
-
-		/* Read the doubles from the one point */
-		gbox->xmin = gbox->xmax = dptr[i++];
-		gbox->ymin = gbox->ymax = dptr[i++];
-		if ( RTFLAGS_GET_Z(g->flags) )
-		{
-			gbox->zmin = gbox->zmax = dptr[i++];
-		}
-		if ( RTFLAGS_GET_M(g->flags) )
-		{
-			gbox->mmin = gbox->mmax = dptr[i++];
-		}
-		gbox_float_round(ctx, gbox);
-		return RT_SUCCESS;
-	}
-	/* And we can do single-entry multi-lines with two vertices (!!!) */
-	else if ( type == RTMULTILINETYPE )
-	{
-		int ndims = RTFLAGS_NDIMS(g->flags);
-		int i = 0; /* Start at <multilinetype><ngeoms> */
-		double *dptr = (double*)(g->data);
-		int *iptr = (int*)(g->data);
-		int ngeoms = iptr[1]; /* Read the ngeoms */
-		int npoints;
-	
-		/* This only works with 1-line multilines */
-		if ( ngeoms != 1 )
-			return RT_FAILURE;
-
-		/* Npoints is at <multilinetype><ngeoms><linetype><npoints> */
-		npoints = iptr[3];
-
-		if ( npoints != 2 )
-			return RT_FAILURE;
-
-		/* Advance to X */
-		/* Move forward two doubles (four ints) */
-		/* Past <multilinetype><ngeoms> */
-		/* Past <linetype><npoints> */
-		i += 2;
-		gbox->xmin = FP_MIN(dptr[i], dptr[i+ndims]);
-		gbox->xmax = FP_MAX(dptr[i], dptr[i+ndims]);
-	
-		/* Advance to Y */
-		i++;
-		gbox->ymin = FP_MIN(dptr[i], dptr[i+ndims]);
-		gbox->ymax = FP_MAX(dptr[i], dptr[i+ndims]);
-	
-		if ( RTFLAGS_GET_Z(g->flags) )
-		{
-			/* Advance to Z */
-			i++;
-			gbox->zmin = FP_MIN(dptr[i], dptr[i+ndims]);
-			gbox->zmax = FP_MAX(dptr[i], dptr[i+ndims]);
-		}
-		if ( RTFLAGS_GET_M(g->flags) )
-		{
-			/* Advance to M */
-			i++;
-			gbox->mmin = FP_MIN(dptr[i], dptr[i+ndims]);
-			gbox->mmax = FP_MAX(dptr[i], dptr[i+ndims]);
-		}
-		gbox_float_round(ctx, gbox);
-		return RT_SUCCESS;
-	}
-	
-	return RT_FAILURE;
+  uint32_t type = gserialized_get_type(ctx, g);
+
+  /* Peeking doesn't help if you already have a box or are geodetic */
+  if ( RTFLAGS_GET_GEODETIC(g->flags) || RTFLAGS_GET_BBOX(g->flags) )
+  {
+    return RT_FAILURE;
+  }
+
+  /* Boxes of points are easy peasy */
+  if ( type == RTPOINTTYPE )
+  {
+    int i = 1; /* Start past <pointtype><padding> */
+    double *dptr = (double*)(g->data);
+
+    /* Read the empty flag */
+    int *iptr = (int*)(g->data);
+    int isempty = (iptr[1] == 0);
+
+    /* EMPTY point has no box */
+    if ( isempty ) return RT_FAILURE;
+
+    gbox->xmin = gbox->xmax = dptr[i++];
+    gbox->ymin = gbox->ymax = dptr[i++];
+    if ( RTFLAGS_GET_Z(g->flags) )
+    {
+      gbox->zmin = gbox->zmax = dptr[i++];
+    }
+    if ( RTFLAGS_GET_M(g->flags) )
+    {
+      gbox->mmin = gbox->mmax = dptr[i++];
+    }
+    gbox_float_round(ctx, gbox);
+    return RT_SUCCESS;
+  }
+  /* We can calculate the box of a two-point cartesian line trivially */
+  else if ( type == RTLINETYPE )
+  {
+    int ndims = RTFLAGS_NDIMS(g->flags);
+    int i = 0; /* Start at <linetype><npoints> */
+    double *dptr = (double*)(g->data);
+    int *iptr = (int*)(g->data);
+    int npoints = iptr[1]; /* Read the npoints */
+
+    /* This only works with 2-point lines */
+    if ( npoints != 2 )
+      return RT_FAILURE;
+
+    /* Advance to X */
+    /* Past <linetype><npoints> */
+    i++;
+    gbox->xmin = FP_MIN(dptr[i], dptr[i+ndims]);
+    gbox->xmax = FP_MAX(dptr[i], dptr[i+ndims]);
+
+    /* Advance to Y */
+    i++;
+    gbox->ymin = FP_MIN(dptr[i], dptr[i+ndims]);
+    gbox->ymax = FP_MAX(dptr[i], dptr[i+ndims]);
+
+    if ( RTFLAGS_GET_Z(g->flags) )
+    {
+      /* Advance to Z */
+      i++;
+      gbox->zmin = FP_MIN(dptr[i], dptr[i+ndims]);
+      gbox->zmax = FP_MAX(dptr[i], dptr[i+ndims]);
+    }
+    if ( RTFLAGS_GET_M(g->flags) )
+    {
+      /* Advance to M */
+      i++;
+      gbox->mmin = FP_MIN(dptr[i], dptr[i+ndims]);
+      gbox->mmax = FP_MAX(dptr[i], dptr[i+ndims]);
+    }
+    gbox_float_round(ctx, gbox);
+    return RT_SUCCESS;
+  }
+  /* We can also do single-entry multi-points */
+  else if ( type == RTMULTIPOINTTYPE )
+  {
+    int i = 0; /* Start at <multipointtype><ngeoms> */
+    double *dptr = (double*)(g->data);
+    int *iptr = (int*)(g->data);
+    int ngeoms = iptr[1]; /* Read the ngeoms */
+
+    /* This only works with single-entry multipoints */
+    if ( ngeoms != 1 )
+      return RT_FAILURE;
+
+    /* Move forward two doubles (four ints) */
+    /* Past <multipointtype><ngeoms> */
+    /* Past <pointtype><emtpyflat> */
+    i += 2;
+
+    /* Read the doubles from the one point */
+    gbox->xmin = gbox->xmax = dptr[i++];
+    gbox->ymin = gbox->ymax = dptr[i++];
+    if ( RTFLAGS_GET_Z(g->flags) )
+    {
+      gbox->zmin = gbox->zmax = dptr[i++];
+    }
+    if ( RTFLAGS_GET_M(g->flags) )
+    {
+      gbox->mmin = gbox->mmax = dptr[i++];
+    }
+    gbox_float_round(ctx, gbox);
+    return RT_SUCCESS;
+  }
+  /* And we can do single-entry multi-lines with two vertices (!!!) */
+  else if ( type == RTMULTILINETYPE )
+  {
+    int ndims = RTFLAGS_NDIMS(g->flags);
+    int i = 0; /* Start at <multilinetype><ngeoms> */
+    double *dptr = (double*)(g->data);
+    int *iptr = (int*)(g->data);
+    int ngeoms = iptr[1]; /* Read the ngeoms */
+    int npoints;
+
+    /* This only works with 1-line multilines */
+    if ( ngeoms != 1 )
+      return RT_FAILURE;
+
+    /* Npoints is at <multilinetype><ngeoms><linetype><npoints> */
+    npoints = iptr[3];
+
+    if ( npoints != 2 )
+      return RT_FAILURE;
+
+    /* Advance to X */
+    /* Move forward two doubles (four ints) */
+    /* Past <multilinetype><ngeoms> */
+    /* Past <linetype><npoints> */
+    i += 2;
+    gbox->xmin = FP_MIN(dptr[i], dptr[i+ndims]);
+    gbox->xmax = FP_MAX(dptr[i], dptr[i+ndims]);
+
+    /* Advance to Y */
+    i++;
+    gbox->ymin = FP_MIN(dptr[i], dptr[i+ndims]);
+    gbox->ymax = FP_MAX(dptr[i], dptr[i+ndims]);
+
+    if ( RTFLAGS_GET_Z(g->flags) )
+    {
+      /* Advance to Z */
+      i++;
+      gbox->zmin = FP_MIN(dptr[i], dptr[i+ndims]);
+      gbox->zmax = FP_MAX(dptr[i], dptr[i+ndims]);
+    }
+    if ( RTFLAGS_GET_M(g->flags) )
+    {
+      /* Advance to M */
+      i++;
+      gbox->mmin = FP_MIN(dptr[i], dptr[i+ndims]);
+      gbox->mmax = FP_MAX(dptr[i], dptr[i+ndims]);
+    }
+    gbox_float_round(ctx, gbox);
+    return RT_SUCCESS;
+  }
+
+  return RT_FAILURE;
 }
 
 /**
@@ -385,27 +385,27 @@ static int gserialized_peek_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBO
 */
 int gserialized_get_gbox_p(const RTCTX *ctx, const GSERIALIZED *g, RTGBOX *box)
 {
-	/* Try to just read the serialized box. */
-	if ( gserialized_read_gbox_p(ctx, g, box) == RT_SUCCESS )
-	{
-		return RT_SUCCESS;
-	}
-	/* No box? Try to peek into simpler geometries and */
-	/* derive a box without creating an rtgeom */
-	else if ( gserialized_peek_gbox_p(ctx, g, box) == RT_SUCCESS )
-	{
-		return RT_SUCCESS;
-	}
-	/* Damn! Nothing for it but to create an rtgeom... */
-	/* See http://trac.osgeo.org/postgis/ticket/1023 */
-	else
-	{
-		RTGEOM *rtgeom = rtgeom_from_gserialized(ctx, g);
-		int ret = rtgeom_calculate_gbox(ctx, rtgeom, box);
-		gbox_float_round(ctx, box);
-		rtgeom_free(ctx, rtgeom);
-		return ret;
-	}
+  /* Try to just read the serialized box. */
+  if ( gserialized_read_gbox_p(ctx, g, box) == RT_SUCCESS )
+  {
+    return RT_SUCCESS;
+  }
+  /* No box? Try to peek into simpler geometries and */
+  /* derive a box without creating an rtgeom */
+  else if ( gserialized_peek_gbox_p(ctx, g, box) == RT_SUCCESS )
+  {
+    return RT_SUCCESS;
+  }
+  /* Damn! Nothing for it but to create an rtgeom... */
+  /* See http://trac.osgeo.org/postgis/ticket/1023 */
+  else
+  {
+    RTGEOM *rtgeom = rtgeom_from_gserialized(ctx, g);
+    int ret = rtgeom_calculate_gbox(ctx, rtgeom, box);
+    gbox_float_round(ctx, box);
+    rtgeom_free(ctx, rtgeom);
+    return ret;
+  }
 }
 
 
@@ -419,150 +419,150 @@ static size_t gserialized_from_any_size(const RTCTX *ctx, const RTGEOM *geom); /
 
 static size_t gserialized_from_rtpoint_size(const RTCTX *ctx, const RTPOINT *point)
 {
-	size_t size = 4; /* Type number. */
+  size_t size = 4; /* Type number. */
 
-	assert(point);
+  assert(point);
 
-	size += 4; /* Number of points (one or zero (empty)). */
-	size += point->point->npoints * RTFLAGS_NDIMS(point->flags) * sizeof(double);
+  size += 4; /* Number of points (one or zero (empty)). */
+  size += point->point->npoints * RTFLAGS_NDIMS(point->flags) * sizeof(double);
 
-	RTDEBUGF(3, "point size = %d", size);
+  RTDEBUGF(3, "point size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_rtline_size(const RTCTX *ctx, const RTLINE *line)
 {
-	size_t size = 4; /* Type number. */
+  size_t size = 4; /* Type number. */
 
-	assert(line);
+  assert(line);
 
-	size += 4; /* Number of points (zero => empty). */
-	size += line->points->npoints * RTFLAGS_NDIMS(line->flags) * sizeof(double);
+  size += 4; /* Number of points (zero => empty). */
+  size += line->points->npoints * RTFLAGS_NDIMS(line->flags) * sizeof(double);
 
-	RTDEBUGF(3, "linestring size = %d", size);
+  RTDEBUGF(3, "linestring size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_rttriangle_size(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	size_t size = 4; /* Type number. */
+  size_t size = 4; /* Type number. */
 
-	assert(triangle);
+  assert(triangle);
 
-	size += 4; /* Number of points (zero => empty). */
-	size += triangle->points->npoints * RTFLAGS_NDIMS(triangle->flags) * sizeof(double);
+  size += 4; /* Number of points (zero => empty). */
+  size += triangle->points->npoints * RTFLAGS_NDIMS(triangle->flags) * sizeof(double);
 
-	RTDEBUGF(3, "triangle size = %d", size);
+  RTDEBUGF(3, "triangle size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_rtpoly_size(const RTCTX *ctx, const RTPOLY *poly)
 {
-	size_t size = 4; /* Type number. */
-	int i = 0;
+  size_t size = 4; /* Type number. */
+  int i = 0;
 
-	assert(poly);
+  assert(poly);
 
-	size += 4; /* Number of rings (zero => empty). */
-	if ( poly->nrings % 2 )
-		size += 4; /* Padding to double alignment. */
+  size += 4; /* Number of rings (zero => empty). */
+  if ( poly->nrings % 2 )
+    size += 4; /* Padding to double alignment. */
 
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		size += 4; /* Number of points in ring. */
-		size += poly->rings[i]->npoints * RTFLAGS_NDIMS(poly->flags) * sizeof(double);
-	}
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    size += 4; /* Number of points in ring. */
+    size += poly->rings[i]->npoints * RTFLAGS_NDIMS(poly->flags) * sizeof(double);
+  }
 
-	RTDEBUGF(3, "polygon size = %d", size);
+  RTDEBUGF(3, "polygon size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_rtcircstring_size(const RTCTX *ctx, const RTCIRCSTRING *curve)
 {
-	size_t size = 4; /* Type number. */
+  size_t size = 4; /* Type number. */
 
-	assert(curve);
+  assert(curve);
 
-	size += 4; /* Number of points (zero => empty). */
-	size += curve->points->npoints * RTFLAGS_NDIMS(curve->flags) * sizeof(double);
+  size += 4; /* Number of points (zero => empty). */
+  size += curve->points->npoints * RTFLAGS_NDIMS(curve->flags) * sizeof(double);
 
-	RTDEBUGF(3, "circstring size = %d", size);
+  RTDEBUGF(3, "circstring size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_rtcollection_size(const RTCTX *ctx, const RTCOLLECTION *col)
 {
-	size_t size = 4; /* Type number. */
-	int i = 0;
+  size_t size = 4; /* Type number. */
+  int i = 0;
 
-	assert(col);
+  assert(col);
 
-	size += 4; /* Number of sub-geometries (zero => empty). */
+  size += 4; /* Number of sub-geometries (zero => empty). */
 
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		size_t subsize = gserialized_from_any_size(ctx, col->geoms[i]);
-		size += subsize;
-		RTDEBUGF(3, "rtcollection subgeom(%d) size = %d", i, subsize);
-	}
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    size_t subsize = gserialized_from_any_size(ctx, col->geoms[i]);
+    size += subsize;
+    RTDEBUGF(3, "rtcollection subgeom(%d) size = %d", i, subsize);
+  }
 
-	RTDEBUGF(3, "rtcollection size = %d", size);
+  RTDEBUGF(3, "rtcollection size = %d", size);
 
-	return size;
+  return size;
 }
 
 static size_t gserialized_from_any_size(const RTCTX *ctx, const RTGEOM *geom)
 {
-	RTDEBUGF(2, "Input type: %s", rttype_name(ctx, geom->type));
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		return gserialized_from_rtpoint_size(ctx, (RTPOINT *)geom);
-	case RTLINETYPE:
-		return gserialized_from_rtline_size(ctx, (RTLINE *)geom);
-	case RTPOLYGONTYPE:
-		return gserialized_from_rtpoly_size(ctx, (RTPOLY *)geom);
-	case RTTRIANGLETYPE:
-		return gserialized_from_rttriangle_size(ctx, (RTTRIANGLE *)geom);
-	case RTCIRCSTRINGTYPE:
-		return gserialized_from_rtcircstring_size(ctx, (RTCIRCSTRING *)geom);
-	case RTCURVEPOLYTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return gserialized_from_rtcollection_size(ctx, (RTCOLLECTION *)geom);
-	default:
-		rterror(ctx, "Unknown geometry type: %d - %s", geom->type, rttype_name(ctx, geom->type));
-		return 0;
-	}
+  RTDEBUGF(2, "Input type: %s", rttype_name(ctx, geom->type));
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    return gserialized_from_rtpoint_size(ctx, (RTPOINT *)geom);
+  case RTLINETYPE:
+    return gserialized_from_rtline_size(ctx, (RTLINE *)geom);
+  case RTPOLYGONTYPE:
+    return gserialized_from_rtpoly_size(ctx, (RTPOLY *)geom);
+  case RTTRIANGLETYPE:
+    return gserialized_from_rttriangle_size(ctx, (RTTRIANGLE *)geom);
+  case RTCIRCSTRINGTYPE:
+    return gserialized_from_rtcircstring_size(ctx, (RTCIRCSTRING *)geom);
+  case RTCURVEPOLYTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return gserialized_from_rtcollection_size(ctx, (RTCOLLECTION *)geom);
+  default:
+    rterror(ctx, "Unknown geometry type: %d - %s", geom->type, rttype_name(ctx, geom->type));
+    return 0;
+  }
 }
 
 /* Public function */
 
 size_t gserialized_from_rtgeom_size(const RTCTX *ctx, const RTGEOM *geom)
 {
-	size_t size = 8; /* Header overhead. */
-	assert(geom);
-	
-	if ( geom->bbox )
-		size += gbox_serialized_size(ctx, geom->flags);	
-		
-	size += gserialized_from_any_size(ctx, geom);
-	RTDEBUGF(3, "g_serialize size = %d", size);
-	
-	return size;
+  size_t size = 8; /* Header overhead. */
+  assert(geom);
+
+  if ( geom->bbox )
+    size += gbox_serialized_size(ctx, geom->flags);
+
+  size += gserialized_from_any_size(ctx, geom);
+  RTDEBUGF(3, "g_serialize size = %d", size);
+
+  return size;
 }
 
 /***********************************************************************
@@ -575,413 +575,413 @@ static size_t gserialized_from_rtgeom_any(const RTCTX *ctx, const RTGEOM *geom,
 
 static size_t gserialized_from_rtpoint(const RTCTX *ctx, const RTPOINT *point, uint8_t *buf)
 {
-	uint8_t *loc;
-	int ptsize = ptarray_point_size(ctx, point->point);
-	int type = RTPOINTTYPE;
+  uint8_t *loc;
+  int ptsize = ptarray_point_size(ctx, point->point);
+  int type = RTPOINTTYPE;
 
-	assert(point);
-	assert(buf);
+  assert(point);
+  assert(buf);
 
-	if ( RTFLAGS_GET_ZM(point->flags) != RTFLAGS_GET_ZM(point->point->flags) )
-		rterror(ctx, "Dimensions mismatch in rtpoint");
+  if ( RTFLAGS_GET_ZM(point->flags) != RTFLAGS_GET_ZM(point->point->flags) )
+    rterror(ctx, "Dimensions mismatch in rtpoint");
 
-	RTDEBUGF(2, "rtpoint_to_gserialized(%p, %p) called", point, buf);
+  RTDEBUGF(2, "rtpoint_to_gserialized(%p, %p) called", point, buf);
 
-	loc = buf;
+  loc = buf;
 
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
-	/* Write in the number of points (0 => empty). */
-	memcpy(loc, &(point->point->npoints), sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
+  /* Write in the number of points (0 => empty). */
+  memcpy(loc, &(point->point->npoints), sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	/* Copy in the ordinates. */
-	if ( point->point->npoints > 0 )
-	{
-		memcpy(loc, rt_getPoint_internal(ctx, point->point, 0), ptsize);
-		loc += ptsize;
-	}
+  /* Copy in the ordinates. */
+  if ( point->point->npoints > 0 )
+  {
+    memcpy(loc, rt_getPoint_internal(ctx, point->point, 0), ptsize);
+    loc += ptsize;
+  }
 
-	return (size_t)(loc - buf);
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rtline(const RTCTX *ctx, const RTLINE *line, uint8_t *buf)
 {
-	uint8_t *loc;
-	int ptsize;
-	size_t size;
-	int type = RTLINETYPE;
+  uint8_t *loc;
+  int ptsize;
+  size_t size;
+  int type = RTLINETYPE;
 
-	assert(line);
-	assert(buf);
+  assert(line);
+  assert(buf);
 
-	RTDEBUGF(2, "rtline_to_gserialized(%p, %p) called", line, buf);
+  RTDEBUGF(2, "rtline_to_gserialized(%p, %p) called", line, buf);
 
-	if ( RTFLAGS_GET_Z(line->flags) != RTFLAGS_GET_Z(line->points->flags) )
-		rterror(ctx, "Dimensions mismatch in rtline");
+  if ( RTFLAGS_GET_Z(line->flags) != RTFLAGS_GET_Z(line->points->flags) )
+    rterror(ctx, "Dimensions mismatch in rtline");
 
-	ptsize = ptarray_point_size(ctx, line->points);
+  ptsize = ptarray_point_size(ctx, line->points);
 
-	loc = buf;
+  loc = buf;
 
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	/* Write in the npoints. */
-	memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the npoints. */
+  memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	RTDEBUGF(3, "rtline_to_gserialized added npoints (%d)", line->points->npoints);
+  RTDEBUGF(3, "rtline_to_gserialized added npoints (%d)", line->points->npoints);
 
-	/* Copy in the ordinates. */
-	if ( line->points->npoints > 0 )
-	{
-		size = line->points->npoints * ptsize;
-		memcpy(loc, rt_getPoint_internal(ctx, line->points, 0), size);
-		loc += size;
-	}
-	RTDEBUGF(3, "rtline_to_gserialized copied serialized_pointlist (%d bytes)", ptsize * line->points->npoints);
+  /* Copy in the ordinates. */
+  if ( line->points->npoints > 0 )
+  {
+    size = line->points->npoints * ptsize;
+    memcpy(loc, rt_getPoint_internal(ctx, line->points, 0), size);
+    loc += size;
+  }
+  RTDEBUGF(3, "rtline_to_gserialized copied serialized_pointlist (%d bytes)", ptsize * line->points->npoints);
 
-	return (size_t)(loc - buf);
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rtpoly(const RTCTX *ctx, const RTPOLY *poly, uint8_t *buf)
 {
-	int i;
-	uint8_t *loc;
-	int ptsize;
-	int type = RTPOLYGONTYPE;
-
-	assert(poly);
-	assert(buf);
-
-	RTDEBUG(2, "rtpoly_to_gserialized called");
-
-	ptsize = sizeof(double) * RTFLAGS_NDIMS(poly->flags);
-	loc = buf;
-
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
-
-	/* Write in the nrings. */
-	memcpy(loc, &(poly->nrings), sizeof(uint32_t));
-	loc += sizeof(uint32_t);
-
-	/* Write in the npoints per ring. */
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		memcpy(loc, &(poly->rings[i]->npoints), sizeof(uint32_t));
-		loc += sizeof(uint32_t);
-	}
-
-	/* Add in padding if necessary to remain double aligned. */
-	if ( poly->nrings % 2 )
-	{
-		memset(loc, 0, sizeof(uint32_t));
-		loc += sizeof(uint32_t);
-	}
-
-	/* Copy in the ordinates. */
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		RTPOINTARRAY *pa = poly->rings[i];
-		size_t pasize;
-
-		if ( RTFLAGS_GET_ZM(poly->flags) != RTFLAGS_GET_ZM(pa->flags) )
-			rterror(ctx, "Dimensions mismatch in rtpoly");
-
-		pasize = pa->npoints * ptsize;
-		memcpy(loc, rt_getPoint_internal(ctx, pa, 0), pasize);
-		loc += pasize;
-	}
-	return (size_t)(loc - buf);
+  int i;
+  uint8_t *loc;
+  int ptsize;
+  int type = RTPOLYGONTYPE;
+
+  assert(poly);
+  assert(buf);
+
+  RTDEBUG(2, "rtpoly_to_gserialized called");
+
+  ptsize = sizeof(double) * RTFLAGS_NDIMS(poly->flags);
+  loc = buf;
+
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
+
+  /* Write in the nrings. */
+  memcpy(loc, &(poly->nrings), sizeof(uint32_t));
+  loc += sizeof(uint32_t);
+
+  /* Write in the npoints per ring. */
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    memcpy(loc, &(poly->rings[i]->npoints), sizeof(uint32_t));
+    loc += sizeof(uint32_t);
+  }
+
+  /* Add in padding if necessary to remain double aligned. */
+  if ( poly->nrings % 2 )
+  {
+    memset(loc, 0, sizeof(uint32_t));
+    loc += sizeof(uint32_t);
+  }
+
+  /* Copy in the ordinates. */
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    RTPOINTARRAY *pa = poly->rings[i];
+    size_t pasize;
+
+    if ( RTFLAGS_GET_ZM(poly->flags) != RTFLAGS_GET_ZM(pa->flags) )
+      rterror(ctx, "Dimensions mismatch in rtpoly");
+
+    pasize = pa->npoints * ptsize;
+    memcpy(loc, rt_getPoint_internal(ctx, pa, 0), pasize);
+    loc += pasize;
+  }
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rttriangle(const RTCTX *ctx, const RTTRIANGLE *triangle, uint8_t *buf)
 {
-	uint8_t *loc;
-	int ptsize;
-	size_t size;
-	int type = RTTRIANGLETYPE;
+  uint8_t *loc;
+  int ptsize;
+  size_t size;
+  int type = RTTRIANGLETYPE;
 
-	assert(triangle);
-	assert(buf);
+  assert(triangle);
+  assert(buf);
 
-	RTDEBUGF(2, "rttriangle_to_gserialized(%p, %p) called", triangle, buf);
+  RTDEBUGF(2, "rttriangle_to_gserialized(%p, %p) called", triangle, buf);
 
-	if ( RTFLAGS_GET_ZM(triangle->flags) != RTFLAGS_GET_ZM(triangle->points->flags) )
-		rterror(ctx, "Dimensions mismatch in rttriangle");
+  if ( RTFLAGS_GET_ZM(triangle->flags) != RTFLAGS_GET_ZM(triangle->points->flags) )
+    rterror(ctx, "Dimensions mismatch in rttriangle");
 
-	ptsize = ptarray_point_size(ctx, triangle->points);
+  ptsize = ptarray_point_size(ctx, triangle->points);
 
-	loc = buf;
+  loc = buf;
 
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	/* Write in the npoints. */
-	memcpy(loc, &(triangle->points->npoints), sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the npoints. */
+  memcpy(loc, &(triangle->points->npoints), sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	RTDEBUGF(3, "rttriangle_to_gserialized added npoints (%d)", triangle->points->npoints);
+  RTDEBUGF(3, "rttriangle_to_gserialized added npoints (%d)", triangle->points->npoints);
 
-	/* Copy in the ordinates. */
-	if ( triangle->points->npoints > 0 )
-	{
-		size = triangle->points->npoints * ptsize;
-		memcpy(loc, rt_getPoint_internal(ctx, triangle->points, 0), size);
-		loc += size;
-	}
-	RTDEBUGF(3, "rttriangle_to_gserialized copied serialized_pointlist (%d bytes)", ptsize * triangle->points->npoints);
+  /* Copy in the ordinates. */
+  if ( triangle->points->npoints > 0 )
+  {
+    size = triangle->points->npoints * ptsize;
+    memcpy(loc, rt_getPoint_internal(ctx, triangle->points, 0), size);
+    loc += size;
+  }
+  RTDEBUGF(3, "rttriangle_to_gserialized copied serialized_pointlist (%d bytes)", ptsize * triangle->points->npoints);
 
-	return (size_t)(loc - buf);
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rtcircstring(const RTCTX *ctx, const RTCIRCSTRING *curve, uint8_t *buf)
 {
-	uint8_t *loc;
-	int ptsize;
-	size_t size;
-	int type = RTCIRCSTRINGTYPE;
+  uint8_t *loc;
+  int ptsize;
+  size_t size;
+  int type = RTCIRCSTRINGTYPE;
 
-	assert(curve);
-	assert(buf);
+  assert(curve);
+  assert(buf);
 
-	if (RTFLAGS_GET_ZM(curve->flags) != RTFLAGS_GET_ZM(curve->points->flags))
-		rterror(ctx, "Dimensions mismatch in rtcircstring");
+  if (RTFLAGS_GET_ZM(curve->flags) != RTFLAGS_GET_ZM(curve->points->flags))
+    rterror(ctx, "Dimensions mismatch in rtcircstring");
 
 
-	ptsize = ptarray_point_size(ctx, curve->points);
-	loc = buf;
+  ptsize = ptarray_point_size(ctx, curve->points);
+  loc = buf;
 
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	/* Write in the npoints. */
-	memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
+  /* Write in the npoints. */
+  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
 
-	/* Copy in the ordinates. */
-	if ( curve->points->npoints > 0 )
-	{
-		size = curve->points->npoints * ptsize;
-		memcpy(loc, rt_getPoint_internal(ctx, curve->points, 0), size);
-		loc += size;
-	}
+  /* Copy in the ordinates. */
+  if ( curve->points->npoints > 0 )
+  {
+    size = curve->points->npoints * ptsize;
+    memcpy(loc, rt_getPoint_internal(ctx, curve->points, 0), size);
+    loc += size;
+  }
 
-	return (size_t)(loc - buf);
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rtcollection(const RTCTX *ctx, const RTCOLLECTION *coll, uint8_t *buf)
 {
-	size_t subsize = 0;
-	uint8_t *loc;
-	int i;
-	int type;
-
-	assert(coll);
-	assert(buf);
-
-	type = coll->type;
-	loc = buf;
-
-	/* Write in the type. */
-	memcpy(loc, &type, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
-
-	/* Write in the number of subgeoms. */
-	memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
-	loc += sizeof(uint32_t);
-
-	/* Serialize subgeoms. */
-	for ( i=0; i<coll->ngeoms; i++ )
-	{
-		if (RTFLAGS_GET_ZM(coll->flags) != RTFLAGS_GET_ZM(coll->geoms[i]->flags))
-			rterror(ctx, "Dimensions mismatch in rtcollection");
-		subsize = gserialized_from_rtgeom_any(ctx, coll->geoms[i], loc);
-		loc += subsize;
-	}
-
-	return (size_t)(loc - buf);
+  size_t subsize = 0;
+  uint8_t *loc;
+  int i;
+  int type;
+
+  assert(coll);
+  assert(buf);
+
+  type = coll->type;
+  loc = buf;
+
+  /* Write in the type. */
+  memcpy(loc, &type, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
+
+  /* Write in the number of subgeoms. */
+  memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
+  loc += sizeof(uint32_t);
+
+  /* Serialize subgeoms. */
+  for ( i=0; i<coll->ngeoms; i++ )
+  {
+    if (RTFLAGS_GET_ZM(coll->flags) != RTFLAGS_GET_ZM(coll->geoms[i]->flags))
+      rterror(ctx, "Dimensions mismatch in rtcollection");
+    subsize = gserialized_from_rtgeom_any(ctx, coll->geoms[i], loc);
+    loc += subsize;
+  }
+
+  return (size_t)(loc - buf);
 }
 
 static size_t gserialized_from_rtgeom_any(const RTCTX *ctx, const RTGEOM *geom, uint8_t *buf)
 {
-	assert(geom);
-	assert(buf);
-
-	RTDEBUGF(2, "Input type (%d) %s, hasz: %d hasm: %d",
-		geom->type, rttype_name(ctx, geom->type),
-		RTFLAGS_GET_Z(geom->flags), RTFLAGS_GET_M(geom->flags));
-	RTDEBUGF(2, "RTGEOM(%p) uint8_t(%p)", geom, buf);
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		return gserialized_from_rtpoint(ctx, (RTPOINT *)geom, buf);
-	case RTLINETYPE:
-		return gserialized_from_rtline(ctx, (RTLINE *)geom, buf);
-	case RTPOLYGONTYPE:
-		return gserialized_from_rtpoly(ctx, (RTPOLY *)geom, buf);
-	case RTTRIANGLETYPE:
-		return gserialized_from_rttriangle(ctx, (RTTRIANGLE *)geom, buf);
-	case RTCIRCSTRINGTYPE:
-		return gserialized_from_rtcircstring(ctx, (RTCIRCSTRING *)geom, buf);
-	case RTCURVEPOLYTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return gserialized_from_rtcollection(ctx, (RTCOLLECTION *)geom, buf);
-	default:
-		rterror(ctx, "Unknown geometry type: %d - %s", geom->type, rttype_name(ctx, geom->type));
-		return 0;
-	}
-	return 0;
+  assert(geom);
+  assert(buf);
+
+  RTDEBUGF(2, "Input type (%d) %s, hasz: %d hasm: %d",
+    geom->type, rttype_name(ctx, geom->type),
+    RTFLAGS_GET_Z(geom->flags), RTFLAGS_GET_M(geom->flags));
+  RTDEBUGF(2, "RTGEOM(%p) uint8_t(%p)", geom, buf);
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    return gserialized_from_rtpoint(ctx, (RTPOINT *)geom, buf);
+  case RTLINETYPE:
+    return gserialized_from_rtline(ctx, (RTLINE *)geom, buf);
+  case RTPOLYGONTYPE:
+    return gserialized_from_rtpoly(ctx, (RTPOLY *)geom, buf);
+  case RTTRIANGLETYPE:
+    return gserialized_from_rttriangle(ctx, (RTTRIANGLE *)geom, buf);
+  case RTCIRCSTRINGTYPE:
+    return gserialized_from_rtcircstring(ctx, (RTCIRCSTRING *)geom, buf);
+  case RTCURVEPOLYTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return gserialized_from_rtcollection(ctx, (RTCOLLECTION *)geom, buf);
+  default:
+    rterror(ctx, "Unknown geometry type: %d - %s", geom->type, rttype_name(ctx, geom->type));
+    return 0;
+  }
+  return 0;
 }
 
 static size_t gserialized_from_gbox(const RTCTX *ctx, const RTGBOX *gbox, uint8_t *buf)
 {
-	uint8_t *loc = buf;
-	float f;
-	size_t return_size;
-
-	assert(buf);
-
-	f = next_float_down(ctx, gbox->xmin);
-	memcpy(loc, &f, sizeof(float));
-	loc += sizeof(float);
-
-	f = next_float_up(ctx, gbox->xmax);
-	memcpy(loc, &f, sizeof(float));
-	loc += sizeof(float);
-
-	f = next_float_down(ctx, gbox->ymin);
-	memcpy(loc, &f, sizeof(float));
-	loc += sizeof(float);
-
-	f = next_float_up(ctx, gbox->ymax);
-	memcpy(loc, &f, sizeof(float));
-	loc += sizeof(float);
-
-	if ( RTFLAGS_GET_GEODETIC(gbox->flags) )
-	{
-		f = next_float_down(ctx, gbox->zmin);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-
-		f = next_float_up(ctx, gbox->zmax);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-
-		return_size = (size_t)(loc - buf);
-		RTDEBUGF(4, "returning size %d", return_size);
-		return return_size;
-	}
-
-	if ( RTFLAGS_GET_Z(gbox->flags) )
-	{
-		f = next_float_down(ctx, gbox->zmin);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-
-		f = next_float_up(ctx, gbox->zmax);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-
-	}
-
-	if ( RTFLAGS_GET_M(gbox->flags) )
-	{
-		f = next_float_down(ctx, gbox->mmin);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-
-		f = next_float_up(ctx, gbox->mmax);
-		memcpy(loc, &f, sizeof(float));
-		loc += sizeof(float);
-	}
-	return_size = (size_t)(loc - buf);
-	RTDEBUGF(4, "returning size %d", return_size);
-	return return_size;
+  uint8_t *loc = buf;
+  float f;
+  size_t return_size;
+
+  assert(buf);
+
+  f = next_float_down(ctx, gbox->xmin);
+  memcpy(loc, &f, sizeof(float));
+  loc += sizeof(float);
+
+  f = next_float_up(ctx, gbox->xmax);
+  memcpy(loc, &f, sizeof(float));
+  loc += sizeof(float);
+
+  f = next_float_down(ctx, gbox->ymin);
+  memcpy(loc, &f, sizeof(float));
+  loc += sizeof(float);
+
+  f = next_float_up(ctx, gbox->ymax);
+  memcpy(loc, &f, sizeof(float));
+  loc += sizeof(float);
+
+  if ( RTFLAGS_GET_GEODETIC(gbox->flags) )
+  {
+    f = next_float_down(ctx, gbox->zmin);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+
+    f = next_float_up(ctx, gbox->zmax);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+
+    return_size = (size_t)(loc - buf);
+    RTDEBUGF(4, "returning size %d", return_size);
+    return return_size;
+  }
+
+  if ( RTFLAGS_GET_Z(gbox->flags) )
+  {
+    f = next_float_down(ctx, gbox->zmin);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+
+    f = next_float_up(ctx, gbox->zmax);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+
+  }
+
+  if ( RTFLAGS_GET_M(gbox->flags) )
+  {
+    f = next_float_down(ctx, gbox->mmin);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+
+    f = next_float_up(ctx, gbox->mmax);
+    memcpy(loc, &f, sizeof(float));
+    loc += sizeof(float);
+  }
+  return_size = (size_t)(loc - buf);
+  RTDEBUGF(4, "returning size %d", return_size);
+  return return_size;
 }
 
 /* Public function */
 
 GSERIALIZED* gserialized_from_rtgeom(const RTCTX *ctx, RTGEOM *geom, int is_geodetic, size_t *size)
 {
-	size_t expected_size = 0;
-	size_t return_size = 0;
-	uint8_t *serialized = NULL;
-	uint8_t *ptr = NULL;
-	GSERIALIZED *g = NULL;
-	assert(geom);
-
-	/*
-	** See if we need a bounding box, add one if we don't have one.
-	*/
-	if ( (! geom->bbox) && rtgeom_needs_bbox(ctx, geom) && (!rtgeom_is_empty(ctx, geom)) )
-	{
-		rtgeom_add_bbox(ctx, geom);
-	}
-	
-	/*
-	** Harmonize the flags to the state of the rtgeom 
-	*/
-	if ( geom->bbox )
-		RTFLAGS_SET_BBOX(geom->flags, 1);
-
-	/* Set up the uint8_t buffer into which we are going to write the serialized geometry. */
-	expected_size = gserialized_from_rtgeom_size(ctx, geom);
-	serialized = rtalloc(ctx, expected_size);
-	ptr = serialized;
-
-	/* Move past size, srid and flags. */
-	ptr += 8;
-
-	/* Write in the serialized form of the gbox, if necessary. */
-	if ( geom->bbox )
-		ptr += gserialized_from_gbox(ctx, geom->bbox, ptr);
-
-	/* Write in the serialized form of the geometry. */
-	ptr += gserialized_from_rtgeom_any(ctx, geom, ptr);
-
-	/* Calculate size as returned by data processing functions. */
-	return_size = ptr - serialized;
-
-	if ( expected_size != return_size ) /* Uh oh! */
-	{
-		rterror(ctx, "Return size (%d) not equal to expected size (%d)!", return_size, expected_size);
-		return NULL;
-	}
-
-	if ( size ) /* Return the output size to the caller if necessary. */
-		*size = return_size;
-
-	g = (GSERIALIZED*)serialized;
-
-	/*
-	** We are aping PgSQL code here, PostGIS code should use
-	** VARSIZE to set this for real.
-	*/
-	g->size = return_size << 2;
-
-	/* Set the SRID! */
-	gserialized_set_srid(ctx, g, geom->srid);
-
-	g->flags = geom->flags;
-
-	return g;
+  size_t expected_size = 0;
+  size_t return_size = 0;
+  uint8_t *serialized = NULL;
+  uint8_t *ptr = NULL;
+  GSERIALIZED *g = NULL;
+  assert(geom);
+
+  /*
+  ** See if we need a bounding box, add one if we don't have one.
+  */
+  if ( (! geom->bbox) && rtgeom_needs_bbox(ctx, geom) && (!rtgeom_is_empty(ctx, geom)) )
+  {
+    rtgeom_add_bbox(ctx, geom);
+  }
+
+  /*
+  ** Harmonize the flags to the state of the rtgeom
+  */
+  if ( geom->bbox )
+    RTFLAGS_SET_BBOX(geom->flags, 1);
+
+  /* Set up the uint8_t buffer into which we are going to write the serialized geometry. */
+  expected_size = gserialized_from_rtgeom_size(ctx, geom);
+  serialized = rtalloc(ctx, expected_size);
+  ptr = serialized;
+
+  /* Move past size, srid and flags. */
+  ptr += 8;
+
+  /* Write in the serialized form of the gbox, if necessary. */
+  if ( geom->bbox )
+    ptr += gserialized_from_gbox(ctx, geom->bbox, ptr);
+
+  /* Write in the serialized form of the geometry. */
+  ptr += gserialized_from_rtgeom_any(ctx, geom, ptr);
+
+  /* Calculate size as returned by data processing functions. */
+  return_size = ptr - serialized;
+
+  if ( expected_size != return_size ) /* Uh oh! */
+  {
+    rterror(ctx, "Return size (%d) not equal to expected size (%d)!", return_size, expected_size);
+    return NULL;
+  }
+
+  if ( size ) /* Return the output size to the caller if necessary. */
+    *size = return_size;
+
+  g = (GSERIALIZED*)serialized;
+
+  /*
+  ** We are aping PgSQL code here, PostGIS code should use
+  ** VARSIZE to set this for real.
+  */
+  g->size = return_size << 2;
+
+  /* Set the SRID! */
+  gserialized_set_srid(ctx, g, geom->srid);
+
+  g->flags = geom->flags;
+
+  return g;
 }
 
 /***********************************************************************
@@ -992,320 +992,320 @@ static RTGEOM* rtgeom_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_pt
 
 static RTPOINT* rtpoint_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint8_t *start_ptr = data_ptr;
-	RTPOINT *point;
-	uint32_t npoints = 0;
+  uint8_t *start_ptr = data_ptr;
+  RTPOINT *point;
+  uint32_t npoints = 0;
 
-	assert(data_ptr);
+  assert(data_ptr);
 
-	point = (RTPOINT*)rtalloc(ctx, sizeof(RTPOINT));
-	point->srid = SRID_UNKNOWN; /* Default */
-	point->bbox = NULL;
-	point->type = RTPOINTTYPE;
-	point->flags = g_flags;
+  point = (RTPOINT*)rtalloc(ctx, sizeof(RTPOINT));
+  point->srid = SRID_UNKNOWN; /* Default */
+  point->bbox = NULL;
+  point->type = RTPOINTTYPE;
+  point->flags = g_flags;
 
-	data_ptr += 4; /* Skip past the type. */
-	npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
-	data_ptr += 4; /* Skip past the npoints. */
+  data_ptr += 4; /* Skip past the type. */
+  npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
+  data_ptr += 4; /* Skip past the npoints. */
 
-	if ( npoints > 0 )
-		point->point = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 1, data_ptr);
-	else
-		point->point = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty point */
+  if ( npoints > 0 )
+    point->point = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 1, data_ptr);
+  else
+    point->point = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty point */
 
-	data_ptr += npoints * RTFLAGS_NDIMS(g_flags) * sizeof(double);
+  data_ptr += npoints * RTFLAGS_NDIMS(g_flags) * sizeof(double);
 
-	if ( g_size )
-		*g_size = data_ptr - start_ptr;
+  if ( g_size )
+    *g_size = data_ptr - start_ptr;
 
-	return point;
+  return point;
 }
 
 static RTLINE* rtline_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint8_t *start_ptr = data_ptr;
-	RTLINE *line;
-	uint32_t npoints = 0;
+  uint8_t *start_ptr = data_ptr;
+  RTLINE *line;
+  uint32_t npoints = 0;
+
+  assert(data_ptr);
 
-	assert(data_ptr);
+  line = (RTLINE*)rtalloc(ctx, sizeof(RTLINE));
+  line->srid = SRID_UNKNOWN; /* Default */
+  line->bbox = NULL;
+  line->type = RTLINETYPE;
+  line->flags = g_flags;
 
-	line = (RTLINE*)rtalloc(ctx, sizeof(RTLINE));
-	line->srid = SRID_UNKNOWN; /* Default */
-	line->bbox = NULL;
-	line->type = RTLINETYPE;
-	line->flags = g_flags;
+  data_ptr += 4; /* Skip past the type. */
+  npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
+  data_ptr += 4; /* Skip past the npoints. */
 
-	data_ptr += 4; /* Skip past the type. */
-	npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
-	data_ptr += 4; /* Skip past the npoints. */
+  if ( npoints > 0 )
+    line->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);
 
-	if ( npoints > 0 )
-		line->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);
-		
-	else
-		line->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty linestring */
+  else
+    line->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty linestring */
 
-	data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
+  data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
 
-	if ( g_size )
-		*g_size = data_ptr - start_ptr;
+  if ( g_size )
+    *g_size = data_ptr - start_ptr;
 
-	return line;
+  return line;
 }
 
 static RTPOLY* rtpoly_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint8_t *start_ptr = data_ptr;
-	RTPOLY *poly;
-	uint8_t *ordinate_ptr;
-	uint32_t nrings = 0;
-	int i = 0;
-
-	assert(data_ptr);
-
-	poly = (RTPOLY*)rtalloc(ctx, sizeof(RTPOLY));
-	poly->srid = SRID_UNKNOWN; /* Default */
-	poly->bbox = NULL;
-	poly->type = RTPOLYGONTYPE;
-	poly->flags = g_flags;
-
-	data_ptr += 4; /* Skip past the polygontype. */
-	nrings = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
-	poly->nrings = nrings;
-	RTDEBUGF(4, "nrings = %d", nrings);
-	data_ptr += 4; /* Skip past the nrings. */
-
-	ordinate_ptr = data_ptr; /* Start the ordinate pointer. */
-	if ( nrings > 0)
-	{
-		poly->rings = (RTPOINTARRAY**)rtalloc(ctx,  sizeof(RTPOINTARRAY*) * nrings );
-		ordinate_ptr += nrings * 4; /* Move past all the npoints values. */
-		if ( nrings % 2 ) /* If there is padding, move past that too. */
-			ordinate_ptr += 4;
-	}
-	else /* Empty polygon */
-	{
-		poly->rings = NULL;
-	}
-
-	for ( i = 0; i < nrings; i++ )
-	{
-		uint32_t npoints = 0;
-
-		/* Read in the number of points. */
-		npoints = rt_get_uint32_t(ctx, data_ptr);
-		data_ptr += 4;
-
-		/* Make a point array for the ring, and move the ordinate pointer past the ring ordinates. */
-		poly->rings[i] = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, ordinate_ptr);
-		
-		ordinate_ptr += sizeof(double) * RTFLAGS_NDIMS(g_flags) * npoints;
-	}
-
-	if ( g_size )
-		*g_size = ordinate_ptr - start_ptr;
-
-	return poly;
+  uint8_t *start_ptr = data_ptr;
+  RTPOLY *poly;
+  uint8_t *ordinate_ptr;
+  uint32_t nrings = 0;
+  int i = 0;
+
+  assert(data_ptr);
+
+  poly = (RTPOLY*)rtalloc(ctx, sizeof(RTPOLY));
+  poly->srid = SRID_UNKNOWN; /* Default */
+  poly->bbox = NULL;
+  poly->type = RTPOLYGONTYPE;
+  poly->flags = g_flags;
+
+  data_ptr += 4; /* Skip past the polygontype. */
+  nrings = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
+  poly->nrings = nrings;
+  RTDEBUGF(4, "nrings = %d", nrings);
+  data_ptr += 4; /* Skip past the nrings. */
+
+  ordinate_ptr = data_ptr; /* Start the ordinate pointer. */
+  if ( nrings > 0)
+  {
+    poly->rings = (RTPOINTARRAY**)rtalloc(ctx,  sizeof(RTPOINTARRAY*) * nrings );
+    ordinate_ptr += nrings * 4; /* Move past all the npoints values. */
+    if ( nrings % 2 ) /* If there is padding, move past that too. */
+      ordinate_ptr += 4;
+  }
+  else /* Empty polygon */
+  {
+    poly->rings = NULL;
+  }
+
+  for ( i = 0; i < nrings; i++ )
+  {
+    uint32_t npoints = 0;
+
+    /* Read in the number of points. */
+    npoints = rt_get_uint32_t(ctx, data_ptr);
+    data_ptr += 4;
+
+    /* Make a point array for the ring, and move the ordinate pointer past the ring ordinates. */
+    poly->rings[i] = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, ordinate_ptr);
+
+    ordinate_ptr += sizeof(double) * RTFLAGS_NDIMS(g_flags) * npoints;
+  }
+
+  if ( g_size )
+    *g_size = ordinate_ptr - start_ptr;
+
+  return poly;
 }
 
 static RTTRIANGLE* rttriangle_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint8_t *start_ptr = data_ptr;
-	RTTRIANGLE *triangle;
-	uint32_t npoints = 0;
+  uint8_t *start_ptr = data_ptr;
+  RTTRIANGLE *triangle;
+  uint32_t npoints = 0;
 
-	assert(data_ptr);
+  assert(data_ptr);
 
-	triangle = (RTTRIANGLE*)rtalloc(ctx, sizeof(RTTRIANGLE));
-	triangle->srid = SRID_UNKNOWN; /* Default */
-	triangle->bbox = NULL;
-	triangle->type = RTTRIANGLETYPE;
-	triangle->flags = g_flags;
+  triangle = (RTTRIANGLE*)rtalloc(ctx, sizeof(RTTRIANGLE));
+  triangle->srid = SRID_UNKNOWN; /* Default */
+  triangle->bbox = NULL;
+  triangle->type = RTTRIANGLETYPE;
+  triangle->flags = g_flags;
 
-	data_ptr += 4; /* Skip past the type. */
-	npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
-	data_ptr += 4; /* Skip past the npoints. */
+  data_ptr += 4; /* Skip past the type. */
+  npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
+  data_ptr += 4; /* Skip past the npoints. */
 
-	if ( npoints > 0 )
-		triangle->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);		
-	else
-		triangle->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty triangle */
+  if ( npoints > 0 )
+    triangle->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);
+  else
+    triangle->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty triangle */
 
-	data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
+  data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
 
-	if ( g_size )
-		*g_size = data_ptr - start_ptr;
+  if ( g_size )
+    *g_size = data_ptr - start_ptr;
 
-	return triangle;
+  return triangle;
 }
 
 static RTCIRCSTRING* rtcircstring_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint8_t *start_ptr = data_ptr;
-	RTCIRCSTRING *circstring;
-	uint32_t npoints = 0;
+  uint8_t *start_ptr = data_ptr;
+  RTCIRCSTRING *circstring;
+  uint32_t npoints = 0;
 
-	assert(data_ptr);
+  assert(data_ptr);
 
-	circstring = (RTCIRCSTRING*)rtalloc(ctx, sizeof(RTCIRCSTRING));
-	circstring->srid = SRID_UNKNOWN; /* Default */
-	circstring->bbox = NULL;
-	circstring->type = RTCIRCSTRINGTYPE;
-	circstring->flags = g_flags;
+  circstring = (RTCIRCSTRING*)rtalloc(ctx, sizeof(RTCIRCSTRING));
+  circstring->srid = SRID_UNKNOWN; /* Default */
+  circstring->bbox = NULL;
+  circstring->type = RTCIRCSTRINGTYPE;
+  circstring->flags = g_flags;
 
-	data_ptr += 4; /* Skip past the circstringtype. */
-	npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
-	data_ptr += 4; /* Skip past the npoints. */
+  data_ptr += 4; /* Skip past the circstringtype. */
+  npoints = rt_get_uint32_t(ctx, data_ptr); /* Zero => empty geometry */
+  data_ptr += 4; /* Skip past the npoints. */
 
-	if ( npoints > 0 )
-		circstring->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);		
-	else
-		circstring->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty circularstring */
+  if ( npoints > 0 )
+    circstring->points = ptarray_construct_reference_data(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), npoints, data_ptr);
+  else
+    circstring->points = ptarray_construct(ctx, RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), 0); /* Empty circularstring */
 
-	data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
+  data_ptr += RTFLAGS_NDIMS(g_flags) * npoints * sizeof(double);
 
-	if ( g_size )
-		*g_size = data_ptr - start_ptr;
+  if ( g_size )
+    *g_size = data_ptr - start_ptr;
 
-	return circstring;
+  return circstring;
 }
 
 static RTCOLLECTION* rtcollection_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint32_t type;
-	uint8_t *start_ptr = data_ptr;
-	RTCOLLECTION *collection;
-	uint32_t ngeoms = 0;
-	int i = 0;
-
-	assert(data_ptr);
-
-	type = rt_get_uint32_t(ctx, data_ptr);
-	data_ptr += 4; /* Skip past the type. */
-
-	collection = (RTCOLLECTION*)rtalloc(ctx, sizeof(RTCOLLECTION));
-	collection->srid = SRID_UNKNOWN; /* Default */
-	collection->bbox = NULL;
-	collection->type = type;
-	collection->flags = g_flags;
-
-	ngeoms = rt_get_uint32_t(ctx, data_ptr);
-	collection->ngeoms = ngeoms; /* Zero => empty geometry */
-	data_ptr += 4; /* Skip past the ngeoms. */
-
-	if ( ngeoms > 0 )
-		collection->geoms = rtalloc(ctx, sizeof(RTGEOM*) * ngeoms);
-	else
-		collection->geoms = NULL;
-
-	/* Sub-geometries are never de-serialized with boxes (#1254) */
-	RTFLAGS_SET_BBOX(g_flags, 0);
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		uint32_t subtype = rt_get_uint32_t(ctx, data_ptr);
-		size_t subsize = 0;
-
-		if ( ! rtcollection_allows_subtype(ctx, type, subtype) )
-		{
-			rterror(ctx, "Invalid subtype (%s) for collection type (%s)", rttype_name(ctx, subtype), rttype_name(ctx, type));
-			rtfree(ctx, collection);
-			return NULL;
-		}
-		collection->geoms[i] = rtgeom_from_gserialized_buffer(ctx, data_ptr, g_flags, &subsize);
-		data_ptr += subsize;
-	}
-
-	if ( g_size )
-		*g_size = data_ptr - start_ptr;
-
-	return collection;
+  uint32_t type;
+  uint8_t *start_ptr = data_ptr;
+  RTCOLLECTION *collection;
+  uint32_t ngeoms = 0;
+  int i = 0;
+
+  assert(data_ptr);
+
+  type = rt_get_uint32_t(ctx, data_ptr);
+  data_ptr += 4; /* Skip past the type. */
+
+  collection = (RTCOLLECTION*)rtalloc(ctx, sizeof(RTCOLLECTION));
+  collection->srid = SRID_UNKNOWN; /* Default */
+  collection->bbox = NULL;
+  collection->type = type;
+  collection->flags = g_flags;
+
+  ngeoms = rt_get_uint32_t(ctx, data_ptr);
+  collection->ngeoms = ngeoms; /* Zero => empty geometry */
+  data_ptr += 4; /* Skip past the ngeoms. */
+
+  if ( ngeoms > 0 )
+    collection->geoms = rtalloc(ctx, sizeof(RTGEOM*) * ngeoms);
+  else
+    collection->geoms = NULL;
+
+  /* Sub-geometries are never de-serialized with boxes (#1254) */
+  RTFLAGS_SET_BBOX(g_flags, 0);
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    uint32_t subtype = rt_get_uint32_t(ctx, data_ptr);
+    size_t subsize = 0;
+
+    if ( ! rtcollection_allows_subtype(ctx, type, subtype) )
+    {
+      rterror(ctx, "Invalid subtype (%s) for collection type (%s)", rttype_name(ctx, subtype), rttype_name(ctx, type));
+      rtfree(ctx, collection);
+      return NULL;
+    }
+    collection->geoms[i] = rtgeom_from_gserialized_buffer(ctx, data_ptr, g_flags, &subsize);
+    data_ptr += subsize;
+  }
+
+  if ( g_size )
+    *g_size = data_ptr - start_ptr;
+
+  return collection;
 }
 
 RTGEOM* rtgeom_from_gserialized_buffer(const RTCTX *ctx, uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
 {
-	uint32_t type;
-
-	assert(data_ptr);
-
-	type = rt_get_uint32_t(ctx, data_ptr);
-
-	RTDEBUGF(2, "Got type %d (%s), hasz=%d hasm=%d geodetic=%d hasbox=%d", type, rttype_name(ctx, type),
-		RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), RTFLAGS_GET_GEODETIC(g_flags), RTFLAGS_GET_BBOX(g_flags));
-
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		return (RTGEOM *)rtpoint_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	case RTLINETYPE:
-		return (RTGEOM *)rtline_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	case RTCIRCSTRINGTYPE:
-		return (RTGEOM *)rtcircstring_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	case RTPOLYGONTYPE:
-		return (RTGEOM *)rtpoly_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	case RTTRIANGLETYPE:
-		return (RTGEOM *)rttriangle_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return (RTGEOM *)rtcollection_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
-	default:
-		rterror(ctx, "Unknown geometry type: %d - %s", type, rttype_name(ctx, type));
-		return NULL;
-	}
+  uint32_t type;
+
+  assert(data_ptr);
+
+  type = rt_get_uint32_t(ctx, data_ptr);
+
+  RTDEBUGF(2, "Got type %d (%s), hasz=%d hasm=%d geodetic=%d hasbox=%d", type, rttype_name(ctx, type),
+    RTFLAGS_GET_Z(g_flags), RTFLAGS_GET_M(g_flags), RTFLAGS_GET_GEODETIC(g_flags), RTFLAGS_GET_BBOX(g_flags));
+
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    return (RTGEOM *)rtpoint_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  case RTLINETYPE:
+    return (RTGEOM *)rtline_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  case RTCIRCSTRINGTYPE:
+    return (RTGEOM *)rtcircstring_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  case RTPOLYGONTYPE:
+    return (RTGEOM *)rtpoly_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  case RTTRIANGLETYPE:
+    return (RTGEOM *)rttriangle_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return (RTGEOM *)rtcollection_from_gserialized_buffer(ctx, data_ptr, g_flags, g_size);
+  default:
+    rterror(ctx, "Unknown geometry type: %d - %s", type, rttype_name(ctx, type));
+    return NULL;
+  }
 }
 
 RTGEOM* rtgeom_from_gserialized(const RTCTX *ctx, const GSERIALIZED *g)
 {
-	uint8_t g_flags = 0;
-	int32_t g_srid = 0;
-	uint32_t g_type = 0;
-	uint8_t *data_ptr = NULL;
-	RTGEOM *rtgeom = NULL;
-	RTGBOX bbox;
-	size_t g_size = 0;
-
-	assert(g);
-
-	g_srid = gserialized_get_srid(ctx, g);
-	g_flags = g->flags;
-	g_type = gserialized_get_type(ctx, g);
-	RTDEBUGF(4, "Got type %d (%s), srid=%d", g_type, rttype_name(ctx, g_type), g_srid);
-
-	data_ptr = (uint8_t*)g->data;
-	if ( RTFLAGS_GET_BBOX(g_flags) )
-		data_ptr += gbox_serialized_size(ctx, g_flags);
-
-	rtgeom = rtgeom_from_gserialized_buffer(ctx, data_ptr, g_flags, &g_size);
-
-	if ( ! rtgeom ) 
-		rterror(ctx, "rtgeom_from_gserialized: unable create geometry"); /* Ooops! */
-
-	rtgeom->type = g_type;
-	rtgeom->flags = g_flags;
-
-	if ( gserialized_read_gbox_p(ctx, g, &bbox) == RT_SUCCESS )
-	{
-		rtgeom->bbox = gbox_copy(ctx, &bbox);
-	}
-	else if ( rtgeom_needs_bbox(ctx, rtgeom) && (rtgeom_calculate_gbox(ctx, rtgeom, &bbox) == RT_SUCCESS) )
-	{
-		rtgeom->bbox = gbox_copy(ctx, &bbox);
-	}
-	else
-	{
-		rtgeom->bbox = NULL;
-	}
-
-	rtgeom_set_srid(ctx, rtgeom, g_srid);
-
-	return rtgeom;
+  uint8_t g_flags = 0;
+  int32_t g_srid = 0;
+  uint32_t g_type = 0;
+  uint8_t *data_ptr = NULL;
+  RTGEOM *rtgeom = NULL;
+  RTGBOX bbox;
+  size_t g_size = 0;
+
+  assert(g);
+
+  g_srid = gserialized_get_srid(ctx, g);
+  g_flags = g->flags;
+  g_type = gserialized_get_type(ctx, g);
+  RTDEBUGF(4, "Got type %d (%s), srid=%d", g_type, rttype_name(ctx, g_type), g_srid);
+
+  data_ptr = (uint8_t*)g->data;
+  if ( RTFLAGS_GET_BBOX(g_flags) )
+    data_ptr += gbox_serialized_size(ctx, g_flags);
+
+  rtgeom = rtgeom_from_gserialized_buffer(ctx, data_ptr, g_flags, &g_size);
+
+  if ( ! rtgeom )
+    rterror(ctx, "rtgeom_from_gserialized: unable create geometry"); /* Ooops! */
+
+  rtgeom->type = g_type;
+  rtgeom->flags = g_flags;
+
+  if ( gserialized_read_gbox_p(ctx, g, &bbox) == RT_SUCCESS )
+  {
+    rtgeom->bbox = gbox_copy(ctx, &bbox);
+  }
+  else if ( rtgeom_needs_bbox(ctx, rtgeom) && (rtgeom_calculate_gbox(ctx, rtgeom, &bbox) == RT_SUCCESS) )
+  {
+    rtgeom->bbox = gbox_copy(ctx, &bbox);
+  }
+  else
+  {
+    rtgeom->bbox = NULL;
+  }
+
+  rtgeom_set_srid(ctx, rtgeom, g_srid);
+
+  return rtgeom;
 }
 
diff --git a/src/g_util.c b/src/g_util.c
index beb4055..85cbca9 100644
--- a/src/g_util.c
+++ b/src/g_util.c
@@ -31,10 +31,10 @@
 /* Structure for the type array */
 struct geomtype_struct
 {
-	char *typename;
-	int type;
-	int z;
-	int m;
+  char *typename;
+  int type;
+  int z;
+  int m;
 };
 
 /* Type array. Note that the order of this array is important in
@@ -44,85 +44,85 @@ struct geomtype_struct
 
 struct geomtype_struct geomtype_struct_array[] =
 {
-	{ "GEOMETRYCOLLECTIONZM", RTCOLLECTIONTYPE, 1, 1 },
-	{ "GEOMETRYCOLLECTIONZ", RTCOLLECTIONTYPE, 1, 0 },
-	{ "GEOMETRYCOLLECTIONM", RTCOLLECTIONTYPE, 0, 1 },
-	{ "GEOMETRYCOLLECTION", RTCOLLECTIONTYPE, 0, 0 },
-
-	{ "GEOMETRYZM", 0, 1, 1 },
-	{ "GEOMETRYZ", 0, 1, 0 },
-	{ "GEOMETRYM", 0, 0, 1 },
-	{ "GEOMETRY", 0, 0, 0 },
-
-	{ "POLYHEDRALSURFACEZM", RTPOLYHEDRALSURFACETYPE, 1, 1 },
-	{ "POLYHEDRALSURFACEZ", RTPOLYHEDRALSURFACETYPE, 1, 0 },
-	{ "POLYHEDRALSURFACEM", RTPOLYHEDRALSURFACETYPE, 0, 1 },
-	{ "POLYHEDRALSURFACE", RTPOLYHEDRALSURFACETYPE, 0, 0 },
-
-	{ "TINZM", RTTINTYPE, 1, 1 },
-	{ "TINZ", RTTINTYPE, 1, 0 },
-	{ "TINM", RTTINTYPE, 0, 1 },
-	{ "TIN", RTTINTYPE, 0, 0 },
-
-	{ "CIRCULARSTRINGZM", RTCIRCSTRINGTYPE, 1, 1 },
-	{ "CIRCULARSTRINGZ", RTCIRCSTRINGTYPE, 1, 0 },
-	{ "CIRCULARSTRINGM", RTCIRCSTRINGTYPE, 0, 1 },
-	{ "CIRCULARSTRING", RTCIRCSTRINGTYPE, 0, 0 },
-
-	{ "COMPOUNDCURVEZM", RTCOMPOUNDTYPE, 1, 1 },
-	{ "COMPOUNDCURVEZ", RTCOMPOUNDTYPE, 1, 0 },
-	{ "COMPOUNDCURVEM", RTCOMPOUNDTYPE, 0, 1 },
-	{ "COMPOUNDCURVE", RTCOMPOUNDTYPE, 0, 0 },
-
-	{ "CURVEPOLYGONZM", RTCURVEPOLYTYPE, 1, 1 },
-	{ "CURVEPOLYGONZ", RTCURVEPOLYTYPE, 1, 0 },
-	{ "CURVEPOLYGONM", RTCURVEPOLYTYPE, 0, 1 },
-	{ "CURVEPOLYGON", RTCURVEPOLYTYPE, 0, 0 },
-
-	{ "MULTICURVEZM", RTMULTICURVETYPE, 1, 1 },
-	{ "MULTICURVEZ", RTMULTICURVETYPE, 1, 0 },
-	{ "MULTICURVEM", RTMULTICURVETYPE, 0, 1 },
-	{ "MULTICURVE", RTMULTICURVETYPE, 0, 0 },
-
-	{ "MULTISURFACEZM", RTMULTISURFACETYPE, 1, 1 },
-	{ "MULTISURFACEZ", RTMULTISURFACETYPE, 1, 0 },
-	{ "MULTISURFACEM", RTMULTISURFACETYPE, 0, 1 },
-	{ "MULTISURFACE", RTMULTISURFACETYPE, 0, 0 },
-
-	{ "MULTILINESTRINGZM", RTMULTILINETYPE, 1, 1 },
-	{ "MULTILINESTRINGZ", RTMULTILINETYPE, 1, 0 },
-	{ "MULTILINESTRINGM", RTMULTILINETYPE, 0, 1 },
-	{ "MULTILINESTRING", RTMULTILINETYPE, 0, 0 },
-
-	{ "MULTIPOLYGONZM", RTMULTIPOLYGONTYPE, 1, 1 },
-	{ "MULTIPOLYGONZ", RTMULTIPOLYGONTYPE, 1, 0 },
-	{ "MULTIPOLYGONM", RTMULTIPOLYGONTYPE, 0, 1 },
-	{ "MULTIPOLYGON", RTMULTIPOLYGONTYPE, 0, 0 },
-
-	{ "MULTIPOINTZM", RTMULTIPOINTTYPE, 1, 1 },
-	{ "MULTIPOINTZ", RTMULTIPOINTTYPE, 1, 0 },
-	{ "MULTIPOINTM", RTMULTIPOINTTYPE, 0, 1 },
-	{ "MULTIPOINT", RTMULTIPOINTTYPE, 0, 0 },
-
-	{ "LINESTRINGZM", RTLINETYPE, 1, 1 },
-	{ "LINESTRINGZ", RTLINETYPE, 1, 0 },
-	{ "LINESTRINGM", RTLINETYPE, 0, 1 },
-	{ "LINESTRING", RTLINETYPE, 0, 0 },
-
-	{ "TRIANGLEZM", RTTRIANGLETYPE, 1, 1 },
-	{ "TRIANGLEZ", RTTRIANGLETYPE, 1, 0 },
-	{ "TRIANGLEM", RTTRIANGLETYPE, 0, 1 },
-	{ "TRIANGLE", RTTRIANGLETYPE, 0, 0 },
-
-	{ "POLYGONZM", RTPOLYGONTYPE, 1, 1 },
-	{ "POLYGONZ", RTPOLYGONTYPE, 1, 0 },
-	{ "POLYGONM", RTPOLYGONTYPE, 0, 1 },
-	{ "POLYGON", RTPOLYGONTYPE, 0, 0 },
-
-	{ "POINTZM", RTPOINTTYPE, 1, 1 },
-	{ "POINTZ", RTPOINTTYPE, 1, 0 },
-	{ "POINTM", RTPOINTTYPE, 0, 1 },
-	{ "POINT", RTPOINTTYPE, 0, 0 }
+  { "GEOMETRYCOLLECTIONZM", RTCOLLECTIONTYPE, 1, 1 },
+  { "GEOMETRYCOLLECTIONZ", RTCOLLECTIONTYPE, 1, 0 },
+  { "GEOMETRYCOLLECTIONM", RTCOLLECTIONTYPE, 0, 1 },
+  { "GEOMETRYCOLLECTION", RTCOLLECTIONTYPE, 0, 0 },
+
+  { "GEOMETRYZM", 0, 1, 1 },
+  { "GEOMETRYZ", 0, 1, 0 },
+  { "GEOMETRYM", 0, 0, 1 },
+  { "GEOMETRY", 0, 0, 0 },
+
+  { "POLYHEDRALSURFACEZM", RTPOLYHEDRALSURFACETYPE, 1, 1 },
+  { "POLYHEDRALSURFACEZ", RTPOLYHEDRALSURFACETYPE, 1, 0 },
+  { "POLYHEDRALSURFACEM", RTPOLYHEDRALSURFACETYPE, 0, 1 },
+  { "POLYHEDRALSURFACE", RTPOLYHEDRALSURFACETYPE, 0, 0 },
+
+  { "TINZM", RTTINTYPE, 1, 1 },
+  { "TINZ", RTTINTYPE, 1, 0 },
+  { "TINM", RTTINTYPE, 0, 1 },
+  { "TIN", RTTINTYPE, 0, 0 },
+
+  { "CIRCULARSTRINGZM", RTCIRCSTRINGTYPE, 1, 1 },
+  { "CIRCULARSTRINGZ", RTCIRCSTRINGTYPE, 1, 0 },
+  { "CIRCULARSTRINGM", RTCIRCSTRINGTYPE, 0, 1 },
+  { "CIRCULARSTRING", RTCIRCSTRINGTYPE, 0, 0 },
+
+  { "COMPOUNDCURVEZM", RTCOMPOUNDTYPE, 1, 1 },
+  { "COMPOUNDCURVEZ", RTCOMPOUNDTYPE, 1, 0 },
+  { "COMPOUNDCURVEM", RTCOMPOUNDTYPE, 0, 1 },
+  { "COMPOUNDCURVE", RTCOMPOUNDTYPE, 0, 0 },
+
+  { "CURVEPOLYGONZM", RTCURVEPOLYTYPE, 1, 1 },
+  { "CURVEPOLYGONZ", RTCURVEPOLYTYPE, 1, 0 },
+  { "CURVEPOLYGONM", RTCURVEPOLYTYPE, 0, 1 },
+  { "CURVEPOLYGON", RTCURVEPOLYTYPE, 0, 0 },
+
+  { "MULTICURVEZM", RTMULTICURVETYPE, 1, 1 },
+  { "MULTICURVEZ", RTMULTICURVETYPE, 1, 0 },
+  { "MULTICURVEM", RTMULTICURVETYPE, 0, 1 },
+  { "MULTICURVE", RTMULTICURVETYPE, 0, 0 },
+
+  { "MULTISURFACEZM", RTMULTISURFACETYPE, 1, 1 },
+  { "MULTISURFACEZ", RTMULTISURFACETYPE, 1, 0 },
+  { "MULTISURFACEM", RTMULTISURFACETYPE, 0, 1 },
+  { "MULTISURFACE", RTMULTISURFACETYPE, 0, 0 },
+
+  { "MULTILINESTRINGZM", RTMULTILINETYPE, 1, 1 },
+  { "MULTILINESTRINGZ", RTMULTILINETYPE, 1, 0 },
+  { "MULTILINESTRINGM", RTMULTILINETYPE, 0, 1 },
+  { "MULTILINESTRING", RTMULTILINETYPE, 0, 0 },
+
+  { "MULTIPOLYGONZM", RTMULTIPOLYGONTYPE, 1, 1 },
+  { "MULTIPOLYGONZ", RTMULTIPOLYGONTYPE, 1, 0 },
+  { "MULTIPOLYGONM", RTMULTIPOLYGONTYPE, 0, 1 },
+  { "MULTIPOLYGON", RTMULTIPOLYGONTYPE, 0, 0 },
+
+  { "MULTIPOINTZM", RTMULTIPOINTTYPE, 1, 1 },
+  { "MULTIPOINTZ", RTMULTIPOINTTYPE, 1, 0 },
+  { "MULTIPOINTM", RTMULTIPOINTTYPE, 0, 1 },
+  { "MULTIPOINT", RTMULTIPOINTTYPE, 0, 0 },
+
+  { "LINESTRINGZM", RTLINETYPE, 1, 1 },
+  { "LINESTRINGZ", RTLINETYPE, 1, 0 },
+  { "LINESTRINGM", RTLINETYPE, 0, 1 },
+  { "LINESTRING", RTLINETYPE, 0, 0 },
+
+  { "TRIANGLEZM", RTTRIANGLETYPE, 1, 1 },
+  { "TRIANGLEZ", RTTRIANGLETYPE, 1, 0 },
+  { "TRIANGLEM", RTTRIANGLETYPE, 0, 1 },
+  { "TRIANGLE", RTTRIANGLETYPE, 0, 0 },
+
+  { "POLYGONZM", RTPOLYGONTYPE, 1, 1 },
+  { "POLYGONZ", RTPOLYGONTYPE, 1, 0 },
+  { "POLYGONM", RTPOLYGONTYPE, 0, 1 },
+  { "POLYGON", RTPOLYGONTYPE, 0, 0 },
+
+  { "POINTZM", RTPOINTTYPE, 1, 1 },
+  { "POINTZ", RTPOINTTYPE, 1, 0 },
+  { "POINTM", RTPOINTTYPE, 0, 1 },
+  { "POINT", RTPOINTTYPE, 0, 0 }
 
 };
 #define GEOMTYPE_STRUCT_ARRAY_LEN (sizeof geomtype_struct_array/sizeof(struct geomtype_struct))
@@ -138,21 +138,21 @@ const char dumb_upper_map[128] = "..............................................
 
 static char dump_toupper(const RTCTX *ctx, int in)
 {
-	if ( in < 0 || in > 127 ) 
-		return '.';
-	return dumb_upper_map[in];
+  if ( in < 0 || in > 127 )
+    return '.';
+  return dumb_upper_map[in];
 }
 
 uint8_t gflags(const RTCTX *ctx, int hasz, int hasm, int geodetic)
 {
-	uint8_t flags = 0;
-	if ( hasz )
-		RTFLAGS_SET_Z(flags, 1);
-	if ( hasm )
-		RTFLAGS_SET_M(flags, 1);
-	if ( geodetic )
-		RTFLAGS_SET_GEODETIC(flags, 1);
-	return flags;
+  uint8_t flags = 0;
+  if ( hasz )
+    RTFLAGS_SET_Z(flags, 1);
+  if ( hasm )
+    RTFLAGS_SET_M(flags, 1);
+  if ( geodetic )
+    RTFLAGS_SET_GEODETIC(flags, 1);
+  return flags;
 }
 
 /**
@@ -163,68 +163,68 @@ uint8_t gflags(const RTCTX *ctx, int hasz, int hasm, int geodetic)
 */
 int geometry_type_from_string(const RTCTX *ctx, const char *str, uint8_t *type, int *z, int *m)
 {
-	char *tmpstr;
-	int tmpstartpos, tmpendpos;
-	int i;
-
-	assert(str);
-	assert(type);
-	assert(z);
-	assert(m);
-
-	/* Initialize. */
-	*type = 0;
-	*z = 0;
-	*m = 0;
-
-	/* Locate any leading/trailing spaces */
-	tmpstartpos = 0;
-	for (i = 0; i < strlen(str); i++)
-	{
-		if (str[i] != ' ')
-		{
-			tmpstartpos = i;
-			break;
-		}
-	}
-
-	tmpendpos = strlen(str) - 1;
-	for (i = strlen(str) - 1; i >= 0; i--)
-	{
-		if (str[i] != ' ')
-		{
-			tmpendpos = i;
-			break;
-		}
-	}
-
-	/* Copy and convert to upper case for comparison */
-	tmpstr = rtalloc(ctx, tmpendpos - tmpstartpos + 2);
-	for (i = tmpstartpos; i <= tmpendpos; i++)
-		tmpstr[i - tmpstartpos] = dump_toupper(ctx, str[i]);
-
-	/* Add NULL to terminate */
-	tmpstr[i - tmpstartpos] = '\0';
-
-	/* Now check for the type */
-	for (i = 0; i < GEOMTYPE_STRUCT_ARRAY_LEN; i++)
-	{
-		if (!strcmp(tmpstr, geomtype_struct_array[i].typename))
-		{
-			*type = geomtype_struct_array[i].type;
-			*z = geomtype_struct_array[i].z;
-			*m = geomtype_struct_array[i].m;
-
-			rtfree(ctx, tmpstr);
-
-			return RT_SUCCESS;
-		}
-
-	}
-
-	rtfree(ctx, tmpstr);
-
-	return RT_FAILURE;
+  char *tmpstr;
+  int tmpstartpos, tmpendpos;
+  int i;
+
+  assert(str);
+  assert(type);
+  assert(z);
+  assert(m);
+
+  /* Initialize. */
+  *type = 0;
+  *z = 0;
+  *m = 0;
+
+  /* Locate any leading/trailing spaces */
+  tmpstartpos = 0;
+  for (i = 0; i < strlen(str); i++)
+  {
+    if (str[i] != ' ')
+    {
+      tmpstartpos = i;
+      break;
+    }
+  }
+
+  tmpendpos = strlen(str) - 1;
+  for (i = strlen(str) - 1; i >= 0; i--)
+  {
+    if (str[i] != ' ')
+    {
+      tmpendpos = i;
+      break;
+    }
+  }
+
+  /* Copy and convert to upper case for comparison */
+  tmpstr = rtalloc(ctx, tmpendpos - tmpstartpos + 2);
+  for (i = tmpstartpos; i <= tmpendpos; i++)
+    tmpstr[i - tmpstartpos] = dump_toupper(ctx, str[i]);
+
+  /* Add NULL to terminate */
+  tmpstr[i - tmpstartpos] = '\0';
+
+  /* Now check for the type */
+  for (i = 0; i < GEOMTYPE_STRUCT_ARRAY_LEN; i++)
+  {
+    if (!strcmp(tmpstr, geomtype_struct_array[i].typename))
+    {
+      *type = geomtype_struct_array[i].type;
+      *z = geomtype_struct_array[i].z;
+      *m = geomtype_struct_array[i].m;
+
+      rtfree(ctx, tmpstr);
+
+      return RT_SUCCESS;
+    }
+
+  }
+
+  rtfree(ctx, tmpstr);
+
+  return RT_FAILURE;
 }
 
 
diff --git a/src/librttopo_geom_internal.h b/src/librttopo_geom_internal.h
index abd7f5f..fd14d39 100644
--- a/src/librttopo_geom_internal.h
+++ b/src/librttopo_geom_internal.h
@@ -71,7 +71,7 @@
 #define FP_IS_ZERO(A) (fabs(A) <= FP_TOLERANCE)
 #define FP_MAX(A, B) (((A) > (B)) ? (A) : (B))
 #define FP_MIN(A, B) (((A) < (B)) ? (A) : (B))
-#define FP_ABS(a)   ((a) <	(0) ? -(a) : (a))
+#define FP_ABS(a)   ((a) <  (0) ? -(a) : (a))
 #define FP_EQUALS(A, B) (fabs((A)-(B)) <= FP_TOLERANCE)
 #define FP_NEQUALS(A, B) (fabs((A)-(B)) > FP_TOLERANCE)
 #define FP_LT(A, B) (((A) + FP_TOLERANCE) < (B))
@@ -110,7 +110,7 @@
 #define RTWKB_BYTE_SIZE 1 /* Internal use only */
 
 /**
-* Well-Known Binary (RTWKB) Geometry Types 
+* Well-Known Binary (RTWKB) Geometry Types
 */
 #define RTWKB_POINT_TYPE 1
 #define RTWKB_LINESTRING_TYPE 2
@@ -243,7 +243,7 @@ RTCOLLECTION* rtcollection_simplify(const RTCTX *ctx, const RTCOLLECTION *igeom,
 int signum(const RTCTX *ctx, double n);
 
 /*
-* The possible ways a pair of segments can interact. Returned by rt_segment_intersects 
+* The possible ways a pair of segments can interact. Returned by rt_segment_intersects
 */
 enum RTCG_SEGMENT_INTERSECTION_TYPE {
     SEG_ERROR = -1,
@@ -266,29 +266,29 @@ int rt_segment_intersects(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D
 double rtpoint_get_ordinate(const RTCTX *ctx, const RTPOINT4D *p, char ordinate);
 void rtpoint_set_ordinate(const RTCTX *ctx, RTPOINT4D *p, char ordinate, double value);
 
-/* 
+/*
 * Generate an interpolated coordinate p given an interpolation value and ordinate to apply it to
 */
 int point_interpolate(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2, RTPOINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value);
 
 
 /**
-* Clip a line based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a line based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 RTCOLLECTION *rtline_clip_to_ordinate_range(const RTCTX *ctx, const RTLINE *line, char ordinate, double from, double to);
 
 /**
-* Clip a multi-line based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a multi-line based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 RTCOLLECTION *rtmline_clip_to_ordinate_range(const RTCTX *ctx, const RTMLINE *mline, char ordinate, double from, double to);
 
 /**
-* Clip a multi-point based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a multi-point based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 RTCOLLECTION *rtmpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTMPOINT *mpoint, char ordinate, double from, double to);
 
 /**
-* Clip a point based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a point based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 RTCOLLECTION *rtpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTPOINT *mpoint, char ordinate, double from, double to);
 
@@ -387,7 +387,7 @@ int rtcollection_startpoint(const RTCTX *ctx, const RTCOLLECTION* col, RTPOINT4D
  */
 void closest_point_on_segment(const RTCTX *ctx, const RTPOINT4D *R, const RTPOINT4D *A, const RTPOINT4D *B, RTPOINT4D *ret);
 
-/* 
+/*
 * Repeated points
 */
 RTPOINTARRAY *ptarray_remove_repeated_points_minpoints(const RTCTX *ctx, const RTPOINTARRAY *in, double tolerance, int minpoints);
@@ -416,14 +416,14 @@ int rttin_is_closed(const RTCTX *ctx, const RTTIN *tin);
 */
 typedef struct gridspec_t
 {
-	double ipx;
-	double ipy;
-	double ipz;
-	double ipm;
-	double xsize;
-	double ysize;
-	double zsize;
-	double msize;
+  double ipx;
+  double ipy;
+  double ipz;
+  double ipm;
+  double xsize;
+  double ysize;
+  double zsize;
+  double msize;
 }
 gridspec;
 
@@ -436,7 +436,7 @@ RTCIRCSTRING* rtcircstring_grid(const RTCTX *ctx, const RTCIRCSTRING *line, cons
 RTPOINTARRAY* ptarray_grid(const RTCTX *ctx, const RTPOINTARRAY *pa, const gridspec *grid);
 
 /*
-* What side of the line formed by p1 and p2 does q fall? 
+* What side of the line formed by p1 and p2 does q fall?
 * Returns -1 for left and 1 for right and 0 for co-linearity
 */
 int rt_segment_side(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *q);
@@ -464,7 +464,7 @@ int rtgeom_contains_point(const RTCTX *ctx, const RTGEOM *geom, const RTPOINT2D
 * Return 2 if the point is on the interior of the line (only case in which
 * a split happens).
 *
-* NOTE: the components pushed to the output vector have their SRID stripped 
+* NOTE: the components pushed to the output vector have their SRID stripped
 */
 int rtline_split_by_point_to(const RTCTX *ctx, const RTLINE* ln, const RTPOINT* pt, RTMLINE* to);
 
diff --git a/src/measures.c b/src/measures.c
index 3e3b164..e6766ce 100644
--- a/src/measures.c
+++ b/src/measures.c
@@ -54,28 +54,28 @@ rtgeom_furthest_line(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 RTGEOM *
 rtgeom_closest_point(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-  return rt_dist2d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MIN);  
+  return rt_dist2d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MIN);
 }
 
 RTGEOM *
 rtgeom_furthest_point(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-  return rt_dist2d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MAX);  
+  return rt_dist2d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MAX);
 }
 
 
 void
 rt_dist2d_distpts_init(const RTCTX *ctx, DISTPTS *dl, int mode)
 {
-	dl->twisted = -1;
-	dl->p1.x = dl->p1.y = 0.0;
-	dl->p2.x = dl->p2.y = 0.0;
-	dl->mode = mode;
-	dl->tolerance = 0.0;
-	if ( mode == DIST_MIN )
-		dl->distance = FLT_MAX;
-	else
-		dl->distance = -1 * FLT_MAX;
+  dl->twisted = -1;
+  dl->p1.x = dl->p1.y = 0.0;
+  dl->p2.x = dl->p2.y = 0.0;
+  dl->mode = mode;
+  dl->tolerance = 0.0;
+  if ( mode == DIST_MIN )
+    dl->distance = FLT_MAX;
+  else
+    dl->distance = -1 * FLT_MAX;
 }
 
 /**
@@ -84,45 +84,45 @@ Function initializing shortestline and longestline calculations.
 RTGEOM *
 rt_dist2d_distanceline(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, int srid, int mode)
 {
-	double x1,x2,y1,y2;
-
-	double initdistance = ( mode == DIST_MIN ? FLT_MAX : -1.0);
-	DISTPTS thedl;
-	RTPOINT *rtpoints[2];
-	RTGEOM *result;
-
-	thedl.mode = mode;
-	thedl.distance = initdistance;
-	thedl.tolerance = 0.0;
-
-	RTDEBUG(2, "rt_dist2d_distanceline is called");
-
-	if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
-	{
-		/*should never get here. all cases ought to be error handled earlier*/
-		rterror(ctx, "Some unspecified error.");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-
-	/*if thedl.distance is unchanged there where only empty geometries input*/
-	if (thedl.distance == initdistance)
-	{
-		RTDEBUG(3, "didn't find geometries to measure between, returning null");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-	else
-	{
-		x1=thedl.p1.x;
-		y1=thedl.p1.y;
-		x2=thedl.p2.x;
-		y2=thedl.p2.y;
-
-		rtpoints[0] = rtpoint_make2d(ctx, srid, x1, y1);
-		rtpoints[1] = rtpoint_make2d(ctx, srid, x2, y2);
-
-		result = (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);
-	}
-	return result;
+  double x1,x2,y1,y2;
+
+  double initdistance = ( mode == DIST_MIN ? FLT_MAX : -1.0);
+  DISTPTS thedl;
+  RTPOINT *rtpoints[2];
+  RTGEOM *result;
+
+  thedl.mode = mode;
+  thedl.distance = initdistance;
+  thedl.tolerance = 0.0;
+
+  RTDEBUG(2, "rt_dist2d_distanceline is called");
+
+  if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
+  {
+    /*should never get here. all cases ought to be error handled earlier*/
+    rterror(ctx, "Some unspecified error.");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+
+  /*if thedl.distance is unchanged there where only empty geometries input*/
+  if (thedl.distance == initdistance)
+  {
+    RTDEBUG(3, "didn't find geometries to measure between, returning null");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+  else
+  {
+    x1=thedl.p1.x;
+    y1=thedl.p1.y;
+    x2=thedl.p2.x;
+    y2=thedl.p2.y;
+
+    rtpoints[0] = rtpoint_make2d(ctx, srid, x1, y1);
+    rtpoints[1] = rtpoint_make2d(ctx, srid, x2, y2);
+
+    result = (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);
+  }
+  return result;
 }
 
 /**
@@ -131,35 +131,35 @@ Function initializing closestpoint calculations.
 RTGEOM *
 rt_dist2d_distancepoint(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2,int srid,int mode)
 {
-	double x,y;
-	DISTPTS thedl;
-	double initdistance = FLT_MAX;
-	RTGEOM *result;
-
-	thedl.mode = mode;
-	thedl.distance= initdistance;
-	thedl.tolerance = 0;
-
-	RTDEBUG(2, "rt_dist2d_distancepoint is called");
-
-	if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
-	{
-		/*should never get here. all cases ought to be error handled earlier*/
-		rterror(ctx, "Some unspecified error.");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-	if (thedl.distance == initdistance)
-	{
-		RTDEBUG(3, "didn't find geometries to measure between, returning null");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-	else
-	{
-		x=thedl.p1.x;
-		y=thedl.p1.y;
-		result = (RTGEOM *)rtpoint_make2d(ctx, srid, x, y);
-	}
-	return result;
+  double x,y;
+  DISTPTS thedl;
+  double initdistance = FLT_MAX;
+  RTGEOM *result;
+
+  thedl.mode = mode;
+  thedl.distance= initdistance;
+  thedl.tolerance = 0;
+
+  RTDEBUG(2, "rt_dist2d_distancepoint is called");
+
+  if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
+  {
+    /*should never get here. all cases ought to be error handled earlier*/
+    rterror(ctx, "Some unspecified error.");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+  if (thedl.distance == initdistance)
+  {
+    RTDEBUG(3, "didn't find geometries to measure between, returning null");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+  else
+  {
+    x=thedl.p1.x;
+    y=thedl.p1.y;
+    result = (RTGEOM *)rtpoint_make2d(ctx, srid, x, y);
+  }
+  return result;
 }
 
 
@@ -169,9 +169,9 @@ Function initialazing max distance calculation
 double
 rtgeom_maxdistance2d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	RTDEBUG(2, "rtgeom_maxdistance2d is called");
+  RTDEBUG(2, "rtgeom_maxdistance2d is called");
 
-	return rtgeom_maxdistance2d_tolerance(ctx,  rt1, rt2, 0.0 );
+  return rtgeom_maxdistance2d_tolerance(ctx,  rt1, rt2, 0.0 );
 }
 
 /**
@@ -181,50 +181,50 @@ The difference is just the tolerance.
 double
 rtgeom_maxdistance2d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance)
 {
-	/*double thedist;*/
-	DISTPTS thedl;
-	RTDEBUG(2, "rtgeom_maxdistance2d_tolerance is called");
-	thedl.mode = DIST_MAX;
-	thedl.distance= -1;
-	thedl.tolerance = tolerance;
-	if (rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
-	{
-		return thedl.distance;
-	}
-	/*should never get here. all cases ought to be error handled earlier*/
-	rterror(ctx, "Some unspecified error.");
-	return -1;
+  /*double thedist;*/
+  DISTPTS thedl;
+  RTDEBUG(2, "rtgeom_maxdistance2d_tolerance is called");
+  thedl.mode = DIST_MAX;
+  thedl.distance= -1;
+  thedl.tolerance = tolerance;
+  if (rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
+  {
+    return thedl.distance;
+  }
+  /*should never get here. all cases ought to be error handled earlier*/
+  rterror(ctx, "Some unspecified error.");
+  return -1;
 }
 
 /**
-	Function initialazing min distance calculation
+  Function initialazing min distance calculation
 */
 double
 rtgeom_mindistance2d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	RTDEBUG(2, "rtgeom_mindistance2d is called");
-	return rtgeom_mindistance2d_tolerance(ctx,  rt1, rt2, 0.0 );
+  RTDEBUG(2, "rtgeom_mindistance2d is called");
+  return rtgeom_mindistance2d_tolerance(ctx,  rt1, rt2, 0.0 );
 }
 
 /**
-	Function handling min distance calculations and dwithin calculations.
-	The difference is just the tolerance.
+  Function handling min distance calculations and dwithin calculations.
+  The difference is just the tolerance.
 */
 double
 rtgeom_mindistance2d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance)
 {
-	DISTPTS thedl;
-	RTDEBUG(2, "rtgeom_mindistance2d_tolerance is called");
-	thedl.mode = DIST_MIN;
-	thedl.distance= FLT_MAX;
-	thedl.tolerance = tolerance;
-	if (rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
-	{
-		return thedl.distance;
-	}
-	/*should never get here. all cases ought to be error handled earlier*/
-	rterror(ctx, "Some unspecified error.");
-	return FLT_MAX;
+  DISTPTS thedl;
+  RTDEBUG(2, "rtgeom_mindistance2d_tolerance is called");
+  thedl.mode = DIST_MIN;
+  thedl.distance= FLT_MAX;
+  thedl.tolerance = tolerance;
+  if (rt_dist2d_comp(ctx,  rt1,rt2,&thedl))
+  {
+    return thedl.distance;
+  }
+  /*should never get here. all cases ought to be error handled earlier*/
+  rterror(ctx, "Some unspecified error.");
+  return FLT_MAX;
 }
 
 
@@ -238,38 +238,38 @@ Functions preparing geometries for distance-calculations
 --------------------------------------------------------------------------------------------------------------*/
 
 /**
-	This function just deserializes geometries
-	Bboxes is not checked here since it is the subgeometries
-	bboxes we will use anyway.
+  This function just deserializes geometries
+  Bboxes is not checked here since it is the subgeometries
+  bboxes we will use anyway.
 */
 int
 rt_dist2d_comp(const RTCTX *ctx, const RTGEOM *rt1,const RTGEOM *rt2, DISTPTS *dl)
 {
-	RTDEBUG(2, "rt_dist2d_comp is called");
+  RTDEBUG(2, "rt_dist2d_comp is called");
 
-	return rt_dist2d_recursive(ctx, rt1, rt2, dl);
+  return rt_dist2d_recursive(ctx, rt1, rt2, dl);
 }
 
 static int
 rt_dist2d_is_collection(const RTCTX *ctx, const RTGEOM *g)
 {
 
-	switch (g->type)
-	{
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTCOMPOUNDTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-		return RT_TRUE;
-		break;
-
-	default:
-		return RT_FALSE;
-	}
+  switch (g->type)
+  {
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTCOMPOUNDTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+    return RT_TRUE;
+    break;
+
+  default:
+    return RT_FALSE;
+  }
 }
 
 /**
@@ -277,93 +277,93 @@ This is a recursive function delivering every possible combinatin of subgeometri
 */
 int rt_dist2d_recursive(const RTCTX *ctx, const RTGEOM *rtg1, const RTGEOM *rtg2, DISTPTS *dl)
 {
-	int i, j;
-	int n1=1;
-	int n2=1;
-	RTGEOM *g1 = NULL;
-	RTGEOM *g2 = NULL;
-	RTCOLLECTION *c1 = NULL;
-	RTCOLLECTION *c2 = NULL;
-
-	RTDEBUGF(2, "rt_dist2d_comp is called with type1=%d, type2=%d", rtg1->type, rtg2->type);
-
-	if (rt_dist2d_is_collection(ctx, rtg1))
-	{
-		RTDEBUG(3, "First geometry is collection");
-		c1 = rtgeom_as_rtcollection(ctx, rtg1);
-		n1 = c1->ngeoms;
-	}
-	if (rt_dist2d_is_collection(ctx, rtg2))
-	{
-		RTDEBUG(3, "Second geometry is collection");
-		c2 = rtgeom_as_rtcollection(ctx, rtg2);
-		n2 = c2->ngeoms;
-	}
-
-	for ( i = 0; i < n1; i++ )
-	{
-
-		if (rt_dist2d_is_collection(ctx, rtg1))
-		{
-			g1 = c1->geoms[i];
-		}
-		else
-		{
-			g1 = (RTGEOM*)rtg1;
-		}
-
-		if (rtgeom_is_empty(ctx, g1)) return RT_TRUE;
-
-		if (rt_dist2d_is_collection(ctx, g1))
-		{
-			RTDEBUG(3, "Found collection inside first geometry collection, recursing");
-			if (!rt_dist2d_recursive(ctx, g1, rtg2, dl)) return RT_FALSE;
-			continue;
-		}
-		for ( j = 0; j < n2; j++ )
-		{
-			if (rt_dist2d_is_collection(ctx, rtg2))
-			{
-				g2 = c2->geoms[j];
-			}
-			else
-			{
-				g2 = (RTGEOM*)rtg2;
-			}
-			if (rt_dist2d_is_collection(ctx, g2))
-			{
-				RTDEBUG(3, "Found collection inside second geometry collection, recursing");
-				if (!rt_dist2d_recursive(ctx, g1, g2, dl)) return RT_FALSE;
-				continue;
-			}
-
-			if ( ! g1->bbox )
-			{
-				rtgeom_add_bbox(ctx, g1);
-			}
-			if ( ! g2->bbox )
-			{
-				rtgeom_add_bbox(ctx, g2);
-			}
-
-			/*If one of geometries is empty, return. True here only means continue searching. False would have stoped the process*/
-			if (rtgeom_is_empty(ctx, g1)||rtgeom_is_empty(ctx, g2)) return RT_TRUE;
-
-			if ( (dl->mode != DIST_MAX) && 
-				 (! rt_dist2d_check_overlap(ctx, g1, g2)) && 
-			     (g1->type == RTLINETYPE || g1->type == RTPOLYGONTYPE) && 
-			     (g2->type == RTLINETYPE || g2->type == RTPOLYGONTYPE) )	
-			{
-				if (!rt_dist2d_distribute_fast(ctx, g1, g2, dl)) return RT_FALSE;
-			}
-			else
-			{
-				if (!rt_dist2d_distribute_bruteforce(ctx, g1, g2, dl)) return RT_FALSE;
-				if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/				
-			}
-		}
-	}
-	return RT_TRUE;
+  int i, j;
+  int n1=1;
+  int n2=1;
+  RTGEOM *g1 = NULL;
+  RTGEOM *g2 = NULL;
+  RTCOLLECTION *c1 = NULL;
+  RTCOLLECTION *c2 = NULL;
+
+  RTDEBUGF(2, "rt_dist2d_comp is called with type1=%d, type2=%d", rtg1->type, rtg2->type);
+
+  if (rt_dist2d_is_collection(ctx, rtg1))
+  {
+    RTDEBUG(3, "First geometry is collection");
+    c1 = rtgeom_as_rtcollection(ctx, rtg1);
+    n1 = c1->ngeoms;
+  }
+  if (rt_dist2d_is_collection(ctx, rtg2))
+  {
+    RTDEBUG(3, "Second geometry is collection");
+    c2 = rtgeom_as_rtcollection(ctx, rtg2);
+    n2 = c2->ngeoms;
+  }
+
+  for ( i = 0; i < n1; i++ )
+  {
+
+    if (rt_dist2d_is_collection(ctx, rtg1))
+    {
+      g1 = c1->geoms[i];
+    }
+    else
+    {
+      g1 = (RTGEOM*)rtg1;
+    }
+
+    if (rtgeom_is_empty(ctx, g1)) return RT_TRUE;
+
+    if (rt_dist2d_is_collection(ctx, g1))
+    {
+      RTDEBUG(3, "Found collection inside first geometry collection, recursing");
+      if (!rt_dist2d_recursive(ctx, g1, rtg2, dl)) return RT_FALSE;
+      continue;
+    }
+    for ( j = 0; j < n2; j++ )
+    {
+      if (rt_dist2d_is_collection(ctx, rtg2))
+      {
+        g2 = c2->geoms[j];
+      }
+      else
+      {
+        g2 = (RTGEOM*)rtg2;
+      }
+      if (rt_dist2d_is_collection(ctx, g2))
+      {
+        RTDEBUG(3, "Found collection inside second geometry collection, recursing");
+        if (!rt_dist2d_recursive(ctx, g1, g2, dl)) return RT_FALSE;
+        continue;
+      }
+
+      if ( ! g1->bbox )
+      {
+        rtgeom_add_bbox(ctx, g1);
+      }
+      if ( ! g2->bbox )
+      {
+        rtgeom_add_bbox(ctx, g2);
+      }
+
+      /*If one of geometries is empty, return. True here only means continue searching. False would have stoped the process*/
+      if (rtgeom_is_empty(ctx, g1)||rtgeom_is_empty(ctx, g2)) return RT_TRUE;
+
+      if ( (dl->mode != DIST_MAX) &&
+         (! rt_dist2d_check_overlap(ctx, g1, g2)) &&
+           (g1->type == RTLINETYPE || g1->type == RTPOLYGONTYPE) &&
+           (g2->type == RTLINETYPE || g2->type == RTPOLYGONTYPE) )
+      {
+        if (!rt_dist2d_distribute_fast(ctx, g1, g2, dl)) return RT_FALSE;
+      }
+      else
+      {
+        if (!rt_dist2d_distribute_bruteforce(ctx, g1, g2, dl)) return RT_FALSE;
+        if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+      }
+    }
+  }
+  return RT_TRUE;
 }
 
 
@@ -371,121 +371,121 @@ int
 rt_dist2d_distribute_bruteforce(const RTCTX *ctx, const RTGEOM *rtg1,const RTGEOM *rtg2, DISTPTS *dl)
 {
 
-	int	t1 = rtg1->type;
-	int	t2 = rtg2->type;
-
-	switch ( t1 )
-	{
-		case RTPOINTTYPE:
-		{
-			dl->twisted = 1;
-			switch ( t2 )
-			{
-				case RTPOINTTYPE:
-					return rt_dist2d_point_point(ctx, (RTPOINT *)rtg1, (RTPOINT *)rtg2, dl);
-				case RTLINETYPE:
-					return rt_dist2d_point_line(ctx, (RTPOINT *)rtg1, (RTLINE *)rtg2, dl);
-				case RTPOLYGONTYPE:
-					return rt_dist2d_point_poly(ctx, (RTPOINT *)rtg1, (RTPOLY *)rtg2, dl);
-				case RTCIRCSTRINGTYPE:
-					return rt_dist2d_point_circstring(ctx, (RTPOINT *)rtg1, (RTCIRCSTRING *)rtg2, dl);
-				case RTCURVEPOLYTYPE:
-					return rt_dist2d_point_curvepoly(ctx, (RTPOINT *)rtg1, (RTCURVEPOLY *)rtg2, dl);
-				default:
-					rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			}
-		}
-		case RTLINETYPE:
-		{
-			dl->twisted = 1;
-			switch ( t2 )
-			{
-				case RTPOINTTYPE:
-					dl->twisted=(-1);
-					return rt_dist2d_point_line(ctx, (RTPOINT *)rtg2, (RTLINE *)rtg1, dl);
-				case RTLINETYPE:
-					return rt_dist2d_line_line(ctx, (RTLINE *)rtg1, (RTLINE *)rtg2, dl);
-				case RTPOLYGONTYPE:
-					return rt_dist2d_line_poly(ctx, (RTLINE *)rtg1, (RTPOLY *)rtg2, dl);
-				case RTCIRCSTRINGTYPE:
-					return rt_dist2d_line_circstring(ctx, (RTLINE *)rtg1, (RTCIRCSTRING *)rtg2, dl);
-				case RTCURVEPOLYTYPE:
-					return rt_dist2d_line_curvepoly(ctx, (RTLINE *)rtg1, (RTCURVEPOLY *)rtg2, dl);
-				default:
-					rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			}
-		}
-		case RTCIRCSTRINGTYPE:
-		{
-			dl->twisted = 1;
-			switch ( t2 )
-			{
-				case RTPOINTTYPE:
-					dl->twisted = -1;
-					return rt_dist2d_point_circstring(ctx, (RTPOINT *)rtg2, (RTCIRCSTRING *)rtg1, dl);
-				case RTLINETYPE:
-					dl->twisted = -1;
-					return rt_dist2d_line_circstring(ctx, (RTLINE *)rtg2, (RTCIRCSTRING *)rtg1, dl);
-				case RTPOLYGONTYPE:
-					return rt_dist2d_circstring_poly(ctx, (RTCIRCSTRING *)rtg1, (RTPOLY *)rtg2, dl);
-				case RTCIRCSTRINGTYPE:
-					return rt_dist2d_circstring_circstring(ctx, (RTCIRCSTRING *)rtg1, (RTCIRCSTRING *)rtg2, dl);
-				case RTCURVEPOLYTYPE:
-					return rt_dist2d_circstring_curvepoly(ctx, (RTCIRCSTRING *)rtg1, (RTCURVEPOLY *)rtg2, dl);
-				default:
-					rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			}			
-		}
-		case RTPOLYGONTYPE:
-		{
-			dl->twisted = -1;
-			switch ( t2 )
-			{
-				case RTPOINTTYPE:
-					return rt_dist2d_point_poly(ctx, (RTPOINT *)rtg2, (RTPOLY *)rtg1, dl);
-				case RTLINETYPE:
-					return rt_dist2d_line_poly(ctx, (RTLINE *)rtg2, (RTPOLY *)rtg1, dl);
-				case RTCIRCSTRINGTYPE:
-					return rt_dist2d_circstring_poly(ctx, (RTCIRCSTRING *)rtg2, (RTPOLY *)rtg1, dl);
-				case RTPOLYGONTYPE:
-					dl->twisted = 1;
-					return rt_dist2d_poly_poly(ctx, (RTPOLY *)rtg1, (RTPOLY *)rtg2, dl);
-				case RTCURVEPOLYTYPE:
-					dl->twisted = 1;
-					return rt_dist2d_poly_curvepoly(ctx, (RTPOLY *)rtg1, (RTCURVEPOLY *)rtg2, dl);
-				default:
-					rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			}
-		}
-		case RTCURVEPOLYTYPE:
-		{
-			dl->twisted = (-1);
-			switch ( t2 )
-			{
-				case RTPOINTTYPE:
-					return rt_dist2d_point_curvepoly(ctx, (RTPOINT *)rtg2, (RTCURVEPOLY *)rtg1, dl);
-				case RTLINETYPE:
-					return rt_dist2d_line_curvepoly(ctx, (RTLINE *)rtg2, (RTCURVEPOLY *)rtg1, dl);
-				case RTPOLYGONTYPE:
-					return rt_dist2d_poly_curvepoly(ctx, (RTPOLY *)rtg2, (RTCURVEPOLY *)rtg1, dl);
-				case RTCIRCSTRINGTYPE:
-					return rt_dist2d_circstring_curvepoly(ctx, (RTCIRCSTRING *)rtg2, (RTCURVEPOLY *)rtg1, dl);
-				case RTCURVEPOLYTYPE:
-					dl->twisted = 1;
-					return rt_dist2d_curvepoly_curvepoly(ctx, (RTCURVEPOLY *)rtg1, (RTCURVEPOLY *)rtg2, dl);
-				default:
-					rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			}			
-		}
-		default:
-		{
-			rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t1));
-		}
-	}
-
-	/*You shouldn't being able to get here*/
-	rterror(ctx, "unspecified error in function rt_dist2d_distribute_bruteforce");
-	return RT_FALSE;
+  int  t1 = rtg1->type;
+  int  t2 = rtg2->type;
+
+  switch ( t1 )
+  {
+    case RTPOINTTYPE:
+    {
+      dl->twisted = 1;
+      switch ( t2 )
+      {
+        case RTPOINTTYPE:
+          return rt_dist2d_point_point(ctx, (RTPOINT *)rtg1, (RTPOINT *)rtg2, dl);
+        case RTLINETYPE:
+          return rt_dist2d_point_line(ctx, (RTPOINT *)rtg1, (RTLINE *)rtg2, dl);
+        case RTPOLYGONTYPE:
+          return rt_dist2d_point_poly(ctx, (RTPOINT *)rtg1, (RTPOLY *)rtg2, dl);
+        case RTCIRCSTRINGTYPE:
+          return rt_dist2d_point_circstring(ctx, (RTPOINT *)rtg1, (RTCIRCSTRING *)rtg2, dl);
+        case RTCURVEPOLYTYPE:
+          return rt_dist2d_point_curvepoly(ctx, (RTPOINT *)rtg1, (RTCURVEPOLY *)rtg2, dl);
+        default:
+          rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      }
+    }
+    case RTLINETYPE:
+    {
+      dl->twisted = 1;
+      switch ( t2 )
+      {
+        case RTPOINTTYPE:
+          dl->twisted=(-1);
+          return rt_dist2d_point_line(ctx, (RTPOINT *)rtg2, (RTLINE *)rtg1, dl);
+        case RTLINETYPE:
+          return rt_dist2d_line_line(ctx, (RTLINE *)rtg1, (RTLINE *)rtg2, dl);
+        case RTPOLYGONTYPE:
+          return rt_dist2d_line_poly(ctx, (RTLINE *)rtg1, (RTPOLY *)rtg2, dl);
+        case RTCIRCSTRINGTYPE:
+          return rt_dist2d_line_circstring(ctx, (RTLINE *)rtg1, (RTCIRCSTRING *)rtg2, dl);
+        case RTCURVEPOLYTYPE:
+          return rt_dist2d_line_curvepoly(ctx, (RTLINE *)rtg1, (RTCURVEPOLY *)rtg2, dl);
+        default:
+          rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      }
+    }
+    case RTCIRCSTRINGTYPE:
+    {
+      dl->twisted = 1;
+      switch ( t2 )
+      {
+        case RTPOINTTYPE:
+          dl->twisted = -1;
+          return rt_dist2d_point_circstring(ctx, (RTPOINT *)rtg2, (RTCIRCSTRING *)rtg1, dl);
+        case RTLINETYPE:
+          dl->twisted = -1;
+          return rt_dist2d_line_circstring(ctx, (RTLINE *)rtg2, (RTCIRCSTRING *)rtg1, dl);
+        case RTPOLYGONTYPE:
+          return rt_dist2d_circstring_poly(ctx, (RTCIRCSTRING *)rtg1, (RTPOLY *)rtg2, dl);
+        case RTCIRCSTRINGTYPE:
+          return rt_dist2d_circstring_circstring(ctx, (RTCIRCSTRING *)rtg1, (RTCIRCSTRING *)rtg2, dl);
+        case RTCURVEPOLYTYPE:
+          return rt_dist2d_circstring_curvepoly(ctx, (RTCIRCSTRING *)rtg1, (RTCURVEPOLY *)rtg2, dl);
+        default:
+          rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      }
+    }
+    case RTPOLYGONTYPE:
+    {
+      dl->twisted = -1;
+      switch ( t2 )
+      {
+        case RTPOINTTYPE:
+          return rt_dist2d_point_poly(ctx, (RTPOINT *)rtg2, (RTPOLY *)rtg1, dl);
+        case RTLINETYPE:
+          return rt_dist2d_line_poly(ctx, (RTLINE *)rtg2, (RTPOLY *)rtg1, dl);
+        case RTCIRCSTRINGTYPE:
+          return rt_dist2d_circstring_poly(ctx, (RTCIRCSTRING *)rtg2, (RTPOLY *)rtg1, dl);
+        case RTPOLYGONTYPE:
+          dl->twisted = 1;
+          return rt_dist2d_poly_poly(ctx, (RTPOLY *)rtg1, (RTPOLY *)rtg2, dl);
+        case RTCURVEPOLYTYPE:
+          dl->twisted = 1;
+          return rt_dist2d_poly_curvepoly(ctx, (RTPOLY *)rtg1, (RTCURVEPOLY *)rtg2, dl);
+        default:
+          rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      }
+    }
+    case RTCURVEPOLYTYPE:
+    {
+      dl->twisted = (-1);
+      switch ( t2 )
+      {
+        case RTPOINTTYPE:
+          return rt_dist2d_point_curvepoly(ctx, (RTPOINT *)rtg2, (RTCURVEPOLY *)rtg1, dl);
+        case RTLINETYPE:
+          return rt_dist2d_line_curvepoly(ctx, (RTLINE *)rtg2, (RTCURVEPOLY *)rtg1, dl);
+        case RTPOLYGONTYPE:
+          return rt_dist2d_poly_curvepoly(ctx, (RTPOLY *)rtg2, (RTCURVEPOLY *)rtg1, dl);
+        case RTCIRCSTRINGTYPE:
+          return rt_dist2d_circstring_curvepoly(ctx, (RTCIRCSTRING *)rtg2, (RTCURVEPOLY *)rtg1, dl);
+        case RTCURVEPOLYTYPE:
+          dl->twisted = 1;
+          return rt_dist2d_curvepoly_curvepoly(ctx, (RTCURVEPOLY *)rtg1, (RTCURVEPOLY *)rtg2, dl);
+        default:
+          rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      }
+    }
+    default:
+    {
+      rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t1));
+    }
+  }
+
+  /*You shouldn't being able to get here*/
+  rterror(ctx, "unspecified error in function rt_dist2d_distribute_bruteforce");
+  return RT_FALSE;
 }
 
 
@@ -498,21 +498,21 @@ We have to check for overlapping bboxes
 int
 rt_dist2d_check_overlap(const RTCTX *ctx, RTGEOM *rtg1,RTGEOM *rtg2)
 {
-	RTDEBUG(2, "rt_dist2d_check_overlap is called");
-	if ( ! rtg1->bbox )
-		rtgeom_calculate_gbox(ctx, rtg1, rtg1->bbox);
-	if ( ! rtg2->bbox )
-		rtgeom_calculate_gbox(ctx, rtg2, rtg2->bbox);
-
-	/*Check if the geometries intersect.
-	*/
-	if ((rtg1->bbox->xmax<rtg2->bbox->xmin||rtg1->bbox->xmin>rtg2->bbox->xmax||rtg1->bbox->ymax<rtg2->bbox->ymin||rtg1->bbox->ymin>rtg2->bbox->ymax))
-	{
-		RTDEBUG(3, "geometries bboxes did not overlap");
-		return RT_FALSE;
-	}
-	RTDEBUG(3, "geometries bboxes overlap");
-	return RT_TRUE;
+  RTDEBUG(2, "rt_dist2d_check_overlap is called");
+  if ( ! rtg1->bbox )
+    rtgeom_calculate_gbox(ctx, rtg1, rtg1->bbox);
+  if ( ! rtg2->bbox )
+    rtgeom_calculate_gbox(ctx, rtg2, rtg2->bbox);
+
+  /*Check if the geometries intersect.
+  */
+  if ((rtg1->bbox->xmax<rtg2->bbox->xmin||rtg1->bbox->xmin>rtg2->bbox->xmax||rtg1->bbox->ymax<rtg2->bbox->ymin||rtg1->bbox->ymin>rtg2->bbox->ymax))
+  {
+    RTDEBUG(3, "geometries bboxes did not overlap");
+    return RT_FALSE;
+  }
+  RTDEBUG(3, "geometries bboxes overlap");
+  return RT_TRUE;
 }
 
 /**
@@ -522,38 +522,38 @@ Here the geometries are distributed for the new faster distance-calculations
 int
 rt_dist2d_distribute_fast(const RTCTX *ctx, RTGEOM *rtg1, RTGEOM *rtg2, DISTPTS *dl)
 {
-	RTPOINTARRAY *pa1, *pa2;
-	int	type1 = rtg1->type;
-	int	type2 = rtg2->type;
-
-	RTDEBUGF(2, "rt_dist2d_distribute_fast is called with typ1=%d, type2=%d", rtg1->type, rtg2->type);
-
-	switch (type1)
-	{
-	case RTLINETYPE:
-		pa1 = ((RTLINE *)rtg1)->points;
-		break;
-	case RTPOLYGONTYPE:
-		pa1 = ((RTPOLY *)rtg1)->rings[0];
-		break;
-	default:
-		rterror(ctx, "Unsupported geometry1 type: %s", rttype_name(ctx, type1));
-		return RT_FALSE;
-	}
-	switch (type2)
-	{
-	case RTLINETYPE:
-		pa2 = ((RTLINE *)rtg2)->points;
-		break;
-	case RTPOLYGONTYPE:
-		pa2 = ((RTPOLY *)rtg2)->rings[0];
-		break;
-	default:
-		rterror(ctx, "Unsupported geometry2 type: %s", rttype_name(ctx, type1));
-		return RT_FALSE;
-	}
-	dl->twisted=1;
-	return rt_dist2d_fast_ptarray_ptarray(ctx, pa1, pa2, dl, rtg1->bbox, rtg2->bbox);
+  RTPOINTARRAY *pa1, *pa2;
+  int  type1 = rtg1->type;
+  int  type2 = rtg2->type;
+
+  RTDEBUGF(2, "rt_dist2d_distribute_fast is called with typ1=%d, type2=%d", rtg1->type, rtg2->type);
+
+  switch (type1)
+  {
+  case RTLINETYPE:
+    pa1 = ((RTLINE *)rtg1)->points;
+    break;
+  case RTPOLYGONTYPE:
+    pa1 = ((RTPOLY *)rtg1)->rings[0];
+    break;
+  default:
+    rterror(ctx, "Unsupported geometry1 type: %s", rttype_name(ctx, type1));
+    return RT_FALSE;
+  }
+  switch (type2)
+  {
+  case RTLINETYPE:
+    pa2 = ((RTLINE *)rtg2)->points;
+    break;
+  case RTPOLYGONTYPE:
+    pa2 = ((RTPOLY *)rtg2)->rings[0];
+    break;
+  default:
+    rterror(ctx, "Unsupported geometry2 type: %s", rttype_name(ctx, type1));
+    return RT_FALSE;
+  }
+  dl->twisted=1;
+  return rt_dist2d_fast_ptarray_ptarray(ctx, pa1, pa2, dl, rtg1->bbox, rtg2->bbox);
 }
 
 /*------------------------------------------------------------------------------------------------------------
@@ -564,8 +564,8 @@ End of Preprocessing functions
 /*------------------------------------------------------------------------------------------------------------
 Brute force functions
 The old way of calculating distances, now used for:
-1)	distances to points (because there shouldn't be anything to gain by the new way of doing it)
-2)	distances when subgeometries geometries bboxes overlaps
+1)  distances to points (because there shouldn't be anything to gain by the new way of doing it)
+2)  distances when subgeometries geometries bboxes overlaps
 --------------------------------------------------------------------------------------------------------------*/
 
 /**
@@ -575,12 +575,12 @@ point to point calculation
 int
 rt_dist2d_point_point(const RTCTX *ctx, RTPOINT *point1, RTPOINT *point2, DISTPTS *dl)
 {
-	const RTPOINT2D *p1, *p2;
+  const RTPOINT2D *p1, *p2;
 
-	p1 = rt_getPoint2d_cp(ctx, point1->point, 0);
-	p2 = rt_getPoint2d_cp(ctx, point2->point, 0);
+  p1 = rt_getPoint2d_cp(ctx, point1->point, 0);
+  p2 = rt_getPoint2d_cp(ctx, point2->point, 0);
 
-	return rt_dist2d_pt_pt(ctx, p1, p2, dl);
+  return rt_dist2d_pt_pt(ctx, p1, p2, dl);
 }
 /**
 
@@ -589,18 +589,18 @@ point to line calculation
 int
 rt_dist2d_point_line(const RTCTX *ctx, RTPOINT *point, RTLINE *line, DISTPTS *dl)
 {
-	const RTPOINT2D *p;
-	RTDEBUG(2, "rt_dist2d_point_line is called");
-	p = rt_getPoint2d_cp(ctx, point->point, 0);
-	return rt_dist2d_pt_ptarray(ctx, p, line->points, dl);
+  const RTPOINT2D *p;
+  RTDEBUG(2, "rt_dist2d_point_line is called");
+  p = rt_getPoint2d_cp(ctx, point->point, 0);
+  return rt_dist2d_pt_ptarray(ctx, p, line->points, dl);
 }
 
 int
 rt_dist2d_point_circstring(const RTCTX *ctx, RTPOINT *point, RTCIRCSTRING *circ, DISTPTS *dl)
 {
-	const RTPOINT2D *p;
-	p = rt_getPoint2d_cp(ctx, point->point, 0);
-	return rt_dist2d_pt_ptarrayarc(ctx, p, circ->points, dl);
+  const RTPOINT2D *p;
+  p = rt_getPoint2d_cp(ctx, point->point, 0);
+  return rt_dist2d_pt_ptarrayarc(ctx, p, circ->points, dl);
 }
 
 /**
@@ -611,93 +611,93 @@ rt_dist2d_point_circstring(const RTCTX *ctx, RTPOINT *point, RTCIRCSTRING *circ,
 int
 rt_dist2d_point_poly(const RTCTX *ctx, RTPOINT *point, RTPOLY *poly, DISTPTS *dl)
 {
-	const RTPOINT2D *p;
-	int i;
-
-	RTDEBUG(2, "rt_dist2d_point_poly called");
-
-	p = rt_getPoint2d_cp(ctx, point->point, 0);
-
-	if (dl->mode == DIST_MAX)
-	{
-		RTDEBUG(3, "looking for maxdistance");
-		return rt_dist2d_pt_ptarray(ctx, p, poly->rings[0], dl);
-	}
-	/* Return distance to outer ring if not inside it */
-	if ( ptarray_contains_point(ctx, poly->rings[0], p) == RT_OUTSIDE )	
-	{
-		RTDEBUG(3, "first point not inside outer-ring");
-		return rt_dist2d_pt_ptarray(ctx, p, poly->rings[0], dl);
-	}
-
-	/*
-	 * Inside the outer ring.
-	 * Scan though each of the inner rings looking to
-	 * see if its inside.  If not, distance==0.
-	 * Otherwise, distance = pt to ring distance
-	 */
-	for ( i = 1;  i < poly->nrings; i++)
-	{
-		/* Inside a hole. Distance = pt -> ring */
-		if ( ptarray_contains_point(ctx, poly->rings[i], p) != RT_OUTSIDE )
-		{
-			RTDEBUG(3, " inside an hole");
-			return rt_dist2d_pt_ptarray(ctx, p, poly->rings[i], dl);
-		}
-	}
-
-	RTDEBUG(3, " inside the polygon");
-	if (dl->mode == DIST_MIN)
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = p->x;
-		dl->p1.y = dl->p2.y = p->y;
-	}
-	return RT_TRUE; /* Is inside the polygon */
+  const RTPOINT2D *p;
+  int i;
+
+  RTDEBUG(2, "rt_dist2d_point_poly called");
+
+  p = rt_getPoint2d_cp(ctx, point->point, 0);
+
+  if (dl->mode == DIST_MAX)
+  {
+    RTDEBUG(3, "looking for maxdistance");
+    return rt_dist2d_pt_ptarray(ctx, p, poly->rings[0], dl);
+  }
+  /* Return distance to outer ring if not inside it */
+  if ( ptarray_contains_point(ctx, poly->rings[0], p) == RT_OUTSIDE )
+  {
+    RTDEBUG(3, "first point not inside outer-ring");
+    return rt_dist2d_pt_ptarray(ctx, p, poly->rings[0], dl);
+  }
+
+  /*
+   * Inside the outer ring.
+   * Scan though each of the inner rings looking to
+   * see if its inside.  If not, distance==0.
+   * Otherwise, distance = pt to ring distance
+   */
+  for ( i = 1;  i < poly->nrings; i++)
+  {
+    /* Inside a hole. Distance = pt -> ring */
+    if ( ptarray_contains_point(ctx, poly->rings[i], p) != RT_OUTSIDE )
+    {
+      RTDEBUG(3, " inside an hole");
+      return rt_dist2d_pt_ptarray(ctx, p, poly->rings[i], dl);
+    }
+  }
+
+  RTDEBUG(3, " inside the polygon");
+  if (dl->mode == DIST_MIN)
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = p->x;
+    dl->p1.y = dl->p2.y = p->y;
+  }
+  return RT_TRUE; /* Is inside the polygon */
 }
 
 int
 rt_dist2d_point_curvepoly(const RTCTX *ctx, RTPOINT *point, RTCURVEPOLY *poly, DISTPTS *dl)
 {
-	const RTPOINT2D *p;
-	int i;
-
-	p = rt_getPoint2d_cp(ctx, point->point, 0);
-
-	if (dl->mode == DIST_MAX)
-		rterror(ctx, "rt_dist2d_point_curvepoly cannot calculate max distance");
-
-	/* Return distance to outer ring if not inside it */
-	if ( rtgeom_contains_point(ctx, poly->rings[0], p) == RT_OUTSIDE )	
-	{
-		return rt_dist2d_recursive(ctx, (RTGEOM*)point, poly->rings[0], dl);
-	}
-
-	/*
-	 * Inside the outer ring.
-	 * Scan though each of the inner rings looking to
-	 * see if its inside.  If not, distance==0.
-	 * Otherwise, distance = pt to ring distance
-	 */
-	for ( i = 1;  i < poly->nrings; i++)
-	{
-		/* Inside a hole. Distance = pt -> ring */
-		if ( rtgeom_contains_point(ctx, poly->rings[i], p) != RT_OUTSIDE )
-		{
-			RTDEBUG(3, " inside a hole");
-			return rt_dist2d_recursive(ctx, (RTGEOM*)point, poly->rings[i], dl);
-		}
-	}
-
-	RTDEBUG(3, " inside the polygon");
-	if (dl->mode == DIST_MIN)
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = p->x;
-		dl->p1.y = dl->p2.y = p->y;
-	}
-
-	return RT_TRUE; /* Is inside the polygon */
+  const RTPOINT2D *p;
+  int i;
+
+  p = rt_getPoint2d_cp(ctx, point->point, 0);
+
+  if (dl->mode == DIST_MAX)
+    rterror(ctx, "rt_dist2d_point_curvepoly cannot calculate max distance");
+
+  /* Return distance to outer ring if not inside it */
+  if ( rtgeom_contains_point(ctx, poly->rings[0], p) == RT_OUTSIDE )
+  {
+    return rt_dist2d_recursive(ctx, (RTGEOM*)point, poly->rings[0], dl);
+  }
+
+  /*
+   * Inside the outer ring.
+   * Scan though each of the inner rings looking to
+   * see if its inside.  If not, distance==0.
+   * Otherwise, distance = pt to ring distance
+   */
+  for ( i = 1;  i < poly->nrings; i++)
+  {
+    /* Inside a hole. Distance = pt -> ring */
+    if ( rtgeom_contains_point(ctx, poly->rings[i], p) != RT_OUTSIDE )
+    {
+      RTDEBUG(3, " inside a hole");
+      return rt_dist2d_recursive(ctx, (RTGEOM*)point, poly->rings[i], dl);
+    }
+  }
+
+  RTDEBUG(3, " inside the polygon");
+  if (dl->mode == DIST_MIN)
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = p->x;
+    dl->p1.y = dl->p2.y = p->y;
+  }
+
+  return RT_TRUE; /* Is inside the polygon */
 }
 
 /**
@@ -707,16 +707,16 @@ line to line calculation
 int
 rt_dist2d_line_line(const RTCTX *ctx, RTLINE *line1, RTLINE *line2, DISTPTS *dl)
 {
-	RTPOINTARRAY *pa1 = line1->points;
-	RTPOINTARRAY *pa2 = line2->points;
-	RTDEBUG(2, "rt_dist2d_line_line is called");
-	return rt_dist2d_ptarray_ptarray(ctx, pa1, pa2, dl);
+  RTPOINTARRAY *pa1 = line1->points;
+  RTPOINTARRAY *pa2 = line2->points;
+  RTDEBUG(2, "rt_dist2d_line_line is called");
+  return rt_dist2d_ptarray_ptarray(ctx, pa1, pa2, dl);
 }
 
 int
 rt_dist2d_line_circstring(const RTCTX *ctx, RTLINE *line1, RTCIRCSTRING *line2, DISTPTS *dl)
 {
-	return rt_dist2d_ptarray_ptarrayarc(ctx, line1->points, line2->points, dl);
+  return rt_dist2d_ptarray_ptarrayarc(ctx, line1->points, line2->points, dl);
 }
 
 /**
@@ -733,311 +733,311 @@ rt_dist2d_line_circstring(const RTCTX *ctx, RTLINE *line1, RTCIRCSTRING *line2,
 int
 rt_dist2d_line_poly(const RTCTX *ctx, RTLINE *line, RTPOLY *poly, DISTPTS *dl)
 {
-	const RTPOINT2D *pt;
-	int i;
-
-	RTDEBUGF(2, "rt_dist2d_line_poly called (%d rings)", poly->nrings);
-
-	pt = rt_getPoint2d_cp(ctx, line->points, 0);
-	if ( ptarray_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
-	{
-		return rt_dist2d_ptarray_ptarray(ctx, line->points, poly->rings[0], dl);
-	}
-
-	for (i=1; i<poly->nrings; i++)
-	{
-		if (!rt_dist2d_ptarray_ptarray(ctx, line->points, poly->rings[i], dl)) return RT_FALSE;
-
-		RTDEBUGF(3, " distance from ring %d: %f, mindist: %f",
-		         i, dl->distance, dl->tolerance);
-		/* just a check if  the answer is already given */
-		if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; 
-	}
-
-	/*
-	 * No intersection, have to check if a point is
-	 * inside polygon
-	 */
-	pt = rt_getPoint2d_cp(ctx, line->points, 0);
-
-	/*
-	 * Outside outer ring, so min distance to a ring
-	 * is the actual min distance
-
-	if ( ! pt_in_ring_2d(ctx, &pt, poly->rings[0]) )
-	{
-		return ;
-	} */
-
-	/*
-	 * Its in the outer ring.
-	 * Have to check if its inside a hole
-	 */
-	for (i=1; i<poly->nrings; i++)
-	{
-		if ( ptarray_contains_point(ctx, poly->rings[i], pt) != RT_OUTSIDE )
-		{
-			/*
-			 * Its inside a hole, then the actual
-			 * distance is the min ring distance
-			 */
-			return RT_TRUE;
-		}
-	}
-	if (dl->mode == DIST_MIN)
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-	}
-	return RT_TRUE; /* Not in hole, so inside polygon */
+  const RTPOINT2D *pt;
+  int i;
+
+  RTDEBUGF(2, "rt_dist2d_line_poly called (%d rings)", poly->nrings);
+
+  pt = rt_getPoint2d_cp(ctx, line->points, 0);
+  if ( ptarray_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
+  {
+    return rt_dist2d_ptarray_ptarray(ctx, line->points, poly->rings[0], dl);
+  }
+
+  for (i=1; i<poly->nrings; i++)
+  {
+    if (!rt_dist2d_ptarray_ptarray(ctx, line->points, poly->rings[i], dl)) return RT_FALSE;
+
+    RTDEBUGF(3, " distance from ring %d: %f, mindist: %f",
+             i, dl->distance, dl->tolerance);
+    /* just a check if  the answer is already given */
+    if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE;
+  }
+
+  /*
+   * No intersection, have to check if a point is
+   * inside polygon
+   */
+  pt = rt_getPoint2d_cp(ctx, line->points, 0);
+
+  /*
+   * Outside outer ring, so min distance to a ring
+   * is the actual min distance
+
+  if ( ! pt_in_ring_2d(ctx, &pt, poly->rings[0]) )
+  {
+    return ;
+  } */
+
+  /*
+   * Its in the outer ring.
+   * Have to check if its inside a hole
+   */
+  for (i=1; i<poly->nrings; i++)
+  {
+    if ( ptarray_contains_point(ctx, poly->rings[i], pt) != RT_OUTSIDE )
+    {
+      /*
+       * Its inside a hole, then the actual
+       * distance is the min ring distance
+       */
+      return RT_TRUE;
+    }
+  }
+  if (dl->mode == DIST_MIN)
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+  }
+  return RT_TRUE; /* Not in hole, so inside polygon */
 }
 
 int
 rt_dist2d_line_curvepoly(const RTCTX *ctx, RTLINE *line, RTCURVEPOLY *poly, DISTPTS *dl)
 {
-	const RTPOINT2D *pt = rt_getPoint2d_cp(ctx, line->points, 0);
-	int i;
-
-	if ( rtgeom_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
-	{
-		return rt_dist2d_recursive(ctx, (RTGEOM*)line, poly->rings[0], dl);
-	}
-
-	for ( i = 1; i < poly->nrings; i++ )
-	{
-		if ( ! rt_dist2d_recursive(ctx, (RTGEOM*)line, poly->rings[i], dl) )
-			return RT_FALSE;
-
-		if ( dl->distance<=dl->tolerance && dl->mode == DIST_MIN ) 
-			return RT_TRUE; 
-	}
-
-	for ( i=1; i < poly->nrings; i++ )
-	{
-		if ( rtgeom_contains_point(ctx, poly->rings[i],pt) != RT_OUTSIDE )
-		{
-			/* Its inside a hole, then the actual */
-			return RT_TRUE;
-		}	
-	}
-
-	if (dl->mode == DIST_MIN)
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-	}
-
-	return RT_TRUE; /* Not in hole, so inside polygon */
+  const RTPOINT2D *pt = rt_getPoint2d_cp(ctx, line->points, 0);
+  int i;
+
+  if ( rtgeom_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
+  {
+    return rt_dist2d_recursive(ctx, (RTGEOM*)line, poly->rings[0], dl);
+  }
+
+  for ( i = 1; i < poly->nrings; i++ )
+  {
+    if ( ! rt_dist2d_recursive(ctx, (RTGEOM*)line, poly->rings[i], dl) )
+      return RT_FALSE;
+
+    if ( dl->distance<=dl->tolerance && dl->mode == DIST_MIN )
+      return RT_TRUE;
+  }
+
+  for ( i=1; i < poly->nrings; i++ )
+  {
+    if ( rtgeom_contains_point(ctx, poly->rings[i],pt) != RT_OUTSIDE )
+    {
+      /* Its inside a hole, then the actual */
+      return RT_TRUE;
+    }
+  }
+
+  if (dl->mode == DIST_MIN)
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+  }
+
+  return RT_TRUE; /* Not in hole, so inside polygon */
 }
 
 /**
 Function handling polygon to polygon calculation
-1	if we are looking for maxdistance, just check the outer rings.
-2	check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
-3	check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1
-4	check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2
-5	If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.
+1  if we are looking for maxdistance, just check the outer rings.
+2  check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
+3  check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1
+4  check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2
+5  If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.
  */
 int
 rt_dist2d_poly_poly(const RTCTX *ctx, RTPOLY *poly1, RTPOLY *poly2, DISTPTS *dl)
 {
 
-	const RTPOINT2D *pt;
-	int i;
-
-	RTDEBUG(2, "rt_dist2d_poly_poly called");
-
-	/*1	if we are looking for maxdistance, just check the outer rings.*/
-	if (dl->mode == DIST_MAX)
-	{
-		return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
-	}
-
-
-	/* 2	check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
-	here it would be possible to handle the information about wich one is inside wich one and only search for the smaller ones in the bigger ones holes.*/
-	pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
-	if ( ptarray_contains_point(ctx, poly2->rings[0], pt) == RT_OUTSIDE )
-	{
-		pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
-		if ( ptarray_contains_point(ctx, poly1->rings[0], pt) == RT_OUTSIDE )
-		{
-			return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
-		}
-	}
-
-	/*3	check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1*/
-	pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
-	for (i=1; i<poly1->nrings; i++)
-	{
-		/* Inside a hole */
-		if ( ptarray_contains_point(ctx, poly1->rings[i], pt) != RT_OUTSIDE )
-		{
-			return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[i], poly2->rings[0], dl);
-		}
-	}
-
-	/*4	check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2*/
-	pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
-	for (i=1; i<poly2->nrings; i++)
-	{
-		/* Inside a hole */
-		if ( ptarray_contains_point(ctx, poly2->rings[i], pt) != RT_OUTSIDE )
-		{
-			return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[i], dl);
-		}
-	}
-
-
-	/*5	If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.*/
-	pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
-	if ( ptarray_contains_point(ctx, poly2->rings[0], pt) != RT_OUTSIDE )
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-		return RT_TRUE;
-	}
-
-	pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
-	if ( ptarray_contains_point(ctx, poly1->rings[0], pt) != RT_OUTSIDE )
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-		return RT_TRUE;
-	}
-
-
-	rterror(ctx, "Unspecified error in function rt_dist2d_poly_poly");
-	return RT_FALSE;
+  const RTPOINT2D *pt;
+  int i;
+
+  RTDEBUG(2, "rt_dist2d_poly_poly called");
+
+  /*1  if we are looking for maxdistance, just check the outer rings.*/
+  if (dl->mode == DIST_MAX)
+  {
+    return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
+  }
+
+
+  /* 2  check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
+  here it would be possible to handle the information about wich one is inside wich one and only search for the smaller ones in the bigger ones holes.*/
+  pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
+  if ( ptarray_contains_point(ctx, poly2->rings[0], pt) == RT_OUTSIDE )
+  {
+    pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
+    if ( ptarray_contains_point(ctx, poly1->rings[0], pt) == RT_OUTSIDE )
+    {
+      return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
+    }
+  }
+
+  /*3  check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1*/
+  pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
+  for (i=1; i<poly1->nrings; i++)
+  {
+    /* Inside a hole */
+    if ( ptarray_contains_point(ctx, poly1->rings[i], pt) != RT_OUTSIDE )
+    {
+      return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[i], poly2->rings[0], dl);
+    }
+  }
+
+  /*4  check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2*/
+  pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
+  for (i=1; i<poly2->nrings; i++)
+  {
+    /* Inside a hole */
+    if ( ptarray_contains_point(ctx, poly2->rings[i], pt) != RT_OUTSIDE )
+    {
+      return rt_dist2d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[i], dl);
+    }
+  }
+
+
+  /*5  If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.*/
+  pt = rt_getPoint2d_cp(ctx, poly1->rings[0], 0);
+  if ( ptarray_contains_point(ctx, poly2->rings[0], pt) != RT_OUTSIDE )
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+    return RT_TRUE;
+  }
+
+  pt = rt_getPoint2d_cp(ctx, poly2->rings[0], 0);
+  if ( ptarray_contains_point(ctx, poly1->rings[0], pt) != RT_OUTSIDE )
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+    return RT_TRUE;
+  }
+
+
+  rterror(ctx, "Unspecified error in function rt_dist2d_poly_poly");
+  return RT_FALSE;
 }
 
 int
 rt_dist2d_poly_curvepoly(const RTCTX *ctx, RTPOLY *poly1, RTCURVEPOLY *curvepoly2, DISTPTS *dl)
 {
-	RTCURVEPOLY *curvepoly1 = rtcurvepoly_construct_from_rtpoly(ctx, poly1);
-	int rv = rt_dist2d_curvepoly_curvepoly(ctx, curvepoly1, curvepoly2, dl);
-	rtgeom_free(ctx, (RTGEOM*)curvepoly1);
-	return rv;
+  RTCURVEPOLY *curvepoly1 = rtcurvepoly_construct_from_rtpoly(ctx, poly1);
+  int rv = rt_dist2d_curvepoly_curvepoly(ctx, curvepoly1, curvepoly2, dl);
+  rtgeom_free(ctx, (RTGEOM*)curvepoly1);
+  return rv;
 }
 
 int
 rt_dist2d_circstring_poly(const RTCTX *ctx, RTCIRCSTRING *circ, RTPOLY *poly, DISTPTS *dl)
 {
-	RTCURVEPOLY *curvepoly = rtcurvepoly_construct_from_rtpoly(ctx, poly);
-	int rv = rt_dist2d_line_curvepoly(ctx, (RTLINE*)circ, curvepoly, dl);
-	rtgeom_free(ctx, (RTGEOM*)curvepoly);
-	return rv;
+  RTCURVEPOLY *curvepoly = rtcurvepoly_construct_from_rtpoly(ctx, poly);
+  int rv = rt_dist2d_line_curvepoly(ctx, (RTLINE*)circ, curvepoly, dl);
+  rtgeom_free(ctx, (RTGEOM*)curvepoly);
+  return rv;
 }
 
 
 int
 rt_dist2d_circstring_curvepoly(const RTCTX *ctx, RTCIRCSTRING *circ, RTCURVEPOLY *poly, DISTPTS *dl)
 {
-	return rt_dist2d_line_curvepoly(ctx, (RTLINE*)circ, poly, dl);
+  return rt_dist2d_line_curvepoly(ctx, (RTLINE*)circ, poly, dl);
 }
 
 int
 rt_dist2d_circstring_circstring(const RTCTX *ctx, RTCIRCSTRING *line1, RTCIRCSTRING *line2, DISTPTS *dl)
 {
-	return rt_dist2d_ptarrayarc_ptarrayarc(ctx, line1->points, line2->points, dl);
+  return rt_dist2d_ptarrayarc_ptarrayarc(ctx, line1->points, line2->points, dl);
 }
 
 static const RTPOINT2D *
 rt_curvering_getfirstpoint2d_cp(const RTCTX *ctx, RTGEOM *geom)
 {
-	switch( geom->type )
-	{
-		case RTLINETYPE:
-			return rt_getPoint2d_cp(ctx, ((RTLINE*)geom)->points, 0);
-		case RTCIRCSTRINGTYPE:
-			return rt_getPoint2d_cp(ctx, ((RTCIRCSTRING*)geom)->points, 0);
-		case RTCOMPOUNDTYPE:
-		{
-			RTCOMPOUND *comp = (RTCOMPOUND*)geom;
-			RTLINE *line = (RTLINE*)(comp->geoms[0]);
-			return rt_getPoint2d_cp(ctx, line->points, 0);			
-		}
-		default:
-			rterror(ctx, "rt_curvering_getfirstpoint2d_cp: unknown type");
-	}
-	return NULL;
+  switch( geom->type )
+  {
+    case RTLINETYPE:
+      return rt_getPoint2d_cp(ctx, ((RTLINE*)geom)->points, 0);
+    case RTCIRCSTRINGTYPE:
+      return rt_getPoint2d_cp(ctx, ((RTCIRCSTRING*)geom)->points, 0);
+    case RTCOMPOUNDTYPE:
+    {
+      RTCOMPOUND *comp = (RTCOMPOUND*)geom;
+      RTLINE *line = (RTLINE*)(comp->geoms[0]);
+      return rt_getPoint2d_cp(ctx, line->points, 0);
+    }
+    default:
+      rterror(ctx, "rt_curvering_getfirstpoint2d_cp: unknown type");
+  }
+  return NULL;
 }
 
 int
 rt_dist2d_curvepoly_curvepoly(const RTCTX *ctx, RTCURVEPOLY *poly1, RTCURVEPOLY *poly2, DISTPTS *dl)
 {
-	const RTPOINT2D *pt;
-	int i;
-
-	RTDEBUG(2, "rt_dist2d_curvepoly_curvepoly called");
-
-	/*1	if we are looking for maxdistance, just check the outer rings.*/
-	if (dl->mode == DIST_MAX)
-	{
-		return rt_dist2d_recursive(ctx, poly1->rings[0],	poly2->rings[0], dl);
-	}
-
-
-	/* 2	check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
-	here it would be possible to handle the information about wich one is inside wich one and only search for the smaller ones in the bigger ones holes.*/
-	pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
-	if ( rtgeom_contains_point(ctx, poly2->rings[0], pt) == RT_OUTSIDE )
-	{
-		pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
-		if ( rtgeom_contains_point(ctx, poly1->rings[0], pt) == RT_OUTSIDE )
-		{
-			return rt_dist2d_recursive(ctx, poly1->rings[0], poly2->rings[0], dl);
-		}
-	}
-
-	/*3	check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1*/
-	pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
-	for (i = 1; i < poly1->nrings; i++)
-	{
-		/* Inside a hole */
-		if ( rtgeom_contains_point(ctx, poly1->rings[i], pt) != RT_OUTSIDE )
-		{
-			return rt_dist2d_recursive(ctx, poly1->rings[i], poly2->rings[0], dl);
-		}
-	}
-
-	/*4	check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2*/
-	pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
-	for (i = 1; i < poly2->nrings; i++)
-	{
-		/* Inside a hole */
-		if ( rtgeom_contains_point(ctx, poly2->rings[i], pt) != RT_OUTSIDE )
-		{
-			return rt_dist2d_recursive(ctx, poly1->rings[0],	poly2->rings[i], dl);
-		}
-	}
-
-
-	/*5	If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.*/
-	pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
-	if ( rtgeom_contains_point(ctx, poly2->rings[0], pt) != RT_OUTSIDE )
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-		return RT_TRUE;
-	}
-
-	pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
-	if ( rtgeom_contains_point(ctx, poly1->rings[0], pt) != RT_OUTSIDE )
-	{
-		dl->distance = 0.0;
-		dl->p1.x = dl->p2.x = pt->x;
-		dl->p1.y = dl->p2.y = pt->y;
-		return RT_TRUE;
-	}
-
-	rterror(ctx, "Unspecified error in function rt_dist2d_curvepoly_curvepoly");
-	return RT_FALSE;
+  const RTPOINT2D *pt;
+  int i;
+
+  RTDEBUG(2, "rt_dist2d_curvepoly_curvepoly called");
+
+  /*1  if we are looking for maxdistance, just check the outer rings.*/
+  if (dl->mode == DIST_MAX)
+  {
+    return rt_dist2d_recursive(ctx, poly1->rings[0],  poly2->rings[0], dl);
+  }
+
+
+  /* 2  check if poly1 has first point outside poly2 and vice versa, if so, just check outer rings
+  here it would be possible to handle the information about wich one is inside wich one and only search for the smaller ones in the bigger ones holes.*/
+  pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
+  if ( rtgeom_contains_point(ctx, poly2->rings[0], pt) == RT_OUTSIDE )
+  {
+    pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
+    if ( rtgeom_contains_point(ctx, poly1->rings[0], pt) == RT_OUTSIDE )
+    {
+      return rt_dist2d_recursive(ctx, poly1->rings[0], poly2->rings[0], dl);
+    }
+  }
+
+  /*3  check if first point of poly2 is in a hole of poly1. If so check outer ring of poly2 against that hole of poly1*/
+  pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
+  for (i = 1; i < poly1->nrings; i++)
+  {
+    /* Inside a hole */
+    if ( rtgeom_contains_point(ctx, poly1->rings[i], pt) != RT_OUTSIDE )
+    {
+      return rt_dist2d_recursive(ctx, poly1->rings[i], poly2->rings[0], dl);
+    }
+  }
+
+  /*4  check if first point of poly1 is in a hole of poly2. If so check outer ring of poly1 against that hole of poly2*/
+  pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
+  for (i = 1; i < poly2->nrings; i++)
+  {
+    /* Inside a hole */
+    if ( rtgeom_contains_point(ctx, poly2->rings[i], pt) != RT_OUTSIDE )
+    {
+      return rt_dist2d_recursive(ctx, poly1->rings[0],  poly2->rings[i], dl);
+    }
+  }
+
+
+  /*5  If we have come all the way here we know that the first point of one of them is inside the other ones outer ring and not in holes so we check wich one is inside.*/
+  pt = rt_curvering_getfirstpoint2d_cp(ctx, poly1->rings[0]);
+  if ( rtgeom_contains_point(ctx, poly2->rings[0], pt) != RT_OUTSIDE )
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+    return RT_TRUE;
+  }
+
+  pt = rt_curvering_getfirstpoint2d_cp(ctx, poly2->rings[0]);
+  if ( rtgeom_contains_point(ctx, poly1->rings[0], pt) != RT_OUTSIDE )
+  {
+    dl->distance = 0.0;
+    dl->p1.x = dl->p2.x = pt->x;
+    dl->p1.y = dl->p2.y = pt->y;
+    return RT_TRUE;
+  }
+
+  rterror(ctx, "Unspecified error in function rt_dist2d_curvepoly_curvepoly");
+  return RT_FALSE;
 }
 
 
@@ -1049,27 +1049,27 @@ rt_dist2d_curvepoly_curvepoly(const RTCTX *ctx, RTCURVEPOLY *poly1, RTCURVEPOLY
 int
 rt_dist2d_pt_ptarray(const RTCTX *ctx, const RTPOINT2D *p, RTPOINTARRAY *pa,DISTPTS *dl)
 {
-	int t;
-	const RTPOINT2D *start, *end;
-	int twist = dl->twisted;
+  int t;
+  const RTPOINT2D *start, *end;
+  int twist = dl->twisted;
 
-	RTDEBUG(2, "rt_dist2d_pt_ptarray is called");
+  RTDEBUG(2, "rt_dist2d_pt_ptarray is called");
 
-	start = rt_getPoint2d_cp(ctx, pa, 0);
+  start = rt_getPoint2d_cp(ctx, pa, 0);
 
-	if ( !rt_dist2d_pt_pt(ctx, p, start, dl) ) return RT_FALSE;
+  if ( !rt_dist2d_pt_pt(ctx, p, start, dl) ) return RT_FALSE;
 
-	for (t=1; t<pa->npoints; t++)
-	{
-		dl->twisted=twist;
-		end = rt_getPoint2d_cp(ctx, pa, t);
-		if (!rt_dist2d_pt_seg(ctx, p, start, end, dl)) return RT_FALSE;
+  for (t=1; t<pa->npoints; t++)
+  {
+    dl->twisted=twist;
+    end = rt_getPoint2d_cp(ctx, pa, t);
+    if (!rt_dist2d_pt_seg(ctx, p, start, end, dl)) return RT_FALSE;
 
-		if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
-		start = end;
-	}
+    if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+    start = end;
+  }
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 /**
@@ -1079,47 +1079,47 @@ rt_dist2d_pt_ptarray(const RTCTX *ctx, const RTPOINT2D *p, RTPOINTARRAY *pa,DIST
 int
 rt_dist2d_pt_ptarrayarc(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINTARRAY *pa, DISTPTS *dl)
 {
-	int t;
-	const RTPOINT2D *A1;
-	const RTPOINT2D *A2;
-	const RTPOINT2D *A3;
-	int twist = dl->twisted;
-
-	RTDEBUG(2, "rt_dist2d_pt_ptarrayarc is called");
-
-	if ( pa->npoints % 2 == 0 || pa->npoints < 3 )
-	{
-		rterror(ctx, "rt_dist2d_pt_ptarrayarc called with non-arc input");
-		return RT_FALSE;
-	}
-
-	if (dl->mode == DIST_MAX)
-	{
-		rterror(ctx, "rt_dist2d_pt_ptarrayarc does not currently support DIST_MAX mode");
-		return RT_FALSE;
-	}
-
-	A1 = rt_getPoint2d_cp(ctx, pa, 0);
-
-	if ( ! rt_dist2d_pt_pt(ctx, p, A1, dl) ) 
-		return RT_FALSE;
-
-	for ( t=1; t<pa->npoints; t += 2 )
-	{
-		dl->twisted = twist;
-		A2 = rt_getPoint2d_cp(ctx, pa, t);
-		A3 = rt_getPoint2d_cp(ctx, pa, t+1);
-		
-		if ( rt_dist2d_pt_arc(ctx, p, A1, A2, A3, dl) == RT_FALSE ) 
-			return RT_FALSE;
-
-		if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
-			return RT_TRUE; /*just a check if  the answer is already given*/
-			
-		A1 = A3;
-	}
-
-	return RT_TRUE;
+  int t;
+  const RTPOINT2D *A1;
+  const RTPOINT2D *A2;
+  const RTPOINT2D *A3;
+  int twist = dl->twisted;
+
+  RTDEBUG(2, "rt_dist2d_pt_ptarrayarc is called");
+
+  if ( pa->npoints % 2 == 0 || pa->npoints < 3 )
+  {
+    rterror(ctx, "rt_dist2d_pt_ptarrayarc called with non-arc input");
+    return RT_FALSE;
+  }
+
+  if (dl->mode == DIST_MAX)
+  {
+    rterror(ctx, "rt_dist2d_pt_ptarrayarc does not currently support DIST_MAX mode");
+    return RT_FALSE;
+  }
+
+  A1 = rt_getPoint2d_cp(ctx, pa, 0);
+
+  if ( ! rt_dist2d_pt_pt(ctx, p, A1, dl) )
+    return RT_FALSE;
+
+  for ( t=1; t<pa->npoints; t += 2 )
+  {
+    dl->twisted = twist;
+    A2 = rt_getPoint2d_cp(ctx, pa, t);
+    A3 = rt_getPoint2d_cp(ctx, pa, t+1);
+
+    if ( rt_dist2d_pt_arc(ctx, p, A1, A2, A3, dl) == RT_FALSE )
+      return RT_FALSE;
+
+    if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
+      return RT_TRUE; /*just a check if  the answer is already given*/
+
+    A1 = A3;
+  }
+
+  return RT_TRUE;
 }
 
 
@@ -1131,50 +1131,50 @@ rt_dist2d_pt_ptarrayarc(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINTARRAY
 int
 rt_dist2d_ptarray_ptarray(const RTCTX *ctx, RTPOINTARRAY *l1, RTPOINTARRAY *l2,DISTPTS *dl)
 {
-	int t,u;
-	const RTPOINT2D	*start, *end;
-	const RTPOINT2D	*start2, *end2;
-	int twist = dl->twisted;
-
-	RTDEBUGF(2, "rt_dist2d_ptarray_ptarray called (points: %d-%d)",l1->npoints, l2->npoints);
-
-	if (dl->mode == DIST_MAX)/*If we are searching for maxdistance we go straight to point-point calculation since the maxdistance have to be between two vertexes*/
-	{
-		for (t=0; t<l1->npoints; t++) /*for each segment in L1 */
-		{
-			start = rt_getPoint2d_cp(ctx, l1, t);
-			for (u=0; u<l2->npoints; u++) /*for each segment in L2 */
-			{
-				start2 = rt_getPoint2d_cp(ctx, l2, u);
-				rt_dist2d_pt_pt(ctx, start, start2, dl);
-				RTDEBUGF(4, "maxdist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
-				RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
-				         t, u, dl->distance, dl->tolerance);
-			}
-		}
-	}
-	else
-	{
-		start = rt_getPoint2d_cp(ctx, l1, 0);
-		for (t=1; t<l1->npoints; t++) /*for each segment in L1 */
-		{
-			end = rt_getPoint2d_cp(ctx, l1, t);
-			start2 = rt_getPoint2d_cp(ctx, l2, 0);
-			for (u=1; u<l2->npoints; u++) /*for each segment in L2 */
-			{
-				end2 = rt_getPoint2d_cp(ctx, l2, u);
-				dl->twisted=twist;
-				rt_dist2d_seg_seg(ctx, start, end, start2, end2, dl);
-				RTDEBUGF(4, "mindist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
-				RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
-				         t, u, dl->distance, dl->tolerance);
-				if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
-				start2 = end2;
-			}
-			start = end;
-		}
-	}
-	return RT_TRUE;
+  int t,u;
+  const RTPOINT2D  *start, *end;
+  const RTPOINT2D  *start2, *end2;
+  int twist = dl->twisted;
+
+  RTDEBUGF(2, "rt_dist2d_ptarray_ptarray called (points: %d-%d)",l1->npoints, l2->npoints);
+
+  if (dl->mode == DIST_MAX)/*If we are searching for maxdistance we go straight to point-point calculation since the maxdistance have to be between two vertexes*/
+  {
+    for (t=0; t<l1->npoints; t++) /*for each segment in L1 */
+    {
+      start = rt_getPoint2d_cp(ctx, l1, t);
+      for (u=0; u<l2->npoints; u++) /*for each segment in L2 */
+      {
+        start2 = rt_getPoint2d_cp(ctx, l2, u);
+        rt_dist2d_pt_pt(ctx, start, start2, dl);
+        RTDEBUGF(4, "maxdist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
+        RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
+                 t, u, dl->distance, dl->tolerance);
+      }
+    }
+  }
+  else
+  {
+    start = rt_getPoint2d_cp(ctx, l1, 0);
+    for (t=1; t<l1->npoints; t++) /*for each segment in L1 */
+    {
+      end = rt_getPoint2d_cp(ctx, l1, t);
+      start2 = rt_getPoint2d_cp(ctx, l2, 0);
+      for (u=1; u<l2->npoints; u++) /*for each segment in L2 */
+      {
+        end2 = rt_getPoint2d_cp(ctx, l2, u);
+        dl->twisted=twist;
+        rt_dist2d_seg_seg(ctx, start, end, start2, end2, dl);
+        RTDEBUGF(4, "mindist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
+        RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
+                 t, u, dl->distance, dl->tolerance);
+        if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+        start2 = end2;
+      }
+      start = end;
+    }
+  }
+  return RT_TRUE;
 }
 
 /**
@@ -1183,52 +1183,52 @@ rt_dist2d_ptarray_ptarray(const RTCTX *ctx, RTPOINTARRAY *l1, RTPOINTARRAY *l2,D
 int
 rt_dist2d_ptarray_ptarrayarc(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINTARRAY *pb, DISTPTS *dl)
 {
-	int t, u;
-	const RTPOINT2D *A1;
-	const RTPOINT2D *A2;
-	const RTPOINT2D *B1;
-	const RTPOINT2D *B2;
-	const RTPOINT2D *B3;
-	int twist = dl->twisted;
-
-	RTDEBUGF(2, "rt_dist2d_ptarray_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
-
-	if ( pb->npoints % 2 == 0 || pb->npoints < 3 )
-	{
-		rterror(ctx, "rt_dist2d_ptarray_ptarrayarc called with non-arc input");
-		return RT_FALSE;
-	}
-
-	if ( dl->mode == DIST_MAX )
-	{
-		rterror(ctx, "rt_dist2d_ptarray_ptarrayarc does not currently support DIST_MAX mode");
-		return RT_FALSE;
-	}
-	else
-	{
-		A1 = rt_getPoint2d_cp(ctx, pa, 0);
-		for ( t=1; t < pa->npoints; t++ ) /* For each segment in pa */
-		{
-			A2 = rt_getPoint2d_cp(ctx, pa, t);
-			B1 = rt_getPoint2d_cp(ctx, pb, 0);
-			for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
-			{
-				B2 = rt_getPoint2d_cp(ctx, pb, u);
-				B3 = rt_getPoint2d_cp(ctx, pb, u+1);
-				dl->twisted = twist;
-
-				rt_dist2d_seg_arc(ctx, A1, A2, B1, B2, B3, dl);
-
-				/* If we've found a distance within tolerance, we're done */
-				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
-					return RT_TRUE; 
-
-				B1 = B3;
-			}
-			A1 = A2;
-		}
-	}
-	return RT_TRUE;
+  int t, u;
+  const RTPOINT2D *A1;
+  const RTPOINT2D *A2;
+  const RTPOINT2D *B1;
+  const RTPOINT2D *B2;
+  const RTPOINT2D *B3;
+  int twist = dl->twisted;
+
+  RTDEBUGF(2, "rt_dist2d_ptarray_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
+
+  if ( pb->npoints % 2 == 0 || pb->npoints < 3 )
+  {
+    rterror(ctx, "rt_dist2d_ptarray_ptarrayarc called with non-arc input");
+    return RT_FALSE;
+  }
+
+  if ( dl->mode == DIST_MAX )
+  {
+    rterror(ctx, "rt_dist2d_ptarray_ptarrayarc does not currently support DIST_MAX mode");
+    return RT_FALSE;
+  }
+  else
+  {
+    A1 = rt_getPoint2d_cp(ctx, pa, 0);
+    for ( t=1; t < pa->npoints; t++ ) /* For each segment in pa */
+    {
+      A2 = rt_getPoint2d_cp(ctx, pa, t);
+      B1 = rt_getPoint2d_cp(ctx, pb, 0);
+      for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
+      {
+        B2 = rt_getPoint2d_cp(ctx, pb, u);
+        B3 = rt_getPoint2d_cp(ctx, pb, u+1);
+        dl->twisted = twist;
+
+        rt_dist2d_seg_arc(ctx, A1, A2, B1, B2, B3, dl);
+
+        /* If we've found a distance within tolerance, we're done */
+        if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
+          return RT_TRUE;
+
+        B1 = B3;
+      }
+      A1 = A2;
+    }
+  }
+  return RT_TRUE;
 }
 
 /**
@@ -1237,423 +1237,423 @@ rt_dist2d_ptarray_ptarrayarc(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTP
 int
 rt_dist2d_ptarrayarc_ptarrayarc(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINTARRAY *pb, DISTPTS *dl)
 {
-	int t, u;
-	const RTPOINT2D *A1;
-	const RTPOINT2D *A2;
-	const RTPOINT2D *A3;
-	const RTPOINT2D *B1;
-	const RTPOINT2D *B2;
-	const RTPOINT2D *B3;
-	int twist = dl->twisted;
-
-	RTDEBUGF(2, "rt_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
-
-	if (dl->mode == DIST_MAX)
-	{
-		rterror(ctx, "rt_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
-		return RT_FALSE;
-	}
-	else
-	{
-		A1 = rt_getPoint2d_cp(ctx, pa, 0);
-		for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
-		{
-			A2 = rt_getPoint2d_cp(ctx, pa, t);
-			A3 = rt_getPoint2d_cp(ctx, pa, t+1);
-			B1 = rt_getPoint2d_cp(ctx, pb, 0);
-			for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
-			{
-				B2 = rt_getPoint2d_cp(ctx, pb, u);
-				B3 = rt_getPoint2d_cp(ctx, pb, u+1);
-				dl->twisted = twist;
-
-				rt_dist2d_arc_arc(ctx, A1, A2, A3, B1, B2, B3, dl);
-
-				/* If we've found a distance within tolerance, we're done */
-				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
-					return RT_TRUE; 
-
-				B1 = B3;
-			}
-			A1 = A3;
-		}
-	}
-	return RT_TRUE;
+  int t, u;
+  const RTPOINT2D *A1;
+  const RTPOINT2D *A2;
+  const RTPOINT2D *A3;
+  const RTPOINT2D *B1;
+  const RTPOINT2D *B2;
+  const RTPOINT2D *B3;
+  int twist = dl->twisted;
+
+  RTDEBUGF(2, "rt_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
+
+  if (dl->mode == DIST_MAX)
+  {
+    rterror(ctx, "rt_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
+    return RT_FALSE;
+  }
+  else
+  {
+    A1 = rt_getPoint2d_cp(ctx, pa, 0);
+    for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
+    {
+      A2 = rt_getPoint2d_cp(ctx, pa, t);
+      A3 = rt_getPoint2d_cp(ctx, pa, t+1);
+      B1 = rt_getPoint2d_cp(ctx, pb, 0);
+      for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
+      {
+        B2 = rt_getPoint2d_cp(ctx, pb, u);
+        B3 = rt_getPoint2d_cp(ctx, pb, u+1);
+        dl->twisted = twist;
+
+        rt_dist2d_arc_arc(ctx, A1, A2, A3, B1, B2, B3, dl);
+
+        /* If we've found a distance within tolerance, we're done */
+        if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
+          return RT_TRUE;
+
+        B1 = B3;
+      }
+      A1 = A3;
+    }
+  }
+  return RT_TRUE;
 }
 
 /**
 * Calculate the shortest distance between an arc and an edge.
-* Line/circle approach from http://stackoverflow.com/questions/1073336/circle-line-collision-detection 
+* Line/circle approach from http://stackoverflow.com/questions/1073336/circle-line-collision-detection
 */
-int 
+int
 rt_dist2d_seg_arc(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *B1, const RTPOINT2D *B2, const RTPOINT2D *B3, DISTPTS *dl)
 {
-	RTPOINT2D C; /* center of arc circle */
-	double radius_C; /* radius of arc circle */
-	RTPOINT2D D; /* point on A closest to C */
-	double dist_C_D; /* distance from C to D */
-	int pt_in_arc, pt_in_seg;
-	DISTPTS dltmp;
-	
-	/* Bail out on crazy modes */
-	if ( dl->mode < 0 )
-		rterror(ctx, "rt_dist2d_seg_arc does not support maxdistance mode");
-
-	/* What if the "arc" is a point? */
-	if ( rt_arc_is_pt(ctx, B1, B2, B3) )
-		return rt_dist2d_pt_seg(ctx, B1, A1, A2, dl);
-
-	/* Calculate center and radius of the circle. */
-	radius_C = rt_arc_center(ctx, B1, B2, B3, &C);
-
-	/* This "arc" is actually a line (B2 is colinear with B1,B3) */
-	if ( radius_C < 0.0 )
-		return rt_dist2d_seg_seg(ctx, A1, A2, B1, B3, dl);
-
-	/* Calculate distance between the line and circle center */
-	rt_dist2d_distpts_init(ctx, &dltmp, DIST_MIN);
-	if ( rt_dist2d_pt_seg(ctx, &C, A1, A2, &dltmp) == RT_FALSE )
-		rterror(ctx, "rt_dist2d_pt_seg failed in rt_dist2d_seg_arc");
-
-	D = dltmp.p1;
-	dist_C_D = dltmp.distance;
-	
-	/* Line intersects circle, maybe arc intersects edge? */
-	/* If so, that's the closest point. */
-	/* If not, the closest point is one of the end points of A */
-	if ( dist_C_D < radius_C )
-	{
-		double length_A; /* length of the segment A */
-		RTPOINT2D E, F; /* points of interection of edge A and circle(B) */
-		double dist_D_EF; /* distance from D to E or F (same distance both ways) */
-
-		dist_D_EF = sqrt(radius_C*radius_C - dist_C_D*dist_C_D);
-		length_A = sqrt((A2->x-A1->x)*(A2->x-A1->x)+(A2->y-A1->y)*(A2->y-A1->y));
-
-		/* Point of intersection E */
-		E.x = D.x - (A2->x-A1->x) * dist_D_EF / length_A;
-		E.y = D.y - (A2->y-A1->y) * dist_D_EF / length_A;
-		/* Point of intersection F */
-		F.x = D.x + (A2->x-A1->x) * dist_D_EF / length_A;
-		F.y = D.y + (A2->y-A1->y) * dist_D_EF / length_A;
-
-
-		/* If E is within A and within B then it's an interesction point */
-		pt_in_arc = rt_pt_in_arc(ctx, &E, B1, B2, B3);
-		pt_in_seg = rt_pt_in_seg(ctx, &E, A1, A2);
-		
-		if ( pt_in_arc && pt_in_seg )
-		{
-			dl->distance = 0.0;
-			dl->p1 = E;
-			dl->p2 = E;
-			return RT_TRUE;
-		}
-		
-		/* If F is within A and within B then it's an interesction point */
-		pt_in_arc = rt_pt_in_arc(ctx, &F, B1, B2, B3);
-		pt_in_seg = rt_pt_in_seg(ctx, &F, A1, A2);
-		
-		if ( pt_in_arc && pt_in_seg )
-		{
-			dl->distance = 0.0;
-			dl->p1 = F;
-			dl->p2 = F;
-			return RT_TRUE;
-		}
-	}
-	
-	/* Line grazes circle, maybe arc intersects edge? */
-	/* If so, grazing point is the closest point. */
-	/* If not, the closest point is one of the end points of A */
-	else if ( dist_C_D == radius_C )
-	{		
-		/* Closest point D is also the point of grazing */
-		pt_in_arc = rt_pt_in_arc(ctx, &D, B1, B2, B3);
-		pt_in_seg = rt_pt_in_seg(ctx, &D, A1, A2);
-
-		/* Is D contained in both A and B? */
-		if ( pt_in_arc && pt_in_seg )
-		{
-			dl->distance = 0.0;
-			dl->p1 = D;
-			dl->p2 = D;
-			return RT_TRUE;
-		}
-	}
-	/* Line misses circle. */
-	/* If closest point to A on circle is within B, then that's the closest */
-	/* Otherwise, the closest point will be an end point of A */
-	else
-	{
-		RTPOINT2D G; /* Point on circle closest to A */
-		G.x = C.x + (D.x-C.x) * radius_C / dist_C_D;
-		G.y = C.y + (D.y-C.y) * radius_C / dist_C_D;
-		
-		pt_in_arc = rt_pt_in_arc(ctx, &G, B1, B2, B3);
-		pt_in_seg = rt_pt_in_seg(ctx, &D, A1, A2);
-		
-		/* Closest point is on the interior of A and B */
-		if ( pt_in_arc && pt_in_seg )
-			return rt_dist2d_pt_pt(ctx, &D, &G, dl);
-
-	}
-	
-	/* Now we test the many combinations of end points with either */
-	/* arcs or edges. Each previous check determined if the closest */
-	/* potential point was within the arc/segment inscribed on the */
-	/* line/circle holding the arc/segment. */
-
-	/* Closest point is in the arc, but not in the segment, so */
-	/* one of the segment end points must be the closest. */
-	if ( pt_in_arc & ! pt_in_seg )
-	{
-		rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
-		rt_dist2d_pt_arc(ctx, A2, B1, B2, B3, dl);		
-		return RT_TRUE;
-	}
-	/* or, one of the arc end points is the closest */
-	else if  ( pt_in_seg && ! pt_in_arc )
-	{
-		rt_dist2d_pt_seg(ctx, B1, A1, A2, dl);
-		rt_dist2d_pt_seg(ctx, B3, A1, A2, dl);
-		return RT_TRUE;			
-	}
-	/* Finally, one of the end-point to end-point combos is the closest. */
-	else
-	{
-		rt_dist2d_pt_pt(ctx, A1, B1, dl);
-		rt_dist2d_pt_pt(ctx, A1, B3, dl);
-		rt_dist2d_pt_pt(ctx, A2, B1, dl);
-		rt_dist2d_pt_pt(ctx, A2, B3, dl);
-		return RT_TRUE;
-	}
-	
-	return RT_FALSE;
+  RTPOINT2D C; /* center of arc circle */
+  double radius_C; /* radius of arc circle */
+  RTPOINT2D D; /* point on A closest to C */
+  double dist_C_D; /* distance from C to D */
+  int pt_in_arc, pt_in_seg;
+  DISTPTS dltmp;
+
+  /* Bail out on crazy modes */
+  if ( dl->mode < 0 )
+    rterror(ctx, "rt_dist2d_seg_arc does not support maxdistance mode");
+
+  /* What if the "arc" is a point? */
+  if ( rt_arc_is_pt(ctx, B1, B2, B3) )
+    return rt_dist2d_pt_seg(ctx, B1, A1, A2, dl);
+
+  /* Calculate center and radius of the circle. */
+  radius_C = rt_arc_center(ctx, B1, B2, B3, &C);
+
+  /* This "arc" is actually a line (B2 is colinear with B1,B3) */
+  if ( radius_C < 0.0 )
+    return rt_dist2d_seg_seg(ctx, A1, A2, B1, B3, dl);
+
+  /* Calculate distance between the line and circle center */
+  rt_dist2d_distpts_init(ctx, &dltmp, DIST_MIN);
+  if ( rt_dist2d_pt_seg(ctx, &C, A1, A2, &dltmp) == RT_FALSE )
+    rterror(ctx, "rt_dist2d_pt_seg failed in rt_dist2d_seg_arc");
+
+  D = dltmp.p1;
+  dist_C_D = dltmp.distance;
+
+  /* Line intersects circle, maybe arc intersects edge? */
+  /* If so, that's the closest point. */
+  /* If not, the closest point is one of the end points of A */
+  if ( dist_C_D < radius_C )
+  {
+    double length_A; /* length of the segment A */
+    RTPOINT2D E, F; /* points of interection of edge A and circle(B) */
+    double dist_D_EF; /* distance from D to E or F (same distance both ways) */
+
+    dist_D_EF = sqrt(radius_C*radius_C - dist_C_D*dist_C_D);
+    length_A = sqrt((A2->x-A1->x)*(A2->x-A1->x)+(A2->y-A1->y)*(A2->y-A1->y));
+
+    /* Point of intersection E */
+    E.x = D.x - (A2->x-A1->x) * dist_D_EF / length_A;
+    E.y = D.y - (A2->y-A1->y) * dist_D_EF / length_A;
+    /* Point of intersection F */
+    F.x = D.x + (A2->x-A1->x) * dist_D_EF / length_A;
+    F.y = D.y + (A2->y-A1->y) * dist_D_EF / length_A;
+
+
+    /* If E is within A and within B then it's an interesction point */
+    pt_in_arc = rt_pt_in_arc(ctx, &E, B1, B2, B3);
+    pt_in_seg = rt_pt_in_seg(ctx, &E, A1, A2);
+
+    if ( pt_in_arc && pt_in_seg )
+    {
+      dl->distance = 0.0;
+      dl->p1 = E;
+      dl->p2 = E;
+      return RT_TRUE;
+    }
+
+    /* If F is within A and within B then it's an interesction point */
+    pt_in_arc = rt_pt_in_arc(ctx, &F, B1, B2, B3);
+    pt_in_seg = rt_pt_in_seg(ctx, &F, A1, A2);
+
+    if ( pt_in_arc && pt_in_seg )
+    {
+      dl->distance = 0.0;
+      dl->p1 = F;
+      dl->p2 = F;
+      return RT_TRUE;
+    }
+  }
+
+  /* Line grazes circle, maybe arc intersects edge? */
+  /* If so, grazing point is the closest point. */
+  /* If not, the closest point is one of the end points of A */
+  else if ( dist_C_D == radius_C )
+  {
+    /* Closest point D is also the point of grazing */
+    pt_in_arc = rt_pt_in_arc(ctx, &D, B1, B2, B3);
+    pt_in_seg = rt_pt_in_seg(ctx, &D, A1, A2);
+
+    /* Is D contained in both A and B? */
+    if ( pt_in_arc && pt_in_seg )
+    {
+      dl->distance = 0.0;
+      dl->p1 = D;
+      dl->p2 = D;
+      return RT_TRUE;
+    }
+  }
+  /* Line misses circle. */
+  /* If closest point to A on circle is within B, then that's the closest */
+  /* Otherwise, the closest point will be an end point of A */
+  else
+  {
+    RTPOINT2D G; /* Point on circle closest to A */
+    G.x = C.x + (D.x-C.x) * radius_C / dist_C_D;
+    G.y = C.y + (D.y-C.y) * radius_C / dist_C_D;
+
+    pt_in_arc = rt_pt_in_arc(ctx, &G, B1, B2, B3);
+    pt_in_seg = rt_pt_in_seg(ctx, &D, A1, A2);
+
+    /* Closest point is on the interior of A and B */
+    if ( pt_in_arc && pt_in_seg )
+      return rt_dist2d_pt_pt(ctx, &D, &G, dl);
+
+  }
+
+  /* Now we test the many combinations of end points with either */
+  /* arcs or edges. Each previous check determined if the closest */
+  /* potential point was within the arc/segment inscribed on the */
+  /* line/circle holding the arc/segment. */
+
+  /* Closest point is in the arc, but not in the segment, so */
+  /* one of the segment end points must be the closest. */
+  if ( pt_in_arc & ! pt_in_seg )
+  {
+    rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
+    rt_dist2d_pt_arc(ctx, A2, B1, B2, B3, dl);
+    return RT_TRUE;
+  }
+  /* or, one of the arc end points is the closest */
+  else if  ( pt_in_seg && ! pt_in_arc )
+  {
+    rt_dist2d_pt_seg(ctx, B1, A1, A2, dl);
+    rt_dist2d_pt_seg(ctx, B3, A1, A2, dl);
+    return RT_TRUE;
+  }
+  /* Finally, one of the end-point to end-point combos is the closest. */
+  else
+  {
+    rt_dist2d_pt_pt(ctx, A1, B1, dl);
+    rt_dist2d_pt_pt(ctx, A1, B3, dl);
+    rt_dist2d_pt_pt(ctx, A2, B1, dl);
+    rt_dist2d_pt_pt(ctx, A2, B3, dl);
+    return RT_TRUE;
+  }
+
+  return RT_FALSE;
 }
 
 int
 rt_dist2d_pt_arc(const RTCTX *ctx, const RTPOINT2D* P, const RTPOINT2D* A1, const RTPOINT2D* A2, const RTPOINT2D* A3, DISTPTS* dl)
 {
-	double radius_A, d;
-	RTPOINT2D C; /* center of circle defined by arc A */
-	RTPOINT2D X; /* point circle(A) where line from C to P crosses */
-	
-	if ( dl->mode < 0 )
-		rterror(ctx, "rt_dist2d_pt_arc does not support maxdistance mode");
-
-	/* What if the arc is a point? */
-	if ( rt_arc_is_pt(ctx, A1, A2, A3) )
-		return rt_dist2d_pt_pt(ctx, P, A1, dl);
-
-	/* Calculate centers and radii of circles. */
-	radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
-	
-	/* This "arc" is actually a line (A2 is colinear with A1,A3) */
-	if ( radius_A < 0.0 )
-		return rt_dist2d_pt_seg(ctx, P, A1, A3, dl);
-	
-	/* Distance from point to center */	
-	d = distance2d_pt_pt(ctx, &C, P);
-	
-	/* X is the point on the circle where the line from P to C crosses */
-	X.x = C.x + (P->x - C.x) * radius_A / d;
-	X.y = C.y + (P->y - C.y) * radius_A / d;
-
-	/* Is crossing point inside the arc? Or arc is actually circle? */
-	if ( p2d_same(ctx, A1, A3) || rt_pt_in_arc(ctx, &X, A1, A2, A3) )
-	{
-		rt_dist2d_pt_pt(ctx, P, &X, dl);
-	}
-	else 
-	{
-		/* Distance is the minimum of the distances to the arc end points */
-		rt_dist2d_pt_pt(ctx, A1, P, dl);
-		rt_dist2d_pt_pt(ctx, A3, P, dl);
-	}
-	return RT_TRUE;
+  double radius_A, d;
+  RTPOINT2D C; /* center of circle defined by arc A */
+  RTPOINT2D X; /* point circle(A) where line from C to P crosses */
+
+  if ( dl->mode < 0 )
+    rterror(ctx, "rt_dist2d_pt_arc does not support maxdistance mode");
+
+  /* What if the arc is a point? */
+  if ( rt_arc_is_pt(ctx, A1, A2, A3) )
+    return rt_dist2d_pt_pt(ctx, P, A1, dl);
+
+  /* Calculate centers and radii of circles. */
+  radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
+
+  /* This "arc" is actually a line (A2 is colinear with A1,A3) */
+  if ( radius_A < 0.0 )
+    return rt_dist2d_pt_seg(ctx, P, A1, A3, dl);
+
+  /* Distance from point to center */
+  d = distance2d_pt_pt(ctx, &C, P);
+
+  /* X is the point on the circle where the line from P to C crosses */
+  X.x = C.x + (P->x - C.x) * radius_A / d;
+  X.y = C.y + (P->y - C.y) * radius_A / d;
+
+  /* Is crossing point inside the arc? Or arc is actually circle? */
+  if ( p2d_same(ctx, A1, A3) || rt_pt_in_arc(ctx, &X, A1, A2, A3) )
+  {
+    rt_dist2d_pt_pt(ctx, P, &X, dl);
+  }
+  else
+  {
+    /* Distance is the minimum of the distances to the arc end points */
+    rt_dist2d_pt_pt(ctx, A1, P, dl);
+    rt_dist2d_pt_pt(ctx, A3, P, dl);
+  }
+  return RT_TRUE;
 }
 
 
 int
-rt_dist2d_arc_arc(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3, 
+rt_dist2d_arc_arc(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3,
                   const RTPOINT2D *B1, const RTPOINT2D *B2, const RTPOINT2D *B3,
                   DISTPTS *dl)
 {
-	RTPOINT2D CA, CB; /* Center points of arcs A and B */
-	double radius_A, radius_B, d; /* Radii of arcs A and B */
-	RTPOINT2D P; /* Temporary point P */
-	RTPOINT2D D; /* Mid-point between the centers CA and CB */
-	int pt_in_arc_A, pt_in_arc_B; /* Test whether potential intersection point is within the arc */
-	
-	if ( dl->mode != DIST_MIN )
-		rterror(ctx, "rt_dist2d_arc_arc only supports mindistance");
-	
-	/* TODO: Handle case where arc is closed circle (A1 = A3) */
-	
-	/* What if one or both of our "arcs" is actually a point? */
-	if ( rt_arc_is_pt(ctx, B1, B2, B3) && rt_arc_is_pt(ctx, A1, A2, A3) )
-		return rt_dist2d_pt_pt(ctx, B1, A1, dl);
-	else if ( rt_arc_is_pt(ctx, B1, B2, B3) )
-		return rt_dist2d_pt_arc(ctx, B1, A1, A2, A3, dl);
-	else if ( rt_arc_is_pt(ctx, A1, A2, A3) )
-		return rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
-	
-	/* Calculate centers and radii of circles. */
-	radius_A = rt_arc_center(ctx, A1, A2, A3, &CA);
-	radius_B = rt_arc_center(ctx, B1, B2, B3, &CB);
-
-	/* Two co-linear arcs?!? That's two segments. */
-	if ( radius_A < 0 && radius_B < 0 )
-		return rt_dist2d_seg_seg(ctx, A1, A3, B1, B3, dl);
-
-	/* A is co-linear, delegate to rt_dist_seg_arc here. */
-	if ( radius_A < 0 )
-		return rt_dist2d_seg_arc(ctx, A1, A3, B1, B2, B3, dl);
-
-	/* B is co-linear, delegate to rt_dist_seg_arc here. */
-	if ( radius_B < 0 )
-		return rt_dist2d_seg_arc(ctx, B1, B3, A1, A2, A3, dl);
-
-	/* Make sure that arc "A" has the bigger radius */
-	if ( radius_B > radius_A )
-	{
-		const RTPOINT2D *tmp;
-		tmp = B1; B1 = A1; A1 = tmp;
-		tmp = B2; B2 = A2; A2 = tmp;
-		tmp = B3; B3 = A3; A3 = tmp;
-		P = CB; CB = CA; CA = P;
-		d = radius_B; radius_B = radius_A; radius_A = d;
-	}
-	
-	/* Center-center distance */
-	d = distance2d_pt_pt(ctx, &CA, &CB);
-
-	/* Equal circles. Arcs may intersect at multiple points, or at none! */
-	if ( FP_EQUALS(d, 0.0) && FP_EQUALS(radius_A, radius_B) )
-	{
-		rterror(ctx, "rt_dist2d_arc_arc can't handle cojoint circles, uh oh");
-	}
-	
-	/* Circles touch at a point. Is that point within the arcs? */
-	if ( d == (radius_A + radius_B) )
-	{
-		D.x = CA.x + (CB.x - CA.x) * radius_A / d;
-		D.y = CA.y + (CB.y - CA.y) * radius_A / d;
-		
-		pt_in_arc_A = rt_pt_in_arc(ctx, &D, A1, A2, A3);
-		pt_in_arc_B = rt_pt_in_arc(ctx, &D, B1, B2, B3);
-		
-		/* Arcs do touch at D, return it */
-		if ( pt_in_arc_A && pt_in_arc_B )
-		{
-			dl->distance = 0.0;
-			dl->p1 = D;
-			dl->p2 = D;
-			return RT_TRUE;
-		}
-	}
-	/* Disjoint or contained circles don't intersect. Closest point may be on */
-	/* the line joining CA to CB. */
-	else if ( d > (radius_A + radius_B) /* Disjoint */ || d < (radius_A - radius_B) /* Contained */ )
-	{
-		RTPOINT2D XA, XB; /* Points where the line from CA to CB cross their circle bounds */
-		
-		/* Calculate hypothetical nearest points, the places on the */
-		/* two circles where the center-center line crosses. If both */
-		/* arcs contain their hypothetical points, that's the crossing distance */
-		XA.x = CA.x + (CB.x - CA.x) * radius_A / d;
-		XA.y = CA.y + (CB.y - CA.y) * radius_A / d;
-		XB.x = CB.x + (CA.x - CB.x) * radius_B / d;
-		XB.y = CB.y + (CA.y - CB.y) * radius_B / d;
-		
-		pt_in_arc_A = rt_pt_in_arc(ctx, &XA, A1, A2, A3);
-		pt_in_arc_B = rt_pt_in_arc(ctx, &XB, B1, B2, B3);
-		
-		/* If the nearest points are both within the arcs, that's our answer */
-		/* the shortest distance is at the nearest points */
-		if ( pt_in_arc_A && pt_in_arc_B )
-		{
-			return rt_dist2d_pt_pt(ctx, &XA, &XB, dl);
-		}
-	}
-	/* Circles cross at two points, are either of those points in both arcs? */
-	/* http://paulbourke.net/geometry/2circle/ */
-	else if ( d < (radius_A + radius_B) )
-	{
-		RTPOINT2D E, F; /* Points where circle(A) and circle(B) cross */
-		/* Distance from CA to D */
-		double a = (radius_A*radius_A - radius_B*radius_B + d*d) / (2*d);
-		/* Distance from D to E or F */
-		double h = sqrt(radius_A*radius_A - a*a);
-		
-		/* Location of D */
-		D.x = CA.x + (CB.x - CA.x) * a / d;
-		D.y = CA.y + (CB.y - CA.y) * a / d;
-		
-		/* Start from D and project h units perpendicular to CA-D to get E */
-		E.x = D.x + (D.y - CA.y) * h / a;
-		E.y = D.y + (D.x - CA.x) * h / a;
-
-		/* Crossing point E contained in arcs? */
-		pt_in_arc_A = rt_pt_in_arc(ctx, &E, A1, A2, A3);
-		pt_in_arc_B = rt_pt_in_arc(ctx, &E, B1, B2, B3);
-
-		if ( pt_in_arc_A && pt_in_arc_B ) 
-		{
-			dl->p1 = dl->p2 = E;
-			dl->distance = 0.0;
-			return RT_TRUE;
-		}
-
-		/* Start from D and project h units perpendicular to CA-D to get F */
-		F.x = D.x - (D.y - CA.y) * h / a;
-		F.y = D.y - (D.x - CA.x) * h / a;
-		
-		/* Crossing point F contained in arcs? */
-		pt_in_arc_A = rt_pt_in_arc(ctx, &F, A1, A2, A3);
-		pt_in_arc_B = rt_pt_in_arc(ctx, &F, B1, B2, B3);
-
-		if ( pt_in_arc_A && pt_in_arc_B ) 
-		{
-			dl->p1 = dl->p2 = F;
-			dl->distance = 0.0;
-			return RT_TRUE;
-		}
-	} 
-	else
-	{
-		rterror(ctx, "rt_dist2d_arc_arc: arcs neither touch, intersect nor are disjoint! INCONCEIVABLE!");
-		return RT_FALSE;
-	}
-
-	/* Closest point is in the arc A, but not in the arc B, so */
-	/* one of the B end points must be the closest. */
-	if ( pt_in_arc_A & ! pt_in_arc_B )
-	{
-		rt_dist2d_pt_arc(ctx, B1, A1, A2, A3, dl);
-		rt_dist2d_pt_arc(ctx, B3, A1, A2, A3, dl);
-		return RT_TRUE;
-	}
-	/* Closest point is in the arc B, but not in the arc A, so */
-	/* one of the A end points must be the closest. */
-	else if  ( pt_in_arc_B && ! pt_in_arc_A )
-	{
-		rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
-		rt_dist2d_pt_arc(ctx, A3, B1, B2, B3, dl);		
-		return RT_TRUE;			
-	}
-	/* Finally, one of the end-point to end-point combos is the closest. */
-	else
-	{
-		rt_dist2d_pt_pt(ctx, A1, B1, dl);
-		rt_dist2d_pt_pt(ctx, A1, B3, dl);
-		rt_dist2d_pt_pt(ctx, A2, B1, dl);
-		rt_dist2d_pt_pt(ctx, A2, B3, dl);
-		return RT_TRUE;
-	}	
-
-	return RT_TRUE;
+  RTPOINT2D CA, CB; /* Center points of arcs A and B */
+  double radius_A, radius_B, d; /* Radii of arcs A and B */
+  RTPOINT2D P; /* Temporary point P */
+  RTPOINT2D D; /* Mid-point between the centers CA and CB */
+  int pt_in_arc_A, pt_in_arc_B; /* Test whether potential intersection point is within the arc */
+
+  if ( dl->mode != DIST_MIN )
+    rterror(ctx, "rt_dist2d_arc_arc only supports mindistance");
+
+  /* TODO: Handle case where arc is closed circle (A1 = A3) */
+
+  /* What if one or both of our "arcs" is actually a point? */
+  if ( rt_arc_is_pt(ctx, B1, B2, B3) && rt_arc_is_pt(ctx, A1, A2, A3) )
+    return rt_dist2d_pt_pt(ctx, B1, A1, dl);
+  else if ( rt_arc_is_pt(ctx, B1, B2, B3) )
+    return rt_dist2d_pt_arc(ctx, B1, A1, A2, A3, dl);
+  else if ( rt_arc_is_pt(ctx, A1, A2, A3) )
+    return rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
+
+  /* Calculate centers and radii of circles. */
+  radius_A = rt_arc_center(ctx, A1, A2, A3, &CA);
+  radius_B = rt_arc_center(ctx, B1, B2, B3, &CB);
+
+  /* Two co-linear arcs?!? That's two segments. */
+  if ( radius_A < 0 && radius_B < 0 )
+    return rt_dist2d_seg_seg(ctx, A1, A3, B1, B3, dl);
+
+  /* A is co-linear, delegate to rt_dist_seg_arc here. */
+  if ( radius_A < 0 )
+    return rt_dist2d_seg_arc(ctx, A1, A3, B1, B2, B3, dl);
+
+  /* B is co-linear, delegate to rt_dist_seg_arc here. */
+  if ( radius_B < 0 )
+    return rt_dist2d_seg_arc(ctx, B1, B3, A1, A2, A3, dl);
+
+  /* Make sure that arc "A" has the bigger radius */
+  if ( radius_B > radius_A )
+  {
+    const RTPOINT2D *tmp;
+    tmp = B1; B1 = A1; A1 = tmp;
+    tmp = B2; B2 = A2; A2 = tmp;
+    tmp = B3; B3 = A3; A3 = tmp;
+    P = CB; CB = CA; CA = P;
+    d = radius_B; radius_B = radius_A; radius_A = d;
+  }
+
+  /* Center-center distance */
+  d = distance2d_pt_pt(ctx, &CA, &CB);
+
+  /* Equal circles. Arcs may intersect at multiple points, or at none! */
+  if ( FP_EQUALS(d, 0.0) && FP_EQUALS(radius_A, radius_B) )
+  {
+    rterror(ctx, "rt_dist2d_arc_arc can't handle cojoint circles, uh oh");
+  }
+
+  /* Circles touch at a point. Is that point within the arcs? */
+  if ( d == (radius_A + radius_B) )
+  {
+    D.x = CA.x + (CB.x - CA.x) * radius_A / d;
+    D.y = CA.y + (CB.y - CA.y) * radius_A / d;
+
+    pt_in_arc_A = rt_pt_in_arc(ctx, &D, A1, A2, A3);
+    pt_in_arc_B = rt_pt_in_arc(ctx, &D, B1, B2, B3);
+
+    /* Arcs do touch at D, return it */
+    if ( pt_in_arc_A && pt_in_arc_B )
+    {
+      dl->distance = 0.0;
+      dl->p1 = D;
+      dl->p2 = D;
+      return RT_TRUE;
+    }
+  }
+  /* Disjoint or contained circles don't intersect. Closest point may be on */
+  /* the line joining CA to CB. */
+  else if ( d > (radius_A + radius_B) /* Disjoint */ || d < (radius_A - radius_B) /* Contained */ )
+  {
+    RTPOINT2D XA, XB; /* Points where the line from CA to CB cross their circle bounds */
+
+    /* Calculate hypothetical nearest points, the places on the */
+    /* two circles where the center-center line crosses. If both */
+    /* arcs contain their hypothetical points, that's the crossing distance */
+    XA.x = CA.x + (CB.x - CA.x) * radius_A / d;
+    XA.y = CA.y + (CB.y - CA.y) * radius_A / d;
+    XB.x = CB.x + (CA.x - CB.x) * radius_B / d;
+    XB.y = CB.y + (CA.y - CB.y) * radius_B / d;
+
+    pt_in_arc_A = rt_pt_in_arc(ctx, &XA, A1, A2, A3);
+    pt_in_arc_B = rt_pt_in_arc(ctx, &XB, B1, B2, B3);
+
+    /* If the nearest points are both within the arcs, that's our answer */
+    /* the shortest distance is at the nearest points */
+    if ( pt_in_arc_A && pt_in_arc_B )
+    {
+      return rt_dist2d_pt_pt(ctx, &XA, &XB, dl);
+    }
+  }
+  /* Circles cross at two points, are either of those points in both arcs? */
+  /* http://paulbourke.net/geometry/2circle/ */
+  else if ( d < (radius_A + radius_B) )
+  {
+    RTPOINT2D E, F; /* Points where circle(A) and circle(B) cross */
+    /* Distance from CA to D */
+    double a = (radius_A*radius_A - radius_B*radius_B + d*d) / (2*d);
+    /* Distance from D to E or F */
+    double h = sqrt(radius_A*radius_A - a*a);
+
+    /* Location of D */
+    D.x = CA.x + (CB.x - CA.x) * a / d;
+    D.y = CA.y + (CB.y - CA.y) * a / d;
+
+    /* Start from D and project h units perpendicular to CA-D to get E */
+    E.x = D.x + (D.y - CA.y) * h / a;
+    E.y = D.y + (D.x - CA.x) * h / a;
+
+    /* Crossing point E contained in arcs? */
+    pt_in_arc_A = rt_pt_in_arc(ctx, &E, A1, A2, A3);
+    pt_in_arc_B = rt_pt_in_arc(ctx, &E, B1, B2, B3);
+
+    if ( pt_in_arc_A && pt_in_arc_B )
+    {
+      dl->p1 = dl->p2 = E;
+      dl->distance = 0.0;
+      return RT_TRUE;
+    }
+
+    /* Start from D and project h units perpendicular to CA-D to get F */
+    F.x = D.x - (D.y - CA.y) * h / a;
+    F.y = D.y - (D.x - CA.x) * h / a;
+
+    /* Crossing point F contained in arcs? */
+    pt_in_arc_A = rt_pt_in_arc(ctx, &F, A1, A2, A3);
+    pt_in_arc_B = rt_pt_in_arc(ctx, &F, B1, B2, B3);
+
+    if ( pt_in_arc_A && pt_in_arc_B )
+    {
+      dl->p1 = dl->p2 = F;
+      dl->distance = 0.0;
+      return RT_TRUE;
+    }
+  }
+  else
+  {
+    rterror(ctx, "rt_dist2d_arc_arc: arcs neither touch, intersect nor are disjoint! INCONCEIVABLE!");
+    return RT_FALSE;
+  }
+
+  /* Closest point is in the arc A, but not in the arc B, so */
+  /* one of the B end points must be the closest. */
+  if ( pt_in_arc_A & ! pt_in_arc_B )
+  {
+    rt_dist2d_pt_arc(ctx, B1, A1, A2, A3, dl);
+    rt_dist2d_pt_arc(ctx, B3, A1, A2, A3, dl);
+    return RT_TRUE;
+  }
+  /* Closest point is in the arc B, but not in the arc A, so */
+  /* one of the A end points must be the closest. */
+  else if  ( pt_in_arc_B && ! pt_in_arc_A )
+  {
+    rt_dist2d_pt_arc(ctx, A1, B1, B2, B3, dl);
+    rt_dist2d_pt_arc(ctx, A3, B1, B2, B3, dl);
+    return RT_TRUE;
+  }
+  /* Finally, one of the end-point to end-point combos is the closest. */
+  else
+  {
+    rt_dist2d_pt_pt(ctx, A1, B1, dl);
+    rt_dist2d_pt_pt(ctx, A1, B3, dl);
+    rt_dist2d_pt_pt(ctx, A2, B1, dl);
+    rt_dist2d_pt_pt(ctx, A2, B3, dl);
+    return RT_TRUE;
+  }
+
+  return RT_TRUE;
 }
 
 /**
@@ -1664,110 +1664,110 @@ but just sending every possible combination further to rt_dist2d_pt_seg
 int
 rt_dist2d_seg_seg(const RTCTX *ctx, const RTPOINT2D *A, const RTPOINT2D *B, const RTPOINT2D *C, const RTPOINT2D *D, DISTPTS *dl)
 {
-	double	s_top, s_bot,s;
-	double	r_top, r_bot,r;
-
-	RTDEBUGF(2, "rt_dist2d_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
-	         A->x,A->y,B->x,B->y, C->x,C->y, D->x, D->y);
-
-	/*A and B are the same point */
-	if (  ( A->x == B->x) && (A->y == B->y) )
-	{
-		return rt_dist2d_pt_seg(ctx, A,C,D,dl);
-	}
-	/*U and V are the same point */
-
-	if (  ( C->x == D->x) && (C->y == D->y) )
-	{
-		dl->twisted= ((dl->twisted) * (-1));
-		return rt_dist2d_pt_seg(ctx, D,A,B,dl);
-	}
-	/* AB and CD are line segments */
-	/* from comp.graphics.algo
-
-	Solving the above for r and s yields
-				(Ay-Cy)(Dx-Cx)-(Ax-Cx)(Dy-Cy)
-	           r = ----------------------------- (eqn 1)
-				(Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)
-
-		 	(Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
-		s = ----------------------------- (eqn 2)
-			(Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)
-	Let P be the position vector of the intersection point, then
-		P=A+r(B-A) or
-		Px=Ax+r(Bx-Ax)
-		Py=Ay+r(By-Ay)
-	By examining the values of r & s, you can also determine some other limiting conditions:
-		If 0<=r<=1 & 0<=s<=1, intersection exists
-		r<0 or r>1 or s<0 or s>1 line segments do not intersect
-		If the denominator in eqn 1 is zero, AB & CD are parallel
-		If the numerator in eqn 1 is also zero, AB & CD are collinear.
-
-	*/
-	r_top = (A->y-C->y)*(D->x-C->x) - (A->x-C->x)*(D->y-C->y);
-	r_bot = (B->x-A->x)*(D->y-C->y) - (B->y-A->y)*(D->x-C->x);
-
-	s_top = (A->y-C->y)*(B->x-A->x) - (A->x-C->x)*(B->y-A->y);
-	s_bot = (B->x-A->x)*(D->y-C->y) - (B->y-A->y)*(D->x-C->x);
-
-	if  ( (r_bot==0) || (s_bot == 0) )
-	{
-		if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
-		{
-			dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
-			return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
-		}
-		else
-		{
-			return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
-		}
-	}
-
-	s = s_top/s_bot;
-	r=  r_top/r_bot;
-
-	if (((r<0) || (r>1) || (s<0) || (s>1)) || (dl->mode == DIST_MAX))
-	{
-		if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
-		{
-			dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
-			return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
-		}
-		else
-		{
-			return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
-		}
-	}
-	else
-	{
-		if (dl->mode == DIST_MIN)	/*If there is intersection we identify the intersection point and return it but only if we are looking for mindistance*/
-		{
-			RTPOINT2D theP;
-
-			if (((A->x==C->x)&&(A->y==C->y))||((A->x==D->x)&&(A->y==D->y)))
-			{
-				theP.x = A->x;
-				theP.y = A->y;
-			}
-			else if (((B->x==C->x)&&(B->y==C->y))||((B->x==D->x)&&(B->y==D->y)))
-			{
-				theP.x = B->x;
-				theP.y = B->y;
-			}
-			else
-			{
-				theP.x = A->x+r*(B->x-A->x);
-				theP.y = A->y+r*(B->y-A->y);
-			}
-			dl->distance=0.0;
-			dl->p1=theP;
-			dl->p2=theP;
-		}
-		return RT_TRUE;
-
-	}
-	rterror(ctx, "unspecified error in function rt_dist2d_seg_seg");
-	return RT_FALSE; /*If we have come here something is wrong*/
+  double  s_top, s_bot,s;
+  double  r_top, r_bot,r;
+
+  RTDEBUGF(2, "rt_dist2d_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
+           A->x,A->y,B->x,B->y, C->x,C->y, D->x, D->y);
+
+  /*A and B are the same point */
+  if (  ( A->x == B->x) && (A->y == B->y) )
+  {
+    return rt_dist2d_pt_seg(ctx, A,C,D,dl);
+  }
+  /*U and V are the same point */
+
+  if (  ( C->x == D->x) && (C->y == D->y) )
+  {
+    dl->twisted= ((dl->twisted) * (-1));
+    return rt_dist2d_pt_seg(ctx, D,A,B,dl);
+  }
+  /* AB and CD are line segments */
+  /* from comp.graphics.algo
+
+  Solving the above for r and s yields
+        (Ay-Cy)(Dx-Cx)-(Ax-Cx)(Dy-Cy)
+             r = ----------------------------- (eqn 1)
+        (Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)
+
+       (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
+    s = ----------------------------- (eqn 2)
+      (Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)
+  Let P be the position vector of the intersection point, then
+    P=A+r(B-A) or
+    Px=Ax+r(Bx-Ax)
+    Py=Ay+r(By-Ay)
+  By examining the values of r & s, you can also determine some other limiting conditions:
+    If 0<=r<=1 & 0<=s<=1, intersection exists
+    r<0 or r>1 or s<0 or s>1 line segments do not intersect
+    If the denominator in eqn 1 is zero, AB & CD are parallel
+    If the numerator in eqn 1 is also zero, AB & CD are collinear.
+
+  */
+  r_top = (A->y-C->y)*(D->x-C->x) - (A->x-C->x)*(D->y-C->y);
+  r_bot = (B->x-A->x)*(D->y-C->y) - (B->y-A->y)*(D->x-C->x);
+
+  s_top = (A->y-C->y)*(B->x-A->x) - (A->x-C->x)*(B->y-A->y);
+  s_bot = (B->x-A->x)*(D->y-C->y) - (B->y-A->y)*(D->x-C->x);
+
+  if  ( (r_bot==0) || (s_bot == 0) )
+  {
+    if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
+    {
+      dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
+      return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
+    }
+    else
+    {
+      return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
+    }
+  }
+
+  s = s_top/s_bot;
+  r=  r_top/r_bot;
+
+  if (((r<0) || (r>1) || (s<0) || (s>1)) || (dl->mode == DIST_MAX))
+  {
+    if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
+    {
+      dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
+      return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
+    }
+    else
+    {
+      return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
+    }
+  }
+  else
+  {
+    if (dl->mode == DIST_MIN)  /*If there is intersection we identify the intersection point and return it but only if we are looking for mindistance*/
+    {
+      RTPOINT2D theP;
+
+      if (((A->x==C->x)&&(A->y==C->y))||((A->x==D->x)&&(A->y==D->y)))
+      {
+        theP.x = A->x;
+        theP.y = A->y;
+      }
+      else if (((B->x==C->x)&&(B->y==C->y))||((B->x==D->x)&&(B->y==D->y)))
+      {
+        theP.x = B->x;
+        theP.y = B->y;
+      }
+      else
+      {
+        theP.x = A->x+r*(B->x-A->x);
+        theP.y = A->y+r*(B->y-A->y);
+      }
+      dl->distance=0.0;
+      dl->p1=theP;
+      dl->p2=theP;
+    }
+    return RT_TRUE;
+
+  }
+  rterror(ctx, "unspecified error in function rt_dist2d_seg_seg");
+  return RT_FALSE; /*If we have come here something is wrong*/
 }
 
 
@@ -1790,246 +1790,246 @@ chosen selection of the points not all of them
 int
 rt_dist2d_fast_ptarray_ptarray(const RTCTX *ctx, RTPOINTARRAY *l1, RTPOINTARRAY *l2,DISTPTS *dl, RTGBOX *box1, RTGBOX *box2)
 {
-	/*here we define two lists to hold our calculated "z"-values and the order number in the geometry*/
-
-	double k, thevalue;
-	float	deltaX, deltaY, c1m, c2m;
-	RTPOINT2D	c1, c2;
-	const RTPOINT2D *theP;
-	float min1X, max1X, max1Y, min1Y,min2X, max2X, max2Y, min2Y;
-	int t;
-	int n1 = l1->npoints;
-	int n2 = l2->npoints;
-	
-	LISTSTRUCT *list1, *list2;
-	list1 = (LISTSTRUCT*)rtalloc(ctx, sizeof(LISTSTRUCT)*n1); 
-	list2 = (LISTSTRUCT*)rtalloc(ctx, sizeof(LISTSTRUCT)*n2);
-	
-	RTDEBUG(2, "rt_dist2d_fast_ptarray_ptarray is called");
-
-	max1X = box1->xmax;
-	min1X = box1->xmin;
-	max1Y = box1->ymax;
-	min1Y = box1->ymin;
-	max2X = box2->xmax;
-	min2X = box2->xmin;
-	max2Y = box2->ymax;
-	min2Y = box2->ymin;
-	/*we want the center of the bboxes, and calculate the slope between the centerpoints*/
-	c1.x = min1X + (max1X-min1X)/2;
-	c1.y = min1Y + (max1Y-min1Y)/2;
-	c2.x = min2X + (max2X-min2X)/2;
-	c2.y = min2Y + (max2Y-min2Y)/2;
-
-	deltaX=(c2.x-c1.x);
-	deltaY=(c2.y-c1.y);
-
-
-	/*Here we calculate where the line perpendicular to the center-center line crosses the axes for each vertex
-	if the center-center line is vertical the perpendicular line will be horizontal and we find it's crossing the Y-axes with z = y-kx */
-	if ((deltaX*deltaX)<(deltaY*deltaY))        /*North or South*/
-	{
-		k = -deltaX/deltaY;
-		for (t=0; t<n1; t++) /*for each segment in L1 */
-		{
-			theP = rt_getPoint2d_cp(ctx, l1, t);
-			thevalue = theP->y - (k * theP->x);
-			list1[t].themeasure=thevalue;
-			list1[t].pnr=t;
-
-		}
-		for (t=0; t<n2; t++) /*for each segment in L2*/
-		{
-			theP = rt_getPoint2d_cp(ctx, l2, t);
-			thevalue = theP->y - (k * theP->x);
-			list2[t].themeasure=thevalue;
-			list2[t].pnr=t;
-
-		}
-		c1m = c1.y-(k*c1.x);
-		c2m = c2.y-(k*c2.x);
-	}
-
-
-	/*if the center-center line is horizontal the perpendicular line will be vertical. To eliminate problems with deviding by zero we are here mirroring the coordinate-system
-	 and we find it's crossing the X-axes with z = x-(1/k)y */
-	else        /*West or East*/
-	{
-		k = -deltaY/deltaX;
-		for (t=0; t<n1; t++) /*for each segment in L1 */
-		{
-			theP = rt_getPoint2d_cp(ctx, l1, t);
-			thevalue = theP->x - (k * theP->y);
-			list1[t].themeasure=thevalue;
-			list1[t].pnr=t;
-			/* rtnotice(ctx, "l1 %d, measure=%f",t,thevalue ); */
-		}
-		for (t=0; t<n2; t++) /*for each segment in L2*/
-		{
-			theP = rt_getPoint2d_cp(ctx, l2, t);
-			thevalue = theP->x - (k * theP->y);
-			list2[t].themeasure=thevalue;
-			list2[t].pnr=t;
-			/* rtnotice(ctx, "l2 %d, measure=%f",t,thevalue ); */
-		}
-		c1m = c1.x-(k*c1.y);
-		c2m = c2.x-(k*c2.y);
-	}
-
-	/*we sort our lists by the calculated values*/
-	qsort(list1, n1, sizeof(LISTSTRUCT), struct_cmp_by_measure);
-	qsort(list2, n2, sizeof(LISTSTRUCT), struct_cmp_by_measure);
-
-	if (c1m < c2m)
-	{
-		if (!rt_dist2d_pre_seg_seg(ctx, l1,l2,list1,list2,k,dl)) 
-		{
-			rtfree(ctx, list1);
-			rtfree(ctx, list2);
-			return RT_FALSE;
-		}
-	}
-	else
-	{
-		dl->twisted= ((dl->twisted) * (-1));
-		if (!rt_dist2d_pre_seg_seg(ctx, l2,l1,list2,list1,k,dl)) 
-		{
-			rtfree(ctx, list1);
-			rtfree(ctx, list2);
-			return RT_FALSE;
-		}
-	}
-	rtfree(ctx, list1);
-	rtfree(ctx, list2);	
-	return RT_TRUE;
+  /*here we define two lists to hold our calculated "z"-values and the order number in the geometry*/
+
+  double k, thevalue;
+  float  deltaX, deltaY, c1m, c2m;
+  RTPOINT2D  c1, c2;
+  const RTPOINT2D *theP;
+  float min1X, max1X, max1Y, min1Y,min2X, max2X, max2Y, min2Y;
+  int t;
+  int n1 = l1->npoints;
+  int n2 = l2->npoints;
+
+  LISTSTRUCT *list1, *list2;
+  list1 = (LISTSTRUCT*)rtalloc(ctx, sizeof(LISTSTRUCT)*n1);
+  list2 = (LISTSTRUCT*)rtalloc(ctx, sizeof(LISTSTRUCT)*n2);
+
+  RTDEBUG(2, "rt_dist2d_fast_ptarray_ptarray is called");
+
+  max1X = box1->xmax;
+  min1X = box1->xmin;
+  max1Y = box1->ymax;
+  min1Y = box1->ymin;
+  max2X = box2->xmax;
+  min2X = box2->xmin;
+  max2Y = box2->ymax;
+  min2Y = box2->ymin;
+  /*we want the center of the bboxes, and calculate the slope between the centerpoints*/
+  c1.x = min1X + (max1X-min1X)/2;
+  c1.y = min1Y + (max1Y-min1Y)/2;
+  c2.x = min2X + (max2X-min2X)/2;
+  c2.y = min2Y + (max2Y-min2Y)/2;
+
+  deltaX=(c2.x-c1.x);
+  deltaY=(c2.y-c1.y);
+
+
+  /*Here we calculate where the line perpendicular to the center-center line crosses the axes for each vertex
+  if the center-center line is vertical the perpendicular line will be horizontal and we find it's crossing the Y-axes with z = y-kx */
+  if ((deltaX*deltaX)<(deltaY*deltaY))        /*North or South*/
+  {
+    k = -deltaX/deltaY;
+    for (t=0; t<n1; t++) /*for each segment in L1 */
+    {
+      theP = rt_getPoint2d_cp(ctx, l1, t);
+      thevalue = theP->y - (k * theP->x);
+      list1[t].themeasure=thevalue;
+      list1[t].pnr=t;
+
+    }
+    for (t=0; t<n2; t++) /*for each segment in L2*/
+    {
+      theP = rt_getPoint2d_cp(ctx, l2, t);
+      thevalue = theP->y - (k * theP->x);
+      list2[t].themeasure=thevalue;
+      list2[t].pnr=t;
+
+    }
+    c1m = c1.y-(k*c1.x);
+    c2m = c2.y-(k*c2.x);
+  }
+
+
+  /*if the center-center line is horizontal the perpendicular line will be vertical. To eliminate problems with deviding by zero we are here mirroring the coordinate-system
+   and we find it's crossing the X-axes with z = x-(1/k)y */
+  else        /*West or East*/
+  {
+    k = -deltaY/deltaX;
+    for (t=0; t<n1; t++) /*for each segment in L1 */
+    {
+      theP = rt_getPoint2d_cp(ctx, l1, t);
+      thevalue = theP->x - (k * theP->y);
+      list1[t].themeasure=thevalue;
+      list1[t].pnr=t;
+      /* rtnotice(ctx, "l1 %d, measure=%f",t,thevalue ); */
+    }
+    for (t=0; t<n2; t++) /*for each segment in L2*/
+    {
+      theP = rt_getPoint2d_cp(ctx, l2, t);
+      thevalue = theP->x - (k * theP->y);
+      list2[t].themeasure=thevalue;
+      list2[t].pnr=t;
+      /* rtnotice(ctx, "l2 %d, measure=%f",t,thevalue ); */
+    }
+    c1m = c1.x-(k*c1.y);
+    c2m = c2.x-(k*c2.y);
+  }
+
+  /*we sort our lists by the calculated values*/
+  qsort(list1, n1, sizeof(LISTSTRUCT), struct_cmp_by_measure);
+  qsort(list2, n2, sizeof(LISTSTRUCT), struct_cmp_by_measure);
+
+  if (c1m < c2m)
+  {
+    if (!rt_dist2d_pre_seg_seg(ctx, l1,l2,list1,list2,k,dl))
+    {
+      rtfree(ctx, list1);
+      rtfree(ctx, list2);
+      return RT_FALSE;
+    }
+  }
+  else
+  {
+    dl->twisted= ((dl->twisted) * (-1));
+    if (!rt_dist2d_pre_seg_seg(ctx, l2,l1,list2,list1,k,dl))
+    {
+      rtfree(ctx, list1);
+      rtfree(ctx, list2);
+      return RT_FALSE;
+    }
+  }
+  rtfree(ctx, list1);
+  rtfree(ctx, list2);
+  return RT_TRUE;
 }
 
 int
 struct_cmp_by_measure(const void *a, const void *b)
 {
-	LISTSTRUCT *ia = (LISTSTRUCT*)a;
-	LISTSTRUCT *ib = (LISTSTRUCT*)b;
-	return ( ia->themeasure>ib->themeasure ) ? 1 : -1;
+  LISTSTRUCT *ia = (LISTSTRUCT*)a;
+  LISTSTRUCT *ib = (LISTSTRUCT*)b;
+  return ( ia->themeasure>ib->themeasure ) ? 1 : -1;
 }
 
 /**
-	preparation before rt_dist2d_seg_seg.
+  preparation before rt_dist2d_seg_seg.
 */
 int
 rt_dist2d_pre_seg_seg(const RTCTX *ctx, RTPOINTARRAY *l1, RTPOINTARRAY *l2,LISTSTRUCT *list1, LISTSTRUCT *list2,double k, DISTPTS *dl)
 {
-	const RTPOINT2D *p1, *p2, *p3, *p4, *p01, *p02;
-	int pnr1,pnr2,pnr3,pnr4, n1, n2, i, u, r, twist;
-	double maxmeasure;
-	n1=	l1->npoints;
-	n2 = l2->npoints;
-
-	RTDEBUG(2, "rt_dist2d_pre_seg_seg is called");
-
-	p1 = rt_getPoint2d_cp(ctx, l1, list1[0].pnr);
-	p3 = rt_getPoint2d_cp(ctx, l2, list2[0].pnr);
-	rt_dist2d_pt_pt(ctx, p1, p3, dl);
-	maxmeasure = sqrt(dl->distance*dl->distance + (dl->distance*dl->distance*k*k));
-	twist = dl->twisted; /*to keep the incomming order between iterations*/
-	for (i =(n1-1); i>=0; --i)
-	{
-		/*we break this iteration when we have checked every
-		point closer to our perpendicular "checkline" than
-		our shortest found distance*/
-		if (((list2[0].themeasure-list1[i].themeasure)) > maxmeasure) break;
-		for (r=-1; r<=1; r +=2) /*because we are not iterating in the original pointorder we have to check the segment before and after every point*/
-		{
-			pnr1 = list1[i].pnr;
-			p1 = rt_getPoint2d_cp(ctx, l1, pnr1);
-			if (pnr1+r<0)
-			{
-				p01 = rt_getPoint2d_cp(ctx, l1, (n1-1));
-				if (( p1->x == p01->x) && (p1->y == p01->y)) pnr2 = (n1-1);
-				else pnr2 = pnr1; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
-			}
-
-			else if (pnr1+r>(n1-1))
-			{
-				p01 = rt_getPoint2d_cp(ctx, l1, 0);
-				if (( p1->x == p01->x) && (p1->y == p01->y)) pnr2 = 0;
-				else pnr2 = pnr1; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
-			}
-			else pnr2 = pnr1+r;
-
-
-			p2 = rt_getPoint2d_cp(ctx, l1, pnr2);
-			for (u=0; u<n2; ++u)
-			{
-				if (((list2[u].themeasure-list1[i].themeasure)) >= maxmeasure) break;
-				pnr3 = list2[u].pnr;
-				p3 = rt_getPoint2d_cp(ctx, l2, pnr3);
-				if (pnr3==0)
-				{
-					p02 = rt_getPoint2d_cp(ctx, l2, (n2-1));
-					if (( p3->x == p02->x) && (p3->y == p02->y)) pnr4 = (n2-1);
-					else pnr4 = pnr3; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
-				}
-				else pnr4 = pnr3-1;
-
-				p4 = rt_getPoint2d_cp(ctx, l2, pnr4);
-				dl->twisted=twist;
-				if (!rt_dist2d_selected_seg_seg(ctx, p1, p2, p3, p4, dl)) return RT_FALSE;
-
-				if (pnr3>=(n2-1))
-				{
-					p02 = rt_getPoint2d_cp(ctx, l2, 0);
-					if (( p3->x == p02->x) && (p3->y == p02->y)) pnr4 = 0;
-					else pnr4 = pnr3; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
-				}
-
-				else pnr4 = pnr3+1;
-
-				p4 = rt_getPoint2d_cp(ctx, l2, pnr4);
-				dl->twisted=twist; /*we reset the "twist" for each iteration*/
-				if (!rt_dist2d_selected_seg_seg(ctx, p1, p2, p3, p4, dl)) return RT_FALSE;
-
-				maxmeasure = sqrt(dl->distance*dl->distance + (dl->distance*dl->distance*k*k));/*here we "translate" the found mindistance so it can be compared to our "z"-values*/
-			}
-		}
-	}
-
-	return RT_TRUE;
+  const RTPOINT2D *p1, *p2, *p3, *p4, *p01, *p02;
+  int pnr1,pnr2,pnr3,pnr4, n1, n2, i, u, r, twist;
+  double maxmeasure;
+  n1=  l1->npoints;
+  n2 = l2->npoints;
+
+  RTDEBUG(2, "rt_dist2d_pre_seg_seg is called");
+
+  p1 = rt_getPoint2d_cp(ctx, l1, list1[0].pnr);
+  p3 = rt_getPoint2d_cp(ctx, l2, list2[0].pnr);
+  rt_dist2d_pt_pt(ctx, p1, p3, dl);
+  maxmeasure = sqrt(dl->distance*dl->distance + (dl->distance*dl->distance*k*k));
+  twist = dl->twisted; /*to keep the incomming order between iterations*/
+  for (i =(n1-1); i>=0; --i)
+  {
+    /*we break this iteration when we have checked every
+    point closer to our perpendicular "checkline" than
+    our shortest found distance*/
+    if (((list2[0].themeasure-list1[i].themeasure)) > maxmeasure) break;
+    for (r=-1; r<=1; r +=2) /*because we are not iterating in the original pointorder we have to check the segment before and after every point*/
+    {
+      pnr1 = list1[i].pnr;
+      p1 = rt_getPoint2d_cp(ctx, l1, pnr1);
+      if (pnr1+r<0)
+      {
+        p01 = rt_getPoint2d_cp(ctx, l1, (n1-1));
+        if (( p1->x == p01->x) && (p1->y == p01->y)) pnr2 = (n1-1);
+        else pnr2 = pnr1; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
+      }
+
+      else if (pnr1+r>(n1-1))
+      {
+        p01 = rt_getPoint2d_cp(ctx, l1, 0);
+        if (( p1->x == p01->x) && (p1->y == p01->y)) pnr2 = 0;
+        else pnr2 = pnr1; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
+      }
+      else pnr2 = pnr1+r;
+
+
+      p2 = rt_getPoint2d_cp(ctx, l1, pnr2);
+      for (u=0; u<n2; ++u)
+      {
+        if (((list2[u].themeasure-list1[i].themeasure)) >= maxmeasure) break;
+        pnr3 = list2[u].pnr;
+        p3 = rt_getPoint2d_cp(ctx, l2, pnr3);
+        if (pnr3==0)
+        {
+          p02 = rt_getPoint2d_cp(ctx, l2, (n2-1));
+          if (( p3->x == p02->x) && (p3->y == p02->y)) pnr4 = (n2-1);
+          else pnr4 = pnr3; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
+        }
+        else pnr4 = pnr3-1;
+
+        p4 = rt_getPoint2d_cp(ctx, l2, pnr4);
+        dl->twisted=twist;
+        if (!rt_dist2d_selected_seg_seg(ctx, p1, p2, p3, p4, dl)) return RT_FALSE;
+
+        if (pnr3>=(n2-1))
+        {
+          p02 = rt_getPoint2d_cp(ctx, l2, 0);
+          if (( p3->x == p02->x) && (p3->y == p02->y)) pnr4 = 0;
+          else pnr4 = pnr3; /* if it is a line and the last and first point is not the same we avoid the edge between start and end this way*/
+        }
+
+        else pnr4 = pnr3+1;
+
+        p4 = rt_getPoint2d_cp(ctx, l2, pnr4);
+        dl->twisted=twist; /*we reset the "twist" for each iteration*/
+        if (!rt_dist2d_selected_seg_seg(ctx, p1, p2, p3, p4, dl)) return RT_FALSE;
+
+        maxmeasure = sqrt(dl->distance*dl->distance + (dl->distance*dl->distance*k*k));/*here we "translate" the found mindistance so it can be compared to our "z"-values*/
+      }
+    }
+  }
+
+  return RT_TRUE;
 }
 
 
 /**
-	This is the same function as rt_dist2d_seg_seg but
-	without any calculations to determine intersection since we
-	already know they do not intersect
+  This is the same function as rt_dist2d_seg_seg but
+  without any calculations to determine intersection since we
+  already know they do not intersect
 */
 int
 rt_dist2d_selected_seg_seg(const RTCTX *ctx, const RTPOINT2D *A, const RTPOINT2D *B, const RTPOINT2D *C, const RTPOINT2D *D, DISTPTS *dl)
 {
-	RTDEBUGF(2, "rt_dist2d_selected_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
-	         A->x,A->y,B->x,B->y, C->x,C->y, D->x, D->y);
-
-	/*A and B are the same point */
-	if (  ( A->x == B->x) && (A->y == B->y) )
-	{
-		return rt_dist2d_pt_seg(ctx, A,C,D,dl);
-	}
-	/*U and V are the same point */
-
-	if (  ( C->x == D->x) && (C->y == D->y) )
-	{
-		dl->twisted= ((dl->twisted) * (-1));
-		return rt_dist2d_pt_seg(ctx, D,A,B,dl);
-	}
-
-	if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
-	{
-		dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
-		return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
-	}
-	else
-	{
-		return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
-	}
+  RTDEBUGF(2, "rt_dist2d_selected_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
+           A->x,A->y,B->x,B->y, C->x,C->y, D->x, D->y);
+
+  /*A and B are the same point */
+  if (  ( A->x == B->x) && (A->y == B->y) )
+  {
+    return rt_dist2d_pt_seg(ctx, A,C,D,dl);
+  }
+  /*U and V are the same point */
+
+  if (  ( C->x == D->x) && (C->y == D->y) )
+  {
+    dl->twisted= ((dl->twisted) * (-1));
+    return rt_dist2d_pt_seg(ctx, D,A,B,dl);
+  }
+
+  if ((rt_dist2d_pt_seg(ctx, A,C,D,dl)) && (rt_dist2d_pt_seg(ctx, B,C,D,dl)))
+  {
+    dl->twisted= ((dl->twisted) * (-1));  /*here we change the order of inputted geometrys and that we  notice by changing sign on dl->twisted*/
+    return ((rt_dist2d_pt_seg(ctx, C,A,B,dl)) && (rt_dist2d_pt_seg(ctx, D,A,B,dl))); /*if all is successful we return true*/
+  }
+  else
+  {
+    return RT_FALSE; /* if any of the calls to rt_dist2d_pt_seg goes wrong we return false*/
+  }
 }
 
 /*------------------------------------------------------------------------------------------------------------
@@ -2051,69 +2051,69 @@ To get this points it was nessecary to change and it also showed to be about 10%
 int
 rt_dist2d_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A, const RTPOINT2D *B, DISTPTS *dl)
 {
-	RTPOINT2D c;
-	double	r;
-	/*if start==end, then use pt distance */
-	if (  ( A->x == B->x) && (A->y == B->y) )
-	{
-		return rt_dist2d_pt_pt(ctx, p,A,dl);
-	}
-	/*
-	 * otherwise, we use comp.graphics.algorithms
-	 * Frequently Asked Questions method
-	 *
-	 *  (1)        AC dot AB
-	 *         r = ---------
-	 *              ||AB||^2
-	 *	r has the following meaning:
-	 *	r=0 P = A
-	 *	r=1 P = B
-	 *	r<0 P is on the backward extension of AB
-	 *	r>1 P is on the forward extension of AB
-	 *	0<r<1 P is interior to AB
-	 */
-
-	r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
-
-	/*This is for finding the maxdistance.
-	the maxdistance have to be between two vertexes,
-	compared to mindistance which can be between
-	tvo vertexes vertex.*/
-	if (dl->mode == DIST_MAX)
-	{
-		if (r>=0.5)
-		{
-			return rt_dist2d_pt_pt(ctx, p,A,dl);
-		}
-		if (r<0.5)
-		{
-			return rt_dist2d_pt_pt(ctx, p,B,dl);
-		}
-	}
-
-	if (r<0)	/*If p projected on the line is outside point A*/
-	{
-		return rt_dist2d_pt_pt(ctx, p,A,dl);
-	}
-	if (r>=1)	/*If p projected on the line is outside point B or on point B*/
-	{
-		return rt_dist2d_pt_pt(ctx, p,B,dl);
-	}
-	
-	/*If the point p is on the segment this is a more robust way to find out that*/
-	if (( ((A->y-p->y)*(B->x-A->x)==(A->x-p->x)*(B->y-A->y) ) ) && (dl->mode ==  DIST_MIN))
-	{
-		dl->distance = 0.0;
-		dl->p1 = *p;
-		dl->p2 = *p;
-	}
-	
-	/*If the projection of point p on the segment is between A and B
-	then we find that "point on segment" and send it to rt_dist2d_pt_pt*/
-	c.x=A->x + r * (B->x-A->x);
-	c.y=A->y + r * (B->y-A->y);
-
-	return rt_dist2d_pt_pt(ctx, p,&c,dl);
+  RTPOINT2D c;
+  double  r;
+  /*if start==end, then use pt distance */
+  if (  ( A->x == B->x) && (A->y == B->y) )
+  {
+    return rt_dist2d_pt_pt(ctx, p,A,dl);
+  }
+  /*
+   * otherwise, we use comp.graphics.algorithms
+   * Frequently Asked Questions method
+   *
+   *  (1)        AC dot AB
+   *         r = ---------
+   *              ||AB||^2
+   *  r has the following meaning:
+   *  r=0 P = A
+   *  r=1 P = B
+   *  r<0 P is on the backward extension of AB
+   *  r>1 P is on the forward extension of AB
+   *  0<r<1 P is interior to AB
+   */
+
+  r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+
+  /*This is for finding the maxdistance.
+  the maxdistance have to be between two vertexes,
+  compared to mindistance which can be between
+  tvo vertexes vertex.*/
+  if (dl->mode == DIST_MAX)
+  {
+    if (r>=0.5)
+    {
+      return rt_dist2d_pt_pt(ctx, p,A,dl);
+    }
+    if (r<0.5)
+    {
+      return rt_dist2d_pt_pt(ctx, p,B,dl);
+    }
+  }
+
+  if (r<0)  /*If p projected on the line is outside point A*/
+  {
+    return rt_dist2d_pt_pt(ctx, p,A,dl);
+  }
+  if (r>=1)  /*If p projected on the line is outside point B or on point B*/
+  {
+    return rt_dist2d_pt_pt(ctx, p,B,dl);
+  }
+
+  /*If the point p is on the segment this is a more robust way to find out that*/
+  if (( ((A->y-p->y)*(B->x-A->x)==(A->x-p->x)*(B->y-A->y) ) ) && (dl->mode ==  DIST_MIN))
+  {
+    dl->distance = 0.0;
+    dl->p1 = *p;
+    dl->p2 = *p;
+  }
+
+  /*If the projection of point p on the segment is between A and B
+  then we find that "point on segment" and send it to rt_dist2d_pt_pt*/
+  c.x=A->x + r * (B->x-A->x);
+  c.y=A->y + r * (B->y-A->y);
+
+  return rt_dist2d_pt_pt(ctx, p,&c,dl);
 }
 
 
@@ -2127,26 +2127,26 @@ depending on dl->mode (max or min)
 int
 rt_dist2d_pt_pt(const RTCTX *ctx, const RTPOINT2D *thep1, const RTPOINT2D *thep2, DISTPTS *dl)
 {
-	double hside = thep2->x - thep1->x;
-	double vside = thep2->y - thep1->y;
-	double dist = sqrt ( hside*hside + vside*vside );
-
-	if (((dl->distance - dist)*(dl->mode))>0) /*multiplication with mode to handle mindistance (mode=1)  and maxdistance (mode = (-1)*/
-	{
-		dl->distance = dist;
-
-		if (dl->twisted>0)	/*To get the points in right order. twisted is updated between 1 and (-1) every time the order is changed earlier in the chain*/
-		{
-			dl->p1 = *thep1;
-			dl->p2 = *thep2;
-		}
-		else
-		{
-			dl->p1 = *thep2;
-			dl->p2 = *thep1;
-		}
-	}
-	return RT_TRUE;
+  double hside = thep2->x - thep1->x;
+  double vside = thep2->y - thep1->y;
+  double dist = sqrt ( hside*hside + vside*vside );
+
+  if (((dl->distance - dist)*(dl->mode))>0) /*multiplication with mode to handle mindistance (mode=1)  and maxdistance (mode = (-1)*/
+  {
+    dl->distance = dist;
+
+    if (dl->twisted>0)  /*To get the points in right order. twisted is updated between 1 and (-1) every time the order is changed earlier in the chain*/
+    {
+      dl->p1 = *thep1;
+      dl->p2 = *thep2;
+    }
+    else
+    {
+      dl->p1 = *thep2;
+      dl->p2 = *thep1;
+    }
+  }
+  return RT_TRUE;
 }
 
 
@@ -2163,20 +2163,20 @@ The old function nessecary for ptarray_segmentize2d in ptarray.c
 double
 distance2d_pt_pt(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2)
 {
-	double hside = p2->x - p1->x;
-	double vside = p2->y - p1->y;
+  double hside = p2->x - p1->x;
+  double vside = p2->y - p1->y;
 
-	return sqrt ( hside*hside + vside*vside );
+  return sqrt ( hside*hside + vside*vside );
 
 }
 
 double
 distance2d_sqr_pt_pt(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2)
 {
-	double hside = p2->x - p1->x;
-	double vside = p2->y - p1->y;
+  double hside = p2->x - p1->x;
+  double vside = p2->y - p1->y;
 
-	return  hside*hside + vside*vside;
+  return  hside*hside + vside*vside;
 
 }
 
@@ -2188,80 +2188,80 @@ The old function nessecary for ptarray_segmentize2d in ptarray.c
 double
 distance2d_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A, const RTPOINT2D *B)
 {
-	double	r,s;
-
-	/*if start==end, then use pt distance */
-	if (  ( A->x == B->x) && (A->y == B->y) )
-		return distance2d_pt_pt(ctx, p,A);
-
-	/*
-	 * otherwise, we use comp.graphics.algorithms
-	 * Frequently Asked Questions method
-	 *
-	 *  (1)     	      AC dot AB
-	        *         r = ---------
-	        *               ||AB||^2
-	 *	r has the following meaning:
-	 *	r=0 P = A
-	 *	r=1 P = B
-	 *	r<0 P is on the backward extension of AB
-	 *	r>1 P is on the forward extension of AB
-	 *	0<r<1 P is interior to AB
-	 */
-
-	r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
-
-	if (r<0) return distance2d_pt_pt(ctx, p,A);
-	if (r>1) return distance2d_pt_pt(ctx, p,B);
-
-
-	/*
-	 * (2)
-	 *	     (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
-	 *	s = -----------------------------
-	 *	             	L^2
-	 *
-	 *	Then the distance from C to P = |s|*L.
-	 *
-	 */
-
-	s = ( (A->y-p->y)*(B->x-A->x)- (A->x-p->x)*(B->y-A->y) ) /
-	    ( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
-
-	return FP_ABS(s) * sqrt(
-	           (B->x-A->x)*(B->x-A->x) + (B->y-A->y)*(B->y-A->y)
-	       );
+  double  r,s;
+
+  /*if start==end, then use pt distance */
+  if (  ( A->x == B->x) && (A->y == B->y) )
+    return distance2d_pt_pt(ctx, p,A);
+
+  /*
+   * otherwise, we use comp.graphics.algorithms
+   * Frequently Asked Questions method
+   *
+   *  (1)             AC dot AB
+          *         r = ---------
+          *               ||AB||^2
+   *  r has the following meaning:
+   *  r=0 P = A
+   *  r=1 P = B
+   *  r<0 P is on the backward extension of AB
+   *  r>1 P is on the forward extension of AB
+   *  0<r<1 P is interior to AB
+   */
+
+  r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+
+  if (r<0) return distance2d_pt_pt(ctx, p,A);
+  if (r>1) return distance2d_pt_pt(ctx, p,B);
+
+
+  /*
+   * (2)
+   *       (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
+   *  s = -----------------------------
+   *                 L^2
+   *
+   *  Then the distance from C to P = |s|*L.
+   *
+   */
+
+  s = ( (A->y-p->y)*(B->x-A->x)- (A->x-p->x)*(B->y-A->y) ) /
+      ( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+
+  return FP_ABS(s) * sqrt(
+             (B->x-A->x)*(B->x-A->x) + (B->y-A->y)*(B->y-A->y)
+         );
 }
 
 /* return distance squared, useful to avoid sqrt calculations */
 double
 distance2d_sqr_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A, const RTPOINT2D *B)
 {
-	double	r,s;
+  double  r,s;
 
-	if (  ( A->x == B->x) && (A->y == B->y) )
-		return distance2d_sqr_pt_pt(ctx, p,A);
+  if (  ( A->x == B->x) && (A->y == B->y) )
+    return distance2d_sqr_pt_pt(ctx, p,A);
 
-	r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+  r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
 
-	if (r<0) return distance2d_sqr_pt_pt(ctx, p,A);
-	if (r>1) return distance2d_sqr_pt_pt(ctx, p,B);
+  if (r<0) return distance2d_sqr_pt_pt(ctx, p,A);
+  if (r>1) return distance2d_sqr_pt_pt(ctx, p,B);
 
 
-	/*
-	 * (2)
-	 *	     (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
-	 *	s = -----------------------------
-	 *	             	L^2
-	 *
-	 *	Then the distance from C to P = |s|*L.
-	 *
-	 */
+  /*
+   * (2)
+   *       (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
+   *  s = -----------------------------
+   *                 L^2
+   *
+   *  Then the distance from C to P = |s|*L.
+   *
+   */
 
-	s = ( (A->y-p->y)*(B->x-A->x)- (A->x-p->x)*(B->y-A->y) ) /
-	    ( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+  s = ( (A->y-p->y)*(B->x-A->x)- (A->x-p->x)*(B->y-A->y) ) /
+      ( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
 
-	return s * s * ( (B->x-A->x)*(B->x-A->x) + (B->y-A->y)*(B->y-A->y) );
+  return s * s * ( (B->x-A->x)*(B->x-A->x) + (B->y-A->y)*(B->y-A->y) );
 }
 
 
@@ -2273,50 +2273,50 @@ distance2d_sqr_pt_seg(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINT2D *A,
 int
 azimuth_pt_pt(const RTCTX *ctx, const RTPOINT2D *A, const RTPOINT2D *B, double *d)
 {
-	if ( A->x == B->x )
-	{
-		if ( A->y < B->y ) *d=0.0;
-		else if ( A->y > B->y ) *d=M_PI;
-		else return 0;
-		return 1;
-	}
-
-	if ( A->y == B->y )
-	{
-		if ( A->x < B->x ) *d=M_PI/2;
-		else if ( A->x > B->x ) *d=M_PI+(M_PI/2);
-		else return 0;
-		return 1;
-	}
-
-	if ( A->x < B->x )
-	{
-		if ( A->y < B->y )
-		{
-			*d=atan(fabs(A->x - B->x) / fabs(A->y - B->y) );
-		}
-		else /* ( A->y > B->y )  - equality case handled above */
-		{
-			*d=atan(fabs(A->y - B->y) / fabs(A->x - B->x) )
-			   + (M_PI/2);
-		}
-	}
-
-	else /* ( A->x > B->x ) - equality case handled above */
-	{
-		if ( A->y > B->y )
-		{
-			*d=atan(fabs(A->x - B->x) / fabs(A->y - B->y) )
-			   + M_PI;
-		}
-		else /* ( A->y < B->y )  - equality case handled above */
-		{
-			*d=atan(fabs(A->y - B->y) / fabs(A->x - B->x) )
-			   + (M_PI+(M_PI/2));
-		}
-	}
-
-	return 1;
+  if ( A->x == B->x )
+  {
+    if ( A->y < B->y ) *d=0.0;
+    else if ( A->y > B->y ) *d=M_PI;
+    else return 0;
+    return 1;
+  }
+
+  if ( A->y == B->y )
+  {
+    if ( A->x < B->x ) *d=M_PI/2;
+    else if ( A->x > B->x ) *d=M_PI+(M_PI/2);
+    else return 0;
+    return 1;
+  }
+
+  if ( A->x < B->x )
+  {
+    if ( A->y < B->y )
+    {
+      *d=atan(fabs(A->x - B->x) / fabs(A->y - B->y) );
+    }
+    else /* ( A->y > B->y )  - equality case handled above */
+    {
+      *d=atan(fabs(A->y - B->y) / fabs(A->x - B->x) )
+         + (M_PI/2);
+    }
+  }
+
+  else /* ( A->x > B->x ) - equality case handled above */
+  {
+    if ( A->y > B->y )
+    {
+      *d=atan(fabs(A->x - B->x) / fabs(A->y - B->y) )
+         + M_PI;
+    }
+    else /* ( A->y < B->y )  - equality case handled above */
+    {
+      *d=atan(fabs(A->y - B->y) / fabs(A->x - B->x) )
+         + (M_PI+(M_PI/2));
+    }
+  }
+
+  return 1;
 }
 
 
diff --git a/src/measures.h b/src/measures.h
index 3789d5e..1f3e278 100644
--- a/src/measures.h
+++ b/src/measures.h
@@ -39,26 +39,26 @@
 #include "librttopo_geom_internal.h"
 
 /* for the measure functions*/
-#define DIST_MAX		-1
-#define DIST_MIN		1
+#define DIST_MAX    -1
+#define DIST_MIN    1
 
-/** 
+/**
 * Structure used in distance-calculations
 */
 typedef struct
 {
-	double distance;	/*the distance between p1 and p2*/
-	RTPOINT2D p1;
-	RTPOINT2D p2;
-	int mode;	/*the direction of looking, if thedir = -1 then we look for maxdistance and if it is 1 then we look for mindistance*/
-	int twisted; /*To preserve the order of incoming points to match the first and secon point in shortest and longest line*/
-	double tolerance; /*the tolerance for dwithin and dfullywithin*/
+  double distance;  /*the distance between p1 and p2*/
+  RTPOINT2D p1;
+  RTPOINT2D p2;
+  int mode;  /*the direction of looking, if thedir = -1 then we look for maxdistance and if it is 1 then we look for mindistance*/
+  int twisted; /*To preserve the order of incoming points to match the first and secon point in shortest and longest line*/
+  double tolerance; /*the tolerance for dwithin and dfullywithin*/
 } DISTPTS;
 
 typedef struct
 {
-	double themeasure;	/*a value calculated to compare distances*/
-	int pnr;	/*pointnumber. the ordernumber of the point*/
+  double themeasure;  /*a value calculated to compare distances*/
+  int pnr;  /*pointnumber. the ordernumber of the point*/
 } LISTSTRUCT;
 
 
@@ -105,7 +105,7 @@ int struct_cmp_by_measure(const void *a, const void *b);
 int rt_dist2d_fast_ptarray_ptarray(const RTCTX *ctx, RTPOINTARRAY *l1,RTPOINTARRAY *l2, DISTPTS *dl,  RTGBOX *box1, RTGBOX *box2);
 
 /*
-* Distance calculation primitives. 
+* Distance calculation primitives.
 */
 int rt_dist2d_pt_pt(const RTCTX *ctx, const RTPOINT2D *P,  const RTPOINT2D *Q,  DISTPTS *dl);
 int rt_dist2d_pt_seg(const RTCTX *ctx, const RTPOINT2D *P,  const RTPOINT2D *A1, const RTPOINT2D *A2, DISTPTS *dl);
diff --git a/src/measures3d.c b/src/measures3d.c
index 799d90a..f432f88 100644
--- a/src/measures3d.c
+++ b/src/measures3d.c
@@ -46,62 +46,62 @@
 static inline int
 get_3dvector_from_points(const RTCTX *ctx, RTPOINT3DZ *p1,RTPOINT3DZ *p2, VECTOR3D *v)
 {
-	v->x=p2->x-p1->x;
-	v->y=p2->y-p1->y;
-	v->z=p2->z-p1->z;
-	
-	return RT_TRUE;
+  v->x=p2->x-p1->x;
+  v->y=p2->y-p1->y;
+  v->z=p2->z-p1->z;
+
+  return RT_TRUE;
 }
 
 static inline int
 get_3dcross_product(const RTCTX *ctx, VECTOR3D *v1,VECTOR3D *v2, VECTOR3D *v)
 {
-	v->x=(v1->y*v2->z)-(v1->z*v2->y);
-	v->y=(v1->z*v2->x)-(v1->x*v2->z);
-	v->z=(v1->x*v2->y)-(v1->y*v2->x);
+  v->x=(v1->y*v2->z)-(v1->z*v2->y);
+  v->y=(v1->z*v2->x)-(v1->x*v2->z);
+  v->z=(v1->x*v2->y)-(v1->y*v2->x);
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 
 /**
-This function is used to create a vertical line used for cases where one if the 
-geometries lacks z-values. The vertical line crosses the 2d point that is closest 
+This function is used to create a vertical line used for cases where one if the
+geometries lacks z-values. The vertical line crosses the 2d point that is closest
 and the z-range is from maxz to minz in the geoemtrie that has z values.
 */
-static 
+static
 RTGEOM* create_v_line(const RTCTX *ctx, const RTGEOM *rtgeom,double x, double y, int srid)
 {
-	
-	RTPOINT *rtpoints[2];
-	RTGBOX gbox;
-	int rv = rtgeom_calculate_gbox(ctx, rtgeom, &gbox);
-	
-	if ( rv == RT_FAILURE )
-		return NULL;
-	
-	rtpoints[0] = rtpoint_make3dz(ctx, srid, x, y, gbox.zmin);
-	rtpoints[1] = rtpoint_make3dz(ctx, srid, x, y, gbox.zmax);
-	
-	 return (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);		
+
+  RTPOINT *rtpoints[2];
+  RTGBOX gbox;
+  int rv = rtgeom_calculate_gbox(ctx, rtgeom, &gbox);
+
+  if ( rv == RT_FAILURE )
+    return NULL;
+
+  rtpoints[0] = rtpoint_make3dz(ctx, srid, x, y, gbox.zmin);
+  rtpoints[1] = rtpoint_make3dz(ctx, srid, x, y, gbox.zmax);
+
+   return (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);
 }
 
-RTGEOM * 
+RTGEOM *
 rtgeom_closest_line_3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	return rt_dist3d_distanceline(ctx, rt1, rt2, rt1->srid, DIST_MIN);
+  return rt_dist3d_distanceline(ctx, rt1, rt2, rt1->srid, DIST_MIN);
 }
 
-RTGEOM * 
+RTGEOM *
 rtgeom_furthest_line_3d(const RTCTX *ctx, RTGEOM *rt1, RTGEOM *rt2)
 {
-	return rt_dist3d_distanceline(ctx, rt1, rt2, rt1->srid, DIST_MAX);
+  return rt_dist3d_distanceline(ctx, rt1, rt2, rt1->srid, DIST_MAX);
 }
 
-RTGEOM * 
+RTGEOM *
 rtgeom_closest_point_3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	return rt_dist3d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MIN);
+  return rt_dist3d_distancepoint(ctx, rt1, rt2, rt1->srid, DIST_MIN);
 }
 
 
@@ -111,102 +111,102 @@ Function initializing 3dshortestline and 3dlongestline calculations.
 RTGEOM *
 rt_dist3d_distanceline(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, int srid, int mode)
 {
-	RTDEBUG(2, "rt_dist3d_distanceline is called");
-	double x1,x2,y1,y2, z1, z2, x, y;
-	double initdistance = ( mode == DIST_MIN ? FLT_MAX : -1.0);
-	DISTPTS3D thedl;
-	RTPOINT *rtpoints[2];
-	RTGEOM *result;
-
-	thedl.mode = mode;
-	thedl.distance = initdistance;
-	thedl.tolerance = 0.0;
-
-	/*Check if we really have 3D geoemtries*/
-	/*If not, send it to 2D-calculations which will give the same result*/
-	/*as an infinite z-value at one or two of the geometries*/
-	if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
-	{
-		
-		rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
-		
-		if(!rtgeom_has_z(ctx, rt1) && !rtgeom_has_z(ctx, rt2))
-			return rt_dist2d_distanceline(ctx, rt1, rt2, srid, mode);	
-		
-		DISTPTS thedl2d;
-		thedl2d.mode = mode;
-		thedl2d.distance = initdistance;
-		thedl2d.tolerance = 0.0;
-		if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl2d))
-		{
-			/*should never get here. all cases ought to be error handled earlier*/
-			rterror(ctx, "Some unspecified error.");
-			result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-		}
-		RTGEOM *vertical_line;
-		if(!rtgeom_has_z(ctx, rt1))
-		{
-			x=thedl2d.p1.x;
-			y=thedl2d.p1.y;
-
-			vertical_line = create_v_line(ctx, rt2,x,y,srid);
-			if (!rt_dist3d_recursive(ctx, vertical_line, rt2, &thedl))
-			{
-				/*should never get here. all cases ought to be error handled earlier*/
-				rtfree(ctx, vertical_line);
-				rterror(ctx, "Some unspecified error.");
-				result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-			}			
-			rtfree(ctx, vertical_line);	
-		}	
-		if(!rtgeom_has_z(ctx, rt2))
-		{
-			x=thedl2d.p2.x;
-			y=thedl2d.p2.y;			
-			
-			vertical_line = create_v_line(ctx, rt1,x,y,srid);
-			if (!rt_dist3d_recursive(ctx, rt1, vertical_line, &thedl))
-			{
-				/*should never get here. all cases ought to be error handled earlier*/
-				rtfree(ctx, vertical_line);
-				rterror(ctx, "Some unspecified error.");
-				return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-			}	
-			rtfree(ctx, vertical_line);		
-		}			
-				
-	}
-	else
-	{		
-		if (!rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
-		{
-			/*should never get here. all cases ought to be error handled earlier*/
-			rterror(ctx, "Some unspecified error.");
-			result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-		}
-	}
-	/*if thedl.distance is unchanged there where only empty geometries input*/
-	if (thedl.distance == initdistance)
-	{
-		RTDEBUG(3, "didn't find geometries to measure between, returning null");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-	else
-	{
-		x1=thedl.p1.x;
-		y1=thedl.p1.y;
-		z1=thedl.p1.z;
-		x2=thedl.p2.x;
-		y2=thedl.p2.y;
-		z2=thedl.p2.z;
-
-		rtpoints[0] = rtpoint_make3dz(ctx, srid, x1, y1, z1);
-		rtpoints[1] = rtpoint_make3dz(ctx, srid, x2, y2, z2);
-
-		result = (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);
-	}
-
-	return result;
+  RTDEBUG(2, "rt_dist3d_distanceline is called");
+  double x1,x2,y1,y2, z1, z2, x, y;
+  double initdistance = ( mode == DIST_MIN ? FLT_MAX : -1.0);
+  DISTPTS3D thedl;
+  RTPOINT *rtpoints[2];
+  RTGEOM *result;
+
+  thedl.mode = mode;
+  thedl.distance = initdistance;
+  thedl.tolerance = 0.0;
+
+  /*Check if we really have 3D geoemtries*/
+  /*If not, send it to 2D-calculations which will give the same result*/
+  /*as an infinite z-value at one or two of the geometries*/
+  if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
+  {
+
+    rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
+
+    if(!rtgeom_has_z(ctx, rt1) && !rtgeom_has_z(ctx, rt2))
+      return rt_dist2d_distanceline(ctx, rt1, rt2, srid, mode);
+
+    DISTPTS thedl2d;
+    thedl2d.mode = mode;
+    thedl2d.distance = initdistance;
+    thedl2d.tolerance = 0.0;
+    if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl2d))
+    {
+      /*should never get here. all cases ought to be error handled earlier*/
+      rterror(ctx, "Some unspecified error.");
+      result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+    }
+    RTGEOM *vertical_line;
+    if(!rtgeom_has_z(ctx, rt1))
+    {
+      x=thedl2d.p1.x;
+      y=thedl2d.p1.y;
+
+      vertical_line = create_v_line(ctx, rt2,x,y,srid);
+      if (!rt_dist3d_recursive(ctx, vertical_line, rt2, &thedl))
+      {
+        /*should never get here. all cases ought to be error handled earlier*/
+        rtfree(ctx, vertical_line);
+        rterror(ctx, "Some unspecified error.");
+        result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+      }
+      rtfree(ctx, vertical_line);
+    }
+    if(!rtgeom_has_z(ctx, rt2))
+    {
+      x=thedl2d.p2.x;
+      y=thedl2d.p2.y;
+
+      vertical_line = create_v_line(ctx, rt1,x,y,srid);
+      if (!rt_dist3d_recursive(ctx, rt1, vertical_line, &thedl))
+      {
+        /*should never get here. all cases ought to be error handled earlier*/
+        rtfree(ctx, vertical_line);
+        rterror(ctx, "Some unspecified error.");
+        return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+      }
+      rtfree(ctx, vertical_line);
+    }
+
+  }
+  else
+  {
+    if (!rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
+    {
+      /*should never get here. all cases ought to be error handled earlier*/
+      rterror(ctx, "Some unspecified error.");
+      result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+    }
+  }
+  /*if thedl.distance is unchanged there where only empty geometries input*/
+  if (thedl.distance == initdistance)
+  {
+    RTDEBUG(3, "didn't find geometries to measure between, returning null");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+  else
+  {
+    x1=thedl.p1.x;
+    y1=thedl.p1.y;
+    z1=thedl.p1.z;
+    x2=thedl.p2.x;
+    y2=thedl.p2.y;
+    z2=thedl.p2.z;
+
+    rtpoints[0] = rtpoint_make3dz(ctx, srid, x1, y1, z1);
+    rtpoints[1] = rtpoint_make3dz(ctx, srid, x2, y2, z2);
+
+    result = (RTGEOM *)rtline_from_ptarray(ctx, srid, 2, rtpoints);
+  }
+
+  return result;
 }
 
 /**
@@ -215,97 +215,97 @@ Function initializing 3dclosestpoint calculations.
 RTGEOM *
 rt_dist3d_distancepoint(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, int srid, int mode)
 {
-	
-	double x,y,z;
-	DISTPTS3D thedl;
-	double initdistance = FLT_MAX;
-	RTGEOM *result;
-
-	thedl.mode = mode;
-	thedl.distance= initdistance;
-	thedl.tolerance = 0;
-
-	RTDEBUG(2, "rt_dist3d_distancepoint is called");
-	
-	/*Check if we really have 3D geoemtries*/
-	/*If not, send it to 2D-calculations which will give the same result*/
-	/*as an infinite z-value at one or two of the geometries*/
-	if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
-	{		
-		rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
-				
-		if(!rtgeom_has_z(ctx, rt1) && !rtgeom_has_z(ctx, rt2))
-			return rt_dist2d_distancepoint(ctx, rt1, rt2, srid, mode);
-			
-		
-		DISTPTS thedl2d;
-		thedl2d.mode = mode;
-		thedl2d.distance = initdistance;
-		thedl2d.tolerance = 0.0;
-		if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl2d))
-		{
-			/*should never get here. all cases ought to be error handled earlier*/
-			rterror(ctx, "Some unspecified error.");
-			return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-		}
-		
-		RTGEOM *vertical_line;
-		if(!rtgeom_has_z(ctx, rt1))
-		{
-			x=thedl2d.p1.x;
-			y=thedl2d.p1.y;
-			
-			vertical_line = create_v_line(ctx, rt2,x,y,srid);	
-			if (!rt_dist3d_recursive(ctx, vertical_line, rt2, &thedl))
-			{
-				/*should never get here. all cases ought to be error handled earlier*/
-				rtfree(ctx, vertical_line);	
-				rterror(ctx, "Some unspecified error.");
-				return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-			}		
-			rtfree(ctx, vertical_line);		
-		}	
-				
-		if(!rtgeom_has_z(ctx, rt2))
-		{
-			x=thedl2d.p2.x;
-			y=thedl2d.p2.y;
-
-			vertical_line = create_v_line(ctx, rt1,x,y,srid);
-			if (!rt_dist3d_recursive(ctx, rt1, vertical_line, &thedl))
-			{
-				/*should never get here. all cases ought to be error handled earlier*/
-				rtfree(ctx, vertical_line);	
-				rterror(ctx, "Some unspecified error.");
-				result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-			}	
-			rtfree(ctx, vertical_line);			
-		}	
-		
-	}
-	else
-	{
-		if (!rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
-		{
-			/*should never get here. all cases ought to be error handled earlier*/
-			rterror(ctx, "Some unspecified error.");
-			result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-		}
-	}
-	if (thedl.distance == initdistance)
-	{
-		RTDEBUG(3, "didn't find geometries to measure between, returning null");
-		result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
-	}
-	else
-	{
-		x=thedl.p1.x;
-		y=thedl.p1.y;
-		z=thedl.p1.z;
-		result = (RTGEOM *)rtpoint_make3dz(ctx, srid, x, y, z);
-	}
-
-	return result;
+
+  double x,y,z;
+  DISTPTS3D thedl;
+  double initdistance = FLT_MAX;
+  RTGEOM *result;
+
+  thedl.mode = mode;
+  thedl.distance= initdistance;
+  thedl.tolerance = 0;
+
+  RTDEBUG(2, "rt_dist3d_distancepoint is called");
+
+  /*Check if we really have 3D geoemtries*/
+  /*If not, send it to 2D-calculations which will give the same result*/
+  /*as an infinite z-value at one or two of the geometries*/
+  if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
+  {
+    rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
+
+    if(!rtgeom_has_z(ctx, rt1) && !rtgeom_has_z(ctx, rt2))
+      return rt_dist2d_distancepoint(ctx, rt1, rt2, srid, mode);
+
+
+    DISTPTS thedl2d;
+    thedl2d.mode = mode;
+    thedl2d.distance = initdistance;
+    thedl2d.tolerance = 0.0;
+    if (!rt_dist2d_comp(ctx,  rt1,rt2,&thedl2d))
+    {
+      /*should never get here. all cases ought to be error handled earlier*/
+      rterror(ctx, "Some unspecified error.");
+      return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+    }
+
+    RTGEOM *vertical_line;
+    if(!rtgeom_has_z(ctx, rt1))
+    {
+      x=thedl2d.p1.x;
+      y=thedl2d.p1.y;
+
+      vertical_line = create_v_line(ctx, rt2,x,y,srid);
+      if (!rt_dist3d_recursive(ctx, vertical_line, rt2, &thedl))
+      {
+        /*should never get here. all cases ought to be error handled earlier*/
+        rtfree(ctx, vertical_line);
+        rterror(ctx, "Some unspecified error.");
+        return (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+      }
+      rtfree(ctx, vertical_line);
+    }
+
+    if(!rtgeom_has_z(ctx, rt2))
+    {
+      x=thedl2d.p2.x;
+      y=thedl2d.p2.y;
+
+      vertical_line = create_v_line(ctx, rt1,x,y,srid);
+      if (!rt_dist3d_recursive(ctx, rt1, vertical_line, &thedl))
+      {
+        /*should never get here. all cases ought to be error handled earlier*/
+        rtfree(ctx, vertical_line);
+        rterror(ctx, "Some unspecified error.");
+        result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+      }
+      rtfree(ctx, vertical_line);
+    }
+
+  }
+  else
+  {
+    if (!rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
+    {
+      /*should never get here. all cases ought to be error handled earlier*/
+      rterror(ctx, "Some unspecified error.");
+      result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+    }
+  }
+  if (thedl.distance == initdistance)
+  {
+    RTDEBUG(3, "didn't find geometries to measure between, returning null");
+    result = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, srid, 0, 0);
+  }
+  else
+  {
+    x=thedl.p1.x;
+    y=thedl.p1.y;
+    z=thedl.p1.z;
+    result = (RTGEOM *)rtpoint_make3dz(ctx, srid, x, y, z);
+  }
+
+  return result;
 }
 
 
@@ -315,9 +315,9 @@ Function initializing 3d max distance calculation
 double
 rtgeom_maxdistance3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	RTDEBUG(2, "rtgeom_maxdistance3d is called");
+  RTDEBUG(2, "rtgeom_maxdistance3d is called");
 
-	return rtgeom_maxdistance3d_tolerance(ctx,  rt1, rt2, 0.0 );
+  return rtgeom_maxdistance3d_tolerance(ctx,  rt1, rt2, 0.0 );
 }
 
 /**
@@ -327,61 +327,61 @@ The difference is just the tolerance.
 double
 rtgeom_maxdistance3d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance)
 {
-	if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
-	{
-		rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
-		return rtgeom_maxdistance2d_tolerance(ctx, rt1, rt2, tolerance);	
-	}
-	/*double thedist;*/
-	DISTPTS3D thedl;
-	RTDEBUG(2, "rtgeom_maxdistance3d_tolerance is called");
-	thedl.mode = DIST_MAX;
-	thedl.distance= -1;
-	thedl.tolerance = tolerance;
-	if (rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
-	{
-		return thedl.distance;
-	}
-	/*should never get here. all cases ought to be error handled earlier*/
-	rterror(ctx, "Some unspecified error.");
-	return -1;
+  if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
+  {
+    rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
+    return rtgeom_maxdistance2d_tolerance(ctx, rt1, rt2, tolerance);
+  }
+  /*double thedist;*/
+  DISTPTS3D thedl;
+  RTDEBUG(2, "rtgeom_maxdistance3d_tolerance is called");
+  thedl.mode = DIST_MAX;
+  thedl.distance= -1;
+  thedl.tolerance = tolerance;
+  if (rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
+  {
+    return thedl.distance;
+  }
+  /*should never get here. all cases ought to be error handled earlier*/
+  rterror(ctx, "Some unspecified error.");
+  return -1;
 }
 
 /**
-	Function initializing 3d min distance calculation
+  Function initializing 3d min distance calculation
 */
 double
 rtgeom_mindistance3d(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2)
 {
-	RTDEBUG(2, "rtgeom_mindistance3d is called");
-	return rtgeom_mindistance3d_tolerance(ctx,  rt1, rt2, 0.0 );
+  RTDEBUG(2, "rtgeom_mindistance3d is called");
+  return rtgeom_mindistance3d_tolerance(ctx,  rt1, rt2, 0.0 );
 }
 
 /**
-	Function handling 3d min distance calculations and dwithin calculations.
-	The difference is just the tolerance.
+  Function handling 3d min distance calculations and dwithin calculations.
+  The difference is just the tolerance.
 */
 double
 rtgeom_mindistance3d_tolerance(const RTCTX *ctx, const RTGEOM *rt1, const RTGEOM *rt2, double tolerance)
 {
-	if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
-	{
-		rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
-		
-		return rtgeom_mindistance2d_tolerance(ctx, rt1, rt2, tolerance);	
-	}
-	DISTPTS3D thedl;
-	RTDEBUG(2, "rtgeom_mindistance3d_tolerance is called");
-	thedl.mode = DIST_MIN;
-	thedl.distance= FLT_MAX;
-	thedl.tolerance = tolerance;
-	if (rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
-	{
-		return thedl.distance;
-	}
-	/*should never get here. all cases ought to be error handled earlier*/
-	rterror(ctx, "Some unspecified error.");
-	return FLT_MAX;
+  if(!rtgeom_has_z(ctx, rt1) || !rtgeom_has_z(ctx, rt2))
+  {
+    rtnotice(ctx, "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
+
+    return rtgeom_mindistance2d_tolerance(ctx, rt1, rt2, tolerance);
+  }
+  DISTPTS3D thedl;
+  RTDEBUG(2, "rtgeom_mindistance3d_tolerance is called");
+  thedl.mode = DIST_MIN;
+  thedl.distance= FLT_MAX;
+  thedl.tolerance = tolerance;
+  if (rt_dist3d_recursive(ctx, rt1, rt2, &thedl))
+  {
+    return thedl.distance;
+  }
+  /*should never get here. all cases ought to be error handled earlier*/
+  rterror(ctx, "Some unspecified error.");
+  return FLT_MAX;
 }
 
 
@@ -400,76 +400,76 @@ This is a recursive function delivering every possible combination of subgeometr
 */
 int rt_dist3d_recursive(const RTCTX *ctx, const RTGEOM *rtg1,const RTGEOM *rtg2, DISTPTS3D *dl)
 {
-	int i, j;
-	int n1=1;
-	int n2=1;
-	RTGEOM *g1 = NULL;
-	RTGEOM *g2 = NULL;
-	RTCOLLECTION *c1 = NULL;
-	RTCOLLECTION *c2 = NULL;
-
-	RTDEBUGF(2, "rt_dist3d_recursive is called with type1=%d, type2=%d", rtg1->type, rtg2->type);
-
-	if (rtgeom_is_collection(ctx, rtg1))
-	{
-		RTDEBUG(3, "First geometry is collection");
-		c1 = rtgeom_as_rtcollection(ctx, rtg1);
-		n1 = c1->ngeoms;
-	}
-	if (rtgeom_is_collection(ctx, rtg2))
-	{
-		RTDEBUG(3, "Second geometry is collection");
-		c2 = rtgeom_as_rtcollection(ctx, rtg2);
-		n2 = c2->ngeoms;
-	}
-
-	for ( i = 0; i < n1; i++ )
-	{
-
-		if (rtgeom_is_collection(ctx, rtg1))
-		{
-			g1 = c1->geoms[i];
-		}
-		else
-		{
-			g1 = (RTGEOM*)rtg1;
-		}
-
-		if (rtgeom_is_empty(ctx, g1)) return RT_TRUE;
-
-		if (rtgeom_is_collection(ctx, g1))
-		{
-			RTDEBUG(3, "Found collection inside first geometry collection, recursing");
-			if (!rt_dist3d_recursive(ctx, g1, rtg2, dl)) return RT_FALSE;
-			continue;
-		}
-		for ( j = 0; j < n2; j++ )
-		{
-			if (rtgeom_is_collection(ctx, rtg2))
-			{
-				g2 = c2->geoms[j];
-			}
-			else
-			{
-				g2 = (RTGEOM*)rtg2;
-			}
-			if (rtgeom_is_collection(ctx, g2))
-			{
-				RTDEBUG(3, "Found collection inside second geometry collection, recursing");
-				if (!rt_dist3d_recursive(ctx, g1, g2, dl)) return RT_FALSE;
-				continue;
-			}
-
-
-			/*If one of geometries is empty, return. True here only means continue searching. False would have stoped the process*/
-			if (rtgeom_is_empty(ctx, g1)||rtgeom_is_empty(ctx, g2)) return RT_TRUE;
-
-
-			if (!rt_dist3d_distribute_bruteforce(ctx, g1, g2, dl)) return RT_FALSE;
-			if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
-		}
-	}
-	return RT_TRUE;
+  int i, j;
+  int n1=1;
+  int n2=1;
+  RTGEOM *g1 = NULL;
+  RTGEOM *g2 = NULL;
+  RTCOLLECTION *c1 = NULL;
+  RTCOLLECTION *c2 = NULL;
+
+  RTDEBUGF(2, "rt_dist3d_recursive is called with type1=%d, type2=%d", rtg1->type, rtg2->type);
+
+  if (rtgeom_is_collection(ctx, rtg1))
+  {
+    RTDEBUG(3, "First geometry is collection");
+    c1 = rtgeom_as_rtcollection(ctx, rtg1);
+    n1 = c1->ngeoms;
+  }
+  if (rtgeom_is_collection(ctx, rtg2))
+  {
+    RTDEBUG(3, "Second geometry is collection");
+    c2 = rtgeom_as_rtcollection(ctx, rtg2);
+    n2 = c2->ngeoms;
+  }
+
+  for ( i = 0; i < n1; i++ )
+  {
+
+    if (rtgeom_is_collection(ctx, rtg1))
+    {
+      g1 = c1->geoms[i];
+    }
+    else
+    {
+      g1 = (RTGEOM*)rtg1;
+    }
+
+    if (rtgeom_is_empty(ctx, g1)) return RT_TRUE;
+
+    if (rtgeom_is_collection(ctx, g1))
+    {
+      RTDEBUG(3, "Found collection inside first geometry collection, recursing");
+      if (!rt_dist3d_recursive(ctx, g1, rtg2, dl)) return RT_FALSE;
+      continue;
+    }
+    for ( j = 0; j < n2; j++ )
+    {
+      if (rtgeom_is_collection(ctx, rtg2))
+      {
+        g2 = c2->geoms[j];
+      }
+      else
+      {
+        g2 = (RTGEOM*)rtg2;
+      }
+      if (rtgeom_is_collection(ctx, g2))
+      {
+        RTDEBUG(3, "Found collection inside second geometry collection, recursing");
+        if (!rt_dist3d_recursive(ctx, g1, g2, dl)) return RT_FALSE;
+        continue;
+      }
+
+
+      /*If one of geometries is empty, return. True here only means continue searching. False would have stoped the process*/
+      if (rtgeom_is_empty(ctx, g1)||rtgeom_is_empty(ctx, g2)) return RT_TRUE;
+
+
+      if (!rt_dist3d_distribute_bruteforce(ctx, g1, g2, dl)) return RT_FALSE;
+      if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+    }
+  }
+  return RT_TRUE;
 }
 
 
@@ -482,88 +482,88 @@ int
 rt_dist3d_distribute_bruteforce(const RTCTX *ctx, const RTGEOM *rtg1, const RTGEOM *rtg2, DISTPTS3D *dl)
 {
 
-	int	t1 = rtg1->type;
-	int	t2 = rtg2->type;
-
-	RTDEBUGF(2, "rt_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", rtg1->type, rtg2->type);
-
-	if  ( t1 == RTPOINTTYPE )
-	{
-		if  ( t2 == RTPOINTTYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_point_point(ctx, (RTPOINT *)rtg1, (RTPOINT *)rtg2, dl);
-		}
-		else if  ( t2 == RTLINETYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_point_line(ctx, (RTPOINT *)rtg1, (RTLINE *)rtg2, dl);
-		}
-		else if  ( t2 == RTPOLYGONTYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_point_poly(ctx, (RTPOINT *)rtg1, (RTPOLY *)rtg2,dl);
-		}
-		else
-		{
-			rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			return RT_FALSE;
-		}
-	}
-	else if ( t1 == RTLINETYPE )
-	{
-		if ( t2 == RTPOINTTYPE )
-		{
-			dl->twisted=(-1);
-			return rt_dist3d_point_line(ctx, (RTPOINT *)rtg2,(RTLINE *)rtg1,dl);
-		}
-		else if ( t2 == RTLINETYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_line_line(ctx, (RTLINE *)rtg1,(RTLINE *)rtg2,dl);
-		}
-		else if ( t2 == RTPOLYGONTYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_line_poly(ctx, (RTLINE *)rtg1,(RTPOLY *)rtg2,dl);
-		}
-		else
-		{
-			rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			return RT_FALSE;
-		}
-	}
-	else if ( t1 == RTPOLYGONTYPE )
-	{
-		if ( t2 == RTPOLYGONTYPE )
-		{
-			dl->twisted=1;
-			return rt_dist3d_poly_poly(ctx, (RTPOLY *)rtg1, (RTPOLY *)rtg2,dl);
-		}
-		else if ( t2 == RTPOINTTYPE )
-		{
-			dl->twisted=-1;
-			return rt_dist3d_point_poly(ctx, (RTPOINT *)rtg2, (RTPOLY *)rtg1,dl);
-		}
-		else if ( t2 == RTLINETYPE )
-		{
-			dl->twisted=-1;
-			return rt_dist3d_line_poly(ctx, (RTLINE *)rtg2,(RTPOLY *)rtg1,dl);
-		}
-		else
-		{
-			rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
-			return RT_FALSE;
-		}
-	}
-	else
-	{
-		rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t1));
-		return RT_FALSE;
-	}
-	/*You shouldn't being able to get here*/
-	rterror(ctx, "unspecified error in function rt_dist3d_distribute_bruteforce");
-	return RT_FALSE;
+  int  t1 = rtg1->type;
+  int  t2 = rtg2->type;
+
+  RTDEBUGF(2, "rt_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", rtg1->type, rtg2->type);
+
+  if  ( t1 == RTPOINTTYPE )
+  {
+    if  ( t2 == RTPOINTTYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_point_point(ctx, (RTPOINT *)rtg1, (RTPOINT *)rtg2, dl);
+    }
+    else if  ( t2 == RTLINETYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_point_line(ctx, (RTPOINT *)rtg1, (RTLINE *)rtg2, dl);
+    }
+    else if  ( t2 == RTPOLYGONTYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_point_poly(ctx, (RTPOINT *)rtg1, (RTPOLY *)rtg2,dl);
+    }
+    else
+    {
+      rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      return RT_FALSE;
+    }
+  }
+  else if ( t1 == RTLINETYPE )
+  {
+    if ( t2 == RTPOINTTYPE )
+    {
+      dl->twisted=(-1);
+      return rt_dist3d_point_line(ctx, (RTPOINT *)rtg2,(RTLINE *)rtg1,dl);
+    }
+    else if ( t2 == RTLINETYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_line_line(ctx, (RTLINE *)rtg1,(RTLINE *)rtg2,dl);
+    }
+    else if ( t2 == RTPOLYGONTYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_line_poly(ctx, (RTLINE *)rtg1,(RTPOLY *)rtg2,dl);
+    }
+    else
+    {
+      rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      return RT_FALSE;
+    }
+  }
+  else if ( t1 == RTPOLYGONTYPE )
+  {
+    if ( t2 == RTPOLYGONTYPE )
+    {
+      dl->twisted=1;
+      return rt_dist3d_poly_poly(ctx, (RTPOLY *)rtg1, (RTPOLY *)rtg2,dl);
+    }
+    else if ( t2 == RTPOINTTYPE )
+    {
+      dl->twisted=-1;
+      return rt_dist3d_point_poly(ctx, (RTPOINT *)rtg2, (RTPOLY *)rtg1,dl);
+    }
+    else if ( t2 == RTLINETYPE )
+    {
+      dl->twisted=-1;
+      return rt_dist3d_line_poly(ctx, (RTLINE *)rtg2,(RTPOLY *)rtg1,dl);
+    }
+    else
+    {
+      rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t2));
+      return RT_FALSE;
+    }
+  }
+  else
+  {
+    rterror(ctx, "Unsupported geometry type: %s", rttype_name(ctx, t1));
+    return RT_FALSE;
+  }
+  /*You shouldn't being able to get here*/
+  rterror(ctx, "unspecified error in function rt_dist3d_distribute_bruteforce");
+  return RT_FALSE;
 }
 
 
@@ -585,14 +585,14 @@ point to point calculation
 int
 rt_dist3d_point_point(const RTCTX *ctx, RTPOINT *point1, RTPOINT *point2, DISTPTS3D *dl)
 {
-	RTPOINT3DZ p1;
-	RTPOINT3DZ p2;
-	RTDEBUG(2, "rt_dist3d_point_point is called");
+  RTPOINT3DZ p1;
+  RTPOINT3DZ p2;
+  RTDEBUG(2, "rt_dist3d_point_point is called");
 
-	rt_getPoint3dz_p(ctx, point1->point, 0, &p1);
-	rt_getPoint3dz_p(ctx, point2->point, 0, &p2);
+  rt_getPoint3dz_p(ctx, point1->point, 0, &p1);
+  rt_getPoint3dz_p(ctx, point2->point, 0, &p2);
 
-	return rt_dist3d_pt_pt(ctx, &p1, &p2,dl);
+  return rt_dist3d_pt_pt(ctx, &p1, &p2,dl);
 }
 /**
 
@@ -601,20 +601,20 @@ point to line calculation
 int
 rt_dist3d_point_line(const RTCTX *ctx, RTPOINT *point, RTLINE *line, DISTPTS3D *dl)
 {
-	RTPOINT3DZ p;
-	RTPOINTARRAY *pa = line->points;
-	RTDEBUG(2, "rt_dist3d_point_line is called");
+  RTPOINT3DZ p;
+  RTPOINTARRAY *pa = line->points;
+  RTDEBUG(2, "rt_dist3d_point_line is called");
 
-	rt_getPoint3dz_p(ctx, point->point, 0, &p);
-	return rt_dist3d_pt_ptarray(ctx, &p, pa, dl);
+  rt_getPoint3dz_p(ctx, point->point, 0, &p);
+  return rt_dist3d_pt_ptarray(ctx, &p, pa, dl);
 }
 
 /**
 
 Computes point to polygon distance
 For mindistance that means:
-1)find the plane of the polygon 
-2)projecting the point to the plane of the polygon 
+1)find the plane of the polygon
+2)projecting the point to the plane of the polygon
 3)finding if that projected point is inside the polygon, if so the distance is measured to that projected point
 4) if not in polygon above, check the distance against the boundary of the polygon
 for max distance it is artays point against boundary
@@ -623,26 +623,26 @@ for max distance it is artays point against boundary
 int
 rt_dist3d_point_poly(const RTCTX *ctx, RTPOINT *point, RTPOLY *poly, DISTPTS3D *dl)
 {
-	RTPOINT3DZ p, projp;/*projp is "point projected on plane"*/
-	PLANE3D plane;
-	RTDEBUG(2, "rt_dist3d_point_poly is called");
-	rt_getPoint3dz_p(ctx, point->point, 0, &p);
-	
-	/*If we are lookig for max distance, longestline or dfullywithin*/
-	if (dl->mode == DIST_MAX)
-	{
-		RTDEBUG(3, "looking for maxdistance");
-		return rt_dist3d_pt_ptarray(ctx, &p, poly->rings[0], dl);
-	}
-	
-	/*Find the plane of the polygon, the "holes" have to be on the same plane. so we only care about the boudary*/
-	if(!define_plane(ctx, poly->rings[0], &plane))
-		return RT_FALSE;
-	
-	/*get our point projected on the plane of the polygon*/
-	project_point_on_plane(ctx, &p, &plane, &projp);
-	
-	return rt_dist3d_pt_poly(ctx, &p, poly,&plane, &projp, dl);
+  RTPOINT3DZ p, projp;/*projp is "point projected on plane"*/
+  PLANE3D plane;
+  RTDEBUG(2, "rt_dist3d_point_poly is called");
+  rt_getPoint3dz_p(ctx, point->point, 0, &p);
+
+  /*If we are lookig for max distance, longestline or dfullywithin*/
+  if (dl->mode == DIST_MAX)
+  {
+    RTDEBUG(3, "looking for maxdistance");
+    return rt_dist3d_pt_ptarray(ctx, &p, poly->rings[0], dl);
+  }
+
+  /*Find the plane of the polygon, the "holes" have to be on the same plane. so we only care about the boudary*/
+  if(!define_plane(ctx, poly->rings[0], &plane))
+    return RT_FALSE;
+
+  /*get our point projected on the plane of the polygon*/
+  project_point_on_plane(ctx, &p, &plane, &projp);
+
+  return rt_dist3d_pt_poly(ctx, &p, poly,&plane, &projp, dl);
 }
 
 
@@ -653,11 +653,11 @@ line to line calculation
 int
 rt_dist3d_line_line(const RTCTX *ctx, RTLINE *line1, RTLINE *line2, DISTPTS3D *dl)
 {
-	RTPOINTARRAY *pa1 = line1->points;
-	RTPOINTARRAY *pa2 = line2->points;
-	RTDEBUG(2, "rt_dist3d_line_line is called");
+  RTPOINTARRAY *pa1 = line1->points;
+  RTPOINTARRAY *pa2 = line2->points;
+  RTDEBUG(2, "rt_dist3d_line_line is called");
 
-	return rt_dist3d_ptarray_ptarray(ctx, pa1, pa2, dl);
+  return rt_dist3d_ptarray_ptarray(ctx, pa1, pa2, dl);
 }
 
 /**
@@ -666,18 +666,18 @@ line to polygon calculation
 */
 int rt_dist3d_line_poly(const RTCTX *ctx, RTLINE *line, RTPOLY *poly, DISTPTS3D *dl)
 {
-	PLANE3D plane;	
-	RTDEBUG(2, "rt_dist3d_line_poly is called");	
-		
-	if (dl->mode == DIST_MAX)
-	{
-		return rt_dist3d_ptarray_ptarray(ctx, line->points, poly->rings[0], dl);
-	}
-	
-	if(!define_plane(ctx, poly->rings[0], &plane))
-		return RT_FALSE;
-	
-	return rt_dist3d_ptarray_poly(ctx, line->points, poly,&plane, dl);
+  PLANE3D plane;
+  RTDEBUG(2, "rt_dist3d_line_poly is called");
+
+  if (dl->mode == DIST_MAX)
+  {
+    return rt_dist3d_ptarray_ptarray(ctx, line->points, poly->rings[0], dl);
+  }
+
+  if(!define_plane(ctx, poly->rings[0], &plane))
+    return RT_FALSE;
+
+  return rt_dist3d_ptarray_poly(ctx, line->points, poly,&plane, dl);
 }
 
 /**
@@ -685,29 +685,29 @@ int rt_dist3d_line_poly(const RTCTX *ctx, RTLINE *line, RTPOLY *poly, DISTPTS3D
 polygon to polygon calculation
 */
 int rt_dist3d_poly_poly(const RTCTX *ctx, RTPOLY *poly1, RTPOLY *poly2, DISTPTS3D *dl)
-{		
-	PLANE3D plane;		
-	RTDEBUG(2, "rt_dist3d_poly_poly is called");
-	if (dl->mode == DIST_MAX)
-	{
-		return rt_dist3d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
-	}
-	
-	if(!define_plane(ctx, poly2->rings[0], &plane))
-		return RT_FALSE;
-	
-	/*What we do here is to compare the bondary of one polygon with the other polygon 
-	and then take the second boudary comparing with the first polygon*/
-	dl->twisted=1;
-	if(!rt_dist3d_ptarray_poly(ctx, poly1->rings[0], poly2,&plane, dl))
-		return RT_FALSE;
-	if(dl->distance==0.0) /*Just check if the answer already is given*/
-		return RT_TRUE;
-	
-	if(!define_plane(ctx, poly1->rings[0], &plane))
-		return RT_FALSE;
-	dl->twisted=-1; /*because we swithc the order of geometries we swithch "twisted" to -1 which will give the right order of points in shortest line.*/
-	return rt_dist3d_ptarray_poly(ctx, poly2->rings[0], poly1,&plane, dl);
+{
+  PLANE3D plane;
+  RTDEBUG(2, "rt_dist3d_poly_poly is called");
+  if (dl->mode == DIST_MAX)
+  {
+    return rt_dist3d_ptarray_ptarray(ctx, poly1->rings[0], poly2->rings[0], dl);
+  }
+
+  if(!define_plane(ctx, poly2->rings[0], &plane))
+    return RT_FALSE;
+
+  /*What we do here is to compare the bondary of one polygon with the other polygon
+  and then take the second boudary comparing with the first polygon*/
+  dl->twisted=1;
+  if(!rt_dist3d_ptarray_poly(ctx, poly1->rings[0], poly2,&plane, dl))
+    return RT_FALSE;
+  if(dl->distance==0.0) /*Just check if the answer already is given*/
+    return RT_TRUE;
+
+  if(!define_plane(ctx, poly1->rings[0], &plane))
+    return RT_FALSE;
+  dl->twisted=-1; /*because we swithc the order of geometries we swithch "twisted" to -1 which will give the right order of points in shortest line.*/
+  return rt_dist3d_ptarray_poly(ctx, poly2->rings[0], poly1,&plane, dl);
 }
 
 /**
@@ -718,25 +718,25 @@ int rt_dist3d_poly_poly(const RTCTX *ctx, RTPOLY *poly1, RTPOLY *poly2, DISTPTS3
 int
 rt_dist3d_pt_ptarray(const RTCTX *ctx, RTPOINT3DZ *p, RTPOINTARRAY *pa,DISTPTS3D *dl)
 {
-	int t;
-	RTPOINT3DZ	start, end;
-	int twist = dl->twisted;
+  int t;
+  RTPOINT3DZ  start, end;
+  int twist = dl->twisted;
 
-	RTDEBUG(2, "rt_dist3d_pt_ptarray is called");
+  RTDEBUG(2, "rt_dist3d_pt_ptarray is called");
 
-	rt_getPoint3dz_p(ctx, pa, 0, &start);
+  rt_getPoint3dz_p(ctx, pa, 0, &start);
 
-	for (t=1; t<pa->npoints; t++)
-	{
-		dl->twisted=twist;
-		rt_getPoint3dz_p(ctx, pa, t, &end);
-		if (!rt_dist3d_pt_seg(ctx, p, &start, &end,dl)) return RT_FALSE;
+  for (t=1; t<pa->npoints; t++)
+  {
+    dl->twisted=twist;
+    rt_getPoint3dz_p(ctx, pa, t, &end);
+    if (!rt_dist3d_pt_seg(ctx, p, &start, &end,dl)) return RT_FALSE;
 
-		if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
-		start = end;
-	}
+    if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+    start = end;
+  }
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 
@@ -748,49 +748,49 @@ if searching for max distance it just sends p-A and p-B to pt-pt calculation
 int
 rt_dist3d_pt_seg(const RTCTX *ctx, RTPOINT3DZ *p, RTPOINT3DZ *A, RTPOINT3DZ *B, DISTPTS3D *dl)
 {
-	RTPOINT3DZ c;
-	double	r;
-	/*if start==end, then use pt distance */
-	if (  ( A->x == B->x) && (A->y == B->y) && (A->z == B->z)  )
-	{
-		return rt_dist3d_pt_pt(ctx, p,A,dl);
-	}
-
-
-	r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y)  + ( p->z-A->z) * (B->z-A->z) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y)+(B->z-A->z)*(B->z-A->z) );
-
-	/*This is for finding the 3Dmaxdistance.
-	the maxdistance have to be between two vertexes,
-	compared to mindistance which can be between
-	tvo vertexes vertex.*/
-	if (dl->mode == DIST_MAX)
-	{
-		if (r>=0.5)
-		{
-			return rt_dist3d_pt_pt(ctx, p,A,dl);
-		}
-		if (r<0.5)
-		{
-			return rt_dist3d_pt_pt(ctx, p,B,dl);
-		}
-	}
-
-	if (r<0)	/*If the first vertex A is closest to the point p*/
-	{
-		return rt_dist3d_pt_pt(ctx, p,A,dl);
-	}
-	if (r>1)	/*If the second vertex B is closest to the point p*/
-	{
-		return rt_dist3d_pt_pt(ctx, p,B,dl);
-	}
-
-	/*else if the point p is closer to some point between a and b
-	then we find that point and send it to rt_dist3d_pt_pt*/
-	c.x=A->x + r * (B->x-A->x);
-	c.y=A->y + r * (B->y-A->y);
-	c.z=A->z + r * (B->z-A->z);
-
-	return rt_dist3d_pt_pt(ctx, p,&c,dl);
+  RTPOINT3DZ c;
+  double  r;
+  /*if start==end, then use pt distance */
+  if (  ( A->x == B->x) && (A->y == B->y) && (A->z == B->z)  )
+  {
+    return rt_dist3d_pt_pt(ctx, p,A,dl);
+  }
+
+
+  r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y)  + ( p->z-A->z) * (B->z-A->z) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y)+(B->z-A->z)*(B->z-A->z) );
+
+  /*This is for finding the 3Dmaxdistance.
+  the maxdistance have to be between two vertexes,
+  compared to mindistance which can be between
+  tvo vertexes vertex.*/
+  if (dl->mode == DIST_MAX)
+  {
+    if (r>=0.5)
+    {
+      return rt_dist3d_pt_pt(ctx, p,A,dl);
+    }
+    if (r<0.5)
+    {
+      return rt_dist3d_pt_pt(ctx, p,B,dl);
+    }
+  }
+
+  if (r<0)  /*If the first vertex A is closest to the point p*/
+  {
+    return rt_dist3d_pt_pt(ctx, p,A,dl);
+  }
+  if (r>1)  /*If the second vertex B is closest to the point p*/
+  {
+    return rt_dist3d_pt_pt(ctx, p,B,dl);
+  }
+
+  /*else if the point p is closer to some point between a and b
+  then we find that point and send it to rt_dist3d_pt_pt*/
+  c.x=A->x + r * (B->x-A->x);
+  c.y=A->y + r * (B->y-A->y);
+  c.z=A->z + r * (B->z-A->z);
+
+  return rt_dist3d_pt_pt(ctx, p,&c,dl);
 }
 
 double
@@ -813,28 +813,28 @@ depending on dl->mode (max or min)
 int
 rt_dist3d_pt_pt(const RTCTX *ctx, RTPOINT3DZ *thep1, RTPOINT3DZ *thep2,DISTPTS3D *dl)
 {
-	double dx = thep2->x - thep1->x;
-	double dy = thep2->y - thep1->y;
-	double dz = thep2->z - thep1->z;
-	double dist = sqrt ( dx*dx + dy*dy + dz*dz);
-	RTDEBUGF(2, "rt_dist3d_pt_pt called (with points: p1.x=%f, p1.y=%f,p1.z=%f,p2.x=%f, p2.y=%f,p2.z=%f)",thep1->x,thep1->y,thep1->z,thep2->x,thep2->y,thep2->z );
-
-	if (((dl->distance - dist)*(dl->mode))>0) /*multiplication with mode to handle mindistance (mode=1)  and maxdistance (mode = (-1)*/
-	{
-		dl->distance = dist;
-
-		if (dl->twisted>0)	/*To get the points in right order. twisted is updated between 1 and (-1) every time the order is changed earlier in the chain*/
-		{
-			dl->p1 = *thep1;
-			dl->p2 = *thep2;
-		}
-		else
-		{
-			dl->p1 = *thep2;
-			dl->p2 = *thep1;
-		}
-	}
-	return RT_TRUE;
+  double dx = thep2->x - thep1->x;
+  double dy = thep2->y - thep1->y;
+  double dz = thep2->z - thep1->z;
+  double dist = sqrt ( dx*dx + dy*dy + dz*dz);
+  RTDEBUGF(2, "rt_dist3d_pt_pt called (with points: p1.x=%f, p1.y=%f,p1.z=%f,p2.x=%f, p2.y=%f,p2.z=%f)",thep1->x,thep1->y,thep1->z,thep2->x,thep2->y,thep2->z );
+
+  if (((dl->distance - dist)*(dl->mode))>0) /*multiplication with mode to handle mindistance (mode=1)  and maxdistance (mode = (-1)*/
+  {
+    dl->distance = dist;
+
+    if (dl->twisted>0)  /*To get the points in right order. twisted is updated between 1 and (-1) every time the order is changed earlier in the chain*/
+    {
+      dl->p1 = *thep1;
+      dl->p2 = *thep2;
+    }
+    else
+    {
+      dl->p1 = *thep2;
+      dl->p2 = *thep1;
+    }
+  }
+  return RT_TRUE;
 }
 
 
@@ -845,208 +845,208 @@ Finds all combinationes of segments between two pointarrays
 int
 rt_dist3d_ptarray_ptarray(const RTCTX *ctx, RTPOINTARRAY *l1, RTPOINTARRAY *l2,DISTPTS3D *dl)
 {
-	int t,u;
-	RTPOINT3DZ	start, end;
-	RTPOINT3DZ	start2, end2;
-	int twist = dl->twisted;
-	RTDEBUGF(2, "rt_dist3d_ptarray_ptarray called (points: %d-%d)",l1->npoints, l2->npoints);
-
-
-
-	if (dl->mode == DIST_MAX)/*If we are searching for maxdistance we go straight to point-point calculation since the maxdistance have to be between two vertexes*/
-	{
-		for (t=0; t<l1->npoints; t++) /*for each segment in L1 */
-		{
-			rt_getPoint3dz_p(ctx, l1, t, &start);
-			for (u=0; u<l2->npoints; u++) /*for each segment in L2 */
-			{
-				rt_getPoint3dz_p(ctx, l2, u, &start2);
-				rt_dist3d_pt_pt(ctx, &start,&start2,dl);
-				RTDEBUGF(4, "maxdist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
-				RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
-				         t, u, dl->distance, dl->tolerance);
-			}
-		}
-	}
-	else
-	{
-		rt_getPoint3dz_p(ctx, l1, 0, &start);
-		for (t=1; t<l1->npoints; t++) /*for each segment in L1 */
-		{
-			rt_getPoint3dz_p(ctx, l1, t, &end);
-			rt_getPoint3dz_p(ctx, l2, 0, &start2);
-			for (u=1; u<l2->npoints; u++) /*for each segment in L2 */
-			{
-				rt_getPoint3dz_p(ctx, l2, u, &end2);
-				dl->twisted=twist;
-				rt_dist3d_seg_seg(ctx, &start, &end, &start2, &end2,dl);
-				RTDEBUGF(4, "mindist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
-				RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
-				         t, u, dl->distance, dl->tolerance);
-				if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
-				start2 = end2;
-			}
-			start = end;
-		}
-	}
-	return RT_TRUE;
+  int t,u;
+  RTPOINT3DZ  start, end;
+  RTPOINT3DZ  start2, end2;
+  int twist = dl->twisted;
+  RTDEBUGF(2, "rt_dist3d_ptarray_ptarray called (points: %d-%d)",l1->npoints, l2->npoints);
+
+
+
+  if (dl->mode == DIST_MAX)/*If we are searching for maxdistance we go straight to point-point calculation since the maxdistance have to be between two vertexes*/
+  {
+    for (t=0; t<l1->npoints; t++) /*for each segment in L1 */
+    {
+      rt_getPoint3dz_p(ctx, l1, t, &start);
+      for (u=0; u<l2->npoints; u++) /*for each segment in L2 */
+      {
+        rt_getPoint3dz_p(ctx, l2, u, &start2);
+        rt_dist3d_pt_pt(ctx, &start,&start2,dl);
+        RTDEBUGF(4, "maxdist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
+        RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
+                 t, u, dl->distance, dl->tolerance);
+      }
+    }
+  }
+  else
+  {
+    rt_getPoint3dz_p(ctx, l1, 0, &start);
+    for (t=1; t<l1->npoints; t++) /*for each segment in L1 */
+    {
+      rt_getPoint3dz_p(ctx, l1, t, &end);
+      rt_getPoint3dz_p(ctx, l2, 0, &start2);
+      for (u=1; u<l2->npoints; u++) /*for each segment in L2 */
+      {
+        rt_getPoint3dz_p(ctx, l2, u, &end2);
+        dl->twisted=twist;
+        rt_dist3d_seg_seg(ctx, &start, &end, &start2, &end2,dl);
+        RTDEBUGF(4, "mindist_ptarray_ptarray; seg %i * seg %i, dist = %g\n",t,u,dl->distance);
+        RTDEBUGF(3, " seg%d-seg%d dist: %f, mindist: %f",
+                 t, u, dl->distance, dl->tolerance);
+        if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return RT_TRUE; /*just a check if  the answer is already given*/
+        start2 = end2;
+      }
+      start = end;
+    }
+  }
+  return RT_TRUE;
 }
 
 /**
 
 Finds the two closest points on two linesegments
 */
-int 
+int
 rt_dist3d_seg_seg(const RTCTX *ctx, RTPOINT3DZ *s1p1, RTPOINT3DZ *s1p2, RTPOINT3DZ *s2p1, RTPOINT3DZ *s2p2, DISTPTS3D *dl)
 {
-	VECTOR3D v1, v2, vl;
-	double s1k, s2k; /*two variables representing where on Line 1 (s1k) and where on Line 2 (s2k) a connecting line between the two lines is perpendicular to both lines*/
-	RTPOINT3DZ p1, p2;
-	double a, b, c, d, e, D;
-			
-	/*s1p1 and s1p2 are the same point */
-	if (  ( s1p1->x == s1p2->x) && (s1p1->y == s1p2->y) && (s1p1->z == s1p2->z) )
-	{
-		return rt_dist3d_pt_seg(ctx, s1p1,s2p1,s2p2,dl);
-	}
-	/*s2p1 and s2p2 are the same point */
-	if (  ( s2p1->x == s2p2->x) && (s2p1->y == s2p2->y) && (s2p1->z == s2p2->z) )
-	{
-		dl->twisted= ((dl->twisted) * (-1));
-		return rt_dist3d_pt_seg(ctx, s2p1,s1p1,s1p2,dl);
-	}
-		
+  VECTOR3D v1, v2, vl;
+  double s1k, s2k; /*two variables representing where on Line 1 (s1k) and where on Line 2 (s2k) a connecting line between the two lines is perpendicular to both lines*/
+  RTPOINT3DZ p1, p2;
+  double a, b, c, d, e, D;
+
+  /*s1p1 and s1p2 are the same point */
+  if (  ( s1p1->x == s1p2->x) && (s1p1->y == s1p2->y) && (s1p1->z == s1p2->z) )
+  {
+    return rt_dist3d_pt_seg(ctx, s1p1,s2p1,s2p2,dl);
+  }
+  /*s2p1 and s2p2 are the same point */
+  if (  ( s2p1->x == s2p2->x) && (s2p1->y == s2p2->y) && (s2p1->z == s2p2->z) )
+  {
+    dl->twisted= ((dl->twisted) * (-1));
+    return rt_dist3d_pt_seg(ctx, s2p1,s1p1,s1p2,dl);
+  }
+
 /*
-	Here we use algorithm from softsurfer.com
-	that can be found here
-	http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm
+  Here we use algorithm from softsurfer.com
+  that can be found here
+  http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm
 */
-	
-	if (!get_3dvector_from_points(ctx, s1p1, s1p2, &v1))
-		return RT_FALSE;	
-
-	if (!get_3dvector_from_points(ctx, s2p1, s2p2, &v2))
-		return RT_FALSE;	
-
-	if (!get_3dvector_from_points(ctx, s2p1, s1p1, &vl))
-		return RT_FALSE;	
-
-	a = DOT(v1,v1);
-	b = DOT(v1,v2);
-	c = DOT(v2,v2);
-	d = DOT(v1,vl);
-	e = DOT(v2,vl);
-	D = a*c - b*b; 
-
-
-	if (D <0.000000001) 
-	{        /* the lines are almost parallel*/
-		s1k = 0.0; /*If the lines are paralell we try by using the startpoint of first segment. If that gives a projected point on the second line outside segment 2 it wil be found that s2k is >1 or <0.*/
-		if(b>c)   /* use the largest denominator*/
-		{
-			s2k=d/b;
-		}
-		else
-		{
-			s2k =e/c;
-		}
-	}
-	else 
-	{
-		s1k = (b*e - c*d) / D;
-		s2k = (a*e - b*d) / D;
-	}
-
-	/* Now we check if the projected closest point on the infinite lines is outside our segments. If so the combinations with start and end points will be tested*/
-	if(s1k<0.0||s1k>1.0||s2k<0.0||s2k>1.0)
-	{
-		if(s1k<0.0) 
-		{
-
-			if (!rt_dist3d_pt_seg(ctx, s1p1, s2p1, s2p2, dl))
-			{
-				return RT_FALSE;
-			}
-		}
-		if(s1k>1.0)
-		{
-
-			if (!rt_dist3d_pt_seg(ctx, s1p2, s2p1, s2p2, dl))
-			{
-				return RT_FALSE;
-			}
-		}
-		if(s2k<0.0)
-		{
-			dl->twisted= ((dl->twisted) * (-1));
-			if (!rt_dist3d_pt_seg(ctx, s2p1, s1p1, s1p2, dl))
-			{
-				return RT_FALSE;
-			}
-		}
-		if(s2k>1.0)
-		{
-			dl->twisted= ((dl->twisted) * (-1));
-			if (!rt_dist3d_pt_seg(ctx, s2p2, s1p1, s1p2, dl))
-			{
-				return RT_FALSE;
-			}
-		}
-	}
-	else
-	{/*Find the closest point on the edges of both segments*/
-		p1.x=s1p1->x+s1k*(s1p2->x-s1p1->x);
-		p1.y=s1p1->y+s1k*(s1p2->y-s1p1->y);
-		p1.z=s1p1->z+s1k*(s1p2->z-s1p1->z);
-
-		p2.x=s2p1->x+s2k*(s2p2->x-s2p1->x);
-		p2.y=s2p1->y+s2k*(s2p2->y-s2p1->y);
-		p2.z=s2p1->z+s2k*(s2p2->z-s2p1->z);
-
-		if (!rt_dist3d_pt_pt(ctx, &p1,&p2,dl))/* Send the closest points to point-point calculation*/
-		{
-			return RT_FALSE;
-		}
-	}
-	return RT_TRUE;
+
+  if (!get_3dvector_from_points(ctx, s1p1, s1p2, &v1))
+    return RT_FALSE;
+
+  if (!get_3dvector_from_points(ctx, s2p1, s2p2, &v2))
+    return RT_FALSE;
+
+  if (!get_3dvector_from_points(ctx, s2p1, s1p1, &vl))
+    return RT_FALSE;
+
+  a = DOT(v1,v1);
+  b = DOT(v1,v2);
+  c = DOT(v2,v2);
+  d = DOT(v1,vl);
+  e = DOT(v2,vl);
+  D = a*c - b*b;
+
+
+  if (D <0.000000001)
+  {        /* the lines are almost parallel*/
+    s1k = 0.0; /*If the lines are paralell we try by using the startpoint of first segment. If that gives a projected point on the second line outside segment 2 it wil be found that s2k is >1 or <0.*/
+    if(b>c)   /* use the largest denominator*/
+    {
+      s2k=d/b;
+    }
+    else
+    {
+      s2k =e/c;
+    }
+  }
+  else
+  {
+    s1k = (b*e - c*d) / D;
+    s2k = (a*e - b*d) / D;
+  }
+
+  /* Now we check if the projected closest point on the infinite lines is outside our segments. If so the combinations with start and end points will be tested*/
+  if(s1k<0.0||s1k>1.0||s2k<0.0||s2k>1.0)
+  {
+    if(s1k<0.0)
+    {
+
+      if (!rt_dist3d_pt_seg(ctx, s1p1, s2p1, s2p2, dl))
+      {
+        return RT_FALSE;
+      }
+    }
+    if(s1k>1.0)
+    {
+
+      if (!rt_dist3d_pt_seg(ctx, s1p2, s2p1, s2p2, dl))
+      {
+        return RT_FALSE;
+      }
+    }
+    if(s2k<0.0)
+    {
+      dl->twisted= ((dl->twisted) * (-1));
+      if (!rt_dist3d_pt_seg(ctx, s2p1, s1p1, s1p2, dl))
+      {
+        return RT_FALSE;
+      }
+    }
+    if(s2k>1.0)
+    {
+      dl->twisted= ((dl->twisted) * (-1));
+      if (!rt_dist3d_pt_seg(ctx, s2p2, s1p1, s1p2, dl))
+      {
+        return RT_FALSE;
+      }
+    }
+  }
+  else
+  {/*Find the closest point on the edges of both segments*/
+    p1.x=s1p1->x+s1k*(s1p2->x-s1p1->x);
+    p1.y=s1p1->y+s1k*(s1p2->y-s1p1->y);
+    p1.z=s1p1->z+s1k*(s1p2->z-s1p1->z);
+
+    p2.x=s2p1->x+s2k*(s2p2->x-s2p1->x);
+    p2.y=s2p1->y+s2k*(s2p2->y-s2p1->y);
+    p2.z=s2p1->z+s2k*(s2p2->z-s2p1->z);
+
+    if (!rt_dist3d_pt_pt(ctx, &p1,&p2,dl))/* Send the closest points to point-point calculation*/
+    {
+      return RT_FALSE;
+    }
+  }
+  return RT_TRUE;
 }
 
 /**
 
-Checking if the point projected on the plane of the polygon actually is inside that polygon. 
+Checking if the point projected on the plane of the polygon actually is inside that polygon.
 If so the mindistance is between that projected point and our original point.
 If not we check from original point to the bounadary.
 If the projected point is inside a hole of the polygon we check the distance to the boudary of that hole.
 */
 int
 rt_dist3d_pt_poly(const RTCTX *ctx, RTPOINT3DZ *p, RTPOLY *poly, PLANE3D *plane,RTPOINT3DZ *projp, DISTPTS3D *dl)
-{	
-	int i;
-	
-	RTDEBUG(2, "rt_dist3d_point_poly called");
-
-	
-	if(pt_in_ring_3d(ctx, projp, poly->rings[0], plane))
-	{
-		for (i=1; i<poly->nrings; i++)
-		{
-			/* Inside a hole. Distance = pt -> ring */
-			if ( pt_in_ring_3d(ctx, projp, poly->rings[i], plane ))
-			{
-				RTDEBUG(3, " inside an hole");
-				return rt_dist3d_pt_ptarray(ctx, p, poly->rings[i], dl);
-			}
-		}		
-		
-		return rt_dist3d_pt_pt(ctx, p,projp,dl);/* If the projected point is inside the polygon the shortest distance is between that point and the inputed point*/
-	}
-	else
-	{
-		return rt_dist3d_pt_ptarray(ctx, p, poly->rings[0], dl); /*If the projected point is outside the polygon we search for the closest distance against the boundarry instead*/
-	}	
-	
-	return RT_TRUE;
-	
+{
+  int i;
+
+  RTDEBUG(2, "rt_dist3d_point_poly called");
+
+
+  if(pt_in_ring_3d(ctx, projp, poly->rings[0], plane))
+  {
+    for (i=1; i<poly->nrings; i++)
+    {
+      /* Inside a hole. Distance = pt -> ring */
+      if ( pt_in_ring_3d(ctx, projp, poly->rings[i], plane ))
+      {
+        RTDEBUG(3, " inside an hole");
+        return rt_dist3d_pt_ptarray(ctx, p, poly->rings[i], dl);
+      }
+    }
+
+    return rt_dist3d_pt_pt(ctx, p,projp,dl);/* If the projected point is inside the polygon the shortest distance is between that point and the inputed point*/
+  }
+  else
+  {
+    return rt_dist3d_pt_ptarray(ctx, p, poly->rings[0], dl); /*If the projected point is outside the polygon we search for the closest distance against the boundarry instead*/
+  }
+
+  return RT_TRUE;
+
 }
 
 /**
@@ -1055,79 +1055,79 @@ Computes pointarray to polygon distance
 */
 int rt_dist3d_ptarray_poly(const RTCTX *ctx, RTPOINTARRAY *pa, RTPOLY *poly,PLANE3D *plane, DISTPTS3D *dl)
 {
-	
-
-	int i,j,k;
-	double f, s1, s2;
-	VECTOR3D projp1_projp2;
-	RTPOINT3DZ p1, p2,projp1, projp2, intersectionp;
-	
-	rt_getPoint3dz_p(ctx, pa, 0, &p1);
-	
-	s1=project_point_on_plane(ctx, &p1, plane, &projp1); /*the sign of s1 tells us on which side of the plane the point is. */
-	rt_dist3d_pt_poly(ctx, &p1, poly, plane,&projp1, dl);	
-	
-	for (i=1;i<pa->npoints;i++)
-	{		
-		int intersects;
-		rt_getPoint3dz_p(ctx, pa, i, &p2);
-		s2=project_point_on_plane(ctx, &p2, plane, &projp2);	
-		rt_dist3d_pt_poly(ctx, &p2, poly, plane,&projp2, dl);
-		
-		/*If s1and s2 has different signs that means they are on different sides of the plane of the polygon.
-		That means that the edge between the points crosses the plane and might intersect with the polygon*/
-		if((s1*s2)<=0) 
-		{
-			f=fabs(s1)/(fabs(s1)+fabs(s2)); /*The size of s1 and s2 is the distance from the point to the plane.*/
-			get_3dvector_from_points(ctx, &projp1, &projp2,&projp1_projp2);
-			
-			/*get the point where the line segment crosses the plane*/
-			intersectionp.x=projp1.x+f*projp1_projp2.x;
-			intersectionp.y=projp1.y+f*projp1_projp2.y;
-			intersectionp.z=projp1.z+f*projp1_projp2.z;
-			
-			intersects = RT_TRUE; /*We set intersects to true until the opposite is proved*/
-			
-			if(pt_in_ring_3d(ctx, &intersectionp, poly->rings[0], plane)) /*Inside outer ring*/
-			{
-				for (k=1;k<poly->nrings; k++)
-				{
-					/* Inside a hole, so no intersection with the polygon*/
-					if ( pt_in_ring_3d(ctx, &intersectionp, poly->rings[k], plane ))
-					{
-						intersects=RT_FALSE;
-						break;
-					}
-				}		
-				if(intersects) 
-				{
-					dl->distance=0.0;
-					dl->p1.x=intersectionp.x;
-					dl->p1.y=intersectionp.y;
-					dl->p1.z=intersectionp.z;
-					
-					dl->p2.x=intersectionp.x;
-					dl->p2.y=intersectionp.y;
-					dl->p2.z=intersectionp.z;
-					return RT_TRUE;
-					
-				}					
-			}			
-		}
-		
-		projp1=projp2;
-		s1=s2;
-		p1=p2;
-	}	
-	
-	/*check or pointarray against boundary and inner boundaries of the polygon*/
-	for (j=0;j<poly->nrings;j++)
-	{
-		rt_dist3d_ptarray_ptarray(ctx, pa, poly->rings[j], dl);
-	}
-	
+
+
+  int i,j,k;
+  double f, s1, s2;
+  VECTOR3D projp1_projp2;
+  RTPOINT3DZ p1, p2,projp1, projp2, intersectionp;
+
+  rt_getPoint3dz_p(ctx, pa, 0, &p1);
+
+  s1=project_point_on_plane(ctx, &p1, plane, &projp1); /*the sign of s1 tells us on which side of the plane the point is. */
+  rt_dist3d_pt_poly(ctx, &p1, poly, plane,&projp1, dl);
+
+  for (i=1;i<pa->npoints;i++)
+  {
+    int intersects;
+    rt_getPoint3dz_p(ctx, pa, i, &p2);
+    s2=project_point_on_plane(ctx, &p2, plane, &projp2);
+    rt_dist3d_pt_poly(ctx, &p2, poly, plane,&projp2, dl);
+
+    /*If s1and s2 has different signs that means they are on different sides of the plane of the polygon.
+    That means that the edge between the points crosses the plane and might intersect with the polygon*/
+    if((s1*s2)<=0)
+    {
+      f=fabs(s1)/(fabs(s1)+fabs(s2)); /*The size of s1 and s2 is the distance from the point to the plane.*/
+      get_3dvector_from_points(ctx, &projp1, &projp2,&projp1_projp2);
+
+      /*get the point where the line segment crosses the plane*/
+      intersectionp.x=projp1.x+f*projp1_projp2.x;
+      intersectionp.y=projp1.y+f*projp1_projp2.y;
+      intersectionp.z=projp1.z+f*projp1_projp2.z;
+
+      intersects = RT_TRUE; /*We set intersects to true until the opposite is proved*/
+
+      if(pt_in_ring_3d(ctx, &intersectionp, poly->rings[0], plane)) /*Inside outer ring*/
+      {
+        for (k=1;k<poly->nrings; k++)
+        {
+          /* Inside a hole, so no intersection with the polygon*/
+          if ( pt_in_ring_3d(ctx, &intersectionp, poly->rings[k], plane ))
+          {
+            intersects=RT_FALSE;
+            break;
+          }
+        }
+        if(intersects)
+        {
+          dl->distance=0.0;
+          dl->p1.x=intersectionp.x;
+          dl->p1.y=intersectionp.y;
+          dl->p1.z=intersectionp.z;
+
+          dl->p2.x=intersectionp.x;
+          dl->p2.y=intersectionp.y;
+          dl->p2.z=intersectionp.z;
+          return RT_TRUE;
+
+        }
+      }
+    }
+
+    projp1=projp2;
+    s1=s2;
+    p1=p2;
+  }
+
+  /*check or pointarray against boundary and inner boundaries of the polygon*/
+  for (j=0;j<poly->nrings;j++)
+  {
+    rt_dist3d_ptarray_ptarray(ctx, pa, poly->rings[j], dl);
+  }
+
 return RT_TRUE;
-}	
+}
 
 
 /**
@@ -1138,70 +1138,70 @@ the plane is stored as a pont in plane (plane.pop) and a normal vector (plane.pv
 int
 define_plane(const RTCTX *ctx, RTPOINTARRAY *pa, PLANE3D *pl)
 {
-	int i,j, numberofvectors, pointsinslice;
-	RTPOINT3DZ p, p1, p2;
-
-	double sumx=0;
-	double sumy=0;
-	double sumz=0;
-	double vl; /*vector length*/
-
-	VECTOR3D v1, v2, v;
-	
-	if((pa->npoints-1)==3) /*Triangle is special case*/
-	{
-		pointsinslice=1;		
-	}
-	else
-	{
-		pointsinslice=(int) floor((pa->npoints-1)/4); /*divide the pointarray into 4 slices*/
-	}
-	
-	/*find the avg point*/
-	for (i=0;i<(pa->npoints-1);i++)
-	{
-		rt_getPoint3dz_p(ctx, pa, i, &p);
-		sumx+=p.x;
-		sumy+=p.y;
-		sumz+=p.z;		
-	}	
-	pl->pop.x=(sumx/(pa->npoints-1));
-	pl->pop.y=(sumy/(pa->npoints-1));
-	pl->pop.z=(sumz/(pa->npoints-1));
-	
-	sumx=0;
-	sumy=0;
-	sumz=0;
-	numberofvectors= floor((pa->npoints-1)/pointsinslice); /*the number of vectors we try can be 3, 4 or 5*/
-	
-	rt_getPoint3dz_p(ctx, pa, 0, &p1);
-	for (j=pointsinslice;j<pa->npoints;j+=pointsinslice)
-	{
-		rt_getPoint3dz_p(ctx, pa, j, &p2);	
-		
-		if (!get_3dvector_from_points(ctx, &(pl->pop), &p1, &v1) || !get_3dvector_from_points(ctx, &(pl->pop), &p2, &v2))
-			return RT_FALSE;	
-		/*perpendicular vector is cross product of v1 and v2*/
-		if (!get_3dcross_product(ctx, &v1,&v2, &v))
-			return RT_FALSE;		
-		vl=VECTORLENGTH(v);
-		sumx+=(v.x/vl);
-		sumy+=(v.y/vl);
-		sumz+=(v.z/vl);	
-		p1=p2;
-	}
-	pl->pv.x=(sumx/numberofvectors);
-	pl->pv.y=(sumy/numberofvectors);
-	pl->pv.z=(sumz/numberofvectors);
-	
-	return 1;
+  int i,j, numberofvectors, pointsinslice;
+  RTPOINT3DZ p, p1, p2;
+
+  double sumx=0;
+  double sumy=0;
+  double sumz=0;
+  double vl; /*vector length*/
+
+  VECTOR3D v1, v2, v;
+
+  if((pa->npoints-1)==3) /*Triangle is special case*/
+  {
+    pointsinslice=1;
+  }
+  else
+  {
+    pointsinslice=(int) floor((pa->npoints-1)/4); /*divide the pointarray into 4 slices*/
+  }
+
+  /*find the avg point*/
+  for (i=0;i<(pa->npoints-1);i++)
+  {
+    rt_getPoint3dz_p(ctx, pa, i, &p);
+    sumx+=p.x;
+    sumy+=p.y;
+    sumz+=p.z;
+  }
+  pl->pop.x=(sumx/(pa->npoints-1));
+  pl->pop.y=(sumy/(pa->npoints-1));
+  pl->pop.z=(sumz/(pa->npoints-1));
+
+  sumx=0;
+  sumy=0;
+  sumz=0;
+  numberofvectors= floor((pa->npoints-1)/pointsinslice); /*the number of vectors we try can be 3, 4 or 5*/
+
+  rt_getPoint3dz_p(ctx, pa, 0, &p1);
+  for (j=pointsinslice;j<pa->npoints;j+=pointsinslice)
+  {
+    rt_getPoint3dz_p(ctx, pa, j, &p2);
+
+    if (!get_3dvector_from_points(ctx, &(pl->pop), &p1, &v1) || !get_3dvector_from_points(ctx, &(pl->pop), &p2, &v2))
+      return RT_FALSE;
+    /*perpendicular vector is cross product of v1 and v2*/
+    if (!get_3dcross_product(ctx, &v1,&v2, &v))
+      return RT_FALSE;
+    vl=VECTORLENGTH(v);
+    sumx+=(v.x/vl);
+    sumy+=(v.y/vl);
+    sumz+=(v.z/vl);
+    p1=p2;
+  }
+  pl->pv.x=(sumx/numberofvectors);
+  pl->pv.y=(sumy/numberofvectors);
+  pl->pv.z=(sumz/numberofvectors);
+
+  return 1;
 }
 
 /**
 
 Finds a point on a plane from where the original point is perpendicular to the plane
 */
-double 
+double
 project_point_on_plane(const RTCTX *ctx, RTPOINT3DZ *p,  PLANE3D *pl, RTPOINT3DZ *p0)
 {
 /*In our plane definition we have a point on the plane and a normal vektor (pl.pv), perpendicular to the plane
@@ -1209,19 +1209,19 @@ this vector will be paralell to the line between our inputted point above the pl
 So, we already have a direction from p to find p0, but we don't know the distance.
 */
 
-	VECTOR3D v1;
-	double f;
-	
-	if (!get_3dvector_from_points(ctx, &(pl->pop), p, &v1))
-	return RT_FALSE;	
-	
-	f=-(DOT(pl->pv,v1)/DOT(pl->pv,pl->pv));
-	
-	p0->x=p->x+pl->pv.x*f;
-	p0->y=p->y+pl->pv.y*f;
-	p0->z=p->z+pl->pv.z*f;      
-	
-	return f;		
+  VECTOR3D v1;
+  double f;
+
+  if (!get_3dvector_from_points(ctx, &(pl->pop), p, &v1))
+  return RT_FALSE;
+
+  f=-(DOT(pl->pv,v1)/DOT(pl->pv,pl->pv));
+
+  p0->x=p->x+pl->pv.x*f;
+  p0->y=p->y+pl->pv.y*f;
+  p0->z=p->z+pl->pv.z*f;
+
+  return f;
 }
 
 
@@ -1231,130 +1231,130 @@ So, we already have a direction from p to find p0, but we don't know the distanc
  * pt_in_ring_3d(ctx): crossing number test for a point in a polygon
  *      input:   p = a point,
  *               pa = vertex points of a ring V[n+1] with V[n]=V[0]
-*		plane=the plane that the vertex points are lying on
+*    plane=the plane that the vertex points are lying on
  *      returns: 0 = outside, 1 = inside
  *
- *	Our polygons have first and last point the same,
+ *  Our polygons have first and last point the same,
  *
-*	The difference in 3D variant is that we exclude the dimension that faces the plane least.
-*	That is the dimension with the highest number in pv
+*  The difference in 3D variant is that we exclude the dimension that faces the plane least.
+*  That is the dimension with the highest number in pv
  */
 int
 pt_in_ring_3d(const RTCTX *ctx, const RTPOINT3DZ *p, const RTPOINTARRAY *ring,PLANE3D *plane)
 {
-	
-	int cn = 0;    /* the crossing number counter */
-	int i;
-	RTPOINT3DZ v1, v2;
-
-	RTPOINT3DZ	first, last;
-
-	rt_getPoint3dz_p(ctx, ring, 0, &first);
-	rt_getPoint3dz_p(ctx, ring, ring->npoints-1, &last);
-	if ( memcmp(&first, &last, sizeof(RTPOINT3DZ)) )
-	{
-		rterror(ctx, "pt_in_ring_3d: V[n] != V[0] (%g %g %g!= %g %g %g)",
-		        first.x, first.y, first.z, last.x, last.y, last.z);
-		return RT_FALSE;
-	}
-
-	RTDEBUGF(2, "pt_in_ring_3d called with point: %g %g %g", p->x, p->y, p->z);
-	/* printPA(ctx, ring); */
-
-	/* loop through all edges of the polygon */
-	rt_getPoint3dz_p(ctx, ring, 0, &v1);
-	
-	
-	if(fabs(plane->pv.z)>=fabs(plane->pv.x)&&fabs(plane->pv.z)>=fabs(plane->pv.y))	/*If the z vector of the normal vector to the plane is larger than x and y vector we project the ring to the xy-plane*/
-	{
-		for (i=0; i<ring->npoints-1; i++)
-		{
-			double vt;
-			rt_getPoint3dz_p(ctx, ring, i+1, &v2);
-
-			/* edge from vertex i to vertex i+1 */
-			if
-			(
-			    /* an upward crossing */
-			    ((v1.y <= p->y) && (v2.y > p->y))
-			    /* a downward crossing */
-			    || ((v1.y > p->y) && (v2.y <= p->y))
-			)
-			{
-
-				vt = (double)(p->y - v1.y) / (v2.y - v1.y);
-
-				/* P.x <intersect */
-				if (p->x < v1.x + vt * (v2.x - v1.x))
-				{
-					/* a valid crossing of y=p.y right of p.x */
-					++cn;
-				}
-			}
-			v1 = v2;
-		}
-	}
-	else if(fabs(plane->pv.y)>=fabs(plane->pv.x)&&fabs(plane->pv.y)>=fabs(plane->pv.z))	/*If the y vector of the normal vector to the plane is larger than x and z vector we project the ring to the xz-plane*/
-	{
-		for (i=0; i<ring->npoints-1; i++)
-			{
-				double vt;
-				rt_getPoint3dz_p(ctx, ring, i+1, &v2);
-
-				/* edge from vertex i to vertex i+1 */
-				if
-				(
-				    /* an upward crossing */
-				    ((v1.z <= p->z) && (v2.z > p->z))
-				    /* a downward crossing */
-				    || ((v1.z > p->z) && (v2.z <= p->z))
-				)
-				{
-
-					vt = (double)(p->z - v1.z) / (v2.z - v1.z);
-
-					/* P.x <intersect */
-					if (p->x < v1.x + vt * (v2.x - v1.x))
-					{
-						/* a valid crossing of y=p.y right of p.x */
-						++cn;
-					}
-				}
-				v1 = v2;
-			}
-	}
-	else	/*Hopefully we only have the cases where x part of the normal vector is largest left*/
-	{
-		for (i=0; i<ring->npoints-1; i++)
-			{
-				double vt;
-				rt_getPoint3dz_p(ctx, ring, i+1, &v2);
-
-				/* edge from vertex i to vertex i+1 */
-				if
-				(
-				    /* an upward crossing */
-				    ((v1.z <= p->z) && (v2.z > p->z))
-				    /* a downward crossing */
-				    || ((v1.z > p->z) && (v2.z <= p->z))
-				)
-				{
-
-					vt = (double)(p->z - v1.z) / (v2.z - v1.z);
-
-					/* P.x <intersect */
-					if (p->y < v1.y + vt * (v2.y - v1.y))
-					{
-						/* a valid crossing of y=p.y right of p.x */
-						++cn;
-					}
-				}
-				v1 = v2;
-			}
-	}
-	RTDEBUGF(3, "pt_in_ring_3d returning %d", cn&1);
-
-	return (cn&1);    /* 0 if even (out), and 1 if odd (in) */
+
+  int cn = 0;    /* the crossing number counter */
+  int i;
+  RTPOINT3DZ v1, v2;
+
+  RTPOINT3DZ  first, last;
+
+  rt_getPoint3dz_p(ctx, ring, 0, &first);
+  rt_getPoint3dz_p(ctx, ring, ring->npoints-1, &last);
+  if ( memcmp(&first, &last, sizeof(RTPOINT3DZ)) )
+  {
+    rterror(ctx, "pt_in_ring_3d: V[n] != V[0] (%g %g %g!= %g %g %g)",
+            first.x, first.y, first.z, last.x, last.y, last.z);
+    return RT_FALSE;
+  }
+
+  RTDEBUGF(2, "pt_in_ring_3d called with point: %g %g %g", p->x, p->y, p->z);
+  /* printPA(ctx, ring); */
+
+  /* loop through all edges of the polygon */
+  rt_getPoint3dz_p(ctx, ring, 0, &v1);
+
+
+  if(fabs(plane->pv.z)>=fabs(plane->pv.x)&&fabs(plane->pv.z)>=fabs(plane->pv.y))  /*If the z vector of the normal vector to the plane is larger than x and y vector we project the ring to the xy-plane*/
+  {
+    for (i=0; i<ring->npoints-1; i++)
+    {
+      double vt;
+      rt_getPoint3dz_p(ctx, ring, i+1, &v2);
+
+      /* edge from vertex i to vertex i+1 */
+      if
+      (
+          /* an upward crossing */
+          ((v1.y <= p->y) && (v2.y > p->y))
+          /* a downward crossing */
+          || ((v1.y > p->y) && (v2.y <= p->y))
+      )
+      {
+
+        vt = (double)(p->y - v1.y) / (v2.y - v1.y);
+
+        /* P.x <intersect */
+        if (p->x < v1.x + vt * (v2.x - v1.x))
+        {
+          /* a valid crossing of y=p.y right of p.x */
+          ++cn;
+        }
+      }
+      v1 = v2;
+    }
+  }
+  else if(fabs(plane->pv.y)>=fabs(plane->pv.x)&&fabs(plane->pv.y)>=fabs(plane->pv.z))  /*If the y vector of the normal vector to the plane is larger than x and z vector we project the ring to the xz-plane*/
+  {
+    for (i=0; i<ring->npoints-1; i++)
+      {
+        double vt;
+        rt_getPoint3dz_p(ctx, ring, i+1, &v2);
+
+        /* edge from vertex i to vertex i+1 */
+        if
+        (
+            /* an upward crossing */
+            ((v1.z <= p->z) && (v2.z > p->z))
+            /* a downward crossing */
+            || ((v1.z > p->z) && (v2.z <= p->z))
+        )
+        {
+
+          vt = (double)(p->z - v1.z) / (v2.z - v1.z);
+
+          /* P.x <intersect */
+          if (p->x < v1.x + vt * (v2.x - v1.x))
+          {
+            /* a valid crossing of y=p.y right of p.x */
+            ++cn;
+          }
+        }
+        v1 = v2;
+      }
+  }
+  else  /*Hopefully we only have the cases where x part of the normal vector is largest left*/
+  {
+    for (i=0; i<ring->npoints-1; i++)
+      {
+        double vt;
+        rt_getPoint3dz_p(ctx, ring, i+1, &v2);
+
+        /* edge from vertex i to vertex i+1 */
+        if
+        (
+            /* an upward crossing */
+            ((v1.z <= p->z) && (v2.z > p->z))
+            /* a downward crossing */
+            || ((v1.z > p->z) && (v2.z <= p->z))
+        )
+        {
+
+          vt = (double)(p->z - v1.z) / (v2.z - v1.z);
+
+          /* P.x <intersect */
+          if (p->y < v1.y + vt * (v2.y - v1.y))
+          {
+            /* a valid crossing of y=p.y right of p.x */
+            ++cn;
+          }
+        }
+        v1 = v2;
+      }
+  }
+  RTDEBUGF(3, "pt_in_ring_3d returning %d", cn&1);
+
+  return (cn&1);    /* 0 if even (out), and 1 if odd (in) */
 }
 
 
diff --git a/src/measures3d.h b/src/measures3d.h
index fcc2ca5..0dc8e6e 100644
--- a/src/measures3d.h
+++ b/src/measures3d.h
@@ -39,26 +39,26 @@ Structure used in distance-calculations
 */
 typedef struct
 {
-	double distance;	/*the distance between p1 and p2*/
-	RTPOINT3DZ p1;
-	RTPOINT3DZ p2;
-	int mode;	/*the direction of looking, if thedir = -1 then we look for 3dmaxdistance and if it is 1 then we look for 3dmindistance*/
-	int twisted; /*To preserve the order of incoming points to match the first and second point in 3dshortest and 3dlongest line*/
-	double tolerance; /*the tolerance for 3ddwithin and 3ddfullywithin*/
+  double distance;  /*the distance between p1 and p2*/
+  RTPOINT3DZ p1;
+  RTPOINT3DZ p2;
+  int mode;  /*the direction of looking, if thedir = -1 then we look for 3dmaxdistance and if it is 1 then we look for 3dmindistance*/
+  int twisted; /*To preserve the order of incoming points to match the first and second point in 3dshortest and 3dlongest line*/
+  double tolerance; /*the tolerance for 3ddwithin and 3ddfullywithin*/
 } DISTPTS3D;
 
 typedef struct
 {
-	double	x,y,z;  
+  double  x,y,z;
 }
-VECTOR3D; 
+VECTOR3D;
 
 typedef struct
 {
-	RTPOINT3DZ		pop;  /*Point On Plane*/
-	VECTOR3D	pv;  /*Perpendicular normal vector*/
+  RTPOINT3DZ    pop;  /*Point On Plane*/
+  VECTOR3D  pv;  /*Perpendicular normal vector*/
 }
-PLANE3D; 
+PLANE3D;
 
 
 /*
diff --git a/src/ptarray.c b/src/ptarray.c
index 61e69e6..9003740 100644
--- a/src/ptarray.c
+++ b/src/ptarray.c
@@ -36,15 +36,15 @@
 int
 ptarray_has_z(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	if ( ! pa ) return RT_FALSE;
-	return RTFLAGS_GET_Z(pa->flags);
+  if ( ! pa ) return RT_FALSE;
+  return RTFLAGS_GET_Z(pa->flags);
 }
 
 int
 ptarray_has_m(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	if ( ! pa ) return RT_FALSE;
-	return RTFLAGS_GET_M(pa->flags);
+  if ( ! pa ) return RT_FALSE;
+  return RTFLAGS_GET_M(pa->flags);
 }
 
 /*
@@ -54,311 +54,311 @@ ptarray_has_m(const RTCTX *ctx, const RTPOINTARRAY *pa)
 int inline
 ptarray_point_size(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	RTDEBUGF(5, "ptarray_point_size: RTFLAGS_NDIMS(pa->flags)=%x",RTFLAGS_NDIMS(pa->flags));
+  RTDEBUGF(5, "ptarray_point_size: RTFLAGS_NDIMS(pa->flags)=%x",RTFLAGS_NDIMS(pa->flags));
 
-	return sizeof(double)*RTFLAGS_NDIMS(pa->flags);
+  return sizeof(double)*RTFLAGS_NDIMS(pa->flags);
 }
 
 RTPOINTARRAY*
 ptarray_construct(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints)
 {
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, hasz, hasm, npoints);
-	pa->npoints = npoints;
-	return pa;
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, hasz, hasm, npoints);
+  pa->npoints = npoints;
+  return pa;
 }
 
 RTPOINTARRAY*
 ptarray_construct_empty(const RTCTX *ctx, char hasz, char hasm, uint32_t maxpoints)
 {
-	RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
-	pa->serialized_pointlist = NULL;
-	
-	/* Set our dimsionality info on the bitmap */
-	pa->flags = gflags(ctx, hasz, hasm, 0);
-	
-	/* We will be allocating a bit of room */
-	pa->npoints = 0;
-	pa->maxpoints = maxpoints;
-	
-	/* Allocate the coordinate array */
-	if ( maxpoints > 0 )
-		pa->serialized_pointlist = rtalloc(ctx, maxpoints * ptarray_point_size(ctx, pa));
-	else 
-		pa->serialized_pointlist = NULL;
-
-	return pa;
+  RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
+  pa->serialized_pointlist = NULL;
+
+  /* Set our dimsionality info on the bitmap */
+  pa->flags = gflags(ctx, hasz, hasm, 0);
+
+  /* We will be allocating a bit of room */
+  pa->npoints = 0;
+  pa->maxpoints = maxpoints;
+
+  /* Allocate the coordinate array */
+  if ( maxpoints > 0 )
+    pa->serialized_pointlist = rtalloc(ctx, maxpoints * ptarray_point_size(ctx, pa));
+  else
+    pa->serialized_pointlist = NULL;
+
+  return pa;
 }
 
 /*
-* Add a point into a pointarray. Only adds as many dimensions as the 
+* Add a point into a pointarray. Only adds as many dimensions as the
 * pointarray supports.
 */
 int
 ptarray_insert_point(const RTCTX *ctx, RTPOINTARRAY *pa, const RTPOINT4D *p, int where)
 {
-	size_t point_size = ptarray_point_size(ctx, pa);
-	RTDEBUGF(5,"pa = %p; p = %p; where = %d", pa, p, where);
-	RTDEBUGF(5,"pa->npoints = %d; pa->maxpoints = %d", pa->npoints, pa->maxpoints);
-	
-	if ( RTFLAGS_GET_READONLY(pa->flags) ) 
-	{
-		rterror(ctx, "ptarray_insert_point: called on read-only point array");
-		return RT_FAILURE;
-	}
-	
-	/* Error on invalid offset value */
-	if ( where > pa->npoints || where < 0)
-	{
-		rterror(ctx, "ptarray_insert_point: offset out of range (%d)", where);
-		return RT_FAILURE;
-	}
-	
-	/* If we have no storage, let's allocate some */
-	if( pa->maxpoints == 0 || ! pa->serialized_pointlist ) 
-	{
-		pa->maxpoints = 32;
-		pa->npoints = 0;
-		pa->serialized_pointlist = rtalloc(ctx, ptarray_point_size(ctx, pa) * pa->maxpoints);
-	}
-
-	/* Error out if we have a bad situation */
-	if ( pa->npoints > pa->maxpoints )
-	{
-		rterror(ctx, "npoints (%d) is greated than maxpoints (%d)", pa->npoints, pa->maxpoints);
-		return RT_FAILURE;
-	}
-	
-	/* Check if we have enough storage, add more if necessary */
-	if( pa->npoints == pa->maxpoints )
-	{
-		pa->maxpoints *= 2;
-		pa->serialized_pointlist = rtrealloc(ctx, pa->serialized_pointlist, ptarray_point_size(ctx, pa) * pa->maxpoints);
-	}
-	
-	/* Make space to insert the new point */
-	if( where < pa->npoints )
-	{
-		size_t copy_size = point_size * (pa->npoints - where);
-		memmove(rt_getPoint_internal(ctx, pa, where+1), rt_getPoint_internal(ctx, pa, where), copy_size);
-		RTDEBUGF(5,"copying %d bytes to start vertex %d from start vertex %d", copy_size, where+1, where);
-	}
-	
-	/* We have one more point */
-	++pa->npoints;
-	
-	/* Copy the new point into the gap */
-	ptarray_set_point4d(ctx, pa, where, p);
-	RTDEBUGF(5,"copying new point to start vertex %d", point_size, where);
-	
-	return RT_SUCCESS;
+  size_t point_size = ptarray_point_size(ctx, pa);
+  RTDEBUGF(5,"pa = %p; p = %p; where = %d", pa, p, where);
+  RTDEBUGF(5,"pa->npoints = %d; pa->maxpoints = %d", pa->npoints, pa->maxpoints);
+
+  if ( RTFLAGS_GET_READONLY(pa->flags) )
+  {
+    rterror(ctx, "ptarray_insert_point: called on read-only point array");
+    return RT_FAILURE;
+  }
+
+  /* Error on invalid offset value */
+  if ( where > pa->npoints || where < 0)
+  {
+    rterror(ctx, "ptarray_insert_point: offset out of range (%d)", where);
+    return RT_FAILURE;
+  }
+
+  /* If we have no storage, let's allocate some */
+  if( pa->maxpoints == 0 || ! pa->serialized_pointlist )
+  {
+    pa->maxpoints = 32;
+    pa->npoints = 0;
+    pa->serialized_pointlist = rtalloc(ctx, ptarray_point_size(ctx, pa) * pa->maxpoints);
+  }
+
+  /* Error out if we have a bad situation */
+  if ( pa->npoints > pa->maxpoints )
+  {
+    rterror(ctx, "npoints (%d) is greated than maxpoints (%d)", pa->npoints, pa->maxpoints);
+    return RT_FAILURE;
+  }
+
+  /* Check if we have enough storage, add more if necessary */
+  if( pa->npoints == pa->maxpoints )
+  {
+    pa->maxpoints *= 2;
+    pa->serialized_pointlist = rtrealloc(ctx, pa->serialized_pointlist, ptarray_point_size(ctx, pa) * pa->maxpoints);
+  }
+
+  /* Make space to insert the new point */
+  if( where < pa->npoints )
+  {
+    size_t copy_size = point_size * (pa->npoints - where);
+    memmove(rt_getPoint_internal(ctx, pa, where+1), rt_getPoint_internal(ctx, pa, where), copy_size);
+    RTDEBUGF(5,"copying %d bytes to start vertex %d from start vertex %d", copy_size, where+1, where);
+  }
+
+  /* We have one more point */
+  ++pa->npoints;
+
+  /* Copy the new point into the gap */
+  ptarray_set_point4d(ctx, pa, where, p);
+  RTDEBUGF(5,"copying new point to start vertex %d", point_size, where);
+
+  return RT_SUCCESS;
 }
 
 int
 ptarray_append_point(const RTCTX *ctx, RTPOINTARRAY *pa, const RTPOINT4D *pt, int repeated_points)
 {
 
-	/* Check for pathology */
-	if( ! pa || ! pt ) 
-	{
-		rterror(ctx, "ptarray_append_point: null input");
-		return RT_FAILURE;
-	}
-
-	/* Check for duplicate end point */
-	if ( repeated_points == RT_FALSE && pa->npoints > 0 )
-	{
-		RTPOINT4D tmp;
-		rt_getPoint4d_p(ctx, pa, pa->npoints-1, &tmp);
-		RTDEBUGF(4,"checking for duplicate end point (pt = POINT(%g %g) pa->npoints-q = POINT(%g %g))",pt->x,pt->y,tmp.x,tmp.y);
-
-		/* Return RT_SUCCESS and do nothing else if previous point in list is equal to this one */
-		if ( (pt->x == tmp.x) && (pt->y == tmp.y) &&
-		     (RTFLAGS_GET_Z(pa->flags) ? pt->z == tmp.z : 1) &&
-		     (RTFLAGS_GET_M(pa->flags) ? pt->m == tmp.m : 1) )
-		{
-			return RT_SUCCESS;
-		}
-	}
-
-	/* Append is just a special case of insert */
-	return ptarray_insert_point(ctx, pa, pt, pa->npoints);
+  /* Check for pathology */
+  if( ! pa || ! pt )
+  {
+    rterror(ctx, "ptarray_append_point: null input");
+    return RT_FAILURE;
+  }
+
+  /* Check for duplicate end point */
+  if ( repeated_points == RT_FALSE && pa->npoints > 0 )
+  {
+    RTPOINT4D tmp;
+    rt_getPoint4d_p(ctx, pa, pa->npoints-1, &tmp);
+    RTDEBUGF(4,"checking for duplicate end point (pt = POINT(%g %g) pa->npoints-q = POINT(%g %g))",pt->x,pt->y,tmp.x,tmp.y);
+
+    /* Return RT_SUCCESS and do nothing else if previous point in list is equal to this one */
+    if ( (pt->x == tmp.x) && (pt->y == tmp.y) &&
+         (RTFLAGS_GET_Z(pa->flags) ? pt->z == tmp.z : 1) &&
+         (RTFLAGS_GET_M(pa->flags) ? pt->m == tmp.m : 1) )
+    {
+      return RT_SUCCESS;
+    }
+  }
+
+  /* Append is just a special case of insert */
+  return ptarray_insert_point(ctx, pa, pt, pa->npoints);
 }
 
 int
 ptarray_append_ptarray(const RTCTX *ctx, RTPOINTARRAY *pa1, RTPOINTARRAY *pa2, double gap_tolerance)
 {
-	unsigned int poff = 0;
-	unsigned int npoints;
-	unsigned int ncap;
-	unsigned int ptsize;
-
-	/* Check for pathology */
-	if( ! pa1 || ! pa2 ) 
-	{
-		rterror(ctx, "ptarray_append_ptarray: null input");
-		return RT_FAILURE;
-	}
-
-	npoints = pa2->npoints;
-	
-	if ( ! npoints ) return RT_SUCCESS; /* nothing more to do */
-
-	if( RTFLAGS_GET_READONLY(pa1->flags) )
-	{
-		rterror(ctx, "ptarray_append_ptarray: target pointarray is read-only");
-		return RT_FAILURE;
-	}
-
-	if( RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags) )
-	{
-		rterror(ctx, "ptarray_append_ptarray: appending mixed dimensionality is not allowed");
-		return RT_FAILURE;
-	}
-
-	ptsize = ptarray_point_size(ctx, pa1);
-
-	/* Check for duplicate end point */
-	if ( pa1->npoints )
-	{
-		RTPOINT2D tmp1, tmp2;
-		rt_getPoint2d_p(ctx, pa1, pa1->npoints-1, &tmp1);
-		rt_getPoint2d_p(ctx, pa2, 0, &tmp2);
-
-		/* If the end point and start point are the same, then don't copy start point */
-		if (p2d_same(ctx, &tmp1, &tmp2)) {
-			poff = 1;
-			--npoints;
-		}
-		else if ( gap_tolerance == 0 || ( gap_tolerance > 0 &&
-		           distance2d_pt_pt(ctx, &tmp1, &tmp2) > gap_tolerance ) ) 
-		{
-			rterror(ctx, "Second line start point too far from first line end point");
-			return RT_FAILURE;
-		} 
-	}
-
-	/* Check if we need extra space */
-	ncap = pa1->npoints + npoints;
-	if ( pa1->maxpoints < ncap )
-	{
-		pa1->maxpoints = ncap > pa1->maxpoints*2 ?
-		                 ncap : pa1->maxpoints*2;
-		pa1->serialized_pointlist = rtrealloc(ctx, pa1->serialized_pointlist, ptsize * pa1->maxpoints);
-	}
-
-	memcpy(rt_getPoint_internal(ctx, pa1, pa1->npoints),
-	       rt_getPoint_internal(ctx, pa2, poff), ptsize * npoints);
-
-	pa1->npoints = ncap;
-
-	return RT_SUCCESS;
+  unsigned int poff = 0;
+  unsigned int npoints;
+  unsigned int ncap;
+  unsigned int ptsize;
+
+  /* Check for pathology */
+  if( ! pa1 || ! pa2 )
+  {
+    rterror(ctx, "ptarray_append_ptarray: null input");
+    return RT_FAILURE;
+  }
+
+  npoints = pa2->npoints;
+
+  if ( ! npoints ) return RT_SUCCESS; /* nothing more to do */
+
+  if( RTFLAGS_GET_READONLY(pa1->flags) )
+  {
+    rterror(ctx, "ptarray_append_ptarray: target pointarray is read-only");
+    return RT_FAILURE;
+  }
+
+  if( RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags) )
+  {
+    rterror(ctx, "ptarray_append_ptarray: appending mixed dimensionality is not allowed");
+    return RT_FAILURE;
+  }
+
+  ptsize = ptarray_point_size(ctx, pa1);
+
+  /* Check for duplicate end point */
+  if ( pa1->npoints )
+  {
+    RTPOINT2D tmp1, tmp2;
+    rt_getPoint2d_p(ctx, pa1, pa1->npoints-1, &tmp1);
+    rt_getPoint2d_p(ctx, pa2, 0, &tmp2);
+
+    /* If the end point and start point are the same, then don't copy start point */
+    if (p2d_same(ctx, &tmp1, &tmp2)) {
+      poff = 1;
+      --npoints;
+    }
+    else if ( gap_tolerance == 0 || ( gap_tolerance > 0 &&
+               distance2d_pt_pt(ctx, &tmp1, &tmp2) > gap_tolerance ) )
+    {
+      rterror(ctx, "Second line start point too far from first line end point");
+      return RT_FAILURE;
+    }
+  }
+
+  /* Check if we need extra space */
+  ncap = pa1->npoints + npoints;
+  if ( pa1->maxpoints < ncap )
+  {
+    pa1->maxpoints = ncap > pa1->maxpoints*2 ?
+                     ncap : pa1->maxpoints*2;
+    pa1->serialized_pointlist = rtrealloc(ctx, pa1->serialized_pointlist, ptsize * pa1->maxpoints);
+  }
+
+  memcpy(rt_getPoint_internal(ctx, pa1, pa1->npoints),
+         rt_getPoint_internal(ctx, pa2, poff), ptsize * npoints);
+
+  pa1->npoints = ncap;
+
+  return RT_SUCCESS;
 }
 
 /*
-* Add a point into a pointarray. Only adds as many dimensions as the 
+* Add a point into a pointarray. Only adds as many dimensions as the
 * pointarray supports.
 */
 int
 ptarray_remove_point(const RTCTX *ctx, RTPOINTARRAY *pa, int where)
 {
-	size_t ptsize = ptarray_point_size(ctx, pa);
-
-	/* Check for pathology */
-	if( ! pa ) 
-	{
-		rterror(ctx, "ptarray_remove_point: null input");
-		return RT_FAILURE;
-	}
-	
-	/* Error on invalid offset value */
-	if ( where >= pa->npoints || where < 0)
-	{
-		rterror(ctx, "ptarray_remove_point: offset out of range (%d)", where);
-		return RT_FAILURE;
-	}
-	
-	/* If the point is any but the last, we need to copy the data back one point */
-	if( where < pa->npoints - 1 )
-	{
-		memmove(rt_getPoint_internal(ctx, pa, where), rt_getPoint_internal(ctx, pa, where+1), ptsize * (pa->npoints - where - 1));
-	}
-	
-	/* We have one less point */
-	pa->npoints--;
-	
-	return RT_SUCCESS;
+  size_t ptsize = ptarray_point_size(ctx, pa);
+
+  /* Check for pathology */
+  if( ! pa )
+  {
+    rterror(ctx, "ptarray_remove_point: null input");
+    return RT_FAILURE;
+  }
+
+  /* Error on invalid offset value */
+  if ( where >= pa->npoints || where < 0)
+  {
+    rterror(ctx, "ptarray_remove_point: offset out of range (%d)", where);
+    return RT_FAILURE;
+  }
+
+  /* If the point is any but the last, we need to copy the data back one point */
+  if( where < pa->npoints - 1 )
+  {
+    memmove(rt_getPoint_internal(ctx, pa, where), rt_getPoint_internal(ctx, pa, where+1), ptsize * (pa->npoints - where - 1));
+  }
+
+  /* We have one less point */
+  pa->npoints--;
+
+  return RT_SUCCESS;
 }
 
 /**
-* Build a new #RTPOINTARRAY, but on top of someone else's ordinate array. 
+* Build a new #RTPOINTARRAY, but on top of someone else's ordinate array.
 * Flag as read-only, so that ptarray_free(ctx) does not free the serialized_ptlist
 */
 RTPOINTARRAY* ptarray_construct_reference_data(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints, uint8_t *ptlist)
 {
-	RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
-	RTDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
-	pa->flags = gflags(ctx, hasz, hasm, 0);
-	RTFLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
-	pa->npoints = npoints;
-	pa->maxpoints = npoints;
-	pa->serialized_pointlist = ptlist;
-	return pa;
+  RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
+  RTDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
+  pa->flags = gflags(ctx, hasz, hasm, 0);
+  RTFLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
+  pa->npoints = npoints;
+  pa->maxpoints = npoints;
+  pa->serialized_pointlist = ptlist;
+  return pa;
 }
 
 
 RTPOINTARRAY*
 ptarray_construct_copy_data(const RTCTX *ctx, char hasz, char hasm, uint32_t npoints, const uint8_t *ptlist)
 {
-	RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
-
-	pa->flags = gflags(ctx, hasz, hasm, 0);
-	pa->npoints = npoints;
-	pa->maxpoints = npoints;
-
-	if ( npoints > 0 )
-	{
-		pa->serialized_pointlist = rtalloc(ctx, ptarray_point_size(ctx, pa) * npoints);
-		memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(ctx, pa) * npoints);
-	}
-	else
-	{
-		pa->serialized_pointlist = NULL;
-	}
-
-	return pa;
+  RTPOINTARRAY *pa = rtalloc(ctx, sizeof(RTPOINTARRAY));
+
+  pa->flags = gflags(ctx, hasz, hasm, 0);
+  pa->npoints = npoints;
+  pa->maxpoints = npoints;
+
+  if ( npoints > 0 )
+  {
+    pa->serialized_pointlist = rtalloc(ctx, ptarray_point_size(ctx, pa) * npoints);
+    memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(ctx, pa) * npoints);
+  }
+  else
+  {
+    pa->serialized_pointlist = NULL;
+  }
+
+  return pa;
 }
 
 void ptarray_free(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	if(pa)
-	{
-		if(pa->serialized_pointlist && ( ! RTFLAGS_GET_READONLY(pa->flags) ) )
-			rtfree(ctx, pa->serialized_pointlist);	
-		rtfree(ctx, pa);
-		RTDEBUG(5,"Freeing a PointArray");
-	}
+  if(pa)
+  {
+    if(pa->serialized_pointlist && ( ! RTFLAGS_GET_READONLY(pa->flags) ) )
+      rtfree(ctx, pa->serialized_pointlist);
+    rtfree(ctx, pa);
+    RTDEBUG(5,"Freeing a PointArray");
+  }
 }
 
 
 void
 ptarray_reverse(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	/* TODO change this to double array operations once point array is double aligned */
-	RTPOINT4D pbuf;
-	uint32_t i;
-	int ptsize = ptarray_point_size(ctx, pa);
-	int last = pa->npoints-1;
-	int mid = pa->npoints/2;
-
-	for (i=0; i<mid; i++)
-	{
-		uint8_t *from, *to;
-		from = rt_getPoint_internal(ctx, pa, i);
-		to = rt_getPoint_internal(ctx, pa, (last-i));
-		memcpy((uint8_t *)&pbuf, to, ptsize);
-		memcpy(to, from, ptsize);
-		memcpy(from, (uint8_t *)&pbuf, ptsize);
-	}
+  /* TODO change this to double array operations once point array is double aligned */
+  RTPOINT4D pbuf;
+  uint32_t i;
+  int ptsize = ptarray_point_size(ctx, pa);
+  int last = pa->npoints-1;
+  int mid = pa->npoints/2;
+
+  for (i=0; i<mid; i++)
+  {
+    uint8_t *from, *to;
+    from = rt_getPoint_internal(ctx, pa, i);
+    to = rt_getPoint_internal(ctx, pa, (last-i));
+    memcpy((uint8_t *)&pbuf, to, ptsize);
+    memcpy(to, from, ptsize);
+    memcpy(from, (uint8_t *)&pbuf, ptsize);
+  }
 
 }
 
@@ -369,28 +369,28 @@ ptarray_reverse(const RTCTX *ctx, RTPOINTARRAY *pa)
 RTPOINTARRAY*
 ptarray_flip_coordinates(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	int i;
-	double d;
-	RTPOINT4D p;
-
-	for (i=0 ; i < pa->npoints ; i++)
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		d = p.y;
-		p.y = p.x;
-		p.x = d;
-		ptarray_set_point4d(ctx, pa, i, &p);
-	}
-
-	return pa;
+  int i;
+  double d;
+  RTPOINT4D p;
+
+  for (i=0 ; i < pa->npoints ; i++)
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    d = p.y;
+    p.y = p.x;
+    p.x = d;
+    ptarray_set_point4d(ctx, pa, i, &p);
+  }
+
+  return pa;
 }
 
 void
 ptarray_swap_ordinates(const RTCTX *ctx, RTPOINTARRAY *pa, RTORD o1, RTORD o2)
 {
-	int i;
-	double d, *dp1, *dp2;
-	RTPOINT4D p;
+  int i;
+  double d, *dp1, *dp2;
+  RTPOINT4D p;
 
 #if PARANOIA_LEVEL > 0
   assert(o1 < 4);
@@ -399,20 +399,20 @@ ptarray_swap_ordinates(const RTCTX *ctx, RTPOINTARRAY *pa, RTORD o1, RTORD o2)
 
   dp1 = ((double*)&p)+(unsigned)o1;
   dp2 = ((double*)&p)+(unsigned)o2;
-	for (i=0 ; i < pa->npoints ; i++)
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		d = *dp2;
-		*dp2 = *dp1;
-		*dp1 = d;
-		ptarray_set_point4d(ctx, pa, i, &p);
-	}
+  for (i=0 ; i < pa->npoints ; i++)
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    d = *dp2;
+    *dp2 = *dp1;
+    *dp1 = d;
+    ptarray_set_point4d(ctx, pa, i, &p);
+  }
 }
 
 
 /**
  * @brief Returns a modified #RTPOINTARRAY so that no segment is
- * 		longer than the given distance (computed using 2d).
+ *     longer than the given distance (computed using 2d).
  *
  * Every input point is kept.
  * Z and M values for added points (if needed) are set to 0.
@@ -420,211 +420,211 @@ ptarray_swap_ordinates(const RTCTX *ctx, RTPOINTARRAY *pa, RTORD o1, RTORD o2)
 RTPOINTARRAY *
 ptarray_segmentize2d(const RTCTX *ctx, const RTPOINTARRAY *ipa, double dist)
 {
-	double	segdist;
-	RTPOINT4D	p1, p2;
-	RTPOINT4D pbuf;
-	RTPOINTARRAY *opa;
-	int ipoff=0; /* input point offset */
-	int hasz = RTFLAGS_GET_Z(ipa->flags);
-	int hasm = RTFLAGS_GET_M(ipa->flags);
-
-	pbuf.x = pbuf.y = pbuf.z = pbuf.m = 0;
-
-	/* Initial storage */
-	opa = ptarray_construct_empty(ctx, hasz, hasm, ipa->npoints);
-	
-	/* Add first point */
-	rt_getPoint4d_p(ctx, ipa, ipoff, &p1);
-	ptarray_append_point(ctx, opa, &p1, RT_FALSE);
-
-	ipoff++;
-
-	while (ipoff<ipa->npoints)
-	{
-		/*
-		 * We use these pointers to avoid
-		 * "strict-aliasing rules break" warning raised
-		 * by gcc (3.3 and up).
-		 *
-		 * It looks that casting a variable address (also
-		 * referred to as "type-punned pointer")
-		 * breaks those "strict" rules.
-		 *
-		 */
-		RTPOINT4D *p1ptr=&p1, *p2ptr=&p2;
-
-		rt_getPoint4d_p(ctx, ipa, ipoff, &p2);
-
-		segdist = distance2d_pt_pt(ctx, (RTPOINT2D *)p1ptr, (RTPOINT2D *)p2ptr);
-
-		if (segdist > dist) /* add an intermediate point */
-		{
-			pbuf.x = p1.x + (p2.x-p1.x)/segdist * dist;
-			pbuf.y = p1.y + (p2.y-p1.y)/segdist * dist;
-			if( hasz ) 
-				pbuf.z = p1.z + (p2.z-p1.z)/segdist * dist;
-			if( hasm )
-				pbuf.m = p1.m + (p2.m-p1.m)/segdist * dist;
-			ptarray_append_point(ctx, opa, &pbuf, RT_FALSE);
-			p1 = pbuf;
-		}
-		else /* copy second point */
-		{
-			ptarray_append_point(ctx, opa, &p2, (ipa->npoints==2)?RT_TRUE:RT_FALSE);
-			p1 = p2;
-			ipoff++;
-		}
-
-		RT_ON_INTERRUPT(ptarray_free(ctx, opa); return NULL);
-	}
-
-	return opa;
+  double  segdist;
+  RTPOINT4D  p1, p2;
+  RTPOINT4D pbuf;
+  RTPOINTARRAY *opa;
+  int ipoff=0; /* input point offset */
+  int hasz = RTFLAGS_GET_Z(ipa->flags);
+  int hasm = RTFLAGS_GET_M(ipa->flags);
+
+  pbuf.x = pbuf.y = pbuf.z = pbuf.m = 0;
+
+  /* Initial storage */
+  opa = ptarray_construct_empty(ctx, hasz, hasm, ipa->npoints);
+
+  /* Add first point */
+  rt_getPoint4d_p(ctx, ipa, ipoff, &p1);
+  ptarray_append_point(ctx, opa, &p1, RT_FALSE);
+
+  ipoff++;
+
+  while (ipoff<ipa->npoints)
+  {
+    /*
+     * We use these pointers to avoid
+     * "strict-aliasing rules break" warning raised
+     * by gcc (3.3 and up).
+     *
+     * It looks that casting a variable address (also
+     * referred to as "type-punned pointer")
+     * breaks those "strict" rules.
+     *
+     */
+    RTPOINT4D *p1ptr=&p1, *p2ptr=&p2;
+
+    rt_getPoint4d_p(ctx, ipa, ipoff, &p2);
+
+    segdist = distance2d_pt_pt(ctx, (RTPOINT2D *)p1ptr, (RTPOINT2D *)p2ptr);
+
+    if (segdist > dist) /* add an intermediate point */
+    {
+      pbuf.x = p1.x + (p2.x-p1.x)/segdist * dist;
+      pbuf.y = p1.y + (p2.y-p1.y)/segdist * dist;
+      if( hasz )
+        pbuf.z = p1.z + (p2.z-p1.z)/segdist * dist;
+      if( hasm )
+        pbuf.m = p1.m + (p2.m-p1.m)/segdist * dist;
+      ptarray_append_point(ctx, opa, &pbuf, RT_FALSE);
+      p1 = pbuf;
+    }
+    else /* copy second point */
+    {
+      ptarray_append_point(ctx, opa, &p2, (ipa->npoints==2)?RT_TRUE:RT_FALSE);
+      p1 = p2;
+      ipoff++;
+    }
+
+    RT_ON_INTERRUPT(ptarray_free(ctx, opa); return NULL);
+  }
+
+  return opa;
 }
 
 char
 ptarray_same(const RTCTX *ctx, const RTPOINTARRAY *pa1, const RTPOINTARRAY *pa2)
 {
-	uint32_t i;
-	size_t ptsize;
-
-	if ( RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags) ) return RT_FALSE;
-	RTDEBUG(5,"dimensions are the same");
-	
-	if ( pa1->npoints != pa2->npoints ) return RT_FALSE;
-	RTDEBUG(5,"npoints are the same");
-
-	ptsize = ptarray_point_size(ctx, pa1);
-	RTDEBUGF(5, "ptsize = %d", ptsize);
-
-	for (i=0; i<pa1->npoints; i++)
-	{
-		if ( memcmp(rt_getPoint_internal(ctx, pa1, i), rt_getPoint_internal(ctx, pa2, i), ptsize) )
-			return RT_FALSE;
-		RTDEBUGF(5,"point #%d is the same",i);
-	}
-
-	return RT_TRUE;
+  uint32_t i;
+  size_t ptsize;
+
+  if ( RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags) ) return RT_FALSE;
+  RTDEBUG(5,"dimensions are the same");
+
+  if ( pa1->npoints != pa2->npoints ) return RT_FALSE;
+  RTDEBUG(5,"npoints are the same");
+
+  ptsize = ptarray_point_size(ctx, pa1);
+  RTDEBUGF(5, "ptsize = %d", ptsize);
+
+  for (i=0; i<pa1->npoints; i++)
+  {
+    if ( memcmp(rt_getPoint_internal(ctx, pa1, i), rt_getPoint_internal(ctx, pa2, i), ptsize) )
+      return RT_FALSE;
+    RTDEBUGF(5,"point #%d is the same",i);
+  }
+
+  return RT_TRUE;
 }
 
 RTPOINTARRAY *
 ptarray_addPoint(const RTCTX *ctx, const RTPOINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
 {
-	RTPOINTARRAY *ret;
-	RTPOINT4D pbuf;
-	size_t ptsize = ptarray_point_size(ctx, pa);
+  RTPOINTARRAY *ret;
+  RTPOINT4D pbuf;
+  size_t ptsize = ptarray_point_size(ctx, pa);
 
-	RTDEBUGF(3, "pa %x p %x size %d where %d",
-	         pa, p, pdims, where);
+  RTDEBUGF(3, "pa %x p %x size %d where %d",
+           pa, p, pdims, where);
 
-	if ( pdims < 2 || pdims > 4 )
-	{
-		rterror(ctx, "ptarray_addPoint: point dimension out of range (%d)",
-		        pdims);
-		return NULL;
-	}
+  if ( pdims < 2 || pdims > 4 )
+  {
+    rterror(ctx, "ptarray_addPoint: point dimension out of range (%d)",
+            pdims);
+    return NULL;
+  }
 
-	if ( where > pa->npoints )
-	{
-		rterror(ctx, "ptarray_addPoint: offset out of range (%d)",
-		        where);
-		return NULL;
-	}
+  if ( where > pa->npoints )
+  {
+    rterror(ctx, "ptarray_addPoint: offset out of range (%d)",
+            where);
+    return NULL;
+  }
 
-	RTDEBUG(3, "called with a %dD point");
+  RTDEBUG(3, "called with a %dD point");
 
-	pbuf.x = pbuf.y = pbuf.z = pbuf.m = 0.0;
-	memcpy((uint8_t *)&pbuf, p, pdims*sizeof(double));
+  pbuf.x = pbuf.y = pbuf.z = pbuf.m = 0.0;
+  memcpy((uint8_t *)&pbuf, p, pdims*sizeof(double));
 
-	RTDEBUG(3, "initialized point buffer");
+  RTDEBUG(3, "initialized point buffer");
 
-	ret = ptarray_construct(ctx, RTFLAGS_GET_Z(pa->flags),
-	                        RTFLAGS_GET_M(pa->flags), pa->npoints+1);
+  ret = ptarray_construct(ctx, RTFLAGS_GET_Z(pa->flags),
+                          RTFLAGS_GET_M(pa->flags), pa->npoints+1);
 
-	if ( where == -1 ) where = pa->npoints;
+  if ( where == -1 ) where = pa->npoints;
 
-	if ( where )
-	{
-		memcpy(rt_getPoint_internal(ctx, ret, 0), rt_getPoint_internal(ctx, pa, 0), ptsize*where);
-	}
+  if ( where )
+  {
+    memcpy(rt_getPoint_internal(ctx, ret, 0), rt_getPoint_internal(ctx, pa, 0), ptsize*where);
+  }
 
-	memcpy(rt_getPoint_internal(ctx, ret, where), (uint8_t *)&pbuf, ptsize);
+  memcpy(rt_getPoint_internal(ctx, ret, where), (uint8_t *)&pbuf, ptsize);
 
-	if ( where+1 != ret->npoints )
-	{
-		memcpy(rt_getPoint_internal(ctx, ret, where+1),
-		       rt_getPoint_internal(ctx, pa, where),
-		       ptsize*(pa->npoints-where));
-	}
+  if ( where+1 != ret->npoints )
+  {
+    memcpy(rt_getPoint_internal(ctx, ret, where+1),
+           rt_getPoint_internal(ctx, pa, where),
+           ptsize*(pa->npoints-where));
+  }
 
-	return ret;
+  return ret;
 }
 
 RTPOINTARRAY *
 ptarray_removePoint(const RTCTX *ctx, RTPOINTARRAY *pa, uint32_t which)
 {
-	RTPOINTARRAY *ret;
-	size_t ptsize = ptarray_point_size(ctx, pa);
+  RTPOINTARRAY *ret;
+  size_t ptsize = ptarray_point_size(ctx, pa);
 
-	RTDEBUGF(3, "pa %x which %d", pa, which);
+  RTDEBUGF(3, "pa %x which %d", pa, which);
 
 #if PARANOIA_LEVEL > 0
-	if ( which > pa->npoints-1 )
-	{
-		rterror(ctx, "ptarray_removePoint: offset (%d) out of range (%d..%d)",
-		        which, 0, pa->npoints-1);
-		return NULL;
-	}
-
-	if ( pa->npoints < 3 )
-	{
-		rterror(ctx, "ptarray_removePointe: can't remove a point from a 2-vertex RTPOINTARRAY");
-	}
+  if ( which > pa->npoints-1 )
+  {
+    rterror(ctx, "ptarray_removePoint: offset (%d) out of range (%d..%d)",
+            which, 0, pa->npoints-1);
+    return NULL;
+  }
+
+  if ( pa->npoints < 3 )
+  {
+    rterror(ctx, "ptarray_removePointe: can't remove a point from a 2-vertex RTPOINTARRAY");
+  }
 #endif
 
-	ret = ptarray_construct(ctx, RTFLAGS_GET_Z(pa->flags),
-	                        RTFLAGS_GET_M(pa->flags), pa->npoints-1);
+  ret = ptarray_construct(ctx, RTFLAGS_GET_Z(pa->flags),
+                          RTFLAGS_GET_M(pa->flags), pa->npoints-1);
 
-	/* copy initial part */
-	if ( which )
-	{
-		memcpy(rt_getPoint_internal(ctx, ret, 0), rt_getPoint_internal(ctx, pa, 0), ptsize*which);
-	}
+  /* copy initial part */
+  if ( which )
+  {
+    memcpy(rt_getPoint_internal(ctx, ret, 0), rt_getPoint_internal(ctx, pa, 0), ptsize*which);
+  }
 
-	/* copy final part */
-	if ( which < pa->npoints-1 )
-	{
-		memcpy(rt_getPoint_internal(ctx, ret, which), rt_getPoint_internal(ctx, pa, which+1),
-		       ptsize*(pa->npoints-which-1));
-	}
+  /* copy final part */
+  if ( which < pa->npoints-1 )
+  {
+    memcpy(rt_getPoint_internal(ctx, ret, which), rt_getPoint_internal(ctx, pa, which+1),
+           ptsize*(pa->npoints-which-1));
+  }
 
-	return ret;
+  return ret;
 }
 
 RTPOINTARRAY *
 ptarray_merge(const RTCTX *ctx, RTPOINTARRAY *pa1, RTPOINTARRAY *pa2)
 {
-	RTPOINTARRAY *pa;
-	size_t ptsize = ptarray_point_size(ctx, pa1);
+  RTPOINTARRAY *pa;
+  size_t ptsize = ptarray_point_size(ctx, pa1);
 
-	if (RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags))
-		rterror(ctx, "ptarray_cat: Mixed dimension");
+  if (RTFLAGS_GET_ZM(pa1->flags) != RTFLAGS_GET_ZM(pa2->flags))
+    rterror(ctx, "ptarray_cat: Mixed dimension");
 
-	pa = ptarray_construct(ctx,  RTFLAGS_GET_Z(pa1->flags),
-	                        RTFLAGS_GET_M(pa1->flags),
-	                        pa1->npoints + pa2->npoints);
+  pa = ptarray_construct(ctx,  RTFLAGS_GET_Z(pa1->flags),
+                          RTFLAGS_GET_M(pa1->flags),
+                          pa1->npoints + pa2->npoints);
 
-	memcpy(         rt_getPoint_internal(ctx, pa, 0),
-	                rt_getPoint_internal(ctx, pa1, 0),
-	                ptsize*(pa1->npoints));
+  memcpy(         rt_getPoint_internal(ctx, pa, 0),
+                  rt_getPoint_internal(ctx, pa1, 0),
+                  ptsize*(pa1->npoints));
 
-	memcpy(         rt_getPoint_internal(ctx, pa, pa1->npoints),
-	                rt_getPoint_internal(ctx, pa2, 0),
-	                ptsize*(pa2->npoints));
+  memcpy(         rt_getPoint_internal(ctx, pa, pa1->npoints),
+                  rt_getPoint_internal(ctx, pa2, 0),
+                  ptsize*(pa2->npoints));
 
-	ptarray_free(ctx, pa1);
-	ptarray_free(ctx, pa2);
+  ptarray_free(ctx, pa1);
+  ptarray_free(ctx, pa2);
 
-	return pa;
+  return pa;
 }
 
 
@@ -634,22 +634,22 @@ ptarray_merge(const RTCTX *ctx, RTPOINTARRAY *pa1, RTPOINTARRAY *pa2)
 RTPOINTARRAY *
 ptarray_clone_deep(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	RTPOINTARRAY *out = rtalloc(ctx, sizeof(RTPOINTARRAY));
-	size_t size;
+  RTPOINTARRAY *out = rtalloc(ctx, sizeof(RTPOINTARRAY));
+  size_t size;
 
-	RTDEBUG(3, "ptarray_clone_deep called.");
+  RTDEBUG(3, "ptarray_clone_deep called.");
 
-	out->flags = in->flags;
-	out->npoints = in->npoints;
-	out->maxpoints = in->maxpoints;
+  out->flags = in->flags;
+  out->npoints = in->npoints;
+  out->maxpoints = in->maxpoints;
 
-	RTFLAGS_SET_READONLY(out->flags, 0);
+  RTFLAGS_SET_READONLY(out->flags, 0);
 
-	size = in->npoints * ptarray_point_size(ctx, in);
-	out->serialized_pointlist = rtalloc(ctx, size);
-	memcpy(out->serialized_pointlist, in->serialized_pointlist, size);
+  size = in->npoints * ptarray_point_size(ctx, in);
+  out->serialized_pointlist = rtalloc(ctx, size);
+  memcpy(out->serialized_pointlist, in->serialized_pointlist, size);
 
-	return out;
+  return out;
 }
 
 /**
@@ -658,145 +658,145 @@ ptarray_clone_deep(const RTCTX *ctx, const RTPOINTARRAY *in)
 RTPOINTARRAY *
 ptarray_clone(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	RTPOINTARRAY *out = rtalloc(ctx, sizeof(RTPOINTARRAY));
+  RTPOINTARRAY *out = rtalloc(ctx, sizeof(RTPOINTARRAY));
 
-	RTDEBUG(3, "ptarray_clone_deep called.");
+  RTDEBUG(3, "ptarray_clone_deep called.");
 
-	out->flags = in->flags;
-	out->npoints = in->npoints;
-	out->maxpoints = in->maxpoints;
+  out->flags = in->flags;
+  out->npoints = in->npoints;
+  out->maxpoints = in->maxpoints;
 
-	RTFLAGS_SET_READONLY(out->flags, 1);
+  RTFLAGS_SET_READONLY(out->flags, 1);
 
-	out->serialized_pointlist = in->serialized_pointlist;
+  out->serialized_pointlist = in->serialized_pointlist;
 
-	return out;
+  return out;
 }
 
 /**
-* Check for ring closure using whatever dimensionality is declared on the 
+* Check for ring closure using whatever dimensionality is declared on the
 * pointarray.
 */
 int
 ptarray_is_closed(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), ptarray_point_size(ctx, in));
+  return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), ptarray_point_size(ctx, in));
 }
 
 
 int
 ptarray_is_closed_2d(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), sizeof(RTPOINT2D));
+  return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), sizeof(RTPOINT2D));
 }
 
 int
 ptarray_is_closed_3d(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), sizeof(POINT3D));
+  return 0 == memcmp(rt_getPoint_internal(ctx, in, 0), rt_getPoint_internal(ctx, in, in->npoints-1), sizeof(POINT3D));
 }
 
 int
 ptarray_is_closed_z(const RTCTX *ctx, const RTPOINTARRAY *in)
 {
-	if ( RTFLAGS_GET_Z(in->flags) )
-		return ptarray_is_closed_3d(ctx, in);
-	else
-		return ptarray_is_closed_2d(ctx, in);
+  if ( RTFLAGS_GET_Z(in->flags) )
+    return ptarray_is_closed_3d(ctx, in);
+  else
+    return ptarray_is_closed_2d(ctx, in);
 }
 
 /**
 * Return 1 if the point is inside the RTPOINTARRAY, -1 if it is outside,
 * and 0 if it is on the boundary.
 */
-int 
+int
 ptarray_contains_point(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT2D *pt)
 {
-	return ptarray_contains_point_partial(ctx, pa, pt, RT_TRUE, NULL);
+  return ptarray_contains_point_partial(ctx, pa, pt, RT_TRUE, NULL);
 }
 
-int 
+int
 ptarray_contains_point_partial(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT2D *pt, int check_closed, int *winding_number)
 {
-	int wn = 0;
-	int i;
-	double side;
-	const RTPOINT2D *seg1;
-	const RTPOINT2D *seg2;
-	double ymin, ymax;
-
-	seg1 = rt_getPoint2d_cp(ctx, pa, 0);
-	seg2 = rt_getPoint2d_cp(ctx, pa, pa->npoints-1);
-	if ( check_closed && ! p2d_same(ctx, seg1, seg2) )
-		rterror(ctx, "ptarray_contains_point called on unclosed ring");
-	
-	for ( i=1; i < pa->npoints; i++ )
-	{
-		seg2 = rt_getPoint2d_cp(ctx, pa, i);
-		
-		/* Zero length segments are ignored. */
-		if ( seg1->x == seg2->x && seg1->y == seg2->y )
-		{
-			seg1 = seg2;
-			continue;
-		}
-			
-		ymin = FP_MIN(seg1->y, seg2->y);
-		ymax = FP_MAX(seg1->y, seg2->y);
-		
-		/* Only test segments in our vertical range */
-		if ( pt->y > ymax || pt->y < ymin ) 
-		{
-			seg1 = seg2;
-			continue;
-		}
-
-		side = rt_segment_side(ctx, seg1, seg2, pt);
-
-		/* 
-		* A point on the boundary of a ring is not contained. 
-		* WAS: if (fabs(side) < 1e-12), see #852 
-		*/
-		if ( (side == 0) && rt_pt_in_seg(ctx, pt, seg1, seg2) )
-		{
-			return RT_BOUNDARY;
-		}
-
-		/*
-		* If the point is to the left of the line, and it's rising,
-		* then the line is to the right of the point and
-		* circling counter-clockwise, so incremement.
-		*/
-		if ( (side < 0) && (seg1->y <= pt->y) && (pt->y < seg2->y) )
-		{
-			wn++;
-		}
-		
-		/*
-		* If the point is to the right of the line, and it's falling,
-		* then the line is to the right of the point and circling
-		* clockwise, so decrement.
-		*/
-		else if ( (side > 0) && (seg2->y <= pt->y) && (pt->y < seg1->y) )
-		{
-			wn--;
-		}
-		
-		seg1 = seg2;
-	}
-
-	/* Sent out the winding number for calls that are building on this as a primitive */
-	if ( winding_number )
-		*winding_number = wn;
-
-	/* Outside */
-	if (wn == 0)
-	{
-		return RT_OUTSIDE;
-	}
-	
-	/* Inside */
-	return RT_INSIDE;
+  int wn = 0;
+  int i;
+  double side;
+  const RTPOINT2D *seg1;
+  const RTPOINT2D *seg2;
+  double ymin, ymax;
+
+  seg1 = rt_getPoint2d_cp(ctx, pa, 0);
+  seg2 = rt_getPoint2d_cp(ctx, pa, pa->npoints-1);
+  if ( check_closed && ! p2d_same(ctx, seg1, seg2) )
+    rterror(ctx, "ptarray_contains_point called on unclosed ring");
+
+  for ( i=1; i < pa->npoints; i++ )
+  {
+    seg2 = rt_getPoint2d_cp(ctx, pa, i);
+
+    /* Zero length segments are ignored. */
+    if ( seg1->x == seg2->x && seg1->y == seg2->y )
+    {
+      seg1 = seg2;
+      continue;
+    }
+
+    ymin = FP_MIN(seg1->y, seg2->y);
+    ymax = FP_MAX(seg1->y, seg2->y);
+
+    /* Only test segments in our vertical range */
+    if ( pt->y > ymax || pt->y < ymin )
+    {
+      seg1 = seg2;
+      continue;
+    }
+
+    side = rt_segment_side(ctx, seg1, seg2, pt);
+
+    /*
+    * A point on the boundary of a ring is not contained.
+    * WAS: if (fabs(side) < 1e-12), see #852
+    */
+    if ( (side == 0) && rt_pt_in_seg(ctx, pt, seg1, seg2) )
+    {
+      return RT_BOUNDARY;
+    }
+
+    /*
+    * If the point is to the left of the line, and it's rising,
+    * then the line is to the right of the point and
+    * circling counter-clockwise, so incremement.
+    */
+    if ( (side < 0) && (seg1->y <= pt->y) && (pt->y < seg2->y) )
+    {
+      wn++;
+    }
+
+    /*
+    * If the point is to the right of the line, and it's falling,
+    * then the line is to the right of the point and circling
+    * clockwise, so decrement.
+    */
+    else if ( (side > 0) && (seg2->y <= pt->y) && (pt->y < seg1->y) )
+    {
+      wn--;
+    }
+
+    seg1 = seg2;
+  }
+
+  /* Sent out the winding number for calls that are building on this as a primitive */
+  if ( winding_number )
+    *winding_number = wn;
+
+  /* Outside */
+  if (wn == 0)
+  {
+    return RT_OUTSIDE;
+  }
+
+  /* Inside */
+  return RT_INSIDE;
 }
 
 /**
@@ -808,423 +808,423 @@ ptarray_contains_point_partial(const RTCTX *ctx, const RTPOINTARRAY *pa, const R
 * and 0 if it is on the boundary.
 */
 
-int 
+int
 ptarrayarc_contains_point(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT2D *pt)
 {
-	return ptarrayarc_contains_point_partial(ctx, pa, pt, RT_TRUE /* Check closed*/, NULL);
+  return ptarrayarc_contains_point_partial(ctx, pa, pt, RT_TRUE /* Check closed*/, NULL);
 }
 
-int 
+int
 ptarrayarc_contains_point_partial(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT2D *pt, int check_closed, int *winding_number)
 {
-	int wn = 0;
-	int i, side;
-	const RTPOINT2D *seg1;
-	const RTPOINT2D *seg2;
-	const RTPOINT2D *seg3;
-	RTGBOX gbox;
-
-	/* Check for not an arc ring (artays have odd # of points) */
-	if ( (pa->npoints % 2) == 0 )
-	{
-		rterror(ctx, "ptarrayarc_contains_point called with even number of points");
-		return RT_OUTSIDE;
-	}
-
-	/* Check for not an arc ring (artays have >= 3 points) */
-	if ( pa->npoints < 3 )
-	{
-		rterror(ctx, "ptarrayarc_contains_point called too-short pointarray");
-		return RT_OUTSIDE;
-	}
-
-	/* Check for unclosed case */
-	seg1 = rt_getPoint2d_cp(ctx, pa, 0);
-	seg3 = rt_getPoint2d_cp(ctx, pa, pa->npoints-1);
-	if ( check_closed && ! p2d_same(ctx, seg1, seg3) )
-	{
-		rterror(ctx, "ptarrayarc_contains_point called on unclosed ring");
-		return RT_OUTSIDE;
-	} 
-	/* OK, it's closed. Is it just one circle? */
-	else if ( p2d_same(ctx, seg1, seg3) && pa->npoints == 3 )
-	{
-		double radius, d;
-		RTPOINT2D c;
-		seg2 = rt_getPoint2d_cp(ctx, pa, 1);
-		
-		/* Wait, it's just a point, so it can't contain anything */
-		if ( rt_arc_is_pt(ctx, seg1, seg2, seg3) )
-			return RT_OUTSIDE;
-			
-		/* See if the point is within the circle radius */
-		radius = rt_arc_center(ctx, seg1, seg2, seg3, &c);
-		d = distance2d_pt_pt(ctx, pt, &c);
-		if ( FP_EQUALS(d, radius) )
-			return RT_BOUNDARY; /* Boundary of circle */
-		else if ( d < radius ) 
-			return RT_INSIDE; /* Inside circle */
-		else 
-			return RT_OUTSIDE; /* Outside circle */
-	} 
-	else if ( p2d_same(ctx, seg1, pt) || p2d_same(ctx, seg3, pt) )
-	{
-		return RT_BOUNDARY; /* Boundary case */
-	}
-
-	/* Start on the ring */
-	seg1 = rt_getPoint2d_cp(ctx, pa, 0);
-	for ( i=1; i < pa->npoints; i += 2 )
-	{
-		seg2 = rt_getPoint2d_cp(ctx, pa, i);
-		seg3 = rt_getPoint2d_cp(ctx, pa, i+1);
-		
-		/* Catch an easy boundary case */
-		if( p2d_same(ctx, seg3, pt) )
-			return RT_BOUNDARY;
-		
-		/* Skip arcs that have no size */
-		if ( rt_arc_is_pt(ctx, seg1, seg2, seg3) )
-		{
-			seg1 = seg3;
-			continue;
-		}
-		
-		/* Only test segments in our vertical range */
-		rt_arc_calculate_gbox_cartesian_2d(ctx, seg1, seg2, seg3, &gbox);
-		if ( pt->y > gbox.ymax || pt->y < gbox.ymin ) 
-		{
-			seg1 = seg3;
-			continue;
-		}
-
-		/* Outside of horizontal range, and not between end points we also skip */
-		if ( (pt->x > gbox.xmax || pt->x < gbox.xmin) && 
-			 (pt->y > FP_MAX(seg1->y, seg3->y) || pt->y < FP_MIN(seg1->y, seg3->y)) ) 
-		{
-			seg1 = seg3;
-			continue;
-		}		
-		
-		side = rt_arc_side(ctx, seg1, seg2, seg3, pt);
-		
-		/* On the boundary */
-		if ( (side == 0) && rt_pt_in_arc(ctx, pt, seg1, seg2, seg3) )
-		{
-			return RT_BOUNDARY;
-		}
-		
-		/* Going "up"! Point to left of arc. */
-		if ( side < 0 && (seg1->y <= pt->y) && (pt->y < seg3->y) )
-		{
-			wn++;
-		}
-
-		/* Going "down"! */
-		if ( side > 0 && (seg2->y <= pt->y) && (pt->y < seg1->y) )
-		{
-			wn--;
-		}
-		
-		/* Inside the arc! */
-		if ( pt->x <= gbox.xmax && pt->x >= gbox.xmin ) 
-		{
-			RTPOINT2D C;
-			double radius = rt_arc_center(ctx, seg1, seg2, seg3, &C);
-			double d = distance2d_pt_pt(ctx, pt, &C);
-
-			/* On the boundary! */
-			if ( d == radius )
-				return RT_BOUNDARY;
-			
-			/* Within the arc! */
-			if ( d  < radius )
-			{
-				/* Left side, increment winding number */
-				if ( side < 0 )
-					wn++;
-				/* Right side, decrement winding number */
-				if ( side > 0 ) 
-					wn--;
-			}
-		}
-
-		seg1 = seg3;
-	}
-
-	/* Sent out the winding number for calls that are building on this as a primitive */
-	if ( winding_number )
-		*winding_number = wn;
-
-	/* Outside */
-	if (wn == 0)
-	{
-		return RT_OUTSIDE;
-	}
-	
-	/* Inside */
-	return RT_INSIDE;
+  int wn = 0;
+  int i, side;
+  const RTPOINT2D *seg1;
+  const RTPOINT2D *seg2;
+  const RTPOINT2D *seg3;
+  RTGBOX gbox;
+
+  /* Check for not an arc ring (artays have odd # of points) */
+  if ( (pa->npoints % 2) == 0 )
+  {
+    rterror(ctx, "ptarrayarc_contains_point called with even number of points");
+    return RT_OUTSIDE;
+  }
+
+  /* Check for not an arc ring (artays have >= 3 points) */
+  if ( pa->npoints < 3 )
+  {
+    rterror(ctx, "ptarrayarc_contains_point called too-short pointarray");
+    return RT_OUTSIDE;
+  }
+
+  /* Check for unclosed case */
+  seg1 = rt_getPoint2d_cp(ctx, pa, 0);
+  seg3 = rt_getPoint2d_cp(ctx, pa, pa->npoints-1);
+  if ( check_closed && ! p2d_same(ctx, seg1, seg3) )
+  {
+    rterror(ctx, "ptarrayarc_contains_point called on unclosed ring");
+    return RT_OUTSIDE;
+  }
+  /* OK, it's closed. Is it just one circle? */
+  else if ( p2d_same(ctx, seg1, seg3) && pa->npoints == 3 )
+  {
+    double radius, d;
+    RTPOINT2D c;
+    seg2 = rt_getPoint2d_cp(ctx, pa, 1);
+
+    /* Wait, it's just a point, so it can't contain anything */
+    if ( rt_arc_is_pt(ctx, seg1, seg2, seg3) )
+      return RT_OUTSIDE;
+
+    /* See if the point is within the circle radius */
+    radius = rt_arc_center(ctx, seg1, seg2, seg3, &c);
+    d = distance2d_pt_pt(ctx, pt, &c);
+    if ( FP_EQUALS(d, radius) )
+      return RT_BOUNDARY; /* Boundary of circle */
+    else if ( d < radius )
+      return RT_INSIDE; /* Inside circle */
+    else
+      return RT_OUTSIDE; /* Outside circle */
+  }
+  else if ( p2d_same(ctx, seg1, pt) || p2d_same(ctx, seg3, pt) )
+  {
+    return RT_BOUNDARY; /* Boundary case */
+  }
+
+  /* Start on the ring */
+  seg1 = rt_getPoint2d_cp(ctx, pa, 0);
+  for ( i=1; i < pa->npoints; i += 2 )
+  {
+    seg2 = rt_getPoint2d_cp(ctx, pa, i);
+    seg3 = rt_getPoint2d_cp(ctx, pa, i+1);
+
+    /* Catch an easy boundary case */
+    if( p2d_same(ctx, seg3, pt) )
+      return RT_BOUNDARY;
+
+    /* Skip arcs that have no size */
+    if ( rt_arc_is_pt(ctx, seg1, seg2, seg3) )
+    {
+      seg1 = seg3;
+      continue;
+    }
+
+    /* Only test segments in our vertical range */
+    rt_arc_calculate_gbox_cartesian_2d(ctx, seg1, seg2, seg3, &gbox);
+    if ( pt->y > gbox.ymax || pt->y < gbox.ymin )
+    {
+      seg1 = seg3;
+      continue;
+    }
+
+    /* Outside of horizontal range, and not between end points we also skip */
+    if ( (pt->x > gbox.xmax || pt->x < gbox.xmin) &&
+       (pt->y > FP_MAX(seg1->y, seg3->y) || pt->y < FP_MIN(seg1->y, seg3->y)) )
+    {
+      seg1 = seg3;
+      continue;
+    }
+
+    side = rt_arc_side(ctx, seg1, seg2, seg3, pt);
+
+    /* On the boundary */
+    if ( (side == 0) && rt_pt_in_arc(ctx, pt, seg1, seg2, seg3) )
+    {
+      return RT_BOUNDARY;
+    }
+
+    /* Going "up"! Point to left of arc. */
+    if ( side < 0 && (seg1->y <= pt->y) && (pt->y < seg3->y) )
+    {
+      wn++;
+    }
+
+    /* Going "down"! */
+    if ( side > 0 && (seg2->y <= pt->y) && (pt->y < seg1->y) )
+    {
+      wn--;
+    }
+
+    /* Inside the arc! */
+    if ( pt->x <= gbox.xmax && pt->x >= gbox.xmin )
+    {
+      RTPOINT2D C;
+      double radius = rt_arc_center(ctx, seg1, seg2, seg3, &C);
+      double d = distance2d_pt_pt(ctx, pt, &C);
+
+      /* On the boundary! */
+      if ( d == radius )
+        return RT_BOUNDARY;
+
+      /* Within the arc! */
+      if ( d  < radius )
+      {
+        /* Left side, increment winding number */
+        if ( side < 0 )
+          wn++;
+        /* Right side, decrement winding number */
+        if ( side > 0 )
+          wn--;
+      }
+    }
+
+    seg1 = seg3;
+  }
+
+  /* Sent out the winding number for calls that are building on this as a primitive */
+  if ( winding_number )
+    *winding_number = wn;
+
+  /* Outside */
+  if (wn == 0)
+  {
+    return RT_OUTSIDE;
+  }
+
+  /* Inside */
+  return RT_INSIDE;
 }
 
 /**
-* Returns the area in cartesian units. Area is negative if ring is oriented CCW, 
+* Returns the area in cartesian units. Area is negative if ring is oriented CCW,
 * positive if it is oriented CW and zero if the ring is degenerate or flat.
 * http://en.wikipedia.org/wiki/Shoelace_formula
 */
 double
 ptarray_signed_area(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	const RTPOINT2D *P1;
-	const RTPOINT2D *P2;
-	const RTPOINT2D *P3;
-	double sum = 0.0;
-	double x0, x, y1, y2;
-	int i;
-	
-	if (! pa || pa->npoints < 3 )
-		return 0.0;
-		
-	P1 = rt_getPoint2d_cp(ctx, pa, 0);
-	P2 = rt_getPoint2d_cp(ctx, pa, 1);
-	x0 = P1->x;
-	for ( i = 1; i < pa->npoints - 1; i++ )
-	{
-		P3 = rt_getPoint2d_cp(ctx, pa, i+1);
-		x = P2->x - x0;
-		y1 = P3->y;
-		y2 = P1->y;
-		sum += x * (y2-y1);
-		
-		/* Move forwards! */
-		P1 = P2;
-		P2 = P3;
-	}
-	return sum / 2.0;	
+  const RTPOINT2D *P1;
+  const RTPOINT2D *P2;
+  const RTPOINT2D *P3;
+  double sum = 0.0;
+  double x0, x, y1, y2;
+  int i;
+
+  if (! pa || pa->npoints < 3 )
+    return 0.0;
+
+  P1 = rt_getPoint2d_cp(ctx, pa, 0);
+  P2 = rt_getPoint2d_cp(ctx, pa, 1);
+  x0 = P1->x;
+  for ( i = 1; i < pa->npoints - 1; i++ )
+  {
+    P3 = rt_getPoint2d_cp(ctx, pa, i+1);
+    x = P2->x - x0;
+    y1 = P3->y;
+    y2 = P1->y;
+    sum += x * (y2-y1);
+
+    /* Move forwards! */
+    P1 = P2;
+    P2 = P3;
+  }
+  return sum / 2.0;
 }
 
 int
 ptarray_isccw(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	double area = 0;
-	area = ptarray_signed_area(ctx, pa);
-	if ( area > 0 ) return RT_FALSE;
-	else return RT_TRUE;
+  double area = 0;
+  area = ptarray_signed_area(ctx, pa);
+  if ( area > 0 ) return RT_FALSE;
+  else return RT_TRUE;
 }
 
 RTPOINTARRAY*
 ptarray_force_dims(const RTCTX *ctx, const RTPOINTARRAY *pa, int hasz, int hasm)
 {
-	/* TODO handle zero-length point arrays */
-	int i;
-	int in_hasz = RTFLAGS_GET_Z(pa->flags);
-	int in_hasm = RTFLAGS_GET_M(pa->flags);
-	RTPOINT4D pt;
-	RTPOINTARRAY *pa_out = ptarray_construct_empty(ctx, hasz, hasm, pa->npoints);
-	
-	for( i = 0; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &pt);
-		if( hasz && ! in_hasz )
-			pt.z = 0.0;
-		if( hasm && ! in_hasm )
-			pt.m = 0.0;
-		ptarray_append_point(ctx, pa_out, &pt, RT_TRUE);
-	} 
-
-	return pa_out;
+  /* TODO handle zero-length point arrays */
+  int i;
+  int in_hasz = RTFLAGS_GET_Z(pa->flags);
+  int in_hasm = RTFLAGS_GET_M(pa->flags);
+  RTPOINT4D pt;
+  RTPOINTARRAY *pa_out = ptarray_construct_empty(ctx, hasz, hasm, pa->npoints);
+
+  for( i = 0; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &pt);
+    if( hasz && ! in_hasz )
+      pt.z = 0.0;
+    if( hasm && ! in_hasm )
+      pt.m = 0.0;
+    ptarray_append_point(ctx, pa_out, &pt, RT_TRUE);
+  }
+
+  return pa_out;
 }
 
 RTPOINTARRAY *
 ptarray_substring(const RTCTX *ctx, RTPOINTARRAY *ipa, double from, double to, double tolerance)
 {
-	RTPOINTARRAY *dpa;
-	RTPOINT4D pt;
-	RTPOINT4D p1, p2;
-	RTPOINT4D *p1ptr=&p1; /* don't break strict-aliasing rule */
-	RTPOINT4D *p2ptr=&p2;
-	int nsegs, i;
-	double length, slength, tlength;
-	int state = 0; /* 0=before, 1=inside */
+  RTPOINTARRAY *dpa;
+  RTPOINT4D pt;
+  RTPOINT4D p1, p2;
+  RTPOINT4D *p1ptr=&p1; /* don't break strict-aliasing rule */
+  RTPOINT4D *p2ptr=&p2;
+  int nsegs, i;
+  double length, slength, tlength;
+  int state = 0; /* 0=before, 1=inside */
 
-	/*
-	 * Create a dynamic pointarray with an initial capacity
-	 * equal to full copy of input points
-	 */
-	dpa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(ipa->flags), RTFLAGS_GET_M(ipa->flags), ipa->npoints);
+  /*
+   * Create a dynamic pointarray with an initial capacity
+   * equal to full copy of input points
+   */
+  dpa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(ipa->flags), RTFLAGS_GET_M(ipa->flags), ipa->npoints);
 
-	/* Compute total line length */
-	length = ptarray_length_2d(ctx, ipa);
+  /* Compute total line length */
+  length = ptarray_length_2d(ctx, ipa);
 
 
-	RTDEBUGF(3, "Total length: %g", length);
+  RTDEBUGF(3, "Total length: %g", length);
 
 
-	/* Get 'from' and 'to' lengths */
-	from = length*from;
-	to = length*to;
+  /* Get 'from' and 'to' lengths */
+  from = length*from;
+  to = length*to;
 
 
-	RTDEBUGF(3, "From/To: %g/%g", from, to);
+  RTDEBUGF(3, "From/To: %g/%g", from, to);
 
 
-	tlength = 0;
-	rt_getPoint4d_p(ctx, ipa, 0, &p1);
-	nsegs = ipa->npoints - 1;
-	for ( i = 0; i < nsegs; i++ )
-	{
-		double dseg;
+  tlength = 0;
+  rt_getPoint4d_p(ctx, ipa, 0, &p1);
+  nsegs = ipa->npoints - 1;
+  for ( i = 0; i < nsegs; i++ )
+  {
+    double dseg;
 
-		rt_getPoint4d_p(ctx, ipa, i+1, &p2);
+    rt_getPoint4d_p(ctx, ipa, i+1, &p2);
 
 
-		RTDEBUGF(3 ,"Segment %d: (%g,%g,%g,%g)-(%g,%g,%g,%g)",
-		         i, p1.x, p1.y, p1.z, p1.m, p2.x, p2.y, p2.z, p2.m);
+    RTDEBUGF(3 ,"Segment %d: (%g,%g,%g,%g)-(%g,%g,%g,%g)",
+             i, p1.x, p1.y, p1.z, p1.m, p2.x, p2.y, p2.z, p2.m);
 
 
-		/* Find the length of this segment */
-		slength = distance2d_pt_pt(ctx, (RTPOINT2D *)p1ptr, (RTPOINT2D *)p2ptr);
+    /* Find the length of this segment */
+    slength = distance2d_pt_pt(ctx, (RTPOINT2D *)p1ptr, (RTPOINT2D *)p2ptr);
 
-		/*
-		 * We are before requested start.
-		 */
-		if ( state == 0 ) /* before */
-		{
+    /*
+     * We are before requested start.
+     */
+    if ( state == 0 ) /* before */
+    {
 
-			RTDEBUG(3, " Before start");
+      RTDEBUG(3, " Before start");
 
-			if ( fabs ( from - ( tlength + slength ) ) <= tolerance )
-			{
+      if ( fabs ( from - ( tlength + slength ) ) <= tolerance )
+      {
 
-				RTDEBUG(3, "  Second point is our start");
+        RTDEBUG(3, "  Second point is our start");
 
-				/*
-				 * Second point is our start
-				 */
-				ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
-				state=1; /* we're inside now */
-				goto END;
-			}
+        /*
+         * Second point is our start
+         */
+        ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
+        state=1; /* we're inside now */
+        goto END;
+      }
 
-			else if ( fabs(from - tlength) <= tolerance )
-			{
+      else if ( fabs(from - tlength) <= tolerance )
+      {
 
-				RTDEBUG(3, "  First point is our start");
+        RTDEBUG(3, "  First point is our start");
 
-				/*
-				 * First point is our start
-				 */
-				ptarray_append_point(ctx, dpa, &p1, RT_FALSE);
+        /*
+         * First point is our start
+         */
+        ptarray_append_point(ctx, dpa, &p1, RT_FALSE);
 
-				/*
-				 * We're inside now, but will check
-				 * 'to' point as well
-				 */
-				state=1;
-			}
+        /*
+         * We're inside now, but will check
+         * 'to' point as well
+         */
+        state=1;
+      }
 
-			/*
-			 * Didn't reach the 'from' point,
-			 * nothing to do
-			 */
-			else if ( from > tlength + slength ) goto END;
+      /*
+       * Didn't reach the 'from' point,
+       * nothing to do
+       */
+      else if ( from > tlength + slength ) goto END;
 
-			else  /* tlength < from < tlength+slength */
-			{
+      else  /* tlength < from < tlength+slength */
+      {
 
-				RTDEBUG(3, "  Seg contains first point");
+        RTDEBUG(3, "  Seg contains first point");
 
-				/*
-				 * Our start is between first and
-				 * second point
-				 */
-				dseg = (from - tlength) / slength;
+        /*
+         * Our start is between first and
+         * second point
+         */
+        dseg = (from - tlength) / slength;
 
-				interpolate_point4d(ctx, &p1, &p2, &pt, dseg);
+        interpolate_point4d(ctx, &p1, &p2, &pt, dseg);
 
-				ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
+        ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
 
-				/*
-				 * We're inside now, but will check
-				 * 'to' point as well
-				 */
-				state=1;
-			}
-		}
+        /*
+         * We're inside now, but will check
+         * 'to' point as well
+         */
+        state=1;
+      }
+    }
 
-		if ( state == 1 ) /* inside */
-		{
+    if ( state == 1 ) /* inside */
+    {
 
-			RTDEBUG(3, " Inside");
+      RTDEBUG(3, " Inside");
 
-			/*
-			 * 'to' point is our second point.
-			 */
-			if ( fabs(to - ( tlength + slength ) ) <= tolerance )
-			{
+      /*
+       * 'to' point is our second point.
+       */
+      if ( fabs(to - ( tlength + slength ) ) <= tolerance )
+      {
 
-				RTDEBUG(3, " Second point is our end");
+        RTDEBUG(3, " Second point is our end");
 
-				ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
-				break; /* substring complete */
-			}
+        ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
+        break; /* substring complete */
+      }
 
-			/*
-			 * 'to' point is our first point.
-			 * (should only happen if 'to' is 0)
-			 */
-			else if ( fabs(to - tlength) <= tolerance )
-			{
+      /*
+       * 'to' point is our first point.
+       * (should only happen if 'to' is 0)
+       */
+      else if ( fabs(to - tlength) <= tolerance )
+      {
 
-				RTDEBUG(3, " First point is our end");
+        RTDEBUG(3, " First point is our end");
 
-				ptarray_append_point(ctx, dpa, &p1, RT_FALSE);
+        ptarray_append_point(ctx, dpa, &p1, RT_FALSE);
 
-				break; /* substring complete */
-			}
+        break; /* substring complete */
+      }
 
-			/*
-			 * Didn't reach the 'end' point,
-			 * just copy second point
-			 */
-			else if ( to > tlength + slength )
-			{
-				ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
-				goto END;
-			}
+      /*
+       * Didn't reach the 'end' point,
+       * just copy second point
+       */
+      else if ( to > tlength + slength )
+      {
+        ptarray_append_point(ctx, dpa, &p2, RT_FALSE);
+        goto END;
+      }
 
-			/*
-			 * 'to' point falls on this segment
-			 * Interpolate and break.
-			 */
-			else if ( to < tlength + slength )
-			{
+      /*
+       * 'to' point falls on this segment
+       * Interpolate and break.
+       */
+      else if ( to < tlength + slength )
+      {
 
-				RTDEBUG(3, " Seg contains our end");
+        RTDEBUG(3, " Seg contains our end");
 
-				dseg = (to - tlength) / slength;
-				interpolate_point4d(ctx, &p1, &p2, &pt, dseg);
+        dseg = (to - tlength) / slength;
+        interpolate_point4d(ctx, &p1, &p2, &pt, dseg);
 
-				ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
+        ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
 
-				break;
-			}
+        break;
+      }
 
-			else
-			{
-				RTDEBUG(3, "Unhandled case");
-			}
-		}
+      else
+      {
+        RTDEBUG(3, "Unhandled case");
+      }
+    }
 
 
 END:
 
-		tlength += slength;
-		memcpy(&p1, &p2, sizeof(RTPOINT4D));
-	}
+    tlength += slength;
+    memcpy(&p1, &p2, sizeof(RTPOINT4D));
+  }
 
-	RTDEBUGF(3, "Out of loop, ptarray has %d points", dpa->npoints);
+  RTDEBUGF(3, "Out of loop, ptarray has %d points", dpa->npoints);
 
-	return dpa;
+  return dpa;
 }
 
 /*
@@ -1234,45 +1234,45 @@ END:
 void
 closest_point_on_segment(const RTCTX *ctx, const RTPOINT4D *p, const RTPOINT4D *A, const RTPOINT4D *B, RTPOINT4D *ret)
 {
-	double r;
-
-	if (  FP_EQUALS(A->x, B->x) && FP_EQUALS(A->y, B->y) )
-	{
-		*ret = *A;
-		return;
-	}
-
-	/*
-	 * We use comp.graphics.algorithms Frequently Asked Questions method
-	 *
-	 * (1)           AC dot AB
-	 *           r = ----------
-	 *                ||AB||^2
-	 *	r has the following meaning:
-	 *	r=0 P = A
-	 *	r=1 P = B
-	 *	r<0 P is on the backward extension of AB
-	 *	r>1 P is on the forward extension of AB
-	 *	0<r<1 P is interior to AB
-	 *
-	 */
-	r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
-
-	if (r<0)
-	{
-		*ret = *A;
-		return;
-	}
-	if (r>1)
-	{
-		*ret = *B;
-		return;
-	}
-
-	ret->x = A->x + ( (B->x - A->x) * r );
-	ret->y = A->y + ( (B->y - A->y) * r );
-	ret->z = A->z + ( (B->z - A->z) * r );
-	ret->m = A->m + ( (B->m - A->m) * r );
+  double r;
+
+  if (  FP_EQUALS(A->x, B->x) && FP_EQUALS(A->y, B->y) )
+  {
+    *ret = *A;
+    return;
+  }
+
+  /*
+   * We use comp.graphics.algorithms Frequently Asked Questions method
+   *
+   * (1)           AC dot AB
+   *           r = ----------
+   *                ||AB||^2
+   *  r has the following meaning:
+   *  r=0 P = A
+   *  r=1 P = B
+   *  r<0 P is on the backward extension of AB
+   *  r>1 P is on the forward extension of AB
+   *  0<r<1 P is interior to AB
+   *
+   */
+  r = ( (p->x-A->x) * (B->x-A->x) + (p->y-A->y) * (B->y-A->y) )/( (B->x-A->x)*(B->x-A->x) +(B->y-A->y)*(B->y-A->y) );
+
+  if (r<0)
+  {
+    *ret = *A;
+    return;
+  }
+  if (r>1)
+  {
+    *ret = *B;
+    return;
+  }
+
+  ret->x = A->x + ( (B->x - A->x) * r );
+  ret->y = A->y + ( (B->y - A->y) * r );
+  ret->z = A->z + ( (B->z - A->z) * r );
+  ret->m = A->m + ( (B->m - A->m) * r );
 }
 
 /*
@@ -1282,127 +1282,127 @@ closest_point_on_segment(const RTCTX *ctx, const RTPOINT4D *p, const RTPOINT4D *
 double
 ptarray_locate_point(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT4D *p4d, double *mindistout, RTPOINT4D *proj4d)
 {
-	double mindist=-1;
-	double tlen, plen;
-	int t, seg=-1;
-	RTPOINT4D	start4d, end4d, projtmp;
-	RTPOINT2D proj, p;
-	const RTPOINT2D *start = NULL, *end = NULL;
-
-	/* Initialize our 2D copy of the input parameter */
-	p.x = p4d->x;
-	p.y = p4d->y;
-	
-	if ( ! proj4d ) proj4d = &projtmp;
-	
-	start = rt_getPoint2d_cp(ctx, pa, 0);
-	
-	/* If the pointarray has only one point, the nearest point is */
-	/* just that point */
-	if ( pa->npoints == 1 )
-	{
-		rt_getPoint4d_p(ctx, pa, 0, proj4d);
-		if ( mindistout )
-			*mindistout = distance2d_pt_pt(ctx, &p, start);
-		return 0.0;
-	}
-	
-	/* Loop through pointarray looking for nearest segment */
-	for (t=1; t<pa->npoints; t++)
-	{
-		double dist;
-		end = rt_getPoint2d_cp(ctx, pa, t);
-		dist = distance2d_pt_seg(ctx, &p, start, end);
-
-		if (t==1 || dist < mindist )
-		{
-			mindist = dist;
-			seg=t-1;
-		}
-
-		if ( mindist == 0 )
-		{
-			RTDEBUG(3, "Breaking on mindist=0");
-			break;
-		}
-
-		start = end;
-	}
-
-	if ( mindistout ) *mindistout = mindist;
-
-	RTDEBUGF(3, "Closest segment: %d", seg);
-	RTDEBUGF(3, "mindist: %g", mindist);
-
-	/*
-	 * We need to project the
-	 * point on the closest segment.
-	 */
-	rt_getPoint4d_p(ctx, pa, seg, &start4d);
-	rt_getPoint4d_p(ctx, pa, seg+1, &end4d);
-	closest_point_on_segment(ctx, p4d, &start4d, &end4d, proj4d);
-	
-	/* Copy 4D values into 2D holder */
-	proj.x = proj4d->x;
-	proj.y = proj4d->y;
-
-	RTDEBUGF(3, "Closest segment:%d, npoints:%d", seg, pa->npoints);
-
-	/* For robustness, force 1 when closest point == endpoint */
-	if ( (seg >= (pa->npoints-2)) && p2d_same(ctx, &proj, end) )
-	{
-		return 1.0;
-	}
-
-	RTDEBUGF(3, "Closest point on segment: %g,%g", proj.x, proj.y);
-
-	tlen = ptarray_length_2d(ctx, pa);
-
-	RTDEBUGF(3, "tlen %g", tlen);
-
-	/* Location of any point on a zero-length line is 0 */
-	/* See http://trac.osgeo.org/postgis/ticket/1772#comment:2 */
-	if ( tlen == 0 ) return 0;
-
-	plen=0;
-	start = rt_getPoint2d_cp(ctx, pa, 0);
-	for (t=0; t<seg; t++, start=end)
-	{
-		end = rt_getPoint2d_cp(ctx, pa, t+1);
-		plen += distance2d_pt_pt(ctx, start, end);
-
-		RTDEBUGF(4, "Segment %d made plen %g", t, plen);
-	}
-
-	plen+=distance2d_pt_pt(ctx, &proj, start);
-
-	RTDEBUGF(3, "plen %g, tlen %g", plen, tlen);
-
-	return plen/tlen;
+  double mindist=-1;
+  double tlen, plen;
+  int t, seg=-1;
+  RTPOINT4D  start4d, end4d, projtmp;
+  RTPOINT2D proj, p;
+  const RTPOINT2D *start = NULL, *end = NULL;
+
+  /* Initialize our 2D copy of the input parameter */
+  p.x = p4d->x;
+  p.y = p4d->y;
+
+  if ( ! proj4d ) proj4d = &projtmp;
+
+  start = rt_getPoint2d_cp(ctx, pa, 0);
+
+  /* If the pointarray has only one point, the nearest point is */
+  /* just that point */
+  if ( pa->npoints == 1 )
+  {
+    rt_getPoint4d_p(ctx, pa, 0, proj4d);
+    if ( mindistout )
+      *mindistout = distance2d_pt_pt(ctx, &p, start);
+    return 0.0;
+  }
+
+  /* Loop through pointarray looking for nearest segment */
+  for (t=1; t<pa->npoints; t++)
+  {
+    double dist;
+    end = rt_getPoint2d_cp(ctx, pa, t);
+    dist = distance2d_pt_seg(ctx, &p, start, end);
+
+    if (t==1 || dist < mindist )
+    {
+      mindist = dist;
+      seg=t-1;
+    }
+
+    if ( mindist == 0 )
+    {
+      RTDEBUG(3, "Breaking on mindist=0");
+      break;
+    }
+
+    start = end;
+  }
+
+  if ( mindistout ) *mindistout = mindist;
+
+  RTDEBUGF(3, "Closest segment: %d", seg);
+  RTDEBUGF(3, "mindist: %g", mindist);
+
+  /*
+   * We need to project the
+   * point on the closest segment.
+   */
+  rt_getPoint4d_p(ctx, pa, seg, &start4d);
+  rt_getPoint4d_p(ctx, pa, seg+1, &end4d);
+  closest_point_on_segment(ctx, p4d, &start4d, &end4d, proj4d);
+
+  /* Copy 4D values into 2D holder */
+  proj.x = proj4d->x;
+  proj.y = proj4d->y;
+
+  RTDEBUGF(3, "Closest segment:%d, npoints:%d", seg, pa->npoints);
+
+  /* For robustness, force 1 when closest point == endpoint */
+  if ( (seg >= (pa->npoints-2)) && p2d_same(ctx, &proj, end) )
+  {
+    return 1.0;
+  }
+
+  RTDEBUGF(3, "Closest point on segment: %g,%g", proj.x, proj.y);
+
+  tlen = ptarray_length_2d(ctx, pa);
+
+  RTDEBUGF(3, "tlen %g", tlen);
+
+  /* Location of any point on a zero-length line is 0 */
+  /* See http://trac.osgeo.org/postgis/ticket/1772#comment:2 */
+  if ( tlen == 0 ) return 0;
+
+  plen=0;
+  start = rt_getPoint2d_cp(ctx, pa, 0);
+  for (t=0; t<seg; t++, start=end)
+  {
+    end = rt_getPoint2d_cp(ctx, pa, t+1);
+    plen += distance2d_pt_pt(ctx, start, end);
+
+    RTDEBUGF(4, "Segment %d made plen %g", t, plen);
+  }
+
+  plen+=distance2d_pt_pt(ctx, &proj, start);
+
+  RTDEBUGF(3, "plen %g, tlen %g", plen, tlen);
+
+  return plen/tlen;
 }
 
 /**
  * @brief Longitude shift for a pointarray.
- *  	Y remains the same
- *  	X is converted:
- *	 		from -180..180 to 0..360
- *	 		from 0..360 to -180..180
- *  	X < 0 becomes X + 360
- *  	X > 180 becomes X - 360
+ *    Y remains the same
+ *    X is converted:
+ *       from -180..180 to 0..360
+ *       from 0..360 to -180..180
+ *    X < 0 becomes X + 360
+ *    X > 180 becomes X - 360
  */
 void
 ptarray_longitude_shift(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	int i;
-	double x;
-
-	for (i=0; i<pa->npoints; i++)
-	{
-		memcpy(&x, rt_getPoint_internal(ctx, pa, i), sizeof(double));
-		if ( x < 0 ) x+= 360;
-		else if ( x > 180 ) x -= 360;
-		memcpy(rt_getPoint_internal(ctx, pa, i), &x, sizeof(double));
-	}
+  int i;
+  double x;
+
+  for (i=0; i<pa->npoints; i++)
+  {
+    memcpy(&x, rt_getPoint_internal(ctx, pa, i), sizeof(double));
+    if ( x < 0 ) x+= 360;
+    else if ( x > 180 ) x -= 360;
+    memcpy(rt_getPoint_internal(ctx, pa, i), &x, sizeof(double));
+  }
 }
 
 
@@ -1416,166 +1416,166 @@ ptarray_longitude_shift(const RTCTX *ctx, RTPOINTARRAY *pa)
 RTPOINTARRAY *
 ptarray_remove_repeated_points_minpoints(const RTCTX *ctx, const RTPOINTARRAY *in, double tolerance, int minpoints)
 {
-	RTPOINTARRAY* out;
-	size_t ptsize;
-	size_t ipn, opn;
-	const RTPOINT2D *last_point, *this_point;
-	double tolsq = tolerance * tolerance;
-
-	if ( minpoints < 1 ) minpoints = 1;
-
-	RTDEBUGF(3, "%s called", __func__);
-
-	/* Single or zero point arrays can't have duplicates */
-	if ( in->npoints < 3 ) return ptarray_clone_deep(ctx, in);
-
-	ptsize = ptarray_point_size(ctx, in);
-
-	RTDEBUGF(3, " ptsize: %d", ptsize);
-
-	/* Allocate enough space for all points */
-	out = ptarray_construct(ctx, RTFLAGS_GET_Z(in->flags),
-	                        RTFLAGS_GET_M(in->flags), in->npoints);
-
-	/* Now fill up the actual points (NOTE: could be optimized) */
-
-	opn=1;
-	memcpy(rt_getPoint_internal(ctx, out, 0), rt_getPoint_internal(ctx, in, 0), ptsize);
-	last_point = rt_getPoint2d_cp(ctx, in, 0);
-	RTDEBUGF(3, " first point copied, out points: %d", opn);
-	for ( ipn = 1; ipn < in->npoints; ++ipn)
-	{
-		this_point = rt_getPoint2d_cp(ctx, in, ipn);
-		if ( (ipn >= in->npoints-minpoints+1 && opn < minpoints) || 
-		     (tolerance == 0 && memcmp(rt_getPoint_internal(ctx, in, ipn-1), rt_getPoint_internal(ctx, in, ipn), ptsize) != 0) ||
-		     (tolerance > 0.0 && distance2d_sqr_pt_pt(ctx, last_point, this_point) > tolsq) )
-		{
-			/* The point is different from the previous,
-			 * we add it to output */
-			memcpy(rt_getPoint_internal(ctx, out, opn++), rt_getPoint_internal(ctx, in, ipn), ptsize);
-			last_point = this_point;
-			RTDEBUGF(3, " Point %d differs from point %d. Out points: %d", ipn, ipn-1, opn);
-		}
-	}
-
-	RTDEBUGF(3, " in:%d out:%d", out->npoints, opn);
-	out->npoints = opn;
-
-	return out;
+  RTPOINTARRAY* out;
+  size_t ptsize;
+  size_t ipn, opn;
+  const RTPOINT2D *last_point, *this_point;
+  double tolsq = tolerance * tolerance;
+
+  if ( minpoints < 1 ) minpoints = 1;
+
+  RTDEBUGF(3, "%s called", __func__);
+
+  /* Single or zero point arrays can't have duplicates */
+  if ( in->npoints < 3 ) return ptarray_clone_deep(ctx, in);
+
+  ptsize = ptarray_point_size(ctx, in);
+
+  RTDEBUGF(3, " ptsize: %d", ptsize);
+
+  /* Allocate enough space for all points */
+  out = ptarray_construct(ctx, RTFLAGS_GET_Z(in->flags),
+                          RTFLAGS_GET_M(in->flags), in->npoints);
+
+  /* Now fill up the actual points (NOTE: could be optimized) */
+
+  opn=1;
+  memcpy(rt_getPoint_internal(ctx, out, 0), rt_getPoint_internal(ctx, in, 0), ptsize);
+  last_point = rt_getPoint2d_cp(ctx, in, 0);
+  RTDEBUGF(3, " first point copied, out points: %d", opn);
+  for ( ipn = 1; ipn < in->npoints; ++ipn)
+  {
+    this_point = rt_getPoint2d_cp(ctx, in, ipn);
+    if ( (ipn >= in->npoints-minpoints+1 && opn < minpoints) ||
+         (tolerance == 0 && memcmp(rt_getPoint_internal(ctx, in, ipn-1), rt_getPoint_internal(ctx, in, ipn), ptsize) != 0) ||
+         (tolerance > 0.0 && distance2d_sqr_pt_pt(ctx, last_point, this_point) > tolsq) )
+    {
+      /* The point is different from the previous,
+       * we add it to output */
+      memcpy(rt_getPoint_internal(ctx, out, opn++), rt_getPoint_internal(ctx, in, ipn), ptsize);
+      last_point = this_point;
+      RTDEBUGF(3, " Point %d differs from point %d. Out points: %d", ipn, ipn-1, opn);
+    }
+  }
+
+  RTDEBUGF(3, " in:%d out:%d", out->npoints, opn);
+  out->npoints = opn;
+
+  return out;
 }
 
 RTPOINTARRAY *
 ptarray_remove_repeated_points(const RTCTX *ctx, const RTPOINTARRAY *in, double tolerance)
 {
-	return ptarray_remove_repeated_points_minpoints(ctx, in, tolerance, 2);
+  return ptarray_remove_repeated_points_minpoints(ctx, in, tolerance, 2);
 }
 
 static void
 ptarray_dp_findsplit(const RTCTX *ctx, RTPOINTARRAY *pts, int p1, int p2, int *split, double *dist)
 {
-	int k;
-	const RTPOINT2D *pk, *pa, *pb;
-	double tmp, d;
+  int k;
+  const RTPOINT2D *pk, *pa, *pb;
+  double tmp, d;
 
-	RTDEBUG(4, "function called");
+  RTDEBUG(4, "function called");
 
-	*split = p1;
-	d = -1;
+  *split = p1;
+  d = -1;
 
-	if (p1 + 1 < p2)
-	{
+  if (p1 + 1 < p2)
+  {
 
-		pa = rt_getPoint2d_cp(ctx, pts, p1);
-		pb = rt_getPoint2d_cp(ctx, pts, p2);
+    pa = rt_getPoint2d_cp(ctx, pts, p1);
+    pb = rt_getPoint2d_cp(ctx, pts, p2);
 
-		RTDEBUGF(4, "P%d(%f,%f) to P%d(%f,%f)",
-		         p1, pa->x, pa->y, p2, pb->x, pb->y);
+    RTDEBUGF(4, "P%d(%f,%f) to P%d(%f,%f)",
+             p1, pa->x, pa->y, p2, pb->x, pb->y);
 
-		for (k=p1+1; k<p2; k++)
-		{
-			pk = rt_getPoint2d_cp(ctx, pts, k);
+    for (k=p1+1; k<p2; k++)
+    {
+      pk = rt_getPoint2d_cp(ctx, pts, k);
 
-			RTDEBUGF(4, "P%d(%f,%f)", k, pk->x, pk->y);
+      RTDEBUGF(4, "P%d(%f,%f)", k, pk->x, pk->y);
 
-			/* distance computation */
-			tmp = distance2d_sqr_pt_seg(ctx, pk, pa, pb);
+      /* distance computation */
+      tmp = distance2d_sqr_pt_seg(ctx, pk, pa, pb);
 
-			if (tmp > d)
-			{
-				d = tmp;	/* record the maximum */
-				*split = k;
+      if (tmp > d)
+      {
+        d = tmp;  /* record the maximum */
+        *split = k;
 
-				RTDEBUGF(4, "P%d is farthest (%g)", k, d);
-			}
-		}
-		*dist = d;
+        RTDEBUGF(4, "P%d is farthest (%g)", k, d);
+      }
+    }
+    *dist = d;
 
-	} /* length---should be redone if can == 0 */
-	else
-	{
-		RTDEBUG(3, "segment too short, no split/no dist");
-		*dist = -1;
-	}
+  } /* length---should be redone if can == 0 */
+  else
+  {
+    RTDEBUG(3, "segment too short, no split/no dist");
+    *dist = -1;
+  }
 
 }
 
 RTPOINTARRAY *
 ptarray_simplify(const RTCTX *ctx, RTPOINTARRAY *inpts, double epsilon, unsigned int minpts)
 {
-	int *stack;			/* recursion stack */
-	int sp=-1;			/* recursion stack pointer */
-	int p1, split;
-	double dist;
-	RTPOINTARRAY *outpts;
-	RTPOINT4D pt;
+  int *stack;      /* recursion stack */
+  int sp=-1;      /* recursion stack pointer */
+  int p1, split;
+  double dist;
+  RTPOINTARRAY *outpts;
+  RTPOINT4D pt;
 
-	double eps_sqr = epsilon * epsilon;
+  double eps_sqr = epsilon * epsilon;
 
-	/* Allocate recursion stack */
-	stack = rtalloc(ctx, sizeof(int)*inpts->npoints);
+  /* Allocate recursion stack */
+  stack = rtalloc(ctx, sizeof(int)*inpts->npoints);
 
-	p1 = 0;
-	stack[++sp] = inpts->npoints-1;
+  p1 = 0;
+  stack[++sp] = inpts->npoints-1;
 
-	RTDEBUGF(2, "Input has %d pts and %d dims", inpts->npoints,
-	                                            RTFLAGS_NDIMS(inpts->flags));
+  RTDEBUGF(2, "Input has %d pts and %d dims", inpts->npoints,
+                                              RTFLAGS_NDIMS(inpts->flags));
 
-	/* Allocate output RTPOINTARRAY, and add first point. */
-	outpts = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(inpts->flags), RTFLAGS_GET_M(inpts->flags), inpts->npoints);
-	rt_getPoint4d_p(ctx, inpts, 0, &pt);
-	ptarray_append_point(ctx, outpts, &pt, RT_FALSE);
+  /* Allocate output RTPOINTARRAY, and add first point. */
+  outpts = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(inpts->flags), RTFLAGS_GET_M(inpts->flags), inpts->npoints);
+  rt_getPoint4d_p(ctx, inpts, 0, &pt);
+  ptarray_append_point(ctx, outpts, &pt, RT_FALSE);
 
-	RTDEBUG(3, "Added P0 to simplified point array (size 1)");
+  RTDEBUG(3, "Added P0 to simplified point array (size 1)");
 
-	do
-	{
+  do
+  {
 
-		ptarray_dp_findsplit(ctx, inpts, p1, stack[sp], &split, &dist);
+    ptarray_dp_findsplit(ctx, inpts, p1, stack[sp], &split, &dist);
 
-		RTDEBUGF(3, "Farthest point from P%d-P%d is P%d (dist. %g)", p1, stack[sp], split, dist);
+    RTDEBUGF(3, "Farthest point from P%d-P%d is P%d (dist. %g)", p1, stack[sp], split, dist);
 
-		if (dist > eps_sqr || ( outpts->npoints+sp+1 < minpts && dist >= 0 ) )
-		{
-			RTDEBUGF(4, "Added P%d to stack (outpts:%d)", split, sp);
-			stack[++sp] = split;
-		}
-		else
-		{
-			rt_getPoint4d_p(ctx, inpts, stack[sp], &pt);
-			RTDEBUGF(4, "npoints , minpoints %d %d", outpts->npoints, minpts);
-			ptarray_append_point(ctx, outpts, &pt, RT_FALSE);
-			
-			RTDEBUGF(4, "Added P%d to simplified point array (size: %d)", stack[sp], outpts->npoints);
+    if (dist > eps_sqr || ( outpts->npoints+sp+1 < minpts && dist >= 0 ) )
+    {
+      RTDEBUGF(4, "Added P%d to stack (outpts:%d)", split, sp);
+      stack[++sp] = split;
+    }
+    else
+    {
+      rt_getPoint4d_p(ctx, inpts, stack[sp], &pt);
+      RTDEBUGF(4, "npoints , minpoints %d %d", outpts->npoints, minpts);
+      ptarray_append_point(ctx, outpts, &pt, RT_FALSE);
 
-			p1 = stack[sp--];
-		}
+      RTDEBUGF(4, "Added P%d to simplified point array (size: %d)", stack[sp], outpts->npoints);
 
-		RTDEBUGF(4, "stack pointer = %d", sp);
-	}
-	while (! (sp<0) );
+      p1 = stack[sp--];
+    }
 
-	rtfree(ctx, stack);
-	return outpts;
+    RTDEBUGF(4, "stack pointer = %d", sp);
+  }
+  while (! (sp<0) );
+
+  rtfree(ctx, stack);
+  return outpts;
 }
 
 /**
@@ -1586,25 +1586,25 @@ ptarray_simplify(const RTCTX *ctx, RTPOINTARRAY *inpts, double epsilon, unsigned
 double
 ptarray_arc_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts)
 {
-	double dist = 0.0;
-	int i;
-	const RTPOINT2D *a1;
-	const RTPOINT2D *a2;
-	const RTPOINT2D *a3;
+  double dist = 0.0;
+  int i;
+  const RTPOINT2D *a1;
+  const RTPOINT2D *a2;
+  const RTPOINT2D *a3;
 
-	if ( pts->npoints % 2 != 1 )
+  if ( pts->npoints % 2 != 1 )
         rterror(ctx, "arc point array with even number of points");
-        
-	a1 = rt_getPoint2d_cp(ctx, pts, 0);
-	
-	for ( i=2; i < pts->npoints; i += 2 )
-	{
-    	a2 = rt_getPoint2d_cp(ctx, pts, i-1);
-		a3 = rt_getPoint2d_cp(ctx, pts, i);
-		dist += rt_arc_length(ctx, a1, a2, a3);
-		a1 = a3;
-	}
-	return dist;
+
+  a1 = rt_getPoint2d_cp(ctx, pts, 0);
+
+  for ( i=2; i < pts->npoints; i += 2 )
+  {
+      a2 = rt_getPoint2d_cp(ctx, pts, i-1);
+    a3 = rt_getPoint2d_cp(ctx, pts, i);
+    dist += rt_arc_length(ctx, a1, a2, a3);
+    a1 = a3;
+  }
+  return dist;
 }
 
 /**
@@ -1613,25 +1613,25 @@ ptarray_arc_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts)
 double
 ptarray_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts)
 {
-	double dist = 0.0;
-	int i;
-	const RTPOINT2D *frm;
-	const RTPOINT2D *to;
-
-	if ( pts->npoints < 2 ) return 0.0;
-
-	frm = rt_getPoint2d_cp(ctx, pts, 0);
-	
-	for ( i=1; i < pts->npoints; i++ )
-	{
-		to = rt_getPoint2d_cp(ctx, pts, i);
-
-		dist += sqrt( ((frm->x - to->x)*(frm->x - to->x))  +
-		              ((frm->y - to->y)*(frm->y - to->y)) );
-		
-		frm = to;
-	}
-	return dist;
+  double dist = 0.0;
+  int i;
+  const RTPOINT2D *frm;
+  const RTPOINT2D *to;
+
+  if ( pts->npoints < 2 ) return 0.0;
+
+  frm = rt_getPoint2d_cp(ctx, pts, 0);
+
+  for ( i=1; i < pts->npoints; i++ )
+  {
+    to = rt_getPoint2d_cp(ctx, pts, i);
+
+    dist += sqrt( ((frm->x - to->x)*(frm->x - to->x))  +
+                  ((frm->y - to->y)*(frm->y - to->y)) );
+
+    frm = to;
+  }
+  return dist;
 }
 
 /**
@@ -1641,26 +1641,26 @@ ptarray_length_2d(const RTCTX *ctx, const RTPOINTARRAY *pts)
 double
 ptarray_length(const RTCTX *ctx, const RTPOINTARRAY *pts)
 {
-	double dist = 0.0;
-	int i;
-	RTPOINT3DZ frm;
-	RTPOINT3DZ to;
-
-	if ( pts->npoints < 2 ) return 0.0;
-
-	/* compute 2d length if 3d is not available */
-	if ( ! RTFLAGS_GET_Z(pts->flags) ) return ptarray_length_2d(ctx, pts);
-
-	rt_getPoint3dz_p(ctx, pts, 0, &frm);
-	for ( i=1; i < pts->npoints; i++ )
-	{
-		rt_getPoint3dz_p(ctx, pts, i, &to);
-		dist += sqrt( ((frm.x - to.x)*(frm.x - to.x)) +
-		              ((frm.y - to.y)*(frm.y - to.y)) +
-		              ((frm.z - to.z)*(frm.z - to.z)) );
-		frm = to;
-	}
-	return dist;
+  double dist = 0.0;
+  int i;
+  RTPOINT3DZ frm;
+  RTPOINT3DZ to;
+
+  if ( pts->npoints < 2 ) return 0.0;
+
+  /* compute 2d length if 3d is not available */
+  if ( ! RTFLAGS_GET_Z(pts->flags) ) return ptarray_length_2d(ctx, pts);
+
+  rt_getPoint3dz_p(ctx, pts, 0, &frm);
+  for ( i=1; i < pts->npoints; i++ )
+  {
+    rt_getPoint3dz_p(ctx, pts, i, &to);
+    dist += sqrt( ((frm.x - to.x)*(frm.x - to.x)) +
+                  ((frm.y - to.y)*(frm.y - to.y)) +
+                  ((frm.z - to.z)*(frm.z - to.z)) );
+    frm = to;
+  }
+  return dist;
 }
 
 
@@ -1674,44 +1674,44 @@ ptarray_length(const RTCTX *ctx, const RTPOINTARRAY *pts)
 uint8_t *
 rt_getPoint_internal(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	size_t size;
-	uint8_t *ptr;
+  size_t size;
+  uint8_t *ptr;
 
 #if PARANOIA_LEVEL > 0
-	if ( pa == NULL )
-	{
-		rterror(ctx, "rt_getPoint got NULL pointarray");
-		return NULL;
-	}
-	
-	RTDEBUGF(5, "(n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
-
-	if ( ( n < 0 ) || 
-	     ( n > pa->npoints ) ||
-	     ( n >= pa->maxpoints ) )
-	{
-		rterror(ctx, "rt_getPoint_internal called outside of ptarray range (n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
-		return NULL; /*error */
-	}
+  if ( pa == NULL )
+  {
+    rterror(ctx, "rt_getPoint got NULL pointarray");
+    return NULL;
+  }
+
+  RTDEBUGF(5, "(n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
+
+  if ( ( n < 0 ) ||
+       ( n > pa->npoints ) ||
+       ( n >= pa->maxpoints ) )
+  {
+    rterror(ctx, "rt_getPoint_internal called outside of ptarray range (n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
+    return NULL; /*error */
+  }
 #endif
 
-	size = ptarray_point_size(ctx, pa);
-	
-	ptr = pa->serialized_pointlist + size * n;
-	if ( RTFLAGS_NDIMS(pa->flags) == 2)
-	{
-		RTDEBUGF(5, "point = %g %g", *((double*)(ptr)), *((double*)(ptr+8)));
-	}
-	else if ( RTFLAGS_NDIMS(pa->flags) == 3)
-	{
-		RTDEBUGF(5, "point = %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)));
-	}
-	else if ( RTFLAGS_NDIMS(pa->flags) == 4)
-	{
-		RTDEBUGF(5, "point = %g %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)), *((double*)(ptr+24)));
-	}
-
-	return ptr;
+  size = ptarray_point_size(ctx, pa);
+
+  ptr = pa->serialized_pointlist + size * n;
+  if ( RTFLAGS_NDIMS(pa->flags) == 2)
+  {
+    RTDEBUGF(5, "point = %g %g", *((double*)(ptr)), *((double*)(ptr+8)));
+  }
+  else if ( RTFLAGS_NDIMS(pa->flags) == 3)
+  {
+    RTDEBUGF(5, "point = %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)));
+  }
+  else if ( RTFLAGS_NDIMS(pa->flags) == 4)
+  {
+    RTDEBUGF(5, "point = %g %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)), *((double*)(ptr+24)));
+  }
+
+  return ptr;
 }
 
 
@@ -1721,48 +1721,48 @@ rt_getPoint_internal(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 void
 ptarray_affine(const RTCTX *ctx, RTPOINTARRAY *pa, const RTAFFINE *a)
 {
-	int i;
-	double x,y,z;
-	RTPOINT4D p4d;
-
-	RTDEBUG(2, "rtgeom_affine_ptarray start");
-
-	if ( RTFLAGS_GET_Z(pa->flags) )
-	{
-		RTDEBUG(3, " has z");
-
-		for (i=0; i<pa->npoints; i++)
-		{
-			rt_getPoint4d_p(ctx, pa, i, &p4d);
-			x = p4d.x;
-			y = p4d.y;
-			z = p4d.z;
-			p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
-			p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
-			p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
-			ptarray_set_point4d(ctx, pa, i, &p4d);
-
-			RTDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
-		}
-	}
-	else
-	{
-		RTDEBUG(3, " doesn't have z");
-
-		for (i=0; i<pa->npoints; i++)
-		{
-			rt_getPoint4d_p(ctx, pa, i, &p4d);
-			x = p4d.x;
-			y = p4d.y;
-			p4d.x = a->afac * x + a->bfac * y + a->xoff;
-			p4d.y = a->dfac * x + a->efac * y + a->yoff;
-			ptarray_set_point4d(ctx, pa, i, &p4d);
-
-			RTDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
-		}
-	}
-
-	RTDEBUG(3, "rtgeom_affine_ptarray end");
+  int i;
+  double x,y,z;
+  RTPOINT4D p4d;
+
+  RTDEBUG(2, "rtgeom_affine_ptarray start");
+
+  if ( RTFLAGS_GET_Z(pa->flags) )
+  {
+    RTDEBUG(3, " has z");
+
+    for (i=0; i<pa->npoints; i++)
+    {
+      rt_getPoint4d_p(ctx, pa, i, &p4d);
+      x = p4d.x;
+      y = p4d.y;
+      z = p4d.z;
+      p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
+      p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
+      p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
+      ptarray_set_point4d(ctx, pa, i, &p4d);
+
+      RTDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
+    }
+  }
+  else
+  {
+    RTDEBUG(3, " doesn't have z");
+
+    for (i=0; i<pa->npoints; i++)
+    {
+      rt_getPoint4d_p(ctx, pa, i, &p4d);
+      x = p4d.x;
+      y = p4d.y;
+      p4d.x = a->afac * x + a->bfac * y + a->xoff;
+      p4d.y = a->dfac * x + a->efac * y + a->yoff;
+      ptarray_set_point4d(ctx, pa, i, &p4d);
+
+      RTDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
+    }
+  }
+
+  RTDEBUG(3, "rtgeom_affine_ptarray end");
 
 }
 
@@ -1794,7 +1794,7 @@ ptarray_scale(const RTCTX *ctx, RTPOINTARRAY *pa, const RTPOINT4D *fact)
 int
 ptarray_startpoint(const RTCTX *ctx, const RTPOINTARRAY* pa, RTPOINT4D* pt)
 {
-	return rt_getPoint4d_p(ctx, pa, 0, pt);
+  return rt_getPoint4d_p(ctx, pa, 0, pt);
 }
 
 
@@ -1811,55 +1811,55 @@ ptarray_startpoint(const RTCTX *ctx, const RTPOINTARRAY* pa, RTPOINT4D* pt)
 RTPOINTARRAY *
 ptarray_grid(const RTCTX *ctx, const RTPOINTARRAY *pa, const gridspec *grid)
 {
-	RTPOINT4D pt;
-	int ipn; /* input point numbers */
-	RTPOINTARRAY *dpa;
+  RTPOINT4D pt;
+  int ipn; /* input point numbers */
+  RTPOINTARRAY *dpa;
 
-	RTDEBUGF(2, "ptarray_grid called on %p", pa);
+  RTDEBUGF(2, "ptarray_grid called on %p", pa);
 
-	dpa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(pa->flags),RTFLAGS_GET_M(pa->flags), pa->npoints);
+  dpa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(pa->flags),RTFLAGS_GET_M(pa->flags), pa->npoints);
 
-	for (ipn=0; ipn<pa->npoints; ++ipn)
-	{
+  for (ipn=0; ipn<pa->npoints; ++ipn)
+  {
 
-		rt_getPoint4d_p(ctx, pa, ipn, &pt);
+    rt_getPoint4d_p(ctx, pa, ipn, &pt);
 
-		if ( grid->xsize )
-			pt.x = rint((pt.x - grid->ipx)/grid->xsize) *
-			         grid->xsize + grid->ipx;
+    if ( grid->xsize )
+      pt.x = rint((pt.x - grid->ipx)/grid->xsize) *
+               grid->xsize + grid->ipx;
 
-		if ( grid->ysize )
-			pt.y = rint((pt.y - grid->ipy)/grid->ysize) *
-			         grid->ysize + grid->ipy;
+    if ( grid->ysize )
+      pt.y = rint((pt.y - grid->ipy)/grid->ysize) *
+               grid->ysize + grid->ipy;
 
-		if ( RTFLAGS_GET_Z(pa->flags) && grid->zsize )
-			pt.z = rint((pt.z - grid->ipz)/grid->zsize) *
-			         grid->zsize + grid->ipz;
+    if ( RTFLAGS_GET_Z(pa->flags) && grid->zsize )
+      pt.z = rint((pt.z - grid->ipz)/grid->zsize) *
+               grid->zsize + grid->ipz;
 
-		if ( RTFLAGS_GET_M(pa->flags) && grid->msize )
-			pt.m = rint((pt.m - grid->ipm)/grid->msize) *
-			         grid->msize + grid->ipm;
+    if ( RTFLAGS_GET_M(pa->flags) && grid->msize )
+      pt.m = rint((pt.m - grid->ipm)/grid->msize) *
+               grid->msize + grid->ipm;
 
-		ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
+    ptarray_append_point(ctx, dpa, &pt, RT_FALSE);
 
-	}
+  }
 
-	return dpa;
+  return dpa;
 }
 
-int 
+int
 ptarray_npoints_in_rect(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTGBOX *gbox)
 {
-	const RTPOINT2D *pt;
-	int n = 0;
-	int i;
-	for ( i = 0; i < pa->npoints; i++ )
-	{
-		pt = rt_getPoint2d_cp(ctx, pa, i);
-		if ( gbox_contains_point2d(ctx, gbox, pt) )
-			n++;
-	}
-	return n;
+  const RTPOINT2D *pt;
+  int n = 0;
+  int i;
+  for ( i = 0; i < pa->npoints; i++ )
+  {
+    pt = rt_getPoint2d_cp(ctx, pa, i);
+    if ( gbox_contains_point2d(ctx, gbox, pt) )
+      n++;
+  }
+  return n;
 }
 
 
diff --git a/src/rtalgorithm.c b/src/rtalgorithm.c
index e9ddaf2..33144d2 100644
--- a/src/rtalgorithm.c
+++ b/src/rtalgorithm.c
@@ -34,36 +34,36 @@
 */
 int signum(const RTCTX *ctx, double n)
 {
-	if( n < 0 ) return -1;
-	if( n > 0 ) return 1;
-	return 0;
+  if( n < 0 ) return -1;
+  if( n > 0 ) return 1;
+  return 0;
 }
 
 int
 p4d_same(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2)
 {
-	if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) && FP_EQUALS(p1->z,p2->z) && FP_EQUALS(p1->m,p2->m) )
-		return RT_TRUE;
-	else
-		return RT_FALSE;
+  if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) && FP_EQUALS(p1->z,p2->z) && FP_EQUALS(p1->m,p2->m) )
+    return RT_TRUE;
+  else
+    return RT_FALSE;
 }
 
 int
 p3d_same(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2)
 {
-	if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) && FP_EQUALS(p1->z,p2->z) )
-		return RT_TRUE;
-	else
-		return RT_FALSE;
+  if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) && FP_EQUALS(p1->z,p2->z) )
+    return RT_TRUE;
+  else
+    return RT_FALSE;
 }
 
 int
 p2d_same(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2)
 {
-	if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) )
-		return RT_TRUE;
-	else
-		return RT_FALSE;
+  if( FP_EQUALS(p1->x,p2->x) && FP_EQUALS(p1->y,p2->y) )
+    return RT_TRUE;
+  else
+    return RT_FALSE;
 }
 
 /**
@@ -75,11 +75,11 @@ p2d_same(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2)
 */
 int rt_segment_side(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *q)
 {
-	double side = ( (q->x - p1->x) * (p2->y - p1->y) - (p2->x - p1->x) * (q->y - p1->y) );
-	if ( side == 0.0 )
-		return 0;
-	else
-		return signum(ctx, side);
+  double side = ( (q->x - p1->x) * (p2->y - p1->y) - (p2->x - p1->x) * (q->y - p1->y) );
+  if ( side == 0.0 )
+    return 0;
+  else
+    return signum(ctx, side);
 }
 
 /**
@@ -88,18 +88,18 @@ int rt_segment_side(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2,
 double
 rt_seg_length(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2)
 {
-	return sqrt((A1->x-A2->x)*(A1->x-A2->x)+(A1->y-A2->y)*(A1->y-A2->y));
+  return sqrt((A1->x-A2->x)*(A1->x-A2->x)+(A1->y-A2->y)*(A1->y-A2->y));
 }
 
 /**
-* Returns true if P is on the same side of the plane partition 
+* Returns true if P is on the same side of the plane partition
 * defined by A1/A3 as A2 is. Only makes sense if P has already been
 * determined to be on the circle defined by A1/A2/A3.
 */
 int
 rt_pt_in_arc(const RTCTX *ctx, const RTPOINT2D *P, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3)
 {
-	return rt_segment_side(ctx, A1, A3, A2) == rt_segment_side(ctx, A1, A3, P);
+  return rt_segment_side(ctx, A1, A3, A2) == rt_segment_side(ctx, A1, A3, P);
 }
 
 /**
@@ -109,8 +109,8 @@ rt_pt_in_arc(const RTCTX *ctx, const RTPOINT2D *P, const RTPOINT2D *A1, const RT
 int
 rt_pt_in_seg(const RTCTX *ctx, const RTPOINT2D *P, const RTPOINT2D *A1, const RTPOINT2D *A2)
 {
-	return ((A1->x <= P->x && P->x < A2->x) || (A1->x >= P->x && P->x > A2->x)) ||
-	       ((A1->y <= P->y && P->y < A2->y) || (A1->y >= P->y && P->y > A2->y));
+  return ((A1->x <= P->x && P->x < A2->x) || (A1->x >= P->x && P->x > A2->x)) ||
+         ((A1->y <= P->y && P->y < A2->y) || (A1->y >= P->y && P->y > A2->y));
 }
 
 /**
@@ -119,11 +119,11 @@ rt_pt_in_seg(const RTCTX *ctx, const RTPOINT2D *P, const RTPOINT2D *A1, const RT
 int
 rt_arc_is_pt(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3)
 {
-	if ( A1->x == A2->x && A2->x == A3->x && 
-	     A1->y == A2->y && A2->y == A3->y )
-		return RT_TRUE;
-	else
-		return RT_FALSE;
+  if ( A1->x == A2->x && A2->x == A3->x &&
+       A1->y == A2->y && A2->y == A3->y )
+    return RT_TRUE;
+  else
+    return RT_FALSE;
 }
 
 /**
@@ -132,103 +132,103 @@ rt_arc_is_pt(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const R
 double
 rt_arc_length(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3)
 {
-	RTPOINT2D C;
-	double radius_A, circumference_A;
-	int a2_side, clockwise;
-	double a1, a3;
-	double angle;
-	
-	if ( rt_arc_is_pt(ctx, A1, A2, A3) )
-		return 0.0;
-	
-	radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
-
-	/* Co-linear! Return linear distance! */
-	if ( radius_A < 0 ) 
-	{
+  RTPOINT2D C;
+  double radius_A, circumference_A;
+  int a2_side, clockwise;
+  double a1, a3;
+  double angle;
+
+  if ( rt_arc_is_pt(ctx, A1, A2, A3) )
+    return 0.0;
+
+  radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
+
+  /* Co-linear! Return linear distance! */
+  if ( radius_A < 0 )
+  {
         double dx = A1->x - A3->x;
         double dy = A1->y - A3->y;
-		return sqrt(dx*dx + dy*dy);
-	}
-	
-	/* Closed circle! Return the circumference! */
-	circumference_A = M_PI * 2 * radius_A;
-	if ( p2d_same(ctx, A1, A3) )
-		return circumference_A;
-	
-	/* Determine the orientation of the arc */
-	a2_side = rt_segment_side(ctx, A1, A3, A2);
-
-	/* The side of the A1/A3 line that A2 falls on dictates the sweep  
-	   direction from A1 to A3. */
-	if ( a2_side == -1 ) 
-		clockwise = RT_TRUE;
-	else 
-		clockwise = RT_FALSE;
-		
-	/* Angles of each point that defines the arc section */
-	a1 = atan2(A1->y - C.y, A1->x - C.x);
-	a3 = atan2(A3->y - C.y, A3->x - C.x);
-
-	/* What's the sweep from A1 to A3? */
-	if ( clockwise )
-	{
-		if ( a1 > a3 )
-			angle = a1 - a3;
-		else
-			angle = 2*M_PI + a1 - a3; 
-	}
-	else
-	{
-		if ( a3 > a1 )
-			angle = a3 - a1;
-		else
-			angle = 2*M_PI + a3 - a1; 			
-	}
-
-	/* Length as proportion of circumference */
-	return circumference_A * (angle / (2*M_PI));
+    return sqrt(dx*dx + dy*dy);
+  }
+
+  /* Closed circle! Return the circumference! */
+  circumference_A = M_PI * 2 * radius_A;
+  if ( p2d_same(ctx, A1, A3) )
+    return circumference_A;
+
+  /* Determine the orientation of the arc */
+  a2_side = rt_segment_side(ctx, A1, A3, A2);
+
+  /* The side of the A1/A3 line that A2 falls on dictates the sweep
+     direction from A1 to A3. */
+  if ( a2_side == -1 )
+    clockwise = RT_TRUE;
+  else
+    clockwise = RT_FALSE;
+
+  /* Angles of each point that defines the arc section */
+  a1 = atan2(A1->y - C.y, A1->x - C.x);
+  a3 = atan2(A3->y - C.y, A3->x - C.x);
+
+  /* What's the sweep from A1 to A3? */
+  if ( clockwise )
+  {
+    if ( a1 > a3 )
+      angle = a1 - a3;
+    else
+      angle = 2*M_PI + a1 - a3;
+  }
+  else
+  {
+    if ( a3 > a1 )
+      angle = a3 - a1;
+    else
+      angle = 2*M_PI + a3 - a1;
+  }
+
+  /* Length as proportion of circumference */
+  return circumference_A * (angle / (2*M_PI));
 }
 
 int rt_arc_side(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, const RTPOINT2D *A3, const RTPOINT2D *Q)
 {
-	RTPOINT2D C;
-	double radius_A;
-	double side_Q, side_A2;
-	double d;
-	
-	side_Q = rt_segment_side(ctx, A1, A3, Q);
-	radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
-	side_A2 = rt_segment_side(ctx, A1, A3, A2);
-	
-	/* Linear case */
-	if ( radius_A < 0 )
-		return side_Q;
-		
-	d = distance2d_pt_pt(ctx, Q, &C);
-	
-	/* Q is on the arc boundary */
-	if ( d == radius_A && side_Q == side_A2 )
-	{	
-		return 0;
-	}
-	
-	/* Q on A1-A3 line, so its on opposite side to A2 */
-	if ( side_Q == 0 )
-	{
-		return -1 * side_A2;
-	}
-	
-	/* 
-	* Q is inside the arc boundary, so it's not on the side we 
-	* might think from examining only the end points
-	*/
-	if ( d < radius_A && side_Q == side_A2 )
-	{
-		side_Q *= -1;
-	}
-	
-	return side_Q;
+  RTPOINT2D C;
+  double radius_A;
+  double side_Q, side_A2;
+  double d;
+
+  side_Q = rt_segment_side(ctx, A1, A3, Q);
+  radius_A = rt_arc_center(ctx, A1, A2, A3, &C);
+  side_A2 = rt_segment_side(ctx, A1, A3, A2);
+
+  /* Linear case */
+  if ( radius_A < 0 )
+    return side_Q;
+
+  d = distance2d_pt_pt(ctx, Q, &C);
+
+  /* Q is on the arc boundary */
+  if ( d == radius_A && side_Q == side_A2 )
+  {
+    return 0;
+  }
+
+  /* Q on A1-A3 line, so its on opposite side to A2 */
+  if ( side_Q == 0 )
+  {
+    return -1 * side_A2;
+  }
+
+  /*
+  * Q is inside the arc boundary, so it's not on the side we
+  * might think from examining only the end points
+  */
+  if ( d < radius_A && side_Q == side_A2 )
+  {
+    side_Q *= -1;
+  }
+
+  return side_Q;
 }
 
 /**
@@ -239,223 +239,223 @@ int rt_arc_side(const RTCTX *ctx, const RTPOINT2D *A1, const RTPOINT2D *A2, cons
 * point is coincident with either end point, they are taken as colinear.
 */
 double
-rt_arc_center(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *p3, RTPOINT2D *result)	
+rt_arc_center(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *p3, RTPOINT2D *result)
 {
-	RTPOINT2D c;
-	double cx, cy, cr;
-	double dx21, dy21, dx31, dy31, h21, h31, d;
-
-	c.x = c.y = 0.0;
-
-	RTDEBUGF(2, "rt_arc_center called (%.16f,%.16f), (%.16f,%.16f), (%.16f,%.16f).", p1->x, p1->y, p2->x, p2->y, p3->x, p3->y);
-
-	/* Closed circle */
-	if (fabs(p1->x - p3->x) < EPSILON_SQLMM &&
-	    fabs(p1->y - p3->y) < EPSILON_SQLMM)
-	{
-		cx = p1->x + (p2->x - p1->x) / 2.0;
-		cy = p1->y + (p2->y - p1->y) / 2.0;
-		c.x = cx;
-		c.y = cy;
-		*result = c;
-		cr = sqrt(pow(cx - p1->x, 2.0) + pow(cy - p1->y, 2.0));
-		return cr;
-	}
-
-	/* Using cartesian eguations from page https://en.wikipedia.org/wiki/Circumscribed_circle */
-	dx21 = p2->x - p1->x;
-	dy21 = p2->y - p1->y;
-	dx31 = p3->x - p1->x;
-	dy31 = p3->y - p1->y;
-
-	h21 = pow(dx21, 2.0) + pow(dy21, 2.0);
-	h31 = pow(dx31, 2.0) + pow(dy31, 2.0);
-
-	/* 2 * |Cross product|, d<0 means clockwise and d>0 counterclockwise sweeping angle */
-	d = 2 * (dx21 * dy31 - dx31 * dy21);
-
-	/* Check colinearity, |Cross product| = 0 */
-	if (fabs(d) < EPSILON_SQLMM)
-		return -1.0;
-
-	/* Calculate centroid coordinates and radius */
-	cx = p1->x + (h21 * dy31 - h31 * dy21) / d;
-	cy = p1->y - (h21 * dx31 - h31 * dx21) / d;
-	c.x = cx;
-	c.y = cy;
-	*result = c;
-	cr = sqrt(pow(cx - p1->x, 2) + pow(cy - p1->y, 2));
-
-	RTDEBUGF(2, "rt_arc_center center is (%.16f,%.16f)", result->x, result->y);
-
-	return cr;
+  RTPOINT2D c;
+  double cx, cy, cr;
+  double dx21, dy21, dx31, dy31, h21, h31, d;
+
+  c.x = c.y = 0.0;
+
+  RTDEBUGF(2, "rt_arc_center called (%.16f,%.16f), (%.16f,%.16f), (%.16f,%.16f).", p1->x, p1->y, p2->x, p2->y, p3->x, p3->y);
+
+  /* Closed circle */
+  if (fabs(p1->x - p3->x) < EPSILON_SQLMM &&
+      fabs(p1->y - p3->y) < EPSILON_SQLMM)
+  {
+    cx = p1->x + (p2->x - p1->x) / 2.0;
+    cy = p1->y + (p2->y - p1->y) / 2.0;
+    c.x = cx;
+    c.y = cy;
+    *result = c;
+    cr = sqrt(pow(cx - p1->x, 2.0) + pow(cy - p1->y, 2.0));
+    return cr;
+  }
+
+  /* Using cartesian eguations from page https://en.wikipedia.org/wiki/Circumscribed_circle */
+  dx21 = p2->x - p1->x;
+  dy21 = p2->y - p1->y;
+  dx31 = p3->x - p1->x;
+  dy31 = p3->y - p1->y;
+
+  h21 = pow(dx21, 2.0) + pow(dy21, 2.0);
+  h31 = pow(dx31, 2.0) + pow(dy31, 2.0);
+
+  /* 2 * |Cross product|, d<0 means clockwise and d>0 counterclockwise sweeping angle */
+  d = 2 * (dx21 * dy31 - dx31 * dy21);
+
+  /* Check colinearity, |Cross product| = 0 */
+  if (fabs(d) < EPSILON_SQLMM)
+    return -1.0;
+
+  /* Calculate centroid coordinates and radius */
+  cx = p1->x + (h21 * dy31 - h31 * dy21) / d;
+  cy = p1->y - (h21 * dx31 - h31 * dx21) / d;
+  c.x = cx;
+  c.y = cy;
+  *result = c;
+  cr = sqrt(pow(cx - p1->x, 2) + pow(cy - p1->y, 2));
+
+  RTDEBUGF(2, "rt_arc_center center is (%.16f,%.16f)", result->x, result->y);
+
+  return cr;
 }
 
 int
 pt_in_ring_2d(const RTCTX *ctx, const RTPOINT2D *p, const RTPOINTARRAY *ring)
 {
-	int cn = 0;    /* the crossing number counter */
-	int i;
-	const RTPOINT2D *v1, *v2;
-	const RTPOINT2D *first, *last;
-
-	first = rt_getPoint2d_cp(ctx, ring, 0);
-	last = rt_getPoint2d_cp(ctx, ring, ring->npoints-1);
-	if ( memcmp(first, last, sizeof(RTPOINT2D)) )
-	{
-		rterror(ctx, "pt_in_ring_2d: V[n] != V[0] (%g %g != %g %g)",
-		        first->x, first->y, last->x, last->y);
-		return RT_FALSE;
-
-	}
-
-	RTDEBUGF(2, "pt_in_ring_2d called with point: %g %g", p->x, p->y);
-	/* printPA(ctx, ring); */
-
-	/* loop through all edges of the polygon */
-	v1 = rt_getPoint2d_cp(ctx, ring, 0);
-	for (i=0; i<ring->npoints-1; i++)
-	{
-		double vt;
-		v2 = rt_getPoint2d_cp(ctx, ring, i+1);
-
-		/* edge from vertex i to vertex i+1 */
-		if
-		(
-		    /* an upward crossing */
-		    ((v1->y <= p->y) && (v2->y > p->y))
-		    /* a downward crossing */
-		    || ((v1->y > p->y) && (v2->y <= p->y))
-		)
-		{
-
-			vt = (double)(p->y - v1->y) / (v2->y - v1->y);
-
-			/* P->x <intersect */
-			if (p->x < v1->x + vt * (v2->x - v1->x))
-			{
-				/* a valid crossing of y=p->y right of p->x */
-				++cn;
-			}
-		}
-		v1 = v2;
-	}
-
-	RTDEBUGF(3, "pt_in_ring_2d returning %d", cn&1);
-
-	return (cn&1);    /* 0 if even (out), and 1 if odd (in) */
+  int cn = 0;    /* the crossing number counter */
+  int i;
+  const RTPOINT2D *v1, *v2;
+  const RTPOINT2D *first, *last;
+
+  first = rt_getPoint2d_cp(ctx, ring, 0);
+  last = rt_getPoint2d_cp(ctx, ring, ring->npoints-1);
+  if ( memcmp(first, last, sizeof(RTPOINT2D)) )
+  {
+    rterror(ctx, "pt_in_ring_2d: V[n] != V[0] (%g %g != %g %g)",
+            first->x, first->y, last->x, last->y);
+    return RT_FALSE;
+
+  }
+
+  RTDEBUGF(2, "pt_in_ring_2d called with point: %g %g", p->x, p->y);
+  /* printPA(ctx, ring); */
+
+  /* loop through all edges of the polygon */
+  v1 = rt_getPoint2d_cp(ctx, ring, 0);
+  for (i=0; i<ring->npoints-1; i++)
+  {
+    double vt;
+    v2 = rt_getPoint2d_cp(ctx, ring, i+1);
+
+    /* edge from vertex i to vertex i+1 */
+    if
+    (
+        /* an upward crossing */
+        ((v1->y <= p->y) && (v2->y > p->y))
+        /* a downward crossing */
+        || ((v1->y > p->y) && (v2->y <= p->y))
+    )
+    {
+
+      vt = (double)(p->y - v1->y) / (v2->y - v1->y);
+
+      /* P->x <intersect */
+      if (p->x < v1->x + vt * (v2->x - v1->x))
+      {
+        /* a valid crossing of y=p->y right of p->x */
+        ++cn;
+      }
+    }
+    v1 = v2;
+  }
+
+  RTDEBUGF(3, "pt_in_ring_2d returning %d", cn&1);
+
+  return (cn&1);    /* 0 if even (out), and 1 if odd (in) */
 }
 
 
-static int 
+static int
 rt_seg_interact(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *q1, const RTPOINT2D *q2)
 {
-	double minq=FP_MIN(q1->x,q2->x);
-	double maxq=FP_MAX(q1->x,q2->x);
-	double minp=FP_MIN(p1->x,p2->x);
-	double maxp=FP_MAX(p1->x,p2->x);
+  double minq=FP_MIN(q1->x,q2->x);
+  double maxq=FP_MAX(q1->x,q2->x);
+  double minp=FP_MIN(p1->x,p2->x);
+  double maxp=FP_MAX(p1->x,p2->x);
 
-	if (FP_GT(minp,maxq) || FP_LT(maxp,minq))
-		return RT_FALSE;
+  if (FP_GT(minp,maxq) || FP_LT(maxp,minq))
+    return RT_FALSE;
 
-	minq=FP_MIN(q1->y,q2->y);
-	maxq=FP_MAX(q1->y,q2->y);
-	minp=FP_MIN(p1->y,p2->y);
-	maxp=FP_MAX(p1->y,p2->y);
+  minq=FP_MIN(q1->y,q2->y);
+  maxq=FP_MAX(q1->y,q2->y);
+  minp=FP_MIN(p1->y,p2->y);
+  maxp=FP_MAX(p1->y,p2->y);
 
-	if (FP_GT(minp,maxq) || FP_LT(maxp,minq))
-		return RT_FALSE;
+  if (FP_GT(minp,maxq) || FP_LT(maxp,minq))
+    return RT_FALSE;
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 /**
 ** @brief returns the kind of #RTCG_SEGMENT_INTERSECTION_TYPE  behavior of lineseg 1 (constructed from p1 and p2) and lineseg 2 (constructed from q1 and q2)
-**	@param p1 start point of first straight linesegment
-**	@param p2 end point of first straight linesegment
-**	@param q1 start point of second line segment
-**	@param q2 end point of second line segment
-**	@return a #RTCG_SEGMENT_INTERSECTION_TYPE
-** 	Returns one of
-**		SEG_ERROR = -1,
-**		SEG_NO_INTERSECTION = 0,
-**		SEG_COLINEAR = 1,
-**		SEG_CROSS_LEFT = 2,
-**		SEG_CROSS_RIGHT = 3,
+**  @param p1 start point of first straight linesegment
+**  @param p2 end point of first straight linesegment
+**  @param q1 start point of second line segment
+**  @param q2 end point of second line segment
+**  @return a #RTCG_SEGMENT_INTERSECTION_TYPE
+**   Returns one of
+**    SEG_ERROR = -1,
+**    SEG_NO_INTERSECTION = 0,
+**    SEG_COLINEAR = 1,
+**    SEG_CROSS_LEFT = 2,
+**    SEG_CROSS_RIGHT = 3,
 */
 int rt_segment_intersects(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D *p2, const RTPOINT2D *q1, const RTPOINT2D *q2)
 {
 
-	int pq1, pq2, qp1, qp2;
-
-	/* No envelope interaction => we are done. */
-	if (!rt_seg_interact(ctx, p1, p2, q1, p2))
-	{
-		return SEG_NO_INTERSECTION;
-	}
-
-	/* Are the start and end points of q on the same side of p? */
-	pq1=rt_segment_side(ctx, p1,p2,q1);
-	pq2=rt_segment_side(ctx, p1,p2,q2);
-	if ((pq1>0 && pq2>0) || (pq1<0 && pq2<0))
-	{
-		return SEG_NO_INTERSECTION;
-	}
-
-	/* Are the start and end points of p on the same side of q? */
-	qp1=rt_segment_side(ctx, q1,q2,p1);
-	qp2=rt_segment_side(ctx, q1,q2,p2);
-	if ( (qp1 > 0.0 && qp2 > 0.0) || (qp1 < 0.0 && qp2 < 0.0) )
-	{
-		return SEG_NO_INTERSECTION;
-	}
-
-	/* Nobody is on one side or another? Must be colinear. */
-	if ( pq1 == 0.0 && pq2 == 0.0 && qp1 == 0.0 && qp2 == 0.0 )
-	{
-		return SEG_COLINEAR;
-	}
-
-	/*
-	** When one end-point touches, the sidedness is determined by the
-	** location of the other end-point. Only touches by the first point
-	** will be considered "real" to avoid double counting.
-	*/
-	RTDEBUGF(4, "pq1=%.15g pq2=%.15g", pq1, pq2);
-	RTDEBUGF(4, "qp1=%.15g qp2=%.15g", qp1, qp2);
-
-	/* Second point of p or q touches, it's not a crossing. */
-	if ( pq2 == 0 || qp2 == 0 )
-	{
-		return SEG_NO_INTERSECTION;
-	}
-
-	/* First point of p touches, it's a "crossing". */
-	if ( pq1 == 0 )
-	{
-		if ( pq2 > 0 )
-			return SEG_CROSS_RIGHT;
-		else
-			return SEG_CROSS_LEFT;
-	}
-
-	/* First point of q touches, it's a crossing. */
-	if ( qp1 == 0 )
-	{
-		if ( pq1 < pq2 )
-			return SEG_CROSS_RIGHT;
-		else
-			return SEG_CROSS_LEFT;
-	}
-
-	/* The segments cross, what direction is the crossing? */
-	if ( pq1 < pq2 )
-		return SEG_CROSS_RIGHT;
-	else
-		return SEG_CROSS_LEFT;
-
-	/* This should never happen! */
-	return SEG_ERROR;
+  int pq1, pq2, qp1, qp2;
+
+  /* No envelope interaction => we are done. */
+  if (!rt_seg_interact(ctx, p1, p2, q1, p2))
+  {
+    return SEG_NO_INTERSECTION;
+  }
+
+  /* Are the start and end points of q on the same side of p? */
+  pq1=rt_segment_side(ctx, p1,p2,q1);
+  pq2=rt_segment_side(ctx, p1,p2,q2);
+  if ((pq1>0 && pq2>0) || (pq1<0 && pq2<0))
+  {
+    return SEG_NO_INTERSECTION;
+  }
+
+  /* Are the start and end points of p on the same side of q? */
+  qp1=rt_segment_side(ctx, q1,q2,p1);
+  qp2=rt_segment_side(ctx, q1,q2,p2);
+  if ( (qp1 > 0.0 && qp2 > 0.0) || (qp1 < 0.0 && qp2 < 0.0) )
+  {
+    return SEG_NO_INTERSECTION;
+  }
+
+  /* Nobody is on one side or another? Must be colinear. */
+  if ( pq1 == 0.0 && pq2 == 0.0 && qp1 == 0.0 && qp2 == 0.0 )
+  {
+    return SEG_COLINEAR;
+  }
+
+  /*
+  ** When one end-point touches, the sidedness is determined by the
+  ** location of the other end-point. Only touches by the first point
+  ** will be considered "real" to avoid double counting.
+  */
+  RTDEBUGF(4, "pq1=%.15g pq2=%.15g", pq1, pq2);
+  RTDEBUGF(4, "qp1=%.15g qp2=%.15g", qp1, qp2);
+
+  /* Second point of p or q touches, it's not a crossing. */
+  if ( pq2 == 0 || qp2 == 0 )
+  {
+    return SEG_NO_INTERSECTION;
+  }
+
+  /* First point of p touches, it's a "crossing". */
+  if ( pq1 == 0 )
+  {
+    if ( pq2 > 0 )
+      return SEG_CROSS_RIGHT;
+    else
+      return SEG_CROSS_LEFT;
+  }
+
+  /* First point of q touches, it's a crossing. */
+  if ( qp1 == 0 )
+  {
+    if ( pq1 < pq2 )
+      return SEG_CROSS_RIGHT;
+    else
+      return SEG_CROSS_LEFT;
+  }
+
+  /* The segments cross, what direction is the crossing? */
+  if ( pq1 < pq2 )
+    return SEG_CROSS_RIGHT;
+  else
+    return SEG_CROSS_LEFT;
+
+  /* This should never happen! */
+  return SEG_ERROR;
 }
 
 /**
@@ -474,111 +474,111 @@ int rt_segment_intersects(const RTCTX *ctx, const RTPOINT2D *p1, const RTPOINT2D
 */
 int rtline_crossing_direction(const RTCTX *ctx, const RTLINE *l1, const RTLINE *l2)
 {
-	int i = 0, j = 0;
-	const RTPOINT2D *p1, *p2, *q1, *q2;
-	RTPOINTARRAY *pa1 = NULL, *pa2 = NULL;
-	int cross_left = 0;
-	int cross_right = 0;
-	int first_cross = 0;
-	int this_cross = 0;
+  int i = 0, j = 0;
+  const RTPOINT2D *p1, *p2, *q1, *q2;
+  RTPOINTARRAY *pa1 = NULL, *pa2 = NULL;
+  int cross_left = 0;
+  int cross_right = 0;
+  int first_cross = 0;
+  int this_cross = 0;
 
-	pa1 = (RTPOINTARRAY*)l1->points;
-	pa2 = (RTPOINTARRAY*)l2->points;
+  pa1 = (RTPOINTARRAY*)l1->points;
+  pa2 = (RTPOINTARRAY*)l2->points;
 
-	/* One-point lines can't intersect (and shouldn't exist). */
-	if ( pa1->npoints < 2 || pa2->npoints < 2 )
-		return LINE_NO_CROSS;
+  /* One-point lines can't intersect (and shouldn't exist). */
+  if ( pa1->npoints < 2 || pa2->npoints < 2 )
+    return LINE_NO_CROSS;
 
-	RTDEBUGF(4, "l1 = %s", rtgeom_to_ewkt(ctx, (RTGEOM*)l1));
-	RTDEBUGF(4, "l2 = %s", rtgeom_to_ewkt(ctx, (RTGEOM*)l2));
+  RTDEBUGF(4, "l1 = %s", rtgeom_to_ewkt(ctx, (RTGEOM*)l1));
+  RTDEBUGF(4, "l2 = %s", rtgeom_to_ewkt(ctx, (RTGEOM*)l2));
 
-	/* Initialize first point of q */
-	q1 = rt_getPoint2d_cp(ctx, pa2, 0);
+  /* Initialize first point of q */
+  q1 = rt_getPoint2d_cp(ctx, pa2, 0);
 
-	for ( i = 1; i < pa2->npoints; i++ )
-	{
+  for ( i = 1; i < pa2->npoints; i++ )
+  {
 
-		/* Update second point of q to next value */
-		q2 = rt_getPoint2d_cp(ctx, pa2, i);
+    /* Update second point of q to next value */
+    q2 = rt_getPoint2d_cp(ctx, pa2, i);
 
-		/* Initialize first point of p */
-		p1 = rt_getPoint2d_cp(ctx, pa1, 0);
+    /* Initialize first point of p */
+    p1 = rt_getPoint2d_cp(ctx, pa1, 0);
 
-		for ( j = 1; j < pa1->npoints; j++ )
-		{
+    for ( j = 1; j < pa1->npoints; j++ )
+    {
 
-			/* Update second point of p to next value */
-			p2 = rt_getPoint2d_cp(ctx, pa1, j);
+      /* Update second point of p to next value */
+      p2 = rt_getPoint2d_cp(ctx, pa1, j);
 
-			this_cross = rt_segment_intersects(ctx, p1, p2, q1, q2);
+      this_cross = rt_segment_intersects(ctx, p1, p2, q1, q2);
 
-			RTDEBUGF(4, "i=%d, j=%d (%.8g %.8g, %.8g %.8g)", this_cross, i, j, p1->x, p1->y, p2->x, p2->y);
+      RTDEBUGF(4, "i=%d, j=%d (%.8g %.8g, %.8g %.8g)", this_cross, i, j, p1->x, p1->y, p2->x, p2->y);
 
-			if ( this_cross == SEG_CROSS_LEFT )
-			{
-				RTDEBUG(4,"this_cross == SEG_CROSS_LEFT");
-				cross_left++;
-				if ( ! first_cross )
-					first_cross = SEG_CROSS_LEFT;
-			}
+      if ( this_cross == SEG_CROSS_LEFT )
+      {
+        RTDEBUG(4,"this_cross == SEG_CROSS_LEFT");
+        cross_left++;
+        if ( ! first_cross )
+          first_cross = SEG_CROSS_LEFT;
+      }
 
-			if ( this_cross == SEG_CROSS_RIGHT )
-			{
-				RTDEBUG(4,"this_cross == SEG_CROSS_RIGHT");
-				cross_right++;
-				if ( ! first_cross )
-					first_cross = SEG_CROSS_LEFT;
-			}
+      if ( this_cross == SEG_CROSS_RIGHT )
+      {
+        RTDEBUG(4,"this_cross == SEG_CROSS_RIGHT");
+        cross_right++;
+        if ( ! first_cross )
+          first_cross = SEG_CROSS_LEFT;
+      }
 
-			/*
-			** Crossing at a co-linearity can be turned handled by extending
-			** segment to next vertext and seeing if the end points straddle
-			** the co-linear segment.
-			*/
-			if ( this_cross == SEG_COLINEAR )
-			{
-				RTDEBUG(4,"this_cross == SEG_COLINEAR");
-				/* TODO: Add logic here and in segment_intersects()
-				continue;
-				*/
-			}
+      /*
+      ** Crossing at a co-linearity can be turned handled by extending
+      ** segment to next vertext and seeing if the end points straddle
+      ** the co-linear segment.
+      */
+      if ( this_cross == SEG_COLINEAR )
+      {
+        RTDEBUG(4,"this_cross == SEG_COLINEAR");
+        /* TODO: Add logic here and in segment_intersects()
+        continue;
+        */
+      }
 
-			RTDEBUG(4,"this_cross == SEG_NO_INTERSECTION");
+      RTDEBUG(4,"this_cross == SEG_NO_INTERSECTION");
 
-			/* Turn second point of p into first point */
-			p1 = p2;
+      /* Turn second point of p into first point */
+      p1 = p2;
 
-		}
+    }
 
-		/* Turn second point of q into first point */
-		q1 = q2;
+    /* Turn second point of q into first point */
+    q1 = q2;
 
-	}
+  }
 
-	RTDEBUGF(4, "first_cross=%d, cross_left=%d, cross_right=%d", first_cross, cross_left, cross_right);
+  RTDEBUGF(4, "first_cross=%d, cross_left=%d, cross_right=%d", first_cross, cross_left, cross_right);
 
-	if ( !cross_left && !cross_right )
-		return LINE_NO_CROSS;
+  if ( !cross_left && !cross_right )
+    return LINE_NO_CROSS;
 
-	if ( !cross_left && cross_right == 1 )
-		return LINE_CROSS_RIGHT;
+  if ( !cross_left && cross_right == 1 )
+    return LINE_CROSS_RIGHT;
 
-	if ( !cross_right && cross_left == 1 )
-		return LINE_CROSS_LEFT;
+  if ( !cross_right && cross_left == 1 )
+    return LINE_CROSS_LEFT;
 
-	if ( cross_left - cross_right == 1 )
-		return LINE_MULTICROSS_END_LEFT;
+  if ( cross_left - cross_right == 1 )
+    return LINE_MULTICROSS_END_LEFT;
 
-	if ( cross_left - cross_right == -1 )
-		return LINE_MULTICROSS_END_RIGHT;
+  if ( cross_left - cross_right == -1 )
+    return LINE_MULTICROSS_END_RIGHT;
 
-	if ( cross_left - cross_right == 0 && first_cross == SEG_CROSS_LEFT )
-		return LINE_MULTICROSS_END_SAME_FIRST_LEFT;
+  if ( cross_left - cross_right == 0 && first_cross == SEG_CROSS_LEFT )
+    return LINE_MULTICROSS_END_SAME_FIRST_LEFT;
 
-	if ( cross_left - cross_right == 0 && first_cross == SEG_CROSS_RIGHT )
-		return LINE_MULTICROSS_END_SAME_FIRST_RIGHT;
+  if ( cross_left - cross_right == 0 && first_cross == SEG_CROSS_RIGHT )
+    return LINE_MULTICROSS_END_SAME_FIRST_RIGHT;
 
-	return LINE_NO_CROSS;
+  return LINE_NO_CROSS;
 
 }
 
@@ -595,62 +595,62 @@ static char *base32 = "0123456789bcdefghjkmnpqrstuvwxyz";
 */
 char * geohash_point(const RTCTX *ctx, double longitude, double latitude, int precision)
 {
-	int is_even=1, i=0;
-	double lat[2], lon[2], mid;
-	char bits[] = {16,8,4,2,1};
-	int bit=0, ch=0;
-	char *geohash = NULL;
-
-	geohash = rtalloc(ctx, precision + 1);
-
-	lat[0] = -90.0;
-	lat[1] = 90.0;
-	lon[0] = -180.0;
-	lon[1] = 180.0;
-
-	while (i < precision)
-	{
-		if (is_even)
-		{
-			mid = (lon[0] + lon[1]) / 2;
-			if (longitude >= mid)
-			{
-				ch |= bits[bit];
-				lon[0] = mid;
-			}
-			else
-			{
-				lon[1] = mid;
-			}
-		}
-		else
-		{
-			mid = (lat[0] + lat[1]) / 2;
-			if (latitude >= mid)
-			{
-				ch |= bits[bit];
-				lat[0] = mid;
-			}
-			else
-			{
-				lat[1] = mid;
-			}
-		}
-
-		is_even = !is_even;
-		if (bit < 4)
-		{
-			bit++;
-		}
-		else
-		{
-			geohash[i++] = base32[ch];
-			bit = 0;
-			ch = 0;
-		}
-	}
-	geohash[i] = 0;
-	return geohash;
+  int is_even=1, i=0;
+  double lat[2], lon[2], mid;
+  char bits[] = {16,8,4,2,1};
+  int bit=0, ch=0;
+  char *geohash = NULL;
+
+  geohash = rtalloc(ctx, precision + 1);
+
+  lat[0] = -90.0;
+  lat[1] = 90.0;
+  lon[0] = -180.0;
+  lon[1] = 180.0;
+
+  while (i < precision)
+  {
+    if (is_even)
+    {
+      mid = (lon[0] + lon[1]) / 2;
+      if (longitude >= mid)
+      {
+        ch |= bits[bit];
+        lon[0] = mid;
+      }
+      else
+      {
+        lon[1] = mid;
+      }
+    }
+    else
+    {
+      mid = (lat[0] + lat[1]) / 2;
+      if (latitude >= mid)
+      {
+        ch |= bits[bit];
+        lat[0] = mid;
+      }
+      else
+      {
+        lat[1] = mid;
+      }
+    }
+
+    is_even = !is_even;
+    if (bit < 4)
+    {
+      bit++;
+    }
+    else
+    {
+      geohash[i++] = base32[ch];
+      bit = 0;
+      ch = 0;
+    }
+  }
+  geohash[i] = 0;
+  return geohash;
 }
 
 
@@ -661,51 +661,51 @@ char * geohash_point(const RTCTX *ctx, double longitude, double latitude, int pr
 */
 unsigned int geohash_point_as_int(const RTCTX *ctx, RTPOINT2D *pt)
 {
-	int is_even=1;
-	double lat[2], lon[2], mid;
-	int bit=32;
-	unsigned int ch = 0;
-
-	double longitude = pt->x;
-	double latitude = pt->y;
-
-	lat[0] = -90.0;
-	lat[1] = 90.0;
-	lon[0] = -180.0;
-	lon[1] = 180.0;
-
-	while (--bit >= 0)
-	{
-		if (is_even)
-		{
-			mid = (lon[0] + lon[1]) / 2;
-			if (longitude > mid)
-			{
-				ch |= 0x0001 << bit;
-				lon[0] = mid;
-			}
-			else
-			{
-				lon[1] = mid;
-			}
-		}
-		else
-		{
-			mid = (lat[0] + lat[1]) / 2;
-			if (latitude > mid)
-			{
-				ch |= 0x0001 << bit;
-				lat[0] = mid;
-			}
-			else
-			{
-				lat[1] = mid;
-			}
-		}
-
-		is_even = !is_even;
-	}
-	return ch;
+  int is_even=1;
+  double lat[2], lon[2], mid;
+  int bit=32;
+  unsigned int ch = 0;
+
+  double longitude = pt->x;
+  double latitude = pt->y;
+
+  lat[0] = -90.0;
+  lat[1] = 90.0;
+  lon[0] = -180.0;
+  lon[1] = 180.0;
+
+  while (--bit >= 0)
+  {
+    if (is_even)
+    {
+      mid = (lon[0] + lon[1]) / 2;
+      if (longitude > mid)
+      {
+        ch |= 0x0001 << bit;
+        lon[0] = mid;
+      }
+      else
+      {
+        lon[1] = mid;
+      }
+    }
+    else
+    {
+      mid = (lat[0] + lat[1]) / 2;
+      if (latitude > mid)
+      {
+        ch |= 0x0001 << bit;
+        lat[0] = mid;
+      }
+      else
+      {
+        lat[1] = mid;
+      }
+    }
+
+    is_even = !is_even;
+  }
+  return ch;
 }
 
 /*
@@ -717,119 +717,119 @@ unsigned int geohash_point_as_int(const RTCTX *ctx, RTPOINT2D *pt)
 */
 void decode_geohash_bbox(const RTCTX *ctx, char *geohash, double *lat, double *lon, int precision)
 {
-	int i, j, hashlen;
-	char c, cd, mask, is_even = 1;
-	static char bits[] = {16, 8, 4, 2, 1};
-
-	lat[0] = -90.0;
-	lat[1] = 90.0;
-	lon[0] = -180.0;
-	lon[1] = 180.0;
-
-	hashlen = strlen(geohash);
-
-	if (precision < 0 || precision > hashlen)
-	{
-		precision = hashlen;
-	}
-
-	for (i = 0; i < precision; i++)
-	{
-		c = tolower(geohash[i]);
-		cd = strchr(base32, c) - base32;
-
-		for (j = 0; j < 5; j++)
-		{
-			mask = bits[j];
-			if (is_even)
-			{
-				lon[!(cd & mask)] = (lon[0] + lon[1]) / 2;
-			}
-			else
-			{
-				lat[!(cd & mask)] = (lat[0] + lat[1]) / 2;
-			}
-			is_even = !is_even;
-		}
-	}
+  int i, j, hashlen;
+  char c, cd, mask, is_even = 1;
+  static char bits[] = {16, 8, 4, 2, 1};
+
+  lat[0] = -90.0;
+  lat[1] = 90.0;
+  lon[0] = -180.0;
+  lon[1] = 180.0;
+
+  hashlen = strlen(geohash);
+
+  if (precision < 0 || precision > hashlen)
+  {
+    precision = hashlen;
+  }
+
+  for (i = 0; i < precision; i++)
+  {
+    c = tolower(geohash[i]);
+    cd = strchr(base32, c) - base32;
+
+    for (j = 0; j < 5; j++)
+    {
+      mask = bits[j];
+      if (is_even)
+      {
+        lon[!(cd & mask)] = (lon[0] + lon[1]) / 2;
+      }
+      else
+      {
+        lat[!(cd & mask)] = (lat[0] + lat[1]) / 2;
+      }
+      is_even = !is_even;
+    }
+  }
 }
 
 int rtgeom_geohash_precision(const RTCTX *ctx, RTGBOX bbox, RTGBOX *bounds)
 {
-	double minx, miny, maxx, maxy;
-	double latmax, latmin, lonmax, lonmin;
-	double lonwidth, latwidth;
-	double latmaxadjust, lonmaxadjust, latminadjust, lonminadjust;
-	int precision = 0;
-
-	/* Get the bounding box, return error if things don't work out. */
-	minx = bbox.xmin;
-	miny = bbox.ymin;
-	maxx = bbox.xmax;
-	maxy = bbox.ymax;
-
-	if ( minx == maxx && miny == maxy )
-	{
-		/* It's a point. Doubles have 51 bits of precision.
-		** 2 * 51 / 5 == 20 */
-		return 20;
-	}
-
-	lonmin = -180.0;
-	latmin = -90.0;
-	lonmax = 180.0;
-	latmax = 90.0;
-
-	/* Shrink a world bounding box until one of the edges interferes with the
-	** bounds of our rectangle. */
-	while ( 1 )
-	{
-		lonwidth = lonmax - lonmin;
-		latwidth = latmax - latmin;
-		latmaxadjust = lonmaxadjust = latminadjust = lonminadjust = 0.0;
-
-		if ( minx > lonmin + lonwidth / 2.0 )
-		{
-			lonminadjust = lonwidth / 2.0;
-		}
-		else if ( maxx < lonmax - lonwidth / 2.0 )
-		{
-			lonmaxadjust = -1 * lonwidth / 2.0;
-		}
-		if ( miny > latmin + latwidth / 2.0 )
-		{
-			latminadjust = latwidth / 2.0;
-		}
-		else if (maxy < latmax - latwidth / 2.0 )
-		{
-			latmaxadjust = -1 * latwidth / 2.0;
-		}
-		/* Only adjust if adjustments are legal (we haven't crossed any edges). */
-		if ( (lonminadjust || lonmaxadjust) && (latminadjust || latmaxadjust ) )
-		{
-			latmin += latminadjust;
-			lonmin += lonminadjust;
-			latmax += latmaxadjust;
-			lonmax += lonmaxadjust;
-			/* Each adjustment cycle corresponds to 2 bits of storage in the
-			** geohash.	*/
-			precision += 2;
-		}
-		else
-		{
-			break;
-		}
-	}
-
-	/* Save the edges of our bounds, in case someone cares later. */
-	bounds->xmin = lonmin;
-	bounds->xmax = lonmax;
-	bounds->ymin = latmin;
-	bounds->ymax = latmax;
-
-	/* Each geohash character (base32) can contain 5 bits of information.
-	** We are returning the precision in characters, so here we divide. */
-	return precision / 5;
+  double minx, miny, maxx, maxy;
+  double latmax, latmin, lonmax, lonmin;
+  double lonwidth, latwidth;
+  double latmaxadjust, lonmaxadjust, latminadjust, lonminadjust;
+  int precision = 0;
+
+  /* Get the bounding box, return error if things don't work out. */
+  minx = bbox.xmin;
+  miny = bbox.ymin;
+  maxx = bbox.xmax;
+  maxy = bbox.ymax;
+
+  if ( minx == maxx && miny == maxy )
+  {
+    /* It's a point. Doubles have 51 bits of precision.
+    ** 2 * 51 / 5 == 20 */
+    return 20;
+  }
+
+  lonmin = -180.0;
+  latmin = -90.0;
+  lonmax = 180.0;
+  latmax = 90.0;
+
+  /* Shrink a world bounding box until one of the edges interferes with the
+  ** bounds of our rectangle. */
+  while ( 1 )
+  {
+    lonwidth = lonmax - lonmin;
+    latwidth = latmax - latmin;
+    latmaxadjust = lonmaxadjust = latminadjust = lonminadjust = 0.0;
+
+    if ( minx > lonmin + lonwidth / 2.0 )
+    {
+      lonminadjust = lonwidth / 2.0;
+    }
+    else if ( maxx < lonmax - lonwidth / 2.0 )
+    {
+      lonmaxadjust = -1 * lonwidth / 2.0;
+    }
+    if ( miny > latmin + latwidth / 2.0 )
+    {
+      latminadjust = latwidth / 2.0;
+    }
+    else if (maxy < latmax - latwidth / 2.0 )
+    {
+      latmaxadjust = -1 * latwidth / 2.0;
+    }
+    /* Only adjust if adjustments are legal (we haven't crossed any edges). */
+    if ( (lonminadjust || lonmaxadjust) && (latminadjust || latmaxadjust ) )
+    {
+      latmin += latminadjust;
+      lonmin += lonminadjust;
+      latmax += latmaxadjust;
+      lonmax += lonmaxadjust;
+      /* Each adjustment cycle corresponds to 2 bits of storage in the
+      ** geohash.  */
+      precision += 2;
+    }
+    else
+    {
+      break;
+    }
+  }
+
+  /* Save the edges of our bounds, in case someone cares later. */
+  bounds->xmin = lonmin;
+  bounds->xmax = lonmax;
+  bounds->ymin = latmin;
+  bounds->ymax = latmax;
+
+  /* Each geohash character (base32) can contain 5 bits of information.
+  ** We are returning the precision in characters, so here we divide. */
+  return precision / 5;
 }
 
 
@@ -841,42 +841,42 @@ int rtgeom_geohash_precision(const RTCTX *ctx, RTGBOX bbox, RTGBOX *bounds)
 */
 char * rtgeom_geohash(const RTCTX *ctx, const RTGEOM *rtgeom, int precision)
 {
-	RTGBOX gbox;
-	RTGBOX gbox_bounds;
-	double lat, lon;
-	int result;
-
-	gbox_init(ctx, &gbox);
-	gbox_init(ctx, &gbox_bounds);
-
-	result = rtgeom_calculate_gbox_cartesian(ctx, rtgeom, &gbox);	
-	if ( result == RT_FAILURE ) return NULL;
-
-	/* Return error if we are being fed something outside our working bounds */
-	if ( gbox.xmin < -180 || gbox.ymin < -90 || gbox.xmax > 180 || gbox.ymax > 90 )
-	{
-		rterror(ctx, "Geohash requires inputs in decimal degrees, got (%g %g, %g %g).",
-			 gbox.xmin, gbox.ymin,
-			 gbox.xmax, gbox.ymax);
-		return NULL;
-	}
-
-	/* What is the center of our geometry bounds? We'll use that to
-	** approximate location. */
-	lon = gbox.xmin + (gbox.xmax - gbox.xmin) / 2;
-	lat = gbox.ymin + (gbox.ymax - gbox.ymin) / 2;
-
-	if ( precision <= 0 )
-	{
-		precision = rtgeom_geohash_precision(ctx, gbox, &gbox_bounds);
-	}
-
-	/*
-	** Return the geohash of the center, with a precision determined by the
-	** extent of the bounds.
-	** Possible change: return the point at the center of the precision bounds?
-	*/
-	return geohash_point(ctx, lon, lat, precision);
+  RTGBOX gbox;
+  RTGBOX gbox_bounds;
+  double lat, lon;
+  int result;
+
+  gbox_init(ctx, &gbox);
+  gbox_init(ctx, &gbox_bounds);
+
+  result = rtgeom_calculate_gbox_cartesian(ctx, rtgeom, &gbox);
+  if ( result == RT_FAILURE ) return NULL;
+
+  /* Return error if we are being fed something outside our working bounds */
+  if ( gbox.xmin < -180 || gbox.ymin < -90 || gbox.xmax > 180 || gbox.ymax > 90 )
+  {
+    rterror(ctx, "Geohash requires inputs in decimal degrees, got (%g %g, %g %g).",
+       gbox.xmin, gbox.ymin,
+       gbox.xmax, gbox.ymax);
+    return NULL;
+  }
+
+  /* What is the center of our geometry bounds? We'll use that to
+  ** approximate location. */
+  lon = gbox.xmin + (gbox.xmax - gbox.xmin) / 2;
+  lat = gbox.ymin + (gbox.ymax - gbox.ymin) / 2;
+
+  if ( precision <= 0 )
+  {
+    precision = rtgeom_geohash_precision(ctx, gbox, &gbox_bounds);
+  }
+
+  /*
+  ** Return the geohash of the center, with a precision determined by the
+  ** extent of the bounds.
+  ** Possible change: return the point at the center of the precision bounds?
+  */
+  return geohash_point(ctx, lon, lat, precision);
 }
 
 
diff --git a/src/rtcircstring.c b/src/rtcircstring.c
index 172344c..6896661 100644
--- a/src/rtcircstring.c
+++ b/src/rtcircstring.c
@@ -51,94 +51,94 @@ void rtcircstring_setPoint4d(const RTCTX *ctx, RTCIRCSTRING *curve, uint32_t ind
 RTCIRCSTRING *
 rtcircstring_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points)
 {
-	RTCIRCSTRING *result;
-
-	/*
-	* The first arc requires three points.  Each additional
-	* arc requires two more points.  Thus the minimum point count
-	* is three, and the count must be odd.
-	*/
-	if (points->npoints % 2 != 1 || points->npoints < 3)
-	{
-		rtnotice(ctx, "rtcircstring_construct: invalid point count %d", points->npoints);
-	}
-
-	result = (RTCIRCSTRING*) rtalloc(ctx, sizeof(RTCIRCSTRING));
-
-	result->type = RTCIRCSTRINGTYPE;
-	
-	result->flags = points->flags;
-	RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
-
-	result->srid = srid;
-	result->points = points;
-	result->bbox = bbox;
-
-	return result;
+  RTCIRCSTRING *result;
+
+  /*
+  * The first arc requires three points.  Each additional
+  * arc requires two more points.  Thus the minimum point count
+  * is three, and the count must be odd.
+  */
+  if (points->npoints % 2 != 1 || points->npoints < 3)
+  {
+    rtnotice(ctx, "rtcircstring_construct: invalid point count %d", points->npoints);
+  }
+
+  result = (RTCIRCSTRING*) rtalloc(ctx, sizeof(RTCIRCSTRING));
+
+  result->type = RTCIRCSTRINGTYPE;
+
+  result->flags = points->flags;
+  RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
+
+  result->srid = srid;
+  result->points = points;
+  result->bbox = bbox;
+
+  return result;
 }
 
 RTCIRCSTRING *
 rtcircstring_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTCIRCSTRING *result = rtalloc(ctx, sizeof(RTCIRCSTRING));
-	result->type = RTCIRCSTRINGTYPE;
-	result->flags = gflags(ctx, hasz,hasm,0);
-	result->srid = srid;
-	result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
-	result->bbox = NULL;
-	return result;
+  RTCIRCSTRING *result = rtalloc(ctx, sizeof(RTCIRCSTRING));
+  result->type = RTCIRCSTRINGTYPE;
+  result->flags = gflags(ctx, hasz,hasm,0);
+  result->srid = srid;
+  result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
+  result->bbox = NULL;
+  return result;
 }
 
 void
 rtcircstring_release(const RTCTX *ctx, RTCIRCSTRING *rtcirc)
 {
-	rtgeom_release(ctx, rtcircstring_as_rtgeom(ctx, rtcirc));
+  rtgeom_release(ctx, rtcircstring_as_rtgeom(ctx, rtcirc));
 }
 
 
 void rtcircstring_free(const RTCTX *ctx, RTCIRCSTRING *curve)
 {
-	if ( ! curve ) return;
-	
-	if ( curve->bbox )
-		rtfree(ctx, curve->bbox);
-	if ( curve->points )
-		ptarray_free(ctx, curve->points);
-	rtfree(ctx, curve);
+  if ( ! curve ) return;
+
+  if ( curve->bbox )
+    rtfree(ctx, curve->bbox);
+  if ( curve->points )
+    ptarray_free(ctx, curve->points);
+  rtfree(ctx, curve);
 }
 
 
 
 void printRTCIRCSTRING(const RTCTX *ctx, RTCIRCSTRING *curve)
 {
-	rtnotice(ctx, "RTCIRCSTRING {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(curve->flags));
-	rtnotice(ctx, "    srid = %i", (int)curve->srid);
-	printPA(ctx, curve->points);
-	rtnotice(ctx, "}");
+  rtnotice(ctx, "RTCIRCSTRING {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(curve->flags));
+  rtnotice(ctx, "    srid = %i", (int)curve->srid);
+  printPA(ctx, curve->points);
+  rtnotice(ctx, "}");
 }
 
 /* @brief Clone RTCIRCSTRING object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTCIRCSTRING *
 rtcircstring_clone(const RTCTX *ctx, const RTCIRCSTRING *g)
 {
-	return (RTCIRCSTRING *)rtline_clone(ctx, (RTLINE *)g);
+  return (RTCIRCSTRING *)rtline_clone(ctx, (RTLINE *)g);
 }
 
 
 void rtcircstring_reverse(const RTCTX *ctx, RTCIRCSTRING *curve)
 {
-	ptarray_reverse(ctx, curve->points);
+  ptarray_reverse(ctx, curve->points);
 }
 
 /* check coordinate equality */
 char
 rtcircstring_same(const RTCTX *ctx, const RTCIRCSTRING *me, const RTCIRCSTRING *you)
 {
-	return ptarray_same(ctx, me->points, you->points);
+  return ptarray_same(ctx, me->points, you->points);
 }
 
 /*
@@ -148,49 +148,49 @@ rtcircstring_same(const RTCTX *ctx, const RTCIRCSTRING *me, const RTCIRCSTRING *
 RTCIRCSTRING *
 rtcircstring_from_rtpointarray(const RTCTX *ctx, int srid, uint32_t npoints, RTPOINT **points)
 {
-	int zmflag=0;
-	uint32_t i;
-	RTPOINTARRAY *pa;
-	uint8_t *newpoints, *ptr;
-	size_t ptsize, size;
-
-	/*
-	 * Find output dimensions, check integrity
-	 */
-	for (i = 0; i < npoints; i++)
-	{
-		if (points[i]->type != RTPOINTTYPE)
-		{
-			rterror(ctx, "rtcurve_from_rtpointarray: invalid input type: %s",
-			        rttype_name(ctx, points[i]->type));
-			return NULL;
-		}
-		if (RTFLAGS_GET_Z(points[i]->flags)) zmflag |= 2;
-		if (RTFLAGS_GET_M(points[i]->flags)) zmflag |= 1;
-		if (zmflag == 3) break;
-	}
-
-	if (zmflag == 0) ptsize = 2 * sizeof(double);
-	else if (zmflag == 3) ptsize = 4 * sizeof(double);
-	else ptsize = 3 * sizeof(double);
-
-	/*
-	 * Allocate output points array
-	 */
-	size = ptsize * npoints;
-	newpoints = rtalloc(ctx, size);
-	memset(newpoints, 0, size);
-
-	ptr = newpoints;
-	for (i = 0; i < npoints; i++)
-	{
-		size = ptarray_point_size(ctx, points[i]->point);
-		memcpy(ptr, rt_getPoint_internal(ctx, points[i]->point, 0), size);
-		ptr += ptsize;
-	}
-	pa = ptarray_construct_reference_data(ctx, zmflag&2, zmflag&1, npoints, newpoints);
-	
-	return rtcircstring_construct(ctx, srid, NULL, pa);
+  int zmflag=0;
+  uint32_t i;
+  RTPOINTARRAY *pa;
+  uint8_t *newpoints, *ptr;
+  size_t ptsize, size;
+
+  /*
+   * Find output dimensions, check integrity
+   */
+  for (i = 0; i < npoints; i++)
+  {
+    if (points[i]->type != RTPOINTTYPE)
+    {
+      rterror(ctx, "rtcurve_from_rtpointarray: invalid input type: %s",
+              rttype_name(ctx, points[i]->type));
+      return NULL;
+    }
+    if (RTFLAGS_GET_Z(points[i]->flags)) zmflag |= 2;
+    if (RTFLAGS_GET_M(points[i]->flags)) zmflag |= 1;
+    if (zmflag == 3) break;
+  }
+
+  if (zmflag == 0) ptsize = 2 * sizeof(double);
+  else if (zmflag == 3) ptsize = 4 * sizeof(double);
+  else ptsize = 3 * sizeof(double);
+
+  /*
+   * Allocate output points array
+   */
+  size = ptsize * npoints;
+  newpoints = rtalloc(ctx, size);
+  memset(newpoints, 0, size);
+
+  ptr = newpoints;
+  for (i = 0; i < npoints; i++)
+  {
+    size = ptarray_point_size(ctx, points[i]->point);
+    memcpy(ptr, rt_getPoint_internal(ctx, points[i]->point, 0), size);
+    ptr += ptsize;
+  }
+  pa = ptarray_construct_reference_data(ctx, zmflag&2, zmflag&1, npoints, newpoints);
+
+  return rtcircstring_construct(ctx, srid, NULL, pa);
 }
 
 /*
@@ -199,61 +199,61 @@ rtcircstring_from_rtpointarray(const RTCTX *ctx, int srid, uint32_t npoints, RTP
 RTCIRCSTRING *
 rtcircstring_from_rtmpoint(const RTCTX *ctx, int srid, RTMPOINT *mpoint)
 {
-	uint32_t i;
-	RTPOINTARRAY *pa;
-	char zmflag = RTFLAGS_GET_ZM(mpoint->flags);
-	size_t ptsize, size;
-	uint8_t *newpoints, *ptr;
-
-	if (zmflag == 0) ptsize = 2 * sizeof(double);
-	else if (zmflag == 3) ptsize = 4 * sizeof(double);
-	else ptsize = 3 * sizeof(double);
-
-	/* Allocate space for output points */
-	size = ptsize * mpoint->ngeoms;
-	newpoints = rtalloc(ctx, size);
-	memset(newpoints, 0, size);
-
-	ptr = newpoints;
-	for (i = 0; i < mpoint->ngeoms; i++)
-	{
-		memcpy(ptr,
-		       rt_getPoint_internal(ctx, mpoint->geoms[i]->point, 0),
-		       ptsize);
-		ptr += ptsize;
-	}
-
-	pa = ptarray_construct_reference_data(ctx, zmflag&2, zmflag&1, mpoint->ngeoms, newpoints);
-	
-	RTDEBUGF(3, "rtcurve_from_rtmpoint: constructed pointarray for %d points, %d zmflag", mpoint->ngeoms, zmflag);
-
-	return rtcircstring_construct(ctx, srid, NULL, pa);
+  uint32_t i;
+  RTPOINTARRAY *pa;
+  char zmflag = RTFLAGS_GET_ZM(mpoint->flags);
+  size_t ptsize, size;
+  uint8_t *newpoints, *ptr;
+
+  if (zmflag == 0) ptsize = 2 * sizeof(double);
+  else if (zmflag == 3) ptsize = 4 * sizeof(double);
+  else ptsize = 3 * sizeof(double);
+
+  /* Allocate space for output points */
+  size = ptsize * mpoint->ngeoms;
+  newpoints = rtalloc(ctx, size);
+  memset(newpoints, 0, size);
+
+  ptr = newpoints;
+  for (i = 0; i < mpoint->ngeoms; i++)
+  {
+    memcpy(ptr,
+           rt_getPoint_internal(ctx, mpoint->geoms[i]->point, 0),
+           ptsize);
+    ptr += ptsize;
+  }
+
+  pa = ptarray_construct_reference_data(ctx, zmflag&2, zmflag&1, mpoint->ngeoms, newpoints);
+
+  RTDEBUGF(3, "rtcurve_from_rtmpoint: constructed pointarray for %d points, %d zmflag", mpoint->ngeoms, zmflag);
+
+  return rtcircstring_construct(ctx, srid, NULL, pa);
 }
 
 RTCIRCSTRING *
 rtcircstring_addpoint(const RTCTX *ctx, RTCIRCSTRING *curve, RTPOINT *point, uint32_t where)
 {
-	RTPOINTARRAY *newpa;
-	RTCIRCSTRING *ret;
+  RTPOINTARRAY *newpa;
+  RTCIRCSTRING *ret;
 
-	newpa = ptarray_addPoint(ctx, curve->points,
-	                         rt_getPoint_internal(ctx, point->point, 0),
-	                         RTFLAGS_NDIMS(point->flags), where);
-	ret = rtcircstring_construct(ctx, curve->srid, NULL, newpa);
+  newpa = ptarray_addPoint(ctx, curve->points,
+                           rt_getPoint_internal(ctx, point->point, 0),
+                           RTFLAGS_NDIMS(point->flags), where);
+  ret = rtcircstring_construct(ctx, curve->srid, NULL, newpa);
 
-	return ret;
+  return ret;
 }
 
 RTCIRCSTRING *
 rtcircstring_removepoint(const RTCTX *ctx, RTCIRCSTRING *curve, uint32_t index)
 {
-	RTPOINTARRAY *newpa;
-	RTCIRCSTRING *ret;
+  RTPOINTARRAY *newpa;
+  RTCIRCSTRING *ret;
 
-	newpa = ptarray_removePoint(ctx, curve->points, index);
-	ret = rtcircstring_construct(ctx, curve->srid, NULL, newpa);
+  newpa = ptarray_removePoint(ctx, curve->points, index);
+  ret = rtcircstring_construct(ctx, curve->srid, NULL, newpa);
 
-	return ret;
+  return ret;
 }
 
 /*
@@ -262,36 +262,36 @@ rtcircstring_removepoint(const RTCTX *ctx, RTCIRCSTRING *curve, uint32_t index)
 void
 rtcircstring_setPoint4d(const RTCTX *ctx, RTCIRCSTRING *curve, uint32_t index, RTPOINT4D *newpoint)
 {
-	ptarray_set_point4d(ctx, curve->points, index, newpoint);
+  ptarray_set_point4d(ctx, curve->points, index, newpoint);
 }
 
 int
 rtcircstring_is_closed(const RTCTX *ctx, const RTCIRCSTRING *curve)
 {
-	if (RTFLAGS_GET_Z(curve->flags))
-		return ptarray_is_closed_3d(ctx, curve->points);
+  if (RTFLAGS_GET_Z(curve->flags))
+    return ptarray_is_closed_3d(ctx, curve->points);
 
-	return ptarray_is_closed_2d(ctx, curve->points);
+  return ptarray_is_closed_2d(ctx, curve->points);
 }
 
 int rtcircstring_is_empty(const RTCTX *ctx, const RTCIRCSTRING *circ)
 {
-	if ( !circ->points || circ->points->npoints < 1 )
-		return RT_TRUE;
-	return RT_FALSE;
+  if ( !circ->points || circ->points->npoints < 1 )
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 double rtcircstring_length(const RTCTX *ctx, const RTCIRCSTRING *circ)
 {
-	return rtcircstring_length_2d(ctx, circ);
+  return rtcircstring_length_2d(ctx, circ);
 }
 
 double rtcircstring_length_2d(const RTCTX *ctx, const RTCIRCSTRING *circ)
 {
-	if ( rtcircstring_is_empty(ctx, circ) )
-		return 0.0;
-	
-	return ptarray_arc_length_2d(ctx, circ->points);
+  if ( rtcircstring_is_empty(ctx, circ) )
+    return 0.0;
+
+  return ptarray_arc_length_2d(ctx, circ->points);
 }
 
 /*
@@ -299,36 +299,36 @@ double rtcircstring_length_2d(const RTCTX *ctx, const RTCIRCSTRING *circ)
  * Returns NULL if the geometry is empty or the index invalid.
  */
 RTPOINT* rtcircstring_get_rtpoint(const RTCTX *ctx, const RTCIRCSTRING *circ, int where) {
-	RTPOINT4D pt;
-	RTPOINT *rtpoint;
-	RTPOINTARRAY *pa;
-
-	if ( rtcircstring_is_empty(ctx, circ) || where < 0 || where >= circ->points->npoints )
-		return NULL;
-
-	pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(circ->flags), RTFLAGS_GET_M(circ->flags), 1);
-	pt = rt_getPoint4d(ctx, circ->points, where);
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
-	rtpoint = rtpoint_construct(ctx, circ->srid, NULL, pa);
-	return rtpoint;
+  RTPOINT4D pt;
+  RTPOINT *rtpoint;
+  RTPOINTARRAY *pa;
+
+  if ( rtcircstring_is_empty(ctx, circ) || where < 0 || where >= circ->points->npoints )
+    return NULL;
+
+  pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(circ->flags), RTFLAGS_GET_M(circ->flags), 1);
+  pt = rt_getPoint4d(ctx, circ->points, where);
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  rtpoint = rtpoint_construct(ctx, circ->srid, NULL, pa);
+  return rtpoint;
 }
 
 /*
-* Snap to grid 
+* Snap to grid
 */
 RTCIRCSTRING* rtcircstring_grid(const RTCTX *ctx, const RTCIRCSTRING *line, const gridspec *grid)
 {
-	RTCIRCSTRING *oline;
-	RTPOINTARRAY *opa;
+  RTCIRCSTRING *oline;
+  RTPOINTARRAY *opa;
 
-	opa = ptarray_grid(ctx, line->points, grid);
+  opa = ptarray_grid(ctx, line->points, grid);
 
-	/* Skip line3d with less then 2 points */
-	if ( opa->npoints < 2 ) return NULL;
+  /* Skip line3d with less then 2 points */
+  if ( opa->npoints < 2 ) return NULL;
 
-	/* TODO: grid bounding box... */
-	oline = rtcircstring_construct(ctx, line->srid, NULL, opa);
+  /* TODO: grid bounding box... */
+  oline = rtcircstring_construct(ctx, line->srid, NULL, opa);
 
-	return oline;
+  return oline;
 }
 
diff --git a/src/rtcollection.c b/src/rtcollection.c
index c57a1cc..1bff21d 100644
--- a/src/rtcollection.c
+++ b/src/rtcollection.c
@@ -36,7 +36,7 @@
 void
 rtcollection_release(const RTCTX *ctx, RTCOLLECTION *rtcollection)
 {
-	rtgeom_release(ctx, rtcollection_as_rtgeom(ctx, rtcollection));
+  rtgeom_release(ctx, rtcollection_as_rtgeom(ctx, rtcollection));
 }
 
 
@@ -44,103 +44,103 @@ RTCOLLECTION *
 rtcollection_construct(const RTCTX *ctx, uint8_t type, int srid, RTGBOX *bbox,
                        uint32_t ngeoms, RTGEOM **geoms)
 {
-	RTCOLLECTION *ret;
-	int hasz, hasm;
+  RTCOLLECTION *ret;
+  int hasz, hasm;
 #ifdef CHECK_RTGEOM_ZM
-	char zm;
-	uint32_t i;
+  char zm;
+  uint32_t i;
 #endif
 
-	RTDEBUGF(2, "rtcollection_construct called with %d, %d, %p, %d, %p.", type, srid, bbox, ngeoms, geoms);
+  RTDEBUGF(2, "rtcollection_construct called with %d, %d, %p, %d, %p.", type, srid, bbox, ngeoms, geoms);
 
-	if( ! rttype_is_collection(ctx, type) )
-		rterror(ctx, "Non-collection type specified in collection constructor!");
+  if( ! rttype_is_collection(ctx, type) )
+    rterror(ctx, "Non-collection type specified in collection constructor!");
 
-	hasz = 0;
-	hasm = 0;
-	if ( ngeoms > 0 )
-	{
-		hasz = RTFLAGS_GET_Z(geoms[0]->flags);
-		hasm = RTFLAGS_GET_M(geoms[0]->flags);
+  hasz = 0;
+  hasm = 0;
+  if ( ngeoms > 0 )
+  {
+    hasz = RTFLAGS_GET_Z(geoms[0]->flags);
+    hasm = RTFLAGS_GET_M(geoms[0]->flags);
 #ifdef CHECK_RTGEOM_ZM
-		zm = RTFLAGS_GET_ZM(geoms[0]->flags);
+    zm = RTFLAGS_GET_ZM(geoms[0]->flags);
 
-		RTDEBUGF(3, "rtcollection_construct type[0]=%d", geoms[0]->type);
+    RTDEBUGF(3, "rtcollection_construct type[0]=%d", geoms[0]->type);
 
-		for (i=1; i<ngeoms; i++)
-		{
-			RTDEBUGF(3, "rtcollection_construct type=[%d]=%d", i, geoms[i]->type);
+    for (i=1; i<ngeoms; i++)
+    {
+      RTDEBUGF(3, "rtcollection_construct type=[%d]=%d", i, geoms[i]->type);
 
-			if ( zm != RTFLAGS_GET_ZM(geoms[i]->flags) )
-				rterror(ctx, "rtcollection_construct: mixed dimension geometries: %d/%d", zm, RTFLAGS_GET_ZM(geoms[i]->flags));
-		}
+      if ( zm != RTFLAGS_GET_ZM(geoms[i]->flags) )
+        rterror(ctx, "rtcollection_construct: mixed dimension geometries: %d/%d", zm, RTFLAGS_GET_ZM(geoms[i]->flags));
+    }
 #endif
-	}
+  }
 
 
-	ret = rtalloc(ctx, sizeof(RTCOLLECTION));
-	ret->type = type;
-	ret->flags = gflags(ctx, hasz,hasm,0);
-	RTFLAGS_SET_BBOX(ret->flags, bbox?1:0);
-	ret->srid = srid;
-	ret->ngeoms = ngeoms;
-	ret->maxgeoms = ngeoms;
-	ret->geoms = geoms;
-	ret->bbox = bbox;
+  ret = rtalloc(ctx, sizeof(RTCOLLECTION));
+  ret->type = type;
+  ret->flags = gflags(ctx, hasz,hasm,0);
+  RTFLAGS_SET_BBOX(ret->flags, bbox?1:0);
+  ret->srid = srid;
+  ret->ngeoms = ngeoms;
+  ret->maxgeoms = ngeoms;
+  ret->geoms = geoms;
+  ret->bbox = bbox;
 
-	return ret;
+  return ret;
 }
 
 RTCOLLECTION *
 rtcollection_construct_empty(const RTCTX *ctx, uint8_t type, int srid, char hasz, char hasm)
 {
-	RTCOLLECTION *ret;
-	if( ! rttype_is_collection(ctx, type) )
-		rterror(ctx, "Non-collection type specified in collection constructor!");
-
-	ret = rtalloc(ctx, sizeof(RTCOLLECTION));
-	ret->type = type;
-	ret->flags = gflags(ctx, hasz,hasm,0);
-	ret->srid = srid;
-	ret->ngeoms = 0;
-	ret->maxgeoms = 1; /* Allocate room for sub-members, just in case. */
-	ret->geoms = rtalloc(ctx, ret->maxgeoms * sizeof(RTGEOM*));
-	ret->bbox = NULL;
-
-	return ret;
+  RTCOLLECTION *ret;
+  if( ! rttype_is_collection(ctx, type) )
+    rterror(ctx, "Non-collection type specified in collection constructor!");
+
+  ret = rtalloc(ctx, sizeof(RTCOLLECTION));
+  ret->type = type;
+  ret->flags = gflags(ctx, hasz,hasm,0);
+  ret->srid = srid;
+  ret->ngeoms = 0;
+  ret->maxgeoms = 1; /* Allocate room for sub-members, just in case. */
+  ret->geoms = rtalloc(ctx, ret->maxgeoms * sizeof(RTGEOM*));
+  ret->bbox = NULL;
+
+  return ret;
 }
 
 RTGEOM *
 rtcollection_getsubgeom(const RTCTX *ctx, RTCOLLECTION *col, int gnum)
 {
-	return (RTGEOM *)col->geoms[gnum];
+  return (RTGEOM *)col->geoms[gnum];
 }
 
 /**
  * @brief Clone #RTCOLLECTION object. #RTPOINTARRAY are not copied.
- * 			Bbox is cloned if present in input.
+ *       Bbox is cloned if present in input.
  */
 RTCOLLECTION *
 rtcollection_clone(const RTCTX *ctx, const RTCOLLECTION *g)
 {
-	uint32_t i;
-	RTCOLLECTION *ret = rtalloc(ctx, sizeof(RTCOLLECTION));
-	memcpy(ret, g, sizeof(RTCOLLECTION));
-	if ( g->ngeoms > 0 )
-	{
-		ret->geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
-		for (i=0; i<g->ngeoms; i++)
-		{
-			ret->geoms[i] = rtgeom_clone(ctx, g->geoms[i]);
-		}
-		if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	}
-	else
-	{
-		ret->bbox = NULL; /* empty collection */
-		ret->geoms = NULL;
-	}
-	return ret;
+  uint32_t i;
+  RTCOLLECTION *ret = rtalloc(ctx, sizeof(RTCOLLECTION));
+  memcpy(ret, g, sizeof(RTCOLLECTION));
+  if ( g->ngeoms > 0 )
+  {
+    ret->geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
+    for (i=0; i<g->ngeoms; i++)
+    {
+      ret->geoms[i] = rtgeom_clone(ctx, g->geoms[i]);
+    }
+    if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  }
+  else
+  {
+    ret->bbox = NULL; /* empty collection */
+    ret->geoms = NULL;
+  }
+  return ret;
 }
 
 /**
@@ -149,24 +149,24 @@ rtcollection_clone(const RTCTX *ctx, const RTCOLLECTION *g)
 RTCOLLECTION *
 rtcollection_clone_deep(const RTCTX *ctx, const RTCOLLECTION *g)
 {
-	uint32_t i;
-	RTCOLLECTION *ret = rtalloc(ctx, sizeof(RTCOLLECTION));
-	memcpy(ret, g, sizeof(RTCOLLECTION));
-	if ( g->ngeoms > 0 )
-	{
-		ret->geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
-		for (i=0; i<g->ngeoms; i++)
-		{
-			ret->geoms[i] = rtgeom_clone_deep(ctx, g->geoms[i]);
-		}
-		if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	}
-	else
-	{
-		ret->bbox = NULL; /* empty collection */
-		ret->geoms = NULL;
-	}
-	return ret;
+  uint32_t i;
+  RTCOLLECTION *ret = rtalloc(ctx, sizeof(RTCOLLECTION));
+  memcpy(ret, g, sizeof(RTCOLLECTION));
+  if ( g->ngeoms > 0 )
+  {
+    ret->geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
+    for (i=0; i<g->ngeoms; i++)
+    {
+      ret->geoms[i] = rtgeom_clone_deep(ctx, g->geoms[i]);
+    }
+    if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  }
+  else
+  {
+    ret->bbox = NULL; /* empty collection */
+    ret->geoms = NULL;
+  }
+  return ret;
 }
 
 /**
@@ -174,11 +174,11 @@ rtcollection_clone_deep(const RTCTX *ctx, const RTCOLLECTION *g)
  */
 void rtcollection_reserve(const RTCTX *ctx, RTCOLLECTION *col, int ngeoms)
 {
-	if ( ngeoms <= col->maxgeoms ) return;
+  if ( ngeoms <= col->maxgeoms ) return;
 
-	/* Allocate more space if we need it */
-	do { col->maxgeoms *= 2; } while ( col->maxgeoms < ngeoms );
-	col->geoms = rtrealloc(ctx, col->geoms, sizeof(RTGEOM*) * col->maxgeoms);
+  /* Allocate more space if we need it */
+  do { col->maxgeoms *= 2; } while ( col->maxgeoms < ngeoms );
+  col->geoms = rtrealloc(ctx, col->geoms, sizeof(RTGEOM*) * col->maxgeoms);
 }
 
 /**
@@ -187,72 +187,72 @@ void rtcollection_reserve(const RTCTX *ctx, RTCOLLECTION *col, int ngeoms)
 */
 RTCOLLECTION* rtcollection_add_rtgeom(const RTCTX *ctx, RTCOLLECTION *col, const RTGEOM *geom)
 {
-	if ( col == NULL || geom == NULL ) return NULL;
-
-	if ( col->geoms == NULL && (col->ngeoms || col->maxgeoms) ) {
-		rterror(ctx, "Collection is in inconsistent state. Null memory but non-zero collection counts.");
-		return NULL;
-	}
-
-	/* Check type compatibility */
-	if ( ! rtcollection_allows_subtype(ctx, col->type, geom->type) ) {
-		rterror(ctx, "%s cannot contain %s element", rttype_name(ctx, col->type), rttype_name(ctx, geom->type));
-		return NULL;
-	}
-
-	/* In case this is a truly empty, make some initial space  */
-	if ( col->geoms == NULL )
-	{
-		col->maxgeoms = 2;
-		col->ngeoms = 0;
-		col->geoms = rtalloc(ctx, col->maxgeoms * sizeof(RTGEOM*));
-	}
-
-	/* Allocate more space if we need it */
-	rtcollection_reserve(ctx, col, col->ngeoms + 1);
+  if ( col == NULL || geom == NULL ) return NULL;
+
+  if ( col->geoms == NULL && (col->ngeoms || col->maxgeoms) ) {
+    rterror(ctx, "Collection is in inconsistent state. Null memory but non-zero collection counts.");
+    return NULL;
+  }
+
+  /* Check type compatibility */
+  if ( ! rtcollection_allows_subtype(ctx, col->type, geom->type) ) {
+    rterror(ctx, "%s cannot contain %s element", rttype_name(ctx, col->type), rttype_name(ctx, geom->type));
+    return NULL;
+  }
+
+  /* In case this is a truly empty, make some initial space  */
+  if ( col->geoms == NULL )
+  {
+    col->maxgeoms = 2;
+    col->ngeoms = 0;
+    col->geoms = rtalloc(ctx, col->maxgeoms * sizeof(RTGEOM*));
+  }
+
+  /* Allocate more space if we need it */
+  rtcollection_reserve(ctx, col, col->ngeoms + 1);
 
 #if PARANOIA_LEVEL > 1
-	/* See http://trac.osgeo.org/postgis/ticket/2933 */
-	/* Make sure we don't already have a reference to this geom */
-	{
-	int i = 0;
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		if ( col->geoms[i] == geom )
-		{
-			RTDEBUGF(4, "Found duplicate geometry in collection %p == %p", col->geoms[i], geom);
-			return col;
-		}
-	}
-	}
+  /* See http://trac.osgeo.org/postgis/ticket/2933 */
+  /* Make sure we don't already have a reference to this geom */
+  {
+  int i = 0;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    if ( col->geoms[i] == geom )
+    {
+      RTDEBUGF(4, "Found duplicate geometry in collection %p == %p", col->geoms[i], geom);
+      return col;
+    }
+  }
+  }
 #endif
 
-	col->geoms[col->ngeoms] = (RTGEOM*)geom;
-	col->ngeoms++;
-	return col;
+  col->geoms[col->ngeoms] = (RTGEOM*)geom;
+  col->ngeoms++;
+  return col;
 }
 
 
 RTCOLLECTION *
 rtcollection_segmentize2d(const RTCTX *ctx, RTCOLLECTION *col, double dist)
 {
-	uint32_t i;
-	RTGEOM **newgeoms;
-
-	if ( ! col->ngeoms ) return rtcollection_clone(ctx, col);
-
-	newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*col->ngeoms);
-	for (i=0; i<col->ngeoms; i++)
-	{
-		newgeoms[i] = rtgeom_segmentize2d(ctx, col->geoms[i], dist);
-		if ( ! newgeoms[i] ) {
-			while (i--) rtgeom_free(ctx, newgeoms[i]);
-			rtfree(ctx, newgeoms);
-			return NULL;
-		}
-	}
-
-	return rtcollection_construct(ctx, col->type, col->srid, NULL, col->ngeoms, newgeoms);
+  uint32_t i;
+  RTGEOM **newgeoms;
+
+  if ( ! col->ngeoms ) return rtcollection_clone(ctx, col);
+
+  newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*col->ngeoms);
+  for (i=0; i<col->ngeoms; i++)
+  {
+    newgeoms[i] = rtgeom_segmentize2d(ctx, col->geoms[i], dist);
+    if ( ! newgeoms[i] ) {
+      while (i--) rtgeom_free(ctx, newgeoms[i]);
+      rtfree(ctx, newgeoms);
+      return NULL;
+    }
+  }
+
+  return rtcollection_construct(ctx, col->type, col->srid, NULL, col->ngeoms, newgeoms);
 }
 
 /** @brief check for same geometry composition
@@ -261,102 +261,102 @@ rtcollection_segmentize2d(const RTCTX *ctx, RTCOLLECTION *col, double dist)
 char
 rtcollection_same(const RTCTX *ctx, const RTCOLLECTION *c1, const RTCOLLECTION *c2)
 {
-	uint32_t i;
-
-	RTDEBUG(2, "rtcollection_same called");
-
-	if ( c1->type != c2->type ) return RT_FALSE;
-	if ( c1->ngeoms != c2->ngeoms ) return RT_FALSE;
-
-	for ( i = 0; i < c1->ngeoms; i++ )
-	{
-		if ( ! rtgeom_same(ctx, c1->geoms[i], c2->geoms[i]) )
-			return RT_FALSE;
-	}
-
-	/* Former method allowed out-of-order equality between collections
-
-		hit = rtalloc(ctx, sizeof(uint32_t)*c1->ngeoms);
-		memset(hit, 0, sizeof(uint32_t)*c1->ngeoms);
-
-		for (i=0; i<c1->ngeoms; i++)
-		{
-			char found=0;
-			for (j=0; j<c2->ngeoms; j++)
-			{
-				if ( hit[j] ) continue;
-				if ( rtgeom_same(ctx, c1->geoms[i], c2->geoms[j]) )
-				{
-					hit[j] = 1;
-					found=1;
-					break;
-				}
-			}
-			if ( ! found ) return RT_FALSE;
-		}
-	*/
-
-	return RT_TRUE;
+  uint32_t i;
+
+  RTDEBUG(2, "rtcollection_same called");
+
+  if ( c1->type != c2->type ) return RT_FALSE;
+  if ( c1->ngeoms != c2->ngeoms ) return RT_FALSE;
+
+  for ( i = 0; i < c1->ngeoms; i++ )
+  {
+    if ( ! rtgeom_same(ctx, c1->geoms[i], c2->geoms[i]) )
+      return RT_FALSE;
+  }
+
+  /* Former method allowed out-of-order equality between collections
+
+    hit = rtalloc(ctx, sizeof(uint32_t)*c1->ngeoms);
+    memset(hit, 0, sizeof(uint32_t)*c1->ngeoms);
+
+    for (i=0; i<c1->ngeoms; i++)
+    {
+      char found=0;
+      for (j=0; j<c2->ngeoms; j++)
+      {
+        if ( hit[j] ) continue;
+        if ( rtgeom_same(ctx, c1->geoms[i], c2->geoms[j]) )
+        {
+          hit[j] = 1;
+          found=1;
+          break;
+        }
+      }
+      if ( ! found ) return RT_FALSE;
+    }
+  */
+
+  return RT_TRUE;
 }
 
 int rtcollection_ngeoms(const RTCTX *ctx, const RTCOLLECTION *col)
 {
-	int i;
-	int ngeoms = 0;
-
-	if ( ! col )
-	{
-		rterror(ctx, "Null input geometry.");
-		return 0;
-	}
-
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		if ( col->geoms[i])
-		{
-			switch (col->geoms[i]->type)
-			{
-			case RTPOINTTYPE:
-			case RTLINETYPE:
-			case RTCIRCSTRINGTYPE:
-			case RTPOLYGONTYPE:
-				ngeoms += 1;
-				break;
-			case RTMULTIPOINTTYPE:
-			case RTMULTILINETYPE:
-			case RTMULTICURVETYPE:
-			case RTMULTIPOLYGONTYPE:
-				ngeoms += col->ngeoms;
-				break;
-			case RTCOLLECTIONTYPE:
-				ngeoms += rtcollection_ngeoms(ctx, (RTCOLLECTION*)col->geoms[i]);
-				break;
-			}
-		}
-	}
-	return ngeoms;
+  int i;
+  int ngeoms = 0;
+
+  if ( ! col )
+  {
+    rterror(ctx, "Null input geometry.");
+    return 0;
+  }
+
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    if ( col->geoms[i])
+    {
+      switch (col->geoms[i]->type)
+      {
+      case RTPOINTTYPE:
+      case RTLINETYPE:
+      case RTCIRCSTRINGTYPE:
+      case RTPOLYGONTYPE:
+        ngeoms += 1;
+        break;
+      case RTMULTIPOINTTYPE:
+      case RTMULTILINETYPE:
+      case RTMULTICURVETYPE:
+      case RTMULTIPOLYGONTYPE:
+        ngeoms += col->ngeoms;
+        break;
+      case RTCOLLECTIONTYPE:
+        ngeoms += rtcollection_ngeoms(ctx, (RTCOLLECTION*)col->geoms[i]);
+        break;
+      }
+    }
+  }
+  return ngeoms;
 }
 
 void rtcollection_free(const RTCTX *ctx, RTCOLLECTION *col)
 {
-	int i;
-	if ( ! col ) return;
-	
-	if ( col->bbox )
-	{
-		rtfree(ctx, col->bbox);
-	}
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		RTDEBUGF(4,"freeing geom[%d]", i);
-		if ( col->geoms && col->geoms[i] )
-			rtgeom_free(ctx, col->geoms[i]);
-	}
-	if ( col->geoms )
-	{
-		rtfree(ctx, col->geoms);
-	}
-	rtfree(ctx, col);
+  int i;
+  if ( ! col ) return;
+
+  if ( col->bbox )
+  {
+    rtfree(ctx, col->bbox);
+  }
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    RTDEBUGF(4,"freeing geom[%d]", i);
+    if ( col->geoms && col->geoms[i] )
+      rtgeom_free(ctx, col->geoms[i]);
+  }
+  if ( col->geoms )
+  {
+    rtfree(ctx, col->geoms);
+  }
+  rtfree(ctx, col);
 }
 
 
@@ -366,233 +366,233 @@ void rtcollection_free(const RTCTX *ctx, RTCOLLECTION *col)
 */
 RTCOLLECTION* rtcollection_extract(const RTCTX *ctx, RTCOLLECTION *col, int type)
 {
-	int i = 0;
-	RTGEOM **geomlist;
-	RTCOLLECTION *outcol;
-	int geomlistsize = 16;
-	int geomlistlen = 0;
-	uint8_t outtype;
-
-	if ( ! col ) return NULL;
-
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		outtype = RTMULTIPOINTTYPE;
-		break;
-	case RTLINETYPE:
-		outtype = RTMULTILINETYPE;
-		break;
-	case RTPOLYGONTYPE:
-		outtype = RTMULTIPOLYGONTYPE;
-		break;
-	default:
-		rterror(ctx, "Only POLYGON, LINESTRING and POINT are supported by rtcollection_extract. %s requested.", rttype_name(ctx, type));
-		return NULL;
-	}
-
-	geomlist = rtalloc(ctx, sizeof(RTGEOM*) * geomlistsize);
-
-	/* Process each sub-geometry */
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		int subtype = col->geoms[i]->type;
-		/* Don't bother adding empty sub-geometries */
-		if ( rtgeom_is_empty(ctx, col->geoms[i]) )
-		{
-			continue;
-		}
-		/* Copy our sub-types into the output list */
-		if ( subtype == type )
-		{
-			/* We've over-run our buffer, double the memory segment */
-			if ( geomlistlen == geomlistsize )
-			{
-				geomlistsize *= 2;
-				geomlist = rtrealloc(ctx, geomlist, sizeof(RTGEOM*) * geomlistsize);
-			}
-			geomlist[geomlistlen] = rtgeom_clone(ctx, col->geoms[i]);
-			geomlistlen++;
-		}
-		/* Recurse into sub-collections */
-		if ( rttype_is_collection(ctx,  subtype ) )
-		{
-			int j = 0;
-			RTCOLLECTION *tmpcol = rtcollection_extract(ctx, (RTCOLLECTION*)col->geoms[i], type);
-			for ( j = 0; j < tmpcol->ngeoms; j++ )
-			{
-				/* We've over-run our buffer, double the memory segment */
-				if ( geomlistlen == geomlistsize )
-				{
-					geomlistsize *= 2;
-					geomlist = rtrealloc(ctx, geomlist, sizeof(RTGEOM*) * geomlistsize);
-				}
-				geomlist[geomlistlen] = tmpcol->geoms[j];
-				geomlistlen++;
-			}
-			rtfree(ctx, tmpcol);
-		}
-	}
-
-	if ( geomlistlen > 0 )
-	{
-		RTGBOX gbox;
-		outcol = rtcollection_construct(ctx, outtype, col->srid, NULL, geomlistlen, geomlist);
-		rtgeom_calculate_gbox(ctx, (RTGEOM *) outcol, &gbox);
-		outcol->bbox = gbox_copy(ctx, &gbox);
-	}
-	else
-	{
-		rtfree(ctx, geomlist);
-		outcol = rtcollection_construct_empty(ctx, outtype, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
-	}
-
-	return outcol;
+  int i = 0;
+  RTGEOM **geomlist;
+  RTCOLLECTION *outcol;
+  int geomlistsize = 16;
+  int geomlistlen = 0;
+  uint8_t outtype;
+
+  if ( ! col ) return NULL;
+
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    outtype = RTMULTIPOINTTYPE;
+    break;
+  case RTLINETYPE:
+    outtype = RTMULTILINETYPE;
+    break;
+  case RTPOLYGONTYPE:
+    outtype = RTMULTIPOLYGONTYPE;
+    break;
+  default:
+    rterror(ctx, "Only POLYGON, LINESTRING and POINT are supported by rtcollection_extract. %s requested.", rttype_name(ctx, type));
+    return NULL;
+  }
+
+  geomlist = rtalloc(ctx, sizeof(RTGEOM*) * geomlistsize);
+
+  /* Process each sub-geometry */
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    int subtype = col->geoms[i]->type;
+    /* Don't bother adding empty sub-geometries */
+    if ( rtgeom_is_empty(ctx, col->geoms[i]) )
+    {
+      continue;
+    }
+    /* Copy our sub-types into the output list */
+    if ( subtype == type )
+    {
+      /* We've over-run our buffer, double the memory segment */
+      if ( geomlistlen == geomlistsize )
+      {
+        geomlistsize *= 2;
+        geomlist = rtrealloc(ctx, geomlist, sizeof(RTGEOM*) * geomlistsize);
+      }
+      geomlist[geomlistlen] = rtgeom_clone(ctx, col->geoms[i]);
+      geomlistlen++;
+    }
+    /* Recurse into sub-collections */
+    if ( rttype_is_collection(ctx,  subtype ) )
+    {
+      int j = 0;
+      RTCOLLECTION *tmpcol = rtcollection_extract(ctx, (RTCOLLECTION*)col->geoms[i], type);
+      for ( j = 0; j < tmpcol->ngeoms; j++ )
+      {
+        /* We've over-run our buffer, double the memory segment */
+        if ( geomlistlen == geomlistsize )
+        {
+          geomlistsize *= 2;
+          geomlist = rtrealloc(ctx, geomlist, sizeof(RTGEOM*) * geomlistsize);
+        }
+        geomlist[geomlistlen] = tmpcol->geoms[j];
+        geomlistlen++;
+      }
+      rtfree(ctx, tmpcol);
+    }
+  }
+
+  if ( geomlistlen > 0 )
+  {
+    RTGBOX gbox;
+    outcol = rtcollection_construct(ctx, outtype, col->srid, NULL, geomlistlen, geomlist);
+    rtgeom_calculate_gbox(ctx, (RTGEOM *) outcol, &gbox);
+    outcol->bbox = gbox_copy(ctx, &gbox);
+  }
+  else
+  {
+    rtfree(ctx, geomlist);
+    outcol = rtcollection_construct_empty(ctx, outtype, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
+  }
+
+  return outcol;
 }
 
 RTGEOM*
 rtcollection_remove_repeated_points(const RTCTX *ctx, const RTCOLLECTION *coll, double tolerance)
 {
-	uint32_t i;
-	RTGEOM **newgeoms;
-
-	newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*coll->ngeoms);
-	for (i=0; i<coll->ngeoms; i++)
-	{
-		newgeoms[i] = rtgeom_remove_repeated_points(ctx, coll->geoms[i], tolerance);
-	}
-
-	return (RTGEOM*)rtcollection_construct(ctx, coll->type,
-	                                       coll->srid, coll->bbox ? gbox_copy(ctx, coll->bbox) : NULL,
-	                                       coll->ngeoms, newgeoms);
+  uint32_t i;
+  RTGEOM **newgeoms;
+
+  newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*coll->ngeoms);
+  for (i=0; i<coll->ngeoms; i++)
+  {
+    newgeoms[i] = rtgeom_remove_repeated_points(ctx, coll->geoms[i], tolerance);
+  }
+
+  return (RTGEOM*)rtcollection_construct(ctx, coll->type,
+                                         coll->srid, coll->bbox ? gbox_copy(ctx, coll->bbox) : NULL,
+                                         coll->ngeoms, newgeoms);
 }
 
 
 RTCOLLECTION*
 rtcollection_force_dims(const RTCTX *ctx, const RTCOLLECTION *col, int hasz, int hasm)
 {
-	RTCOLLECTION *colout;
-	
-	/* Return 2D empty */
-	if( rtcollection_is_empty(ctx, col) )
-	{
-		colout = rtcollection_construct_empty(ctx, col->type, col->srid, hasz, hasm);
-	}
-	else
-	{
-		int i;
-		RTGEOM **geoms = NULL;
-		geoms = rtalloc(ctx, sizeof(RTGEOM*) * col->ngeoms);
-		for( i = 0; i < col->ngeoms; i++ )
-		{
-			geoms[i] = rtgeom_force_dims(ctx, col->geoms[i], hasz, hasm);
-		}
-		colout = rtcollection_construct(ctx, col->type, col->srid, NULL, col->ngeoms, geoms);
-	}
-	return colout;
+  RTCOLLECTION *colout;
+
+  /* Return 2D empty */
+  if( rtcollection_is_empty(ctx, col) )
+  {
+    colout = rtcollection_construct_empty(ctx, col->type, col->srid, hasz, hasm);
+  }
+  else
+  {
+    int i;
+    RTGEOM **geoms = NULL;
+    geoms = rtalloc(ctx, sizeof(RTGEOM*) * col->ngeoms);
+    for( i = 0; i < col->ngeoms; i++ )
+    {
+      geoms[i] = rtgeom_force_dims(ctx, col->geoms[i], hasz, hasm);
+    }
+    colout = rtcollection_construct(ctx, col->type, col->srid, NULL, col->ngeoms, geoms);
+  }
+  return colout;
 }
 
 int rtcollection_is_empty(const RTCTX *ctx, const RTCOLLECTION *col)
 {
-	int i;
-	if ( (col->ngeoms == 0) || (!col->geoms) )
-		return RT_TRUE;
-	for( i = 0; i < col->ngeoms; i++ )
-	{
-		if ( ! rtgeom_is_empty(ctx, col->geoms[i]) ) return RT_FALSE;
-	}
-	return RT_TRUE;
+  int i;
+  if ( (col->ngeoms == 0) || (!col->geoms) )
+    return RT_TRUE;
+  for( i = 0; i < col->ngeoms; i++ )
+  {
+    if ( ! rtgeom_is_empty(ctx, col->geoms[i]) ) return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 
 int rtcollection_count_vertices(const RTCTX *ctx, RTCOLLECTION *col)
 {
-	int i = 0;
-	int v = 0; /* vertices */
-	assert(col);
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		v += rtgeom_count_vertices(ctx, col->geoms[i]);
-	}
-	return v;
+  int i = 0;
+  int v = 0; /* vertices */
+  assert(col);
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    v += rtgeom_count_vertices(ctx, col->geoms[i]);
+  }
+  return v;
 }
 
 RTCOLLECTION* rtcollection_simplify(const RTCTX *ctx, const RTCOLLECTION *igeom, double dist, int preserve_collapsed)
 {
- 	int i;
-	RTCOLLECTION *out = rtcollection_construct_empty(ctx, igeom->type, igeom->srid, RTFLAGS_GET_Z(igeom->flags), RTFLAGS_GET_M(igeom->flags));
+   int i;
+  RTCOLLECTION *out = rtcollection_construct_empty(ctx, igeom->type, igeom->srid, RTFLAGS_GET_Z(igeom->flags), RTFLAGS_GET_M(igeom->flags));
 
-	if( rtcollection_is_empty(ctx, igeom) )
-		return out; /* should we return NULL instead ? */
+  if( rtcollection_is_empty(ctx, igeom) )
+    return out; /* should we return NULL instead ? */
 
-	for( i = 0; i < igeom->ngeoms; i++ )
-	{
-		RTGEOM *ngeom = rtgeom_simplify(ctx, igeom->geoms[i], dist, preserve_collapsed);
-		if ( ngeom ) out = rtcollection_add_rtgeom(ctx, out, ngeom);
-	}
+  for( i = 0; i < igeom->ngeoms; i++ )
+  {
+    RTGEOM *ngeom = rtgeom_simplify(ctx, igeom->geoms[i], dist, preserve_collapsed);
+    if ( ngeom ) out = rtcollection_add_rtgeom(ctx, out, ngeom);
+  }
 
-	return out;
+  return out;
 }
 
 int rtcollection_allows_subtype(const RTCTX *ctx, int collectiontype, int subtype)
 {
-	if ( collectiontype == RTCOLLECTIONTYPE )
-		return RT_TRUE;
-	if ( collectiontype == RTMULTIPOINTTYPE &&
-	        subtype == RTPOINTTYPE )
-		return RT_TRUE;
-	if ( collectiontype == RTMULTILINETYPE &&
-	        subtype == RTLINETYPE )
-		return RT_TRUE;
-	if ( collectiontype == RTMULTIPOLYGONTYPE &&
-	        subtype == RTPOLYGONTYPE )
-		return RT_TRUE;
-	if ( collectiontype == RTCOMPOUNDTYPE &&
-	        (subtype == RTLINETYPE || subtype == RTCIRCSTRINGTYPE) )
-		return RT_TRUE;
-	if ( collectiontype == RTCURVEPOLYTYPE &&
-	        (subtype == RTCIRCSTRINGTYPE || subtype == RTLINETYPE || subtype == RTCOMPOUNDTYPE) )
-		return RT_TRUE;
-	if ( collectiontype == RTMULTICURVETYPE &&
-	        (subtype == RTCIRCSTRINGTYPE || subtype == RTLINETYPE || subtype == RTCOMPOUNDTYPE) )
-		return RT_TRUE;
-	if ( collectiontype == RTMULTISURFACETYPE &&
-	        (subtype == RTPOLYGONTYPE || subtype == RTCURVEPOLYTYPE) )
-		return RT_TRUE;
-	if ( collectiontype == RTPOLYHEDRALSURFACETYPE &&
-	        subtype == RTPOLYGONTYPE )
-		return RT_TRUE;
-	if ( collectiontype == RTTINTYPE &&
-	        subtype == RTTRIANGLETYPE )
-		return RT_TRUE;
-
-	/* Must be a bad combination! */
-	return RT_FALSE;
+  if ( collectiontype == RTCOLLECTIONTYPE )
+    return RT_TRUE;
+  if ( collectiontype == RTMULTIPOINTTYPE &&
+          subtype == RTPOINTTYPE )
+    return RT_TRUE;
+  if ( collectiontype == RTMULTILINETYPE &&
+          subtype == RTLINETYPE )
+    return RT_TRUE;
+  if ( collectiontype == RTMULTIPOLYGONTYPE &&
+          subtype == RTPOLYGONTYPE )
+    return RT_TRUE;
+  if ( collectiontype == RTCOMPOUNDTYPE &&
+          (subtype == RTLINETYPE || subtype == RTCIRCSTRINGTYPE) )
+    return RT_TRUE;
+  if ( collectiontype == RTCURVEPOLYTYPE &&
+          (subtype == RTCIRCSTRINGTYPE || subtype == RTLINETYPE || subtype == RTCOMPOUNDTYPE) )
+    return RT_TRUE;
+  if ( collectiontype == RTMULTICURVETYPE &&
+          (subtype == RTCIRCSTRINGTYPE || subtype == RTLINETYPE || subtype == RTCOMPOUNDTYPE) )
+    return RT_TRUE;
+  if ( collectiontype == RTMULTISURFACETYPE &&
+          (subtype == RTPOLYGONTYPE || subtype == RTCURVEPOLYTYPE) )
+    return RT_TRUE;
+  if ( collectiontype == RTPOLYHEDRALSURFACETYPE &&
+          subtype == RTPOLYGONTYPE )
+    return RT_TRUE;
+  if ( collectiontype == RTTINTYPE &&
+          subtype == RTTRIANGLETYPE )
+    return RT_TRUE;
+
+  /* Must be a bad combination! */
+  return RT_FALSE;
 }
 
 int
 rtcollection_startpoint(const RTCTX *ctx, const RTCOLLECTION* col, RTPOINT4D* pt)
 {
-	if ( col->ngeoms < 1 )
-		return RT_FAILURE;
-		
-	return rtgeom_startpoint(ctx, col->geoms[0], pt);
+  if ( col->ngeoms < 1 )
+    return RT_FAILURE;
+
+  return rtgeom_startpoint(ctx, col->geoms[0], pt);
 }
 
 
 RTCOLLECTION* rtcollection_grid(const RTCTX *ctx, const RTCOLLECTION *coll, const gridspec *grid)
 {
-	uint32_t i;
-	RTCOLLECTION *newcoll;
-	
-	newcoll = rtcollection_construct_empty(ctx, coll->type, coll->srid, rtgeom_has_z(ctx, (RTGEOM*)coll), rtgeom_has_m(ctx, (RTGEOM*)coll));
-
-	for (i=0; i<coll->ngeoms; i++)
-	{
-		RTGEOM *g = rtgeom_grid(ctx, coll->geoms[i], grid);
-		if ( g ) 
-			rtcollection_add_rtgeom(ctx, newcoll, g);
-	}
-
-	return newcoll;
+  uint32_t i;
+  RTCOLLECTION *newcoll;
+
+  newcoll = rtcollection_construct_empty(ctx, coll->type, coll->srid, rtgeom_has_z(ctx, (RTGEOM*)coll), rtgeom_has_m(ctx, (RTGEOM*)coll));
+
+  for (i=0; i<coll->ngeoms; i++)
+  {
+    RTGEOM *g = rtgeom_grid(ctx, coll->geoms[i], grid);
+    if ( g )
+      rtcollection_add_rtgeom(ctx, newcoll, g);
+  }
+
+  return newcoll;
 }
diff --git a/src/rtcompound.c b/src/rtcompound.c
index 4e083b9..7bcb4d7 100644
--- a/src/rtcompound.c
+++ b/src/rtcompound.c
@@ -35,217 +35,217 @@
 int
 rtcompound_is_closed(const RTCTX *ctx, const RTCOMPOUND *compound)
 {
-	size_t size;
-	int npoints=0;
-
-	if ( rtgeom_has_z(ctx, (RTGEOM*)compound) )
-	{
-		size = sizeof(POINT3D);
-	}
-	else
-	{
-		size = sizeof(RTPOINT2D);
-	}
-
-	if ( compound->geoms[compound->ngeoms - 1]->type == RTCIRCSTRINGTYPE )
-	{
-		npoints = ((RTCIRCSTRING *)compound->geoms[compound->ngeoms - 1])->points->npoints;
-	}
-	else if (compound->geoms[compound->ngeoms - 1]->type == RTLINETYPE)
-	{
-		npoints = ((RTLINE *)compound->geoms[compound->ngeoms - 1])->points->npoints;
-	}
-
-	if ( memcmp(rt_getPoint_internal(ctx,  (RTPOINTARRAY *)compound->geoms[0]->data, 0),
-	            rt_getPoint_internal(ctx,  (RTPOINTARRAY *)compound->geoms[compound->ngeoms - 1]->data,
-	                               npoints - 1),
-	            size) ) 
-	{
-		return RT_FALSE;
-	}
-
-	return RT_TRUE;
+  size_t size;
+  int npoints=0;
+
+  if ( rtgeom_has_z(ctx, (RTGEOM*)compound) )
+  {
+    size = sizeof(POINT3D);
+  }
+  else
+  {
+    size = sizeof(RTPOINT2D);
+  }
+
+  if ( compound->geoms[compound->ngeoms - 1]->type == RTCIRCSTRINGTYPE )
+  {
+    npoints = ((RTCIRCSTRING *)compound->geoms[compound->ngeoms - 1])->points->npoints;
+  }
+  else if (compound->geoms[compound->ngeoms - 1]->type == RTLINETYPE)
+  {
+    npoints = ((RTLINE *)compound->geoms[compound->ngeoms - 1])->points->npoints;
+  }
+
+  if ( memcmp(rt_getPoint_internal(ctx,  (RTPOINTARRAY *)compound->geoms[0]->data, 0),
+              rt_getPoint_internal(ctx,  (RTPOINTARRAY *)compound->geoms[compound->ngeoms - 1]->data,
+                                 npoints - 1),
+              size) )
+  {
+    return RT_FALSE;
+  }
+
+  return RT_TRUE;
 }
 
 double rtcompound_length(const RTCTX *ctx, const RTCOMPOUND *comp)
 {
-	double length = 0.0;
-	RTLINE *line;
-	if ( rtgeom_is_empty(ctx, (RTGEOM*)comp) )
-		return 0.0;
-	line = rtcompound_stroke(ctx, comp, 32);
-	length = rtline_length(ctx, line);
-	rtline_free(ctx, line);
-	return length;
+  double length = 0.0;
+  RTLINE *line;
+  if ( rtgeom_is_empty(ctx, (RTGEOM*)comp) )
+    return 0.0;
+  line = rtcompound_stroke(ctx, comp, 32);
+  length = rtline_length(ctx, line);
+  rtline_free(ctx, line);
+  return length;
 }
 
 double rtcompound_length_2d(const RTCTX *ctx, const RTCOMPOUND *comp)
 {
-	double length = 0.0;
-	RTLINE *line;
-	if ( rtgeom_is_empty(ctx, (RTGEOM*)comp) )
-		return 0.0;
-	line = rtcompound_stroke(ctx, comp, 32);
-	length = rtline_length_2d(ctx, line);
-	rtline_free(ctx, line);
-	return length;
+  double length = 0.0;
+  RTLINE *line;
+  if ( rtgeom_is_empty(ctx, (RTGEOM*)comp) )
+    return 0.0;
+  line = rtcompound_stroke(ctx, comp, 32);
+  length = rtline_length_2d(ctx, line);
+  rtline_free(ctx, line);
+  return length;
 }
 
 int rtcompound_add_rtgeom(const RTCTX *ctx, RTCOMPOUND *comp, RTGEOM *geom)
 {
-	RTCOLLECTION *col = (RTCOLLECTION*)comp;
-	
-	/* Empty things can't continuously join up with other things */
-	if ( rtgeom_is_empty(ctx, geom) )
-	{
-		RTDEBUG(4, "Got an empty component for a compound curve!");
-		return RT_FAILURE;
-	}
-	
-	if( col->ngeoms > 0 )
-	{
-		RTPOINT4D last, first;
-		/* First point of the component we are adding */
-		RTLINE *newline = (RTLINE*)geom;
-		/* Last point of the previous component */
-		RTLINE *prevline = (RTLINE*)(col->geoms[col->ngeoms-1]);
-
-		rt_getPoint4d_p(ctx, newline->points, 0, &first);
-		rt_getPoint4d_p(ctx, prevline->points, prevline->points->npoints-1, &last);
-		
-		if ( !(FP_EQUALS(first.x,last.x) && FP_EQUALS(first.y,last.y)) )
-		{
-			RTDEBUG(4, "Components don't join up end-to-end!");
-			RTDEBUGF(4, "first pt (%g %g %g %g) last pt (%g %g %g %g)", first.x, first.y, first.z, first.m, last.x, last.y, last.z, last.m);			
-			return RT_FAILURE;
-		}
-	}
-	
-	col = rtcollection_add_rtgeom(ctx, col, geom);
-	return RT_SUCCESS;
+  RTCOLLECTION *col = (RTCOLLECTION*)comp;
+
+  /* Empty things can't continuously join up with other things */
+  if ( rtgeom_is_empty(ctx, geom) )
+  {
+    RTDEBUG(4, "Got an empty component for a compound curve!");
+    return RT_FAILURE;
+  }
+
+  if( col->ngeoms > 0 )
+  {
+    RTPOINT4D last, first;
+    /* First point of the component we are adding */
+    RTLINE *newline = (RTLINE*)geom;
+    /* Last point of the previous component */
+    RTLINE *prevline = (RTLINE*)(col->geoms[col->ngeoms-1]);
+
+    rt_getPoint4d_p(ctx, newline->points, 0, &first);
+    rt_getPoint4d_p(ctx, prevline->points, prevline->points->npoints-1, &last);
+
+    if ( !(FP_EQUALS(first.x,last.x) && FP_EQUALS(first.y,last.y)) )
+    {
+      RTDEBUG(4, "Components don't join up end-to-end!");
+      RTDEBUGF(4, "first pt (%g %g %g %g) last pt (%g %g %g %g)", first.x, first.y, first.z, first.m, last.x, last.y, last.z, last.m);
+      return RT_FAILURE;
+    }
+  }
+
+  col = rtcollection_add_rtgeom(ctx, col, geom);
+  return RT_SUCCESS;
 }
 
 RTCOMPOUND *
 rtcompound_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTCOMPOUND *ret = (RTCOMPOUND*)rtcollection_construct_empty(ctx, RTCOMPOUNDTYPE, srid, hasz, hasm);
-	return ret;
+  RTCOMPOUND *ret = (RTCOMPOUND*)rtcollection_construct_empty(ctx, RTCOMPOUNDTYPE, srid, hasz, hasm);
+  return ret;
 }
 
 int rtgeom_contains_point(const RTCTX *ctx, const RTGEOM *geom, const RTPOINT2D *pt)
 {
-	switch( geom->type )
-	{
-		case RTLINETYPE:
-			return ptarray_contains_point(ctx, ((RTLINE*)geom)->points, pt);
-		case RTCIRCSTRINGTYPE:
-			return ptarrayarc_contains_point(ctx, ((RTCIRCSTRING*)geom)->points, pt);
-		case RTCOMPOUNDTYPE:
-			return rtcompound_contains_point(ctx, (RTCOMPOUND*)geom, pt);
-	}
-	rterror(ctx, "rtgeom_contains_point failed");
-	return RT_FAILURE;
+  switch( geom->type )
+  {
+    case RTLINETYPE:
+      return ptarray_contains_point(ctx, ((RTLINE*)geom)->points, pt);
+    case RTCIRCSTRINGTYPE:
+      return ptarrayarc_contains_point(ctx, ((RTCIRCSTRING*)geom)->points, pt);
+    case RTCOMPOUNDTYPE:
+      return rtcompound_contains_point(ctx, (RTCOMPOUND*)geom, pt);
+  }
+  rterror(ctx, "rtgeom_contains_point failed");
+  return RT_FAILURE;
 }
 
-int 
+int
 rtcompound_contains_point(const RTCTX *ctx, const RTCOMPOUND *comp, const RTPOINT2D *pt)
 {
-	int i;
-	RTLINE *rtline;
-	RTCIRCSTRING *rtcirc;
-	int wn = 0;
-	int winding_number = 0;
-	int result;
-
-	for ( i = 0; i < comp->ngeoms; i++ )
-	{
-		RTGEOM *rtgeom = comp->geoms[i];
-		if ( rtgeom->type == RTLINETYPE )
-		{
-			rtline = rtgeom_as_rtline(ctx, rtgeom);
-			if ( comp->ngeoms == 1 )
-			{
-				return ptarray_contains_point(ctx, rtline->points, pt); 
-			}
-			else
-			{
-				/* Don't check closure while doing p-i-p test */
-				result = ptarray_contains_point_partial(ctx, rtline->points, pt, RT_FALSE, &winding_number);
-			}
-		}
-		else
-		{
-			rtcirc = rtgeom_as_rtcircstring(ctx, rtgeom);
-			if ( ! rtcirc ) {
-				rterror(ctx, "Unexpected component of type %s in compound curve", rttype_name(ctx, rtgeom->type));
-				return 0;
-			}
-			if ( comp->ngeoms == 1 )
-			{
-				return ptarrayarc_contains_point(ctx, rtcirc->points, pt); 				
-			}
-			else
-			{
-				/* Don't check closure while doing p-i-p test */
-				result = ptarrayarc_contains_point_partial(ctx, rtcirc->points, pt, RT_FALSE, &winding_number);
-			}
-		}
-
-		/* Propogate boundary condition */
-		if ( result == RT_BOUNDARY ) 
-			return RT_BOUNDARY;
-
-		wn += winding_number;
-	}
-
-	/* Outside */
-	if (wn == 0)
-		return RT_OUTSIDE;
-	
-	/* Inside */
-	return RT_INSIDE;
-}	
+  int i;
+  RTLINE *rtline;
+  RTCIRCSTRING *rtcirc;
+  int wn = 0;
+  int winding_number = 0;
+  int result;
+
+  for ( i = 0; i < comp->ngeoms; i++ )
+  {
+    RTGEOM *rtgeom = comp->geoms[i];
+    if ( rtgeom->type == RTLINETYPE )
+    {
+      rtline = rtgeom_as_rtline(ctx, rtgeom);
+      if ( comp->ngeoms == 1 )
+      {
+        return ptarray_contains_point(ctx, rtline->points, pt);
+      }
+      else
+      {
+        /* Don't check closure while doing p-i-p test */
+        result = ptarray_contains_point_partial(ctx, rtline->points, pt, RT_FALSE, &winding_number);
+      }
+    }
+    else
+    {
+      rtcirc = rtgeom_as_rtcircstring(ctx, rtgeom);
+      if ( ! rtcirc ) {
+        rterror(ctx, "Unexpected component of type %s in compound curve", rttype_name(ctx, rtgeom->type));
+        return 0;
+      }
+      if ( comp->ngeoms == 1 )
+      {
+        return ptarrayarc_contains_point(ctx, rtcirc->points, pt);
+      }
+      else
+      {
+        /* Don't check closure while doing p-i-p test */
+        result = ptarrayarc_contains_point_partial(ctx, rtcirc->points, pt, RT_FALSE, &winding_number);
+      }
+    }
+
+    /* Propogate boundary condition */
+    if ( result == RT_BOUNDARY )
+      return RT_BOUNDARY;
+
+    wn += winding_number;
+  }
+
+  /* Outside */
+  if (wn == 0)
+    return RT_OUTSIDE;
+
+  /* Inside */
+  return RT_INSIDE;
+}
 
 RTCOMPOUND *
 rtcompound_construct_from_rtline(const RTCTX *ctx, const RTLINE *rtline)
 {
   RTCOMPOUND* ogeom = rtcompound_construct_empty(ctx, rtline->srid, RTFLAGS_GET_Z(rtline->flags), RTFLAGS_GET_M(rtline->flags));
   rtcompound_add_rtgeom(ctx, ogeom, rtgeom_clone(ctx, (RTGEOM*)rtline));
-	/* ogeom->bbox = rtline->bbox; */
+  /* ogeom->bbox = rtline->bbox; */
   return ogeom;
 }
 
-RTPOINT* 
+RTPOINT*
 rtcompound_get_rtpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp, int where)
 {
-	int i;
-	int count = 0;
-	int npoints = 0;
-	if ( rtgeom_is_empty(ctx, (RTGEOM*)rtcmp) )
-		return NULL;
-	
-	npoints = rtgeom_count_vertices(ctx, (RTGEOM*)rtcmp);
-	if ( where < 0 || where >= npoints )
-	{
-		rterror(ctx, "%s: index %d is not in range of number of vertices (%d) in input", __func__, where, npoints);
-		return NULL;
-	}
-	
-	for ( i = 0; i < rtcmp->ngeoms; i++ )
-	{
-		RTGEOM* part = rtcmp->geoms[i];
-		int npoints_part = rtgeom_count_vertices(ctx, part);
-		if ( where >= count && where < count + npoints_part )
-		{
-			return rtline_get_rtpoint(ctx, (RTLINE*)part, where - count);
-		}
-		else
-		{
-			count += npoints_part;
-		}
-	}
-
-	return NULL;	
+  int i;
+  int count = 0;
+  int npoints = 0;
+  if ( rtgeom_is_empty(ctx, (RTGEOM*)rtcmp) )
+    return NULL;
+
+  npoints = rtgeom_count_vertices(ctx, (RTGEOM*)rtcmp);
+  if ( where < 0 || where >= npoints )
+  {
+    rterror(ctx, "%s: index %d is not in range of number of vertices (%d) in input", __func__, where, npoints);
+    return NULL;
+  }
+
+  for ( i = 0; i < rtcmp->ngeoms; i++ )
+  {
+    RTGEOM* part = rtcmp->geoms[i];
+    int npoints_part = rtgeom_count_vertices(ctx, part);
+    if ( where >= count && where < count + npoints_part )
+    {
+      return rtline_get_rtpoint(ctx, (RTLINE*)part, where - count);
+    }
+    else
+    {
+      count += npoints_part;
+    }
+  }
+
+  return NULL;
 }
 
 
@@ -253,25 +253,25 @@ rtcompound_get_rtpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp, int where)
 RTPOINT *
 rtcompound_get_startpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp)
 {
-	return rtcompound_get_rtpoint(ctx, rtcmp, 0);
+  return rtcompound_get_rtpoint(ctx, rtcmp, 0);
 }
 
 RTPOINT *
 rtcompound_get_endpoint(const RTCTX *ctx, const RTCOMPOUND *rtcmp)
 {
-	RTLINE *rtline;
-	if ( rtcmp->ngeoms < 1 )
-	{
-		return NULL;
-	}
-	
-	rtline = (RTLINE*)(rtcmp->geoms[rtcmp->ngeoms-1]);
-
-	if ( (!rtline) || (!rtline->points) || (rtline->points->npoints < 1) )
-	{
-		return NULL;
-	}
-	
-	return rtline_get_rtpoint(ctx, rtline, rtline->points->npoints-1);
+  RTLINE *rtline;
+  if ( rtcmp->ngeoms < 1 )
+  {
+    return NULL;
+  }
+
+  rtline = (RTLINE*)(rtcmp->geoms[rtcmp->ngeoms-1]);
+
+  if ( (!rtline) || (!rtline->points) || (rtline->points->npoints < 1) )
+  {
+    return NULL;
+  }
+
+  return rtline_get_rtpoint(ctx, rtline, rtline->points->npoints-1);
 }
 
diff --git a/src/rtcurvepoly.c b/src/rtcurvepoly.c
index 241ff4f..59b6702 100644
--- a/src/rtcurvepoly.c
+++ b/src/rtcurvepoly.c
@@ -36,95 +36,95 @@
 RTCURVEPOLY *
 rtcurvepoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTCURVEPOLY *ret;
-
-	ret = rtalloc(ctx, sizeof(RTCURVEPOLY));
-	ret->type = RTCURVEPOLYTYPE;
-	ret->flags = gflags(ctx, hasz, hasm, 0);
-	ret->srid = srid;
-	ret->nrings = 0;
-	ret->maxrings = 1; /* Allocate room for sub-members, just in case. */
-	ret->rings = rtalloc(ctx, ret->maxrings * sizeof(RTGEOM*));
-	ret->bbox = NULL;
-
-	return ret;
+  RTCURVEPOLY *ret;
+
+  ret = rtalloc(ctx, sizeof(RTCURVEPOLY));
+  ret->type = RTCURVEPOLYTYPE;
+  ret->flags = gflags(ctx, hasz, hasm, 0);
+  ret->srid = srid;
+  ret->nrings = 0;
+  ret->maxrings = 1; /* Allocate room for sub-members, just in case. */
+  ret->rings = rtalloc(ctx, ret->maxrings * sizeof(RTGEOM*));
+  ret->bbox = NULL;
+
+  return ret;
 }
 
 RTCURVEPOLY *
 rtcurvepoly_construct_from_rtpoly(const RTCTX *ctx, RTPOLY *rtpoly)
 {
-	RTCURVEPOLY *ret;
-	int i;
-	ret = rtalloc(ctx, sizeof(RTCURVEPOLY));
-	ret->type = RTCURVEPOLYTYPE;
-	ret->flags = rtpoly->flags;
-	ret->srid = rtpoly->srid;
-	ret->nrings = rtpoly->nrings;
-	ret->maxrings = rtpoly->nrings; /* Allocate room for sub-members, just in case. */
-	ret->rings = rtalloc(ctx, ret->maxrings * sizeof(RTGEOM*));
-	ret->bbox = rtpoly->bbox ? gbox_clone(ctx, rtpoly->bbox) : NULL;
-	for ( i = 0; i < ret->nrings; i++ )
-	{
-		ret->rings[i] = rtline_as_rtgeom(ctx, rtline_construct(ctx, ret->srid, NULL, ptarray_clone_deep(ctx, rtpoly->rings[i])));
-	}
-	return ret;
+  RTCURVEPOLY *ret;
+  int i;
+  ret = rtalloc(ctx, sizeof(RTCURVEPOLY));
+  ret->type = RTCURVEPOLYTYPE;
+  ret->flags = rtpoly->flags;
+  ret->srid = rtpoly->srid;
+  ret->nrings = rtpoly->nrings;
+  ret->maxrings = rtpoly->nrings; /* Allocate room for sub-members, just in case. */
+  ret->rings = rtalloc(ctx, ret->maxrings * sizeof(RTGEOM*));
+  ret->bbox = rtpoly->bbox ? gbox_clone(ctx, rtpoly->bbox) : NULL;
+  for ( i = 0; i < ret->nrings; i++ )
+  {
+    ret->rings[i] = rtline_as_rtgeom(ctx, rtline_construct(ctx, ret->srid, NULL, ptarray_clone_deep(ctx, rtpoly->rings[i])));
+  }
+  return ret;
 }
 
 int rtcurvepoly_add_ring(const RTCTX *ctx, RTCURVEPOLY *poly, RTGEOM *ring)
 {
-	int i;
-	
-	/* Can't do anything with NULLs */
-	if( ! poly || ! ring ) 
-	{
-		RTDEBUG(4,"NULL inputs!!! quitting");
-		return RT_FAILURE;
-	}
-
-	/* Check that we're not working with garbage */
-	if ( poly->rings == NULL && (poly->nrings || poly->maxrings) )
-	{
-		RTDEBUG(4,"mismatched nrings/maxrings");
-		rterror(ctx, "Curvepolygon is in inconsistent state. Null memory but non-zero collection counts.");
-	}
-
-	/* Check that we're adding an allowed ring type */
-	if ( ! ( ring->type == RTLINETYPE || ring->type == RTCIRCSTRINGTYPE || ring->type == RTCOMPOUNDTYPE ) )
-	{
-		RTDEBUGF(4,"got incorrect ring type: %s",rttype_name(ctx, ring->type));
-		return RT_FAILURE;
-	}
-
-		
-	/* In case this is a truly empty, make some initial space  */
-	if ( poly->rings == NULL )
-	{
-		poly->maxrings = 2;
-		poly->nrings = 0;
-		poly->rings = rtalloc(ctx, poly->maxrings * sizeof(RTGEOM*));
-	}
-
-	/* Allocate more space if we need it */
-	if ( poly->nrings == poly->maxrings )
-	{
-		poly->maxrings *= 2;
-		poly->rings = rtrealloc(ctx, poly->rings, sizeof(RTGEOM*) * poly->maxrings);
-	}
-
-	/* Make sure we don't already have a reference to this geom */
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if ( poly->rings[i] == ring )
-		{
-			RTDEBUGF(4, "Found duplicate geometry in collection %p == %p", poly->rings[i], ring);
-			return RT_SUCCESS;
-		}
-	}
-
-	/* Add the ring and increment the ring count */
-	poly->rings[poly->nrings] = (RTGEOM*)ring;
-	poly->nrings++;
-	return RT_SUCCESS;	
+  int i;
+
+  /* Can't do anything with NULLs */
+  if( ! poly || ! ring )
+  {
+    RTDEBUG(4,"NULL inputs!!! quitting");
+    return RT_FAILURE;
+  }
+
+  /* Check that we're not working with garbage */
+  if ( poly->rings == NULL && (poly->nrings || poly->maxrings) )
+  {
+    RTDEBUG(4,"mismatched nrings/maxrings");
+    rterror(ctx, "Curvepolygon is in inconsistent state. Null memory but non-zero collection counts.");
+  }
+
+  /* Check that we're adding an allowed ring type */
+  if ( ! ( ring->type == RTLINETYPE || ring->type == RTCIRCSTRINGTYPE || ring->type == RTCOMPOUNDTYPE ) )
+  {
+    RTDEBUGF(4,"got incorrect ring type: %s",rttype_name(ctx, ring->type));
+    return RT_FAILURE;
+  }
+
+
+  /* In case this is a truly empty, make some initial space  */
+  if ( poly->rings == NULL )
+  {
+    poly->maxrings = 2;
+    poly->nrings = 0;
+    poly->rings = rtalloc(ctx, poly->maxrings * sizeof(RTGEOM*));
+  }
+
+  /* Allocate more space if we need it */
+  if ( poly->nrings == poly->maxrings )
+  {
+    poly->maxrings *= 2;
+    poly->rings = rtrealloc(ctx, poly->rings, sizeof(RTGEOM*) * poly->maxrings);
+  }
+
+  /* Make sure we don't already have a reference to this geom */
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if ( poly->rings[i] == ring )
+    {
+      RTDEBUGF(4, "Found duplicate geometry in collection %p == %p", poly->rings[i], ring);
+      return RT_SUCCESS;
+    }
+  }
+
+  /* Add the ring and increment the ring count */
+  poly->rings[poly->nrings] = (RTGEOM*)ring;
+  poly->nrings++;
+  return RT_SUCCESS;
 }
 
 /**
@@ -133,37 +133,37 @@ int rtcurvepoly_add_ring(const RTCTX *ctx, RTCURVEPOLY *poly, RTGEOM *ring)
 double
 rtcurvepoly_area(const RTCTX *ctx, const RTCURVEPOLY *curvepoly)
 {
-	double area = 0.0;
-	RTPOLY *poly;
-	if( rtgeom_is_empty(ctx, (RTGEOM*)curvepoly) )
-		return 0.0;
-	poly = rtcurvepoly_stroke(ctx, curvepoly, 32);
-	area = rtpoly_area(ctx, poly);
-	rtpoly_free(ctx, poly);
-	return area;
+  double area = 0.0;
+  RTPOLY *poly;
+  if( rtgeom_is_empty(ctx, (RTGEOM*)curvepoly) )
+    return 0.0;
+  poly = rtcurvepoly_stroke(ctx, curvepoly, 32);
+  area = rtpoly_area(ctx, poly);
+  rtpoly_free(ctx, poly);
+  return area;
 }
 
 
 double
 rtcurvepoly_perimeter(const RTCTX *ctx, const RTCURVEPOLY *poly)
 {
-	double result=0.0;
-	int i;
+  double result=0.0;
+  int i;
 
-	for (i=0; i<poly->nrings; i++)
-		result += rtgeom_length(ctx, poly->rings[i]);
+  for (i=0; i<poly->nrings; i++)
+    result += rtgeom_length(ctx, poly->rings[i]);
 
-	return result;
+  return result;
 }
 
 double
 rtcurvepoly_perimeter_2d(const RTCTX *ctx, const RTCURVEPOLY *poly)
 {
-	double result=0.0;
-	int i;
+  double result=0.0;
+  int i;
 
-	for (i=0; i<poly->nrings; i++)
-		result += rtgeom_length_2d(ctx, poly->rings[i]);
+  for (i=0; i<poly->nrings; i++)
+    result += rtgeom_length_2d(ctx, poly->rings[i]);
 
-	return result;
+  return result;
 }
diff --git a/src/rtgeodetic.c b/src/rtgeodetic.c
index 4273e9e..aae4887 100644
--- a/src/rtgeodetic.c
+++ b/src/rtgeodetic.c
@@ -41,27 +41,27 @@ int gbox_geocentric_slow = RT_FALSE;
 */
 double longitude_radians_normalize(const RTCTX *ctx, double lon)
 {
-	if ( lon == -1.0 * M_PI )
-		return M_PI;
-	if ( lon == -2.0 * M_PI )
-		return 0.0;
+  if ( lon == -1.0 * M_PI )
+    return M_PI;
+  if ( lon == -2.0 * M_PI )
+    return 0.0;
 
-	if ( lon > 2.0 * M_PI )
-		lon = remainder(lon, 2.0 * M_PI);
+  if ( lon > 2.0 * M_PI )
+    lon = remainder(lon, 2.0 * M_PI);
 
-	if ( lon < -2.0 * M_PI )
-		lon = remainder(lon, -2.0 * M_PI);
+  if ( lon < -2.0 * M_PI )
+    lon = remainder(lon, -2.0 * M_PI);
 
-	if ( lon > M_PI )
-		lon = -2.0 * M_PI + lon;
+  if ( lon > M_PI )
+    lon = -2.0 * M_PI + lon;
 
-	if ( lon < -1.0 * M_PI )
-		lon = 2.0 * M_PI + lon;
-		
-	if ( lon == -2.0 * M_PI )
-		lon *= -1.0;
+  if ( lon < -1.0 * M_PI )
+    lon = 2.0 * M_PI + lon;
 
-	return lon;
+  if ( lon == -2.0 * M_PI )
+    lon *= -1.0;
+
+  return lon;
 }
 
 /**
@@ -70,25 +70,25 @@ double longitude_radians_normalize(const RTCTX *ctx, double lon)
 double latitude_radians_normalize(const RTCTX *ctx, double lat)
 {
 
-	if ( lat > 2.0 * M_PI )
-		lat = remainder(lat, 2.0 * M_PI);
+  if ( lat > 2.0 * M_PI )
+    lat = remainder(lat, 2.0 * M_PI);
 
-	if ( lat < -2.0 * M_PI )
-		lat = remainder(lat, -2.0 * M_PI);
+  if ( lat < -2.0 * M_PI )
+    lat = remainder(lat, -2.0 * M_PI);
 
-	if ( lat > M_PI )
-		lat = M_PI - lat;
+  if ( lat > M_PI )
+    lat = M_PI - lat;
 
-	if ( lat < -1.0 * M_PI )
-		lat = -1.0 * M_PI - lat;
+  if ( lat < -1.0 * M_PI )
+    lat = -1.0 * M_PI - lat;
 
-	if ( lat > M_PI_2 )
-		lat = M_PI - lat;
+  if ( lat > M_PI_2 )
+    lat = M_PI - lat;
 
-	if ( lat < -1.0 * M_PI_2 )
-		lat = -1.0 * M_PI - lat;
+  if ( lat < -1.0 * M_PI_2 )
+    lat = -1.0 * M_PI - lat;
 
-	return lat;
+  return lat;
 }
 
 /**
@@ -97,25 +97,25 @@ double latitude_radians_normalize(const RTCTX *ctx, double lat)
 */
 double longitude_degrees_normalize(const RTCTX *ctx, double lon)
 {
-	if ( lon > 360.0 )
-		lon = remainder(lon, 360.0);
+  if ( lon > 360.0 )
+    lon = remainder(lon, 360.0);
 
-	if ( lon < -360.0 )
-		lon = remainder(lon, -360.0);
+  if ( lon < -360.0 )
+    lon = remainder(lon, -360.0);
 
-	if ( lon > 180.0 )
-		lon = -360.0 + lon;
+  if ( lon > 180.0 )
+    lon = -360.0 + lon;
 
-	if ( lon < -180.0 )
-		lon = 360 + lon;
+  if ( lon < -180.0 )
+    lon = 360 + lon;
 
-	if ( lon == -180.0 )
-		return 180.0;
+  if ( lon == -180.0 )
+    return 180.0;
 
-	if ( lon == -360.0 )
-		return 0.0;
+  if ( lon == -360.0 )
+    return 0.0;
 
-	return lon;
+  return lon;
 }
 
 /**
@@ -125,25 +125,25 @@ double longitude_degrees_normalize(const RTCTX *ctx, double lon)
 double latitude_degrees_normalize(const RTCTX *ctx, double lat)
 {
 
-	if ( lat > 360.0 )
-		lat = remainder(lat, 360.0);
+  if ( lat > 360.0 )
+    lat = remainder(lat, 360.0);
 
-	if ( lat < -360.0 )
-		lat = remainder(lat, -360.0);
+  if ( lat < -360.0 )
+    lat = remainder(lat, -360.0);
 
-	if ( lat > 180.0 )
-		lat = 180.0 - lat;
+  if ( lat > 180.0 )
+    lat = 180.0 - lat;
 
-	if ( lat < -180.0 )
-		lat = -180.0 - lat;
+  if ( lat < -180.0 )
+    lat = -180.0 - lat;
 
-	if ( lat > 90.0 )
-		lat = 180.0 - lat;
+  if ( lat > 90.0 )
+    lat = 180.0 - lat;
 
-	if ( lat < -90.0 )
-		lat = -180.0 - lat;
+  if ( lat < -90.0 )
+    lat = -180.0 - lat;
 
-	return lat;
+  return lat;
 }
 
 /**
@@ -151,17 +151,17 @@ double latitude_degrees_normalize(const RTCTX *ctx, double lat)
 */
 void point_shift(const RTCTX *ctx, GEOGRAPHIC_POINT *p, double shift)
 {
-	double lon = p->lon + shift;
-	if ( lon > M_PI )
-		p->lon = -1.0 * M_PI + (lon - M_PI);
-	else
-		p->lon = lon;
-	return;
+  double lon = p->lon + shift;
+  if ( lon > M_PI )
+    p->lon = -1.0 * M_PI + (lon - M_PI);
+  else
+    p->lon = lon;
+  return;
 }
 
 int geographic_point_equals(const RTCTX *ctx, const GEOGRAPHIC_POINT *g1, const GEOGRAPHIC_POINT *g2)
 {
-	return FP_EQUALS(g1->lat, g2->lat) && FP_EQUALS(g1->lon, g2->lon);
+  return FP_EQUALS(g1->lat, g2->lat) && FP_EQUALS(g1->lon, g2->lon);
 }
 
 /**
@@ -171,129 +171,129 @@ int geographic_point_equals(const RTCTX *ctx, const GEOGRAPHIC_POINT *g1, const
 */
 void geographic_point_init(const RTCTX *ctx, double lon, double lat, GEOGRAPHIC_POINT *g)
 {
-	g->lat = latitude_radians_normalize(ctx, deg2rad(lat));
-	g->lon = longitude_radians_normalize(ctx, deg2rad(lon));
+  g->lat = latitude_radians_normalize(ctx, deg2rad(lat));
+  g->lon = longitude_radians_normalize(ctx, deg2rad(lon));
 }
 
 /** Returns the angular height (latitudinal span) of the box in radians */
-double 
+double
 gbox_angular_height(const RTCTX *ctx, const RTGBOX* gbox)
 {
-	double d[6];
-	int i;
-	double zmin = FLT_MAX;
-	double zmax = -1 * FLT_MAX;
-	POINT3D pt;
-	
-	/* Take a copy of the box corners so we can treat them as a list */
-	/* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
-	memcpy(d, &(gbox->xmin), 6*sizeof(double));
-	
-	/* Generate all 8 corner vectors of the box */
-	for ( i = 0; i < 8; i++ )
-	{
-		pt.x = d[i / 4];
-		pt.y = d[2 + (i % 4) / 2];
-		pt.z = d[4 + (i % 2)];
-		normalize(ctx, &pt);
-		if ( pt.z < zmin ) zmin = pt.z;
-		if ( pt.z > zmax ) zmax = pt.z;
-	}
-	return asin(zmax) - asin(zmin);
+  double d[6];
+  int i;
+  double zmin = FLT_MAX;
+  double zmax = -1 * FLT_MAX;
+  POINT3D pt;
+
+  /* Take a copy of the box corners so we can treat them as a list */
+  /* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
+  memcpy(d, &(gbox->xmin), 6*sizeof(double));
+
+  /* Generate all 8 corner vectors of the box */
+  for ( i = 0; i < 8; i++ )
+  {
+    pt.x = d[i / 4];
+    pt.y = d[2 + (i % 4) / 2];
+    pt.z = d[4 + (i % 2)];
+    normalize(ctx, &pt);
+    if ( pt.z < zmin ) zmin = pt.z;
+    if ( pt.z > zmax ) zmax = pt.z;
+  }
+  return asin(zmax) - asin(zmin);
 }
 
 /** Returns the angular width (longitudinal span) of the box in radians */
-double 
+double
 gbox_angular_width(const RTCTX *ctx, const RTGBOX* gbox)
 {
-	double d[6];
-	int i, j;
-	POINT3D pt[3];
-	double maxangle;
-	double magnitude;
-
-	/* Take a copy of the box corners so we can treat them as a list */
-	/* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
-	memcpy(d, &(gbox->xmin), 6*sizeof(double));
-
-	/* Start with the bottom corner */
-	pt[0].x = gbox->xmin;
-	pt[0].y = gbox->ymin;
-	magnitude = sqrt(pt[0].x*pt[0].x + pt[0].y*pt[0].y);
-	pt[0].x /= magnitude;
-	pt[0].y /= magnitude;
-
-	/* Generate all 8 corner vectors of the box */
-	/* Find the vector furthest from our seed vector */
-	for ( j = 0; j < 2; j++ )
-	{
-		maxangle = -1 * FLT_MAX;
-		for ( i = 0; i < 4; i++ )
-		{
-			double angle, dotprod;
-			POINT3D pt_n;
-		
-			pt_n.x = d[i / 2];
-			pt_n.y = d[2 + (i % 2)];
-			magnitude = sqrt(pt_n.x*pt_n.x + pt_n.y*pt_n.y);
-			pt_n.x /= magnitude;
-			pt_n.y /= magnitude;
-			pt_n.z = 0.0;
-
-			dotprod = pt_n.x*pt[j].x + pt_n.y*pt[j].y;
-			angle = acos(dotprod > 1.0 ? 1.0 : dotprod);
-			if ( angle > maxangle )
-			{
-				pt[j+1] = pt_n;
-				maxangle = angle;
-			}
-		}
-	}
-	
-	/* Return the distance between the two furthest vectors */
-	return maxangle;
+  double d[6];
+  int i, j;
+  POINT3D pt[3];
+  double maxangle;
+  double magnitude;
+
+  /* Take a copy of the box corners so we can treat them as a list */
+  /* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
+  memcpy(d, &(gbox->xmin), 6*sizeof(double));
+
+  /* Start with the bottom corner */
+  pt[0].x = gbox->xmin;
+  pt[0].y = gbox->ymin;
+  magnitude = sqrt(pt[0].x*pt[0].x + pt[0].y*pt[0].y);
+  pt[0].x /= magnitude;
+  pt[0].y /= magnitude;
+
+  /* Generate all 8 corner vectors of the box */
+  /* Find the vector furthest from our seed vector */
+  for ( j = 0; j < 2; j++ )
+  {
+    maxangle = -1 * FLT_MAX;
+    for ( i = 0; i < 4; i++ )
+    {
+      double angle, dotprod;
+      POINT3D pt_n;
+
+      pt_n.x = d[i / 2];
+      pt_n.y = d[2 + (i % 2)];
+      magnitude = sqrt(pt_n.x*pt_n.x + pt_n.y*pt_n.y);
+      pt_n.x /= magnitude;
+      pt_n.y /= magnitude;
+      pt_n.z = 0.0;
+
+      dotprod = pt_n.x*pt[j].x + pt_n.y*pt[j].y;
+      angle = acos(dotprod > 1.0 ? 1.0 : dotprod);
+      if ( angle > maxangle )
+      {
+        pt[j+1] = pt_n;
+        maxangle = angle;
+      }
+    }
+  }
+
+  /* Return the distance between the two furthest vectors */
+  return maxangle;
 }
 
 /** Computes the average(ish) center of the box and returns success. */
 int
 gbox_centroid(const RTCTX *ctx, const RTGBOX* gbox, RTPOINT2D* out)
 {
-	double d[6];
-	GEOGRAPHIC_POINT g;
-	POINT3D pt;
-	int i;
-
-	/* Take a copy of the box corners so we can treat them as a list */
-	/* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
-	memcpy(d, &(gbox->xmin), 6*sizeof(double));
-	
-	/* Zero out our return vector */
-	pt.x = pt.y = pt.z = 0.0;
-
-	for ( i = 0; i < 8; i++ )
-	{
-		POINT3D pt_n;
-	
-		pt_n.x = d[i / 4];
-		pt_n.y = d[2 + ((i % 4) / 2)];
-		pt_n.z = d[4 + (i % 2)];
-		normalize(ctx, &pt_n);
-	
-		pt.x += pt_n.x;
-		pt.y += pt_n.y;
-		pt.z += pt_n.z;		
-	}
-	
-	pt.x /= 8.0;
-	pt.y /= 8.0;
-	pt.z /= 8.0;
-	normalize(ctx, &pt);
-
-	cart2geog(ctx, &pt, &g);
-	out->x = longitude_degrees_normalize(ctx, rad2deg(g.lon));
-	out->y = latitude_degrees_normalize(ctx, rad2deg(g.lat));
-	
-	return RT_SUCCESS;
+  double d[6];
+  GEOGRAPHIC_POINT g;
+  POINT3D pt;
+  int i;
+
+  /* Take a copy of the box corners so we can treat them as a list */
+  /* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
+  memcpy(d, &(gbox->xmin), 6*sizeof(double));
+
+  /* Zero out our return vector */
+  pt.x = pt.y = pt.z = 0.0;
+
+  for ( i = 0; i < 8; i++ )
+  {
+    POINT3D pt_n;
+
+    pt_n.x = d[i / 4];
+    pt_n.y = d[2 + ((i % 4) / 2)];
+    pt_n.z = d[4 + (i % 2)];
+    normalize(ctx, &pt_n);
+
+    pt.x += pt_n.x;
+    pt.y += pt_n.y;
+    pt.z += pt_n.z;
+  }
+
+  pt.x /= 8.0;
+  pt.y /= 8.0;
+  pt.z /= 8.0;
+  normalize(ctx, &pt);
+
+  cart2geog(ctx, &pt, &g);
+  out->x = longitude_degrees_normalize(ctx, rad2deg(g.lon));
+  out->y = latitude_degrees_normalize(ctx, rad2deg(g.lat));
+
+  return RT_SUCCESS;
 }
 
 /**
@@ -307,61 +307,61 @@ gbox_centroid(const RTCTX *ctx, const RTGBOX* gbox, RTPOINT2D* out)
 */
 static int gbox_check_poles(const RTCTX *ctx, RTGBOX *gbox)
 {
-	int rv = RT_FALSE;
-	RTDEBUG(4, "checking poles");
-	RTDEBUGF(4, "gbox %s", gbox_to_string(ctx, gbox));
-	/* Z axis */
-	if ( gbox->xmin < 0.0 && gbox->xmax > 0.0 &&
-	     gbox->ymin < 0.0 && gbox->ymax > 0.0 )
-	{
-		if ( (gbox->zmin + gbox->zmax) > 0.0 )
-		{
-			RTDEBUG(4, "enclosed positive z axis");
-			gbox->zmax = 1.0;
-		}
-		else
-		{
-			RTDEBUG(4, "enclosed negative z axis");
-			gbox->zmin = -1.0;
-		}
-		rv = RT_TRUE;
-	}
-
-	/* Y axis */
-	if ( gbox->xmin < 0.0 && gbox->xmax > 0.0 &&
-	     gbox->zmin < 0.0 && gbox->zmax > 0.0 )
-	{
-		if ( gbox->ymin + gbox->ymax > 0.0 )
-		{
-			RTDEBUG(4, "enclosed positive y axis");
-			gbox->ymax = 1.0;
-		}
-		else
-		{
-			RTDEBUG(4, "enclosed negative y axis");
-			gbox->ymin = -1.0;
-		}
-		rv = RT_TRUE;
-	}
-
-	/* X axis */
-	if ( gbox->ymin < 0.0 && gbox->ymax > 0.0 &&
-	     gbox->zmin < 0.0 && gbox->zmax > 0.0 )
-	{
-		if ( gbox->xmin + gbox->xmax > 0.0 )
-		{
-			RTDEBUG(4, "enclosed positive x axis");
-			gbox->xmax = 1.0;
-		}
-		else
-		{
-			RTDEBUG(4, "enclosed negative x axis");
-			gbox->xmin = -1.0;
-		}
-		rv = RT_TRUE;
-	}
-
-	return rv;
+  int rv = RT_FALSE;
+  RTDEBUG(4, "checking poles");
+  RTDEBUGF(4, "gbox %s", gbox_to_string(ctx, gbox));
+  /* Z axis */
+  if ( gbox->xmin < 0.0 && gbox->xmax > 0.0 &&
+       gbox->ymin < 0.0 && gbox->ymax > 0.0 )
+  {
+    if ( (gbox->zmin + gbox->zmax) > 0.0 )
+    {
+      RTDEBUG(4, "enclosed positive z axis");
+      gbox->zmax = 1.0;
+    }
+    else
+    {
+      RTDEBUG(4, "enclosed negative z axis");
+      gbox->zmin = -1.0;
+    }
+    rv = RT_TRUE;
+  }
+
+  /* Y axis */
+  if ( gbox->xmin < 0.0 && gbox->xmax > 0.0 &&
+       gbox->zmin < 0.0 && gbox->zmax > 0.0 )
+  {
+    if ( gbox->ymin + gbox->ymax > 0.0 )
+    {
+      RTDEBUG(4, "enclosed positive y axis");
+      gbox->ymax = 1.0;
+    }
+    else
+    {
+      RTDEBUG(4, "enclosed negative y axis");
+      gbox->ymin = -1.0;
+    }
+    rv = RT_TRUE;
+  }
+
+  /* X axis */
+  if ( gbox->ymin < 0.0 && gbox->ymax > 0.0 &&
+       gbox->zmin < 0.0 && gbox->zmax > 0.0 )
+  {
+    if ( gbox->xmin + gbox->xmax > 0.0 )
+    {
+      RTDEBUG(4, "enclosed positive x axis");
+      gbox->xmax = 1.0;
+    }
+    else
+    {
+      RTDEBUG(4, "enclosed negative x axis");
+      gbox->xmin = -1.0;
+    }
+    rv = RT_TRUE;
+  }
+
+  return rv;
 }
 
 /**
@@ -369,18 +369,18 @@ static int gbox_check_poles(const RTCTX *ctx, RTGBOX *gbox)
 */
 void geog2cart(const RTCTX *ctx, const GEOGRAPHIC_POINT *g, POINT3D *p)
 {
-	p->x = cos(g->lat) * cos(g->lon);
-	p->y = cos(g->lat) * sin(g->lon);
-	p->z = sin(g->lat);
+  p->x = cos(g->lat) * cos(g->lon);
+  p->y = cos(g->lat) * sin(g->lon);
+  p->z = sin(g->lat);
 }
 
 /**
-* Convert cartesion coordinates on unit sphere to spherical coordinates 
+* Convert cartesion coordinates on unit sphere to spherical coordinates
 */
 void cart2geog(const RTCTX *ctx, const POINT3D *p, GEOGRAPHIC_POINT *g)
 {
-	g->lon = atan2(p->y, p->x);
-	g->lat = asin(p->z);
+  g->lon = atan2(p->y, p->x);
+  g->lat = asin(p->z);
 }
 
 /**
@@ -388,20 +388,20 @@ void cart2geog(const RTCTX *ctx, const POINT3D *p, GEOGRAPHIC_POINT *g)
 */
 void ll2cart(const RTCTX *ctx, const RTPOINT2D *g, POINT3D *p)
 {
-	double x_rad = M_PI * g->x / 180.0;
-	double y_rad = M_PI * g->y / 180.0;
-	double cos_y_rad = cos(y_rad);
-	p->x = cos_y_rad * cos(x_rad);
-	p->y = cos_y_rad * sin(x_rad);
-	p->z = sin(y_rad);
+  double x_rad = M_PI * g->x / 180.0;
+  double y_rad = M_PI * g->y / 180.0;
+  double cos_y_rad = cos(y_rad);
+  p->x = cos_y_rad * cos(x_rad);
+  p->y = cos_y_rad * sin(x_rad);
+  p->z = sin(y_rad);
 }
 
 /**
-* Convert cartesion coordinates on unit sphere to lon/lat coordinates 
+* Convert cartesion coordinates on unit sphere to lon/lat coordinates
 static void cart2ll(const POINT3D *p, RTPOINT2D *g)
 {
-	g->x = longitude_degrees_normalize(ctx, 180.0 * atan2(p->y, p->x) / M_PI);
-	g->y = latitude_degrees_normalize(ctx, 180.0 * asin(p->z) / M_PI);
+  g->x = longitude_degrees_normalize(ctx, 180.0 * atan2(p->y, p->x) / M_PI);
+  g->y = latitude_degrees_normalize(ctx, 180.0 * asin(p->z) / M_PI);
 }
 */
 
@@ -411,7 +411,7 @@ static void cart2ll(const POINT3D *p, RTPOINT2D *g)
 */
 static double dot_product(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2)
 {
-	return (p1->x*p2->x) + (p1->y*p2->y) + (p1->z*p2->z);
+  return (p1->x*p2->x) + (p1->y*p2->y) + (p1->z*p2->z);
 }
 
 /**
@@ -419,10 +419,10 @@ static double dot_product(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2
 */
 static void cross_product(const RTCTX *ctx, const POINT3D *a, const POINT3D *b, POINT3D *n)
 {
-	n->x = a->y * b->z - a->z * b->y;
-	n->y = a->z * b->x - a->x * b->z;
-	n->z = a->x * b->y - a->y * b->x;
-	return;
+  n->x = a->y * b->z - a->z * b->y;
+  n->y = a->z * b->x - a->x * b->z;
+  n->z = a->x * b->y - a->y * b->x;
+  return;
 }
 
 /**
@@ -430,10 +430,10 @@ static void cross_product(const RTCTX *ctx, const POINT3D *a, const POINT3D *b,
 */
 void vector_sum(const RTCTX *ctx, const POINT3D *a, const POINT3D *b, POINT3D *n)
 {
-	n->x = a->x + b->x;
-	n->y = a->y + b->y;
-	n->z = a->z + b->z;
-	return;
+  n->x = a->x + b->x;
+  n->y = a->y + b->y;
+  n->z = a->z + b->z;
+  return;
 }
 
 /**
@@ -441,10 +441,10 @@ void vector_sum(const RTCTX *ctx, const POINT3D *a, const POINT3D *b, POINT3D *n
 */
 static void vector_difference(const RTCTX *ctx, const POINT3D *a, const POINT3D *b, POINT3D *n)
 {
-	n->x = a->x - b->x;
-	n->y = a->y - b->y;
-	n->z = a->z - b->z;
-	return;
+  n->x = a->x - b->x;
+  n->y = a->y - b->y;
+  n->z = a->z - b->z;
+  return;
 }
 
 /**
@@ -452,16 +452,16 @@ static void vector_difference(const RTCTX *ctx, const POINT3D *a, const POINT3D
 */
 static void vector_scale(const RTCTX *ctx, POINT3D *n, double scale)
 {
-	n->x *= scale;
-	n->y *= scale;
-	n->z *= scale;
-	return;
+  n->x *= scale;
+  n->y *= scale;
+  n->z *= scale;
+  return;
 }
 
 /*
 * static inline double vector_magnitude(const POINT3D* v)
 * {
-*	return sqrt(v->x*v->x + v->y*v->y + v->z*v->z);
+*  return sqrt(v->x*v->x + v->y*v->y + v->z*v->z);
 * }
 */
 
@@ -470,18 +470,18 @@ static void vector_scale(const RTCTX *ctx, POINT3D *n, double scale)
 */
 double vector_angle(const RTCTX *ctx, const POINT3D* v1, const POINT3D* v2)
 {
-	POINT3D v3, normal;
-	double angle, x, y;
+  POINT3D v3, normal;
+  double angle, x, y;
+
+  cross_product(ctx, v1, v2, &normal);
+  normalize(ctx, &normal);
+  cross_product(ctx, &normal, v1, &v3);
 
-	cross_product(ctx, v1, v2, &normal);
-	normalize(ctx, &normal);
-	cross_product(ctx, &normal, v1, &v3);
-	
-	x = dot_product(ctx, v1, v2);
-	y = dot_product(ctx, v2, &v3);
-	
-	angle = atan2(y, x);
-	return angle;
+  x = dot_product(ctx, v1, v2);
+  y = dot_product(ctx, v2, &v3);
+
+  angle = atan2(y, x);
+  return angle;
 }
 
 /**
@@ -489,15 +489,15 @@ double vector_angle(const RTCTX *ctx, const POINT3D* v1, const POINT3D* v2)
 */
 static void normalize2d(const RTCTX *ctx, RTPOINT2D *p)
 {
-	double d = sqrt(p->x*p->x + p->y*p->y);
-	if (FP_IS_ZERO(d))
-	{
-		p->x = p->y = 0.0;
-		return;
-	}
-	p->x = p->x / d;
-	p->y = p->y / d;
-	return;
+  double d = sqrt(p->x*p->x + p->y*p->y);
+  if (FP_IS_ZERO(d))
+  {
+    p->x = p->y = 0.0;
+    return;
+  }
+  p->x = p->x / d;
+  p->y = p->y / d;
+  return;
 }
 
 /**
@@ -506,73 +506,73 @@ static void normalize2d(const RTCTX *ctx, RTPOINT2D *p)
 */
 void unit_normal(const RTCTX *ctx, const POINT3D *P1, const POINT3D *P2, POINT3D *normal)
 {
-	double p_dot = dot_product(ctx, P1, P2);
-	POINT3D P3;
-	
-	/* If edge is really large, calculate a narrower equivalent angle A1/A3. */
-	if ( p_dot < 0 )
-	{
-		vector_sum(ctx, P1, P2, &P3);
-		normalize(ctx, &P3);
-	}
-	/* If edge is narrow, calculate a wider equivalent angle A1/A3. */
-	else if ( p_dot > 0.95 )
-	{
-		vector_difference(ctx, P2, P1, &P3);
-		normalize(ctx, &P3);
-	}
-	/* Just keep the current angle in A1/A3. */
-	else
-	{
-		P3 = *P2;
-	}
-	
-	/* Normals to the A-plane and B-plane */
-	cross_product(ctx, P1, &P3, normal);
-	normalize(ctx, normal);
-}
-
-/** 
+  double p_dot = dot_product(ctx, P1, P2);
+  POINT3D P3;
+
+  /* If edge is really large, calculate a narrower equivalent angle A1/A3. */
+  if ( p_dot < 0 )
+  {
+    vector_sum(ctx, P1, P2, &P3);
+    normalize(ctx, &P3);
+  }
+  /* If edge is narrow, calculate a wider equivalent angle A1/A3. */
+  else if ( p_dot > 0.95 )
+  {
+    vector_difference(ctx, P2, P1, &P3);
+    normalize(ctx, &P3);
+  }
+  /* Just keep the current angle in A1/A3. */
+  else
+  {
+    P3 = *P2;
+  }
+
+  /* Normals to the A-plane and B-plane */
+  cross_product(ctx, P1, &P3, normal);
+  normalize(ctx, normal);
+}
+
+/**
 * Rotates v1 through an angle (in radians) within the plane defined by v1/v2, returns
 * the rotated vector in n.
 */
 void vector_rotate(const RTCTX *ctx, const POINT3D* v1, const POINT3D* v2, double angle, POINT3D* n)
 {
-	POINT3D u;
-	double cos_a = cos(angle);
-	double sin_a = sin(angle);
-	double uxuy, uyuz, uxuz;
-	double ux2, uy2, uz2;
-	double rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz;
-	
-	/* Need a unit vector normal to rotate around */
-	unit_normal(ctx, v1, v2, &u);
-	
-	uxuy = u.x * u.y;
-	uxuz = u.x * u.z;
-	uyuz = u.y * u.z;
-	
-	ux2 = u.x * u.x;
-	uy2 = u.y * u.y;
-	uz2 = u.z * u.z;
-	
-	rxx = cos_a + ux2 * (1 - cos_a);
-	rxy = uxuy * (1 - cos_a) - u.z * sin_a;
-	rxz = uxuz * (1 - cos_a) + u.y * sin_a;
-	
-	ryx = uxuy * (1 - cos_a) + u.z * sin_a;
-	ryy = cos_a + uy2 * (1 - cos_a);
-	ryz = uyuz * (1 - cos_a) - u.x * sin_a;
-	
-	rzx = uxuz * (1 - cos_a) - u.y * sin_a;
-	rzy = uyuz * (1 - cos_a) + u.x * sin_a;
-	rzz = cos_a + uz2 * (1 - cos_a);
-
-	n->x = rxx * v1->x + rxy * v1->y + rxz * v1->z;
-	n->y = ryx * v1->x + ryy * v1->y + ryz * v1->z;
-	n->z = rzx * v1->x + rzy * v1->y + rzz * v1->z;
-
-	normalize(ctx, n);
+  POINT3D u;
+  double cos_a = cos(angle);
+  double sin_a = sin(angle);
+  double uxuy, uyuz, uxuz;
+  double ux2, uy2, uz2;
+  double rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz;
+
+  /* Need a unit vector normal to rotate around */
+  unit_normal(ctx, v1, v2, &u);
+
+  uxuy = u.x * u.y;
+  uxuz = u.x * u.z;
+  uyuz = u.y * u.z;
+
+  ux2 = u.x * u.x;
+  uy2 = u.y * u.y;
+  uz2 = u.z * u.z;
+
+  rxx = cos_a + ux2 * (1 - cos_a);
+  rxy = uxuy * (1 - cos_a) - u.z * sin_a;
+  rxz = uxuz * (1 - cos_a) + u.y * sin_a;
+
+  ryx = uxuy * (1 - cos_a) + u.z * sin_a;
+  ryy = cos_a + uy2 * (1 - cos_a);
+  ryz = uyuz * (1 - cos_a) - u.x * sin_a;
+
+  rzx = uxuz * (1 - cos_a) - u.y * sin_a;
+  rzy = uyuz * (1 - cos_a) + u.x * sin_a;
+  rzz = cos_a + uz2 * (1 - cos_a);
+
+  n->x = rxx * v1->x + rxy * v1->y + rxz * v1->z;
+  n->y = ryx * v1->x + ryy * v1->y + ryz * v1->z;
+  n->z = rzx * v1->x + rzy * v1->y + rzz * v1->z;
+
+  normalize(ctx, n);
 }
 
 /**
@@ -580,16 +580,16 @@ void vector_rotate(const RTCTX *ctx, const POINT3D* v1, const POINT3D* v2, doubl
 */
 void normalize(const RTCTX *ctx, POINT3D *p)
 {
-	double d = sqrt(p->x*p->x + p->y*p->y + p->z*p->z);
-	if (FP_IS_ZERO(d))
-	{
-		p->x = p->y = p->z = 0.0;
-		return;
-	}
-	p->x = p->x / d;
-	p->y = p->y / d;
-	p->z = p->z / d;
-	return;
+  double d = sqrt(p->x*p->x + p->y*p->y + p->z*p->z);
+  if (FP_IS_ZERO(d))
+  {
+    p->x = p->y = p->z = 0.0;
+    return;
+  }
+  p->x = p->x / d;
+  p->y = p->y / d;
+  p->z = p->z / d;
+  return;
 }
 
 
@@ -599,85 +599,85 @@ void normalize(const RTCTX *ctx, POINT3D *p)
 */
 void robust_cross_product(const RTCTX *ctx, const GEOGRAPHIC_POINT *p, const GEOGRAPHIC_POINT *q, POINT3D *a)
 {
-	double lon_qpp = (q->lon + p->lon) / -2.0;
-	double lon_qmp = (q->lon - p->lon) / 2.0;
-	double sin_p_lat_minus_q_lat = sin(p->lat-q->lat);
-	double sin_p_lat_plus_q_lat = sin(p->lat+q->lat);
-	double sin_lon_qpp = sin(lon_qpp);
-	double sin_lon_qmp = sin(lon_qmp);
-	double cos_lon_qpp = cos(lon_qpp);
-	double cos_lon_qmp = cos(lon_qmp);
-	a->x = sin_p_lat_minus_q_lat * sin_lon_qpp * cos_lon_qmp -
-	       sin_p_lat_plus_q_lat * cos_lon_qpp * sin_lon_qmp;
-	a->y = sin_p_lat_minus_q_lat * cos_lon_qpp * cos_lon_qmp +
-	       sin_p_lat_plus_q_lat * sin_lon_qpp * sin_lon_qmp;
-	a->z = cos(p->lat) * cos(q->lat) * sin(q->lon-p->lon);
+  double lon_qpp = (q->lon + p->lon) / -2.0;
+  double lon_qmp = (q->lon - p->lon) / 2.0;
+  double sin_p_lat_minus_q_lat = sin(p->lat-q->lat);
+  double sin_p_lat_plus_q_lat = sin(p->lat+q->lat);
+  double sin_lon_qpp = sin(lon_qpp);
+  double sin_lon_qmp = sin(lon_qmp);
+  double cos_lon_qpp = cos(lon_qpp);
+  double cos_lon_qmp = cos(lon_qmp);
+  a->x = sin_p_lat_minus_q_lat * sin_lon_qpp * cos_lon_qmp -
+         sin_p_lat_plus_q_lat * cos_lon_qpp * sin_lon_qmp;
+  a->y = sin_p_lat_minus_q_lat * cos_lon_qpp * cos_lon_qmp +
+         sin_p_lat_plus_q_lat * sin_lon_qpp * sin_lon_qmp;
+  a->z = cos(p->lat) * cos(q->lat) * sin(q->lon-p->lon);
 }
 
 void x_to_z(const RTCTX *ctx, POINT3D *p)
 {
-	double tmp = p->z;
-	p->z = p->x;
-	p->x = tmp;
+  double tmp = p->z;
+  p->z = p->x;
+  p->x = tmp;
 }
 
 void y_to_z(const RTCTX *ctx, POINT3D *p)
 {
-	double tmp = p->z;
-	p->z = p->y;
-	p->y = tmp;
+  double tmp = p->z;
+  p->z = p->y;
+  p->y = tmp;
 }
 
 
 int crosses_dateline(const RTCTX *ctx, const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
 {
-	double sign_s = signum(s->lon);
-	double sign_e = signum(e->lon);
-	double ss = fabs(s->lon);
-	double ee = fabs(e->lon);
-	if ( sign_s == sign_e )
-	{
-		return RT_FALSE;
-	}
-	else
-	{
-		double dl = ss + ee;
-		if ( dl < M_PI )
-			return RT_FALSE;
-		else if ( FP_EQUALS(dl, M_PI) )
-			return RT_FALSE;
-		else
-			return RT_TRUE;
-	}
+  double sign_s = signum(s->lon);
+  double sign_e = signum(e->lon);
+  double ss = fabs(s->lon);
+  double ee = fabs(e->lon);
+  if ( sign_s == sign_e )
+  {
+    return RT_FALSE;
+  }
+  else
+  {
+    double dl = ss + ee;
+    if ( dl < M_PI )
+      return RT_FALSE;
+    else if ( FP_EQUALS(dl, M_PI) )
+      return RT_FALSE;
+    else
+      return RT_TRUE;
+  }
 }
 
 /**
 * Returns -1 if the point is to the left of the plane formed
-* by the edge, 1 if the point is to the right, and 0 if the 
+* by the edge, 1 if the point is to the right, and 0 if the
 * point is on the plane.
 */
-static int 
+static int
 edge_point_side(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
-	POINT3D normal, pt;
-	double w;
-	/* Normal to the plane defined by e */
-	robust_cross_product(ctx, &(e->start), &(e->end), &normal);
-	normalize(ctx, &normal);
-	geog2cart(ctx, p, &pt);
-	/* We expect the dot product of with normal with any vector in the plane to be zero */
-	w = dot_product(ctx, &normal, &pt);
-	RTDEBUGF(4,"dot product %.9g",w);
-	if ( FP_IS_ZERO(w) )
-	{
-		RTDEBUG(4, "point is on plane (dot product is zero)");
-		return 0;
-	}
-	
-	if ( w < 0 )
-		return -1;
-	else 
-		return 1;
+  POINT3D normal, pt;
+  double w;
+  /* Normal to the plane defined by e */
+  robust_cross_product(ctx, &(e->start), &(e->end), &normal);
+  normalize(ctx, &normal);
+  geog2cart(ctx, p, &pt);
+  /* We expect the dot product of with normal with any vector in the plane to be zero */
+  w = dot_product(ctx, &normal, &pt);
+  RTDEBUGF(4,"dot product %.9g",w);
+  if ( FP_IS_ZERO(w) )
+  {
+    RTDEBUG(4, "point is on plane (dot product is zero)");
+    return 0;
+  }
+
+  if ( w < 0 )
+    return -1;
+  else
+    return 1;
 }
 
 /**
@@ -686,16 +686,16 @@ edge_point_side(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POI
 static double
 sphere_angle(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b,  const GEOGRAPHIC_POINT *c)
 {
-	POINT3D normal1, normal2;
-	robust_cross_product(ctx, b, a, &normal1);
-	robust_cross_product(ctx, b, c, &normal2);
-	normalize(ctx, &normal1);
-	normalize(ctx, &normal2);
-	return sphere_distance_cartesian(ctx, &normal1, &normal2);	
+  POINT3D normal1, normal2;
+  robust_cross_product(ctx, b, a, &normal1);
+  robust_cross_product(ctx, b, c, &normal2);
+  normalize(ctx, &normal1);
+  normalize(ctx, &normal2);
+  return sphere_distance_cartesian(ctx, &normal1, &normal2);
 }
 
 /**
-* Computes the spherical area of a triangle. If C is to the left of A/B, 
+* Computes the spherical area of a triangle. If C is to the left of A/B,
 * the area is negative. If C is to the right of A/B, the area is positive.
 *
 * @param a The first triangle vertex.
@@ -703,31 +703,31 @@ sphere_angle(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT
 * @param c The last triangle vertex.
 * @return the signed area in radians.
 */
-static double 
+static double
 sphere_signed_area(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const GEOGRAPHIC_POINT *c)
 {
-	double angle_a, angle_b, angle_c;
-	double area_radians = 0.0;
-	int side;
-	GEOGRAPHIC_EDGE e;
-	
-	angle_a = sphere_angle(ctx, b,a,c);
-	angle_b = sphere_angle(ctx, a,b,c);
-	angle_c = sphere_angle(ctx, b,c,a);
-	
-	area_radians = angle_a + angle_b + angle_c - M_PI;
+  double angle_a, angle_b, angle_c;
+  double area_radians = 0.0;
+  int side;
+  GEOGRAPHIC_EDGE e;
+
+  angle_a = sphere_angle(ctx, b,a,c);
+  angle_b = sphere_angle(ctx, a,b,c);
+  angle_c = sphere_angle(ctx, b,c,a);
+
+  area_radians = angle_a + angle_b + angle_c - M_PI;
+
+  /* What's the direction of the B/C edge? */
+  e.start = *a;
+  e.end = *b;
+  side = edge_point_side(ctx, &e, c);
 
-	/* What's the direction of the B/C edge? */
-	e.start = *a;
-	e.end = *b;
-	side = edge_point_side(ctx, &e, c);
-	
-	/* Co-linear points implies no area */
-	if ( side == 0 ) 
-		return 0.0;
+  /* Co-linear points implies no area */
+  if ( side == 0 )
+    return 0.0;
 
-	/* Add the sign to the area */
-	return side * area_radians;
+  /* Add the sign to the area */
+  return side * area_radians;
 }
 
 
@@ -740,11 +740,11 @@ sphere_signed_area(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC
 */
 int edge_point_on_plane(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
-	int side = edge_point_side(ctx, e, p);
-	if ( side == 0 )
-		return RT_TRUE;
-		
-	return RT_FALSE;
+  int side = edge_point_side(ctx, e, p);
+  if ( side == 0 )
+    return RT_TRUE;
+
+  return RT_FALSE;
 }
 
 /**
@@ -753,46 +753,46 @@ int edge_point_on_plane(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRA
 */
 int edge_point_in_cone(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
-	POINT3D vcp, vs, ve, vp;
-	double vs_dot_vcp, vp_dot_vcp;
-	geog2cart(ctx, &(e->start), &vs);
-	geog2cart(ctx, &(e->end), &ve);
-	/* Antipodal case, everything is inside. */
-	if ( vs.x == -1.0 * ve.x && vs.y == -1.0 * ve.y && vs.z == -1.0 * ve.z )
-		return RT_TRUE;
-	geog2cart(ctx, p, &vp);
-	/* The normalized sum bisects the angle between start and end. */
-	vector_sum(ctx, &vs, &ve, &vcp);
-	normalize(ctx, &vcp);
-	/* The projection of start onto the center defines the minimum similarity */
-	vs_dot_vcp = dot_product(ctx, &vs, &vcp);
-	RTDEBUGF(4,"vs_dot_vcp %.19g",vs_dot_vcp);
-	/* The projection of candidate p onto the center */
-	vp_dot_vcp = dot_product(ctx, &vp, &vcp);
-	RTDEBUGF(4,"vp_dot_vcp %.19g",vp_dot_vcp);
-	/* If p is more similar than start then p is inside the cone */
-	RTDEBUGF(4,"fabs(vp_dot_vcp - vs_dot_vcp) %.39g",fabs(vp_dot_vcp - vs_dot_vcp));
-
-	/*
-	** We want to test that vp_dot_vcp is >= vs_dot_vcp but there are
-	** numerical stability issues for values that are very very nearly
-	** equal. Unfortunately there are also values of vp_dot_vcp that are legitimately
-	** very close to but still less than vs_dot_vcp which we also need to catch.
-	** The tolerance of 10-17 seems to do the trick on 32-bit and 64-bit architectures,
-	** for the test cases here.
-	** However, tuning the tolerance value feels like a dangerous hack.
-	** Fundamentally, the problem is that this test is so sensitive.
-	*/
-
-	/* 1.1102230246251565404236316680908203125e-16 */
-
-	if ( vp_dot_vcp > vs_dot_vcp || fabs(vp_dot_vcp - vs_dot_vcp) < 2e-16 )
-	{
-		RTDEBUG(4, "point is in cone");
-		return RT_TRUE;
-	}
-	RTDEBUG(4, "point is not in cone");
-	return RT_FALSE;
+  POINT3D vcp, vs, ve, vp;
+  double vs_dot_vcp, vp_dot_vcp;
+  geog2cart(ctx, &(e->start), &vs);
+  geog2cart(ctx, &(e->end), &ve);
+  /* Antipodal case, everything is inside. */
+  if ( vs.x == -1.0 * ve.x && vs.y == -1.0 * ve.y && vs.z == -1.0 * ve.z )
+    return RT_TRUE;
+  geog2cart(ctx, p, &vp);
+  /* The normalized sum bisects the angle between start and end. */
+  vector_sum(ctx, &vs, &ve, &vcp);
+  normalize(ctx, &vcp);
+  /* The projection of start onto the center defines the minimum similarity */
+  vs_dot_vcp = dot_product(ctx, &vs, &vcp);
+  RTDEBUGF(4,"vs_dot_vcp %.19g",vs_dot_vcp);
+  /* The projection of candidate p onto the center */
+  vp_dot_vcp = dot_product(ctx, &vp, &vcp);
+  RTDEBUGF(4,"vp_dot_vcp %.19g",vp_dot_vcp);
+  /* If p is more similar than start then p is inside the cone */
+  RTDEBUGF(4,"fabs(vp_dot_vcp - vs_dot_vcp) %.39g",fabs(vp_dot_vcp - vs_dot_vcp));
+
+  /*
+  ** We want to test that vp_dot_vcp is >= vs_dot_vcp but there are
+  ** numerical stability issues for values that are very very nearly
+  ** equal. Unfortunately there are also values of vp_dot_vcp that are legitimately
+  ** very close to but still less than vs_dot_vcp which we also need to catch.
+  ** The tolerance of 10-17 seems to do the trick on 32-bit and 64-bit architectures,
+  ** for the test cases here.
+  ** However, tuning the tolerance value feels like a dangerous hack.
+  ** Fundamentally, the problem is that this test is so sensitive.
+  */
+
+  /* 1.1102230246251565404236316680908203125e-16 */
+
+  if ( vp_dot_vcp > vs_dot_vcp || fabs(vp_dot_vcp - vs_dot_vcp) < 2e-16 )
+  {
+    RTDEBUG(4, "point is in cone");
+    return RT_TRUE;
+  }
+  RTDEBUG(4, "point is not in cone");
+  return RT_FALSE;
 }
 
 /**
@@ -800,111 +800,111 @@ int edge_point_in_cone(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAP
 */
 int edge_contains_coplanar_point(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
-	GEOGRAPHIC_EDGE g;
-	GEOGRAPHIC_POINT q;
-	double slon = fabs((e->start).lon) + fabs((e->end).lon);
-	double dlon = fabs(fabs((e->start).lon) - fabs((e->end).lon));
-	double slat = (e->start).lat + (e->end).lat;
-
-	RTDEBUGF(4, "e.start == GPOINT(%.6g %.6g) ", (e->start).lat, (e->start).lon);
-	RTDEBUGF(4, "e.end == GPOINT(%.6g %.6g) ", (e->end).lat, (e->end).lon);
-	RTDEBUGF(4, "p == GPOINT(%.6g %.6g) ", p->lat, p->lon);
-
-	/* Copy values into working registers */
-	g = *e;
-	q = *p;
-
-	/* Vertical plane, we need to do this calculation in latitude */
-	if ( FP_EQUALS( g.start.lon, g.end.lon ) )
-	{
-		RTDEBUG(4, "vertical plane, we need to do this calculation in latitude");
-		/* Supposed to be co-planar... */
-		if ( ! FP_EQUALS( q.lon, g.start.lon ) )
-			return RT_FALSE;
-
-		if ( ( g.start.lat <= q.lat && q.lat <= g.end.lat ) ||
-		     ( g.end.lat <= q.lat && q.lat <= g.start.lat ) )
-		{
-			return RT_TRUE;
-		}
-		else
-		{
-			return RT_FALSE;
-		}
-	}
-
-	/* Over the pole, we need normalize latitude and do this calculation in latitude */
-	if ( FP_EQUALS( slon, M_PI ) && ( signum(g.start.lon) != signum(g.end.lon) || FP_EQUALS(dlon, M_PI) ) )
-	{
-		RTDEBUG(4, "over the pole...");
-		/* Antipodal, everything (or nothing?) is inside */
-		if ( FP_EQUALS( slat, 0.0 ) )
-			return RT_TRUE;
-
-		/* Point *is* the north pole */
-		if ( slat > 0.0 && FP_EQUALS(q.lat, M_PI_2 ) )
-			return RT_TRUE;
-
-		/* Point *is* the south pole */
-		if ( slat < 0.0 && FP_EQUALS(q.lat, -1.0 * M_PI_2) )
-			return RT_TRUE;
-
-		RTDEBUG(4, "coplanar?...");
-
-		/* Supposed to be co-planar... */
-		if ( ! FP_EQUALS( q.lon, g.start.lon ) )
-			return RT_FALSE;
-
-		RTDEBUG(4, "north or south?...");
-
-		/* Over north pole, test based on south pole */
-		if ( slat > 0.0 )
-		{
-			RTDEBUG(4, "over the north pole...");
-			if ( q.lat > FP_MIN(g.start.lat, g.end.lat) )
-				return RT_TRUE;
-			else
-				return RT_FALSE;
-		}
-		else
-			/* Over south pole, test based on north pole */
-		{
-			RTDEBUG(4, "over the south pole...");
-			if ( q.lat < FP_MAX(g.start.lat, g.end.lat) )
-				return RT_TRUE;
-			else
-				return RT_FALSE;
-		}
-	}
-
-	/* Dateline crossing, flip everything to the opposite hemisphere */
-	else if ( slon > M_PI && ( signum(g.start.lon) != signum(g.end.lon) ) )
-	{
-		RTDEBUG(4, "crosses dateline, flip longitudes...");
-		if ( g.start.lon > 0.0 )
-			g.start.lon -= M_PI;
-		else
-			g.start.lon += M_PI;
-		if ( g.end.lon > 0.0 )
-			g.end.lon -= M_PI;
-		else
-			g.end.lon += M_PI;
-
-		if ( q.lon > 0.0 )
-			q.lon -= M_PI;
-		else
-			q.lon += M_PI;
-	}
-
-	if ( ( g.start.lon <= q.lon && q.lon <= g.end.lon ) ||
-	     ( g.end.lon <= q.lon && q.lon <= g.start.lon ) )
-	{
-		RTDEBUG(4, "true, this edge contains point");
-		return RT_TRUE;
-	}
-
-	RTDEBUG(4, "false, this edge does not contain point");
-	return RT_FALSE;
+  GEOGRAPHIC_EDGE g;
+  GEOGRAPHIC_POINT q;
+  double slon = fabs((e->start).lon) + fabs((e->end).lon);
+  double dlon = fabs(fabs((e->start).lon) - fabs((e->end).lon));
+  double slat = (e->start).lat + (e->end).lat;
+
+  RTDEBUGF(4, "e.start == GPOINT(%.6g %.6g) ", (e->start).lat, (e->start).lon);
+  RTDEBUGF(4, "e.end == GPOINT(%.6g %.6g) ", (e->end).lat, (e->end).lon);
+  RTDEBUGF(4, "p == GPOINT(%.6g %.6g) ", p->lat, p->lon);
+
+  /* Copy values into working registers */
+  g = *e;
+  q = *p;
+
+  /* Vertical plane, we need to do this calculation in latitude */
+  if ( FP_EQUALS( g.start.lon, g.end.lon ) )
+  {
+    RTDEBUG(4, "vertical plane, we need to do this calculation in latitude");
+    /* Supposed to be co-planar... */
+    if ( ! FP_EQUALS( q.lon, g.start.lon ) )
+      return RT_FALSE;
+
+    if ( ( g.start.lat <= q.lat && q.lat <= g.end.lat ) ||
+         ( g.end.lat <= q.lat && q.lat <= g.start.lat ) )
+    {
+      return RT_TRUE;
+    }
+    else
+    {
+      return RT_FALSE;
+    }
+  }
+
+  /* Over the pole, we need normalize latitude and do this calculation in latitude */
+  if ( FP_EQUALS( slon, M_PI ) && ( signum(g.start.lon) != signum(g.end.lon) || FP_EQUALS(dlon, M_PI) ) )
+  {
+    RTDEBUG(4, "over the pole...");
+    /* Antipodal, everything (or nothing?) is inside */
+    if ( FP_EQUALS( slat, 0.0 ) )
+      return RT_TRUE;
+
+    /* Point *is* the north pole */
+    if ( slat > 0.0 && FP_EQUALS(q.lat, M_PI_2 ) )
+      return RT_TRUE;
+
+    /* Point *is* the south pole */
+    if ( slat < 0.0 && FP_EQUALS(q.lat, -1.0 * M_PI_2) )
+      return RT_TRUE;
+
+    RTDEBUG(4, "coplanar?...");
+
+    /* Supposed to be co-planar... */
+    if ( ! FP_EQUALS( q.lon, g.start.lon ) )
+      return RT_FALSE;
+
+    RTDEBUG(4, "north or south?...");
+
+    /* Over north pole, test based on south pole */
+    if ( slat > 0.0 )
+    {
+      RTDEBUG(4, "over the north pole...");
+      if ( q.lat > FP_MIN(g.start.lat, g.end.lat) )
+        return RT_TRUE;
+      else
+        return RT_FALSE;
+    }
+    else
+      /* Over south pole, test based on north pole */
+    {
+      RTDEBUG(4, "over the south pole...");
+      if ( q.lat < FP_MAX(g.start.lat, g.end.lat) )
+        return RT_TRUE;
+      else
+        return RT_FALSE;
+    }
+  }
+
+  /* Dateline crossing, flip everything to the opposite hemisphere */
+  else if ( slon > M_PI && ( signum(g.start.lon) != signum(g.end.lon) ) )
+  {
+    RTDEBUG(4, "crosses dateline, flip longitudes...");
+    if ( g.start.lon > 0.0 )
+      g.start.lon -= M_PI;
+    else
+      g.start.lon += M_PI;
+    if ( g.end.lon > 0.0 )
+      g.end.lon -= M_PI;
+    else
+      g.end.lon += M_PI;
+
+    if ( q.lon > 0.0 )
+      q.lon -= M_PI;
+    else
+      q.lon += M_PI;
+  }
+
+  if ( ( g.start.lon <= q.lon && q.lon <= g.end.lon ) ||
+       ( g.end.lon <= q.lon && q.lon <= g.start.lon ) )
+  {
+    RTDEBUG(4, "true, this edge contains point");
+    return RT_TRUE;
+  }
+
+  RTDEBUG(4, "false, this edge does not contain point");
+  return RT_FALSE;
 }
 
 
@@ -913,18 +913,18 @@ int edge_contains_coplanar_point(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, con
 */
 double sphere_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
 {
-	double d_lon = e->lon - s->lon;
-	double cos_d_lon = cos(d_lon);
-	double cos_lat_e = cos(e->lat);
-	double sin_lat_e = sin(e->lat);
-	double cos_lat_s = cos(s->lat);
-	double sin_lat_s = sin(s->lat);
+  double d_lon = e->lon - s->lon;
+  double cos_d_lon = cos(d_lon);
+  double cos_lat_e = cos(e->lat);
+  double sin_lat_e = sin(e->lat);
+  double cos_lat_s = cos(s->lat);
+  double sin_lat_s = sin(s->lat);
 
-	double a1 = POW2(cos_lat_e * sin(d_lon));
-	double a2 = POW2(cos_lat_s * sin_lat_e - sin_lat_s * cos_lat_e * cos_d_lon);
-	double a = sqrt(a1 + a2);
-	double b = sin_lat_s * sin_lat_e + cos_lat_s * cos_lat_e * cos_d_lon;
-	return atan2(a, b);
+  double a1 = POW2(cos_lat_e * sin(d_lon));
+  double a2 = POW2(cos_lat_s * sin_lat_e - sin_lat_s * cos_lat_e * cos_d_lon);
+  double a = sqrt(a1 + a2);
+  double b = sin_lat_s * sin_lat_e + cos_lat_s * cos_lat_e * cos_d_lon;
+  return atan2(a, b);
 }
 
 /**
@@ -932,7 +932,7 @@ double sphere_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *s, const GEOGRA
 */
 double sphere_distance_cartesian(const RTCTX *ctx, const POINT3D *s, const POINT3D *e)
 {
-	return acos(dot_product(ctx, s, e));
+  return acos(dot_product(ctx, s, e));
 }
 
 /**
@@ -940,28 +940,28 @@ double sphere_distance_cartesian(const RTCTX *ctx, const POINT3D *s, const POINT
 */
 double sphere_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e, double d)
 {
-	double heading = 0.0;
-	double f;
-	
-	/* Starting from the poles? Special case. */
-	if ( FP_IS_ZERO(cos(s->lat)) )
-		return (s->lat > 0.0) ? M_PI : 0.0;
+  double heading = 0.0;
+  double f;
+
+  /* Starting from the poles? Special case. */
+  if ( FP_IS_ZERO(cos(s->lat)) )
+    return (s->lat > 0.0) ? M_PI : 0.0;
 
-	f = (sin(e->lat) - sin(s->lat) * cos(d)) / (sin(d) * cos(s->lat));
-	if ( FP_EQUALS(f, 1.0) )
-		heading = 0.0;
-	else if ( fabs(f) > 1.0 )
-	{
-		RTDEBUGF(4, "f = %g", f);
-		heading = acos(f);
-	}
-	else
-		heading = acos(f);
+  f = (sin(e->lat) - sin(s->lat) * cos(d)) / (sin(d) * cos(s->lat));
+  if ( FP_EQUALS(f, 1.0) )
+    heading = 0.0;
+  else if ( fabs(f) > 1.0 )
+  {
+    RTDEBUGF(4, "f = %g", f);
+    heading = acos(f);
+  }
+  else
+    heading = acos(f);
 
-	if ( sin(e->lon - s->lon) < 0.0 )
-		heading = -1 * heading;
+  if ( sin(e->lon - s->lon) < 0.0 )
+    heading = -1 * heading;
 
-	return heading;
+  return heading;
 }
 
 #if 0 /* unused */
@@ -978,15 +978,15 @@ double sphere_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *s, const GEOGR
 */
 static double sphere_excess(const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const GEOGRAPHIC_POINT *c)
 {
-	double a_dist = sphere_distance(ctx, b, c);
-	double b_dist = sphere_distance(ctx, c, a);
-	double c_dist = sphere_distance(ctx, a, b);
-	double hca = sphere_direction(ctx, c, a, b_dist);
-	double hcb = sphere_direction(ctx, c, b, a_dist);
-	double sign = signum(hcb-hca);
-	double ss = (a_dist + b_dist + c_dist) / 2.0;
-	double E = tan(ss/2.0)*tan((ss-a_dist)/2.0)*tan((ss-b_dist)/2.0)*tan((ss-c_dist)/2.0);
-	return 4.0 * atan(sqrt(fabs(E))) * sign;
+  double a_dist = sphere_distance(ctx, b, c);
+  double b_dist = sphere_distance(ctx, c, a);
+  double c_dist = sphere_distance(ctx, a, b);
+  double hca = sphere_direction(ctx, c, a, b_dist);
+  double hcb = sphere_direction(ctx, c, b, a_dist);
+  double sign = signum(hcb-hca);
+  double ss = (a_dist + b_dist + c_dist) / 2.0;
+  double E = tan(ss/2.0)*tan((ss-a_dist)/2.0)*tan((ss-b_dist)/2.0)*tan((ss-c_dist)/2.0);
+  return 4.0 * atan(sqrt(fabs(E))) * sign;
 }
 #endif
 
@@ -997,14 +997,14 @@ static double sphere_excess(const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b
 */
 int edge_contains_point(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
-	if ( edge_point_in_cone(ctx, e, p) && edge_point_on_plane(ctx, e, p) )
-		/*	if ( edge_contains_coplanar_point(ctx, e, p) && edge_point_on_plane(ctx, e, p) ) */
-	{
-		RTDEBUG(4, "point is on edge");
-		return RT_TRUE;
-	}
-	RTDEBUG(4, "point is not on edge");
-	return RT_FALSE;
+  if ( edge_point_in_cone(ctx, e, p) && edge_point_on_plane(ctx, e, p) )
+    /*  if ( edge_contains_coplanar_point(ctx, e, p) && edge_point_on_plane(ctx, e, p) ) */
+  {
+    RTDEBUG(4, "point is on edge");
+    return RT_TRUE;
+  }
+  RTDEBUG(4, "point is not on edge");
+  return RT_FALSE;
 }
 
 /**
@@ -1012,24 +1012,24 @@ int edge_contains_point(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRA
 */
 double z_to_latitude(const RTCTX *ctx, double z, int top)
 {
-	double sign = signum(z);
-	double tlat = acos(z);
-	RTDEBUGF(4, "inputs: z(%.8g) sign(%.8g) tlat(%.8g)", z, sign, tlat);
-	if (FP_IS_ZERO(z))
-	{
-		if (top) return M_PI_2;
-		else return -1.0 * M_PI_2;
-	}
-	if (fabs(tlat) > M_PI_2 )
-	{
-		tlat = sign * (M_PI - fabs(tlat));
-	}
-	else
-	{
-		tlat = sign * tlat;
-	}
-	RTDEBUGF(4, "output: tlat(%.8g)", tlat);
-	return tlat;
+  double sign = signum(z);
+  double tlat = acos(z);
+  RTDEBUGF(4, "inputs: z(%.8g) sign(%.8g) tlat(%.8g)", z, sign, tlat);
+  if (FP_IS_ZERO(z))
+  {
+    if (top) return M_PI_2;
+    else return -1.0 * M_PI_2;
+  }
+  if (fabs(tlat) > M_PI_2 )
+  {
+    tlat = sign * (M_PI - fabs(tlat));
+  }
+  else
+  {
+    tlat = sign * tlat;
+  }
+  RTDEBUGF(4, "output: tlat(%.8g)", tlat);
+  return tlat;
 }
 
 /**
@@ -1039,22 +1039,22 @@ double z_to_latitude(const RTCTX *ctx, double z, int top)
 */
 int clairaut_cartesian(const RTCTX *ctx, const POINT3D *start, const POINT3D *end, GEOGRAPHIC_POINT *g_top, GEOGRAPHIC_POINT *g_bottom)
 {
-	POINT3D t1, t2;
-	GEOGRAPHIC_POINT vN1, vN2;
-	RTDEBUG(4,"entering function");
-	unit_normal(ctx, start, end, &t1);
-	unit_normal(ctx, end, start, &t2);
-	RTDEBUGF(4, "unit normal t1 == POINT(%.8g %.8g %.8g)", t1.x, t1.y, t1.z);
-	RTDEBUGF(4, "unit normal t2 == POINT(%.8g %.8g %.8g)", t2.x, t2.y, t2.z);
-	cart2geog(ctx, &t1, &vN1);
-	cart2geog(ctx, &t2, &vN2);
-	g_top->lat = z_to_latitude(ctx, t1.z,RT_TRUE);
-	g_top->lon = vN2.lon;
-	g_bottom->lat = z_to_latitude(ctx, t2.z,RT_FALSE);
-	g_bottom->lon = vN1.lon;
-	RTDEBUGF(4, "clairaut top == GPOINT(%.6g %.6g)", g_top->lat, g_top->lon);
-	RTDEBUGF(4, "clairaut bottom == GPOINT(%.6g %.6g)", g_bottom->lat, g_bottom->lon);
-	return RT_SUCCESS;
+  POINT3D t1, t2;
+  GEOGRAPHIC_POINT vN1, vN2;
+  RTDEBUG(4,"entering function");
+  unit_normal(ctx, start, end, &t1);
+  unit_normal(ctx, end, start, &t2);
+  RTDEBUGF(4, "unit normal t1 == POINT(%.8g %.8g %.8g)", t1.x, t1.y, t1.z);
+  RTDEBUGF(4, "unit normal t2 == POINT(%.8g %.8g %.8g)", t2.x, t2.y, t2.z);
+  cart2geog(ctx, &t1, &vN1);
+  cart2geog(ctx, &t2, &vN2);
+  g_top->lat = z_to_latitude(ctx, t1.z,RT_TRUE);
+  g_top->lon = vN2.lon;
+  g_bottom->lat = z_to_latitude(ctx, t2.z,RT_FALSE);
+  g_bottom->lon = vN1.lon;
+  RTDEBUGF(4, "clairaut top == GPOINT(%.6g %.6g)", g_top->lat, g_top->lon);
+  RTDEBUGF(4, "clairaut bottom == GPOINT(%.6g %.6g)", g_bottom->lat, g_bottom->lon);
+  return RT_SUCCESS;
 }
 
 /**
@@ -1064,24 +1064,24 @@ int clairaut_cartesian(const RTCTX *ctx, const POINT3D *start, const POINT3D *en
 */
 int clairaut_geographic(const RTCTX *ctx, const GEOGRAPHIC_POINT *start, const GEOGRAPHIC_POINT *end, GEOGRAPHIC_POINT *g_top, GEOGRAPHIC_POINT *g_bottom)
 {
-	POINT3D t1, t2;
-	GEOGRAPHIC_POINT vN1, vN2;
-	RTDEBUG(4,"entering function");
-	robust_cross_product(ctx, start, end, &t1);
-	normalize(ctx, &t1);
-	robust_cross_product(ctx, end, start, &t2);
-	normalize(ctx, &t2);
-	RTDEBUGF(4, "unit normal t1 == POINT(%.8g %.8g %.8g)", t1.x, t1.y, t1.z);
-	RTDEBUGF(4, "unit normal t2 == POINT(%.8g %.8g %.8g)", t2.x, t2.y, t2.z);
-	cart2geog(ctx, &t1, &vN1);
-	cart2geog(ctx, &t2, &vN2);
-	g_top->lat = z_to_latitude(ctx, t1.z,RT_TRUE);
-	g_top->lon = vN2.lon;
-	g_bottom->lat = z_to_latitude(ctx, t2.z,RT_FALSE);
-	g_bottom->lon = vN1.lon;
-	RTDEBUGF(4, "clairaut top == GPOINT(%.6g %.6g)", g_top->lat, g_top->lon);
-	RTDEBUGF(4, "clairaut bottom == GPOINT(%.6g %.6g)", g_bottom->lat, g_bottom->lon);
-	return RT_SUCCESS;
+  POINT3D t1, t2;
+  GEOGRAPHIC_POINT vN1, vN2;
+  RTDEBUG(4,"entering function");
+  robust_cross_product(ctx, start, end, &t1);
+  normalize(ctx, &t1);
+  robust_cross_product(ctx, end, start, &t2);
+  normalize(ctx, &t2);
+  RTDEBUGF(4, "unit normal t1 == POINT(%.8g %.8g %.8g)", t1.x, t1.y, t1.z);
+  RTDEBUGF(4, "unit normal t2 == POINT(%.8g %.8g %.8g)", t2.x, t2.y, t2.z);
+  cart2geog(ctx, &t1, &vN1);
+  cart2geog(ctx, &t2, &vN2);
+  g_top->lat = z_to_latitude(ctx, t1.z,RT_TRUE);
+  g_top->lon = vN2.lon;
+  g_bottom->lat = z_to_latitude(ctx, t2.z,RT_FALSE);
+  g_bottom->lon = vN1.lon;
+  RTDEBUGF(4, "clairaut top == GPOINT(%.6g %.6g)", g_top->lat, g_top->lon);
+  RTDEBUGF(4, "clairaut bottom == GPOINT(%.6g %.6g)", g_bottom->lat, g_bottom->lon);
+  return RT_SUCCESS;
 }
 
 /**
@@ -1090,184 +1090,184 @@ int clairaut_geographic(const RTCTX *ctx, const GEOGRAPHIC_POINT *start, const G
 */
 int edge_intersection(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *g)
 {
-	POINT3D ea, eb, v;
-	RTDEBUGF(4, "e1 start(%.20g %.20g) end(%.20g %.20g)", e1->start.lat, e1->start.lon, e1->end.lat, e1->end.lon);
-	RTDEBUGF(4, "e2 start(%.20g %.20g) end(%.20g %.20g)", e2->start.lat, e2->start.lon, e2->end.lat, e2->end.lon);
-
-	RTDEBUGF(4, "e1 start(%.20g %.20g) end(%.20g %.20g)", rad2deg(e1->start.lon), rad2deg(e1->start.lat), rad2deg(e1->end.lon), rad2deg(e1->end.lat));
-	RTDEBUGF(4, "e2 start(%.20g %.20g) end(%.20g %.20g)", rad2deg(e2->start.lon), rad2deg(e2->start.lat), rad2deg(e2->end.lon), rad2deg(e2->end.lat));
-
-	if ( geographic_point_equals(ctx, &(e1->start), &(e2->start)) )
-	{
-		*g = e1->start;
-		return RT_TRUE;
-	}
-	if ( geographic_point_equals(ctx, &(e1->end), &(e2->end)) )
-	{
-		*g = e1->end;
-		return RT_TRUE;
-	}
-	if ( geographic_point_equals(ctx, &(e1->end), &(e2->start)) )
-	{
-		*g = e1->end;
-		return RT_TRUE;
-	}
-	if ( geographic_point_equals(ctx, &(e1->start), &(e2->end)) )
-	{
-		*g = e1->start;
-		return RT_TRUE;
-	}
-
-	robust_cross_product(ctx, &(e1->start), &(e1->end), &ea);
-	normalize(ctx, &ea);
-	robust_cross_product(ctx, &(e2->start), &(e2->end), &eb);
-	normalize(ctx, &eb);
-	RTDEBUGF(4, "e1 cross product == POINT(%.12g %.12g %.12g)", ea.x, ea.y, ea.z);
-	RTDEBUGF(4, "e2 cross product == POINT(%.12g %.12g %.12g)", eb.x, eb.y, eb.z);
-	RTDEBUGF(4, "fabs(dot_product(ctx, ea, eb)) == %.14g", fabs(dot_product(ctx, &ea, &eb)));
-	if ( FP_EQUALS(fabs(dot_product(ctx, &ea, &eb)), 1.0) )
-	{
-		RTDEBUGF(4, "parallel edges found! dot_product = %.12g", dot_product(ctx, &ea, &eb));
-		/* Parallel (maybe equal) edges! */
-		/* Hack alert, only returning ONE end of the edge right now, most do better later. */
-		/* Hack alart #2, returning a value of 2 to indicate a co-linear crossing event. */
-		if ( edge_contains_point(ctx, e1, &(e2->start)) )
-		{
-			*g = e2->start;
-			return 2;
-		}
-		if ( edge_contains_point(ctx, e1, &(e2->end)) )
-		{
-			*g = e2->end;
-			return 2;
-		}
-		if ( edge_contains_point(ctx, e2, &(e1->start)) )
-		{
-			*g = e1->start;
-			return 2;
-		}
-		if ( edge_contains_point(ctx, e2, &(e1->end)) )
-		{
-			*g = e1->end;
-			return 2;
-		}
-	}
-	unit_normal(ctx, &ea, &eb, &v);
-	RTDEBUGF(4, "v == POINT(%.12g %.12g %.12g)", v.x, v.y, v.z);
-	g->lat = atan2(v.z, sqrt(v.x * v.x + v.y * v.y));
-	g->lon = atan2(v.y, v.x);
-	RTDEBUGF(4, "g == GPOINT(%.12g %.12g)", g->lat, g->lon);
-	RTDEBUGF(4, "g == POINT(%.12g %.12g)", rad2deg(g->lon), rad2deg(g->lat));
-	if ( edge_contains_point(ctx, e1, g) && edge_contains_point(ctx, e2, g) )
-	{
-		return RT_TRUE;
-	}
-	else
-	{
-		RTDEBUG(4, "flipping point to other side of sphere");
-		g->lat = -1.0 * g->lat;
-		g->lon = g->lon + M_PI;
-		if ( g->lon > M_PI )
-		{
-			g->lon = -1.0 * (2.0 * M_PI - g->lon);
-		}
-		if ( edge_contains_point(ctx, e1, g) && edge_contains_point(ctx, e2, g) )
-		{
-			return RT_TRUE;
-		}
-	}
-	return RT_FALSE;
+  POINT3D ea, eb, v;
+  RTDEBUGF(4, "e1 start(%.20g %.20g) end(%.20g %.20g)", e1->start.lat, e1->start.lon, e1->end.lat, e1->end.lon);
+  RTDEBUGF(4, "e2 start(%.20g %.20g) end(%.20g %.20g)", e2->start.lat, e2->start.lon, e2->end.lat, e2->end.lon);
+
+  RTDEBUGF(4, "e1 start(%.20g %.20g) end(%.20g %.20g)", rad2deg(e1->start.lon), rad2deg(e1->start.lat), rad2deg(e1->end.lon), rad2deg(e1->end.lat));
+  RTDEBUGF(4, "e2 start(%.20g %.20g) end(%.20g %.20g)", rad2deg(e2->start.lon), rad2deg(e2->start.lat), rad2deg(e2->end.lon), rad2deg(e2->end.lat));
+
+  if ( geographic_point_equals(ctx, &(e1->start), &(e2->start)) )
+  {
+    *g = e1->start;
+    return RT_TRUE;
+  }
+  if ( geographic_point_equals(ctx, &(e1->end), &(e2->end)) )
+  {
+    *g = e1->end;
+    return RT_TRUE;
+  }
+  if ( geographic_point_equals(ctx, &(e1->end), &(e2->start)) )
+  {
+    *g = e1->end;
+    return RT_TRUE;
+  }
+  if ( geographic_point_equals(ctx, &(e1->start), &(e2->end)) )
+  {
+    *g = e1->start;
+    return RT_TRUE;
+  }
+
+  robust_cross_product(ctx, &(e1->start), &(e1->end), &ea);
+  normalize(ctx, &ea);
+  robust_cross_product(ctx, &(e2->start), &(e2->end), &eb);
+  normalize(ctx, &eb);
+  RTDEBUGF(4, "e1 cross product == POINT(%.12g %.12g %.12g)", ea.x, ea.y, ea.z);
+  RTDEBUGF(4, "e2 cross product == POINT(%.12g %.12g %.12g)", eb.x, eb.y, eb.z);
+  RTDEBUGF(4, "fabs(dot_product(ctx, ea, eb)) == %.14g", fabs(dot_product(ctx, &ea, &eb)));
+  if ( FP_EQUALS(fabs(dot_product(ctx, &ea, &eb)), 1.0) )
+  {
+    RTDEBUGF(4, "parallel edges found! dot_product = %.12g", dot_product(ctx, &ea, &eb));
+    /* Parallel (maybe equal) edges! */
+    /* Hack alert, only returning ONE end of the edge right now, most do better later. */
+    /* Hack alart #2, returning a value of 2 to indicate a co-linear crossing event. */
+    if ( edge_contains_point(ctx, e1, &(e2->start)) )
+    {
+      *g = e2->start;
+      return 2;
+    }
+    if ( edge_contains_point(ctx, e1, &(e2->end)) )
+    {
+      *g = e2->end;
+      return 2;
+    }
+    if ( edge_contains_point(ctx, e2, &(e1->start)) )
+    {
+      *g = e1->start;
+      return 2;
+    }
+    if ( edge_contains_point(ctx, e2, &(e1->end)) )
+    {
+      *g = e1->end;
+      return 2;
+    }
+  }
+  unit_normal(ctx, &ea, &eb, &v);
+  RTDEBUGF(4, "v == POINT(%.12g %.12g %.12g)", v.x, v.y, v.z);
+  g->lat = atan2(v.z, sqrt(v.x * v.x + v.y * v.y));
+  g->lon = atan2(v.y, v.x);
+  RTDEBUGF(4, "g == GPOINT(%.12g %.12g)", g->lat, g->lon);
+  RTDEBUGF(4, "g == POINT(%.12g %.12g)", rad2deg(g->lon), rad2deg(g->lat));
+  if ( edge_contains_point(ctx, e1, g) && edge_contains_point(ctx, e2, g) )
+  {
+    return RT_TRUE;
+  }
+  else
+  {
+    RTDEBUG(4, "flipping point to other side of sphere");
+    g->lat = -1.0 * g->lat;
+    g->lon = g->lon + M_PI;
+    if ( g->lon > M_PI )
+    {
+      g->lon = -1.0 * (2.0 * M_PI - g->lon);
+    }
+    if ( edge_contains_point(ctx, e1, g) && edge_contains_point(ctx, e2, g) )
+    {
+      return RT_TRUE;
+    }
+  }
+  return RT_FALSE;
 }
 
 double edge_distance_to_point(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *gp, GEOGRAPHIC_POINT *closest)
 {
-	double d1 = 1000000000.0, d2, d3, d_nearest;
-	POINT3D n, p, k;
-	GEOGRAPHIC_POINT gk, g_nearest;
-
-	/* Zero length edge, */
-	if ( geographic_point_equals(ctx, &(e->start), &(e->end)) )
-	{
-		*closest = e->start;
-		return sphere_distance(ctx, &(e->start), gp);
-	}
-
-	robust_cross_product(ctx, &(e->start), &(e->end), &n);
-	normalize(ctx, &n);
-	geog2cart(ctx, gp, &p);
-	vector_scale(ctx, &n, dot_product(ctx, &p, &n));
-	vector_difference(ctx, &p, &n, &k);
-	normalize(ctx, &k);
-	cart2geog(ctx, &k, &gk);
-	if ( edge_contains_point(ctx, e, &gk) )
-	{
-		d1 = sphere_distance(ctx, gp, &gk);
-	}
-	d2 = sphere_distance(ctx, gp, &(e->start));
-	d3 = sphere_distance(ctx, gp, &(e->end));
-
-	d_nearest = d1;
-	g_nearest = gk;
-
-	if ( d2 < d_nearest )
-	{
-		d_nearest = d2;
-		g_nearest = e->start;
-	}
-	if ( d3 < d_nearest )
-	{
-		d_nearest = d3;
-		g_nearest = e->end;
-	}
-	if (closest)
-		*closest = g_nearest;
-
-	return d_nearest;
+  double d1 = 1000000000.0, d2, d3, d_nearest;
+  POINT3D n, p, k;
+  GEOGRAPHIC_POINT gk, g_nearest;
+
+  /* Zero length edge, */
+  if ( geographic_point_equals(ctx, &(e->start), &(e->end)) )
+  {
+    *closest = e->start;
+    return sphere_distance(ctx, &(e->start), gp);
+  }
+
+  robust_cross_product(ctx, &(e->start), &(e->end), &n);
+  normalize(ctx, &n);
+  geog2cart(ctx, gp, &p);
+  vector_scale(ctx, &n, dot_product(ctx, &p, &n));
+  vector_difference(ctx, &p, &n, &k);
+  normalize(ctx, &k);
+  cart2geog(ctx, &k, &gk);
+  if ( edge_contains_point(ctx, e, &gk) )
+  {
+    d1 = sphere_distance(ctx, gp, &gk);
+  }
+  d2 = sphere_distance(ctx, gp, &(e->start));
+  d3 = sphere_distance(ctx, gp, &(e->end));
+
+  d_nearest = d1;
+  g_nearest = gk;
+
+  if ( d2 < d_nearest )
+  {
+    d_nearest = d2;
+    g_nearest = e->start;
+  }
+  if ( d3 < d_nearest )
+  {
+    d_nearest = d3;
+    g_nearest = e->end;
+  }
+  if (closest)
+    *closest = g_nearest;
+
+  return d_nearest;
 }
 
 /**
 * Calculate the distance between two edges.
-* IMPORTANT: this test does not check for edge intersection!!! (distance == 0) 
+* IMPORTANT: this test does not check for edge intersection!!! (distance == 0)
 * You have to check for intersection before calling this function.
 */
 double edge_distance_to_edge(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
 {
-	double d;
-	GEOGRAPHIC_POINT gcp1s, gcp1e, gcp2s, gcp2e, c1, c2;
-	double d1s = edge_distance_to_point(ctx, e1, &(e2->start), &gcp1s);
-	double d1e = edge_distance_to_point(ctx, e1, &(e2->end), &gcp1e);
-	double d2s = edge_distance_to_point(ctx, e2, &(e1->start), &gcp2s);
-	double d2e = edge_distance_to_point(ctx, e2, &(e1->end), &gcp2e);
+  double d;
+  GEOGRAPHIC_POINT gcp1s, gcp1e, gcp2s, gcp2e, c1, c2;
+  double d1s = edge_distance_to_point(ctx, e1, &(e2->start), &gcp1s);
+  double d1e = edge_distance_to_point(ctx, e1, &(e2->end), &gcp1e);
+  double d2s = edge_distance_to_point(ctx, e2, &(e1->start), &gcp2s);
+  double d2e = edge_distance_to_point(ctx, e2, &(e1->end), &gcp2e);
 
-	d = d1s;
-	c1 = gcp1s;
-	c2 = e2->start;
+  d = d1s;
+  c1 = gcp1s;
+  c2 = e2->start;
 
-	if ( d1e < d )
-	{
-		d = d1e;
-		c1 = gcp1e;
-		c2 = e2->end;
-	}
+  if ( d1e < d )
+  {
+    d = d1e;
+    c1 = gcp1e;
+    c2 = e2->end;
+  }
 
-	if ( d2s < d )
-	{
-		d = d2s;
-		c1 = e1->start;
-		c2 = gcp2s;
-	}
+  if ( d2s < d )
+  {
+    d = d2s;
+    c1 = e1->start;
+    c2 = gcp2s;
+  }
 
-	if ( d2e < d )
-	{
-		d = d2e;
-		c1 = e1->end;
-		c2 = gcp2e;
-	}
+  if ( d2e < d )
+  {
+    d = d2e;
+    c1 = e1->end;
+    c2 = gcp2e;
+  }
 
-	if ( closest1 ) *closest1 = c1;
-	if ( closest2 ) *closest2 = c2;
+  if ( closest1 ) *closest1 = c1;
+  if ( closest2 ) *closest2 = c2;
 
-	return d;
+  return d;
 }
 
 
@@ -1277,180 +1277,180 @@ double edge_distance_to_edge(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e1, const
 */
 int sphere_project(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, double distance, double azimuth, GEOGRAPHIC_POINT *n)
 {
-	double d = distance;
-	double lat1 = r->lat;
-	double lon1 = r->lon;
-	double lat2, lon2;
+  double d = distance;
+  double lat1 = r->lat;
+  double lon1 = r->lon;
+  double lat2, lon2;
+
+  lat2 = asin(sin(lat1)*cos(d) + cos(lat1)*sin(d)*cos(azimuth));
 
-	lat2 = asin(sin(lat1)*cos(d) + cos(lat1)*sin(d)*cos(azimuth));
+  /* If we're going straight up or straight down, we don't need to calculate the longitude */
+  /* TODO: this isn't quite true, what if we're going over the pole? */
+  if ( FP_EQUALS(azimuth, M_PI) || FP_EQUALS(azimuth, 0.0) )
+  {
+    lon2 = r->lon;
+  }
+  else
+  {
+    lon2 = lon1 + atan2(sin(azimuth)*sin(d)*cos(lat1), cos(d)-sin(lat1)*sin(lat2));
+  }
 
-	/* If we're going straight up or straight down, we don't need to calculate the longitude */
-	/* TODO: this isn't quite true, what if we're going over the pole? */
-	if ( FP_EQUALS(azimuth, M_PI) || FP_EQUALS(azimuth, 0.0) )
-	{
-		lon2 = r->lon;
-	}
-	else
-	{
-		lon2 = lon1 + atan2(sin(azimuth)*sin(d)*cos(lat1), cos(d)-sin(lat1)*sin(lat2));
-	}
-	
-	if ( isnan(lat2) || isnan(lon2) )
-		return RT_FAILURE;
+  if ( isnan(lat2) || isnan(lon2) )
+    return RT_FAILURE;
 
-	n->lat = lat2;
-	n->lon = lon2;
+  n->lat = lat2;
+  n->lon = lon2;
 
-	return RT_SUCCESS;
+  return RT_SUCCESS;
 }
 
 
 int edge_calculate_gbox_slow(const RTCTX *ctx, const GEOGRAPHIC_EDGE *e, RTGBOX *gbox)
 {
-	int steps = 1000000;
-	int i;
-	double dx, dy, dz;
-	double distance = sphere_distance(ctx, &(e->start), &(e->end));
-	POINT3D pn, p, start, end;
-
-	/* Edge is zero length, just return the naive box */
-	if ( FP_IS_ZERO(distance) )
-	{
-		RTDEBUG(4, "edge is zero length. returning");
-		geog2cart(ctx, &(e->start), &start);
-		geog2cart(ctx, &(e->end), &end);
-		gbox_init_point3d(ctx, &start, gbox);
-		gbox_merge_point3d(ctx, &end, gbox);
-		return RT_SUCCESS;
-	}
-
-	/* Edge is antipodal (one point on each side of the globe),
-	   set the box to contain the whole world and return */
-	if ( FP_EQUALS(distance, M_PI) )
-	{
-		RTDEBUG(4, "edge is antipodal. setting to maximum size box, and returning");
-		gbox->xmin = gbox->ymin = gbox->zmin = -1.0;
-		gbox->xmax = gbox->ymax = gbox->zmax = 1.0;
-		return RT_SUCCESS; 
-	}
-
-	/* Walk along the chord between start and end incrementally,
-	   normalizing at each step. */
-	geog2cart(ctx, &(e->start), &start);
-	geog2cart(ctx, &(e->end), &end);
-	dx = (end.x - start.x)/steps;
-	dy = (end.y - start.y)/steps;
-	dz = (end.z - start.z)/steps;
-	p = start;
-	gbox->xmin = gbox->xmax = p.x;
-	gbox->ymin = gbox->ymax = p.y;
-	gbox->zmin = gbox->zmax = p.z;
-	for ( i = 0; i < steps; i++ )
-	{
-		p.x += dx;
-		p.y += dy;
-		p.z += dz;
-		pn = p;
-		normalize(ctx, &pn);
-		gbox_merge_point3d(ctx, &pn, gbox);
-	}
-	return RT_SUCCESS;
+  int steps = 1000000;
+  int i;
+  double dx, dy, dz;
+  double distance = sphere_distance(ctx, &(e->start), &(e->end));
+  POINT3D pn, p, start, end;
+
+  /* Edge is zero length, just return the naive box */
+  if ( FP_IS_ZERO(distance) )
+  {
+    RTDEBUG(4, "edge is zero length. returning");
+    geog2cart(ctx, &(e->start), &start);
+    geog2cart(ctx, &(e->end), &end);
+    gbox_init_point3d(ctx, &start, gbox);
+    gbox_merge_point3d(ctx, &end, gbox);
+    return RT_SUCCESS;
+  }
+
+  /* Edge is antipodal (one point on each side of the globe),
+     set the box to contain the whole world and return */
+  if ( FP_EQUALS(distance, M_PI) )
+  {
+    RTDEBUG(4, "edge is antipodal. setting to maximum size box, and returning");
+    gbox->xmin = gbox->ymin = gbox->zmin = -1.0;
+    gbox->xmax = gbox->ymax = gbox->zmax = 1.0;
+    return RT_SUCCESS;
+  }
+
+  /* Walk along the chord between start and end incrementally,
+     normalizing at each step. */
+  geog2cart(ctx, &(e->start), &start);
+  geog2cart(ctx, &(e->end), &end);
+  dx = (end.x - start.x)/steps;
+  dy = (end.y - start.y)/steps;
+  dz = (end.z - start.z)/steps;
+  p = start;
+  gbox->xmin = gbox->xmax = p.x;
+  gbox->ymin = gbox->ymax = p.y;
+  gbox->zmin = gbox->zmax = p.z;
+  for ( i = 0; i < steps; i++ )
+  {
+    p.x += dx;
+    p.y += dy;
+    p.z += dz;
+    pn = p;
+    normalize(ctx, &pn);
+    gbox_merge_point3d(ctx, &pn, gbox);
+  }
+  return RT_SUCCESS;
 }
 
 /**
 * The magic function, given an edge in spherical coordinates, calculate a
 * 3D bounding box that fully contains it, taking into account the curvature
-* of the sphere on which it is inscribed. 
+* of the sphere on which it is inscribed.
 *
 * Any arc on the sphere defines a plane that bisects the sphere. In this plane,
 * the arc is a portion of a unit circle.
 * Projecting the end points of the axes (1,0,0), (-1,0,0) etc, into the plane
-* and normalizing yields potential extrema points. Those points on the 
+* and normalizing yields potential extrema points. Those points on the
 * side of the plane-dividing line formed by the end points that is opposite
 * the origin of the plane are extrema and should be added to the bounding box.
 */
 int edge_calculate_gbox(const RTCTX *ctx, const POINT3D *A1, const POINT3D *A2, RTGBOX *gbox)
 {
-	RTPOINT2D R1, R2, RX, O;
-	POINT3D AN, A3;
-	POINT3D X[6];
-	int i, o_side;
-
-	/* Initialize the box with the edge end points */
-	gbox_init_point3d(ctx, A1, gbox);
-	gbox_merge_point3d(ctx, A2, gbox);
-	
-	/* Zero length edge, just return! */
-	if ( p3d_same(ctx, A1, A2) )
-		return RT_SUCCESS;
-	
-	/* Error out on antipodal edge */
-	if ( FP_EQUALS(A1->x, -1*A2->x) && FP_EQUALS(A1->y, -1*A2->y) && FP_EQUALS(A1->z, -1*A2->z) )
-	{
-		rterror(ctx, "Antipodal (180 degrees long) edge detected!");
-		return RT_FAILURE;
-	}
-	
-	/* Create A3, a vector in the plane of A1/A2, orthogonal to A1  */
-	unit_normal(ctx, A1, A2, &AN);
-	unit_normal(ctx, &AN, A1, &A3);
-
-	/* Project A1 and A2 into the 2-space formed by the plane A1/A3 */
-	R1.x = 1.0;
-	R1.y = 0.0;
-	R2.x = dot_product(ctx, A2, A1);
-	R2.y = dot_product(ctx, A2, &A3);
-
-	/* Initialize our 3-space axis points (x+, x-, y+, y-, z+, z-) */
-	memset(X, 0, sizeof(POINT3D) * 6);
-	X[0].x = X[2].y = X[4].z =  1.0;
-	X[1].x = X[3].y = X[5].z = -1.0;
-	
-	/* Initialize a 2-space origin point. */
-	O.x = O.y = 0.0;
-	/* What side of the line joining R1/R2 is O? */
-	o_side = rt_segment_side(ctx, &R1, &R2, &O);
-	
-	/* Add any extrema! */
-	for ( i = 0; i < 6; i++ )
-	{
-		/* Convert 3-space axis points to 2-space unit vectors */
-		RX.x = dot_product(ctx, &(X[i]), A1);
-		RX.y = dot_product(ctx, &(X[i]), &A3);
-		normalize2d(ctx, &RX);
-		
-		/* Any axis end on the side of R1/R2 opposite the origin */
-		/* is an extreme point in the arc, so we add the 3-space */
-		/* version of the point on R1/R2 to the gbox */
-		if ( rt_segment_side(ctx, &R1, &R2, &RX) != o_side )
-		{
-			POINT3D Xn;
-			Xn.x = RX.x * A1->x + RX.y * A3.x;
-			Xn.y = RX.x * A1->y + RX.y * A3.y;
-			Xn.z = RX.x * A1->z + RX.y * A3.z;
-			
-			gbox_merge_point3d(ctx, &Xn, gbox);
-		}
-	}
-
-	return RT_SUCCESS;
+  RTPOINT2D R1, R2, RX, O;
+  POINT3D AN, A3;
+  POINT3D X[6];
+  int i, o_side;
+
+  /* Initialize the box with the edge end points */
+  gbox_init_point3d(ctx, A1, gbox);
+  gbox_merge_point3d(ctx, A2, gbox);
+
+  /* Zero length edge, just return! */
+  if ( p3d_same(ctx, A1, A2) )
+    return RT_SUCCESS;
+
+  /* Error out on antipodal edge */
+  if ( FP_EQUALS(A1->x, -1*A2->x) && FP_EQUALS(A1->y, -1*A2->y) && FP_EQUALS(A1->z, -1*A2->z) )
+  {
+    rterror(ctx, "Antipodal (180 degrees long) edge detected!");
+    return RT_FAILURE;
+  }
+
+  /* Create A3, a vector in the plane of A1/A2, orthogonal to A1  */
+  unit_normal(ctx, A1, A2, &AN);
+  unit_normal(ctx, &AN, A1, &A3);
+
+  /* Project A1 and A2 into the 2-space formed by the plane A1/A3 */
+  R1.x = 1.0;
+  R1.y = 0.0;
+  R2.x = dot_product(ctx, A2, A1);
+  R2.y = dot_product(ctx, A2, &A3);
+
+  /* Initialize our 3-space axis points (x+, x-, y+, y-, z+, z-) */
+  memset(X, 0, sizeof(POINT3D) * 6);
+  X[0].x = X[2].y = X[4].z =  1.0;
+  X[1].x = X[3].y = X[5].z = -1.0;
+
+  /* Initialize a 2-space origin point. */
+  O.x = O.y = 0.0;
+  /* What side of the line joining R1/R2 is O? */
+  o_side = rt_segment_side(ctx, &R1, &R2, &O);
+
+  /* Add any extrema! */
+  for ( i = 0; i < 6; i++ )
+  {
+    /* Convert 3-space axis points to 2-space unit vectors */
+    RX.x = dot_product(ctx, &(X[i]), A1);
+    RX.y = dot_product(ctx, &(X[i]), &A3);
+    normalize2d(ctx, &RX);
+
+    /* Any axis end on the side of R1/R2 opposite the origin */
+    /* is an extreme point in the arc, so we add the 3-space */
+    /* version of the point on R1/R2 to the gbox */
+    if ( rt_segment_side(ctx, &R1, &R2, &RX) != o_side )
+    {
+      POINT3D Xn;
+      Xn.x = RX.x * A1->x + RX.y * A3.x;
+      Xn.y = RX.x * A1->y + RX.y * A3.y;
+      Xn.z = RX.x * A1->z + RX.y * A3.z;
+
+      gbox_merge_point3d(ctx, &Xn, gbox);
+    }
+  }
+
+  return RT_SUCCESS;
 }
 
 void rtpoly_pt_outside(const RTCTX *ctx, const RTPOLY *poly, RTPOINT2D *pt_outside)
-{	
-	/* Make sure we have boxes */
-	if ( poly->bbox )
-	{
-		gbox_pt_outside(ctx, poly->bbox, pt_outside);
-		return;
-	}
-	else
-	{
-		RTGBOX gbox;
-		rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)poly, &gbox);
-		gbox_pt_outside(ctx, &gbox, pt_outside);
-		return;
-	}
+{
+  /* Make sure we have boxes */
+  if ( poly->bbox )
+  {
+    gbox_pt_outside(ctx, poly->bbox, pt_outside);
+    return;
+  }
+  else
+  {
+    RTGBOX gbox;
+    rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)poly, &gbox);
+    gbox_pt_outside(ctx, &gbox, pt_outside);
+    return;
+  }
 }
 
 /**
@@ -1459,82 +1459,82 @@ void rtpoly_pt_outside(const RTCTX *ctx, const RTPOLY *poly, RTPOINT2D *pt_outsi
 */
 void gbox_pt_outside(const RTCTX *ctx, const RTGBOX *gbox, RTPOINT2D *pt_outside)
 {
-	double grow = M_PI / 180.0 / 60.0; /* one arc-minute */
-	int i;
-	RTGBOX ge;
-	POINT3D corners[8];
-	POINT3D pt;
-	GEOGRAPHIC_POINT g;
-
-	while ( grow < M_PI )
-	{
-		/* Assign our box and expand it slightly. */
-		ge = *gbox;
-		if ( ge.xmin > -1 ) ge.xmin -= grow;
-		if ( ge.ymin > -1 ) ge.ymin -= grow;
-		if ( ge.zmin > -1 ) ge.zmin -= grow;
-		if ( ge.xmax < 1 )  ge.xmax += grow;
-		if ( ge.ymax < 1 )  ge.ymax += grow;
-		if ( ge.zmax < 1 )  ge.zmax += grow;
-
-		/* Build our eight corner points */
-		corners[0].x = ge.xmin;
-		corners[0].y = ge.ymin;
-		corners[0].z = ge.zmin;
-
-		corners[1].x = ge.xmin;
-		corners[1].y = ge.ymax;
-		corners[1].z = ge.zmin;
-
-		corners[2].x = ge.xmin;
-		corners[2].y = ge.ymin;
-		corners[2].z = ge.zmax;
-
-		corners[3].x = ge.xmax;
-		corners[3].y = ge.ymin;
-		corners[3].z = ge.zmin;
-
-		corners[4].x = ge.xmax;
-		corners[4].y = ge.ymax;
-		corners[4].z = ge.zmin;
-
-		corners[5].x = ge.xmax;
-		corners[5].y = ge.ymin;
-		corners[5].z = ge.zmax;
-
-		corners[6].x = ge.xmin;
-		corners[6].y = ge.ymax;
-		corners[6].z = ge.zmax;
-
-		corners[7].x = ge.xmax;
-		corners[7].y = ge.ymax;
-		corners[7].z = ge.zmax;
-
-		RTDEBUG(4, "trying to use a box corner point...");
-		for ( i = 0; i < 8; i++ )
-		{
-			normalize(ctx, &(corners[i]));
-			RTDEBUGF(4, "testing corner %d: POINT(%.8g %.8g %.8g)", i, corners[i].x, corners[i].y, corners[i].z);
-			if ( ! gbox_contains_point3d(ctx, gbox, &(corners[i])) )
-			{
-				RTDEBUGF(4, "corner %d is outside our gbox", i);
-				pt = corners[i];
-				normalize(ctx, &pt);
-				cart2geog(ctx, &pt, &g);
-				pt_outside->x = rad2deg(g.lon);
-				pt_outside->y = rad2deg(g.lat);
-				RTDEBUGF(4, "returning POINT(%.8g %.8g) as outside point", pt_outside->x, pt_outside->y);
-				return;
-			}
-		}
-
-		/* Try a wider growth to push the corners outside the original box. */
-		grow *= 2.0;
-	}
-
-	/* This should never happen! */
-	rterror(ctx, "BOOM! Could not generate outside point!");
-	return;
+  double grow = M_PI / 180.0 / 60.0; /* one arc-minute */
+  int i;
+  RTGBOX ge;
+  POINT3D corners[8];
+  POINT3D pt;
+  GEOGRAPHIC_POINT g;
+
+  while ( grow < M_PI )
+  {
+    /* Assign our box and expand it slightly. */
+    ge = *gbox;
+    if ( ge.xmin > -1 ) ge.xmin -= grow;
+    if ( ge.ymin > -1 ) ge.ymin -= grow;
+    if ( ge.zmin > -1 ) ge.zmin -= grow;
+    if ( ge.xmax < 1 )  ge.xmax += grow;
+    if ( ge.ymax < 1 )  ge.ymax += grow;
+    if ( ge.zmax < 1 )  ge.zmax += grow;
+
+    /* Build our eight corner points */
+    corners[0].x = ge.xmin;
+    corners[0].y = ge.ymin;
+    corners[0].z = ge.zmin;
+
+    corners[1].x = ge.xmin;
+    corners[1].y = ge.ymax;
+    corners[1].z = ge.zmin;
+
+    corners[2].x = ge.xmin;
+    corners[2].y = ge.ymin;
+    corners[2].z = ge.zmax;
+
+    corners[3].x = ge.xmax;
+    corners[3].y = ge.ymin;
+    corners[3].z = ge.zmin;
+
+    corners[4].x = ge.xmax;
+    corners[4].y = ge.ymax;
+    corners[4].z = ge.zmin;
+
+    corners[5].x = ge.xmax;
+    corners[5].y = ge.ymin;
+    corners[5].z = ge.zmax;
+
+    corners[6].x = ge.xmin;
+    corners[6].y = ge.ymax;
+    corners[6].z = ge.zmax;
+
+    corners[7].x = ge.xmax;
+    corners[7].y = ge.ymax;
+    corners[7].z = ge.zmax;
+
+    RTDEBUG(4, "trying to use a box corner point...");
+    for ( i = 0; i < 8; i++ )
+    {
+      normalize(ctx, &(corners[i]));
+      RTDEBUGF(4, "testing corner %d: POINT(%.8g %.8g %.8g)", i, corners[i].x, corners[i].y, corners[i].z);
+      if ( ! gbox_contains_point3d(ctx, gbox, &(corners[i])) )
+      {
+        RTDEBUGF(4, "corner %d is outside our gbox", i);
+        pt = corners[i];
+        normalize(ctx, &pt);
+        cart2geog(ctx, &pt, &g);
+        pt_outside->x = rad2deg(g.lon);
+        pt_outside->y = rad2deg(g.lat);
+        RTDEBUGF(4, "returning POINT(%.8g %.8g) as outside point", pt_outside->x, pt_outside->y);
+        return;
+      }
+    }
+
+    /* Try a wider growth to push the corners outside the original box. */
+    grow *= 2.0;
+  }
+
+  /* This should never happen! */
+  rterror(ctx, "BOOM! Could not generate outside point!");
+  return;
 }
 
 
@@ -1543,106 +1543,106 @@ void gbox_pt_outside(const RTCTX *ctx, const RTGBOX *gbox, RTPOINT2D *pt_outside
 * @param pa_in - input point array pointer
 * @param max_seg_length - maximum output segment length in radians
 */
-static RTPOINTARRAY* 
+static RTPOINTARRAY*
 ptarray_segmentize_sphere(const RTCTX *ctx, const RTPOINTARRAY *pa_in, double max_seg_length)
 {
-	RTPOINTARRAY *pa_out;
-	int hasz = ptarray_has_z(ctx, pa_in);
-	int hasm = ptarray_has_m(ctx, pa_in);
-	int pa_in_offset = 0; /* input point offset */
-	RTPOINT4D p1, p2, p;
-	POINT3D q1, q2, q, qn;
-	GEOGRAPHIC_POINT g1, g2, g;
-	double d;
-	
-	/* Just crap out on crazy input */
-	if ( ! pa_in )
-		rterror(ctx, "ptarray_segmentize_sphere: null input pointarray");
-	if ( max_seg_length <= 0.0 )	
-		rterror(ctx, "ptarray_segmentize_sphere: maximum segment length must be positive");
-
-	/* Empty starting array */
-	pa_out = ptarray_construct_empty(ctx, hasz, hasm, pa_in->npoints);
-
-	/* Add first point */
-	rt_getPoint4d_p(ctx, pa_in, pa_in_offset, &p1);
-	ptarray_append_point(ctx, pa_out, &p1, RT_FALSE);
-	geographic_point_init(ctx, p1.x, p1.y, &g1);
-	pa_in_offset++;
-	
-	while ( pa_in_offset < pa_in->npoints )
-	{
-		rt_getPoint4d_p(ctx, pa_in, pa_in_offset, &p2);
-		geographic_point_init(ctx, p2.x, p2.y, &g2);
-		
-		/* Skip duplicate points (except in case of 2-point lines!) */
-		if ( (pa_in->npoints > 2) && p4d_same(ctx, &p1, &p2) )
-		{
-			/* Move one offset forward */
-			p1 = p2;
-			g1 = g2;
-			pa_in_offset++;
-			continue;
-		}
-
-		/* How long is this edge? */
-		d = sphere_distance(ctx, &g1, &g2);
-		
-		/* We need to segmentize this edge */
-		if ( d > max_seg_length )
-		{
-			int nsegs = 1 + d / max_seg_length;
-			int i;
-			double dx, dy, dz, dzz = 0, dmm = 0;
-			
-			geog2cart(ctx, &g1, &q1);
-			geog2cart(ctx, &g2, &q2);
-			
-			dx = (q2.x - q1.x) / nsegs;
-			dy = (q2.y - q1.y) / nsegs;
-			dz = (q2.z - q1.z) / nsegs;
-			
-			/* The independent Z/M values on the ptarray */
-			if ( hasz ) dzz = (p2.z - p1.z) / nsegs;
-			if ( hasm ) dmm = (p2.m - p1.m) / nsegs;
-			
-			q = q1;
-			p = p1;
-			
-			for ( i = 0; i < nsegs - 1; i++ )
-			{
-				/* Move one increment forwards */
-				q.x += dx; q.y += dy; q.z += dz;
-				qn = q;
-				normalize(ctx, &qn);
-				
-				/* Back to spherical coordinates */
-				cart2geog(ctx, &qn, &g);
-				/* Back to lon/lat */
-				p.x = rad2deg(g.lon);
-				p.y = rad2deg(g.lat);
-				if ( hasz )
-					p.z += dzz;
-				if ( hasm )
-					p.m += dmm;
-				ptarray_append_point(ctx, pa_out, &p, RT_FALSE);
-			}
-			
-			ptarray_append_point(ctx, pa_out, &p2, RT_FALSE);
-		}
-		/* This edge is already short enough */
-		else
-		{
-			ptarray_append_point(ctx, pa_out, &p2, (pa_in->npoints==2)?RT_TRUE:RT_FALSE);
-		}
-
-		/* Move one offset forward */
-		p1 = p2;
-		g1 = g2;
-		pa_in_offset++;
-	}
-	
-	return pa_out;	
+  RTPOINTARRAY *pa_out;
+  int hasz = ptarray_has_z(ctx, pa_in);
+  int hasm = ptarray_has_m(ctx, pa_in);
+  int pa_in_offset = 0; /* input point offset */
+  RTPOINT4D p1, p2, p;
+  POINT3D q1, q2, q, qn;
+  GEOGRAPHIC_POINT g1, g2, g;
+  double d;
+
+  /* Just crap out on crazy input */
+  if ( ! pa_in )
+    rterror(ctx, "ptarray_segmentize_sphere: null input pointarray");
+  if ( max_seg_length <= 0.0 )
+    rterror(ctx, "ptarray_segmentize_sphere: maximum segment length must be positive");
+
+  /* Empty starting array */
+  pa_out = ptarray_construct_empty(ctx, hasz, hasm, pa_in->npoints);
+
+  /* Add first point */
+  rt_getPoint4d_p(ctx, pa_in, pa_in_offset, &p1);
+  ptarray_append_point(ctx, pa_out, &p1, RT_FALSE);
+  geographic_point_init(ctx, p1.x, p1.y, &g1);
+  pa_in_offset++;
+
+  while ( pa_in_offset < pa_in->npoints )
+  {
+    rt_getPoint4d_p(ctx, pa_in, pa_in_offset, &p2);
+    geographic_point_init(ctx, p2.x, p2.y, &g2);
+
+    /* Skip duplicate points (except in case of 2-point lines!) */
+    if ( (pa_in->npoints > 2) && p4d_same(ctx, &p1, &p2) )
+    {
+      /* Move one offset forward */
+      p1 = p2;
+      g1 = g2;
+      pa_in_offset++;
+      continue;
+    }
+
+    /* How long is this edge? */
+    d = sphere_distance(ctx, &g1, &g2);
+
+    /* We need to segmentize this edge */
+    if ( d > max_seg_length )
+    {
+      int nsegs = 1 + d / max_seg_length;
+      int i;
+      double dx, dy, dz, dzz = 0, dmm = 0;
+
+      geog2cart(ctx, &g1, &q1);
+      geog2cart(ctx, &g2, &q2);
+
+      dx = (q2.x - q1.x) / nsegs;
+      dy = (q2.y - q1.y) / nsegs;
+      dz = (q2.z - q1.z) / nsegs;
+
+      /* The independent Z/M values on the ptarray */
+      if ( hasz ) dzz = (p2.z - p1.z) / nsegs;
+      if ( hasm ) dmm = (p2.m - p1.m) / nsegs;
+
+      q = q1;
+      p = p1;
+
+      for ( i = 0; i < nsegs - 1; i++ )
+      {
+        /* Move one increment forwards */
+        q.x += dx; q.y += dy; q.z += dz;
+        qn = q;
+        normalize(ctx, &qn);
+
+        /* Back to spherical coordinates */
+        cart2geog(ctx, &qn, &g);
+        /* Back to lon/lat */
+        p.x = rad2deg(g.lon);
+        p.y = rad2deg(g.lat);
+        if ( hasz )
+          p.z += dzz;
+        if ( hasm )
+          p.m += dmm;
+        ptarray_append_point(ctx, pa_out, &p, RT_FALSE);
+      }
+
+      ptarray_append_point(ctx, pa_out, &p2, RT_FALSE);
+    }
+    /* This edge is already short enough */
+    else
+    {
+      ptarray_append_point(ctx, pa_out, &p2, (pa_in->npoints==2)?RT_TRUE:RT_FALSE);
+    }
+
+    /* Move one offset forward */
+    p1 = p2;
+    g1 = g2;
+    pa_in_offset++;
+  }
+
+  return pa_out;
 }
 
 /**
@@ -1651,63 +1651,63 @@ ptarray_segmentize_sphere(const RTCTX *ctx, const RTPOINTARRAY *pa_in, double ma
 * @param rtg_in = input geometry
 * @param max_seg_length = maximum segment length in radians
 */
-RTGEOM* 
+RTGEOM*
 rtgeom_segmentize_sphere(const RTCTX *ctx, const RTGEOM *rtg_in, double max_seg_length)
 {
-	RTPOINTARRAY *pa_out;
-	RTLINE *rtline;
-	RTPOLY *rtpoly_in, *rtpoly_out;
-	RTCOLLECTION *rtcol_in, *rtcol_out;
-	int i;
-	
-	/* Reflect NULL */
-	if ( ! rtg_in )
-		return NULL;
-		
-	/* Clone empty */
-	if ( rtgeom_is_empty(ctx, rtg_in) )
-		return rtgeom_clone(ctx, rtg_in);
-	
-	switch (rtg_in->type)
-	{
-	case RTMULTIPOINTTYPE:
-	case RTPOINTTYPE:
-		return rtgeom_clone_deep(ctx, rtg_in);
-		break;
-	case RTLINETYPE:
-		rtline = rtgeom_as_rtline(ctx, rtg_in);
-		pa_out = ptarray_segmentize_sphere(ctx, rtline->points, max_seg_length);
-		return rtline_as_rtgeom(ctx, rtline_construct(ctx, rtg_in->srid, NULL, pa_out));
-		break;
-	case RTPOLYGONTYPE:
-		rtpoly_in = rtgeom_as_rtpoly(ctx, rtg_in);
-		rtpoly_out = rtpoly_construct_empty(ctx, rtg_in->srid, rtgeom_has_z(ctx, rtg_in), rtgeom_has_m(ctx, rtg_in));
-		for ( i = 0; i < rtpoly_in->nrings; i++ )
-		{
-			pa_out = ptarray_segmentize_sphere(ctx, rtpoly_in->rings[i], max_seg_length);
-			rtpoly_add_ring(ctx, rtpoly_out, pa_out);
-		}
-		return rtpoly_as_rtgeom(ctx, rtpoly_out);
-		break;
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		rtcol_in = rtgeom_as_rtcollection(ctx, rtg_in);
-		rtcol_out = rtcollection_construct_empty(ctx, rtg_in->type, rtg_in->srid, rtgeom_has_z(ctx, rtg_in), rtgeom_has_m(ctx, rtg_in));
-		for ( i = 0; i < rtcol_in->ngeoms; i++ )
-		{
-			rtcollection_add_rtgeom(ctx, rtcol_out, rtgeom_segmentize_sphere(ctx, rtcol_in->geoms[i], max_seg_length));
-		}
-		return rtcollection_as_rtgeom(ctx, rtcol_out);
-		break;
-	default:
-		rterror(ctx, "rtgeom_segmentize_sphere: unsupported input geometry type: %d - %s",
-		        rtg_in->type, rttype_name(ctx, rtg_in->type));
-		break;
-	}
-	
-	rterror(ctx, "rtgeom_segmentize_sphere got to the end of the function, should not happen");
-	return NULL;
+  RTPOINTARRAY *pa_out;
+  RTLINE *rtline;
+  RTPOLY *rtpoly_in, *rtpoly_out;
+  RTCOLLECTION *rtcol_in, *rtcol_out;
+  int i;
+
+  /* Reflect NULL */
+  if ( ! rtg_in )
+    return NULL;
+
+  /* Clone empty */
+  if ( rtgeom_is_empty(ctx, rtg_in) )
+    return rtgeom_clone(ctx, rtg_in);
+
+  switch (rtg_in->type)
+  {
+  case RTMULTIPOINTTYPE:
+  case RTPOINTTYPE:
+    return rtgeom_clone_deep(ctx, rtg_in);
+    break;
+  case RTLINETYPE:
+    rtline = rtgeom_as_rtline(ctx, rtg_in);
+    pa_out = ptarray_segmentize_sphere(ctx, rtline->points, max_seg_length);
+    return rtline_as_rtgeom(ctx, rtline_construct(ctx, rtg_in->srid, NULL, pa_out));
+    break;
+  case RTPOLYGONTYPE:
+    rtpoly_in = rtgeom_as_rtpoly(ctx, rtg_in);
+    rtpoly_out = rtpoly_construct_empty(ctx, rtg_in->srid, rtgeom_has_z(ctx, rtg_in), rtgeom_has_m(ctx, rtg_in));
+    for ( i = 0; i < rtpoly_in->nrings; i++ )
+    {
+      pa_out = ptarray_segmentize_sphere(ctx, rtpoly_in->rings[i], max_seg_length);
+      rtpoly_add_ring(ctx, rtpoly_out, pa_out);
+    }
+    return rtpoly_as_rtgeom(ctx, rtpoly_out);
+    break;
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    rtcol_in = rtgeom_as_rtcollection(ctx, rtg_in);
+    rtcol_out = rtcollection_construct_empty(ctx, rtg_in->type, rtg_in->srid, rtgeom_has_z(ctx, rtg_in), rtgeom_has_m(ctx, rtg_in));
+    for ( i = 0; i < rtcol_in->ngeoms; i++ )
+    {
+      rtcollection_add_rtgeom(ctx, rtcol_out, rtgeom_segmentize_sphere(ctx, rtcol_in->geoms[i], max_seg_length));
+    }
+    return rtcollection_as_rtgeom(ctx, rtcol_out);
+    break;
+  default:
+    rterror(ctx, "rtgeom_segmentize_sphere: unsupported input geometry type: %d - %s",
+            rtg_in->type, rttype_name(ctx, rtg_in->type));
+    break;
+  }
+
+  rterror(ctx, "rtgeom_segmentize_sphere got to the end of the function, should not happen");
+  return NULL;
 }
 
 
@@ -1715,221 +1715,221 @@ rtgeom_segmentize_sphere(const RTCTX *ctx, const RTGEOM *rtg_in, double max_seg_
 * Returns the area of the ring (ring must be closed) in square radians (surface of
 * the sphere is 4*PI).
 */
-double 
+double
 ptarray_area_sphere(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	int i;
-	const RTPOINT2D *p;
-	GEOGRAPHIC_POINT a, b, c;
-	double area = 0.0;
-	
-	/* Return zero on nonsensical inputs */
-	if ( ! pa || pa->npoints < 4 )
-		return 0.0;
-	
-	p = rt_getPoint2d_cp(ctx, pa, 0);
-	geographic_point_init(ctx, p->x, p->y, &a);
-	p = rt_getPoint2d_cp(ctx, pa, 1);
-	geographic_point_init(ctx, p->x, p->y, &b);
-	
-	for ( i = 2; i < pa->npoints-1; i++ )
-	{
-		p = rt_getPoint2d_cp(ctx, pa, i);
-		geographic_point_init(ctx, p->x, p->y, &c);
-		area += sphere_signed_area(ctx, &a, &b, &c);
-		b = c;
-	}
-	
-	return fabs(area);
+  int i;
+  const RTPOINT2D *p;
+  GEOGRAPHIC_POINT a, b, c;
+  double area = 0.0;
+
+  /* Return zero on nonsensical inputs */
+  if ( ! pa || pa->npoints < 4 )
+    return 0.0;
+
+  p = rt_getPoint2d_cp(ctx, pa, 0);
+  geographic_point_init(ctx, p->x, p->y, &a);
+  p = rt_getPoint2d_cp(ctx, pa, 1);
+  geographic_point_init(ctx, p->x, p->y, &b);
+
+  for ( i = 2; i < pa->npoints-1; i++ )
+  {
+    p = rt_getPoint2d_cp(ctx, pa, i);
+    geographic_point_init(ctx, p->x, p->y, &c);
+    area += sphere_signed_area(ctx, &a, &b, &c);
+    b = c;
+  }
+
+  return fabs(area);
 }
 
 
 static double ptarray_distance_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa1, const RTPOINTARRAY *pa2, const SPHEROID *s, double tolerance, int check_intersection)
 {
-	GEOGRAPHIC_EDGE e1, e2;
-	GEOGRAPHIC_POINT g1, g2;
-	GEOGRAPHIC_POINT nearest1, nearest2;
-	POINT3D A1, A2, B1, B2;
-	const RTPOINT2D *p;
-	double distance;
-	int i, j;
-	int use_sphere = (s->a == s->b ? 1 : 0);
-
-	/* Make result really big, so that everything will be smaller than it */
-	distance = FLT_MAX;
-
-	/* Empty point arrays? Return negative */
-	if ( pa1->npoints == 0 || pa2->npoints == 0 )
-		return -1.0;
-
-	/* Handle point/point case here */
-	if ( pa1->npoints == 1 && pa2->npoints == 1 )
-	{
-		p = rt_getPoint2d_cp(ctx, pa1, 0);
-		geographic_point_init(ctx, p->x, p->y, &g1);
-		p = rt_getPoint2d_cp(ctx, pa2, 0);
-		geographic_point_init(ctx, p->x, p->y, &g2);
-		/* Sphere special case, axes equal */
-		distance = s->radius * sphere_distance(ctx, &g1, &g2);
-		if ( use_sphere )
-			return distance;
-		/* Below tolerance, actual distance isn't of interest */
-		else if ( distance < 0.95 * tolerance )
-			return distance;
-		/* Close or greater than tolerance, get the real answer to be sure */
-		else
-			return spheroid_distance(ctx, &g1, &g2, s);
-	}
-
-	/* Handle point/line case here */
-	if ( pa1->npoints == 1 || pa2->npoints == 1 )
-	{
-		/* Handle one/many case here */
-		int i;
-		const RTPOINTARRAY *pa_one;
-		const RTPOINTARRAY *pa_many;
-
-		if ( pa1->npoints == 1 )
-		{
-			pa_one = pa1;
-			pa_many = pa2;
-		}
-		else
-		{
-			pa_one = pa2;
-			pa_many = pa1;
-		}
-
-		/* Initialize our point */
-		p = rt_getPoint2d_cp(ctx, pa_one, 0);
-		geographic_point_init(ctx, p->x, p->y, &g1);
-
-		/* Initialize start of line */
-		p = rt_getPoint2d_cp(ctx, pa_many, 0);
-		geographic_point_init(ctx, p->x, p->y, &(e1.start));
-
-		/* Iterate through the edges in our line */
-		for ( i = 1; i < pa_many->npoints; i++ )
-		{
-			double d;
-			p = rt_getPoint2d_cp(ctx, pa_many, i);
-			geographic_point_init(ctx, p->x, p->y, &(e1.end));
-			/* Get the spherical distance between point and edge */
-			d = s->radius * edge_distance_to_point(ctx, &e1, &g1, &g2);
-			/* New shortest distance! Record this distance / location */
-			if ( d < distance )
-			{
-				distance = d;
-				nearest2 = g2;
-			}
-			/* We've gotten closer than the tolerance... */
-			if ( d < tolerance )
-			{
-				/* Working on a sphere? The answer is correct, return */
-				if ( use_sphere )
-				{
-					return d;
-				}
-				/* Far enough past the tolerance that the spheroid calculation won't change things */
-				else if ( d < tolerance * 0.95 )
-				{
-					return d;
-				}
-				/* On a spheroid and near the tolerance? Confirm that we are *actually* closer than tolerance */
-				else
-				{
-					d = spheroid_distance(ctx, &g1, &nearest2, s);
-					/* Yes, closer than tolerance, return! */
-					if ( d < tolerance )
-						return d;
-				}
-			}
-			e1.start = e1.end;
-		}
-
-		/* On sphere, return answer */
-		if ( use_sphere )
-			return distance;
-		/* On spheroid, calculate final answer based on closest approach */
-		else
-			return spheroid_distance(ctx, &g1, &nearest2, s);
-
-	}
-
-	/* Initialize start of line 1 */
-	p = rt_getPoint2d_cp(ctx, pa1, 0);
-	geographic_point_init(ctx, p->x, p->y, &(e1.start));
-	geog2cart(ctx, &(e1.start), &A1);
-
-
-	/* Handle line/line case */
-	for ( i = 1; i < pa1->npoints; i++ )
-	{
-		p = rt_getPoint2d_cp(ctx, pa1, i);
-		geographic_point_init(ctx, p->x, p->y, &(e1.end));
-		geog2cart(ctx, &(e1.end), &A2);
-
-		/* Initialize start of line 2 */
-		p = rt_getPoint2d_cp(ctx, pa2, 0);
-		geographic_point_init(ctx, p->x, p->y, &(e2.start));
-		geog2cart(ctx, &(e2.start), &B1);
-
-		for ( j = 1; j < pa2->npoints; j++ )
-		{
-			double d;
-
-			p = rt_getPoint2d_cp(ctx, pa2, j);
-			geographic_point_init(ctx, p->x, p->y, &(e2.end));
-			geog2cart(ctx, &(e2.end), &B2);
-
-			RTDEBUGF(4, "e1.start == GPOINT(%.6g %.6g) ", e1.start.lat, e1.start.lon);
-			RTDEBUGF(4, "e1.end == GPOINT(%.6g %.6g) ", e1.end.lat, e1.end.lon);
-			RTDEBUGF(4, "e2.start == GPOINT(%.6g %.6g) ", e2.start.lat, e2.start.lon);
-			RTDEBUGF(4, "e2.end == GPOINT(%.6g %.6g) ", e2.end.lat, e2.end.lon);
-
-			if ( check_intersection && edge_intersects(ctx, &A1, &A2, &B1, &B2) )
-			{
-				RTDEBUG(4,"edge intersection! returning 0.0");
-				return 0.0;
-			}
-			d = s->radius * edge_distance_to_edge(ctx, &e1, &e2, &g1, &g2);
-			RTDEBUGF(4,"got edge_distance_to_edge %.8g", d);
-
-			if ( d < distance )
-			{
-				distance = d;
-				nearest1 = g1;
-				nearest2 = g2;
-			}
-			if ( d < tolerance )
-			{
-				if ( use_sphere )
-				{
-					return d;
-				}
-				else
-				{
-					d = spheroid_distance(ctx, &nearest1, &nearest2, s);
-					if ( d < tolerance )
-						return d;
-				}
-			}
-
-			/* Copy end to start to allow a new end value in next iteration */
-			e2.start = e2.end;
-			B1 = B2;
-		}
-
-		/* Copy end to start to allow a new end value in next iteration */
-		e1.start = e1.end;
-		A1 = A2;
-	}
-	RTDEBUGF(4,"finished all loops, returning %.8g", distance);
-
-	if ( use_sphere )
-		return distance;
-	else
-		return spheroid_distance(ctx, &nearest1, &nearest2, s);
+  GEOGRAPHIC_EDGE e1, e2;
+  GEOGRAPHIC_POINT g1, g2;
+  GEOGRAPHIC_POINT nearest1, nearest2;
+  POINT3D A1, A2, B1, B2;
+  const RTPOINT2D *p;
+  double distance;
+  int i, j;
+  int use_sphere = (s->a == s->b ? 1 : 0);
+
+  /* Make result really big, so that everything will be smaller than it */
+  distance = FLT_MAX;
+
+  /* Empty point arrays? Return negative */
+  if ( pa1->npoints == 0 || pa2->npoints == 0 )
+    return -1.0;
+
+  /* Handle point/point case here */
+  if ( pa1->npoints == 1 && pa2->npoints == 1 )
+  {
+    p = rt_getPoint2d_cp(ctx, pa1, 0);
+    geographic_point_init(ctx, p->x, p->y, &g1);
+    p = rt_getPoint2d_cp(ctx, pa2, 0);
+    geographic_point_init(ctx, p->x, p->y, &g2);
+    /* Sphere special case, axes equal */
+    distance = s->radius * sphere_distance(ctx, &g1, &g2);
+    if ( use_sphere )
+      return distance;
+    /* Below tolerance, actual distance isn't of interest */
+    else if ( distance < 0.95 * tolerance )
+      return distance;
+    /* Close or greater than tolerance, get the real answer to be sure */
+    else
+      return spheroid_distance(ctx, &g1, &g2, s);
+  }
+
+  /* Handle point/line case here */
+  if ( pa1->npoints == 1 || pa2->npoints == 1 )
+  {
+    /* Handle one/many case here */
+    int i;
+    const RTPOINTARRAY *pa_one;
+    const RTPOINTARRAY *pa_many;
+
+    if ( pa1->npoints == 1 )
+    {
+      pa_one = pa1;
+      pa_many = pa2;
+    }
+    else
+    {
+      pa_one = pa2;
+      pa_many = pa1;
+    }
+
+    /* Initialize our point */
+    p = rt_getPoint2d_cp(ctx, pa_one, 0);
+    geographic_point_init(ctx, p->x, p->y, &g1);
+
+    /* Initialize start of line */
+    p = rt_getPoint2d_cp(ctx, pa_many, 0);
+    geographic_point_init(ctx, p->x, p->y, &(e1.start));
+
+    /* Iterate through the edges in our line */
+    for ( i = 1; i < pa_many->npoints; i++ )
+    {
+      double d;
+      p = rt_getPoint2d_cp(ctx, pa_many, i);
+      geographic_point_init(ctx, p->x, p->y, &(e1.end));
+      /* Get the spherical distance between point and edge */
+      d = s->radius * edge_distance_to_point(ctx, &e1, &g1, &g2);
+      /* New shortest distance! Record this distance / location */
+      if ( d < distance )
+      {
+        distance = d;
+        nearest2 = g2;
+      }
+      /* We've gotten closer than the tolerance... */
+      if ( d < tolerance )
+      {
+        /* Working on a sphere? The answer is correct, return */
+        if ( use_sphere )
+        {
+          return d;
+        }
+        /* Far enough past the tolerance that the spheroid calculation won't change things */
+        else if ( d < tolerance * 0.95 )
+        {
+          return d;
+        }
+        /* On a spheroid and near the tolerance? Confirm that we are *actually* closer than tolerance */
+        else
+        {
+          d = spheroid_distance(ctx, &g1, &nearest2, s);
+          /* Yes, closer than tolerance, return! */
+          if ( d < tolerance )
+            return d;
+        }
+      }
+      e1.start = e1.end;
+    }
+
+    /* On sphere, return answer */
+    if ( use_sphere )
+      return distance;
+    /* On spheroid, calculate final answer based on closest approach */
+    else
+      return spheroid_distance(ctx, &g1, &nearest2, s);
+
+  }
+
+  /* Initialize start of line 1 */
+  p = rt_getPoint2d_cp(ctx, pa1, 0);
+  geographic_point_init(ctx, p->x, p->y, &(e1.start));
+  geog2cart(ctx, &(e1.start), &A1);
+
+
+  /* Handle line/line case */
+  for ( i = 1; i < pa1->npoints; i++ )
+  {
+    p = rt_getPoint2d_cp(ctx, pa1, i);
+    geographic_point_init(ctx, p->x, p->y, &(e1.end));
+    geog2cart(ctx, &(e1.end), &A2);
+
+    /* Initialize start of line 2 */
+    p = rt_getPoint2d_cp(ctx, pa2, 0);
+    geographic_point_init(ctx, p->x, p->y, &(e2.start));
+    geog2cart(ctx, &(e2.start), &B1);
+
+    for ( j = 1; j < pa2->npoints; j++ )
+    {
+      double d;
+
+      p = rt_getPoint2d_cp(ctx, pa2, j);
+      geographic_point_init(ctx, p->x, p->y, &(e2.end));
+      geog2cart(ctx, &(e2.end), &B2);
+
+      RTDEBUGF(4, "e1.start == GPOINT(%.6g %.6g) ", e1.start.lat, e1.start.lon);
+      RTDEBUGF(4, "e1.end == GPOINT(%.6g %.6g) ", e1.end.lat, e1.end.lon);
+      RTDEBUGF(4, "e2.start == GPOINT(%.6g %.6g) ", e2.start.lat, e2.start.lon);
+      RTDEBUGF(4, "e2.end == GPOINT(%.6g %.6g) ", e2.end.lat, e2.end.lon);
+
+      if ( check_intersection && edge_intersects(ctx, &A1, &A2, &B1, &B2) )
+      {
+        RTDEBUG(4,"edge intersection! returning 0.0");
+        return 0.0;
+      }
+      d = s->radius * edge_distance_to_edge(ctx, &e1, &e2, &g1, &g2);
+      RTDEBUGF(4,"got edge_distance_to_edge %.8g", d);
+
+      if ( d < distance )
+      {
+        distance = d;
+        nearest1 = g1;
+        nearest2 = g2;
+      }
+      if ( d < tolerance )
+      {
+        if ( use_sphere )
+        {
+          return d;
+        }
+        else
+        {
+          d = spheroid_distance(ctx, &nearest1, &nearest2, s);
+          if ( d < tolerance )
+            return d;
+        }
+      }
+
+      /* Copy end to start to allow a new end value in next iteration */
+      e2.start = e2.end;
+      B1 = B2;
+    }
+
+    /* Copy end to start to allow a new end value in next iteration */
+    e1.start = e1.end;
+    A1 = A2;
+  }
+  RTDEBUGF(4,"finished all loops, returning %.8g", distance);
+
+  if ( use_sphere )
+    return distance;
+  else
+    return spheroid_distance(ctx, &nearest1, &nearest2, s);
 }
 
 
@@ -1941,60 +1941,60 @@ static double ptarray_distance_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa
 */
 double rtgeom_area_sphere(const RTCTX *ctx, const RTGEOM *rtgeom, const SPHEROID *spheroid)
 {
-	int type;
-	double radius2 = spheroid->radius * spheroid->radius;
+  int type;
+  double radius2 = spheroid->radius * spheroid->radius;
 
-	assert(rtgeom);
+  assert(rtgeom);
 
-	/* No area in nothing */
-	if ( rtgeom_is_empty(ctx, rtgeom) )
-		return 0.0;
+  /* No area in nothing */
+  if ( rtgeom_is_empty(ctx, rtgeom) )
+    return 0.0;
 
-	/* Read the geometry type number */
-	type = rtgeom->type;
+  /* Read the geometry type number */
+  type = rtgeom->type;
 
-	/* Anything but polygons and collections returns zero */
-	if ( ! ( type == RTPOLYGONTYPE || type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE ) )
-		return 0.0;
+  /* Anything but polygons and collections returns zero */
+  if ( ! ( type == RTPOLYGONTYPE || type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE ) )
+    return 0.0;
 
-	/* Actually calculate area */
-	if ( type == RTPOLYGONTYPE )
-	{
-		RTPOLY *poly = (RTPOLY*)rtgeom;
-		int i;
-		double area = 0.0;
+  /* Actually calculate area */
+  if ( type == RTPOLYGONTYPE )
+  {
+    RTPOLY *poly = (RTPOLY*)rtgeom;
+    int i;
+    double area = 0.0;
 
-		/* Just in case there's no rings */
-		if ( poly->nrings < 1 )
-			return 0.0;
+    /* Just in case there's no rings */
+    if ( poly->nrings < 1 )
+      return 0.0;
 
-		/* First, the area of the outer ring */
-		area += radius2 * ptarray_area_sphere(ctx, poly->rings[0]);
+    /* First, the area of the outer ring */
+    area += radius2 * ptarray_area_sphere(ctx, poly->rings[0]);
 
-		/* Subtract areas of inner rings */
-		for ( i = 1; i < poly->nrings; i++ )
-		{
-			area -= radius2 * ptarray_area_sphere(ctx, poly->rings[i]);
-		}
-		return area;
-	}
+    /* Subtract areas of inner rings */
+    for ( i = 1; i < poly->nrings; i++ )
+    {
+      area -= radius2 * ptarray_area_sphere(ctx, poly->rings[i]);
+    }
+    return area;
+  }
 
-	/* Recurse into sub-geometries to get area */
-	if ( type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE )
-	{
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom;
-		int i;
-		double area = 0.0;
+  /* Recurse into sub-geometries to get area */
+  if ( type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE )
+  {
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom;
+    int i;
+    double area = 0.0;
 
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			area += rtgeom_area_sphere(ctx, col->geoms[i], spheroid);
-		}
-		return area;
-	}
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      area += rtgeom_area_sphere(ctx, col->geoms[i], spheroid);
+    }
+    return area;
+  }
 
-	/* Shouldn't get here. */
-	return 0.0;
+  /* Shouldn't get here. */
+  return 0.0;
 }
 
 
@@ -2005,52 +2005,52 @@ double rtgeom_area_sphere(const RTCTX *ctx, const RTGEOM *rtgeom, const SPHEROID
 * @param distance - distance, in units of the spheroid def'n.
 * @param azimuth - azimuth in radians.
 * @return s - location of projected point.
-* 
+*
 */
 RTPOINT* rtgeom_project_spheroid(const RTCTX *ctx, const RTPOINT *r, const SPHEROID *spheroid, double distance, double azimuth)
 {
-	GEOGRAPHIC_POINT geo_source, geo_dest;
-	RTPOINT4D pt_dest;
-	double x, y;
-	RTPOINTARRAY *pa;
-	RTPOINT *rtp;
-
-	/* Check the azimuth validity, convert to radians */
-	if ( azimuth < -2.0 * M_PI || azimuth > 2.0 * M_PI ) 
-	{
-		rterror(ctx, "Azimuth must be between -2PI and 2PI");
-		return NULL;
-	}
-
-	/* Check the distance validity */
-	if ( distance < 0.0 || distance > (M_PI * spheroid->radius) )
-	{
-		rterror(ctx, "Distance must be between 0 and %g", M_PI * spheroid->radius);
-		return NULL;
-	}
-		
-	/* Convert to ta geodetic point */
-	x = rtpoint_get_x(ctx, r);
-	y = rtpoint_get_y(ctx, r);
-	geographic_point_init(ctx, x, y, &geo_source);
-	
-	/* Try the projection */
-	if( spheroid_project(ctx, &geo_source, spheroid, distance, azimuth, &geo_dest) == RT_FAILURE ) 
-	{
-		RTDEBUGF(3, "Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
-		rterror(ctx, "Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
-		return NULL;
-	}
-	
-	/* Build the output RTPOINT */
-	pa = ptarray_construct(ctx, 0, 0, 1);
-	pt_dest.x = rad2deg(longitude_radians_normalize(ctx, geo_dest.lon));
-	pt_dest.y = rad2deg(latitude_radians_normalize(ctx, geo_dest.lat));
-	pt_dest.z = pt_dest.m = 0.0;
-	ptarray_set_point4d(ctx, pa, 0, &pt_dest);
-	rtp = rtpoint_construct(ctx, r->srid, NULL, pa);
-	rtgeom_set_geodetic(ctx, rtpoint_as_rtgeom(ctx, rtp), RT_TRUE);
-	return rtp;
+  GEOGRAPHIC_POINT geo_source, geo_dest;
+  RTPOINT4D pt_dest;
+  double x, y;
+  RTPOINTARRAY *pa;
+  RTPOINT *rtp;
+
+  /* Check the azimuth validity, convert to radians */
+  if ( azimuth < -2.0 * M_PI || azimuth > 2.0 * M_PI )
+  {
+    rterror(ctx, "Azimuth must be between -2PI and 2PI");
+    return NULL;
+  }
+
+  /* Check the distance validity */
+  if ( distance < 0.0 || distance > (M_PI * spheroid->radius) )
+  {
+    rterror(ctx, "Distance must be between 0 and %g", M_PI * spheroid->radius);
+    return NULL;
+  }
+
+  /* Convert to ta geodetic point */
+  x = rtpoint_get_x(ctx, r);
+  y = rtpoint_get_y(ctx, r);
+  geographic_point_init(ctx, x, y, &geo_source);
+
+  /* Try the projection */
+  if( spheroid_project(ctx, &geo_source, spheroid, distance, azimuth, &geo_dest) == RT_FAILURE )
+  {
+    RTDEBUGF(3, "Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
+    rterror(ctx, "Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
+    return NULL;
+  }
+
+  /* Build the output RTPOINT */
+  pa = ptarray_construct(ctx, 0, 0, 1);
+  pt_dest.x = rad2deg(longitude_radians_normalize(ctx, geo_dest.lon));
+  pt_dest.y = rad2deg(latitude_radians_normalize(ctx, geo_dest.lat));
+  pt_dest.z = pt_dest.m = 0.0;
+  ptarray_set_point4d(ctx, pa, 0, &pt_dest);
+  rtp = rtpoint_construct(ctx, r->srid, NULL, pa);
+  rtgeom_set_geodetic(ctx, rtpoint_as_rtgeom(ctx, rtp), RT_TRUE);
+  return rtp;
 }
 
 
@@ -2059,32 +2059,32 @@ RTPOINT* rtgeom_project_spheroid(const RTCTX *ctx, const RTPOINT *r, const SPHER
 * @param r - location of first point.
 * @param s - location of second point.
 * @param spheroid - spheroid definition.
-* @return azimuth - azimuth in radians. 
-* 
+* @return azimuth - azimuth in radians.
+*
 */
 double rtgeom_azumith_spheroid(const RTCTX *ctx, const RTPOINT *r, const RTPOINT *s, const SPHEROID *spheroid)
 {
-	GEOGRAPHIC_POINT g1, g2;
-	double x1, y1, x2, y2;
-
-	/* Convert r to a geodetic point */
-	x1 = rtpoint_get_x(ctx, r);
-	y1 = rtpoint_get_y(ctx, r);
-	geographic_point_init(ctx, x1, y1, &g1);
-
-	/* Convert s to a geodetic point */
-	x2 = rtpoint_get_x(ctx, s);
-	y2 = rtpoint_get_y(ctx, s);
-	geographic_point_init(ctx, x2, y2, &g2);
-	
-	/* Same point, return NaN */
-	if ( FP_EQUALS(x1, x2) && FP_EQUALS(y1, y2) )
-	{
-		return NAN;
-	}
-	
-	/* Do the direction calculation */
-	return spheroid_direction(ctx, &g1, &g2, spheroid);
+  GEOGRAPHIC_POINT g1, g2;
+  double x1, y1, x2, y2;
+
+  /* Convert r to a geodetic point */
+  x1 = rtpoint_get_x(ctx, r);
+  y1 = rtpoint_get_y(ctx, r);
+  geographic_point_init(ctx, x1, y1, &g1);
+
+  /* Convert s to a geodetic point */
+  x2 = rtpoint_get_x(ctx, s);
+  y2 = rtpoint_get_y(ctx, s);
+  geographic_point_init(ctx, x2, y2, &g2);
+
+  /* Same point, return NaN */
+  if ( FP_EQUALS(x1, x2) && FP_EQUALS(y1, y2) )
+  {
+    return NAN;
+  }
+
+  /* Do the direction calculation */
+  return spheroid_direction(ctx, &g1, &g2, spheroid);
 }
 
 /**
@@ -2095,302 +2095,302 @@ double rtgeom_azumith_spheroid(const RTCTX *ctx, const RTPOINT *r, const RTPOINT
 */
 double rtgeom_distance_spheroid(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2, const SPHEROID *spheroid, double tolerance)
 {
-	uint8_t type1, type2;
-	int check_intersection = RT_FALSE;
-	RTGBOX gbox1, gbox2;
-
-	gbox_init(ctx, &gbox1);
-	gbox_init(ctx, &gbox2);
-	
-	assert(rtgeom1);
-	assert(rtgeom2);
-	
-	RTDEBUGF(4, "entered function, tolerance %.8g", tolerance);
-
-	/* What's the distance to an empty geometry? We don't know.
-	   Return a negative number so the caller can catch this case. */
-	if ( rtgeom_is_empty(ctx, rtgeom1) || rtgeom_is_empty(ctx, rtgeom2) )
-	{
-		return -1.0;
-	}
-
-	type1 = rtgeom1->type;
-	type2 = rtgeom2->type;
-
-	/* Make sure we have boxes */
-	if ( rtgeom1->bbox )
-		gbox1 = *(rtgeom1->bbox);
-	else
-		rtgeom_calculate_gbox_geodetic(ctx, rtgeom1, &gbox1);
-
-	/* Make sure we have boxes */
-	if ( rtgeom2->bbox )
-		gbox2 = *(rtgeom2->bbox);
-	else
-		rtgeom_calculate_gbox_geodetic(ctx, rtgeom2, &gbox2);
-
-	/* If the boxes aren't disjoint, we have to check for edge intersections */
-	if ( gbox_overlaps(ctx, &gbox1, &gbox2) )
-		check_intersection = RT_TRUE;
-
-	/* Point/line combinations can all be handled with simple point array iterations */
-	if ( ( type1 == RTPOINTTYPE || type1 == RTLINETYPE ) &&
-	     ( type2 == RTPOINTTYPE || type2 == RTLINETYPE ) )
-	{
-		RTPOINTARRAY *pa1, *pa2;
-
-		if ( type1 == RTPOINTTYPE )
-			pa1 = ((RTPOINT*)rtgeom1)->point;
-		else
-			pa1 = ((RTLINE*)rtgeom1)->points;
-
-		if ( type2 == RTPOINTTYPE )
-			pa2 = ((RTPOINT*)rtgeom2)->point;
-		else
-			pa2 = ((RTLINE*)rtgeom2)->points;
-
-		return ptarray_distance_spheroid(ctx, pa1, pa2, spheroid, tolerance, check_intersection);
-	}
-
-	/* Point/Polygon cases, if point-in-poly, return zero, else return distance. */
-	if ( ( type1 == RTPOLYGONTYPE && type2 == RTPOINTTYPE ) ||
-	     ( type2 == RTPOLYGONTYPE && type1 == RTPOINTTYPE ) )
-	{
-		const RTPOINT2D *p;
-		RTPOLY *rtpoly;
-		RTPOINT *rtpt;
-		double distance = FLT_MAX;
-		int i;
-
-		if ( type1 == RTPOINTTYPE )
-		{
-			rtpt = (RTPOINT*)rtgeom1;
-			rtpoly = (RTPOLY*)rtgeom2;
-		}
-		else
-		{
-			rtpt = (RTPOINT*)rtgeom2;
-			rtpoly = (RTPOLY*)rtgeom1;
-		}
-		p = rt_getPoint2d_cp(ctx, rtpt->point, 0);
-
-		/* Point in polygon implies zero distance */
-		if ( rtpoly_covers_point2d(ctx, rtpoly, p) )
-		{
-			return 0.0;
-		}
-		
-		/* Not inside, so what's the actual distance? */
-		for ( i = 0; i < rtpoly->nrings; i++ )
-		{
-			double ring_distance = ptarray_distance_spheroid(ctx, rtpoly->rings[i], rtpt->point, spheroid, tolerance, check_intersection);
-			if ( ring_distance < distance )
-				distance = ring_distance;
-			if ( distance < tolerance )
-				return distance;
-		}
-		return distance;
-	}
-
-	/* Line/polygon case, if start point-in-poly, return zero, else return distance. */
-	if ( ( type1 == RTPOLYGONTYPE && type2 == RTLINETYPE ) ||
-	     ( type2 == RTPOLYGONTYPE && type1 == RTLINETYPE ) )
-	{
-		const RTPOINT2D *p;
-		RTPOLY *rtpoly;
-		RTLINE *rtline;
-		double distance = FLT_MAX;
-		int i;
-
-		if ( type1 == RTLINETYPE )
-		{
-			rtline = (RTLINE*)rtgeom1;
-			rtpoly = (RTPOLY*)rtgeom2;
-		}
-		else
-		{
-			rtline = (RTLINE*)rtgeom2;
-			rtpoly = (RTPOLY*)rtgeom1;
-		}
-		p = rt_getPoint2d_cp(ctx, rtline->points, 0);
-
-		RTDEBUG(4, "checking if a point of line is in polygon");
-
-		/* Point in polygon implies zero distance */
-		if ( rtpoly_covers_point2d(ctx, rtpoly, p) ) 
-			return 0.0;
-
-		RTDEBUG(4, "checking ring distances");
-
-		/* Not contained, so what's the actual distance? */
-		for ( i = 0; i < rtpoly->nrings; i++ )
-		{
-			double ring_distance = ptarray_distance_spheroid(ctx, rtpoly->rings[i], rtline->points, spheroid, tolerance, check_intersection);
-			RTDEBUGF(4, "ring[%d] ring_distance = %.8g", i, ring_distance);
-			if ( ring_distance < distance )
-				distance = ring_distance;
-			if ( distance < tolerance )
-				return distance;
-		}
-		RTDEBUGF(4, "all rings checked, returning distance = %.8g", distance);
-		return distance;
-
-	}
-
-	/* Polygon/polygon case, if start point-in-poly, return zero, else return distance. */
-	if ( ( type1 == RTPOLYGONTYPE && type2 == RTPOLYGONTYPE ) ||
-	     ( type2 == RTPOLYGONTYPE && type1 == RTPOLYGONTYPE ) )
-	{
-		const RTPOINT2D *p;
-		RTPOLY *rtpoly1 = (RTPOLY*)rtgeom1;
-		RTPOLY *rtpoly2 = (RTPOLY*)rtgeom2;
-		double distance = FLT_MAX;
-		int i, j;
-
-		/* Point of 2 in polygon 1 implies zero distance */
-		p = rt_getPoint2d_cp(ctx, rtpoly1->rings[0], 0);
-		if ( rtpoly_covers_point2d(ctx, rtpoly2, p) )
-			return 0.0;
-
-		/* Point of 1 in polygon 2 implies zero distance */
-		p = rt_getPoint2d_cp(ctx, rtpoly2->rings[0], 0);
-		if ( rtpoly_covers_point2d(ctx, rtpoly1, p) )
-			return 0.0;
-
-		/* Not contained, so what's the actual distance? */
-		for ( i = 0; i < rtpoly1->nrings; i++ )
-		{
-			for ( j = 0; j < rtpoly2->nrings; j++ )
-			{
-				double ring_distance = ptarray_distance_spheroid(ctx, rtpoly1->rings[i], rtpoly2->rings[j], spheroid, tolerance, check_intersection);
-				if ( ring_distance < distance )
-					distance = ring_distance;
-				if ( distance < tolerance )
-					return distance;
-			}
-		}
-		return distance;
-	}
-
-	/* Recurse into collections */
-	if ( rttype_is_collection(ctx, type1) )
-	{
-		int i;
-		double distance = FLT_MAX;
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom1;
-
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			double geom_distance = rtgeom_distance_spheroid(ctx, col->geoms[i], rtgeom2, spheroid, tolerance);
-			if ( geom_distance < distance )
-				distance = geom_distance;
-			if ( distance < tolerance )
-				return distance;
-		}
-		return distance;
-	}
-
-	/* Recurse into collections */
-	if ( rttype_is_collection(ctx, type2) )
-	{
-		int i;
-		double distance = FLT_MAX;
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom2;
-
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			double geom_distance = rtgeom_distance_spheroid(ctx, rtgeom1, col->geoms[i], spheroid, tolerance);
-			if ( geom_distance < distance )
-				distance = geom_distance;
-			if ( distance < tolerance )
-				return distance;
-		}
-		return distance;
-	}
-
-
-	rterror(ctx, "arguments include unsupported geometry type (%s, %s)", rttype_name(ctx, type1), rttype_name(ctx, type1));
-	return -1.0;
+  uint8_t type1, type2;
+  int check_intersection = RT_FALSE;
+  RTGBOX gbox1, gbox2;
+
+  gbox_init(ctx, &gbox1);
+  gbox_init(ctx, &gbox2);
+
+  assert(rtgeom1);
+  assert(rtgeom2);
+
+  RTDEBUGF(4, "entered function, tolerance %.8g", tolerance);
+
+  /* What's the distance to an empty geometry? We don't know.
+     Return a negative number so the caller can catch this case. */
+  if ( rtgeom_is_empty(ctx, rtgeom1) || rtgeom_is_empty(ctx, rtgeom2) )
+  {
+    return -1.0;
+  }
+
+  type1 = rtgeom1->type;
+  type2 = rtgeom2->type;
+
+  /* Make sure we have boxes */
+  if ( rtgeom1->bbox )
+    gbox1 = *(rtgeom1->bbox);
+  else
+    rtgeom_calculate_gbox_geodetic(ctx, rtgeom1, &gbox1);
+
+  /* Make sure we have boxes */
+  if ( rtgeom2->bbox )
+    gbox2 = *(rtgeom2->bbox);
+  else
+    rtgeom_calculate_gbox_geodetic(ctx, rtgeom2, &gbox2);
+
+  /* If the boxes aren't disjoint, we have to check for edge intersections */
+  if ( gbox_overlaps(ctx, &gbox1, &gbox2) )
+    check_intersection = RT_TRUE;
+
+  /* Point/line combinations can all be handled with simple point array iterations */
+  if ( ( type1 == RTPOINTTYPE || type1 == RTLINETYPE ) &&
+       ( type2 == RTPOINTTYPE || type2 == RTLINETYPE ) )
+  {
+    RTPOINTARRAY *pa1, *pa2;
+
+    if ( type1 == RTPOINTTYPE )
+      pa1 = ((RTPOINT*)rtgeom1)->point;
+    else
+      pa1 = ((RTLINE*)rtgeom1)->points;
+
+    if ( type2 == RTPOINTTYPE )
+      pa2 = ((RTPOINT*)rtgeom2)->point;
+    else
+      pa2 = ((RTLINE*)rtgeom2)->points;
+
+    return ptarray_distance_spheroid(ctx, pa1, pa2, spheroid, tolerance, check_intersection);
+  }
+
+  /* Point/Polygon cases, if point-in-poly, return zero, else return distance. */
+  if ( ( type1 == RTPOLYGONTYPE && type2 == RTPOINTTYPE ) ||
+       ( type2 == RTPOLYGONTYPE && type1 == RTPOINTTYPE ) )
+  {
+    const RTPOINT2D *p;
+    RTPOLY *rtpoly;
+    RTPOINT *rtpt;
+    double distance = FLT_MAX;
+    int i;
+
+    if ( type1 == RTPOINTTYPE )
+    {
+      rtpt = (RTPOINT*)rtgeom1;
+      rtpoly = (RTPOLY*)rtgeom2;
+    }
+    else
+    {
+      rtpt = (RTPOINT*)rtgeom2;
+      rtpoly = (RTPOLY*)rtgeom1;
+    }
+    p = rt_getPoint2d_cp(ctx, rtpt->point, 0);
+
+    /* Point in polygon implies zero distance */
+    if ( rtpoly_covers_point2d(ctx, rtpoly, p) )
+    {
+      return 0.0;
+    }
+
+    /* Not inside, so what's the actual distance? */
+    for ( i = 0; i < rtpoly->nrings; i++ )
+    {
+      double ring_distance = ptarray_distance_spheroid(ctx, rtpoly->rings[i], rtpt->point, spheroid, tolerance, check_intersection);
+      if ( ring_distance < distance )
+        distance = ring_distance;
+      if ( distance < tolerance )
+        return distance;
+    }
+    return distance;
+  }
+
+  /* Line/polygon case, if start point-in-poly, return zero, else return distance. */
+  if ( ( type1 == RTPOLYGONTYPE && type2 == RTLINETYPE ) ||
+       ( type2 == RTPOLYGONTYPE && type1 == RTLINETYPE ) )
+  {
+    const RTPOINT2D *p;
+    RTPOLY *rtpoly;
+    RTLINE *rtline;
+    double distance = FLT_MAX;
+    int i;
+
+    if ( type1 == RTLINETYPE )
+    {
+      rtline = (RTLINE*)rtgeom1;
+      rtpoly = (RTPOLY*)rtgeom2;
+    }
+    else
+    {
+      rtline = (RTLINE*)rtgeom2;
+      rtpoly = (RTPOLY*)rtgeom1;
+    }
+    p = rt_getPoint2d_cp(ctx, rtline->points, 0);
+
+    RTDEBUG(4, "checking if a point of line is in polygon");
+
+    /* Point in polygon implies zero distance */
+    if ( rtpoly_covers_point2d(ctx, rtpoly, p) )
+      return 0.0;
+
+    RTDEBUG(4, "checking ring distances");
+
+    /* Not contained, so what's the actual distance? */
+    for ( i = 0; i < rtpoly->nrings; i++ )
+    {
+      double ring_distance = ptarray_distance_spheroid(ctx, rtpoly->rings[i], rtline->points, spheroid, tolerance, check_intersection);
+      RTDEBUGF(4, "ring[%d] ring_distance = %.8g", i, ring_distance);
+      if ( ring_distance < distance )
+        distance = ring_distance;
+      if ( distance < tolerance )
+        return distance;
+    }
+    RTDEBUGF(4, "all rings checked, returning distance = %.8g", distance);
+    return distance;
+
+  }
+
+  /* Polygon/polygon case, if start point-in-poly, return zero, else return distance. */
+  if ( ( type1 == RTPOLYGONTYPE && type2 == RTPOLYGONTYPE ) ||
+       ( type2 == RTPOLYGONTYPE && type1 == RTPOLYGONTYPE ) )
+  {
+    const RTPOINT2D *p;
+    RTPOLY *rtpoly1 = (RTPOLY*)rtgeom1;
+    RTPOLY *rtpoly2 = (RTPOLY*)rtgeom2;
+    double distance = FLT_MAX;
+    int i, j;
+
+    /* Point of 2 in polygon 1 implies zero distance */
+    p = rt_getPoint2d_cp(ctx, rtpoly1->rings[0], 0);
+    if ( rtpoly_covers_point2d(ctx, rtpoly2, p) )
+      return 0.0;
+
+    /* Point of 1 in polygon 2 implies zero distance */
+    p = rt_getPoint2d_cp(ctx, rtpoly2->rings[0], 0);
+    if ( rtpoly_covers_point2d(ctx, rtpoly1, p) )
+      return 0.0;
+
+    /* Not contained, so what's the actual distance? */
+    for ( i = 0; i < rtpoly1->nrings; i++ )
+    {
+      for ( j = 0; j < rtpoly2->nrings; j++ )
+      {
+        double ring_distance = ptarray_distance_spheroid(ctx, rtpoly1->rings[i], rtpoly2->rings[j], spheroid, tolerance, check_intersection);
+        if ( ring_distance < distance )
+          distance = ring_distance;
+        if ( distance < tolerance )
+          return distance;
+      }
+    }
+    return distance;
+  }
+
+  /* Recurse into collections */
+  if ( rttype_is_collection(ctx, type1) )
+  {
+    int i;
+    double distance = FLT_MAX;
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom1;
+
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      double geom_distance = rtgeom_distance_spheroid(ctx, col->geoms[i], rtgeom2, spheroid, tolerance);
+      if ( geom_distance < distance )
+        distance = geom_distance;
+      if ( distance < tolerance )
+        return distance;
+    }
+    return distance;
+  }
+
+  /* Recurse into collections */
+  if ( rttype_is_collection(ctx, type2) )
+  {
+    int i;
+    double distance = FLT_MAX;
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom2;
+
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      double geom_distance = rtgeom_distance_spheroid(ctx, rtgeom1, col->geoms[i], spheroid, tolerance);
+      if ( geom_distance < distance )
+        distance = geom_distance;
+      if ( distance < tolerance )
+        return distance;
+    }
+    return distance;
+  }
+
+
+  rterror(ctx, "arguments include unsupported geometry type (%s, %s)", rttype_name(ctx, type1), rttype_name(ctx, type1));
+  return -1.0;
 
 }
 
 
 int rtgeom_covers_rtgeom_sphere(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2)
 {
-	int type1, type2;
-	RTGBOX gbox1, gbox2;
-	gbox1.flags = gbox2.flags = 0;
-		
-	assert(rtgeom1);
-	assert(rtgeom2);
-
-	type1 = rtgeom1->type;
-	type2 = rtgeom2->type;
-
-	/* Currently a restricted implementation */
-	if ( ! ( (type1 == RTPOLYGONTYPE || type1 == RTMULTIPOLYGONTYPE || type1 == RTCOLLECTIONTYPE) &&
-	         (type2 == RTPOINTTYPE || type2 == RTMULTIPOINTTYPE || type2 == RTCOLLECTIONTYPE) ) )
-	{
-		rterror(ctx, "rtgeom_covers_rtgeom_sphere: only POLYGON covers POINT tests are currently supported");
-		return RT_FALSE;
-	}
-
-	/* Make sure we have boxes */
-	if ( rtgeom1->bbox )
-		gbox1 = *(rtgeom1->bbox);
-	else
-		rtgeom_calculate_gbox_geodetic(ctx, rtgeom1, &gbox1);
-
-	/* Make sure we have boxes */
-	if ( rtgeom2->bbox )
-		gbox2 = *(rtgeom2->bbox);
-	else
-		rtgeom_calculate_gbox_geodetic(ctx, rtgeom2, &gbox2);
-
-
-	/* Handle the polygon/point case */
-	if ( type1 == RTPOLYGONTYPE && type2 == RTPOINTTYPE )
-	{
-		RTPOINT2D pt_to_test;
-		rt_getPoint2d_p(ctx, ((RTPOINT*)rtgeom2)->point, 0, &pt_to_test);
-		return rtpoly_covers_point2d(ctx, (RTPOLY*)rtgeom1, &pt_to_test);
-	}
-
-	/* If any of the first argument parts covers the second argument, it's true */
-	if ( rttype_is_collection(ctx,  type1 ) )
-	{
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom1;
-
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			if ( rtgeom_covers_rtgeom_sphere(ctx, col->geoms[i], rtgeom2) )
-			{
-				return RT_TRUE;
-			}
-		}
-		return RT_FALSE;
-	}
-
-	/* Only if all of the second arguments are covered by the first argument is the condition true */
-	if ( rttype_is_collection(ctx,  type2 ) )
-	{
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom2;
-
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			if ( ! rtgeom_covers_rtgeom_sphere(ctx, rtgeom1, col->geoms[i]) )
-			{
-				return RT_FALSE;
-			}
-		}
-		return RT_TRUE;
-	}
-
-	/* Don't get here */
-	rterror(ctx, "rtgeom_covers_rtgeom_sphere: reached end of function without resolution");
-	return RT_FALSE;
+  int type1, type2;
+  RTGBOX gbox1, gbox2;
+  gbox1.flags = gbox2.flags = 0;
+
+  assert(rtgeom1);
+  assert(rtgeom2);
+
+  type1 = rtgeom1->type;
+  type2 = rtgeom2->type;
+
+  /* Currently a restricted implementation */
+  if ( ! ( (type1 == RTPOLYGONTYPE || type1 == RTMULTIPOLYGONTYPE || type1 == RTCOLLECTIONTYPE) &&
+           (type2 == RTPOINTTYPE || type2 == RTMULTIPOINTTYPE || type2 == RTCOLLECTIONTYPE) ) )
+  {
+    rterror(ctx, "rtgeom_covers_rtgeom_sphere: only POLYGON covers POINT tests are currently supported");
+    return RT_FALSE;
+  }
+
+  /* Make sure we have boxes */
+  if ( rtgeom1->bbox )
+    gbox1 = *(rtgeom1->bbox);
+  else
+    rtgeom_calculate_gbox_geodetic(ctx, rtgeom1, &gbox1);
+
+  /* Make sure we have boxes */
+  if ( rtgeom2->bbox )
+    gbox2 = *(rtgeom2->bbox);
+  else
+    rtgeom_calculate_gbox_geodetic(ctx, rtgeom2, &gbox2);
+
+
+  /* Handle the polygon/point case */
+  if ( type1 == RTPOLYGONTYPE && type2 == RTPOINTTYPE )
+  {
+    RTPOINT2D pt_to_test;
+    rt_getPoint2d_p(ctx, ((RTPOINT*)rtgeom2)->point, 0, &pt_to_test);
+    return rtpoly_covers_point2d(ctx, (RTPOLY*)rtgeom1, &pt_to_test);
+  }
+
+  /* If any of the first argument parts covers the second argument, it's true */
+  if ( rttype_is_collection(ctx,  type1 ) )
+  {
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom1;
+
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      if ( rtgeom_covers_rtgeom_sphere(ctx, col->geoms[i], rtgeom2) )
+      {
+        return RT_TRUE;
+      }
+    }
+    return RT_FALSE;
+  }
+
+  /* Only if all of the second arguments are covered by the first argument is the condition true */
+  if ( rttype_is_collection(ctx,  type2 ) )
+  {
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom2;
+
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      if ( ! rtgeom_covers_rtgeom_sphere(ctx, rtgeom1, col->geoms[i]) )
+      {
+        return RT_FALSE;
+      }
+    }
+    return RT_TRUE;
+  }
+
+  /* Don't get here */
+  rterror(ctx, "rtgeom_covers_rtgeom_sphere: reached end of function without resolution");
+  return RT_FALSE;
 
 }
 
@@ -2401,72 +2401,72 @@ int rtgeom_covers_rtgeom_sphere(const RTCTX *ctx, const RTGEOM *rtgeom1, const R
 */
 int rtpoly_covers_point2d(const RTCTX *ctx, const RTPOLY *poly, const RTPOINT2D *pt_to_test)
 {
-	int i;
-	int in_hole_count = 0;
-	POINT3D p;
-	GEOGRAPHIC_POINT gpt_to_test;
-	RTPOINT2D pt_outside;
-	RTGBOX gbox;
-	gbox.flags = 0;
-
-	/* Nulls and empties don't contain anything! */
-	if ( ! poly || rtgeom_is_empty(ctx, (RTGEOM*)poly) )
-	{
-		RTDEBUG(4,"returning false, geometry is empty or null");
-		return RT_FALSE;
-	}
-
-	/* Make sure we have boxes */
-	if ( poly->bbox )
-		gbox = *(poly->bbox);
-	else
-		rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)poly, &gbox);
-
-	/* Point not in box? Done! */
-	geographic_point_init(ctx, pt_to_test->x, pt_to_test->y, &gpt_to_test);
-	geog2cart(ctx, &gpt_to_test, &p);
-	if ( ! gbox_contains_point3d(ctx, &gbox, &p) )
-	{
-		RTDEBUG(4, "the point is not in the box!");
-		return RT_FALSE;
-	}
-
-	/* Calculate our outside point from the gbox */
-	gbox_pt_outside(ctx, &gbox, &pt_outside);
-
-	RTDEBUGF(4, "pt_outside POINT(%.18g %.18g)", pt_outside.x, pt_outside.y);
-	RTDEBUGF(4, "pt_to_test POINT(%.18g %.18g)", pt_to_test->x, pt_to_test->y);
-	RTDEBUGF(4, "polygon %s", rtgeom_to_ewkt(ctx, (RTGEOM*)poly));
-	RTDEBUGF(4, "gbox %s", gbox_to_string(ctx, &gbox));
-
-	/* Not in outer ring? We're done! */
-	if ( ! ptarray_contains_point_sphere(ctx, poly->rings[0], &pt_outside, pt_to_test) )
-	{
-		RTDEBUG(4,"returning false, point is outside ring");
-		return RT_FALSE;
-	}
-
-	RTDEBUGF(4, "testing %d rings", poly->nrings);
-
-	/* But maybe point is in a hole... */
-	for ( i = 1; i < poly->nrings; i++ )
-	{
-		RTDEBUGF(4, "ring test loop %d", i);
-		/* Count up hole containment. Odd => outside boundary. */
-		if ( ptarray_contains_point_sphere(ctx, poly->rings[i], &pt_outside, pt_to_test) )
-			in_hole_count++;
-	}
-
-	RTDEBUGF(4, "in_hole_count == %d", in_hole_count);
-
-	if ( in_hole_count % 2 )
-	{
-		RTDEBUG(4,"returning false, inner ring containment count is odd");
-		return RT_FALSE;
-	}
-
-	RTDEBUG(4,"returning true, inner ring containment count is even");
-	return RT_TRUE;
+  int i;
+  int in_hole_count = 0;
+  POINT3D p;
+  GEOGRAPHIC_POINT gpt_to_test;
+  RTPOINT2D pt_outside;
+  RTGBOX gbox;
+  gbox.flags = 0;
+
+  /* Nulls and empties don't contain anything! */
+  if ( ! poly || rtgeom_is_empty(ctx, (RTGEOM*)poly) )
+  {
+    RTDEBUG(4,"returning false, geometry is empty or null");
+    return RT_FALSE;
+  }
+
+  /* Make sure we have boxes */
+  if ( poly->bbox )
+    gbox = *(poly->bbox);
+  else
+    rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)poly, &gbox);
+
+  /* Point not in box? Done! */
+  geographic_point_init(ctx, pt_to_test->x, pt_to_test->y, &gpt_to_test);
+  geog2cart(ctx, &gpt_to_test, &p);
+  if ( ! gbox_contains_point3d(ctx, &gbox, &p) )
+  {
+    RTDEBUG(4, "the point is not in the box!");
+    return RT_FALSE;
+  }
+
+  /* Calculate our outside point from the gbox */
+  gbox_pt_outside(ctx, &gbox, &pt_outside);
+
+  RTDEBUGF(4, "pt_outside POINT(%.18g %.18g)", pt_outside.x, pt_outside.y);
+  RTDEBUGF(4, "pt_to_test POINT(%.18g %.18g)", pt_to_test->x, pt_to_test->y);
+  RTDEBUGF(4, "polygon %s", rtgeom_to_ewkt(ctx, (RTGEOM*)poly));
+  RTDEBUGF(4, "gbox %s", gbox_to_string(ctx, &gbox));
+
+  /* Not in outer ring? We're done! */
+  if ( ! ptarray_contains_point_sphere(ctx, poly->rings[0], &pt_outside, pt_to_test) )
+  {
+    RTDEBUG(4,"returning false, point is outside ring");
+    return RT_FALSE;
+  }
+
+  RTDEBUGF(4, "testing %d rings", poly->nrings);
+
+  /* But maybe point is in a hole... */
+  for ( i = 1; i < poly->nrings; i++ )
+  {
+    RTDEBUGF(4, "ring test loop %d", i);
+    /* Count up hole containment. Odd => outside boundary. */
+    if ( ptarray_contains_point_sphere(ctx, poly->rings[i], &pt_outside, pt_to_test) )
+      in_hole_count++;
+  }
+
+  RTDEBUGF(4, "in_hole_count == %d", in_hole_count);
+
+  if ( in_hole_count % 2 )
+  {
+    RTDEBUG(4,"returning false, inner ring containment count is odd");
+    return RT_FALSE;
+  }
+
+  RTDEBUG(4,"returning true, inner ring containment count is even");
+  return RT_TRUE;
 }
 
 
@@ -2476,581 +2476,581 @@ int rtpoly_covers_point2d(const RTCTX *ctx, const RTPOLY *poly, const RTPOINT2D
 */
 int rt_getPoint2d_p_ro(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT2D **point)
 {
-	uint8_t *pa_ptr = NULL;
-	assert(pa);
-	assert(n >= 0);
-	assert(n < pa->npoints);
+  uint8_t *pa_ptr = NULL;
+  assert(pa);
+  assert(n >= 0);
+  assert(n < pa->npoints);
 
-	pa_ptr = rt_getPoint_internal(ctx, pa, n);
-	/* printf( "pa_ptr[0]: %g\n", *((double*)pa_ptr)); */
-	*point = (RTPOINT2D*)pa_ptr;
+  pa_ptr = rt_getPoint_internal(ctx, pa, n);
+  /* printf( "pa_ptr[0]: %g\n", *((double*)pa_ptr)); */
+  *point = (RTPOINT2D*)pa_ptr;
 
-	return RT_SUCCESS;
+  return RT_SUCCESS;
 }
 
 int ptarray_calculate_gbox_geodetic(const RTCTX *ctx, const RTPOINTARRAY *pa, RTGBOX *gbox)
 {
-	int i;
-	int first = RT_TRUE;
-	const RTPOINT2D *p;
-	POINT3D A1, A2;
-	RTGBOX edge_gbox;
-
-	assert(gbox);
-	assert(pa);
-
-	gbox_init(ctx, &edge_gbox);
-	edge_gbox.flags = gbox->flags;
-
-	if ( pa->npoints == 0 ) return RT_FAILURE;
-
-	if ( pa->npoints == 1 )
-	{
-		p = rt_getPoint2d_cp(ctx, pa, 0);
-		ll2cart(ctx, p, &A1);
-		gbox->xmin = gbox->xmax = A1.x;
-		gbox->ymin = gbox->ymax = A1.y;
-		gbox->zmin = gbox->zmax = A1.z;
-		return RT_SUCCESS;
-	}
-
-	p = rt_getPoint2d_cp(ctx, pa, 0);
-	ll2cart(ctx, p, &A1);
-	
-	for ( i = 1; i < pa->npoints; i++ )
-	{
-		
-		p = rt_getPoint2d_cp(ctx, pa, i);
-		ll2cart(ctx, p, &A2);
-		
-		edge_calculate_gbox(ctx, &A1, &A2, &edge_gbox);
-
-		/* Initialize the box */
-		if ( first )
-		{
-			gbox_duplicate(ctx, &edge_gbox, gbox);
-			first = RT_FALSE;
-		}
-		/* Expand the box where necessary */
-		else
-		{
-			gbox_merge(ctx, &edge_gbox, gbox);
-		}
-		
-		A1 = A2;
-	}
-
-	return RT_SUCCESS;
+  int i;
+  int first = RT_TRUE;
+  const RTPOINT2D *p;
+  POINT3D A1, A2;
+  RTGBOX edge_gbox;
+
+  assert(gbox);
+  assert(pa);
+
+  gbox_init(ctx, &edge_gbox);
+  edge_gbox.flags = gbox->flags;
+
+  if ( pa->npoints == 0 ) return RT_FAILURE;
+
+  if ( pa->npoints == 1 )
+  {
+    p = rt_getPoint2d_cp(ctx, pa, 0);
+    ll2cart(ctx, p, &A1);
+    gbox->xmin = gbox->xmax = A1.x;
+    gbox->ymin = gbox->ymax = A1.y;
+    gbox->zmin = gbox->zmax = A1.z;
+    return RT_SUCCESS;
+  }
+
+  p = rt_getPoint2d_cp(ctx, pa, 0);
+  ll2cart(ctx, p, &A1);
+
+  for ( i = 1; i < pa->npoints; i++ )
+  {
+
+    p = rt_getPoint2d_cp(ctx, pa, i);
+    ll2cart(ctx, p, &A2);
+
+    edge_calculate_gbox(ctx, &A1, &A2, &edge_gbox);
+
+    /* Initialize the box */
+    if ( first )
+    {
+      gbox_duplicate(ctx, &edge_gbox, gbox);
+      first = RT_FALSE;
+    }
+    /* Expand the box where necessary */
+    else
+    {
+      gbox_merge(ctx, &edge_gbox, gbox);
+    }
+
+    A1 = A2;
+  }
+
+  return RT_SUCCESS;
 }
 
 static int rtpoint_calculate_gbox_geodetic(const RTCTX *ctx, const RTPOINT *point, RTGBOX *gbox)
 {
-	assert(point);
-	return ptarray_calculate_gbox_geodetic(ctx, point->point, gbox);
+  assert(point);
+  return ptarray_calculate_gbox_geodetic(ctx, point->point, gbox);
 }
 
 static int rtline_calculate_gbox_geodetic(const RTCTX *ctx, const RTLINE *line, RTGBOX *gbox)
 {
-	assert(line);
-	return ptarray_calculate_gbox_geodetic(ctx, line->points, gbox);
+  assert(line);
+  return ptarray_calculate_gbox_geodetic(ctx, line->points, gbox);
 }
 
 static int rtpolygon_calculate_gbox_geodetic(const RTCTX *ctx, const RTPOLY *poly, RTGBOX *gbox)
 {
-	RTGBOX ringbox;
-	int i;
-	int first = RT_TRUE;
-	assert(poly);
-	if ( poly->nrings == 0 )
-		return RT_FAILURE;
-	ringbox.flags = gbox->flags;
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if ( ptarray_calculate_gbox_geodetic(ctx, poly->rings[i], &ringbox) == RT_FAILURE )
-			return RT_FAILURE;
-		if ( first )
-		{
-			gbox_duplicate(ctx, &ringbox, gbox);
-			first = RT_FALSE;
-		}
-		else
-		{
-			gbox_merge(ctx, &ringbox, gbox);
-		}
-	}
-
-	/* If the box wraps a poly, push that axis to the absolute min/max as appropriate */
-	gbox_check_poles(ctx, gbox);
-
-	return RT_SUCCESS;
+  RTGBOX ringbox;
+  int i;
+  int first = RT_TRUE;
+  assert(poly);
+  if ( poly->nrings == 0 )
+    return RT_FAILURE;
+  ringbox.flags = gbox->flags;
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if ( ptarray_calculate_gbox_geodetic(ctx, poly->rings[i], &ringbox) == RT_FAILURE )
+      return RT_FAILURE;
+    if ( first )
+    {
+      gbox_duplicate(ctx, &ringbox, gbox);
+      first = RT_FALSE;
+    }
+    else
+    {
+      gbox_merge(ctx, &ringbox, gbox);
+    }
+  }
+
+  /* If the box wraps a poly, push that axis to the absolute min/max as appropriate */
+  gbox_check_poles(ctx, gbox);
+
+  return RT_SUCCESS;
 }
 
 static int rttriangle_calculate_gbox_geodetic(const RTCTX *ctx, const RTTRIANGLE *triangle, RTGBOX *gbox)
 {
-	assert(triangle);
-	return ptarray_calculate_gbox_geodetic(ctx, triangle->points, gbox);
+  assert(triangle);
+  return ptarray_calculate_gbox_geodetic(ctx, triangle->points, gbox);
 }
 
 
 static int rtcollection_calculate_gbox_geodetic(const RTCTX *ctx, const RTCOLLECTION *coll, RTGBOX *gbox)
 {
-	RTGBOX subbox;
-	int i;
-	int result = RT_FAILURE;
-	int first = RT_TRUE;
-	assert(coll);
-	if ( coll->ngeoms == 0 )
-		return RT_FAILURE;
-
-	subbox.flags = gbox->flags;
-
-	for ( i = 0; i < coll->ngeoms; i++ )
-	{
-		if ( rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)(coll->geoms[i]), &subbox) == RT_SUCCESS )
-		{
-			/* Keep a copy of the sub-bounding box for later */
-			if ( coll->geoms[i]->bbox ) 
-				rtfree(ctx, coll->geoms[i]->bbox);
-			coll->geoms[i]->bbox = gbox_copy(ctx, &subbox);
-			if ( first )
-			{
-				gbox_duplicate(ctx, &subbox, gbox);
-				first = RT_FALSE;
-			}
-			else
-			{
-				gbox_merge(ctx, &subbox, gbox);
-			}
-			result = RT_SUCCESS;
-		}
-	}
-	return result;
+  RTGBOX subbox;
+  int i;
+  int result = RT_FAILURE;
+  int first = RT_TRUE;
+  assert(coll);
+  if ( coll->ngeoms == 0 )
+    return RT_FAILURE;
+
+  subbox.flags = gbox->flags;
+
+  for ( i = 0; i < coll->ngeoms; i++ )
+  {
+    if ( rtgeom_calculate_gbox_geodetic(ctx, (RTGEOM*)(coll->geoms[i]), &subbox) == RT_SUCCESS )
+    {
+      /* Keep a copy of the sub-bounding box for later */
+      if ( coll->geoms[i]->bbox )
+        rtfree(ctx, coll->geoms[i]->bbox);
+      coll->geoms[i]->bbox = gbox_copy(ctx, &subbox);
+      if ( first )
+      {
+        gbox_duplicate(ctx, &subbox, gbox);
+        first = RT_FALSE;
+      }
+      else
+      {
+        gbox_merge(ctx, &subbox, gbox);
+      }
+      result = RT_SUCCESS;
+    }
+  }
+  return result;
 }
 
 int rtgeom_calculate_gbox_geodetic(const RTCTX *ctx, const RTGEOM *geom, RTGBOX *gbox)
 {
-	int result = RT_FAILURE;
-	RTDEBUGF(4, "got type %d", geom->type);
-
-	/* Add a geodetic flag to the incoming gbox */
-	gbox->flags = gflags(ctx, RTFLAGS_GET_Z(geom->flags),RTFLAGS_GET_M(geom->flags),1);
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		result = rtpoint_calculate_gbox_geodetic(ctx, (RTPOINT*)geom, gbox);
-		break;
-	case RTLINETYPE:
-		result = rtline_calculate_gbox_geodetic(ctx, (RTLINE *)geom, gbox);
-		break;
-	case RTPOLYGONTYPE:
-		result = rtpolygon_calculate_gbox_geodetic(ctx, (RTPOLY *)geom, gbox);
-		break;
-	case RTTRIANGLETYPE:
-		result = rttriangle_calculate_gbox_geodetic(ctx, (RTTRIANGLE *)geom, gbox);
-		break;
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		result = rtcollection_calculate_gbox_geodetic(ctx, (RTCOLLECTION *)geom, gbox);
-		break;
-	default:
-		rterror(ctx, "rtgeom_calculate_gbox_geodetic: unsupported input geometry type: %d - %s",
-		        geom->type, rttype_name(ctx, geom->type));
-		break;
-	}
-	return result;
+  int result = RT_FAILURE;
+  RTDEBUGF(4, "got type %d", geom->type);
+
+  /* Add a geodetic flag to the incoming gbox */
+  gbox->flags = gflags(ctx, RTFLAGS_GET_Z(geom->flags),RTFLAGS_GET_M(geom->flags),1);
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    result = rtpoint_calculate_gbox_geodetic(ctx, (RTPOINT*)geom, gbox);
+    break;
+  case RTLINETYPE:
+    result = rtline_calculate_gbox_geodetic(ctx, (RTLINE *)geom, gbox);
+    break;
+  case RTPOLYGONTYPE:
+    result = rtpolygon_calculate_gbox_geodetic(ctx, (RTPOLY *)geom, gbox);
+    break;
+  case RTTRIANGLETYPE:
+    result = rttriangle_calculate_gbox_geodetic(ctx, (RTTRIANGLE *)geom, gbox);
+    break;
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    result = rtcollection_calculate_gbox_geodetic(ctx, (RTCOLLECTION *)geom, gbox);
+    break;
+  default:
+    rterror(ctx, "rtgeom_calculate_gbox_geodetic: unsupported input geometry type: %d - %s",
+            geom->type, rttype_name(ctx, geom->type));
+    break;
+  }
+  return result;
 }
 
 
 
 static int ptarray_check_geodetic(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	int t;
-	RTPOINT2D pt;
+  int t;
+  RTPOINT2D pt;
 
-	assert(pa);
+  assert(pa);
 
-	for (t=0; t<pa->npoints; t++)
-	{
-		rt_getPoint2d_p(ctx, pa, t, &pt);
-		/* printf( "%d (%g, %g)\n", t, pt.x, pt.y); */
-		if ( pt.x < -180.0 || pt.y < -90.0 || pt.x > 180.0 || pt.y > 90.0 )
-			return RT_FALSE;
-	}
+  for (t=0; t<pa->npoints; t++)
+  {
+    rt_getPoint2d_p(ctx, pa, t, &pt);
+    /* printf( "%d (%g, %g)\n", t, pt.x, pt.y); */
+    if ( pt.x < -180.0 || pt.y < -90.0 || pt.x > 180.0 || pt.y > 90.0 )
+      return RT_FALSE;
+  }
 
-	return RT_TRUE;
+  return RT_TRUE;
 }
 
 static int rtpoint_check_geodetic(const RTCTX *ctx, const RTPOINT *point)
 {
-	assert(point);
-	return ptarray_check_geodetic(ctx, point->point);
+  assert(point);
+  return ptarray_check_geodetic(ctx, point->point);
 }
 
 static int rtline_check_geodetic(const RTCTX *ctx, const RTLINE *line)
 {
-	assert(line);
-	return ptarray_check_geodetic(ctx, line->points);
+  assert(line);
+  return ptarray_check_geodetic(ctx, line->points);
 }
 
 static int rtpoly_check_geodetic(const RTCTX *ctx, const RTPOLY *poly)
 {
-	int i = 0;
-	assert(poly);
+  int i = 0;
+  assert(poly);
 
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if ( ptarray_check_geodetic(ctx, poly->rings[i]) == RT_FALSE )
-			return RT_FALSE;
-	}
-	return RT_TRUE;
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if ( ptarray_check_geodetic(ctx, poly->rings[i]) == RT_FALSE )
+      return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 static int rttriangle_check_geodetic(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	assert(triangle);
-	return ptarray_check_geodetic(ctx, triangle->points);
+  assert(triangle);
+  return ptarray_check_geodetic(ctx, triangle->points);
 }
 
 
 static int rtcollection_check_geodetic(const RTCTX *ctx, const RTCOLLECTION *col)
 {
-	int i = 0;
-	assert(col);
+  int i = 0;
+  assert(col);
 
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		if ( rtgeom_check_geodetic(ctx, col->geoms[i]) == RT_FALSE )
-			return RT_FALSE;
-	}
-	return RT_TRUE;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    if ( rtgeom_check_geodetic(ctx, col->geoms[i]) == RT_FALSE )
+      return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 int rtgeom_check_geodetic(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( rtgeom_is_empty(ctx, geom) ) 
-		return RT_TRUE;
-		
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_check_geodetic(ctx, (RTPOINT *)geom);
-	case RTLINETYPE:
-		return rtline_check_geodetic(ctx, (RTLINE *)geom);
-	case RTPOLYGONTYPE:
-		return rtpoly_check_geodetic(ctx, (RTPOLY *)geom);
-	case RTTRIANGLETYPE:
-		return rttriangle_check_geodetic(ctx, (RTTRIANGLE *)geom);
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_check_geodetic(ctx, (RTCOLLECTION *)geom);
-	default:
-		rterror(ctx, "rtgeom_check_geodetic: unsupported input geometry type: %d - %s",
-		        geom->type, rttype_name(ctx, geom->type));
-	}
-	return RT_FALSE;
+  if ( rtgeom_is_empty(ctx, geom) )
+    return RT_TRUE;
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_check_geodetic(ctx, (RTPOINT *)geom);
+  case RTLINETYPE:
+    return rtline_check_geodetic(ctx, (RTLINE *)geom);
+  case RTPOLYGONTYPE:
+    return rtpoly_check_geodetic(ctx, (RTPOLY *)geom);
+  case RTTRIANGLETYPE:
+    return rttriangle_check_geodetic(ctx, (RTTRIANGLE *)geom);
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_check_geodetic(ctx, (RTCOLLECTION *)geom);
+  default:
+    rterror(ctx, "rtgeom_check_geodetic: unsupported input geometry type: %d - %s",
+            geom->type, rttype_name(ctx, geom->type));
+  }
+  return RT_FALSE;
 }
 
 static int ptarray_force_geodetic(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	int t;
-	int changed = RT_FALSE;
-	RTPOINT4D pt;
+  int t;
+  int changed = RT_FALSE;
+  RTPOINT4D pt;
 
-	assert(pa);
+  assert(pa);
 
-	for ( t=0; t < pa->npoints; t++ )
-	{
-		rt_getPoint4d_p(ctx, pa, t, &pt);
-		if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
-		{
-			pt.x = longitude_degrees_normalize(ctx, pt.x); 
-			pt.y = latitude_degrees_normalize(ctx, pt.y); 
-			ptarray_set_point4d(ctx, pa, t, &pt);
-			changed = RT_TRUE;
-		}
-	}
-	return changed;  
+  for ( t=0; t < pa->npoints; t++ )
+  {
+    rt_getPoint4d_p(ctx, pa, t, &pt);
+    if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
+    {
+      pt.x = longitude_degrees_normalize(ctx, pt.x);
+      pt.y = latitude_degrees_normalize(ctx, pt.y);
+      ptarray_set_point4d(ctx, pa, t, &pt);
+      changed = RT_TRUE;
+    }
+  }
+  return changed;
 }
 
 static int rtpoint_force_geodetic(const RTCTX *ctx, RTPOINT *point)
 {
-	assert(point);
-	return ptarray_force_geodetic(ctx, point->point);
+  assert(point);
+  return ptarray_force_geodetic(ctx, point->point);
 }
 
 static int rtline_force_geodetic(const RTCTX *ctx, RTLINE *line)
 {
-	assert(line);
-	return ptarray_force_geodetic(ctx, line->points);
+  assert(line);
+  return ptarray_force_geodetic(ctx, line->points);
 }
 
 static int rtpoly_force_geodetic(const RTCTX *ctx, RTPOLY *poly)
 {
-	int i = 0;
-	int changed = RT_FALSE;
-	assert(poly);
+  int i = 0;
+  int changed = RT_FALSE;
+  assert(poly);
 
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if ( ptarray_force_geodetic(ctx, poly->rings[i]) == RT_TRUE )
-			changed = RT_TRUE;
-	}
-	return changed;
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if ( ptarray_force_geodetic(ctx, poly->rings[i]) == RT_TRUE )
+      changed = RT_TRUE;
+  }
+  return changed;
 }
 
 static int rtcollection_force_geodetic(const RTCTX *ctx, RTCOLLECTION *col)
 {
-	int i = 0;
-	int changed = RT_FALSE;
-	assert(col);
+  int i = 0;
+  int changed = RT_FALSE;
+  assert(col);
 
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		if ( rtgeom_force_geodetic(ctx, col->geoms[i]) == RT_TRUE )
-			changed = RT_TRUE;
-	}
-	return changed;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    if ( rtgeom_force_geodetic(ctx, col->geoms[i]) == RT_TRUE )
+      changed = RT_TRUE;
+  }
+  return changed;
 }
 
 int rtgeom_force_geodetic(const RTCTX *ctx, RTGEOM *geom)
 {
-	switch ( rtgeom_get_type(ctx, geom) )
-	{
-		case RTPOINTTYPE:
-			return rtpoint_force_geodetic(ctx, (RTPOINT *)geom);
-		case RTLINETYPE:
-			return rtline_force_geodetic(ctx, (RTLINE *)geom);
-		case RTPOLYGONTYPE:
-			return rtpoly_force_geodetic(ctx, (RTPOLY *)geom);
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOLLECTIONTYPE:
-			return rtcollection_force_geodetic(ctx, (RTCOLLECTION *)geom);
-		default:
-			rterror(ctx, "unsupported input geometry type: %d", rtgeom_get_type(ctx, geom));
-	}
-	return RT_FALSE;
+  switch ( rtgeom_get_type(ctx, geom) )
+  {
+    case RTPOINTTYPE:
+      return rtpoint_force_geodetic(ctx, (RTPOINT *)geom);
+    case RTLINETYPE:
+      return rtline_force_geodetic(ctx, (RTLINE *)geom);
+    case RTPOLYGONTYPE:
+      return rtpoly_force_geodetic(ctx, (RTPOLY *)geom);
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOLLECTIONTYPE:
+      return rtcollection_force_geodetic(ctx, (RTCOLLECTION *)geom);
+    default:
+      rterror(ctx, "unsupported input geometry type: %d", rtgeom_get_type(ctx, geom));
+  }
+  return RT_FALSE;
 }
 
 
 double ptarray_length_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa, const SPHEROID *s)
 {
-	GEOGRAPHIC_POINT a, b;
-	double za = 0.0, zb = 0.0;
-	RTPOINT4D p;
-	int i;
-	int hasz = RT_FALSE;
-	double length = 0.0;
-	double seglength = 0.0;
-
-	/* Return zero on non-sensical inputs */
-	if ( ! pa || pa->npoints < 2 )
-		return 0.0;
-
-	/* See if we have a third dimension */
-	hasz = RTFLAGS_GET_Z(pa->flags);
-
-	/* Initialize first point */
-	rt_getPoint4d_p(ctx, pa, 0, &p);
-	geographic_point_init(ctx, p.x, p.y, &a);
-	if ( hasz ) 
-		za = p.z;
-
-	/* Loop and sum the length for each segment */
-	for ( i = 1; i < pa->npoints; i++ )
-	{
-		seglength = 0.0;
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		geographic_point_init(ctx, p.x, p.y, &b);
-		if ( hasz ) 
-			zb = p.z;
-
-		/* Special sphere case */
-		if ( s->a == s->b )
-			seglength = s->radius * sphere_distance(ctx, &a, &b);
-		/* Spheroid case */
-		else
-			seglength = spheroid_distance(ctx, &a, &b, s);
-
-		/* Add in the vertical displacement if we're in 3D */
-		if ( hasz ) 
-			seglength = sqrt( (zb-za)*(zb-za) + seglength*seglength );
-			
-		/* Add this segment length to the total */
-		length += seglength;
-
-		/* B gets incremented in the next loop, so we save the value here */
-		a = b;
-		za = zb;
-	}
-	return length;
+  GEOGRAPHIC_POINT a, b;
+  double za = 0.0, zb = 0.0;
+  RTPOINT4D p;
+  int i;
+  int hasz = RT_FALSE;
+  double length = 0.0;
+  double seglength = 0.0;
+
+  /* Return zero on non-sensical inputs */
+  if ( ! pa || pa->npoints < 2 )
+    return 0.0;
+
+  /* See if we have a third dimension */
+  hasz = RTFLAGS_GET_Z(pa->flags);
+
+  /* Initialize first point */
+  rt_getPoint4d_p(ctx, pa, 0, &p);
+  geographic_point_init(ctx, p.x, p.y, &a);
+  if ( hasz )
+    za = p.z;
+
+  /* Loop and sum the length for each segment */
+  for ( i = 1; i < pa->npoints; i++ )
+  {
+    seglength = 0.0;
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    geographic_point_init(ctx, p.x, p.y, &b);
+    if ( hasz )
+      zb = p.z;
+
+    /* Special sphere case */
+    if ( s->a == s->b )
+      seglength = s->radius * sphere_distance(ctx, &a, &b);
+    /* Spheroid case */
+    else
+      seglength = spheroid_distance(ctx, &a, &b, s);
+
+    /* Add in the vertical displacement if we're in 3D */
+    if ( hasz )
+      seglength = sqrt( (zb-za)*(zb-za) + seglength*seglength );
+
+    /* Add this segment length to the total */
+    length += seglength;
+
+    /* B gets incremented in the next loop, so we save the value here */
+    a = b;
+    za = zb;
+  }
+  return length;
 }
 
 double rtgeom_length_spheroid(const RTCTX *ctx, const RTGEOM *geom, const SPHEROID *s)
 {
-	int type;
-	int i = 0;
-	double length = 0.0;
+  int type;
+  int i = 0;
+  double length = 0.0;
 
-	assert(geom);
+  assert(geom);
 
-	/* No area in nothing */
-	if ( rtgeom_is_empty(ctx, geom) )
-		return 0.0;
+  /* No area in nothing */
+  if ( rtgeom_is_empty(ctx, geom) )
+    return 0.0;
 
-	type = geom->type;
+  type = geom->type;
 
-	if ( type == RTPOINTTYPE || type == RTMULTIPOINTTYPE )
-		return 0.0;
+  if ( type == RTPOINTTYPE || type == RTMULTIPOINTTYPE )
+    return 0.0;
 
-	if ( type == RTLINETYPE )
-		return ptarray_length_spheroid(ctx, ((RTLINE*)geom)->points, s);
+  if ( type == RTLINETYPE )
+    return ptarray_length_spheroid(ctx, ((RTLINE*)geom)->points, s);
 
-	if ( type == RTPOLYGONTYPE )
-	{
-		RTPOLY *poly = (RTPOLY*)geom;
-		for ( i = 0; i < poly->nrings; i++ )
-		{
-			length += ptarray_length_spheroid(ctx, poly->rings[i], s);
-		}
-		return length;
-	}
+  if ( type == RTPOLYGONTYPE )
+  {
+    RTPOLY *poly = (RTPOLY*)geom;
+    for ( i = 0; i < poly->nrings; i++ )
+    {
+      length += ptarray_length_spheroid(ctx, poly->rings[i], s);
+    }
+    return length;
+  }
 
-	if ( type == RTTRIANGLETYPE )
-		return ptarray_length_spheroid(ctx, ((RTTRIANGLE*)geom)->points, s);
+  if ( type == RTTRIANGLETYPE )
+    return ptarray_length_spheroid(ctx, ((RTTRIANGLE*)geom)->points, s);
 
-	if ( rttype_is_collection(ctx,  type ) )
-	{
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
+  if ( rttype_is_collection(ctx,  type ) )
+  {
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
 
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			length += rtgeom_length_spheroid(ctx, col->geoms[i], s);
-		}
-		return length;
-	}
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      length += rtgeom_length_spheroid(ctx, col->geoms[i], s);
+    }
+    return length;
+  }
 
-	rterror(ctx, "unsupported type passed to rtgeom_length_sphere");
-	return 0.0;
+  rterror(ctx, "unsupported type passed to rtgeom_length_sphere");
+  return 0.0;
 }
 
 /**
-* When features are snapped or sometimes they are just this way, they are very close to 
+* When features are snapped or sometimes they are just this way, they are very close to
 * the geodetic bounds but slightly over. This routine nudges those points, and only
 * those points, back over to the bounds.
 * http://trac.osgeo.org/postgis/ticket/1292
 */
-static int 
+static int
 ptarray_nudge_geodetic(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
 
-	int i;
-	RTPOINT4D p;
-	int altered = RT_FALSE;
-	int rv = RT_FALSE;
-	static double tolerance = 1e-10;
-
-	if ( ! pa )
-		rterror(ctx, "ptarray_nudge_geodetic called with null input");
-
-	for(i = 0; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		if ( p.x < -180.0 && (-180.0 - p.x < tolerance) )
-		{
-			p.x = -180.0;
-			altered = RT_TRUE;
-		}
-		if ( p.x > 180.0 && (p.x - 180.0 < tolerance) )
-		{
-			p.x = 180.0;
-			altered = RT_TRUE;
-		}
-		if ( p.y < -90.0 && (-90.0 - p.y < tolerance) )
-		{
-			p.y = -90.0;
-			altered = RT_TRUE;
-		}
-		if ( p.y > 90.0 && (p.y - 90.0 < tolerance) )
-		{
-			p.y = 90.0;
-			altered = RT_TRUE;
-		}
-		if ( altered == RT_TRUE )
-		{
-			ptarray_set_point4d(ctx, pa, i, &p);
-			altered = RT_FALSE;
-			rv = RT_TRUE;
-		}
-	}
-	return rv;
+  int i;
+  RTPOINT4D p;
+  int altered = RT_FALSE;
+  int rv = RT_FALSE;
+  static double tolerance = 1e-10;
+
+  if ( ! pa )
+    rterror(ctx, "ptarray_nudge_geodetic called with null input");
+
+  for(i = 0; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    if ( p.x < -180.0 && (-180.0 - p.x < tolerance) )
+    {
+      p.x = -180.0;
+      altered = RT_TRUE;
+    }
+    if ( p.x > 180.0 && (p.x - 180.0 < tolerance) )
+    {
+      p.x = 180.0;
+      altered = RT_TRUE;
+    }
+    if ( p.y < -90.0 && (-90.0 - p.y < tolerance) )
+    {
+      p.y = -90.0;
+      altered = RT_TRUE;
+    }
+    if ( p.y > 90.0 && (p.y - 90.0 < tolerance) )
+    {
+      p.y = 90.0;
+      altered = RT_TRUE;
+    }
+    if ( altered == RT_TRUE )
+    {
+      ptarray_set_point4d(ctx, pa, i, &p);
+      altered = RT_FALSE;
+      rv = RT_TRUE;
+    }
+  }
+  return rv;
 }
 
 /**
-* When features are snapped or sometimes they are just this way, they are very close to 
+* When features are snapped or sometimes they are just this way, they are very close to
 * the geodetic bounds but slightly over. This routine nudges those points, and only
 * those points, back over to the bounds.
 * http://trac.osgeo.org/postgis/ticket/1292
 */
-int 
+int
 rtgeom_nudge_geodetic(const RTCTX *ctx, RTGEOM *geom)
 {
-	int type;
-	int i = 0;
-	int rv = RT_FALSE;
+  int type;
+  int i = 0;
+  int rv = RT_FALSE;
 
-	assert(geom);
+  assert(geom);
 
-	/* No points in nothing */
-	if ( rtgeom_is_empty(ctx, geom) )
-		return RT_FALSE;
+  /* No points in nothing */
+  if ( rtgeom_is_empty(ctx, geom) )
+    return RT_FALSE;
 
-	type = geom->type;
+  type = geom->type;
 
-	if ( type == RTPOINTTYPE )
-		return ptarray_nudge_geodetic(ctx, ((RTPOINT*)geom)->point);
+  if ( type == RTPOINTTYPE )
+    return ptarray_nudge_geodetic(ctx, ((RTPOINT*)geom)->point);
 
-	if ( type == RTLINETYPE )
-		return ptarray_nudge_geodetic(ctx, ((RTLINE*)geom)->points);
+  if ( type == RTLINETYPE )
+    return ptarray_nudge_geodetic(ctx, ((RTLINE*)geom)->points);
 
-	if ( type == RTPOLYGONTYPE )
-	{
-		RTPOLY *poly = (RTPOLY*)geom;
-		for ( i = 0; i < poly->nrings; i++ )
-		{
-			int n = ptarray_nudge_geodetic(ctx, poly->rings[i]);
-			rv = (rv == RT_TRUE ? rv : n);
-		}
-		return rv;
-	}
+  if ( type == RTPOLYGONTYPE )
+  {
+    RTPOLY *poly = (RTPOLY*)geom;
+    for ( i = 0; i < poly->nrings; i++ )
+    {
+      int n = ptarray_nudge_geodetic(ctx, poly->rings[i]);
+      rv = (rv == RT_TRUE ? rv : n);
+    }
+    return rv;
+  }
 
-	if ( type == RTTRIANGLETYPE )
-		return ptarray_nudge_geodetic(ctx, ((RTTRIANGLE*)geom)->points);
+  if ( type == RTTRIANGLETYPE )
+    return ptarray_nudge_geodetic(ctx, ((RTTRIANGLE*)geom)->points);
 
-	if ( rttype_is_collection(ctx,  type ) )
-	{
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
+  if ( rttype_is_collection(ctx,  type ) )
+  {
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
 
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			int n = rtgeom_nudge_geodetic(ctx, col->geoms[i]);
-			rv = (rv == RT_TRUE ? rv : n);
-		}
-		return rv;
-	}
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      int n = rtgeom_nudge_geodetic(ctx, col->geoms[i]);
+      rv = (rv == RT_TRUE ? rv : n);
+    }
+    return rv;
+  }
 
-	rterror(ctx, "unsupported type (%s) passed to rtgeom_nudge_geodetic", rttype_name(ctx, type));
-	return rv;
+  rterror(ctx, "unsupported type (%s) passed to rtgeom_nudge_geodetic", rttype_name(ctx, type));
+  return rv;
 }
 
 
@@ -3060,35 +3060,35 @@ rtgeom_nudge_geodetic(const RTCTX *ctx, RTGEOM *geom)
 static int
 point_in_cone(const RTCTX *ctx, const POINT3D *A1, const POINT3D *A2, const POINT3D *P)
 {
-	POINT3D AC; /* Center point of A1/A2 */
-	double min_similarity, similarity;
-	
-	/* The normalized sum bisects the angle between start and end. */
-	vector_sum(ctx, A1, A2, &AC);
-	normalize(ctx, &AC);
-	
-	/* The projection of start onto the center defines the minimum similarity */
-	min_similarity = dot_product(ctx, A1, &AC);
+  POINT3D AC; /* Center point of A1/A2 */
+  double min_similarity, similarity;
+
+  /* The normalized sum bisects the angle between start and end. */
+  vector_sum(ctx, A1, A2, &AC);
+  normalize(ctx, &AC);
+
+  /* The projection of start onto the center defines the minimum similarity */
+  min_similarity = dot_product(ctx, A1, &AC);
 
-	/* The projection of candidate p onto the center */
-	similarity = dot_product(ctx, P, &AC);
+  /* The projection of candidate p onto the center */
+  similarity = dot_product(ctx, P, &AC);
 
-	/* If the point is more similar than the end, the point is in the cone */
-	if ( similarity > min_similarity || fabs(similarity - min_similarity) < 2e-16 )
-	{
-		return RT_TRUE;
-	}
-	return RT_FALSE;
+  /* If the point is more similar than the end, the point is in the cone */
+  if ( similarity > min_similarity || fabs(similarity - min_similarity) < 2e-16 )
+  {
+    return RT_TRUE;
+  }
+  return RT_FALSE;
 }
 
 
 /**
 * Utility function for ptarray_contains_point_sphere(ctx)
 */
-static int 
+static int
 point3d_equals(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2)
 {
-	return FP_EQUALS(p1->x, p2->x) && FP_EQUALS(p1->y, p2->y) && FP_EQUALS(p1->z, p2->z);
+  return FP_EQUALS(p1->x, p2->x) && FP_EQUALS(p1->y, p2->y) && FP_EQUALS(p1->z, p2->z);
 }
 
 /**
@@ -3098,114 +3098,114 @@ point3d_equals(const RTCTX *ctx, const POINT3D *p1, const POINT3D *p2)
 static int
 dot_product_side(const RTCTX *ctx, const POINT3D *p, const POINT3D *q)
 {
-	double dp = dot_product(ctx, p, q);
+  double dp = dot_product(ctx, p, q);
+
+  if ( FP_IS_ZERO(dp) )
+    return 0;
 
-	if ( FP_IS_ZERO(dp) )
-		return 0;
-		
-	return dp < 0.0 ? -1 : 1;
+  return dp < 0.0 ? -1 : 1;
 }
 
 /**
-* Returns non-zero if edges A and B interact. The type of interaction is given in the 
+* Returns non-zero if edges A and B interact. The type of interaction is given in the
 * return value with the bitmask elements defined above.
 */
-int 
+int
 edge_intersects(const RTCTX *ctx, const POINT3D *A1, const POINT3D *A2, const POINT3D *B1, const POINT3D *B2)
 {
-	POINT3D AN, BN, VN;  /* Normals to plane A and plane B */
-	double ab_dot;
-	int a1_side, a2_side, b1_side, b2_side;
-	int rv = PIR_NO_INTERACT;
-	
-	/* Normals to the A-plane and B-plane */
-	unit_normal(ctx, A1, A2, &AN);
-	unit_normal(ctx, B1, B2, &BN);
-	
-	/* Are A-plane and B-plane basically the same? */
-	ab_dot = dot_product(ctx, &AN, &BN);
-	if ( FP_EQUALS(fabs(ab_dot), 1.0) )
-	{
-		/* Co-linear case */
-		if ( point_in_cone(ctx, A1, A2, B1) || point_in_cone(ctx, A1, A2, B2) || 
-		     point_in_cone(ctx, B1, B2, A1) || point_in_cone(ctx, B1, B2, A2) )
-		{
-			rv |= PIR_INTERSECTS;
-			rv |= PIR_COLINEAR;
-		}
-		return rv;
-	}
-	
-	/* What side of plane-A and plane-B do the end points */
-	/* of A and B fall? */
-	a1_side = dot_product_side(ctx, &BN, A1);
-	a2_side = dot_product_side(ctx, &BN, A2);
-	b1_side = dot_product_side(ctx, &AN, B1);
-	b2_side = dot_product_side(ctx, &AN, B2);
-
-	/* Both ends of A on the same side of plane B. */
-	if ( a1_side == a2_side && a1_side != 0 )
-	{
-		/* No intersection. */
-		return PIR_NO_INTERACT;
-	}
-
-	/* Both ends of B on the same side of plane A. */
-	if ( b1_side == b2_side && b1_side != 0 )
-	{
-		/* No intersection. */
-		return PIR_NO_INTERACT;
-	}
-
-	/* A straddles B and B straddles A, so... */
-	if ( a1_side != a2_side && (a1_side + a2_side) == 0 &&
-	     b1_side != b2_side && (b1_side + b2_side) == 0 )
-	{
-		/* Have to check if intersection point is inside both arcs */
-		unit_normal(ctx, &AN, &BN, &VN);
-		if ( point_in_cone(ctx, A1, A2, &VN) && point_in_cone(ctx, B1, B2, &VN) )
-		{
-			return PIR_INTERSECTS;
-		}
-
-		/* Have to check if intersection point is inside both arcs */
-		vector_scale(ctx, &VN, -1);
-		if ( point_in_cone(ctx, A1, A2, &VN) && point_in_cone(ctx, B1, B2, &VN) )
-		{
-			return PIR_INTERSECTS;
-		}
-		
-		return PIR_NO_INTERACT;
-	}
-
-	/* The rest are all intersects variants... */
-	rv |= PIR_INTERSECTS;
-
-	/* A touches B */
-	if ( a1_side == 0 )
-	{
-		/* Touches at A1, A2 is on what side? */
-		rv |= (a2_side < 0 ? PIR_A_TOUCH_RIGHT : PIR_A_TOUCH_LEFT);
-	}
-	else if ( a2_side == 0 )
-	{
-		/* Touches at A2, A1 is on what side? */
-		rv |= (a1_side < 0 ? PIR_A_TOUCH_RIGHT : PIR_A_TOUCH_LEFT);
-	}
-
-	/* B touches A */
-	if ( b1_side == 0 )
-	{
-		/* Touches at B1, B2 is on what side? */
-		rv |= (b2_side < 0 ? PIR_B_TOUCH_RIGHT : PIR_B_TOUCH_LEFT);
-	}
-	else if ( b2_side == 0 )
-	{
-		/* Touches at B2, B1 is on what side? */
-		rv |= (b1_side < 0 ? PIR_B_TOUCH_RIGHT : PIR_B_TOUCH_LEFT);
-	}
-	
-	return rv;
+  POINT3D AN, BN, VN;  /* Normals to plane A and plane B */
+  double ab_dot;
+  int a1_side, a2_side, b1_side, b2_side;
+  int rv = PIR_NO_INTERACT;
+
+  /* Normals to the A-plane and B-plane */
+  unit_normal(ctx, A1, A2, &AN);
+  unit_normal(ctx, B1, B2, &BN);
+
+  /* Are A-plane and B-plane basically the same? */
+  ab_dot = dot_product(ctx, &AN, &BN);
+  if ( FP_EQUALS(fabs(ab_dot), 1.0) )
+  {
+    /* Co-linear case */
+    if ( point_in_cone(ctx, A1, A2, B1) || point_in_cone(ctx, A1, A2, B2) ||
+         point_in_cone(ctx, B1, B2, A1) || point_in_cone(ctx, B1, B2, A2) )
+    {
+      rv |= PIR_INTERSECTS;
+      rv |= PIR_COLINEAR;
+    }
+    return rv;
+  }
+
+  /* What side of plane-A and plane-B do the end points */
+  /* of A and B fall? */
+  a1_side = dot_product_side(ctx, &BN, A1);
+  a2_side = dot_product_side(ctx, &BN, A2);
+  b1_side = dot_product_side(ctx, &AN, B1);
+  b2_side = dot_product_side(ctx, &AN, B2);
+
+  /* Both ends of A on the same side of plane B. */
+  if ( a1_side == a2_side && a1_side != 0 )
+  {
+    /* No intersection. */
+    return PIR_NO_INTERACT;
+  }
+
+  /* Both ends of B on the same side of plane A. */
+  if ( b1_side == b2_side && b1_side != 0 )
+  {
+    /* No intersection. */
+    return PIR_NO_INTERACT;
+  }
+
+  /* A straddles B and B straddles A, so... */
+  if ( a1_side != a2_side && (a1_side + a2_side) == 0 &&
+       b1_side != b2_side && (b1_side + b2_side) == 0 )
+  {
+    /* Have to check if intersection point is inside both arcs */
+    unit_normal(ctx, &AN, &BN, &VN);
+    if ( point_in_cone(ctx, A1, A2, &VN) && point_in_cone(ctx, B1, B2, &VN) )
+    {
+      return PIR_INTERSECTS;
+    }
+
+    /* Have to check if intersection point is inside both arcs */
+    vector_scale(ctx, &VN, -1);
+    if ( point_in_cone(ctx, A1, A2, &VN) && point_in_cone(ctx, B1, B2, &VN) )
+    {
+      return PIR_INTERSECTS;
+    }
+
+    return PIR_NO_INTERACT;
+  }
+
+  /* The rest are all intersects variants... */
+  rv |= PIR_INTERSECTS;
+
+  /* A touches B */
+  if ( a1_side == 0 )
+  {
+    /* Touches at A1, A2 is on what side? */
+    rv |= (a2_side < 0 ? PIR_A_TOUCH_RIGHT : PIR_A_TOUCH_LEFT);
+  }
+  else if ( a2_side == 0 )
+  {
+    /* Touches at A2, A1 is on what side? */
+    rv |= (a1_side < 0 ? PIR_A_TOUCH_RIGHT : PIR_A_TOUCH_LEFT);
+  }
+
+  /* B touches A */
+  if ( b1_side == 0 )
+  {
+    /* Touches at B1, B2 is on what side? */
+    rv |= (b2_side < 0 ? PIR_B_TOUCH_RIGHT : PIR_B_TOUCH_LEFT);
+  }
+  else if ( b2_side == 0 )
+  {
+    /* Touches at B2, B1 is on what side? */
+    rv |= (b1_side < 0 ? PIR_B_TOUCH_RIGHT : PIR_B_TOUCH_LEFT);
+  }
+
+  return rv;
 }
 
 /**
@@ -3218,88 +3218,88 @@ edge_intersects(const RTCTX *ctx, const POINT3D *A1, const POINT3D *A2, const PO
 */
 int ptarray_contains_point_sphere(const RTCTX *ctx, const RTPOINTARRAY *pa, const RTPOINT2D *pt_outside, const RTPOINT2D *pt_to_test)
 {
-	POINT3D S1, S2; /* Stab line end points */
-	POINT3D E1, E2; /* Edge end points (3-space) */
-	RTPOINT2D p; /* Edge end points (lon/lat) */
-	int count = 0, i, inter;
-
-	/* Null input, not enough points for a ring? You ain't closed! */
-	if ( ! pa || pa->npoints < 4 )
-		return RT_FALSE;
-
-	/* Set up our stab line */
-	ll2cart(ctx, pt_to_test, &S1);
-	ll2cart(ctx, pt_outside, &S2);
-
-	/* Initialize first point */
-	rt_getPoint2d_p(ctx, pa, 0, &p);
-	ll2cart(ctx, &p, &E1);
-
-	/* Walk every edge and see if the stab line hits it */
-	for ( i = 1; i < pa->npoints; i++ )
-	{
-		RTDEBUGF(4, "testing edge (%d)", i);
-		RTDEBUGF(4, "  start point == POINT(%.12g %.12g)", p.x, p.y);
-
-		/* Read next point. */
-		rt_getPoint2d_p(ctx, pa, i, &p);
-		ll2cart(ctx, &p, &E2);
-
-		/* Skip over too-short edges. */
-		if ( point3d_equals(ctx, &E1, &E2) )
-		{
-			continue;
-		}
-		
-		/* Our test point is on an edge end! Point is "in ring" by our definition */
-		if ( point3d_equals(ctx, &S1, &E1) )
-		{
-			return RT_TRUE;
-		}
-		
-		/* Calculate relationship between stab line and edge */
-		inter = edge_intersects(ctx, &S1, &S2, &E1, &E2);
-		
-		/* We have some kind of interaction... */
-		if ( inter & PIR_INTERSECTS )
-		{
-			/* If the stabline is touching the edge, that implies the test point */
-			/* is on the edge, so we're done, the point is in (on) the ring. */
-			if ( (inter & PIR_A_TOUCH_RIGHT) || (inter & PIR_A_TOUCH_LEFT) )
-			{
-				return RT_TRUE;
-			}
-			
-			/* It's a touching interaction, disregard all the left-side ones. */
-			/* It's a co-linear intersection, ignore those. */
-			if ( inter & PIR_B_TOUCH_RIGHT || inter & PIR_COLINEAR )
-			{
-				/* Do nothing, to avoid double counts. */
-				RTDEBUGF(4,"    edge (%d) crossed, disregarding to avoid double count", i, count);
-			}
-			else
-			{
-				/* Increment crossingn count. */
-				count++;
-				RTDEBUGF(4,"    edge (%d) crossed, count == %d", i, count);
-			}
-		}
-		else
-		{
-			RTDEBUGF(4,"    edge (%d) did not cross", i);
-		}
-		
-		/* Increment to next edge */
-		E1 = E2;
-	}
-
-	RTDEBUGF(4,"final count == %d", count);
-
-	/* An odd number of crossings implies containment! */
-	if ( count % 2 )
-	{
-		return RT_TRUE;
-	}
-
-	return RT_FALSE;
+  POINT3D S1, S2; /* Stab line end points */
+  POINT3D E1, E2; /* Edge end points (3-space) */
+  RTPOINT2D p; /* Edge end points (lon/lat) */
+  int count = 0, i, inter;
+
+  /* Null input, not enough points for a ring? You ain't closed! */
+  if ( ! pa || pa->npoints < 4 )
+    return RT_FALSE;
+
+  /* Set up our stab line */
+  ll2cart(ctx, pt_to_test, &S1);
+  ll2cart(ctx, pt_outside, &S2);
+
+  /* Initialize first point */
+  rt_getPoint2d_p(ctx, pa, 0, &p);
+  ll2cart(ctx, &p, &E1);
+
+  /* Walk every edge and see if the stab line hits it */
+  for ( i = 1; i < pa->npoints; i++ )
+  {
+    RTDEBUGF(4, "testing edge (%d)", i);
+    RTDEBUGF(4, "  start point == POINT(%.12g %.12g)", p.x, p.y);
+
+    /* Read next point. */
+    rt_getPoint2d_p(ctx, pa, i, &p);
+    ll2cart(ctx, &p, &E2);
+
+    /* Skip over too-short edges. */
+    if ( point3d_equals(ctx, &E1, &E2) )
+    {
+      continue;
+    }
+
+    /* Our test point is on an edge end! Point is "in ring" by our definition */
+    if ( point3d_equals(ctx, &S1, &E1) )
+    {
+      return RT_TRUE;
+    }
+
+    /* Calculate relationship between stab line and edge */
+    inter = edge_intersects(ctx, &S1, &S2, &E1, &E2);
+
+    /* We have some kind of interaction... */
+    if ( inter & PIR_INTERSECTS )
+    {
+      /* If the stabline is touching the edge, that implies the test point */
+      /* is on the edge, so we're done, the point is in (on) the ring. */
+      if ( (inter & PIR_A_TOUCH_RIGHT) || (inter & PIR_A_TOUCH_LEFT) )
+      {
+        return RT_TRUE;
+      }
+
+      /* It's a touching interaction, disregard all the left-side ones. */
+      /* It's a co-linear intersection, ignore those. */
+      if ( inter & PIR_B_TOUCH_RIGHT || inter & PIR_COLINEAR )
+      {
+        /* Do nothing, to avoid double counts. */
+        RTDEBUGF(4,"    edge (%d) crossed, disregarding to avoid double count", i, count);
+      }
+      else
+      {
+        /* Increment crossingn count. */
+        count++;
+        RTDEBUGF(4,"    edge (%d) crossed, count == %d", i, count);
+      }
+    }
+    else
+    {
+      RTDEBUGF(4,"    edge (%d) did not cross", i);
+    }
+
+    /* Increment to next edge */
+    E1 = E2;
+  }
+
+  RTDEBUGF(4,"final count == %d", count);
+
+  /* An odd number of crossings implies containment! */
+  if ( count % 2 )
+  {
+    return RT_TRUE;
+  }
+
+  return RT_FALSE;
 }
diff --git a/src/rtgeodetic.h b/src/rtgeodetic.h
index 79389a2..cdb654e 100644
--- a/src/rtgeodetic.h
+++ b/src/rtgeodetic.h
@@ -47,8 +47,8 @@ extern int gbox_geocentric_slow;
 */
 typedef struct
 {
-	double lon;
-	double lat;
+  double lon;
+  double lat;
 } GEOGRAPHIC_POINT;
 
 /**
@@ -56,8 +56,8 @@ typedef struct
 */
 typedef struct
 {
-	GEOGRAPHIC_POINT start;
-	GEOGRAPHIC_POINT end;
+  GEOGRAPHIC_POINT start;
+  GEOGRAPHIC_POINT end;
 } GEOGRAPHIC_EDGE;
 
 /**
@@ -65,8 +65,8 @@ typedef struct
 */
 typedef struct
 {
-	double measure;
-	uint32_t index;
+  double measure;
+  uint32_t index;
 } DISTANCE_ORDER;
 
 /**
@@ -153,7 +153,7 @@ int spheroid_project(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, const SPHEROID
 
 /**
 * Notes for rewrite
-* 
+*
 * Define separate POINT types for 2-d-points-in-radiands and 3-d-points-in-geocentric
 * Maintain consistent units (radians?) throughout all calculations
 * Put an index pointer onto RTGEOM itself, and cache the indexed RTGEOM instead of a bare tree
diff --git a/src/rtgeom.c b/src/rtgeom.c
index ce3133d..c534d43 100644
--- a/src/rtgeom.c
+++ b/src/rtgeom.c
@@ -36,239 +36,239 @@
 void
 rtgeom_force_clockwise(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	RTCOLLECTION *coll;
-	int i;
-
-	switch (rtgeom->type)
-	{
-	case RTPOLYGONTYPE:
-		rtpoly_force_clockwise(ctx, (RTPOLY *)rtgeom);
-		return;
-
-	case RTTRIANGLETYPE:
-		rttriangle_force_clockwise(ctx, (RTTRIANGLE *)rtgeom);
-		return;
-
-		/* Not handle POLYHEDRALSURFACE and TIN
-		   as they are supposed to be well oriented */
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		coll = (RTCOLLECTION *)rtgeom;
-		for (i=0; i<coll->ngeoms; i++)
-			rtgeom_force_clockwise(ctx, coll->geoms[i]);
-		return;
-	}
+  RTCOLLECTION *coll;
+  int i;
+
+  switch (rtgeom->type)
+  {
+  case RTPOLYGONTYPE:
+    rtpoly_force_clockwise(ctx, (RTPOLY *)rtgeom);
+    return;
+
+  case RTTRIANGLETYPE:
+    rttriangle_force_clockwise(ctx, (RTTRIANGLE *)rtgeom);
+    return;
+
+    /* Not handle POLYHEDRALSURFACE and TIN
+       as they are supposed to be well oriented */
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    coll = (RTCOLLECTION *)rtgeom;
+    for (i=0; i<coll->ngeoms; i++)
+      rtgeom_force_clockwise(ctx, coll->geoms[i]);
+    return;
+  }
 }
 
 /** Reverse vertex order of RTGEOM **/
 void
 rtgeom_reverse(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	int i;
-	RTCOLLECTION *col;
-
-	switch (rtgeom->type)
-	{
-	case RTLINETYPE:
-		rtline_reverse(ctx, (RTLINE *)rtgeom);
-		return;
-	case RTPOLYGONTYPE:
-		rtpoly_reverse(ctx, (RTPOLY *)rtgeom);
-		return;
-	case RTTRIANGLETYPE:
-		rttriangle_reverse(ctx, (RTTRIANGLE *)rtgeom);
-		return;
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		col = (RTCOLLECTION *)rtgeom;
-		for (i=0; i<col->ngeoms; i++)
-			rtgeom_reverse(ctx, col->geoms[i]);
-		return;
-	}
+  int i;
+  RTCOLLECTION *col;
+
+  switch (rtgeom->type)
+  {
+  case RTLINETYPE:
+    rtline_reverse(ctx, (RTLINE *)rtgeom);
+    return;
+  case RTPOLYGONTYPE:
+    rtpoly_reverse(ctx, (RTPOLY *)rtgeom);
+    return;
+  case RTTRIANGLETYPE:
+    rttriangle_reverse(ctx, (RTTRIANGLE *)rtgeom);
+    return;
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    col = (RTCOLLECTION *)rtgeom;
+    for (i=0; i<col->ngeoms; i++)
+      rtgeom_reverse(ctx, col->geoms[i]);
+    return;
+  }
 }
 
 RTPOINT *
 rtgeom_as_rtpoint(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTPOINTTYPE )
-		return (RTPOINT *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTPOINTTYPE )
+    return (RTPOINT *)rtgeom;
+  else return NULL;
 }
 
 RTLINE *
 rtgeom_as_rtline(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTLINETYPE )
-		return (RTLINE *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTLINETYPE )
+    return (RTLINE *)rtgeom;
+  else return NULL;
 }
 
 RTCIRCSTRING *
 rtgeom_as_rtcircstring(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTCIRCSTRINGTYPE )
-		return (RTCIRCSTRING *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTCIRCSTRINGTYPE )
+    return (RTCIRCSTRING *)rtgeom;
+  else return NULL;
 }
 
 RTCOMPOUND *
 rtgeom_as_rtcompound(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTCOMPOUNDTYPE )
-		return (RTCOMPOUND *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTCOMPOUNDTYPE )
+    return (RTCOMPOUND *)rtgeom;
+  else return NULL;
 }
 
 RTCURVEPOLY *
 rtgeom_as_rtcurvepoly(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTCURVEPOLYTYPE )
-		return (RTCURVEPOLY *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTCURVEPOLYTYPE )
+    return (RTCURVEPOLY *)rtgeom;
+  else return NULL;
 }
 
 RTPOLY *
 rtgeom_as_rtpoly(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTPOLYGONTYPE )
-		return (RTPOLY *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTPOLYGONTYPE )
+    return (RTPOLY *)rtgeom;
+  else return NULL;
 }
 
 RTTRIANGLE *
 rtgeom_as_rttriangle(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTTRIANGLETYPE )
-		return (RTTRIANGLE *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTTRIANGLETYPE )
+    return (RTTRIANGLE *)rtgeom;
+  else return NULL;
 }
 
 RTCOLLECTION *
 rtgeom_as_rtcollection(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom_is_collection(ctx, rtgeom) )
-		return (RTCOLLECTION*)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom_is_collection(ctx, rtgeom) )
+    return (RTCOLLECTION*)rtgeom;
+  else return NULL;
 }
 
 RTMPOINT *
 rtgeom_as_rtmpoint(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTMULTIPOINTTYPE )
-		return (RTMPOINT *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTMULTIPOINTTYPE )
+    return (RTMPOINT *)rtgeom;
+  else return NULL;
 }
 
 RTMLINE *
 rtgeom_as_rtmline(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTMULTILINETYPE )
-		return (RTMLINE *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTMULTILINETYPE )
+    return (RTMLINE *)rtgeom;
+  else return NULL;
 }
 
 RTMPOLY *
 rtgeom_as_rtmpoly(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom == NULL ) return NULL;
-	if ( rtgeom->type == RTMULTIPOLYGONTYPE )
-		return (RTMPOLY *)rtgeom;
-	else return NULL;
+  if ( rtgeom == NULL ) return NULL;
+  if ( rtgeom->type == RTMULTIPOLYGONTYPE )
+    return (RTMPOLY *)rtgeom;
+  else return NULL;
 }
 
 RTPSURFACE *
 rtgeom_as_rtpsurface(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom->type == RTPOLYHEDRALSURFACETYPE )
-		return (RTPSURFACE *)rtgeom;
-	else return NULL;
+  if ( rtgeom->type == RTPOLYHEDRALSURFACETYPE )
+    return (RTPSURFACE *)rtgeom;
+  else return NULL;
 }
 
 RTTIN *
 rtgeom_as_rttin(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	if ( rtgeom->type == RTTINTYPE )
-		return (RTTIN *)rtgeom;
-	else return NULL;
+  if ( rtgeom->type == RTTINTYPE )
+    return (RTTIN *)rtgeom;
+  else return NULL;
 }
 
 RTGEOM * rttin_as_rtgeom(const RTCTX *ctx, const RTTIN *obj)
 {
-	return (RTGEOM *)obj;
+  return (RTGEOM *)obj;
 }
 
 RTGEOM * rtpsurface_as_rtgeom(const RTCTX *ctx, const RTPSURFACE *obj)
 {
-	return (RTGEOM *)obj;
+  return (RTGEOM *)obj;
 }
 
 RTGEOM * rtmpoly_as_rtgeom(const RTCTX *ctx, const RTMPOLY *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtmline_as_rtgeom(const RTCTX *ctx, const RTMLINE *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtmpoint_as_rtgeom(const RTCTX *ctx, const RTMPOINT *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtcollection_as_rtgeom(const RTCTX *ctx, const RTCOLLECTION *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtcircstring_as_rtgeom(const RTCTX *ctx, const RTCIRCSTRING *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtcurvepoly_as_rtgeom(const RTCTX *ctx, const RTCURVEPOLY *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtcompound_as_rtgeom(const RTCTX *ctx, const RTCOMPOUND *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtpoly_as_rtgeom(const RTCTX *ctx, const RTPOLY *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rttriangle_as_rtgeom(const RTCTX *ctx, const RTTRIANGLE *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtline_as_rtgeom(const RTCTX *ctx, const RTLINE *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 RTGEOM * rtpoint_as_rtgeom(const RTCTX *ctx, const RTPOINT *obj)
 {
-	if ( obj == NULL ) return NULL;
-	return (RTGEOM *)obj;
+  if ( obj == NULL ) return NULL;
+  return (RTGEOM *)obj;
 }
 
 
@@ -277,18 +277,18 @@ RTGEOM * rtpoint_as_rtgeom(const RTCTX *ctx, const RTPOINT *obj)
 */
 uint8_t RTMULTITYPE[RTNUMTYPES] =
 {
-	0,
-	RTMULTIPOINTTYPE,        /*  1 */
-	RTMULTILINETYPE,         /*  2 */
-	RTMULTIPOLYGONTYPE,      /*  3 */
-	0,0,0,0,
-	RTMULTICURVETYPE,        /*  8 */
-	RTMULTICURVETYPE,        /*  9 */
-	RTMULTISURFACETYPE,      /* 10 */
-	RTPOLYHEDRALSURFACETYPE, /* 11 */
-	0, 0,
-	RTTINTYPE,               /* 14 */
-	0
+  0,
+  RTMULTIPOINTTYPE,        /*  1 */
+  RTMULTILINETYPE,         /*  2 */
+  RTMULTIPOLYGONTYPE,      /*  3 */
+  0,0,0,0,
+  RTMULTICURVETYPE,        /*  8 */
+  RTMULTICURVETYPE,        /*  9 */
+  RTMULTISURFACETYPE,      /* 10 */
+  RTPOLYHEDRALSURFACETYPE, /* 11 */
+  0, 0,
+  RTTINTYPE,               /* 14 */
+  0
 };
 
 /**
@@ -297,38 +297,38 @@ uint8_t RTMULTITYPE[RTNUMTYPES] =
 RTGEOM *
 rtgeom_as_multi(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	RTGEOM **ogeoms;
-	RTGEOM *ogeom = NULL;
-	RTGBOX *box = NULL;
-	int type;
+  RTGEOM **ogeoms;
+  RTGEOM *ogeom = NULL;
+  RTGBOX *box = NULL;
+  int type;
 
-	type = rtgeom->type;
+  type = rtgeom->type;
 
-	if ( ! RTMULTITYPE[type] ) return rtgeom_clone(ctx, rtgeom);
+  if ( ! RTMULTITYPE[type] ) return rtgeom_clone(ctx, rtgeom);
 
-	if( rtgeom_is_empty(ctx, rtgeom) )
-	{
-		ogeom = (RTGEOM *)rtcollection_construct_empty(ctx, 
-			RTMULTITYPE[type],
-			rtgeom->srid,
-			RTFLAGS_GET_Z(rtgeom->flags),
-			RTFLAGS_GET_M(rtgeom->flags)
-		);
-	}
-	else
-	{
-		ogeoms = rtalloc(ctx, sizeof(RTGEOM*));
-		ogeoms[0] = rtgeom_clone(ctx, rtgeom);
+  if( rtgeom_is_empty(ctx, rtgeom) )
+  {
+    ogeom = (RTGEOM *)rtcollection_construct_empty(ctx,
+      RTMULTITYPE[type],
+      rtgeom->srid,
+      RTFLAGS_GET_Z(rtgeom->flags),
+      RTFLAGS_GET_M(rtgeom->flags)
+    );
+  }
+  else
+  {
+    ogeoms = rtalloc(ctx, sizeof(RTGEOM*));
+    ogeoms[0] = rtgeom_clone(ctx, rtgeom);
 
-		/* Sub-geometries are not allowed to have bboxes or SRIDs, move the bbox to the collection */
-		box = ogeoms[0]->bbox;
-		ogeoms[0]->bbox = NULL;
-		ogeoms[0]->srid = SRID_UNKNOWN;
+    /* Sub-geometries are not allowed to have bboxes or SRIDs, move the bbox to the collection */
+    box = ogeoms[0]->bbox;
+    ogeoms[0]->bbox = NULL;
+    ogeoms[0]->srid = SRID_UNKNOWN;
 
-		ogeom = (RTGEOM *)rtcollection_construct(ctx, RTMULTITYPE[type], rtgeom->srid, box, 1, ogeoms);
-	}
+    ogeom = (RTGEOM *)rtcollection_construct(ctx, RTMULTITYPE[type], rtgeom->srid, box, 1, ogeoms);
+  }
 
-	return ogeom;
+  return ogeom;
 }
 
 /**
@@ -337,47 +337,47 @@ rtgeom_as_multi(const RTCTX *ctx, const RTGEOM *rtgeom)
 RTGEOM *
 rtgeom_as_curve(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	RTGEOM *ogeom;
-	int type = rtgeom->type;
-	/*
-	int hasz = RTFLAGS_GET_Z(rtgeom->flags);
-	int hasm = RTFLAGS_GET_M(rtgeom->flags);
-	int srid = rtgeom->srid;
-	*/
-
-	switch(type)
-	{
-		case RTLINETYPE:
-			/* turn to COMPOUNDCURVE */
-			ogeom = (RTGEOM*)rtcompound_construct_from_rtline(ctx, (RTLINE*)rtgeom);
-			break;
-		case RTPOLYGONTYPE:
-			ogeom = (RTGEOM*)rtcurvepoly_construct_from_rtpoly(ctx, rtgeom_as_rtpoly(ctx, rtgeom));
-			break;
-		case RTMULTILINETYPE:
-			/* turn to MULTICURVE */
-			ogeom = rtgeom_clone(ctx, rtgeom);
-			ogeom->type = RTMULTICURVETYPE;
-			break;
-		case RTMULTIPOLYGONTYPE:
-			/* turn to MULTISURFACE */
-			ogeom = rtgeom_clone(ctx, rtgeom);
-			ogeom->type = RTMULTISURFACETYPE;
-			break;
-		case RTCOLLECTIONTYPE:
-		default:
-			ogeom = rtgeom_clone(ctx, rtgeom);
-			break;
-	}
-
-	/* TODO: copy bbox from input geom ? */
-
-	return ogeom;
+  RTGEOM *ogeom;
+  int type = rtgeom->type;
+  /*
+  int hasz = RTFLAGS_GET_Z(rtgeom->flags);
+  int hasm = RTFLAGS_GET_M(rtgeom->flags);
+  int srid = rtgeom->srid;
+  */
+
+  switch(type)
+  {
+    case RTLINETYPE:
+      /* turn to COMPOUNDCURVE */
+      ogeom = (RTGEOM*)rtcompound_construct_from_rtline(ctx, (RTLINE*)rtgeom);
+      break;
+    case RTPOLYGONTYPE:
+      ogeom = (RTGEOM*)rtcurvepoly_construct_from_rtpoly(ctx, rtgeom_as_rtpoly(ctx, rtgeom));
+      break;
+    case RTMULTILINETYPE:
+      /* turn to MULTICURVE */
+      ogeom = rtgeom_clone(ctx, rtgeom);
+      ogeom->type = RTMULTICURVETYPE;
+      break;
+    case RTMULTIPOLYGONTYPE:
+      /* turn to MULTISURFACE */
+      ogeom = rtgeom_clone(ctx, rtgeom);
+      ogeom->type = RTMULTISURFACETYPE;
+      break;
+    case RTCOLLECTIONTYPE:
+    default:
+      ogeom = rtgeom_clone(ctx, rtgeom);
+      break;
+  }
+
+  /* TODO: copy bbox from input geom ? */
+
+  return ogeom;
 }
 
 
 /**
-* Free the containing RTGEOM and the associated BOX. Leave the underlying 
+* Free the containing RTGEOM and the associated BOX. Leave the underlying
 * geoms/points/point objects intact. Useful for functions that are stripping
 * out subcomponents of complex objects, or building up new temporary objects
 * on top of subcomponents.
@@ -385,94 +385,94 @@ rtgeom_as_curve(const RTCTX *ctx, const RTGEOM *rtgeom)
 void
 rtgeom_release(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	if ( ! rtgeom )
-		rterror(ctx, "rtgeom_release: someone called on 0x0");
+  if ( ! rtgeom )
+    rterror(ctx, "rtgeom_release: someone called on 0x0");
 
-	RTDEBUGF(3, "releasing type %s", rttype_name(ctx, rtgeom->type));
+  RTDEBUGF(3, "releasing type %s", rttype_name(ctx, rtgeom->type));
 
-	/* Drop bounding box (artays a copy) */
-	if ( rtgeom->bbox )
-	{
-		RTDEBUGF(3, "rtgeom_release: releasing bbox. %p", rtgeom->bbox);
-		rtfree(ctx, rtgeom->bbox);
-	}
-	rtfree(ctx, rtgeom);
+  /* Drop bounding box (artays a copy) */
+  if ( rtgeom->bbox )
+  {
+    RTDEBUGF(3, "rtgeom_release: releasing bbox. %p", rtgeom->bbox);
+    rtfree(ctx, rtgeom->bbox);
+  }
+  rtfree(ctx, rtgeom);
 
 }
 
 
 /* @brief Clone RTGEOM object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTGEOM *
 rtgeom_clone(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	RTDEBUGF(2, "rtgeom_clone called with %p, %s",
-	         rtgeom, rttype_name(ctx, rtgeom->type));
-
-	switch (rtgeom->type)
-	{
-	case RTPOINTTYPE:
-		return (RTGEOM *)rtpoint_clone(ctx, (RTPOINT *)rtgeom);
-	case RTLINETYPE:
-		return (RTGEOM *)rtline_clone(ctx, (RTLINE *)rtgeom);
-	case RTCIRCSTRINGTYPE:
-		return (RTGEOM *)rtcircstring_clone(ctx, (RTCIRCSTRING *)rtgeom);
-	case RTPOLYGONTYPE:
-		return (RTGEOM *)rtpoly_clone(ctx, (RTPOLY *)rtgeom);
-	case RTTRIANGLETYPE:
-		return (RTGEOM *)rttriangle_clone(ctx, (RTTRIANGLE *)rtgeom);
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return (RTGEOM *)rtcollection_clone(ctx, (RTCOLLECTION *)rtgeom);
-	default:
-		rterror(ctx, "rtgeom_clone: Unknown geometry type: %s", rttype_name(ctx, rtgeom->type));
-		return NULL;
-	}
-}
-
-/** 
-* Deep-clone an #RTGEOM object. #RTPOINTARRAY <em>are</em> copied. 
+  RTDEBUGF(2, "rtgeom_clone called with %p, %s",
+           rtgeom, rttype_name(ctx, rtgeom->type));
+
+  switch (rtgeom->type)
+  {
+  case RTPOINTTYPE:
+    return (RTGEOM *)rtpoint_clone(ctx, (RTPOINT *)rtgeom);
+  case RTLINETYPE:
+    return (RTGEOM *)rtline_clone(ctx, (RTLINE *)rtgeom);
+  case RTCIRCSTRINGTYPE:
+    return (RTGEOM *)rtcircstring_clone(ctx, (RTCIRCSTRING *)rtgeom);
+  case RTPOLYGONTYPE:
+    return (RTGEOM *)rtpoly_clone(ctx, (RTPOLY *)rtgeom);
+  case RTTRIANGLETYPE:
+    return (RTGEOM *)rttriangle_clone(ctx, (RTTRIANGLE *)rtgeom);
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return (RTGEOM *)rtcollection_clone(ctx, (RTCOLLECTION *)rtgeom);
+  default:
+    rterror(ctx, "rtgeom_clone: Unknown geometry type: %s", rttype_name(ctx, rtgeom->type));
+    return NULL;
+  }
+}
+
+/**
+* Deep-clone an #RTGEOM object. #RTPOINTARRAY <em>are</em> copied.
 */
 RTGEOM *
 rtgeom_clone_deep(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	RTDEBUGF(2, "rtgeom_clone called with %p, %s",
-	         rtgeom, rttype_name(ctx, rtgeom->type));
-
-	switch (rtgeom->type)
-	{
-	case RTPOINTTYPE:
-	case RTLINETYPE:
-	case RTCIRCSTRINGTYPE:
-	case RTTRIANGLETYPE:
-		return (RTGEOM *)rtline_clone_deep(ctx, (RTLINE *)rtgeom);
-	case RTPOLYGONTYPE:
-		return (RTGEOM *)rtpoly_clone_deep(ctx, (RTPOLY *)rtgeom);
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return (RTGEOM *)rtcollection_clone_deep(ctx, (RTCOLLECTION *)rtgeom);
-	default:
-		rterror(ctx, "rtgeom_clone_deep: Unknown geometry type: %s", rttype_name(ctx, rtgeom->type));
-		return NULL;
-	}
+  RTDEBUGF(2, "rtgeom_clone called with %p, %s",
+           rtgeom, rttype_name(ctx, rtgeom->type));
+
+  switch (rtgeom->type)
+  {
+  case RTPOINTTYPE:
+  case RTLINETYPE:
+  case RTCIRCSTRINGTYPE:
+  case RTTRIANGLETYPE:
+    return (RTGEOM *)rtline_clone_deep(ctx, (RTLINE *)rtgeom);
+  case RTPOLYGONTYPE:
+    return (RTGEOM *)rtpoly_clone_deep(ctx, (RTPOLY *)rtgeom);
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return (RTGEOM *)rtcollection_clone_deep(ctx, (RTCOLLECTION *)rtgeom);
+  default:
+    rterror(ctx, "rtgeom_clone_deep: Unknown geometry type: %s", rttype_name(ctx, rtgeom->type));
+    return NULL;
+  }
 }
 
 
@@ -482,126 +482,126 @@ rtgeom_clone_deep(const RTCTX *ctx, const RTGEOM *rtgeom)
 char*
 rtgeom_to_ewkt(const RTCTX *ctx, const RTGEOM *rtgeom)
 {
-	char* wkt = NULL;
-	size_t wkt_size = 0;
-	
-	wkt = rtgeom_to_wkt(ctx, rtgeom, RTWKT_EXTENDED, 12, &wkt_size);
+  char* wkt = NULL;
+  size_t wkt_size = 0;
+
+  wkt = rtgeom_to_wkt(ctx, rtgeom, RTWKT_EXTENDED, 12, &wkt_size);
 
-	if ( ! wkt )
-	{
-		rterror(ctx, "Error writing geom %p to RTWKT", rtgeom);
-	}
+  if ( ! wkt )
+  {
+    rterror(ctx, "Error writing geom %p to RTWKT", rtgeom);
+  }
 
-	return wkt;
+  return wkt;
 }
 
 /**
  * @brief geom1 same as geom2
- *  	iff
- *      	+ have same type
- *			+ have same # objects
- *      	+ have same bvol
- *      	+ each object in geom1 has a corresponding object in geom2 (see above)
- *	@param rtgeom1
- *	@param rtgeom2
+ *    iff
+ *        + have same type
+ *      + have same # objects
+ *        + have same bvol
+ *        + each object in geom1 has a corresponding object in geom2 (see above)
+ *  @param rtgeom1
+ *  @param rtgeom2
  */
 char
 rtgeom_same(const RTCTX *ctx, const RTGEOM *rtgeom1, const RTGEOM *rtgeom2)
 {
-	RTDEBUGF(2, "rtgeom_same(ctx, %s, %s) called",
-	         rttype_name(ctx, rtgeom1->type),
-	         rttype_name(ctx, rtgeom2->type));
-
-	if ( rtgeom1->type != rtgeom2->type )
-	{
-		RTDEBUG(3, " type differ");
-
-		return RT_FALSE;
-	}
-
-	if ( RTFLAGS_GET_ZM(rtgeom1->flags) != RTFLAGS_GET_ZM(rtgeom2->flags) )
-	{
-		RTDEBUG(3, " ZM flags differ");
-
-		return RT_FALSE;
-	}
-
-	/* Check boxes if both already computed  */
-	if ( rtgeom1->bbox && rtgeom2->bbox )
-	{
-		/*rtnotice(ctx, "bbox1:%p, bbox2:%p", rtgeom1->bbox, rtgeom2->bbox);*/
-		if ( ! gbox_same(ctx, rtgeom1->bbox, rtgeom2->bbox) )
-		{
-			RTDEBUG(3, " bounding boxes differ");
-
-			return RT_FALSE;
-		}
-	}
-
-	/* geoms have same type, invoke type-specific function */
-	switch (rtgeom1->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_same(ctx, (RTPOINT *)rtgeom1,
-		                    (RTPOINT *)rtgeom2);
-	case RTLINETYPE:
-		return rtline_same(ctx, (RTLINE *)rtgeom1,
-		                   (RTLINE *)rtgeom2);
-	case RTPOLYGONTYPE:
-		return rtpoly_same(ctx, (RTPOLY *)rtgeom1,
-		                   (RTPOLY *)rtgeom2);
-	case RTTRIANGLETYPE:
-		return rttriangle_same(ctx, (RTTRIANGLE *)rtgeom1,
-		                       (RTTRIANGLE *)rtgeom2);
-	case RTCIRCSTRINGTYPE:
-		return rtcircstring_same(ctx, (RTCIRCSTRING *)rtgeom1,
-					 (RTCIRCSTRING *)rtgeom2);
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_same(ctx, (RTCOLLECTION *)rtgeom1,
-		                         (RTCOLLECTION *)rtgeom2);
-	default:
-		rterror(ctx, "rtgeom_same: unsupported geometry type: %s",
-		        rttype_name(ctx, rtgeom1->type));
-		return RT_FALSE;
-	}
+  RTDEBUGF(2, "rtgeom_same(ctx, %s, %s) called",
+           rttype_name(ctx, rtgeom1->type),
+           rttype_name(ctx, rtgeom2->type));
+
+  if ( rtgeom1->type != rtgeom2->type )
+  {
+    RTDEBUG(3, " type differ");
+
+    return RT_FALSE;
+  }
+
+  if ( RTFLAGS_GET_ZM(rtgeom1->flags) != RTFLAGS_GET_ZM(rtgeom2->flags) )
+  {
+    RTDEBUG(3, " ZM flags differ");
+
+    return RT_FALSE;
+  }
+
+  /* Check boxes if both already computed  */
+  if ( rtgeom1->bbox && rtgeom2->bbox )
+  {
+    /*rtnotice(ctx, "bbox1:%p, bbox2:%p", rtgeom1->bbox, rtgeom2->bbox);*/
+    if ( ! gbox_same(ctx, rtgeom1->bbox, rtgeom2->bbox) )
+    {
+      RTDEBUG(3, " bounding boxes differ");
+
+      return RT_FALSE;
+    }
+  }
+
+  /* geoms have same type, invoke type-specific function */
+  switch (rtgeom1->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_same(ctx, (RTPOINT *)rtgeom1,
+                        (RTPOINT *)rtgeom2);
+  case RTLINETYPE:
+    return rtline_same(ctx, (RTLINE *)rtgeom1,
+                       (RTLINE *)rtgeom2);
+  case RTPOLYGONTYPE:
+    return rtpoly_same(ctx, (RTPOLY *)rtgeom1,
+                       (RTPOLY *)rtgeom2);
+  case RTTRIANGLETYPE:
+    return rttriangle_same(ctx, (RTTRIANGLE *)rtgeom1,
+                           (RTTRIANGLE *)rtgeom2);
+  case RTCIRCSTRINGTYPE:
+    return rtcircstring_same(ctx, (RTCIRCSTRING *)rtgeom1,
+           (RTCIRCSTRING *)rtgeom2);
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_same(ctx, (RTCOLLECTION *)rtgeom1,
+                             (RTCOLLECTION *)rtgeom2);
+  default:
+    rterror(ctx, "rtgeom_same: unsupported geometry type: %s",
+            rttype_name(ctx, rtgeom1->type));
+    return RT_FALSE;
+  }
 
 }
 
 int
 rtpoint_inside_circle(const RTCTX *ctx, const RTPOINT *p, double cx, double cy, double rad)
 {
-	const RTPOINT2D *pt;
-	RTPOINT2D center;
+  const RTPOINT2D *pt;
+  RTPOINT2D center;
 
-	if ( ! p || ! p->point )
-		return RT_FALSE;
-		
-	pt = rt_getPoint2d_cp(ctx, p->point, 0);
+  if ( ! p || ! p->point )
+    return RT_FALSE;
 
-	center.x = cx;
-	center.y = cy;
+  pt = rt_getPoint2d_cp(ctx, p->point, 0);
 
-	if ( distance2d_pt_pt(ctx, pt, &center) < rad ) 
-		return RT_TRUE;
+  center.x = cx;
+  center.y = cy;
 
-	return RT_FALSE;
+  if ( distance2d_pt_pt(ctx, pt, &center) < rad )
+    return RT_TRUE;
+
+  return RT_FALSE;
 }
 
 void
 rtgeom_drop_bbox(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	if ( rtgeom->bbox ) rtfree(ctx, rtgeom->bbox);
-	rtgeom->bbox = NULL;
-	RTFLAGS_SET_BBOX(rtgeom->flags, 0);
+  if ( rtgeom->bbox ) rtfree(ctx, rtgeom->bbox);
+  rtgeom->bbox = NULL;
+  RTFLAGS_SET_BBOX(rtgeom->flags, 0);
 }
 
 /**
@@ -612,50 +612,50 @@ rtgeom_drop_bbox(const RTCTX *ctx, RTGEOM *rtgeom)
 void
 rtgeom_add_bbox(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	/* an empty RTGEOM has no bbox */
-	if ( rtgeom_is_empty(ctx, rtgeom) ) return;
+  /* an empty RTGEOM has no bbox */
+  if ( rtgeom_is_empty(ctx, rtgeom) ) return;
 
-	if ( rtgeom->bbox ) return;
-	RTFLAGS_SET_BBOX(rtgeom->flags, 1);
-	rtgeom->bbox = gbox_new(ctx, rtgeom->flags);
-	rtgeom_calculate_gbox(ctx, rtgeom, rtgeom->bbox);
+  if ( rtgeom->bbox ) return;
+  RTFLAGS_SET_BBOX(rtgeom->flags, 1);
+  rtgeom->bbox = gbox_new(ctx, rtgeom->flags);
+  rtgeom_calculate_gbox(ctx, rtgeom, rtgeom->bbox);
 }
 
-void 
+void
 rtgeom_add_bbox_deep(const RTCTX *ctx, RTGEOM *rtgeom, RTGBOX *gbox)
 {
-	if ( rtgeom_is_empty(ctx, rtgeom) ) return;
-
-	RTFLAGS_SET_BBOX(rtgeom->flags, 1);
-	
-	if ( ! ( gbox || rtgeom->bbox ) )
-	{
-		rtgeom->bbox = gbox_new(ctx, rtgeom->flags);
-		rtgeom_calculate_gbox(ctx, rtgeom, rtgeom->bbox);		
-	}
-	else if ( gbox && ! rtgeom->bbox )
-	{
-		rtgeom->bbox = gbox_clone(ctx, gbox);
-	}
-	
-	if ( rtgeom_is_collection(ctx, rtgeom) )
-	{
-		int i;
-		RTCOLLECTION *rtcol = (RTCOLLECTION*)rtgeom;
-
-		for ( i = 0; i < rtcol->ngeoms; i++ )
-		{
-			rtgeom_add_bbox_deep(ctx, rtcol->geoms[i], rtgeom->bbox);
-		}
-	}
+  if ( rtgeom_is_empty(ctx, rtgeom) ) return;
+
+  RTFLAGS_SET_BBOX(rtgeom->flags, 1);
+
+  if ( ! ( gbox || rtgeom->bbox ) )
+  {
+    rtgeom->bbox = gbox_new(ctx, rtgeom->flags);
+    rtgeom_calculate_gbox(ctx, rtgeom, rtgeom->bbox);
+  }
+  else if ( gbox && ! rtgeom->bbox )
+  {
+    rtgeom->bbox = gbox_clone(ctx, gbox);
+  }
+
+  if ( rtgeom_is_collection(ctx, rtgeom) )
+  {
+    int i;
+    RTCOLLECTION *rtcol = (RTCOLLECTION*)rtgeom;
+
+    for ( i = 0; i < rtcol->ngeoms; i++ )
+    {
+      rtgeom_add_bbox_deep(ctx, rtcol->geoms[i], rtgeom->bbox);
+    }
+  }
 }
 
 const RTGBOX *
 rtgeom_get_bbox(const RTCTX *ctx, const RTGEOM *rtg)
 {
-	/* add it if not already there */
-	rtgeom_add_bbox(ctx, (RTGEOM *)rtg);
-	return rtg->bbox;
+  /* add it if not already there */
+  rtgeom_add_bbox(ctx, (RTGEOM *)rtg);
+  return rtg->bbox;
 }
 
 
@@ -665,347 +665,347 @@ rtgeom_get_bbox(const RTCTX *ctx, const RTGEOM *rtg)
 */
 int rtgeom_calculate_gbox(const RTCTX *ctx, const RTGEOM *rtgeom, RTGBOX *gbox)
 {
-	gbox->flags = rtgeom->flags;
-	if( RTFLAGS_GET_GEODETIC(rtgeom->flags) )
-		return rtgeom_calculate_gbox_geodetic(ctx, rtgeom, gbox);
-	else
-		return rtgeom_calculate_gbox_cartesian(ctx, rtgeom, gbox);	
+  gbox->flags = rtgeom->flags;
+  if( RTFLAGS_GET_GEODETIC(rtgeom->flags) )
+    return rtgeom_calculate_gbox_geodetic(ctx, rtgeom, gbox);
+  else
+    return rtgeom_calculate_gbox_cartesian(ctx, rtgeom, gbox);
 }
 
 void
 rtgeom_drop_srid(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	rtgeom->srid = SRID_UNKNOWN;	/* TODO: To be changed to SRID_UNKNOWN */
+  rtgeom->srid = SRID_UNKNOWN;  /* TODO: To be changed to SRID_UNKNOWN */
 }
 
 RTGEOM *
 rtgeom_segmentize2d(const RTCTX *ctx, RTGEOM *rtgeom, double dist)
 {
-	switch (rtgeom->type)
-	{
-	case RTLINETYPE:
-		return (RTGEOM *)rtline_segmentize2d(ctx, (RTLINE *)rtgeom,
-		                                     dist);
-	case RTPOLYGONTYPE:
-		return (RTGEOM *)rtpoly_segmentize2d(ctx, (RTPOLY *)rtgeom,
-		                                     dist);
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		return (RTGEOM *)rtcollection_segmentize2d(ctx, 
-		           (RTCOLLECTION *)rtgeom, dist);
-
-	default:
-		return rtgeom_clone(ctx, rtgeom);
-	}
+  switch (rtgeom->type)
+  {
+  case RTLINETYPE:
+    return (RTGEOM *)rtline_segmentize2d(ctx, (RTLINE *)rtgeom,
+                                         dist);
+  case RTPOLYGONTYPE:
+    return (RTGEOM *)rtpoly_segmentize2d(ctx, (RTPOLY *)rtgeom,
+                                         dist);
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    return (RTGEOM *)rtcollection_segmentize2d(ctx,
+               (RTCOLLECTION *)rtgeom, dist);
+
+  default:
+    return rtgeom_clone(ctx, rtgeom);
+  }
 }
 
 RTGEOM*
 rtgeom_force_2d(const RTCTX *ctx, const RTGEOM *geom)
-{	
-	return rtgeom_force_dims(ctx, geom, 0, 0);
+{
+  return rtgeom_force_dims(ctx, geom, 0, 0);
 }
 
 RTGEOM*
 rtgeom_force_3dz(const RTCTX *ctx, const RTGEOM *geom)
-{	
-	return rtgeom_force_dims(ctx, geom, 1, 0);
+{
+  return rtgeom_force_dims(ctx, geom, 1, 0);
 }
 
 RTGEOM*
 rtgeom_force_3dm(const RTCTX *ctx, const RTGEOM *geom)
-{	
-	return rtgeom_force_dims(ctx, geom, 0, 1);
+{
+  return rtgeom_force_dims(ctx, geom, 0, 1);
 }
 
 RTGEOM*
 rtgeom_force_4d(const RTCTX *ctx, const RTGEOM *geom)
-{	
-	return rtgeom_force_dims(ctx, geom, 1, 1);
+{
+  return rtgeom_force_dims(ctx, geom, 1, 1);
 }
 
 RTGEOM*
 rtgeom_force_dims(const RTCTX *ctx, const RTGEOM *geom, int hasz, int hasm)
-{	
-	switch(geom->type)
-	{
-		case RTPOINTTYPE:
-			return rtpoint_as_rtgeom(ctx, rtpoint_force_dims(ctx, (RTPOINT*)geom, hasz, hasm));
-		case RTCIRCSTRINGTYPE:
-		case RTLINETYPE:
-		case RTTRIANGLETYPE:
-			return rtline_as_rtgeom(ctx, rtline_force_dims(ctx, (RTLINE*)geom, hasz, hasm));
-		case RTPOLYGONTYPE:
-			return rtpoly_as_rtgeom(ctx, rtpoly_force_dims(ctx, (RTPOLY*)geom, hasz, hasm));
-		case RTCOMPOUNDTYPE:
-		case RTCURVEPOLYTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTPOLYHEDRALSURFACETYPE:
-		case RTTINTYPE:
-		case RTCOLLECTIONTYPE:
-			return rtcollection_as_rtgeom(ctx, rtcollection_force_dims(ctx, (RTCOLLECTION*)geom, hasz, hasm));
-		default:
-			rterror(ctx, "rtgeom_force_2d: unsupported geom type: %s", rttype_name(ctx, geom->type));
-			return NULL;
-	}
+{
+  switch(geom->type)
+  {
+    case RTPOINTTYPE:
+      return rtpoint_as_rtgeom(ctx, rtpoint_force_dims(ctx, (RTPOINT*)geom, hasz, hasm));
+    case RTCIRCSTRINGTYPE:
+    case RTLINETYPE:
+    case RTTRIANGLETYPE:
+      return rtline_as_rtgeom(ctx, rtline_force_dims(ctx, (RTLINE*)geom, hasz, hasm));
+    case RTPOLYGONTYPE:
+      return rtpoly_as_rtgeom(ctx, rtpoly_force_dims(ctx, (RTPOLY*)geom, hasz, hasm));
+    case RTCOMPOUNDTYPE:
+    case RTCURVEPOLYTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTPOLYHEDRALSURFACETYPE:
+    case RTTINTYPE:
+    case RTCOLLECTIONTYPE:
+      return rtcollection_as_rtgeom(ctx, rtcollection_force_dims(ctx, (RTCOLLECTION*)geom, hasz, hasm));
+    default:
+      rterror(ctx, "rtgeom_force_2d: unsupported geom type: %s", rttype_name(ctx, geom->type));
+      return NULL;
+  }
 }
 
 RTGEOM*
 rtgeom_force_sfs(const RTCTX *ctx, RTGEOM *geom, int version)
-{	
-	RTCOLLECTION *col;
-	int i;
-	RTGEOM *g;
-
-	/* SFS 1.2 version */
-	if (version == 120)
-	{
-		switch(geom->type)
-		{
-			/* SQL/MM types */
-			case RTCIRCSTRINGTYPE:
-			case RTCOMPOUNDTYPE:
-			case RTCURVEPOLYTYPE:
-			case RTMULTICURVETYPE:
-			case RTMULTISURFACETYPE:
-				return rtgeom_stroke(ctx, geom, 32);
-
-			case RTCOLLECTIONTYPE:
-				col = (RTCOLLECTION*)geom;
-				for ( i = 0; i < col->ngeoms; i++ ) 
-					col->geoms[i] = rtgeom_force_sfs(ctx, (RTGEOM*)col->geoms[i], version);
-
-				return rtcollection_as_rtgeom(ctx, (RTCOLLECTION*)geom);
-
-			default:
-				return (RTGEOM *)geom;
-		}
-	}
-	
-
-	/* SFS 1.1 version */
-	switch(geom->type)
-	{
-		/* SQL/MM types */
-		case RTCIRCSTRINGTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTCURVEPOLYTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-			return rtgeom_stroke(ctx, geom, 32);
-
-		/* SFS 1.2 types */
-		case RTTRIANGLETYPE:
-			g = rtpoly_as_rtgeom(ctx, rtpoly_from_rtlines(ctx, (RTLINE*)geom, 0, NULL));
-			rtgeom_free(ctx, geom);
-			return g;
-
-		case RTTINTYPE:
-			col = (RTCOLLECTION*) geom;
-			for ( i = 0; i < col->ngeoms; i++ )
-			{
-				g = rtpoly_as_rtgeom(ctx, rtpoly_from_rtlines(ctx, (RTLINE*)col->geoms[i], 0, NULL));
-				rtgeom_free(ctx, col->geoms[i]);
-				col->geoms[i] = g;
-			}
-			col->type = RTCOLLECTIONTYPE;
-			return rtmpoly_as_rtgeom(ctx, (RTMPOLY*)geom);
-		
-		case RTPOLYHEDRALSURFACETYPE:
-			geom->type = RTCOLLECTIONTYPE;
-			return (RTGEOM *)geom;
-
-		/* Collection */
-		case RTCOLLECTIONTYPE:
-			col = (RTCOLLECTION*)geom;
-			for ( i = 0; i < col->ngeoms; i++ ) 
-				col->geoms[i] = rtgeom_force_sfs(ctx, (RTGEOM*)col->geoms[i], version);
-
-			return rtcollection_as_rtgeom(ctx, (RTCOLLECTION*)geom);
-		
-		default:
-			return (RTGEOM *)geom;
-	}
-}
-
-int32_t 
+{
+  RTCOLLECTION *col;
+  int i;
+  RTGEOM *g;
+
+  /* SFS 1.2 version */
+  if (version == 120)
+  {
+    switch(geom->type)
+    {
+      /* SQL/MM types */
+      case RTCIRCSTRINGTYPE:
+      case RTCOMPOUNDTYPE:
+      case RTCURVEPOLYTYPE:
+      case RTMULTICURVETYPE:
+      case RTMULTISURFACETYPE:
+        return rtgeom_stroke(ctx, geom, 32);
+
+      case RTCOLLECTIONTYPE:
+        col = (RTCOLLECTION*)geom;
+        for ( i = 0; i < col->ngeoms; i++ )
+          col->geoms[i] = rtgeom_force_sfs(ctx, (RTGEOM*)col->geoms[i], version);
+
+        return rtcollection_as_rtgeom(ctx, (RTCOLLECTION*)geom);
+
+      default:
+        return (RTGEOM *)geom;
+    }
+  }
+
+
+  /* SFS 1.1 version */
+  switch(geom->type)
+  {
+    /* SQL/MM types */
+    case RTCIRCSTRINGTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTCURVEPOLYTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+      return rtgeom_stroke(ctx, geom, 32);
+
+    /* SFS 1.2 types */
+    case RTTRIANGLETYPE:
+      g = rtpoly_as_rtgeom(ctx, rtpoly_from_rtlines(ctx, (RTLINE*)geom, 0, NULL));
+      rtgeom_free(ctx, geom);
+      return g;
+
+    case RTTINTYPE:
+      col = (RTCOLLECTION*) geom;
+      for ( i = 0; i < col->ngeoms; i++ )
+      {
+        g = rtpoly_as_rtgeom(ctx, rtpoly_from_rtlines(ctx, (RTLINE*)col->geoms[i], 0, NULL));
+        rtgeom_free(ctx, col->geoms[i]);
+        col->geoms[i] = g;
+      }
+      col->type = RTCOLLECTIONTYPE;
+      return rtmpoly_as_rtgeom(ctx, (RTMPOLY*)geom);
+
+    case RTPOLYHEDRALSURFACETYPE:
+      geom->type = RTCOLLECTIONTYPE;
+      return (RTGEOM *)geom;
+
+    /* Collection */
+    case RTCOLLECTIONTYPE:
+      col = (RTCOLLECTION*)geom;
+      for ( i = 0; i < col->ngeoms; i++ )
+        col->geoms[i] = rtgeom_force_sfs(ctx, (RTGEOM*)col->geoms[i], version);
+
+      return rtcollection_as_rtgeom(ctx, (RTCOLLECTION*)geom);
+
+    default:
+      return (RTGEOM *)geom;
+  }
+}
+
+int32_t
 rtgeom_get_srid(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( ! geom ) return SRID_UNKNOWN;
-	return geom->srid;
+  if ( ! geom ) return SRID_UNKNOWN;
+  return geom->srid;
 }
 
-uint32_t 
+uint32_t
 rtgeom_get_type(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( ! geom ) return 0;
-	return geom->type;
+  if ( ! geom ) return 0;
+  return geom->type;
 }
 
-int 
+int
 rtgeom_has_z(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( ! geom ) return RT_FALSE;
-	return RTFLAGS_GET_Z(geom->flags);
+  if ( ! geom ) return RT_FALSE;
+  return RTFLAGS_GET_Z(geom->flags);
 }
 
-int 
+int
 rtgeom_has_m(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( ! geom ) return RT_FALSE;
-	return RTFLAGS_GET_M(geom->flags);
+  if ( ! geom ) return RT_FALSE;
+  return RTFLAGS_GET_M(geom->flags);
 }
 
-int 
+int
 rtgeom_ndims(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( ! geom ) return 0;
-	return RTFLAGS_NDIMS(geom->flags);
+  if ( ! geom ) return 0;
+  return RTFLAGS_NDIMS(geom->flags);
 }
 
 
 void
 rtgeom_set_geodetic(const RTCTX *ctx, RTGEOM *geom, int value)
 {
-	RTPOINT *pt;
-	RTLINE *ln;
-	RTPOLY *ply;
-	RTCOLLECTION *col;
-	int i;
-	
-	RTFLAGS_SET_GEODETIC(geom->flags, value);
-	if ( geom->bbox )
-		RTFLAGS_SET_GEODETIC(geom->bbox->flags, value);
-	
-	switch(geom->type)
-	{
-		case RTPOINTTYPE:
-			pt = (RTPOINT*)geom;
-			if ( pt->point )
-				RTFLAGS_SET_GEODETIC(pt->point->flags, value);
-			break;
-		case RTLINETYPE:
-			ln = (RTLINE*)geom;
-			if ( ln->points )
-				RTFLAGS_SET_GEODETIC(ln->points->flags, value);
-			break;
-		case RTPOLYGONTYPE:
-			ply = (RTPOLY*)geom;
-			for ( i = 0; i < ply->nrings; i++ )
-				RTFLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
-			break;
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOLLECTIONTYPE:
-			col = (RTCOLLECTION*)geom;
-			for ( i = 0; i < col->ngeoms; i++ )
-				rtgeom_set_geodetic(ctx, col->geoms[i], value);
-			break;
-		default:
-			rterror(ctx, "rtgeom_set_geodetic: unsupported geom type: %s", rttype_name(ctx, geom->type));
-			return;
-	}
+  RTPOINT *pt;
+  RTLINE *ln;
+  RTPOLY *ply;
+  RTCOLLECTION *col;
+  int i;
+
+  RTFLAGS_SET_GEODETIC(geom->flags, value);
+  if ( geom->bbox )
+    RTFLAGS_SET_GEODETIC(geom->bbox->flags, value);
+
+  switch(geom->type)
+  {
+    case RTPOINTTYPE:
+      pt = (RTPOINT*)geom;
+      if ( pt->point )
+        RTFLAGS_SET_GEODETIC(pt->point->flags, value);
+      break;
+    case RTLINETYPE:
+      ln = (RTLINE*)geom;
+      if ( ln->points )
+        RTFLAGS_SET_GEODETIC(ln->points->flags, value);
+      break;
+    case RTPOLYGONTYPE:
+      ply = (RTPOLY*)geom;
+      for ( i = 0; i < ply->nrings; i++ )
+        RTFLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
+      break;
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOLLECTIONTYPE:
+      col = (RTCOLLECTION*)geom;
+      for ( i = 0; i < col->ngeoms; i++ )
+        rtgeom_set_geodetic(ctx, col->geoms[i], value);
+      break;
+    default:
+      rterror(ctx, "rtgeom_set_geodetic: unsupported geom type: %s", rttype_name(ctx, geom->type));
+      return;
+  }
 }
 
 void
 rtgeom_longitude_shift(const RTCTX *ctx, RTGEOM *rtgeom)
 {
-	int i;
-	switch (rtgeom->type)
-	{
-		RTPOINT *point;
-		RTLINE *line;
-		RTPOLY *poly;
-		RTTRIANGLE *triangle;
-		RTCOLLECTION *coll;
-
-	case RTPOINTTYPE:
-		point = (RTPOINT *)rtgeom;
-		ptarray_longitude_shift(ctx, point->point);
-		return;
-	case RTLINETYPE:
-		line = (RTLINE *)rtgeom;
-		ptarray_longitude_shift(ctx, line->points);
-		return;
-	case RTPOLYGONTYPE:
-		poly = (RTPOLY *)rtgeom;
-		for (i=0; i<poly->nrings; i++)
-			ptarray_longitude_shift(ctx, poly->rings[i]);
-		return;
-	case RTTRIANGLETYPE:
-		triangle = (RTTRIANGLE *)rtgeom;
-		ptarray_longitude_shift(ctx, triangle->points);
-		return;
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		coll = (RTCOLLECTION *)rtgeom;
-		for (i=0; i<coll->ngeoms; i++)
-			rtgeom_longitude_shift(ctx, coll->geoms[i]);
-		return;
-	default:
-		rterror(ctx, "rtgeom_longitude_shift: unsupported geom type: %s",
-		        rttype_name(ctx, rtgeom->type));
-	}
-}
-
-int 
+  int i;
+  switch (rtgeom->type)
+  {
+    RTPOINT *point;
+    RTLINE *line;
+    RTPOLY *poly;
+    RTTRIANGLE *triangle;
+    RTCOLLECTION *coll;
+
+  case RTPOINTTYPE:
+    point = (RTPOINT *)rtgeom;
+    ptarray_longitude_shift(ctx, point->point);
+    return;
+  case RTLINETYPE:
+    line = (RTLINE *)rtgeom;
+    ptarray_longitude_shift(ctx, line->points);
+    return;
+  case RTPOLYGONTYPE:
+    poly = (RTPOLY *)rtgeom;
+    for (i=0; i<poly->nrings; i++)
+      ptarray_longitude_shift(ctx, poly->rings[i]);
+    return;
+  case RTTRIANGLETYPE:
+    triangle = (RTTRIANGLE *)rtgeom;
+    ptarray_longitude_shift(ctx, triangle->points);
+    return;
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    coll = (RTCOLLECTION *)rtgeom;
+    for (i=0; i<coll->ngeoms; i++)
+      rtgeom_longitude_shift(ctx, coll->geoms[i]);
+    return;
+  default:
+    rterror(ctx, "rtgeom_longitude_shift: unsupported geom type: %s",
+            rttype_name(ctx, rtgeom->type));
+  }
+}
+
+int
 rtgeom_is_closed(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	
-	if( rtgeom_is_empty(ctx, geom) )
-		return RT_FALSE;
-	
-	/* Test linear types for closure */
-	switch (type)
-	{
-	case RTLINETYPE:
-		return rtline_is_closed(ctx, (RTLINE*)geom);
-	case RTPOLYGONTYPE:
-		return rtpoly_is_closed(ctx, (RTPOLY*)geom);
-	case RTCIRCSTRINGTYPE:
-		return rtcircstring_is_closed(ctx, (RTCIRCSTRING*)geom);
-	case RTCOMPOUNDTYPE:
-		return rtcompound_is_closed(ctx, (RTCOMPOUND*)geom);
-	case RTTINTYPE:
-		return rttin_is_closed(ctx, (RTTIN*)geom);
-	case RTPOLYHEDRALSURFACETYPE:
-		return rtpsurface_is_closed(ctx, (RTPSURFACE*)geom);
-	}
-	
-	/* Recurse into collections and see if anything is not closed */
-	if ( rtgeom_is_collection(ctx, geom) )
-	{
-		RTCOLLECTION *col = rtgeom_as_rtcollection(ctx, geom);
-		int i;
-		int closed;
-		for ( i = 0; i < col->ngeoms; i++ ) 
-		{
-			closed = rtgeom_is_closed(ctx, col->geoms[i]);
-			if ( ! closed ) 
-				return RT_FALSE;
-		}
-		return RT_TRUE;
-	}
-	
-	/* All non-linear non-collection types we will call closed */
-	return RT_TRUE;
-}
-
-int 
+  int type = geom->type;
+
+  if( rtgeom_is_empty(ctx, geom) )
+    return RT_FALSE;
+
+  /* Test linear types for closure */
+  switch (type)
+  {
+  case RTLINETYPE:
+    return rtline_is_closed(ctx, (RTLINE*)geom);
+  case RTPOLYGONTYPE:
+    return rtpoly_is_closed(ctx, (RTPOLY*)geom);
+  case RTCIRCSTRINGTYPE:
+    return rtcircstring_is_closed(ctx, (RTCIRCSTRING*)geom);
+  case RTCOMPOUNDTYPE:
+    return rtcompound_is_closed(ctx, (RTCOMPOUND*)geom);
+  case RTTINTYPE:
+    return rttin_is_closed(ctx, (RTTIN*)geom);
+  case RTPOLYHEDRALSURFACETYPE:
+    return rtpsurface_is_closed(ctx, (RTPSURFACE*)geom);
+  }
+
+  /* Recurse into collections and see if anything is not closed */
+  if ( rtgeom_is_collection(ctx, geom) )
+  {
+    RTCOLLECTION *col = rtgeom_as_rtcollection(ctx, geom);
+    int i;
+    int closed;
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      closed = rtgeom_is_closed(ctx, col->geoms[i]);
+      if ( ! closed )
+        return RT_FALSE;
+    }
+    return RT_TRUE;
+  }
+
+  /* All non-linear non-collection types we will call closed */
+  return RT_TRUE;
+}
+
+int
 rtgeom_is_collection(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if( ! geom ) return RT_FALSE;
-	return rttype_is_collection(ctx, geom->type);
+  if( ! geom ) return RT_FALSE;
+  return rttype_is_collection(ctx, geom->type);
 }
 
 /** Return TRUE if the geometry may contain sub-geometries, i.e. it is a MULTI* or COMPOUNDCURVE */
@@ -1013,139 +1013,139 @@ int
 rttype_is_collection(const RTCTX *ctx, uint8_t type)
 {
 
-	switch (type)
-	{
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-		return RT_TRUE;
-		break;
+  switch (type)
+  {
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+    return RT_TRUE;
+    break;
 
-	default:
-		return RT_FALSE;
-	}
+  default:
+    return RT_FALSE;
+  }
 }
 
 /**
 * Given an rttype number, what homogeneous collection can hold it?
 */
-int 
+int
 rttype_get_collectiontype(const RTCTX *ctx, uint8_t type)
 {
-	switch (type)
-	{
-		case RTPOINTTYPE:
-			return RTMULTIPOINTTYPE;
-		case RTLINETYPE:
-			return RTMULTILINETYPE;
-		case RTPOLYGONTYPE:
-			return RTMULTIPOLYGONTYPE;
-		case RTCIRCSTRINGTYPE:
-			return RTMULTICURVETYPE;
-		case RTCOMPOUNDTYPE:
-			return RTMULTICURVETYPE;
-		case RTCURVEPOLYTYPE:
-			return RTMULTISURFACETYPE;
-		case RTTRIANGLETYPE:
-			return RTTINTYPE;
-		default:
-			return RTCOLLECTIONTYPE;
-	}
+  switch (type)
+  {
+    case RTPOINTTYPE:
+      return RTMULTIPOINTTYPE;
+    case RTLINETYPE:
+      return RTMULTILINETYPE;
+    case RTPOLYGONTYPE:
+      return RTMULTIPOLYGONTYPE;
+    case RTCIRCSTRINGTYPE:
+      return RTMULTICURVETYPE;
+    case RTCOMPOUNDTYPE:
+      return RTMULTICURVETYPE;
+    case RTCURVEPOLYTYPE:
+      return RTMULTISURFACETYPE;
+    case RTTRIANGLETYPE:
+      return RTTINTYPE;
+    default:
+      return RTCOLLECTIONTYPE;
+  }
 }
 
 
 void rtgeom_free(const RTCTX *ctx, RTGEOM *rtgeom)
 {
 
-	/* There's nothing here to free... */
-	if( ! rtgeom ) return;
-
-	RTDEBUGF(5,"freeing a %s",rttype_name(ctx, rtgeom->type));
-	
-	switch (rtgeom->type)
-	{
-	case RTPOINTTYPE:
-		rtpoint_free(ctx, (RTPOINT *)rtgeom);
-		break;
-	case RTLINETYPE:
-		rtline_free(ctx, (RTLINE *)rtgeom);
-		break;
-	case RTPOLYGONTYPE:
-		rtpoly_free(ctx, (RTPOLY *)rtgeom);
-		break;
-	case RTCIRCSTRINGTYPE:
-		rtcircstring_free(ctx, (RTCIRCSTRING *)rtgeom);
-		break;
-	case RTTRIANGLETYPE:
-		rttriangle_free(ctx, (RTTRIANGLE *)rtgeom);
-		break;
-	case RTMULTIPOINTTYPE:
-		rtmpoint_free(ctx, (RTMPOINT *)rtgeom);
-		break;
-	case RTMULTILINETYPE:
-		rtmline_free(ctx, (RTMLINE *)rtgeom);
-		break;
-	case RTMULTIPOLYGONTYPE:
-		rtmpoly_free(ctx, (RTMPOLY *)rtgeom);
-		break;
-	case RTPOLYHEDRALSURFACETYPE:
-		rtpsurface_free(ctx, (RTPSURFACE *)rtgeom);
-		break;
-	case RTTINTYPE:
-		rttin_free(ctx, (RTTIN *)rtgeom);
-		break;
-	case RTCURVEPOLYTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTCOLLECTIONTYPE:
-		rtcollection_free(ctx, (RTCOLLECTION *)rtgeom);
-		break;
-	default:
-		rterror(ctx, "rtgeom_free called with unknown type (%d) %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
-	}
-	return;
+  /* There's nothing here to free... */
+  if( ! rtgeom ) return;
+
+  RTDEBUGF(5,"freeing a %s",rttype_name(ctx, rtgeom->type));
+
+  switch (rtgeom->type)
+  {
+  case RTPOINTTYPE:
+    rtpoint_free(ctx, (RTPOINT *)rtgeom);
+    break;
+  case RTLINETYPE:
+    rtline_free(ctx, (RTLINE *)rtgeom);
+    break;
+  case RTPOLYGONTYPE:
+    rtpoly_free(ctx, (RTPOLY *)rtgeom);
+    break;
+  case RTCIRCSTRINGTYPE:
+    rtcircstring_free(ctx, (RTCIRCSTRING *)rtgeom);
+    break;
+  case RTTRIANGLETYPE:
+    rttriangle_free(ctx, (RTTRIANGLE *)rtgeom);
+    break;
+  case RTMULTIPOINTTYPE:
+    rtmpoint_free(ctx, (RTMPOINT *)rtgeom);
+    break;
+  case RTMULTILINETYPE:
+    rtmline_free(ctx, (RTMLINE *)rtgeom);
+    break;
+  case RTMULTIPOLYGONTYPE:
+    rtmpoly_free(ctx, (RTMPOLY *)rtgeom);
+    break;
+  case RTPOLYHEDRALSURFACETYPE:
+    rtpsurface_free(ctx, (RTPSURFACE *)rtgeom);
+    break;
+  case RTTINTYPE:
+    rttin_free(ctx, (RTTIN *)rtgeom);
+    break;
+  case RTCURVEPOLYTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTCOLLECTIONTYPE:
+    rtcollection_free(ctx, (RTCOLLECTION *)rtgeom);
+    break;
+  default:
+    rterror(ctx, "rtgeom_free called with unknown type (%d) %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
+  }
+  return;
 }
 
 int rtgeom_needs_bbox(const RTCTX *ctx, const RTGEOM *geom)
 {
-	assert(geom);
-	if ( geom->type == RTPOINTTYPE )
-	{
-		return RT_FALSE;
-	}
-	else if ( geom->type == RTLINETYPE )
-	{
-		if ( rtgeom_count_vertices(ctx, geom) <= 2 )
-			return RT_FALSE;
-		else
-			return RT_TRUE;
-	}
-	else if ( geom->type == RTMULTIPOINTTYPE )
-	{
-		if ( ((RTCOLLECTION*)geom)->ngeoms == 1 )
-			return RT_FALSE;
-		else
-			return RT_TRUE;
-	}
-	else if ( geom->type == RTMULTILINETYPE )
-	{
-		if ( ((RTCOLLECTION*)geom)->ngeoms == 1 && rtgeom_count_vertices(ctx, geom) <= 2 )
-			return RT_FALSE;
-		else
-			return RT_TRUE;
-	}
-	else
-	{
-		return RT_TRUE;
-	}
+  assert(geom);
+  if ( geom->type == RTPOINTTYPE )
+  {
+    return RT_FALSE;
+  }
+  else if ( geom->type == RTLINETYPE )
+  {
+    if ( rtgeom_count_vertices(ctx, geom) <= 2 )
+      return RT_FALSE;
+    else
+      return RT_TRUE;
+  }
+  else if ( geom->type == RTMULTIPOINTTYPE )
+  {
+    if ( ((RTCOLLECTION*)geom)->ngeoms == 1 )
+      return RT_FALSE;
+    else
+      return RT_TRUE;
+  }
+  else if ( geom->type == RTMULTILINETYPE )
+  {
+    if ( ((RTCOLLECTION*)geom)->ngeoms == 1 && rtgeom_count_vertices(ctx, geom) <= 2 )
+      return RT_FALSE;
+    else
+      return RT_TRUE;
+  }
+  else
+  {
+    return RT_TRUE;
+  }
 }
 
 /**
@@ -1153,108 +1153,108 @@ int rtgeom_needs_bbox(const RTCTX *ctx, const RTGEOM *geom)
 */
 int rtgeom_count_vertices(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int result = 0;
-	
-	/* Null? Zero. */
-	if( ! geom ) return 0;
-	
-	RTDEBUGF(4, "rtgeom_count_vertices got type %s",
-	         rttype_name(ctx, geom->type));
-
-	/* Empty? Zero. */
-	if( rtgeom_is_empty(ctx, geom) ) return 0;
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		result = 1;
-		break;
-	case RTTRIANGLETYPE:
-	case RTCIRCSTRINGTYPE: 
-	case RTLINETYPE:
-		result = rtline_count_vertices(ctx, (RTLINE *)geom);
-		break;
-	case RTPOLYGONTYPE:
-		result = rtpoly_count_vertices(ctx, (RTPOLY *)geom);
-		break;
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		result = rtcollection_count_vertices(ctx, (RTCOLLECTION *)geom);
-		break;
-	default:
-		rterror(ctx, "%s: unsupported input geometry type: %s",
-		        __func__, rttype_name(ctx, geom->type));
-		break;
-	}
-	RTDEBUGF(3, "counted %d vertices", result);
-	return result;
+  int result = 0;
+
+  /* Null? Zero. */
+  if( ! geom ) return 0;
+
+  RTDEBUGF(4, "rtgeom_count_vertices got type %s",
+           rttype_name(ctx, geom->type));
+
+  /* Empty? Zero. */
+  if( rtgeom_is_empty(ctx, geom) ) return 0;
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    result = 1;
+    break;
+  case RTTRIANGLETYPE:
+  case RTCIRCSTRINGTYPE:
+  case RTLINETYPE:
+    result = rtline_count_vertices(ctx, (RTLINE *)geom);
+    break;
+  case RTPOLYGONTYPE:
+    result = rtpoly_count_vertices(ctx, (RTPOLY *)geom);
+    break;
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    result = rtcollection_count_vertices(ctx, (RTCOLLECTION *)geom);
+    break;
+  default:
+    rterror(ctx, "%s: unsupported input geometry type: %s",
+            __func__, rttype_name(ctx, geom->type));
+    break;
+  }
+  RTDEBUGF(3, "counted %d vertices", result);
+  return result;
 }
 
 /**
-* For an #RTGEOM, returns 0 for points, 1 for lines, 
-* 2 for polygons, 3 for volume, and the max dimension 
+* For an #RTGEOM, returns 0 for points, 1 for lines,
+* 2 for polygons, 3 for volume, and the max dimension
 * of a collection.
 */
 int rtgeom_dimension(const RTCTX *ctx, const RTGEOM *geom)
 {
 
-	/* Null? Zero. */
-	if( ! geom ) return -1;
-	
-	RTDEBUGF(4, "rtgeom_dimension got type %s",
-	         rttype_name(ctx, geom->type));
-
-	/* Empty? Zero. */
-	/* if( rtgeom_is_empty(ctx, geom) ) return 0; */
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-	case RTMULTIPOINTTYPE:
-		return 0;
-	case RTCIRCSTRINGTYPE: 
-	case RTLINETYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTILINETYPE:
-		return 1;
-	case RTTRIANGLETYPE:
-	case RTPOLYGONTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTTINTYPE:
-		return 2;
-	case RTPOLYHEDRALSURFACETYPE:
-	{
-		/* A closed polyhedral surface contains a volume. */
-		int closed = rtpsurface_is_closed(ctx, (RTPSURFACE*)geom);
-		return ( closed ? 3 : 2 );
-	}
-	case RTCOLLECTIONTYPE:
-	{
-		int maxdim = 0, i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for( i = 0; i < col->ngeoms; i++ )
-		{
-			int dim = rtgeom_dimension(ctx, col->geoms[i]);
-			maxdim = ( dim > maxdim ? dim : maxdim );
-		}
-		return maxdim;
-	}
-	default:
-		rterror(ctx, "%s: unsupported input geometry type: %s",
-		        __func__, rttype_name(ctx, geom->type));
-	}
-	return -1;
+  /* Null? Zero. */
+  if( ! geom ) return -1;
+
+  RTDEBUGF(4, "rtgeom_dimension got type %s",
+           rttype_name(ctx, geom->type));
+
+  /* Empty? Zero. */
+  /* if( rtgeom_is_empty(ctx, geom) ) return 0; */
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+  case RTMULTIPOINTTYPE:
+    return 0;
+  case RTCIRCSTRINGTYPE:
+  case RTLINETYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTILINETYPE:
+    return 1;
+  case RTTRIANGLETYPE:
+  case RTPOLYGONTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTTINTYPE:
+    return 2;
+  case RTPOLYHEDRALSURFACETYPE:
+  {
+    /* A closed polyhedral surface contains a volume. */
+    int closed = rtpsurface_is_closed(ctx, (RTPSURFACE*)geom);
+    return ( closed ? 3 : 2 );
+  }
+  case RTCOLLECTIONTYPE:
+  {
+    int maxdim = 0, i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for( i = 0; i < col->ngeoms; i++ )
+    {
+      int dim = rtgeom_dimension(ctx, col->geoms[i]);
+      maxdim = ( dim > maxdim ? dim : maxdim );
+    }
+    return maxdim;
+  }
+  default:
+    rterror(ctx, "%s: unsupported input geometry type: %s",
+            __func__, rttype_name(ctx, geom->type));
+  }
+  return -1;
 }
 
 /**
@@ -1262,211 +1262,211 @@ int rtgeom_dimension(const RTCTX *ctx, const RTGEOM *geom)
 */
 int rtgeom_count_rings(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int result = 0;
-	
-	/* Null? Empty? Zero. */
-	if( ! geom || rtgeom_is_empty(ctx, geom) ) 
-		return 0;
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-	case RTCIRCSTRINGTYPE: 
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTLINETYPE:
-		result = 0;
-		break;
-	case RTTRIANGLETYPE:
-		result = 1;
-		break;
-	case RTPOLYGONTYPE:
-		result = ((RTPOLY *)geom)->nrings;
-		break;
-	case RTCURVEPOLYTYPE:
-		result = ((RTCURVEPOLY *)geom)->nrings;
-		break;
-	case RTMULTISURFACETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-	{
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		int i = 0;
-		for( i = 0; i < col->ngeoms; i++ )
-			result += rtgeom_count_rings(ctx, col->geoms[i]);
-		break;
-	}
-	default:
-		rterror(ctx, "rtgeom_count_rings: unsupported input geometry type: %s", rttype_name(ctx, geom->type));
-		break;
-	}
-	RTDEBUGF(3, "counted %d rings", result);
-	return result;
+  int result = 0;
+
+  /* Null? Empty? Zero. */
+  if( ! geom || rtgeom_is_empty(ctx, geom) )
+    return 0;
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+  case RTCIRCSTRINGTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTLINETYPE:
+    result = 0;
+    break;
+  case RTTRIANGLETYPE:
+    result = 1;
+    break;
+  case RTPOLYGONTYPE:
+    result = ((RTPOLY *)geom)->nrings;
+    break;
+  case RTCURVEPOLYTYPE:
+    result = ((RTCURVEPOLY *)geom)->nrings;
+    break;
+  case RTMULTISURFACETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+  {
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    int i = 0;
+    for( i = 0; i < col->ngeoms; i++ )
+      result += rtgeom_count_rings(ctx, col->geoms[i]);
+    break;
+  }
+  default:
+    rterror(ctx, "rtgeom_count_rings: unsupported input geometry type: %s", rttype_name(ctx, geom->type));
+    break;
+  }
+  RTDEBUGF(3, "counted %d rings", result);
+  return result;
 }
 
 int rtgeom_is_empty(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int result = RT_FALSE;
-	RTDEBUGF(4, "rtgeom_is_empty: got type %s",
-	         rttype_name(ctx, geom->type));
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_is_empty(ctx, (RTPOINT*)geom);
-		break;
-	case RTLINETYPE:
-		return rtline_is_empty(ctx, (RTLINE*)geom);
-		break;
-	case RTCIRCSTRINGTYPE:
-		return rtcircstring_is_empty(ctx, (RTCIRCSTRING*)geom);
-		break;
-	case RTPOLYGONTYPE:
-		return rtpoly_is_empty(ctx, (RTPOLY*)geom);
-		break;
-	case RTTRIANGLETYPE:
-		return rttriangle_is_empty(ctx, (RTTRIANGLE*)geom);
-		break;
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTICURVETYPE:
-	case RTMULTISURFACETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_is_empty(ctx, (RTCOLLECTION *)geom);
-		break;
-	default:
-		rterror(ctx, "rtgeom_is_empty: unsupported input geometry type: %s",
-		        rttype_name(ctx, geom->type));
-		break;
-	}
-	return result;
+  int result = RT_FALSE;
+  RTDEBUGF(4, "rtgeom_is_empty: got type %s",
+           rttype_name(ctx, geom->type));
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_is_empty(ctx, (RTPOINT*)geom);
+    break;
+  case RTLINETYPE:
+    return rtline_is_empty(ctx, (RTLINE*)geom);
+    break;
+  case RTCIRCSTRINGTYPE:
+    return rtcircstring_is_empty(ctx, (RTCIRCSTRING*)geom);
+    break;
+  case RTPOLYGONTYPE:
+    return rtpoly_is_empty(ctx, (RTPOLY*)geom);
+    break;
+  case RTTRIANGLETYPE:
+    return rttriangle_is_empty(ctx, (RTTRIANGLE*)geom);
+    break;
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTICURVETYPE:
+  case RTMULTISURFACETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_is_empty(ctx, (RTCOLLECTION *)geom);
+    break;
+  default:
+    rterror(ctx, "rtgeom_is_empty: unsupported input geometry type: %s",
+            rttype_name(ctx, geom->type));
+    break;
+  }
+  return result;
 }
 
 int rtgeom_has_srid(const RTCTX *ctx, const RTGEOM *geom)
 {
-	if ( geom->srid != SRID_UNKNOWN )
-		return RT_TRUE;
+  if ( geom->srid != SRID_UNKNOWN )
+    return RT_TRUE;
 
-	return RT_FALSE;
+  return RT_FALSE;
 }
 
 
 static int rtcollection_dimensionality(const RTCTX *ctx, RTCOLLECTION *col)
 {
-	int i;
-	int dimensionality = 0;
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		int d = rtgeom_dimensionality(ctx, col->geoms[i]);
-		if ( d > dimensionality )
-			dimensionality = d;
-	}
-	return dimensionality;
+  int i;
+  int dimensionality = 0;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    int d = rtgeom_dimensionality(ctx, col->geoms[i]);
+    if ( d > dimensionality )
+      dimensionality = d;
+  }
+  return dimensionality;
 }
 
 extern int rtgeom_dimensionality(const RTCTX *ctx, RTGEOM *geom)
 {
-	int dim;
-
-	RTDEBUGF(3, "rtgeom_dimensionality got type %s",
-	         rttype_name(ctx, geom->type));
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-	case RTMULTIPOINTTYPE:
-		return 0;
-		break;
-	case RTLINETYPE:
-	case RTCIRCSTRINGTYPE:
-	case RTMULTILINETYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-		return 1;
-		break;
-	case RTPOLYGONTYPE:
-	case RTTRIANGLETYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTISURFACETYPE:
-		return 2;
-		break;
-
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-		dim = rtgeom_is_closed(ctx, geom)?3:2;
-		return dim;
-		break;
-
-	case RTCOLLECTIONTYPE:
-		return rtcollection_dimensionality(ctx, (RTCOLLECTION *)geom);
-		break;
-	default:
-		rterror(ctx, "rtgeom_dimensionality: unsupported input geometry type: %s",
-		        rttype_name(ctx, geom->type));
-		break;
-	}
-	return 0;
+  int dim;
+
+  RTDEBUGF(3, "rtgeom_dimensionality got type %s",
+           rttype_name(ctx, geom->type));
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+  case RTMULTIPOINTTYPE:
+    return 0;
+    break;
+  case RTLINETYPE:
+  case RTCIRCSTRINGTYPE:
+  case RTMULTILINETYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+    return 1;
+    break;
+  case RTPOLYGONTYPE:
+  case RTTRIANGLETYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTISURFACETYPE:
+    return 2;
+    break;
+
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+    dim = rtgeom_is_closed(ctx, geom)?3:2;
+    return dim;
+    break;
+
+  case RTCOLLECTIONTYPE:
+    return rtcollection_dimensionality(ctx, (RTCOLLECTION *)geom);
+    break;
+  default:
+    rterror(ctx, "rtgeom_dimensionality: unsupported input geometry type: %s",
+            rttype_name(ctx, geom->type));
+    break;
+  }
+  return 0;
 }
 
 extern RTGEOM* rtgeom_remove_repeated_points(const RTCTX *ctx, const RTGEOM *in, double tolerance)
 {
-	RTDEBUGF(4, "rtgeom_remove_repeated_points got type %s",
-	         rttype_name(ctx, in->type));
-
-	if(rtgeom_is_empty(ctx, in)) 
-	{
-		return rtgeom_clone_deep(ctx, in);
-	}
-
-	switch (in->type)
-	{
-	case RTMULTIPOINTTYPE:
-		return rtmpoint_remove_repeated_points(ctx, (RTMPOINT*)in, tolerance);
-		break;
-	case RTLINETYPE:
-		return rtline_remove_repeated_points(ctx, (RTLINE*)in, tolerance);
-
-	case RTMULTILINETYPE:
-	case RTCOLLECTIONTYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-		return rtcollection_remove_repeated_points(ctx, (RTCOLLECTION *)in, tolerance);
-
-	case RTPOLYGONTYPE:
-		return rtpoly_remove_repeated_points(ctx, (RTPOLY *)in, tolerance);
-		break;
-
-	case RTPOINTTYPE:
-	case RTTRIANGLETYPE:
-	case RTTINTYPE:
-		/* No point is repeated for a single point, or for Triangle or TIN */
-		return rtgeom_clone_deep(ctx, in);
-
-	case RTCIRCSTRINGTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTICURVETYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTISURFACETYPE:
-		/* Dunno how to handle these, will return untouched */
-		return rtgeom_clone_deep(ctx, in);
-
-	default:
-		rtnotice(ctx, "%s: unsupported geometry type: %s",
-		         __func__, rttype_name(ctx, in->type));
-		return rtgeom_clone_deep(ctx, in);
-		break;
-	}
-	return 0;
+  RTDEBUGF(4, "rtgeom_remove_repeated_points got type %s",
+           rttype_name(ctx, in->type));
+
+  if(rtgeom_is_empty(ctx, in))
+  {
+    return rtgeom_clone_deep(ctx, in);
+  }
+
+  switch (in->type)
+  {
+  case RTMULTIPOINTTYPE:
+    return rtmpoint_remove_repeated_points(ctx, (RTMPOINT*)in, tolerance);
+    break;
+  case RTLINETYPE:
+    return rtline_remove_repeated_points(ctx, (RTLINE*)in, tolerance);
+
+  case RTMULTILINETYPE:
+  case RTCOLLECTIONTYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+    return rtcollection_remove_repeated_points(ctx, (RTCOLLECTION *)in, tolerance);
+
+  case RTPOLYGONTYPE:
+    return rtpoly_remove_repeated_points(ctx, (RTPOLY *)in, tolerance);
+    break;
+
+  case RTPOINTTYPE:
+  case RTTRIANGLETYPE:
+  case RTTINTYPE:
+    /* No point is repeated for a single point, or for Triangle or TIN */
+    return rtgeom_clone_deep(ctx, in);
+
+  case RTCIRCSTRINGTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTICURVETYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTISURFACETYPE:
+    /* Dunno how to handle these, will return untouched */
+    return rtgeom_clone_deep(ctx, in);
+
+  default:
+    rtnotice(ctx, "%s: unsupported geometry type: %s",
+             __func__, rttype_name(ctx, in->type));
+    return rtgeom_clone_deep(ctx, in);
+    break;
+  }
+  return 0;
 }
 
 RTGEOM* rtgeom_flip_coordinates(const RTCTX *ctx, RTGEOM *in)
@@ -1477,573 +1477,573 @@ RTGEOM* rtgeom_flip_coordinates(const RTCTX *ctx, RTGEOM *in)
 
 void rtgeom_swap_ordinates(const RTCTX *ctx, RTGEOM *in, RTORD o1, RTORD o2)
 {
-	RTCOLLECTION *col;
-	RTPOLY *poly;
-	int i;
+  RTCOLLECTION *col;
+  RTPOLY *poly;
+  int i;
 
 #if PARANOIA_LEVEL > 0
   assert(o1 < 4);
   assert(o2 < 4);
 #endif
 
-	if ( (!in) || rtgeom_is_empty(ctx, in) ) return;
+  if ( (!in) || rtgeom_is_empty(ctx, in) ) return;
 
   /* TODO: check for rtgeom NOT having the specified dimension ? */
 
-	RTDEBUGF(4, "rtgeom_flip_coordinates, got type: %s",
-	         rttype_name(ctx, in->type));
-
-	switch (in->type)
-	{
-	case RTPOINTTYPE:
-		ptarray_swap_ordinates(ctx, rtgeom_as_rtpoint(ctx, in)->point, o1, o2);
-		break;
-
-	case RTLINETYPE:
-		ptarray_swap_ordinates(ctx, rtgeom_as_rtline(ctx, in)->points, o1, o2);
-		break;
-
-	case RTCIRCSTRINGTYPE:
-		ptarray_swap_ordinates(ctx, rtgeom_as_rtcircstring(ctx, in)->points, o1, o2);
-		break;
-
-	case RTPOLYGONTYPE:
-		poly = (RTPOLY *) in;
-		for (i=0; i<poly->nrings; i++)
-		{
-			ptarray_swap_ordinates(ctx, poly->rings[i], o1, o2);
-		}
-		break;
-
-	case RTTRIANGLETYPE:
-		ptarray_swap_ordinates(ctx, rtgeom_as_rttriangle(ctx, in)->points, o1, o2);
-		break;
-
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTICURVETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-		col = (RTCOLLECTION *) in;
-		for (i=0; i<col->ngeoms; i++)
-		{
-			rtgeom_swap_ordinates(ctx, col->geoms[i], o1, o2);
-		}
-		break;
-
-	default:
-		rterror(ctx, "rtgeom_swap_ordinates: unsupported geometry type: %s",
-		        rttype_name(ctx, in->type));
-		return;
-	}
-
-	/* only refresh bbox if X or Y changed */
-	if ( in->bbox && (o1 < 2 || o2 < 2) ) 
-	{
-		rtgeom_drop_bbox(ctx, in);
-		rtgeom_add_bbox(ctx, in);
-	}
+  RTDEBUGF(4, "rtgeom_flip_coordinates, got type: %s",
+           rttype_name(ctx, in->type));
+
+  switch (in->type)
+  {
+  case RTPOINTTYPE:
+    ptarray_swap_ordinates(ctx, rtgeom_as_rtpoint(ctx, in)->point, o1, o2);
+    break;
+
+  case RTLINETYPE:
+    ptarray_swap_ordinates(ctx, rtgeom_as_rtline(ctx, in)->points, o1, o2);
+    break;
+
+  case RTCIRCSTRINGTYPE:
+    ptarray_swap_ordinates(ctx, rtgeom_as_rtcircstring(ctx, in)->points, o1, o2);
+    break;
+
+  case RTPOLYGONTYPE:
+    poly = (RTPOLY *) in;
+    for (i=0; i<poly->nrings; i++)
+    {
+      ptarray_swap_ordinates(ctx, poly->rings[i], o1, o2);
+    }
+    break;
+
+  case RTTRIANGLETYPE:
+    ptarray_swap_ordinates(ctx, rtgeom_as_rttriangle(ctx, in)->points, o1, o2);
+    break;
+
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTICURVETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+    col = (RTCOLLECTION *) in;
+    for (i=0; i<col->ngeoms; i++)
+    {
+      rtgeom_swap_ordinates(ctx, col->geoms[i], o1, o2);
+    }
+    break;
+
+  default:
+    rterror(ctx, "rtgeom_swap_ordinates: unsupported geometry type: %s",
+            rttype_name(ctx, in->type));
+    return;
+  }
+
+  /* only refresh bbox if X or Y changed */
+  if ( in->bbox && (o1 < 2 || o2 < 2) )
+  {
+    rtgeom_drop_bbox(ctx, in);
+    rtgeom_add_bbox(ctx, in);
+  }
 }
 
 void rtgeom_set_srid(const RTCTX *ctx, RTGEOM *geom, int32_t srid)
 {
-	int i;
+  int i;
 
-	RTDEBUGF(4,"entered with srid=%d",srid);
+  RTDEBUGF(4,"entered with srid=%d",srid);
 
-	geom->srid = srid;
+  geom->srid = srid;
 
-	if ( rtgeom_is_collection(ctx, geom) )
-	{
-		/* All the children are set to the same SRID value */
-		RTCOLLECTION *col = rtgeom_as_rtcollection(ctx, geom);
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			rtgeom_set_srid(ctx, col->geoms[i], srid);
-		}
-	}
+  if ( rtgeom_is_collection(ctx, geom) )
+  {
+    /* All the children are set to the same SRID value */
+    RTCOLLECTION *col = rtgeom_as_rtcollection(ctx, geom);
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      rtgeom_set_srid(ctx, col->geoms[i], srid);
+    }
+  }
 }
 
 RTGEOM* rtgeom_simplify(const RTCTX *ctx, const RTGEOM *igeom, double dist, int preserve_collapsed)
 {
-	switch (igeom->type)
-	{
-	case RTPOINTTYPE:
-	case RTMULTIPOINTTYPE:
-		return rtgeom_clone(ctx, igeom);
-	case RTLINETYPE:
-		return (RTGEOM*)rtline_simplify(ctx, (RTLINE*)igeom, dist, preserve_collapsed);
-	case RTPOLYGONTYPE:
-		return (RTGEOM*)rtpoly_simplify(ctx, (RTPOLY*)igeom, dist, preserve_collapsed);
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		return (RTGEOM*)rtcollection_simplify(ctx, (RTCOLLECTION *)igeom, dist, preserve_collapsed);
-	default:
-		rterror(ctx, "%s: unsupported geometry type: %s", __func__, rttype_name(ctx, igeom->type));
-	}
-	return NULL;
+  switch (igeom->type)
+  {
+  case RTPOINTTYPE:
+  case RTMULTIPOINTTYPE:
+    return rtgeom_clone(ctx, igeom);
+  case RTLINETYPE:
+    return (RTGEOM*)rtline_simplify(ctx, (RTLINE*)igeom, dist, preserve_collapsed);
+  case RTPOLYGONTYPE:
+    return (RTGEOM*)rtpoly_simplify(ctx, (RTPOLY*)igeom, dist, preserve_collapsed);
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    return (RTGEOM*)rtcollection_simplify(ctx, (RTCOLLECTION *)igeom, dist, preserve_collapsed);
+  default:
+    rterror(ctx, "%s: unsupported geometry type: %s", __func__, rttype_name(ctx, igeom->type));
+  }
+  return NULL;
 }
 
 double rtgeom_area(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	
-	if ( type == RTPOLYGONTYPE )
-		return rtpoly_area(ctx, (RTPOLY*)geom);
-	else if ( type == RTCURVEPOLYTYPE )
-		return rtcurvepoly_area(ctx, (RTCURVEPOLY*)geom);
-	else if (type ==  RTTRIANGLETYPE )
-		return rttriangle_area(ctx, (RTTRIANGLE*)geom);
-	else if ( rtgeom_is_collection(ctx, geom) )
-	{
-		double area = 0.0;
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for ( i = 0; i < col->ngeoms; i++ )
-			area += rtgeom_area(ctx, col->geoms[i]);
-		return area;
-	}
-	else
-		return 0.0;
+  int type = geom->type;
+
+  if ( type == RTPOLYGONTYPE )
+    return rtpoly_area(ctx, (RTPOLY*)geom);
+  else if ( type == RTCURVEPOLYTYPE )
+    return rtcurvepoly_area(ctx, (RTCURVEPOLY*)geom);
+  else if (type ==  RTTRIANGLETYPE )
+    return rttriangle_area(ctx, (RTTRIANGLE*)geom);
+  else if ( rtgeom_is_collection(ctx, geom) )
+  {
+    double area = 0.0;
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for ( i = 0; i < col->ngeoms; i++ )
+      area += rtgeom_area(ctx, col->geoms[i]);
+    return area;
+  }
+  else
+    return 0.0;
 }
 
 double rtgeom_perimeter(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	if ( type == RTPOLYGONTYPE )
-		return rtpoly_perimeter(ctx, (RTPOLY*)geom);
-	else if ( type == RTCURVEPOLYTYPE )
-		return rtcurvepoly_perimeter(ctx, (RTCURVEPOLY*)geom);
-	else if ( type == RTTRIANGLETYPE )
-		return rttriangle_perimeter(ctx, (RTTRIANGLE*)geom);
-	else if ( rtgeom_is_collection(ctx, geom) )
-	{
-		double perimeter = 0.0;
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for ( i = 0; i < col->ngeoms; i++ )
-			perimeter += rtgeom_perimeter(ctx, col->geoms[i]);
-		return perimeter;
-	}
-	else
-		return 0.0;
+  int type = geom->type;
+  if ( type == RTPOLYGONTYPE )
+    return rtpoly_perimeter(ctx, (RTPOLY*)geom);
+  else if ( type == RTCURVEPOLYTYPE )
+    return rtcurvepoly_perimeter(ctx, (RTCURVEPOLY*)geom);
+  else if ( type == RTTRIANGLETYPE )
+    return rttriangle_perimeter(ctx, (RTTRIANGLE*)geom);
+  else if ( rtgeom_is_collection(ctx, geom) )
+  {
+    double perimeter = 0.0;
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for ( i = 0; i < col->ngeoms; i++ )
+      perimeter += rtgeom_perimeter(ctx, col->geoms[i]);
+    return perimeter;
+  }
+  else
+    return 0.0;
 }
 
 double rtgeom_perimeter_2d(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	if ( type == RTPOLYGONTYPE )
-		return rtpoly_perimeter_2d(ctx, (RTPOLY*)geom);
-	else if ( type == RTCURVEPOLYTYPE )
-		return rtcurvepoly_perimeter_2d(ctx, (RTCURVEPOLY*)geom);
-	else if ( type == RTTRIANGLETYPE )
-		return rttriangle_perimeter_2d(ctx, (RTTRIANGLE*)geom);
-	else if ( rtgeom_is_collection(ctx, geom) )
-	{
-		double perimeter = 0.0;
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for ( i = 0; i < col->ngeoms; i++ )
-			perimeter += rtgeom_perimeter_2d(ctx, col->geoms[i]);
-		return perimeter;
-	}
-	else
-		return 0.0;
+  int type = geom->type;
+  if ( type == RTPOLYGONTYPE )
+    return rtpoly_perimeter_2d(ctx, (RTPOLY*)geom);
+  else if ( type == RTCURVEPOLYTYPE )
+    return rtcurvepoly_perimeter_2d(ctx, (RTCURVEPOLY*)geom);
+  else if ( type == RTTRIANGLETYPE )
+    return rttriangle_perimeter_2d(ctx, (RTTRIANGLE*)geom);
+  else if ( rtgeom_is_collection(ctx, geom) )
+  {
+    double perimeter = 0.0;
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for ( i = 0; i < col->ngeoms; i++ )
+      perimeter += rtgeom_perimeter_2d(ctx, col->geoms[i]);
+    return perimeter;
+  }
+  else
+    return 0.0;
 }
 
 double rtgeom_length(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	if ( type == RTLINETYPE )
-		return rtline_length(ctx, (RTLINE*)geom);
-	else if ( type == RTCIRCSTRINGTYPE )
-		return rtcircstring_length(ctx, (RTCIRCSTRING*)geom);
-	else if ( type == RTCOMPOUNDTYPE )
-		return rtcompound_length(ctx, (RTCOMPOUND*)geom);
-	else if ( rtgeom_is_collection(ctx, geom) )
-	{
-		double length = 0.0;
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for ( i = 0; i < col->ngeoms; i++ )
-			length += rtgeom_length(ctx, col->geoms[i]);
-		return length;
-	}
-	else
-		return 0.0;
+  int type = geom->type;
+  if ( type == RTLINETYPE )
+    return rtline_length(ctx, (RTLINE*)geom);
+  else if ( type == RTCIRCSTRINGTYPE )
+    return rtcircstring_length(ctx, (RTCIRCSTRING*)geom);
+  else if ( type == RTCOMPOUNDTYPE )
+    return rtcompound_length(ctx, (RTCOMPOUND*)geom);
+  else if ( rtgeom_is_collection(ctx, geom) )
+  {
+    double length = 0.0;
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for ( i = 0; i < col->ngeoms; i++ )
+      length += rtgeom_length(ctx, col->geoms[i]);
+    return length;
+  }
+  else
+    return 0.0;
 }
 
 double rtgeom_length_2d(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
-	if ( type == RTLINETYPE )
-		return rtline_length_2d(ctx, (RTLINE*)geom);
-	else if ( type == RTCIRCSTRINGTYPE )
-		return rtcircstring_length_2d(ctx, (RTCIRCSTRING*)geom);
-	else if ( type == RTCOMPOUNDTYPE )
-		return rtcompound_length_2d(ctx, (RTCOMPOUND*)geom);
-	else if ( rtgeom_is_collection(ctx, geom) )
-	{
-		double length = 0.0;
-		int i;
-		RTCOLLECTION *col = (RTCOLLECTION*)geom;
-		for ( i = 0; i < col->ngeoms; i++ )
-			length += rtgeom_length_2d(ctx, col->geoms[i]);
-		return length;
-	}
-	else
-		return 0.0;
+  int type = geom->type;
+  if ( type == RTLINETYPE )
+    return rtline_length_2d(ctx, (RTLINE*)geom);
+  else if ( type == RTCIRCSTRINGTYPE )
+    return rtcircstring_length_2d(ctx, (RTCIRCSTRING*)geom);
+  else if ( type == RTCOMPOUNDTYPE )
+    return rtcompound_length_2d(ctx, (RTCOMPOUND*)geom);
+  else if ( rtgeom_is_collection(ctx, geom) )
+  {
+    double length = 0.0;
+    int i;
+    RTCOLLECTION *col = (RTCOLLECTION*)geom;
+    for ( i = 0; i < col->ngeoms; i++ )
+      length += rtgeom_length_2d(ctx, col->geoms[i]);
+    return length;
+  }
+  else
+    return 0.0;
 }
 
 void
 rtgeom_affine(const RTCTX *ctx, RTGEOM *geom, const RTAFFINE *affine)
 {
-	int type = geom->type;
-	int i;
-
-	switch(type) 
-	{
-		/* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
-		case RTPOINTTYPE:
-		case RTLINETYPE:
-		case RTCIRCSTRINGTYPE:
-		case RTTRIANGLETYPE:
-		{
-			RTLINE *l = (RTLINE*)geom;
-			ptarray_affine(ctx, l->points, affine);
-			break;
-		}
-		case RTPOLYGONTYPE:
-		{
-			RTPOLY *p = (RTPOLY*)geom;
-			for( i = 0; i < p->nrings; i++ )
-				ptarray_affine(ctx, p->rings[i], affine);
-			break;
-		}
-		case RTCURVEPOLYTYPE:
-		{
-			RTCURVEPOLY *c = (RTCURVEPOLY*)geom;
-			for( i = 0; i < c->nrings; i++ )
-				rtgeom_affine(ctx, c->rings[i], affine);
-			break;
-		}
-		default:
-		{
-			if( rtgeom_is_collection(ctx, geom) )
-			{
-				RTCOLLECTION *c = (RTCOLLECTION*)geom;
-				for( i = 0; i < c->ngeoms; i++ )
-				{
-					rtgeom_affine(ctx, c->geoms[i], affine);
-				}
-			}
-			else 
-			{
-				rterror(ctx, "rtgeom_affine: unable to handle type '%s'", rttype_name(ctx, type));
-			}
-		}
-	}
+  int type = geom->type;
+  int i;
+
+  switch(type)
+  {
+    /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
+    case RTPOINTTYPE:
+    case RTLINETYPE:
+    case RTCIRCSTRINGTYPE:
+    case RTTRIANGLETYPE:
+    {
+      RTLINE *l = (RTLINE*)geom;
+      ptarray_affine(ctx, l->points, affine);
+      break;
+    }
+    case RTPOLYGONTYPE:
+    {
+      RTPOLY *p = (RTPOLY*)geom;
+      for( i = 0; i < p->nrings; i++ )
+        ptarray_affine(ctx, p->rings[i], affine);
+      break;
+    }
+    case RTCURVEPOLYTYPE:
+    {
+      RTCURVEPOLY *c = (RTCURVEPOLY*)geom;
+      for( i = 0; i < c->nrings; i++ )
+        rtgeom_affine(ctx, c->rings[i], affine);
+      break;
+    }
+    default:
+    {
+      if( rtgeom_is_collection(ctx, geom) )
+      {
+        RTCOLLECTION *c = (RTCOLLECTION*)geom;
+        for( i = 0; i < c->ngeoms; i++ )
+        {
+          rtgeom_affine(ctx, c->geoms[i], affine);
+        }
+      }
+      else
+      {
+        rterror(ctx, "rtgeom_affine: unable to handle type '%s'", rttype_name(ctx, type));
+      }
+    }
+  }
 
 }
 
 void
 rtgeom_scale(const RTCTX *ctx, RTGEOM *geom, const RTPOINT4D *factor)
 {
-	int type = geom->type;
-	int i;
-
-	switch(type) 
-	{
-		/* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
-		case RTPOINTTYPE:
-		case RTLINETYPE:
-		case RTCIRCSTRINGTYPE:
-		case RTTRIANGLETYPE:
-		{
-			RTLINE *l = (RTLINE*)geom;
-			ptarray_scale(ctx, l->points, factor);
-			break;
-		}
-		case RTPOLYGONTYPE:
-		{
-			RTPOLY *p = (RTPOLY*)geom;
-			for( i = 0; i < p->nrings; i++ )
-				ptarray_scale(ctx, p->rings[i], factor);
-			break;
-		}
-		case RTCURVEPOLYTYPE:
-		{
-			RTCURVEPOLY *c = (RTCURVEPOLY*)geom;
-			for( i = 0; i < c->nrings; i++ )
-				rtgeom_scale(ctx, c->rings[i], factor);
-			break;
-		}
-		default:
-		{
-			if( rtgeom_is_collection(ctx, geom) )
-			{
-				RTCOLLECTION *c = (RTCOLLECTION*)geom;
-				for( i = 0; i < c->ngeoms; i++ )
-				{
-					rtgeom_scale(ctx, c->geoms[i], factor);
-				}
-			}
-			else 
-			{
-				rterror(ctx, "rtgeom_scale: unable to handle type '%s'", rttype_name(ctx, type));
-			}
-		}
-	}
-
-	/* Recompute bbox if needed */
-
-	if ( geom->bbox ) 
-	{
-		/* TODO: expose a gbox_scale function */
-		geom->bbox->xmin *= factor->x;
-		geom->bbox->xmax *= factor->x;
-		geom->bbox->ymin *= factor->y;
-		geom->bbox->ymax *= factor->y;
-		geom->bbox->zmin *= factor->z;
-		geom->bbox->zmax *= factor->z;
-		geom->bbox->mmin *= factor->m;
-		geom->bbox->mmax *= factor->m;
-	}
+  int type = geom->type;
+  int i;
+
+  switch(type)
+  {
+    /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
+    case RTPOINTTYPE:
+    case RTLINETYPE:
+    case RTCIRCSTRINGTYPE:
+    case RTTRIANGLETYPE:
+    {
+      RTLINE *l = (RTLINE*)geom;
+      ptarray_scale(ctx, l->points, factor);
+      break;
+    }
+    case RTPOLYGONTYPE:
+    {
+      RTPOLY *p = (RTPOLY*)geom;
+      for( i = 0; i < p->nrings; i++ )
+        ptarray_scale(ctx, p->rings[i], factor);
+      break;
+    }
+    case RTCURVEPOLYTYPE:
+    {
+      RTCURVEPOLY *c = (RTCURVEPOLY*)geom;
+      for( i = 0; i < c->nrings; i++ )
+        rtgeom_scale(ctx, c->rings[i], factor);
+      break;
+    }
+    default:
+    {
+      if( rtgeom_is_collection(ctx, geom) )
+      {
+        RTCOLLECTION *c = (RTCOLLECTION*)geom;
+        for( i = 0; i < c->ngeoms; i++ )
+        {
+          rtgeom_scale(ctx, c->geoms[i], factor);
+        }
+      }
+      else
+      {
+        rterror(ctx, "rtgeom_scale: unable to handle type '%s'", rttype_name(ctx, type));
+      }
+    }
+  }
+
+  /* Recompute bbox if needed */
+
+  if ( geom->bbox )
+  {
+    /* TODO: expose a gbox_scale function */
+    geom->bbox->xmin *= factor->x;
+    geom->bbox->xmax *= factor->x;
+    geom->bbox->ymin *= factor->y;
+    geom->bbox->ymax *= factor->y;
+    geom->bbox->zmin *= factor->z;
+    geom->bbox->zmax *= factor->z;
+    geom->bbox->mmin *= factor->m;
+    geom->bbox->mmax *= factor->m;
+  }
 }
 
 RTGEOM*
 rtgeom_construct_empty(const RTCTX *ctx, uint8_t type, int srid, char hasz, char hasm)
 {
-	switch(type) 
-	{
-		case RTPOINTTYPE:
-			return rtpoint_as_rtgeom(ctx, rtpoint_construct_empty(ctx, srid, hasz, hasm));
-		case RTLINETYPE:
-			return rtline_as_rtgeom(ctx, rtline_construct_empty(ctx, srid, hasz, hasm));
-		case RTPOLYGONTYPE:
-			return rtpoly_as_rtgeom(ctx, rtpoly_construct_empty(ctx, srid, hasz, hasm));
-		case RTCURVEPOLYTYPE:
-			return rtcurvepoly_as_rtgeom(ctx, rtcurvepoly_construct_empty(ctx, srid, hasz, hasm));
-		case RTCIRCSTRINGTYPE:
-			return rtcircstring_as_rtgeom(ctx, rtcircstring_construct_empty(ctx, srid, hasz, hasm));
-		case RTTRIANGLETYPE:
-			return rttriangle_as_rtgeom(ctx, rttriangle_construct_empty(ctx, srid, hasz, hasm));
-		case RTCOMPOUNDTYPE:
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOLLECTIONTYPE:
-			return rtcollection_as_rtgeom(ctx, rtcollection_construct_empty(ctx, type, srid, hasz, hasm));
-		default:
-			rterror(ctx, "rtgeom_construct_empty: unsupported geometry type: %s",
-		        	rttype_name(ctx, type));
-			return NULL;
-	}
+  switch(type)
+  {
+    case RTPOINTTYPE:
+      return rtpoint_as_rtgeom(ctx, rtpoint_construct_empty(ctx, srid, hasz, hasm));
+    case RTLINETYPE:
+      return rtline_as_rtgeom(ctx, rtline_construct_empty(ctx, srid, hasz, hasm));
+    case RTPOLYGONTYPE:
+      return rtpoly_as_rtgeom(ctx, rtpoly_construct_empty(ctx, srid, hasz, hasm));
+    case RTCURVEPOLYTYPE:
+      return rtcurvepoly_as_rtgeom(ctx, rtcurvepoly_construct_empty(ctx, srid, hasz, hasm));
+    case RTCIRCSTRINGTYPE:
+      return rtcircstring_as_rtgeom(ctx, rtcircstring_construct_empty(ctx, srid, hasz, hasm));
+    case RTTRIANGLETYPE:
+      return rttriangle_as_rtgeom(ctx, rttriangle_construct_empty(ctx, srid, hasz, hasm));
+    case RTCOMPOUNDTYPE:
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOLLECTIONTYPE:
+      return rtcollection_as_rtgeom(ctx, rtcollection_construct_empty(ctx, type, srid, hasz, hasm));
+    default:
+      rterror(ctx, "rtgeom_construct_empty: unsupported geometry type: %s",
+              rttype_name(ctx, type));
+      return NULL;
+  }
 }
 
 int
 rtgeom_startpoint(const RTCTX *ctx, const RTGEOM* rtgeom, RTPOINT4D* pt)
 {
-	if ( ! rtgeom )
-		return RT_FAILURE;
-		
-	switch( rtgeom->type ) 
-	{
-		case RTPOINTTYPE:
-			return ptarray_startpoint(ctx, ((RTPOINT*)rtgeom)->point, pt);
-		case RTTRIANGLETYPE:
-		case RTCIRCSTRINGTYPE:
-		case RTLINETYPE:
-			return ptarray_startpoint(ctx, ((RTLINE*)rtgeom)->points, pt);
-		case RTPOLYGONTYPE:
-			return rtpoly_startpoint(ctx, (RTPOLY*)rtgeom, pt);
-		case RTCURVEPOLYTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOLLECTIONTYPE:
-			return rtcollection_startpoint(ctx, (RTCOLLECTION*)rtgeom, pt);
-		default:
-			rterror(ctx, "int: unsupported geometry type: %s",
-		        	rttype_name(ctx, rtgeom->type));
-			return RT_FAILURE;
-	}
+  if ( ! rtgeom )
+    return RT_FAILURE;
+
+  switch( rtgeom->type )
+  {
+    case RTPOINTTYPE:
+      return ptarray_startpoint(ctx, ((RTPOINT*)rtgeom)->point, pt);
+    case RTTRIANGLETYPE:
+    case RTCIRCSTRINGTYPE:
+    case RTLINETYPE:
+      return ptarray_startpoint(ctx, ((RTLINE*)rtgeom)->points, pt);
+    case RTPOLYGONTYPE:
+      return rtpoly_startpoint(ctx, (RTPOLY*)rtgeom, pt);
+    case RTCURVEPOLYTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOLLECTIONTYPE:
+      return rtcollection_startpoint(ctx, (RTCOLLECTION*)rtgeom, pt);
+    default:
+      rterror(ctx, "int: unsupported geometry type: %s",
+              rttype_name(ctx, rtgeom->type));
+      return RT_FAILURE;
+  }
 }
 
 
 RTGEOM *
 rtgeom_grid(const RTCTX *ctx, const RTGEOM *rtgeom, const gridspec *grid)
 {
-	switch ( rtgeom->type )
-	{
-		case RTPOINTTYPE:
-			return (RTGEOM *)rtpoint_grid(ctx, (RTPOINT *)rtgeom, grid);
-		case RTLINETYPE:
-			return (RTGEOM *)rtline_grid(ctx, (RTLINE *)rtgeom, grid);
-		case RTPOLYGONTYPE:
-			return (RTGEOM *)rtpoly_grid(ctx, (RTPOLY *)rtgeom, grid);
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOLLECTIONTYPE:
-		case RTCOMPOUNDTYPE:
-			return (RTGEOM *)rtcollection_grid(ctx, (RTCOLLECTION *)rtgeom, grid);
-		case RTCIRCSTRINGTYPE:
-			return (RTGEOM *)rtcircstring_grid(ctx, (RTCIRCSTRING *)rtgeom, grid);
-		default:
-			rterror(ctx, "rtgeom_grid: Unsupported geometry type: %s",
-			        rttype_name(ctx, rtgeom->type));
-			return NULL;
-	}
+  switch ( rtgeom->type )
+  {
+    case RTPOINTTYPE:
+      return (RTGEOM *)rtpoint_grid(ctx, (RTPOINT *)rtgeom, grid);
+    case RTLINETYPE:
+      return (RTGEOM *)rtline_grid(ctx, (RTLINE *)rtgeom, grid);
+    case RTPOLYGONTYPE:
+      return (RTGEOM *)rtpoly_grid(ctx, (RTPOLY *)rtgeom, grid);
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOLLECTIONTYPE:
+    case RTCOMPOUNDTYPE:
+      return (RTGEOM *)rtcollection_grid(ctx, (RTCOLLECTION *)rtgeom, grid);
+    case RTCIRCSTRINGTYPE:
+      return (RTGEOM *)rtcircstring_grid(ctx, (RTCIRCSTRING *)rtgeom, grid);
+    default:
+      rterror(ctx, "rtgeom_grid: Unsupported geometry type: %s",
+              rttype_name(ctx, rtgeom->type));
+      return NULL;
+  }
 }
 
 
 /* Prototype for recursion */
-static int 
+static int
 rtgeom_subdivide_recursive(const RTCTX *ctx, const RTGEOM *geom, int maxvertices, int depth, RTCOLLECTION *col, const RTGBOX *clip);
 
 static int
 rtgeom_subdivide_recursive(const RTCTX *ctx, const RTGEOM *geom, int maxvertices, int depth, RTCOLLECTION *col, const RTGBOX *clip)
 {
-	const int maxdepth = 50;
-	int nvertices = 0;
-	int i, n = 0;
-	double width = clip->xmax - clip->xmin;
-	double height = clip->ymax - clip->ymin;
-	RTGBOX subbox1, subbox2;
-	RTGEOM *clipped1, *clipped2;
-	
-	if ( geom->type == RTPOLYHEDRALSURFACETYPE || geom->type == RTTINTYPE )
-	{
-		rterror(ctx, "%s: unsupported geometry type '%s'", __func__, rttype_name(ctx, geom->type));
-	}
-	
-	if ( width == 0.0 && height == 0.0 )
-		return 0;
-	
-	/* Artays just recurse into collections */
-	if ( rtgeom_is_collection(ctx, geom) )
-	{
-		RTCOLLECTION *incol = (RTCOLLECTION*)geom;
-		int n = 0;
-		for ( i = 0; i < incol->ngeoms; i++ )
-		{
-			/* Don't increment depth yet, since we aren't actually subdividing geomtries yet */
-			n += rtgeom_subdivide_recursive(ctx, incol->geoms[i], maxvertices, depth, col, clip);
-		}
-		return n;
-	}
-	
-	/* But don't go too far. 2^25 = 33M, that's enough subdivision */
-	/* Signal callers above that we depth'ed out with a negative */
-	/* return value */
-	if ( depth > maxdepth )
-	{
-		return 0;
-	}
-	
-	nvertices = rtgeom_count_vertices(ctx, geom);
-	/* Skip empties entirely */
-	if ( nvertices == 0 )
-	{
-		return 0;
-	}
-	
-	/* If it is under the vertex tolerance, just add it, we're done */
-	if ( nvertices < maxvertices )
-	{
-		rtcollection_add_rtgeom(ctx, col, rtgeom_clone_deep(ctx, geom));
-		return 1;
-	}
-	
-	subbox1 = subbox2 = *clip;
-	if ( width > height )
-	{
-		subbox1.xmax = subbox2.xmin = (clip->xmin + clip->xmax)/2;
-	}
-	else
-	{
-		subbox1.ymax = subbox2.ymin = (clip->ymin + clip->ymax)/2;
-	}
-	
-	if ( height == 0 )
-	{
-		subbox1.ymax += FP_TOLERANCE;
-		subbox2.ymax += FP_TOLERANCE;
-		subbox1.ymin -= FP_TOLERANCE;
-		subbox2.ymin -= FP_TOLERANCE;
-	}
-
-	if ( width == 0 )
-	{
-		subbox1.xmax += FP_TOLERANCE;
-		subbox2.xmax += FP_TOLERANCE;
-		subbox1.xmin -= FP_TOLERANCE;
-		subbox2.xmin -= FP_TOLERANCE;
-	}
-		
-	clipped1 = rtgeom_clip_by_rect(ctx, geom, subbox1.xmin, subbox1.ymin, subbox1.xmax, subbox1.ymax);
-	clipped2 = rtgeom_clip_by_rect(ctx, geom, subbox2.xmin, subbox2.ymin, subbox2.xmax, subbox2.ymax);
-	
-	if ( clipped1 )
-	{
-		n += rtgeom_subdivide_recursive(ctx, clipped1, maxvertices, ++depth, col, &subbox1);
-		rtgeom_free(ctx, clipped1);
-	}
-
-	if ( clipped2 )
-	{
-		n += rtgeom_subdivide_recursive(ctx, clipped2, maxvertices, ++depth, col, &subbox2);
-		rtgeom_free(ctx, clipped2);
-	}
-	
-	return n;
-	
+  const int maxdepth = 50;
+  int nvertices = 0;
+  int i, n = 0;
+  double width = clip->xmax - clip->xmin;
+  double height = clip->ymax - clip->ymin;
+  RTGBOX subbox1, subbox2;
+  RTGEOM *clipped1, *clipped2;
+
+  if ( geom->type == RTPOLYHEDRALSURFACETYPE || geom->type == RTTINTYPE )
+  {
+    rterror(ctx, "%s: unsupported geometry type '%s'", __func__, rttype_name(ctx, geom->type));
+  }
+
+  if ( width == 0.0 && height == 0.0 )
+    return 0;
+
+  /* Artays just recurse into collections */
+  if ( rtgeom_is_collection(ctx, geom) )
+  {
+    RTCOLLECTION *incol = (RTCOLLECTION*)geom;
+    int n = 0;
+    for ( i = 0; i < incol->ngeoms; i++ )
+    {
+      /* Don't increment depth yet, since we aren't actually subdividing geomtries yet */
+      n += rtgeom_subdivide_recursive(ctx, incol->geoms[i], maxvertices, depth, col, clip);
+    }
+    return n;
+  }
+
+  /* But don't go too far. 2^25 = 33M, that's enough subdivision */
+  /* Signal callers above that we depth'ed out with a negative */
+  /* return value */
+  if ( depth > maxdepth )
+  {
+    return 0;
+  }
+
+  nvertices = rtgeom_count_vertices(ctx, geom);
+  /* Skip empties entirely */
+  if ( nvertices == 0 )
+  {
+    return 0;
+  }
+
+  /* If it is under the vertex tolerance, just add it, we're done */
+  if ( nvertices < maxvertices )
+  {
+    rtcollection_add_rtgeom(ctx, col, rtgeom_clone_deep(ctx, geom));
+    return 1;
+  }
+
+  subbox1 = subbox2 = *clip;
+  if ( width > height )
+  {
+    subbox1.xmax = subbox2.xmin = (clip->xmin + clip->xmax)/2;
+  }
+  else
+  {
+    subbox1.ymax = subbox2.ymin = (clip->ymin + clip->ymax)/2;
+  }
+
+  if ( height == 0 )
+  {
+    subbox1.ymax += FP_TOLERANCE;
+    subbox2.ymax += FP_TOLERANCE;
+    subbox1.ymin -= FP_TOLERANCE;
+    subbox2.ymin -= FP_TOLERANCE;
+  }
+
+  if ( width == 0 )
+  {
+    subbox1.xmax += FP_TOLERANCE;
+    subbox2.xmax += FP_TOLERANCE;
+    subbox1.xmin -= FP_TOLERANCE;
+    subbox2.xmin -= FP_TOLERANCE;
+  }
+
+  clipped1 = rtgeom_clip_by_rect(ctx, geom, subbox1.xmin, subbox1.ymin, subbox1.xmax, subbox1.ymax);
+  clipped2 = rtgeom_clip_by_rect(ctx, geom, subbox2.xmin, subbox2.ymin, subbox2.xmax, subbox2.ymax);
+
+  if ( clipped1 )
+  {
+    n += rtgeom_subdivide_recursive(ctx, clipped1, maxvertices, ++depth, col, &subbox1);
+    rtgeom_free(ctx, clipped1);
+  }
+
+  if ( clipped2 )
+  {
+    n += rtgeom_subdivide_recursive(ctx, clipped2, maxvertices, ++depth, col, &subbox2);
+    rtgeom_free(ctx, clipped2);
+  }
+
+  return n;
+
 }
 
 RTCOLLECTION *
 rtgeom_subdivide(const RTCTX *ctx, const RTGEOM *geom, int maxvertices)
 {
-	static int startdepth = 0;
-	static int minmaxvertices = 8;
-	RTCOLLECTION *col;
-	RTGBOX clip;
-	
-	col = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom));
+  static int startdepth = 0;
+  static int minmaxvertices = 8;
+  RTCOLLECTION *col;
+  RTGBOX clip;
+
+  col = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom));
+
+  if ( rtgeom_is_empty(ctx, geom) )
+    return col;
 
-	if ( rtgeom_is_empty(ctx, geom) )
-		return col;
+  if ( maxvertices < minmaxvertices )
+  {
+    rtcollection_free(ctx, col);
+    rterror(ctx, "%s: cannot subdivide to fewer than %d vertices per output", __func__, minmaxvertices);
+  }
 
-	if ( maxvertices < minmaxvertices )
-	{
-		rtcollection_free(ctx, col);
-		rterror(ctx, "%s: cannot subdivide to fewer than %d vertices per output", __func__, minmaxvertices);
-	}
-	
-	clip = *(rtgeom_get_bbox(ctx, geom));
-	rtgeom_subdivide_recursive(ctx, geom, maxvertices, startdepth, col, &clip);
-	rtgeom_set_srid(ctx, (RTGEOM*)col, geom->srid);
-	return col;
+  clip = *(rtgeom_get_bbox(ctx, geom));
+  rtgeom_subdivide_recursive(ctx, geom, maxvertices, startdepth, col, &clip);
+  rtgeom_set_srid(ctx, (RTGEOM*)col, geom->srid);
+  return col;
 }
 
 
 int
 rtgeom_is_trajectory(const RTCTX *ctx, const RTGEOM *geom)
 {
-	int type = geom->type;
+  int type = geom->type;
 
-	if( type != RTLINETYPE ) 
-	{
-		rtnotice(ctx, "Geometry is not a LINESTRING");
-		return RT_FALSE;
-	}
-	return rtline_is_trajectory(ctx, (RTLINE*)geom);
+  if( type != RTLINETYPE )
+  {
+    rtnotice(ctx, "Geometry is not a LINESTRING");
+    return RT_FALSE;
+  }
+  return rtline_is_trajectory(ctx, (RTLINE*)geom);
 }
 
diff --git a/src/rtgeom_api.c b/src/rtgeom_api.c
index 5913d31..c361fcf 100644
--- a/src/rtgeom_api.c
+++ b/src/rtgeom_api.c
@@ -62,24 +62,24 @@ rtgeom_version()
 
 typedef union
 {
-	float value;
-	uint32_t word;
+  float value;
+  uint32_t word;
 } ieee_float_shape_type;
 
-#define GET_FLOAT_WORD(i,d)			\
-	do {					\
-		ieee_float_shape_type gf_u;	\
-		gf_u.value = (d);		\
-		(i) = gf_u.word;		\
-	} while (0)
+#define GET_FLOAT_WORD(i,d)      \
+  do {          \
+    ieee_float_shape_type gf_u;  \
+    gf_u.value = (d);    \
+    (i) = gf_u.word;    \
+  } while (0)
 
 
-#define SET_FLOAT_WORD(d,i)			\
-	do {					\
-		ieee_float_shape_type sf_u;	\
-		sf_u.word = (i);		\
-		(d) = sf_u.value;		\
-	} while (0)
+#define SET_FLOAT_WORD(d,i)      \
+  do {          \
+    ieee_float_shape_type sf_u;  \
+    sf_u.word = (i);    \
+    (d) = sf_u.value;    \
+  } while (0)
 
 
 /*
@@ -89,79 +89,79 @@ typedef union
 static float
 nextafterf_custom(const RTCTX *ctx, float x, float y)
 {
-	int hx,hy,ix,iy;
-
-	GET_FLOAT_WORD(hx,x);
-	GET_FLOAT_WORD(hy,y);
-	ix = hx&0x7fffffff;             /* |x| */
-	iy = hy&0x7fffffff;             /* |y| */
-
-	if ((ix>0x7f800000) ||   /* x is nan */
-	        (iy>0x7f800000))     /* y is nan */
-		return x+y;
-	if (x==y) return y;              /* x=y, return y */
-	if (ix==0)
-	{
-		/* x == 0 */
-		SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
-		y = x*x;
-		if (y==x) return y;
-		else return x;   /* raise underflow flag */
-	}
-	if (hx>=0)
-	{
-		/* x > 0 */
-		if (hx>hy)
-		{
-			/* x > y, x -= ulp */
-			hx -= 1;
-		}
-		else
-		{
-			/* x < y, x += ulp */
-			hx += 1;
-		}
-	}
-	else
-	{
-		/* x < 0 */
-		if (hy>=0||hx>hy)
-		{
-			/* x < y, x -= ulp */
-			hx -= 1;
-		}
-		else
-		{
-			/* x > y, x += ulp */
-			hx += 1;
-		}
-	}
-	hy = hx&0x7f800000;
-	if (hy>=0x7f800000) return x+x;  /* overflow  */
-	if (hy<0x00800000)
-	{
-		/* underflow */
-		y = x*x;
-		if (y!=x)
-		{
-			/* raise underflow flag */
-			SET_FLOAT_WORD(y,hx);
-			return y;
-		}
-	}
-	SET_FLOAT_WORD(x,hx);
-	return x;
+  int hx,hy,ix,iy;
+
+  GET_FLOAT_WORD(hx,x);
+  GET_FLOAT_WORD(hy,y);
+  ix = hx&0x7fffffff;             /* |x| */
+  iy = hy&0x7fffffff;             /* |y| */
+
+  if ((ix>0x7f800000) ||   /* x is nan */
+          (iy>0x7f800000))     /* y is nan */
+    return x+y;
+  if (x==y) return y;              /* x=y, return y */
+  if (ix==0)
+  {
+    /* x == 0 */
+    SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
+    y = x*x;
+    if (y==x) return y;
+    else return x;   /* raise underflow flag */
+  }
+  if (hx>=0)
+  {
+    /* x > 0 */
+    if (hx>hy)
+    {
+      /* x > y, x -= ulp */
+      hx -= 1;
+    }
+    else
+    {
+      /* x < y, x += ulp */
+      hx += 1;
+    }
+  }
+  else
+  {
+    /* x < 0 */
+    if (hy>=0||hx>hy)
+    {
+      /* x < y, x -= ulp */
+      hx -= 1;
+    }
+    else
+    {
+      /* x > y, x += ulp */
+      hx += 1;
+    }
+  }
+  hy = hx&0x7f800000;
+  if (hy>=0x7f800000) return x+x;  /* overflow  */
+  if (hy<0x00800000)
+  {
+    /* underflow */
+    y = x*x;
+    if (y!=x)
+    {
+      /* raise underflow flag */
+      SET_FLOAT_WORD(y,hx);
+      return y;
+    }
+  }
+  SET_FLOAT_WORD(x,hx);
+  return x;
 }
 
 
 float next_float_down(const RTCTX *ctx, double d)
 {
-	float result  = d;
+  float result  = d;
 
-	if ( ((double) result) <=d)
-		return result;
+  if ( ((double) result) <=d)
+    return result;
 
-	return nextafterf_custom(ctx, result, result - 1000000);
+  return nextafterf_custom(ctx, result, result - 1000000);
 
 }
 
@@ -172,12 +172,12 @@ float next_float_down(const RTCTX *ctx, double d)
 float
 next_float_up(const RTCTX *ctx, double d)
 {
-	float result  = d;
+  float result  = d;
 
-	if ( ((double) result) >=d)
-		return result;
+  if ( ((double) result) >=d)
+    return result;
 
-	return nextafterf_custom(ctx, result, result + 1000000);
+  return nextafterf_custom(ctx, result, result + 1000000);
 }
 
 
@@ -188,12 +188,12 @@ next_float_up(const RTCTX *ctx, double d)
 double
 next_double_down(const RTCTX *ctx, float d)
 {
-	double result  = d;
+  double result  = d;
 
-	if ( result < d)
-		return result;
+  if ( result < d)
+    return result;
 
-	return nextafterf_custom(ctx, result, result - 1000000);
+  return nextafterf_custom(ctx, result, result - 1000000);
 }
 
 /*
@@ -203,12 +203,12 @@ next_double_down(const RTCTX *ctx, float d)
 double
 next_double_up(const RTCTX *ctx, float d)
 {
-	double result  = d;
+  double result  = d;
 
-	if ( result > d)
-		return result;
+  if ( result > d)
+    return result;
 
-	return nextafterf_custom(ctx, result, result + 1000000);
+  return nextafterf_custom(ctx, result, result + 1000000);
 }
 
 
@@ -229,9 +229,9 @@ next_double_up(const RTCTX *ctx, float d)
 RTPOINT4D
 rt_getPoint4d(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	RTPOINT4D result;
-	rt_getPoint4d_p(ctx, pa, n, &result);
-	return result;
+  RTPOINT4D result;
+  rt_getPoint4d_p(ctx, pa, n, &result);
+  return result;
 }
 
 /*
@@ -244,53 +244,53 @@ rt_getPoint4d(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 int
 rt_getPoint4d_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT4D *op)
 {
-	uint8_t *ptr;
-	int zmflag;
+  uint8_t *ptr;
+  int zmflag;
 
 #if PARANOIA_LEVEL > 0
-	if ( ! pa ) rterror(ctx, "rt_getPoint4d_p: NULL pointarray");
+  if ( ! pa ) rterror(ctx, "rt_getPoint4d_p: NULL pointarray");
 
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "rt_getPoint4d_p: point offset out of range");
-	}
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "rt_getPoint4d_p: point offset out of range");
+  }
 #endif
 
-	RTDEBUG(4, "rt_getPoint4d_p called.");
+  RTDEBUG(4, "rt_getPoint4d_p called.");
 
-	/* Get a pointer to nth point offset and zmflag */
-	ptr=rt_getPoint_internal(ctx, pa, n);
-	zmflag=RTFLAGS_GET_ZM(pa->flags);
+  /* Get a pointer to nth point offset and zmflag */
+  ptr=rt_getPoint_internal(ctx, pa, n);
+  zmflag=RTFLAGS_GET_ZM(pa->flags);
 
-	RTDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
+  RTDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
 
-	switch (zmflag)
-	{
-	case 0: /* 2d  */
-		memcpy(op, ptr, sizeof(RTPOINT2D));
-		op->m=NO_M_VALUE;
-		op->z=NO_Z_VALUE;
-		break;
-
-	case 3: /* ZM */
-		memcpy(op, ptr, sizeof(RTPOINT4D));
-		break;
-
-	case 2: /* Z */
-		memcpy(op, ptr, sizeof(RTPOINT3DZ));
-		op->m=NO_M_VALUE;
-		break;
-
-	case 1: /* M */
-		memcpy(op, ptr, sizeof(RTPOINT3DM));
-		op->m=op->z; /* we use Z as temporary storage */
-		op->z=NO_Z_VALUE;
-		break;
-
-	default:
-		rterror(ctx, "Unknown ZM flag ??");
-	}
-	return 1;
+  switch (zmflag)
+  {
+  case 0: /* 2d  */
+    memcpy(op, ptr, sizeof(RTPOINT2D));
+    op->m=NO_M_VALUE;
+    op->z=NO_Z_VALUE;
+    break;
+
+  case 3: /* ZM */
+    memcpy(op, ptr, sizeof(RTPOINT4D));
+    break;
+
+  case 2: /* Z */
+    memcpy(op, ptr, sizeof(RTPOINT3DZ));
+    op->m=NO_M_VALUE;
+    break;
+
+  case 1: /* M */
+    memcpy(op, ptr, sizeof(RTPOINT3DM));
+    op->m=op->z; /* we use Z as temporary storage */
+    op->z=NO_Z_VALUE;
+    break;
+
+  default:
+    rterror(ctx, "Unknown ZM flag ??");
+  }
+  return 1;
 
 }
 
@@ -304,9 +304,9 @@ rt_getPoint4d_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT4D *op)
 RTPOINT3DZ
 rt_getPoint3dz(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	RTPOINT3DZ result;
-	rt_getPoint3dz_p(ctx, pa, n, &result);
-	return result;
+  RTPOINT3DZ result;
+  rt_getPoint3dz_p(ctx, pa, n, &result);
+  return result;
 }
 
 /*
@@ -318,9 +318,9 @@ rt_getPoint3dz(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 RTPOINT3DM
 rt_getPoint3dm(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	RTPOINT3DM result;
-	rt_getPoint3dm_p(ctx, pa, n, &result);
-	return result;
+  RTPOINT3DM result;
+  rt_getPoint3dm_p(ctx, pa, n, &result);
+  return result;
 }
 
 /*
@@ -332,44 +332,44 @@ rt_getPoint3dm(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 int
 rt_getPoint3dz_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DZ *op)
 {
-	uint8_t *ptr;
+  uint8_t *ptr;
 
 #if PARANOIA_LEVEL > 0
-	if ( ! pa ) return 0;
+  if ( ! pa ) return 0;
 
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		RTDEBUGF(4, "%d out of numpoint range (%d)", n, pa->npoints);
-		return 0; /*error */
-	}
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    RTDEBUGF(4, "%d out of numpoint range (%d)", n, pa->npoints);
+    return 0; /*error */
+  }
 #endif
 
-	RTDEBUGF(2, "rt_getPoint3dz_p called on array of %d-dimensions / %u pts",
-	         RTFLAGS_NDIMS(pa->flags), pa->npoints);
-
-	/* Get a pointer to nth point offset */
-	ptr=rt_getPoint_internal(ctx, pa, n);
-
-	/*
-	 * if input RTPOINTARRAY has the Z, it is artays
-	 * at third position so make a single copy
-	 */
-	if ( RTFLAGS_GET_Z(pa->flags) )
-	{
-		memcpy(op, ptr, sizeof(RTPOINT3DZ));
-	}
-
-	/*
-	 * Otherwise copy the 2d part and initialize
-	 * Z to NO_Z_VALUE
-	 */
-	else
-	{
-		memcpy(op, ptr, sizeof(RTPOINT2D));
-		op->z=NO_Z_VALUE;
-	}
-
-	return 1;
+  RTDEBUGF(2, "rt_getPoint3dz_p called on array of %d-dimensions / %u pts",
+           RTFLAGS_NDIMS(pa->flags), pa->npoints);
+
+  /* Get a pointer to nth point offset */
+  ptr=rt_getPoint_internal(ctx, pa, n);
+
+  /*
+   * if input RTPOINTARRAY has the Z, it is artays
+   * at third position so make a single copy
+   */
+  if ( RTFLAGS_GET_Z(pa->flags) )
+  {
+    memcpy(op, ptr, sizeof(RTPOINT3DZ));
+  }
+
+  /*
+   * Otherwise copy the 2d part and initialize
+   * Z to NO_Z_VALUE
+   */
+  else
+  {
+    memcpy(op, ptr, sizeof(RTPOINT2D));
+    op->z=NO_Z_VALUE;
+  }
+
+  return 1;
 
 }
 
@@ -382,59 +382,59 @@ rt_getPoint3dz_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DZ *op
 int
 rt_getPoint3dm_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DM *op)
 {
-	uint8_t *ptr;
-	int zmflag;
+  uint8_t *ptr;
+  int zmflag;
 
 #if PARANOIA_LEVEL > 0
-	if ( ! pa ) return 0;
+  if ( ! pa ) return 0;
 
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "%d out of numpoint range (%d)", n, pa->npoints);
-		return 0; /*error */
-	}
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "%d out of numpoint range (%d)", n, pa->npoints);
+    return 0; /*error */
+  }
 #endif
 
-	RTDEBUGF(2, "rt_getPoint3dm_p(ctx, %d) called on array of %d-dimensions / %u pts",
-	         n, RTFLAGS_NDIMS(pa->flags), pa->npoints);
-
-
-	/* Get a pointer to nth point offset and zmflag */
-	ptr=rt_getPoint_internal(ctx, pa, n);
-	zmflag=RTFLAGS_GET_ZM(pa->flags);
-
-	/*
-	 * if input RTPOINTARRAY has the M and NO Z,
-	 * we can issue a single memcpy
-	 */
-	if ( zmflag == 1 )
-	{
-		memcpy(op, ptr, sizeof(RTPOINT3DM));
-		return 1;
-	}
-
-	/*
-	 * Otherwise copy the 2d part and
-	 * initialize M to NO_M_VALUE
-	 */
-	memcpy(op, ptr, sizeof(RTPOINT2D));
-
-	/*
-	 * Then, if input has Z skip it and
-	 * copy next double, otherwise initialize
-	 * M to NO_M_VALUE
-	 */
-	if ( zmflag == 3 )
-	{
-		ptr+=sizeof(RTPOINT3DZ);
-		memcpy(&(op->m), ptr, sizeof(double));
-	}
-	else
-	{
-		op->m=NO_M_VALUE;
-	}
-
-	return 1;
+  RTDEBUGF(2, "rt_getPoint3dm_p(ctx, %d) called on array of %d-dimensions / %u pts",
+           n, RTFLAGS_NDIMS(pa->flags), pa->npoints);
+
+
+  /* Get a pointer to nth point offset and zmflag */
+  ptr=rt_getPoint_internal(ctx, pa, n);
+  zmflag=RTFLAGS_GET_ZM(pa->flags);
+
+  /*
+   * if input RTPOINTARRAY has the M and NO Z,
+   * we can issue a single memcpy
+   */
+  if ( zmflag == 1 )
+  {
+    memcpy(op, ptr, sizeof(RTPOINT3DM));
+    return 1;
+  }
+
+  /*
+   * Otherwise copy the 2d part and
+   * initialize M to NO_M_VALUE
+   */
+  memcpy(op, ptr, sizeof(RTPOINT2D));
+
+  /*
+   * Then, if input has Z skip it and
+   * copy next double, otherwise initialize
+   * M to NO_M_VALUE
+   */
+  if ( zmflag == 3 )
+  {
+    ptr+=sizeof(RTPOINT3DZ);
+    memcpy(&(op->m), ptr, sizeof(double));
+  }
+  else
+  {
+    op->m=NO_M_VALUE;
+  }
+
+  return 1;
 }
 
 
@@ -447,9 +447,9 @@ rt_getPoint3dm_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT3DM *op
 RTPOINT2D
 rt_getPoint2d(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	const RTPOINT2D *result;
-	result = rt_getPoint2d_cp(ctx, pa, n);
-	return *result;
+  const RTPOINT2D *result;
+  result = rt_getPoint2d_cp(ctx, pa, n);
+  return *result;
 }
 
 /*
@@ -462,79 +462,79 @@ int
 rt_getPoint2d_p(const RTCTX *ctx, const RTPOINTARRAY *pa, int n, RTPOINT2D *point)
 {
 #if PARANOIA_LEVEL > 0
-	if ( ! pa ) return 0;
+  if ( ! pa ) return 0;
 
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "rt_getPoint2d_p: point offset out of range");
-		return 0; /*error */
-	}
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "rt_getPoint2d_p: point offset out of range");
+    return 0; /*error */
+  }
 #endif
 
-	/* this does x,y */
-	memcpy(point, rt_getPoint_internal(ctx, pa, n), sizeof(RTPOINT2D));
-	return 1;
+  /* this does x,y */
+  memcpy(point, rt_getPoint_internal(ctx, pa, n), sizeof(RTPOINT2D));
+  return 1;
 }
 
 /**
-* Returns a pointer into the RTPOINTARRAY serialized_ptlist, 
+* Returns a pointer into the RTPOINTARRAY serialized_ptlist,
 * suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the 
+* and declared const because you aren't allowed to muck with the
 * values, only read them.
 */
 const RTPOINT2D*
 rt_getPoint2d_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	if ( ! pa ) return 0;
+  if ( ! pa ) return 0;
 
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "rt_getPoint2D_const_p: point offset out of range");
-		return 0; /*error */
-	}
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "rt_getPoint2D_const_p: point offset out of range");
+    return 0; /*error */
+  }
 
-	return (const RTPOINT2D*)rt_getPoint_internal(ctx, pa, n);
+  return (const RTPOINT2D*)rt_getPoint_internal(ctx, pa, n);
 }
 
 const RTPOINT3DZ*
 rt_getPoint3dz_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	if ( ! pa ) return 0;
-	
-	if ( ! RTFLAGS_GET_Z(pa->flags) )
-	{
-		rterror(ctx, "rt_getPoint3dz_cp: no Z coordinates in point array");
-		return 0; /*error */
-	}
-
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "rt_getPoint3dz_cp: point offset out of range");
-		return 0; /*error */
-	}
-
-	return (const RTPOINT3DZ*)rt_getPoint_internal(ctx, pa, n);
+  if ( ! pa ) return 0;
+
+  if ( ! RTFLAGS_GET_Z(pa->flags) )
+  {
+    rterror(ctx, "rt_getPoint3dz_cp: no Z coordinates in point array");
+    return 0; /*error */
+  }
+
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "rt_getPoint3dz_cp: point offset out of range");
+    return 0; /*error */
+  }
+
+  return (const RTPOINT3DZ*)rt_getPoint_internal(ctx, pa, n);
 }
 
 
 const RTPOINT4D*
 rt_getPoint4d_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 {
-	if ( ! pa ) return 0;
-	
-	if ( ! (RTFLAGS_GET_Z(pa->flags) && RTFLAGS_GET_Z(pa->flags)) )
-	{
-		rterror(ctx, "rt_getPoint3dz_cp: no Z and M coordinates in point array");
-		return 0; /*error */
-	}
-
-	if ( (n<0) || (n>=pa->npoints))
-	{
-		rterror(ctx, "rt_getPoint3dz_cp: point offset out of range");
-		return 0; /*error */
-	}
-
-	return (const RTPOINT4D*)rt_getPoint_internal(ctx, pa, n);
+  if ( ! pa ) return 0;
+
+  if ( ! (RTFLAGS_GET_Z(pa->flags) && RTFLAGS_GET_Z(pa->flags)) )
+  {
+    rterror(ctx, "rt_getPoint3dz_cp: no Z and M coordinates in point array");
+    return 0; /*error */
+  }
+
+  if ( (n<0) || (n>=pa->npoints))
+  {
+    rterror(ctx, "rt_getPoint3dz_cp: point offset out of range");
+    return 0; /*error */
+  }
+
+  return (const RTPOINT4D*)rt_getPoint_internal(ctx, pa, n);
 }
 
 
@@ -549,26 +549,26 @@ rt_getPoint4d_cp(const RTCTX *ctx, const RTPOINTARRAY *pa, int n)
 void
 ptarray_set_point4d(const RTCTX *ctx, RTPOINTARRAY *pa, int n, const RTPOINT4D *p4d)
 {
-	uint8_t *ptr;
-	assert(n >= 0 && n < pa->npoints);
-	ptr=rt_getPoint_internal(ctx, pa, n);
-	switch ( RTFLAGS_GET_ZM(pa->flags) )
-	{
-	case 3:
-		memcpy(ptr, p4d, sizeof(RTPOINT4D));
-		break;
-	case 2:
-		memcpy(ptr, p4d, sizeof(RTPOINT3DZ));
-		break;
-	case 1:
-		memcpy(ptr, p4d, sizeof(RTPOINT2D));
-		ptr+=sizeof(RTPOINT2D);
-		memcpy(ptr, &(p4d->m), sizeof(double));
-		break;
-	case 0:
-		memcpy(ptr, p4d, sizeof(RTPOINT2D));
-		break;
-	}
+  uint8_t *ptr;
+  assert(n >= 0 && n < pa->npoints);
+  ptr=rt_getPoint_internal(ctx, pa, n);
+  switch ( RTFLAGS_GET_ZM(pa->flags) )
+  {
+  case 3:
+    memcpy(ptr, p4d, sizeof(RTPOINT4D));
+    break;
+  case 2:
+    memcpy(ptr, p4d, sizeof(RTPOINT3DZ));
+    break;
+  case 1:
+    memcpy(ptr, p4d, sizeof(RTPOINT2D));
+    ptr+=sizeof(RTPOINT2D);
+    memcpy(ptr, &(p4d->m), sizeof(double));
+    break;
+  case 0:
+    memcpy(ptr, p4d, sizeof(RTPOINT2D));
+    break;
+  }
 }
 
 
@@ -582,20 +582,20 @@ ptarray_set_point4d(const RTCTX *ctx, RTPOINTARRAY *pa, int n, const RTPOINT4D *
 uint32_t
 rt_get_uint32_t(const RTCTX *ctx, const uint8_t *loc)
 {
-	uint32_t result;
+  uint32_t result;
 
-	memcpy(&result, loc, sizeof(uint32_t));
-	return result;
+  memcpy(&result, loc, sizeof(uint32_t));
+  return result;
 }
 
 /* handle missaligned signed int32_t data */
 int32_t
 rt_get_int32_t(const RTCTX *ctx, const uint8_t *loc)
 {
-	int32_t result;
+  int32_t result;
 
-	memcpy(&result,loc, sizeof(int32_t));
-	return result;
+  memcpy(&result,loc, sizeof(int32_t));
+  return result;
 }
 
 
@@ -605,43 +605,43 @@ rt_get_int32_t(const RTCTX *ctx, const uint8_t *loc)
 
 void printBOX3D(const RTCTX *ctx, BOX3D *box)
 {
-	rtnotice(ctx, "BOX3D: %g %g, %g %g", box->xmin, box->ymin,
-	         box->xmax, box->ymax);
+  rtnotice(ctx, "BOX3D: %g %g, %g %g", box->xmin, box->ymin,
+           box->xmax, box->ymax);
 }
 
 void printPA(const RTCTX *ctx, RTPOINTARRAY *pa)
 {
-	int t;
-	RTPOINT4D pt;
-	char *mflag;
-
-
-	if ( RTFLAGS_GET_M(pa->flags) ) mflag = "M";
-	else mflag = "";
-
-	rtnotice(ctx, "      RTPOINTARRAY%s{", mflag);
-	rtnotice(ctx, "                 ndims=%i,   ptsize=%i",
-	         RTFLAGS_NDIMS(pa->flags), ptarray_point_size(ctx, pa));
-	rtnotice(ctx, "                 npoints = %i", pa->npoints);
-
-	for (t =0; t<pa->npoints; t++)
-	{
-		rt_getPoint4d_p(ctx, pa, t, &pt);
-		if (RTFLAGS_NDIMS(pa->flags) == 2)
-		{
-			rtnotice(ctx, "                    %i : %lf,%lf",t,pt.x,pt.y);
-		}
-		if (RTFLAGS_NDIMS(pa->flags) == 3)
-		{
-			rtnotice(ctx, "                    %i : %lf,%lf,%lf",t,pt.x,pt.y,pt.z);
-		}
-		if (RTFLAGS_NDIMS(pa->flags) == 4)
-		{
-			rtnotice(ctx, "                    %i : %lf,%lf,%lf,%lf",t,pt.x,pt.y,pt.z,pt.m);
-		}
-	}
-
-	rtnotice(ctx, "      }");
+  int t;
+  RTPOINT4D pt;
+  char *mflag;
+
+
+  if ( RTFLAGS_GET_M(pa->flags) ) mflag = "M";
+  else mflag = "";
+
+  rtnotice(ctx, "      RTPOINTARRAY%s{", mflag);
+  rtnotice(ctx, "                 ndims=%i,   ptsize=%i",
+           RTFLAGS_NDIMS(pa->flags), ptarray_point_size(ctx, pa));
+  rtnotice(ctx, "                 npoints = %i", pa->npoints);
+
+  for (t =0; t<pa->npoints; t++)
+  {
+    rt_getPoint4d_p(ctx, pa, t, &pt);
+    if (RTFLAGS_NDIMS(pa->flags) == 2)
+    {
+      rtnotice(ctx, "                    %i : %lf,%lf",t,pt.x,pt.y);
+    }
+    if (RTFLAGS_NDIMS(pa->flags) == 3)
+    {
+      rtnotice(ctx, "                    %i : %lf,%lf,%lf",t,pt.x,pt.y,pt.z);
+    }
+    if (RTFLAGS_NDIMS(pa->flags) == 4)
+    {
+      rtnotice(ctx, "                    %i : %lf,%lf,%lf,%lf",t,pt.x,pt.y,pt.z,pt.m);
+    }
+  }
+
+  rtnotice(ctx, "      }");
 }
 
 
@@ -652,126 +652,126 @@ void printPA(const RTCTX *ctx, RTPOINTARRAY *pa)
 uint8_t
 parse_hex(const RTCTX *ctx, char *str)
 {
-	/* do this a little brute force to make it faster */
-
-	uint8_t		result_high = 0;
-	uint8_t		result_low = 0;
-
-	switch (str[0])
-	{
-	case '0' :
-		result_high = 0;
-		break;
-	case '1' :
-		result_high = 1;
-		break;
-	case '2' :
-		result_high = 2;
-		break;
-	case '3' :
-		result_high = 3;
-		break;
-	case '4' :
-		result_high = 4;
-		break;
-	case '5' :
-		result_high = 5;
-		break;
-	case '6' :
-		result_high = 6;
-		break;
-	case '7' :
-		result_high = 7;
-		break;
-	case '8' :
-		result_high = 8;
-		break;
-	case '9' :
-		result_high = 9;
-		break;
-	case 'A' :
-	case 'a' :
-		result_high = 10;
-		break;
-	case 'B' :
-	case 'b' :
-		result_high = 11;
-		break;
-	case 'C' :
-	case 'c' :
-		result_high = 12;
-		break;
-	case 'D' :
-	case 'd' :
-		result_high = 13;
-		break;
-	case 'E' :
-	case 'e' :
-		result_high = 14;
-		break;
-	case 'F' :
-	case 'f' :
-		result_high = 15;
-		break;
-	}
-	switch (str[1])
-	{
-	case '0' :
-		result_low = 0;
-		break;
-	case '1' :
-		result_low = 1;
-		break;
-	case '2' :
-		result_low = 2;
-		break;
-	case '3' :
-		result_low = 3;
-		break;
-	case '4' :
-		result_low = 4;
-		break;
-	case '5' :
-		result_low = 5;
-		break;
-	case '6' :
-		result_low = 6;
-		break;
-	case '7' :
-		result_low = 7;
-		break;
-	case '8' :
-		result_low = 8;
-		break;
-	case '9' :
-		result_low = 9;
-		break;
-	case 'A' :
-	case 'a' :
-		result_low = 10;
-		break;
-	case 'B' :
-	case 'b' :
-		result_low = 11;
-		break;
-	case 'C' :
-	case 'c' :
-		result_low = 12;
-		break;
-	case 'D' :
-	case 'd' :
-		result_low = 13;
-		break;
-	case 'E' :
-	case 'e' :
-		result_low = 14;
-		break;
-	case 'F' :
-	case 'f' :
-		result_low = 15;
-		break;
-	}
-	return (uint8_t) ((result_high<<4) + result_low);
+  /* do this a little brute force to make it faster */
+
+  uint8_t    result_high = 0;
+  uint8_t    result_low = 0;
+
+  switch (str[0])
+  {
+  case '0' :
+    result_high = 0;
+    break;
+  case '1' :
+    result_high = 1;
+    break;
+  case '2' :
+    result_high = 2;
+    break;
+  case '3' :
+    result_high = 3;
+    break;
+  case '4' :
+    result_high = 4;
+    break;
+  case '5' :
+    result_high = 5;
+    break;
+  case '6' :
+    result_high = 6;
+    break;
+  case '7' :
+    result_high = 7;
+    break;
+  case '8' :
+    result_high = 8;
+    break;
+  case '9' :
+    result_high = 9;
+    break;
+  case 'A' :
+  case 'a' :
+    result_high = 10;
+    break;
+  case 'B' :
+  case 'b' :
+    result_high = 11;
+    break;
+  case 'C' :
+  case 'c' :
+    result_high = 12;
+    break;
+  case 'D' :
+  case 'd' :
+    result_high = 13;
+    break;
+  case 'E' :
+  case 'e' :
+    result_high = 14;
+    break;
+  case 'F' :
+  case 'f' :
+    result_high = 15;
+    break;
+  }
+  switch (str[1])
+  {
+  case '0' :
+    result_low = 0;
+    break;
+  case '1' :
+    result_low = 1;
+    break;
+  case '2' :
+    result_low = 2;
+    break;
+  case '3' :
+    result_low = 3;
+    break;
+  case '4' :
+    result_low = 4;
+    break;
+  case '5' :
+    result_low = 5;
+    break;
+  case '6' :
+    result_low = 6;
+    break;
+  case '7' :
+    result_low = 7;
+    break;
+  case '8' :
+    result_low = 8;
+    break;
+  case '9' :
+    result_low = 9;
+    break;
+  case 'A' :
+  case 'a' :
+    result_low = 10;
+    break;
+  case 'B' :
+  case 'b' :
+    result_low = 11;
+    break;
+  case 'C' :
+  case 'c' :
+    result_low = 12;
+    break;
+  case 'D' :
+  case 'd' :
+    result_low = 13;
+    break;
+  case 'E' :
+  case 'e' :
+    result_low = 14;
+    break;
+  case 'F' :
+  case 'f' :
+    result_low = 15;
+    break;
+  }
+  return (uint8_t) ((result_high<<4) + result_low);
 }
 
 
@@ -780,25 +780,25 @@ parse_hex(const RTCTX *ctx, char *str)
  * the hex number.
  *
  * Ie. deparse_hex(ctx,  255, mystr)
- *		-> mystr[0] = 'F' and mystr[1] = 'F'
+ *    -> mystr[0] = 'F' and mystr[1] = 'F'
  *
  * No error checking done
  */
 void
 deparse_hex(const RTCTX *ctx, uint8_t str, char *result)
 {
-	int	input_high;
-	int  input_low;
-	static char outchr[]=
-	{
-		"0123456789ABCDEF"
-	};
+  int  input_high;
+  int  input_low;
+  static char outchr[]=
+  {
+    "0123456789ABCDEF"
+  };
 
-	input_high = (str>>4);
-	input_low = (str & 0x0F);
+  input_high = (str>>4);
+  input_low = (str & 0x0F);
 
-	result[0] = outchr[input_high];
-	result[1] = outchr[input_low];
+  result[0] = outchr[input_high];
+  result[1] = outchr[input_low];
 
 }
 
@@ -820,16 +820,16 @@ void
 interpolate_point4d(const RTCTX *ctx, RTPOINT4D *A, RTPOINT4D *B, RTPOINT4D *I, double F)
 {
 #if PARANOIA_LEVEL > 0
-	double absF=fabs(F);
-	if ( absF < 0 || absF > 1 )
-	{
-		rterror(ctx, "interpolate_point4d: invalid F (%g)", F);
-	}
+  double absF=fabs(F);
+  if ( absF < 0 || absF > 1 )
+  {
+    rterror(ctx, "interpolate_point4d: invalid F (%g)", F);
+  }
 #endif
-	I->x=A->x+((B->x-A->x)*F);
-	I->y=A->y+((B->y-A->y)*F);
-	I->z=A->z+((B->z-A->z)*F);
-	I->m=A->m+((B->m-A->m)*F);
+  I->x=A->x+((B->x-A->x)*F);
+  I->y=A->y+((B->y-A->y)*F);
+  I->z=A->z+((B->z-A->z)*F);
+  I->m=A->m+((B->m-A->m)*F);
 }
 
 
diff --git a/src/rtgeom_debug.c b/src/rtgeom_debug.c
index 77650aa..225d2f2 100644
--- a/src/rtgeom_debug.c
+++ b/src/rtgeom_debug.c
@@ -36,17 +36,17 @@ static char tflags[6];
 static char *
 rtgeom_flagchars(const RTCTX *ctx, RTGEOM *rtg)
 {
-	int flagno = 0;
-	if ( RTFLAGS_GET_Z(rtg->flags) ) tflags[flagno++] = 'Z';
-	if ( RTFLAGS_GET_M(rtg->flags) ) tflags[flagno++] = 'M';
-	if ( RTFLAGS_GET_BBOX(rtg->flags) ) tflags[flagno++] = 'B';
-	if ( RTFLAGS_GET_GEODETIC(rtg->flags) ) tflags[flagno++] = 'G';
-	if ( rtg->srid != SRID_UNKNOWN ) tflags[flagno++] = 'S';
-	tflags[flagno] = '\0';
+  int flagno = 0;
+  if ( RTFLAGS_GET_Z(rtg->flags) ) tflags[flagno++] = 'Z';
+  if ( RTFLAGS_GET_M(rtg->flags) ) tflags[flagno++] = 'M';
+  if ( RTFLAGS_GET_BBOX(rtg->flags) ) tflags[flagno++] = 'B';
+  if ( RTFLAGS_GET_GEODETIC(rtg->flags) ) tflags[flagno++] = 'G';
+  if ( rtg->srid != SRID_UNKNOWN ) tflags[flagno++] = 'S';
+  tflags[flagno] = '\0';
 
-	RTDEBUGF(4, "Flags: %s - returning %p", rtg->flags, tflags);
+  RTDEBUGF(4, "Flags: %s - returning %p", rtg->flags, tflags);
 
-	return tflags;
+  return tflags;
 }
 
 /*
@@ -55,140 +55,140 @@ rtgeom_flagchars(const RTCTX *ctx, RTGEOM *rtg)
 static char *
 rtpoint_summary(const RTCTX *ctx, RTPOINT *point, int offset)
 {
-	char *result;
-	char *pad="";
-	char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)point);
+  char *result;
+  char *pad="";
+  char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)point);
 
-	result = (char *)rtalloc(ctx, 128+offset);
+  result = (char *)rtalloc(ctx, 128+offset);
 
-	sprintf(result, "%*.s%s[%s]",
-	        offset, pad, rttype_name(ctx, point->type),
-	        zmflags);
-	return result;
+  sprintf(result, "%*.s%s[%s]",
+          offset, pad, rttype_name(ctx, point->type),
+          zmflags);
+  return result;
 }
 
 static char *
 rtline_summary(const RTCTX *ctx, RTLINE *line, int offset)
 {
-	char *result;
-	char *pad="";
-	char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)line);
+  char *result;
+  char *pad="";
+  char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)line);
 
-	result = (char *)rtalloc(ctx, 128+offset);
+  result = (char *)rtalloc(ctx, 128+offset);
 
-	sprintf(result, "%*.s%s[%s] with %d points",
-	        offset, pad, rttype_name(ctx, line->type),
-	        zmflags,
-	        line->points->npoints);
-	return result;
+  sprintf(result, "%*.s%s[%s] with %d points",
+          offset, pad, rttype_name(ctx, line->type),
+          zmflags,
+          line->points->npoints);
+  return result;
 }
 
 
 static char *
 rtcollection_summary(const RTCTX *ctx, RTCOLLECTION *col, int offset)
 {
-	size_t size = 128;
-	char *result;
-	char *tmp;
-	int i;
-	static char *nl = "\n";
-	char *pad="";
-	char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)col);
+  size_t size = 128;
+  char *result;
+  char *tmp;
+  int i;
+  static char *nl = "\n";
+  char *pad="";
+  char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)col);
 
-	RTDEBUG(2, "rtcollection_summary called");
+  RTDEBUG(2, "rtcollection_summary called");
 
-	result = (char *)rtalloc(ctx, size);
+  result = (char *)rtalloc(ctx, size);
 
-	sprintf(result, "%*.s%s[%s] with %d elements\n",
-	        offset, pad, rttype_name(ctx, col->type),
-	        zmflags,
-	        col->ngeoms);
+  sprintf(result, "%*.s%s[%s] with %d elements\n",
+          offset, pad, rttype_name(ctx, col->type),
+          zmflags,
+          col->ngeoms);
 
-	for (i=0; i<col->ngeoms; i++)
-	{
-		tmp = rtgeom_summary(ctx, col->geoms[i], offset+2);
-		size += strlen(tmp)+1;
-		result = rtrealloc(ctx, result, size);
+  for (i=0; i<col->ngeoms; i++)
+  {
+    tmp = rtgeom_summary(ctx, col->geoms[i], offset+2);
+    size += strlen(tmp)+1;
+    result = rtrealloc(ctx, result, size);
 
-		RTDEBUGF(4, "Reallocated %d bytes for result", size);
-		if ( i > 0 ) strcat(result,nl);
+    RTDEBUGF(4, "Reallocated %d bytes for result", size);
+    if ( i > 0 ) strcat(result,nl);
 
-		strcat(result, tmp);
-		rtfree(ctx, tmp);
-	}
+    strcat(result, tmp);
+    rtfree(ctx, tmp);
+  }
 
-	RTDEBUG(3, "rtcollection_summary returning");
+  RTDEBUG(3, "rtcollection_summary returning");
 
-	return result;
+  return result;
 }
 
 static char *
 rtpoly_summary(const RTCTX *ctx, RTPOLY *poly, int offset)
 {
-	char tmp[256];
-	size_t size = 64*(poly->nrings+1)+128;
-	char *result;
-	int i;
-	char *pad="";
-	static char *nl = "\n";
-	char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)poly);
-
-	RTDEBUG(2, "rtpoly_summary called");
-
-	result = (char *)rtalloc(ctx, size);
-
-	sprintf(result, "%*.s%s[%s] with %i rings\n",
-	        offset, pad, rttype_name(ctx, poly->type),
-	        zmflags,
-	        poly->nrings);
-
-	for (i=0; i<poly->nrings; i++)
-	{
-		sprintf(tmp,"%s   ring %i has %i points",
-		        pad, i, poly->rings[i]->npoints);
-		if ( i > 0 ) strcat(result,nl);
-		strcat(result,tmp);
-	}
-
-	RTDEBUG(3, "rtpoly_summary returning");
-
-	return result;
+  char tmp[256];
+  size_t size = 64*(poly->nrings+1)+128;
+  char *result;
+  int i;
+  char *pad="";
+  static char *nl = "\n";
+  char *zmflags = rtgeom_flagchars(ctx, (RTGEOM*)poly);
+
+  RTDEBUG(2, "rtpoly_summary called");
+
+  result = (char *)rtalloc(ctx, size);
+
+  sprintf(result, "%*.s%s[%s] with %i rings\n",
+          offset, pad, rttype_name(ctx, poly->type),
+          zmflags,
+          poly->nrings);
+
+  for (i=0; i<poly->nrings; i++)
+  {
+    sprintf(tmp,"%s   ring %i has %i points",
+            pad, i, poly->rings[i]->npoints);
+    if ( i > 0 ) strcat(result,nl);
+    strcat(result,tmp);
+  }
+
+  RTDEBUG(3, "rtpoly_summary returning");
+
+  return result;
 }
 
 char *
 rtgeom_summary(const RTCTX *ctx, const RTGEOM *rtgeom, int offset)
 {
-	char *result;
-
-	switch (rtgeom->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_summary(ctx, (RTPOINT *)rtgeom, offset);
-
-	case RTCIRCSTRINGTYPE:
-	case RTTRIANGLETYPE:
-	case RTLINETYPE:
-		return rtline_summary(ctx, (RTLINE *)rtgeom, offset);
-
-	case RTPOLYGONTYPE:
-		return rtpoly_summary(ctx, (RTPOLY *)rtgeom, offset);
-
-	case RTTINTYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTICURVETYPE:
-	case RTCURVEPOLYTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_summary(ctx, (RTCOLLECTION *)rtgeom, offset);
-	default:
-		result = (char *)rtalloc(ctx, 256);
-		sprintf(result, "Object is of unknown type: %d",
-		        rtgeom->type);
-		return result;
-	}
-
-	return NULL;
+  char *result;
+
+  switch (rtgeom->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_summary(ctx, (RTPOINT *)rtgeom, offset);
+
+  case RTCIRCSTRINGTYPE:
+  case RTTRIANGLETYPE:
+  case RTLINETYPE:
+    return rtline_summary(ctx, (RTLINE *)rtgeom, offset);
+
+  case RTPOLYGONTYPE:
+    return rtpoly_summary(ctx, (RTPOLY *)rtgeom, offset);
+
+  case RTTINTYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTICURVETYPE:
+  case RTCURVEPOLYTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_summary(ctx, (RTCOLLECTION *)rtgeom, offset);
+  default:
+    result = (char *)rtalloc(ctx, 256);
+    sprintf(result, "Object is of unknown type: %d",
+            rtgeom->type);
+    return result;
+  }
+
+  return NULL;
 }
diff --git a/src/rtgeom_geos.c b/src/rtgeom_geos.c
index 82666d5..d59e525 100644
--- a/src/rtgeom_geos.c
+++ b/src/rtgeom_geos.c
@@ -44,7 +44,7 @@ rtgeom_get_last_geos_error(const RTCTX *ctx)
 static void
 rtgeom_geos_notice(const char *msg, void *ctx)
 {
-	rtnotice(ctx, "%s\n", msg);
+  rtnotice(ctx, "%s\n", msg);
 }
 
 extern void
@@ -54,16 +54,17 @@ rtgeom_geos_error(const char *msg, void *ptr)
 
   /* TODO:  write in the context, not in the global ! */
 
-	/* Call the supplied function */
-	if ( RTGEOM_GEOS_ERRMSG_MAXSIZE-1 < snprintf(ctx->rtgeom_geos_errmsg, RTGEOM_GEOS_ERRMSG_MAXSIZE-1, "%s", msg) )
-	{
-		ctx->rtgeom_geos_errmsg[RTGEOM_GEOS_ERRMSG_MAXSIZE-1] = '\0';
-	}
+  /* Call the supplied function */
+  if ( RTGEOM_GEOS_ERRMSG_MAXSIZE-1 < snprintf(ctx->rtgeom_geos_errmsg, RTGEOM_GEOS_ERRMSG_MAXSIZE-1, "%s", msg) )
+  {
+    ctx->rtgeom_geos_errmsg[RTGEOM_GEOS_ERRMSG_MAXSIZE-1] = '\0';
+  }
 }
 
 void
 rtgeom_geos_ensure_init(const RTCTX *ctx)
 {
+  if ( ctx->gctx != NULL ) return;
   GEOSContextHandle_t h = GEOS_init_r();
   ((RTCTX*)ctx)->gctx = h;
   GEOSContext_setNoticeMessageHandler_r(h, rtgeom_geos_notice, (void*)ctx);
@@ -83,963 +84,963 @@ rtgeom_geos_ensure_init(const RTCTX *ctx)
 RTPOINTARRAY *
 ptarray_from_GEOSCoordSeq(const RTCTX *ctx, const GEOSCoordSequence *cs, char want3d)
 {
-	uint32_t dims=2;
-	uint32_t size, i;
-	RTPOINTARRAY *pa;
-	RTPOINT4D point;
+  uint32_t dims=2;
+  uint32_t size, i;
+  RTPOINTARRAY *pa;
+  RTPOINT4D point;
 
-	RTDEBUG(2, "ptarray_fromGEOSCoordSeq called");
+  RTDEBUG(2, "ptarray_fromGEOSCoordSeq called");
 
-	if ( ! GEOSCoordSeq_getSize_r(ctx->gctx, cs, &size) )
-		rterror(ctx, "Exception thrown");
+  if ( ! GEOSCoordSeq_getSize_r(ctx->gctx, cs, &size) )
+    rterror(ctx, "Exception thrown");
 
-	RTDEBUGF(4, " GEOSCoordSeq size: %d", size);
+  RTDEBUGF(4, " GEOSCoordSeq size: %d", size);
 
-	if ( want3d )
-	{
-		if ( ! GEOSCoordSeq_getDimensions_r(ctx->gctx, cs, &dims) )
-			rterror(ctx, "Exception thrown");
+  if ( want3d )
+  {
+    if ( ! GEOSCoordSeq_getDimensions_r(ctx->gctx, cs, &dims) )
+      rterror(ctx, "Exception thrown");
 
-		RTDEBUGF(4, " GEOSCoordSeq dimensions: %d", dims);
+    RTDEBUGF(4, " GEOSCoordSeq dimensions: %d", dims);
 
-		/* forget higher dimensions (if any) */
-		if ( dims > 3 ) dims = 3;
-	}
+    /* forget higher dimensions (if any) */
+    if ( dims > 3 ) dims = 3;
+  }
 
-	RTDEBUGF(4, " output dimensions: %d", dims);
+  RTDEBUGF(4, " output dimensions: %d", dims);
 
-	pa = ptarray_construct(ctx, (dims==3), 0, size);
+  pa = ptarray_construct(ctx, (dims==3), 0, size);
 
-	for (i=0; i<size; i++)
-	{
-		GEOSCoordSeq_getX_r(ctx->gctx, cs, i, &(point.x));
-		GEOSCoordSeq_getY_r(ctx->gctx, cs, i, &(point.y));
-		if ( dims >= 3 ) GEOSCoordSeq_getZ_r(ctx->gctx, cs, i, &(point.z));
-		ptarray_set_point4d(ctx, pa,i,&point);
-	}
+  for (i=0; i<size; i++)
+  {
+    GEOSCoordSeq_getX_r(ctx->gctx, cs, i, &(point.x));
+    GEOSCoordSeq_getY_r(ctx->gctx, cs, i, &(point.y));
+    if ( dims >= 3 ) GEOSCoordSeq_getZ_r(ctx->gctx, cs, i, &(point.z));
+    ptarray_set_point4d(ctx, pa,i,&point);
+  }
 
-	return pa;
+  return pa;
 }
 
 /* Return an RTGEOM from a Geometry */
 RTGEOM *
 GEOS2RTGEOM(const RTCTX *ctx, const GEOSGeometry *geom, char want3d)
 {
-	int type = GEOSGeomTypeId_r(ctx->gctx, geom) ;
-	int hasZ;
-	int SRID = GEOSGetSRID_r(ctx->gctx, geom);
+  int type = GEOSGeomTypeId_r(ctx->gctx, geom) ;
+  int hasZ;
+  int SRID = GEOSGetSRID_r(ctx->gctx, geom);
 
-	/* GEOS's 0 is equivalent to our unknown as for SRID values */
-	if ( SRID == 0 ) SRID = SRID_UNKNOWN;
+  /* GEOS's 0 is equivalent to our unknown as for SRID values */
+  if ( SRID == 0 ) SRID = SRID_UNKNOWN;
 
-	if ( want3d )
-	{
-		hasZ = GEOSHasZ_r(ctx->gctx, geom);
-		if ( ! hasZ )
-		{
-			RTDEBUG(3, "Geometry has no Z, won't provide one");
+  if ( want3d )
+  {
+    hasZ = GEOSHasZ_r(ctx->gctx, geom);
+    if ( ! hasZ )
+    {
+      RTDEBUG(3, "Geometry has no Z, won't provide one");
 
-			want3d = 0;
-		}
-	}
+      want3d = 0;
+    }
+  }
 
 /*
-	if ( GEOSisEmpty_r(ctx->gctx, geom) )
-	{
-		return (RTGEOM*)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, SRID, want3d, 0);
-	}
+  if ( GEOSisEmpty_r(ctx->gctx, geom) )
+  {
+    return (RTGEOM*)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, SRID, want3d, 0);
+  }
 */
 
-	switch (type)
-	{
-		const GEOSCoordSequence *cs;
-		RTPOINTARRAY *pa, **ppaa;
-		const GEOSGeometry *g;
-		RTGEOM **geoms;
-		uint32_t i, ngeoms;
-
-	case GEOS_POINT:
-		RTDEBUG(4, "rtgeom_from_geometry: it's a Point");
-		cs = GEOSGeom_getCoordSeq_r(ctx->gctx, geom);
-		if ( GEOSisEmpty_r(ctx->gctx, geom) )
-		  return (RTGEOM*)rtpoint_construct_empty(ctx, SRID, want3d, 0);
-		pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
-		return (RTGEOM *)rtpoint_construct(ctx, SRID, NULL, pa);
-
-	case GEOS_LINESTRING:
-	case GEOS_LINEARRING:
-		RTDEBUG(4, "rtgeom_from_geometry: it's a LineString or LinearRing");
-		if ( GEOSisEmpty_r(ctx->gctx, geom) )
-		  return (RTGEOM*)rtline_construct_empty(ctx, SRID, want3d, 0);
-
-		cs = GEOSGeom_getCoordSeq_r(ctx->gctx, geom);
-		pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
-		return (RTGEOM *)rtline_construct(ctx, SRID, NULL, pa);
-
-	case GEOS_POLYGON:
-		RTDEBUG(4, "rtgeom_from_geometry: it's a Polygon");
-		if ( GEOSisEmpty_r(ctx->gctx, geom) )
-		  return (RTGEOM*)rtpoly_construct_empty(ctx, SRID, want3d, 0);
-		ngeoms = GEOSGetNumInteriorRings_r(ctx->gctx, geom);
-		ppaa = rtalloc(ctx, sizeof(RTPOINTARRAY *)*(ngeoms+1));
-		g = GEOSGetExteriorRing_r(ctx->gctx, geom);
-		cs = GEOSGeom_getCoordSeq_r(ctx->gctx, g);
-		ppaa[0] = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
-		for (i=0; i<ngeoms; i++)
-		{
-			g = GEOSGetInteriorRingN_r(ctx->gctx, geom, i);
-			cs = GEOSGeom_getCoordSeq_r(ctx->gctx, g);
-			ppaa[i+1] = ptarray_from_GEOSCoordSeq(ctx, cs,
-			                                      want3d);
-		}
-		return (RTGEOM *)rtpoly_construct(ctx, SRID, NULL,
-		                                  ngeoms+1, ppaa);
-
-	case GEOS_MULTIPOINT:
-	case GEOS_MULTILINESTRING:
-	case GEOS_MULTIPOLYGON:
-	case GEOS_GEOMETRYCOLLECTION:
-		RTDEBUG(4, "rtgeom_from_geometry: it's a Collection or Multi");
-
-		ngeoms = GEOSGetNumGeometries_r(ctx->gctx, geom);
-		geoms = NULL;
-		if ( ngeoms )
-		{
-			geoms = rtalloc(ctx, sizeof(RTGEOM *)*ngeoms);
-			for (i=0; i<ngeoms; i++)
-			{
-				g = GEOSGetGeometryN_r(ctx->gctx, geom, i);
-				geoms[i] = GEOS2RTGEOM(ctx, g, want3d);
-			}
-		}
-		return (RTGEOM *)rtcollection_construct(ctx, type,
-		                                        SRID, NULL, ngeoms, geoms);
-
-	default:
-		rterror(ctx, "GEOS2RTGEOM: unknown geometry type: %d", type);
-		return NULL;
-
-	}
+  switch (type)
+  {
+    const GEOSCoordSequence *cs;
+    RTPOINTARRAY *pa, **ppaa;
+    const GEOSGeometry *g;
+    RTGEOM **geoms;
+    uint32_t i, ngeoms;
+
+  case GEOS_POINT:
+    RTDEBUG(4, "rtgeom_from_geometry: it's a Point");
+    cs = GEOSGeom_getCoordSeq_r(ctx->gctx, geom);
+    if ( GEOSisEmpty_r(ctx->gctx, geom) )
+      return (RTGEOM*)rtpoint_construct_empty(ctx, SRID, want3d, 0);
+    pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
+    return (RTGEOM *)rtpoint_construct(ctx, SRID, NULL, pa);
+
+  case GEOS_LINESTRING:
+  case GEOS_LINEARRING:
+    RTDEBUG(4, "rtgeom_from_geometry: it's a LineString or LinearRing");
+    if ( GEOSisEmpty_r(ctx->gctx, geom) )
+      return (RTGEOM*)rtline_construct_empty(ctx, SRID, want3d, 0);
+
+    cs = GEOSGeom_getCoordSeq_r(ctx->gctx, geom);
+    pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
+    return (RTGEOM *)rtline_construct(ctx, SRID, NULL, pa);
+
+  case GEOS_POLYGON:
+    RTDEBUG(4, "rtgeom_from_geometry: it's a Polygon");
+    if ( GEOSisEmpty_r(ctx->gctx, geom) )
+      return (RTGEOM*)rtpoly_construct_empty(ctx, SRID, want3d, 0);
+    ngeoms = GEOSGetNumInteriorRings_r(ctx->gctx, geom);
+    ppaa = rtalloc(ctx, sizeof(RTPOINTARRAY *)*(ngeoms+1));
+    g = GEOSGetExteriorRing_r(ctx->gctx, geom);
+    cs = GEOSGeom_getCoordSeq_r(ctx->gctx, g);
+    ppaa[0] = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
+    for (i=0; i<ngeoms; i++)
+    {
+      g = GEOSGetInteriorRingN_r(ctx->gctx, geom, i);
+      cs = GEOSGeom_getCoordSeq_r(ctx->gctx, g);
+      ppaa[i+1] = ptarray_from_GEOSCoordSeq(ctx, cs,
+                                            want3d);
+    }
+    return (RTGEOM *)rtpoly_construct(ctx, SRID, NULL,
+                                      ngeoms+1, ppaa);
+
+  case GEOS_MULTIPOINT:
+  case GEOS_MULTILINESTRING:
+  case GEOS_MULTIPOLYGON:
+  case GEOS_GEOMETRYCOLLECTION:
+    RTDEBUG(4, "rtgeom_from_geometry: it's a Collection or Multi");
+
+    ngeoms = GEOSGetNumGeometries_r(ctx->gctx, geom);
+    geoms = NULL;
+    if ( ngeoms )
+    {
+      geoms = rtalloc(ctx, sizeof(RTGEOM *)*ngeoms);
+      for (i=0; i<ngeoms; i++)
+      {
+        g = GEOSGetGeometryN_r(ctx->gctx, geom, i);
+        geoms[i] = GEOS2RTGEOM(ctx, g, want3d);
+      }
+    }
+    return (RTGEOM *)rtcollection_construct(ctx, type,
+                                            SRID, NULL, ngeoms, geoms);
+
+  default:
+    rterror(ctx, "GEOS2RTGEOM: unknown geometry type: %d", type);
+    return NULL;
+
+  }
 
 }
 
 static GEOSCoordSeq
 ptarray_to_GEOSCoordSeq(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	uint32_t dims = 2;
-	uint32_t i;
-	const RTPOINT3DZ *p3d;
-	const RTPOINT2D *p2d;
-	GEOSCoordSeq sq;
-
-	if ( RTFLAGS_GET_Z(pa->flags) ) 
-		dims = 3;
-
-	if ( ! (sq = GEOSCoordSeq_create_r(ctx->gctx, pa->npoints, dims)) ) 
-		rterror(ctx, "Error creating GEOS Coordinate Sequence");
-
-	for ( i=0; i < pa->npoints; i++ )
-	{
-		if ( dims == 3 )
-		{
-			p3d = rt_getPoint3dz_cp(ctx, pa, i);
-			p2d = (const RTPOINT2D *)p3d;
-			RTDEBUGF(4, "Point: %g,%g,%g", p3d->x, p3d->y, p3d->z);
-		}
-		else
-		{
-			p2d = rt_getPoint2d_cp(ctx, pa, i);
-			RTDEBUGF(4, "Point: %g,%g", p2d->x, p2d->y);
-		}
+  uint32_t dims = 2;
+  uint32_t i;
+  const RTPOINT3DZ *p3d;
+  const RTPOINT2D *p2d;
+  GEOSCoordSeq sq;
+
+  if ( RTFLAGS_GET_Z(pa->flags) )
+    dims = 3;
+
+  if ( ! (sq = GEOSCoordSeq_create_r(ctx->gctx, pa->npoints, dims)) )
+    rterror(ctx, "Error creating GEOS Coordinate Sequence");
+
+  for ( i=0; i < pa->npoints; i++ )
+  {
+    if ( dims == 3 )
+    {
+      p3d = rt_getPoint3dz_cp(ctx, pa, i);
+      p2d = (const RTPOINT2D *)p3d;
+      RTDEBUGF(4, "Point: %g,%g,%g", p3d->x, p3d->y, p3d->z);
+    }
+    else
+    {
+      p2d = rt_getPoint2d_cp(ctx, pa, i);
+      RTDEBUGF(4, "Point: %g,%g", p2d->x, p2d->y);
+    }
 
 #if RTGEOM_GEOS_VERSION < 33
-		/* Make sure we don't pass any infinite values down into GEOS */
-		/* GEOS 3.3+ is supposed to  handle this stuff OK */
-		if ( isinf(p2d->x) || isinf(p2d->y) || (dims == 3 && isinf(p3d->z)) )
-			rterror(ctx, "Infinite coordinate value found in geometry.");
-		if ( isnan(p2d->x) || isnan(p2d->y) || (dims == 3 && isnan(p3d->z)) )
-			rterror(ctx, "NaN coordinate value found in geometry.");
+    /* Make sure we don't pass any infinite values down into GEOS */
+    /* GEOS 3.3+ is supposed to  handle this stuff OK */
+    if ( isinf(p2d->x) || isinf(p2d->y) || (dims == 3 && isinf(p3d->z)) )
+      rterror(ctx, "Infinite coordinate value found in geometry.");
+    if ( isnan(p2d->x) || isnan(p2d->y) || (dims == 3 && isnan(p3d->z)) )
+      rterror(ctx, "NaN coordinate value found in geometry.");
 #endif
 
-		GEOSCoordSeq_setX_r(ctx->gctx, sq, i, p2d->x);
-		GEOSCoordSeq_setY_r(ctx->gctx, sq, i, p2d->y);
-		
-		if ( dims == 3 ) 
-			GEOSCoordSeq_setZ_r(ctx->gctx, sq, i, p3d->z);
-	}
-	return sq;
+    GEOSCoordSeq_setX_r(ctx->gctx, sq, i, p2d->x);
+    GEOSCoordSeq_setY_r(ctx->gctx, sq, i, p2d->y);
+
+    if ( dims == 3 )
+      GEOSCoordSeq_setZ_r(ctx->gctx, sq, i, p3d->z);
+  }
+  return sq;
 }
 
 static GEOSGeometry *
 ptarray_to_GEOSLinearRing(const RTCTX *ctx, const RTPOINTARRAY *pa, int autofix)
 {
-	GEOSCoordSeq sq;
-	GEOSGeom g;
-	RTPOINTARRAY *npa = 0;
-
-	if ( autofix )
-	{
-		/* check ring for being closed and fix if not */
-		if ( ! ptarray_is_closed_2d(ctx, pa) ) 
-		{
-			npa = ptarray_addPoint(ctx, pa, rt_getPoint_internal(ctx, pa, 0), RTFLAGS_NDIMS(pa->flags), pa->npoints);
-			pa = npa;
-		}
-		/* TODO: check ring for having at least 4 vertices */
+  GEOSCoordSeq sq;
+  GEOSGeom g;
+  RTPOINTARRAY *npa = 0;
+
+  if ( autofix )
+  {
+    /* check ring for being closed and fix if not */
+    if ( ! ptarray_is_closed_2d(ctx, pa) )
+    {
+      npa = ptarray_addPoint(ctx, pa, rt_getPoint_internal(ctx, pa, 0), RTFLAGS_NDIMS(pa->flags), pa->npoints);
+      pa = npa;
+    }
+    /* TODO: check ring for having at least 4 vertices */
 #if 0
-		while ( pa->npoints < 4 ) 
-		{
-			npa = ptarray_addPoint(ctx, npa, rt_getPoint_internal(ctx, pa, 0), RTFLAGS_NDIMS(pa->flags), pa->npoints);
-		}
+    while ( pa->npoints < 4 )
+    {
+      npa = ptarray_addPoint(ctx, npa, rt_getPoint_internal(ctx, pa, 0), RTFLAGS_NDIMS(pa->flags), pa->npoints);
+    }
 #endif
-	}
+  }
 
-	sq = ptarray_to_GEOSCoordSeq(ctx, pa);
-	if ( npa ) ptarray_free(ctx, npa);
-	g = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
-	return g;
+  sq = ptarray_to_GEOSCoordSeq(ctx, pa);
+  if ( npa ) ptarray_free(ctx, npa);
+  g = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
+  return g;
 }
 
 GEOSGeometry *
 GBOX2GEOS(const RTCTX *ctx, const RTGBOX *box)
 {
-	GEOSGeometry* envelope;
-	GEOSGeometry* ring;
-	GEOSCoordSequence* seq = GEOSCoordSeq_create_r(ctx->gctx, 5, 2);
-	if (!seq) 
-	{
-		return NULL;
-	}
-
-	GEOSCoordSeq_setX_r(ctx->gctx, seq, 0, box->xmin);
-	GEOSCoordSeq_setY_r(ctx->gctx, seq, 0, box->ymin);
-
-	GEOSCoordSeq_setX_r(ctx->gctx, seq, 1, box->xmax);
-	GEOSCoordSeq_setY_r(ctx->gctx, seq, 1, box->ymin);
-
-	GEOSCoordSeq_setX_r(ctx->gctx, seq, 2, box->xmax);
-	GEOSCoordSeq_setY_r(ctx->gctx, seq, 2, box->ymax);
-
-	GEOSCoordSeq_setX_r(ctx->gctx, seq, 3, box->xmin);
-	GEOSCoordSeq_setY_r(ctx->gctx, seq, 3, box->ymax);
-
-	GEOSCoordSeq_setX_r(ctx->gctx, seq, 4, box->xmin);
-	GEOSCoordSeq_setY_r(ctx->gctx, seq, 4, box->ymin);
-
-	ring = GEOSGeom_createLinearRing_r(ctx->gctx, seq);
-	if (!ring) 
-	{
-		GEOSCoordSeq_destroy_r(ctx->gctx, seq);
-		return NULL;
-	}
-
-	envelope = GEOSGeom_createPolygon_r(ctx->gctx, ring, NULL, 0);
-	if (!envelope) 
-	{
-		GEOSGeom_destroy_r(ctx->gctx, ring);
-		return NULL;
-	}
-
-	return envelope;
+  GEOSGeometry* envelope;
+  GEOSGeometry* ring;
+  GEOSCoordSequence* seq = GEOSCoordSeq_create_r(ctx->gctx, 5, 2);
+  if (!seq)
+  {
+    return NULL;
+  }
+
+  GEOSCoordSeq_setX_r(ctx->gctx, seq, 0, box->xmin);
+  GEOSCoordSeq_setY_r(ctx->gctx, seq, 0, box->ymin);
+
+  GEOSCoordSeq_setX_r(ctx->gctx, seq, 1, box->xmax);
+  GEOSCoordSeq_setY_r(ctx->gctx, seq, 1, box->ymin);
+
+  GEOSCoordSeq_setX_r(ctx->gctx, seq, 2, box->xmax);
+  GEOSCoordSeq_setY_r(ctx->gctx, seq, 2, box->ymax);
+
+  GEOSCoordSeq_setX_r(ctx->gctx, seq, 3, box->xmin);
+  GEOSCoordSeq_setY_r(ctx->gctx, seq, 3, box->ymax);
+
+  GEOSCoordSeq_setX_r(ctx->gctx, seq, 4, box->xmin);
+  GEOSCoordSeq_setY_r(ctx->gctx, seq, 4, box->ymin);
+
+  ring = GEOSGeom_createLinearRing_r(ctx->gctx, seq);
+  if (!ring)
+  {
+    GEOSCoordSeq_destroy_r(ctx->gctx, seq);
+    return NULL;
+  }
+
+  envelope = GEOSGeom_createPolygon_r(ctx->gctx, ring, NULL, 0);
+  if (!envelope)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, ring);
+    return NULL;
+  }
+
+  return envelope;
 }
 
 GEOSGeometry *
 RTGEOM2GEOS(const RTCTX *ctx, const RTGEOM *rtgeom, int autofix)
 {
-	GEOSCoordSeq sq;
-	GEOSGeom g, shell;
-	GEOSGeom *geoms = NULL;
-	/*
-	RTGEOM *tmp;
-	*/
-	uint32_t ngeoms, i;
-	int geostype;
+  GEOSCoordSeq sq;
+  GEOSGeom g, shell;
+  GEOSGeom *geoms = NULL;
+  /*
+  RTGEOM *tmp;
+  */
+  uint32_t ngeoms, i;
+  int geostype;
 #if RTDEBUG_LEVEL >= 4
-	char *wkt;
+  char *wkt;
 #endif
 
-	RTDEBUGF(4, "RTGEOM2GEOS got a %s", rttype_name(ctx, rtgeom->type));
-
-	if (rtgeom_has_arc(ctx, rtgeom))
-	{
-		RTGEOM *rtgeom_stroked = rtgeom_stroke(ctx, rtgeom, 32);
-		GEOSGeometry *g = RTGEOM2GEOS(ctx, rtgeom_stroked, autofix);
-		rtgeom_free(ctx, rtgeom_stroked);
-		return g;
-	}
-	
-	switch (rtgeom->type)
-	{
-		RTPOINT *rtp = NULL;
-		RTPOLY *rtpoly = NULL;
-		RTLINE *rtl = NULL;
-		RTCOLLECTION *rtc = NULL;
+  RTDEBUGF(4, "RTGEOM2GEOS got a %s", rttype_name(ctx, rtgeom->type));
+
+  if (rtgeom_has_arc(ctx, rtgeom))
+  {
+    RTGEOM *rtgeom_stroked = rtgeom_stroke(ctx, rtgeom, 32);
+    GEOSGeometry *g = RTGEOM2GEOS(ctx, rtgeom_stroked, autofix);
+    rtgeom_free(ctx, rtgeom_stroked);
+    return g;
+  }
+
+  switch (rtgeom->type)
+  {
+    RTPOINT *rtp = NULL;
+    RTPOLY *rtpoly = NULL;
+    RTLINE *rtl = NULL;
+    RTCOLLECTION *rtc = NULL;
 #if RTGEOM_GEOS_VERSION < 33
-		RTPOINTARRAY *pa = NULL;
+    RTPOINTARRAY *pa = NULL;
 #endif
-		
-	case RTPOINTTYPE:
-		rtp = (RTPOINT *)rtgeom;
-		
-		if ( rtgeom_is_empty(ctx, rtgeom) )
-		{
+
+  case RTPOINTTYPE:
+    rtp = (RTPOINT *)rtgeom;
+
+    if ( rtgeom_is_empty(ctx, rtgeom) )
+    {
 #if RTGEOM_GEOS_VERSION < 33
-			pa = ptarray_construct_empty(ctx, rtgeom_has_z(ctx, rtgeom), rtgeom_has_m(ctx, rtgeom), 2);
-			sq = ptarray_to_GEOSCoordSeq(ctx, pa);
-			shell = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
-			g = GEOSGeom_createPolygon_r(ctx->gctx, shell, NULL, 0);
+      pa = ptarray_construct_empty(ctx, rtgeom_has_z(ctx, rtgeom), rtgeom_has_m(ctx, rtgeom), 2);
+      sq = ptarray_to_GEOSCoordSeq(ctx, pa);
+      shell = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
+      g = GEOSGeom_createPolygon_r(ctx->gctx, shell, NULL, 0);
 #else
-			g = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
+      g = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
 #endif
-		}
-		else
-		{
-			sq = ptarray_to_GEOSCoordSeq(ctx, rtp->point);
-			g = GEOSGeom_createPoint_r(ctx->gctx, sq);
-		}
-		if ( ! g )
-		{
-			/* rtnotice(ctx, "Exception in RTGEOM2GEOS"); */
-			return NULL;
-		}
-		break;
-	case RTLINETYPE:
-		rtl = (RTLINE *)rtgeom;
-		/* TODO: if (autofix) */
-		if ( rtl->points->npoints == 1 ) {
-			/* Duplicate point, to make geos-friendly */
-			rtl->points = ptarray_addPoint(ctx, rtl->points,
-		                           rt_getPoint_internal(ctx, rtl->points, 0),
-		                           RTFLAGS_NDIMS(rtl->points->flags),
-		                           rtl->points->npoints);
-		}
-		sq = ptarray_to_GEOSCoordSeq(ctx, rtl->points);
-		g = GEOSGeom_createLineString_r(ctx->gctx, sq);
-		if ( ! g )
-		{
-			/* rtnotice(ctx, "Exception in RTGEOM2GEOS"); */
-			return NULL;
-		}
-		break;
-
-	case RTPOLYGONTYPE:
-		rtpoly = (RTPOLY *)rtgeom;
-		if ( rtgeom_is_empty(ctx, rtgeom) )
-		{
+    }
+    else
+    {
+      sq = ptarray_to_GEOSCoordSeq(ctx, rtp->point);
+      g = GEOSGeom_createPoint_r(ctx->gctx, sq);
+    }
+    if ( ! g )
+    {
+      /* rtnotice(ctx, "Exception in RTGEOM2GEOS"); */
+      return NULL;
+    }
+    break;
+  case RTLINETYPE:
+    rtl = (RTLINE *)rtgeom;
+    /* TODO: if (autofix) */
+    if ( rtl->points->npoints == 1 ) {
+      /* Duplicate point, to make geos-friendly */
+      rtl->points = ptarray_addPoint(ctx, rtl->points,
+                               rt_getPoint_internal(ctx, rtl->points, 0),
+                               RTFLAGS_NDIMS(rtl->points->flags),
+                               rtl->points->npoints);
+    }
+    sq = ptarray_to_GEOSCoordSeq(ctx, rtl->points);
+    g = GEOSGeom_createLineString_r(ctx->gctx, sq);
+    if ( ! g )
+    {
+      /* rtnotice(ctx, "Exception in RTGEOM2GEOS"); */
+      return NULL;
+    }
+    break;
+
+  case RTPOLYGONTYPE:
+    rtpoly = (RTPOLY *)rtgeom;
+    if ( rtgeom_is_empty(ctx, rtgeom) )
+    {
 #if RTGEOM_GEOS_VERSION < 33
-			RTPOINTARRAY *pa = ptarray_construct_empty(ctx, rtgeom_has_z(ctx, rtgeom), rtgeom_has_m(ctx, rtgeom), 2);
-			sq = ptarray_to_GEOSCoordSeq(ctx, pa);
-			shell = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
-			g = GEOSGeom_createPolygon_r(ctx->gctx, shell, NULL, 0);
+      RTPOINTARRAY *pa = ptarray_construct_empty(ctx, rtgeom_has_z(ctx, rtgeom), rtgeom_has_m(ctx, rtgeom), 2);
+      sq = ptarray_to_GEOSCoordSeq(ctx, pa);
+      shell = GEOSGeom_createLinearRing_r(ctx->gctx, sq);
+      g = GEOSGeom_createPolygon_r(ctx->gctx, shell, NULL, 0);
 #else
-			g = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
+      g = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
 #endif
-		}
-		else
-		{
-			shell = ptarray_to_GEOSLinearRing(ctx, rtpoly->rings[0], autofix);
-			if ( ! shell ) return NULL;
-			/*rterror(ctx, "RTGEOM2GEOS: exception during polygon shell conversion"); */
-			ngeoms = rtpoly->nrings-1;
-			if ( ngeoms > 0 )
-				geoms = malloc(sizeof(GEOSGeom)*ngeoms);
-
-			for (i=1; i<rtpoly->nrings; ++i)
-			{
-				geoms[i-1] = ptarray_to_GEOSLinearRing(ctx, rtpoly->rings[i], autofix);
-				if ( ! geoms[i-1] )
-				{
-					--i;
-					while (i) GEOSGeom_destroy_r(ctx->gctx, geoms[--i]);
-					free(geoms);
-					GEOSGeom_destroy_r(ctx->gctx, shell);
-					return NULL;
-				}
-				/*rterror(ctx, "RTGEOM2GEOS: exception during polygon hole conversion"); */
-			}
-			g = GEOSGeom_createPolygon_r(ctx->gctx, shell, geoms, ngeoms);
-			if (geoms) free(geoms);
-		}
-		if ( ! g ) return NULL;
-		break;
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		if ( rtgeom->type == RTMULTIPOINTTYPE )
-			geostype = GEOS_MULTIPOINT;
-		else if ( rtgeom->type == RTMULTILINETYPE )
-			geostype = GEOS_MULTILINESTRING;
-		else if ( rtgeom->type == RTMULTIPOLYGONTYPE )
-			geostype = GEOS_MULTIPOLYGON;
-		else
-			geostype = GEOS_GEOMETRYCOLLECTION;
-
-		rtc = (RTCOLLECTION *)rtgeom;
-
-		ngeoms = rtc->ngeoms;
-		if ( ngeoms > 0 )
-			geoms = malloc(sizeof(GEOSGeom)*ngeoms);
-
-		for (i=0; i<ngeoms; ++i)
-		{
-			GEOSGeometry* g = RTGEOM2GEOS(ctx, rtc->geoms[i], 0);
-			if ( ! g )
-			{
-				while (i) GEOSGeom_destroy_r(ctx->gctx, geoms[--i]);
-				free(geoms);
-				return NULL;
-			}
-			geoms[i] = g;
-		}
-		g = GEOSGeom_createCollection_r(ctx->gctx, geostype, geoms, ngeoms);
-		if ( geoms ) free(geoms);
-		if ( ! g ) return NULL;
-		break;
-
-	default:
-		rterror(ctx, "Unknown geometry type: %d - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
-		return NULL;
-	}
-
-	GEOSSetSRID_r(ctx->gctx, g, rtgeom->srid);
+    }
+    else
+    {
+      shell = ptarray_to_GEOSLinearRing(ctx, rtpoly->rings[0], autofix);
+      if ( ! shell ) return NULL;
+      /*rterror(ctx, "RTGEOM2GEOS: exception during polygon shell conversion"); */
+      ngeoms = rtpoly->nrings-1;
+      if ( ngeoms > 0 )
+        geoms = malloc(sizeof(GEOSGeom)*ngeoms);
+
+      for (i=1; i<rtpoly->nrings; ++i)
+      {
+        geoms[i-1] = ptarray_to_GEOSLinearRing(ctx, rtpoly->rings[i], autofix);
+        if ( ! geoms[i-1] )
+        {
+          --i;
+          while (i) GEOSGeom_destroy_r(ctx->gctx, geoms[--i]);
+          free(geoms);
+          GEOSGeom_destroy_r(ctx->gctx, shell);
+          return NULL;
+        }
+        /*rterror(ctx, "RTGEOM2GEOS: exception during polygon hole conversion"); */
+      }
+      g = GEOSGeom_createPolygon_r(ctx->gctx, shell, geoms, ngeoms);
+      if (geoms) free(geoms);
+    }
+    if ( ! g ) return NULL;
+    break;
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    if ( rtgeom->type == RTMULTIPOINTTYPE )
+      geostype = GEOS_MULTIPOINT;
+    else if ( rtgeom->type == RTMULTILINETYPE )
+      geostype = GEOS_MULTILINESTRING;
+    else if ( rtgeom->type == RTMULTIPOLYGONTYPE )
+      geostype = GEOS_MULTIPOLYGON;
+    else
+      geostype = GEOS_GEOMETRYCOLLECTION;
+
+    rtc = (RTCOLLECTION *)rtgeom;
+
+    ngeoms = rtc->ngeoms;
+    if ( ngeoms > 0 )
+      geoms = malloc(sizeof(GEOSGeom)*ngeoms);
+
+    for (i=0; i<ngeoms; ++i)
+    {
+      GEOSGeometry* g = RTGEOM2GEOS(ctx, rtc->geoms[i], 0);
+      if ( ! g )
+      {
+        while (i) GEOSGeom_destroy_r(ctx->gctx, geoms[--i]);
+        free(geoms);
+        return NULL;
+      }
+      geoms[i] = g;
+    }
+    g = GEOSGeom_createCollection_r(ctx->gctx, geostype, geoms, ngeoms);
+    if ( geoms ) free(geoms);
+    if ( ! g ) return NULL;
+    break;
+
+  default:
+    rterror(ctx, "Unknown geometry type: %d - %s", rtgeom->type, rttype_name(ctx, rtgeom->type));
+    return NULL;
+  }
+
+  GEOSSetSRID_r(ctx->gctx, g, rtgeom->srid);
 
 #if RTDEBUG_LEVEL >= 4
-	wkt = GEOSGeomToWKT_r(ctx->gctx, g);
-	RTDEBUGF(4, "RTGEOM2GEOS: GEOSGeom: %s", wkt);
-	free(wkt);
+  wkt = GEOSGeomToWKT_r(ctx->gctx, g);
+  RTDEBUGF(4, "RTGEOM2GEOS: GEOSGeom: %s", wkt);
+  free(wkt);
 #endif
 
-	return g;
+  return g;
 }
 
 const char*
 rtgeom_geos_version()
 {
-	const char *ver = GEOSversion();
-	return ver;
+  const char *ver = GEOSversion();
+  return ver;
 }
 
 RTGEOM *
 rtgeom_normalize(const RTCTX *ctx, const RTGEOM *geom1)
 {
-	RTGEOM *result ;
-	GEOSGeometry *g1;
-	int is3d ;
-	int srid ;
-
-	srid = (int)(geom1->srid);
-	is3d = RTFLAGS_GET_Z(geom1->flags);
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ;
-	}
-
-	if ( -1 == GEOSNormalize_r(ctx->gctx, g1) )
-	{
-	  rterror(ctx, "Error in GEOSNormalize: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
-
-	GEOSSetSRID_r(ctx->gctx, g1, srid); /* needed ? */
-	result = GEOS2RTGEOM(ctx, g1, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-
-	if (result == NULL)
-	{
-	  rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s",
-	                rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
-
-	return result ;
+  RTGEOM *result ;
+  GEOSGeometry *g1;
+  int is3d ;
+  int srid ;
+
+  srid = (int)(geom1->srid);
+  is3d = RTFLAGS_GET_Z(geom1->flags);
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ;
+  }
+
+  if ( -1 == GEOSNormalize_r(ctx->gctx, g1) )
+  {
+    rterror(ctx, "Error in GEOSNormalize: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
+
+  GEOSSetSRID_r(ctx->gctx, g1, srid); /* needed ? */
+  result = GEOS2RTGEOM(ctx, g1, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+
+  if (result == NULL)
+  {
+    rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s",
+                  rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
+
+  return result ;
 }
 
 RTGEOM *
 rtgeom_intersection(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2)
 {
-	RTGEOM *result ;
-	GEOSGeometry *g1, *g2, *g3 ;
-	int is3d ;
-	int srid ;
-
-	/* A.Intersection(Empty) == Empty */
-	if ( rtgeom_is_empty(ctx, geom2) )
-		return rtgeom_clone_deep(ctx, geom2);
-
-	/* Empty.Intersection(A) == Empty */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom1);
-
-	/* ensure srids are identical */
-	srid = (int)(geom1->srid);
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
-
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
-
-	rtgeom_geos_ensure_init(ctx);
-
-	RTDEBUG(3, "intersection() START");
-
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ;
-	}
-
-	g2 = RTGEOM2GEOS(ctx, geom2, 0);
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "Second argument geometry could not be converted to GEOS.");
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		return NULL ;
-	}
-
-	RTDEBUG(3, " constructed geometrys - calling geos");
-	RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
-	RTDEBUGF(3, " g2 = %s", GEOSGeomToWKT_r(ctx->gctx, g2));
-	/*RTDEBUGF(3, "g2 is valid = %i",GEOSisvalid_r(ctx->gctx, g2)); */
-	/*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
-
-	g3 = GEOSIntersection_r(ctx->gctx, g1,g2);
-
-	RTDEBUG(3, " intersection finished");
-
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		rterror(ctx, "Error performing intersection: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
-
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
-
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
-
-	result = GEOS2RTGEOM(ctx, g3, is3d);
-
-	if (result == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
-
-	return result ;
+  RTGEOM *result ;
+  GEOSGeometry *g1, *g2, *g3 ;
+  int is3d ;
+  int srid ;
+
+  /* A.Intersection(Empty) == Empty */
+  if ( rtgeom_is_empty(ctx, geom2) )
+    return rtgeom_clone_deep(ctx, geom2);
+
+  /* Empty.Intersection(A) == Empty */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom1);
+
+  /* ensure srids are identical */
+  srid = (int)(geom1->srid);
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+
+  rtgeom_geos_ensure_init(ctx);
+
+  RTDEBUG(3, "intersection() START");
+
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ;
+  }
+
+  g2 = RTGEOM2GEOS(ctx, geom2, 0);
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "Second argument geometry could not be converted to GEOS.");
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    return NULL ;
+  }
+
+  RTDEBUG(3, " constructed geometrys - calling geos");
+  RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
+  RTDEBUGF(3, " g2 = %s", GEOSGeomToWKT_r(ctx->gctx, g2));
+  /*RTDEBUGF(3, "g2 is valid = %i",GEOSisvalid_r(ctx->gctx, g2)); */
+  /*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
+
+  g3 = GEOSIntersection_r(ctx->gctx, g1,g2);
+
+  RTDEBUG(3, " intersection finished");
+
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    rterror(ctx, "Error performing intersection: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
+
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
+
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
+
+  result = GEOS2RTGEOM(ctx, g3, is3d);
+
+  if (result == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
+
+  return result ;
 }
 
 RTGEOM *
 rtgeom_linemerge(const RTCTX *ctx, const RTGEOM *geom1)
 {
-	RTGEOM *result ;
-	GEOSGeometry *g1, *g3 ;
-	int is3d = RTFLAGS_GET_Z(geom1->flags);
-	int srid = geom1->srid;
-
-	/* Empty.Linemerge() == Empty */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return (RTGEOM*)rtcollection_construct_empty(ctx,  RTCOLLECTIONTYPE, srid, is3d,
+  RTGEOM *result ;
+  GEOSGeometry *g1, *g3 ;
+  int is3d = RTFLAGS_GET_Z(geom1->flags);
+  int srid = geom1->srid;
+
+  /* Empty.Linemerge() == Empty */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return (RTGEOM*)rtcollection_construct_empty(ctx,  RTCOLLECTIONTYPE, srid, is3d,
                                          rtgeom_has_m(ctx, geom1) );
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	RTDEBUG(3, "linemerge() START");
+  RTDEBUG(3, "linemerge() START");
 
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ;
-	}
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ;
+  }
 
-	RTDEBUG(3, " constructed geometrys - calling geos");
-	RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
-	/*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
+  RTDEBUG(3, " constructed geometrys - calling geos");
+  RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
+  /*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
 
-	g3 = GEOSLineMerge_r(ctx->gctx, g1);
+  g3 = GEOSLineMerge_r(ctx->gctx, g1);
 
-	RTDEBUG(3, " linemerge finished");
+  RTDEBUG(3, " linemerge finished");
 
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "Error performing linemerge: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "Error performing linemerge: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
 
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
 
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
 
-	result = GEOS2RTGEOM(ctx, g3, is3d);
+  result = GEOS2RTGEOM(ctx, g3, is3d);
 
-	if (result == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "Error performing linemerge: GEOS2RTGEOM: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
+  if (result == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "Error performing linemerge: GEOS2RTGEOM: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
 
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	return result ;
+  return result ;
 }
 
 RTGEOM *
 rtgeom_unaryunion(const RTCTX *ctx, const RTGEOM *geom1)
 {
-	RTGEOM *result ;
-	GEOSGeometry *g1, *g3 ;
-	int is3d = RTFLAGS_GET_Z(geom1->flags);
-	int srid = geom1->srid;
+  RTGEOM *result ;
+  GEOSGeometry *g1, *g3 ;
+  int is3d = RTFLAGS_GET_Z(geom1->flags);
+  int srid = geom1->srid;
 
-	/* Empty.UnaryUnion() == Empty */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom1);
+  /* Empty.UnaryUnion() == Empty */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom1);
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ;
-	}
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ;
+  }
 
-	g3 = GEOSUnaryUnion_r(ctx->gctx, g1);
+  g3 = GEOSUnaryUnion_r(ctx->gctx, g1);
 
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "Error performing unaryunion: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "Error performing unaryunion: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
 
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
 
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
 
-	result = GEOS2RTGEOM(ctx, g3, is3d);
+  result = GEOS2RTGEOM(ctx, g3, is3d);
 
-	if (result == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "Error performing unaryunion: GEOS2RTGEOM: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
+  if (result == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "Error performing unaryunion: GEOS2RTGEOM: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
 
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	return result ;
+  return result ;
 }
 
 RTGEOM *
 rtgeom_difference(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2)
 {
-	GEOSGeometry *g1, *g2, *g3;
-	RTGEOM *result;
-	int is3d;
-	int srid;
-
-	/* A.Difference(Empty) == A */
-	if ( rtgeom_is_empty(ctx, geom2) )
-		return rtgeom_clone_deep(ctx, geom1);
-
-	/* Empty.Intersection(A) == Empty */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom1);
-
-	/* ensure srids are identical */
-	srid = (int)(geom1->srid);
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
-
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	g2 = RTGEOM2GEOS(ctx, geom2, 0);
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	g3 = GEOSDifference_r(ctx->gctx, g1,g2);
-
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		rterror(ctx, "GEOSDifference: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
-
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
-
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
-
-	result = GEOS2RTGEOM(ctx, g3, is3d);
-
-	if (result == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "Error performing difference: GEOS2RTGEOM: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
-
-	/* compressType(result); */
-
-	return result;
+  GEOSGeometry *g1, *g2, *g3;
+  RTGEOM *result;
+  int is3d;
+  int srid;
+
+  /* A.Difference(Empty) == A */
+  if ( rtgeom_is_empty(ctx, geom2) )
+    return rtgeom_clone_deep(ctx, geom1);
+
+  /* Empty.Intersection(A) == Empty */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom1);
+
+  /* ensure srids are identical */
+  srid = (int)(geom1->srid);
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  g2 = RTGEOM2GEOS(ctx, geom2, 0);
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  g3 = GEOSDifference_r(ctx->gctx, g1,g2);
+
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    rterror(ctx, "GEOSDifference: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
+
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
+
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
+
+  result = GEOS2RTGEOM(ctx, g3, is3d);
+
+  if (result == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "Error performing difference: GEOS2RTGEOM: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
+
+  /* compressType(result); */
+
+  return result;
 }
 
 RTGEOM *
 rtgeom_symdifference(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2)
 {
-	GEOSGeometry *g1, *g2, *g3;
-	RTGEOM *result;
-	int is3d;
-	int srid;
+  GEOSGeometry *g1, *g2, *g3;
+  RTGEOM *result;
+  int is3d;
+  int srid;
 
-	/* A.SymDifference(Empty) == A */
-	if ( rtgeom_is_empty(ctx, geom2) )
-		return rtgeom_clone_deep(ctx, geom1);
+  /* A.SymDifference(Empty) == A */
+  if ( rtgeom_is_empty(ctx, geom2) )
+    return rtgeom_clone_deep(ctx, geom1);
 
-	/* Empty.DymDifference(B) == B */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom2);
+  /* Empty.DymDifference(B) == B */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom2);
 
-	/* ensure srids are identical */
-	srid = (int)(geom1->srid);
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+  /* ensure srids are identical */
+  srid = (int)(geom1->srid);
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
 
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
 
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	g2 = RTGEOM2GEOS(ctx, geom2, 0);
+  g2 = RTGEOM2GEOS(ctx, geom2, 0);
 
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		return NULL;
-	}
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    return NULL;
+  }
 
-	g3 = GEOSSymDifference_r(ctx->gctx, g1,g2);
+  g3 = GEOSSymDifference_r(ctx->gctx, g1,g2);
 
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		rterror(ctx, "GEOSSymDifference: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL; /*never get here */
-	}
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    rterror(ctx, "GEOSSymDifference: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL; /*never get here */
+  }
 
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3));
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3));
 
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
 
-	result = GEOS2RTGEOM(ctx, g3, is3d);
+  result = GEOS2RTGEOM(ctx, g3, is3d);
 
-	if (result == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "GEOS symdifference_r(ctx->gctx) threw an error (result postgis geometry formation)!");
-		return NULL ; /*never get here */
-	}
+  if (result == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "GEOS symdifference_r(ctx->gctx) threw an error (result postgis geometry formation)!");
+    return NULL ; /*never get here */
+  }
 
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	return result;
+  return result;
 }
 
 RTGEOM*
 rtgeom_union(const RTCTX *ctx, const RTGEOM *geom1, const RTGEOM *geom2)
 {
-	int is3d;
-	int srid;
-	GEOSGeometry *g1, *g2, *g3;
-	RTGEOM *result;
+  int is3d;
+  int srid;
+  GEOSGeometry *g1, *g2, *g3;
+  RTGEOM *result;
 
-	RTDEBUG(2, "in geomunion");
+  RTDEBUG(2, "in geomunion");
 
-	/* A.Union(empty) == A */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom2);
+  /* A.Union(empty) == A */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom2);
 
-	/* B.Union(empty) == B */
-	if ( rtgeom_is_empty(ctx, geom2) )
-		return rtgeom_clone_deep(ctx, geom1);
+  /* B.Union(empty) == B */
+  if ( rtgeom_is_empty(ctx, geom2) )
+    return rtgeom_clone_deep(ctx, geom1);
 
 
-	/* ensure srids are identical */
-	srid = (int)(geom1->srid);
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+  /* ensure srids are identical */
+  srid = (int)(geom1->srid);
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
 
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	g1 = RTGEOM2GEOS(ctx, geom1, 0);
+  g1 = RTGEOM2GEOS(ctx, geom1, 0);
 
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	g2 = RTGEOM2GEOS(ctx, geom2, 0);
+  g2 = RTGEOM2GEOS(ctx, geom2, 0);
 
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	RTDEBUGF(3, "g1=%s", GEOSGeomToWKT_r(ctx->gctx, g1));
-	RTDEBUGF(3, "g2=%s", GEOSGeomToWKT_r(ctx->gctx, g2));
+  RTDEBUGF(3, "g1=%s", GEOSGeomToWKT_r(ctx->gctx, g1));
+  RTDEBUGF(3, "g2=%s", GEOSGeomToWKT_r(ctx->gctx, g2));
 
-	g3 = GEOSUnion_r(ctx->gctx, g1,g2);
+  g3 = GEOSUnion_r(ctx->gctx, g1,g2);
 
-	RTDEBUGF(3, "g3=%s", GEOSGeomToWKT_r(ctx->gctx, g3));
+  RTDEBUGF(3, "g3=%s", GEOSGeomToWKT_r(ctx->gctx, g3));
 
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
 
-	if (g3 == NULL)
-	{
-		rterror(ctx, "GEOSUnion: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL; /* never get here */
-	}
+  if (g3 == NULL)
+  {
+    rterror(ctx, "GEOSUnion: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL; /* never get here */
+  }
 
 
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
 
-	result = GEOS2RTGEOM(ctx, g3, is3d);
+  result = GEOS2RTGEOM(ctx, g3, is3d);
 
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	if (result == NULL)
-	{
-		rterror(ctx, "Error performing union: GEOS2RTGEOM: %s",
-		        rtgeom_get_last_geos_error(ctx));
-		return NULL; /*never get here */
-	}
+  if (result == NULL)
+  {
+    rterror(ctx, "Error performing union: GEOS2RTGEOM: %s",
+            rtgeom_get_last_geos_error(ctx));
+    return NULL; /*never get here */
+  }
 
-	return result;
+  return result;
 }
 
 RTGEOM *
 rtgeom_clip_by_rect(const RTCTX *ctx, const RTGEOM *geom1, double x0, double y0, double x1, double y1)
 {
 #if RTGEOM_GEOS_VERSION < 35
-	rterror(ctx, "The GEOS version this postgis binary "
-	        "was compiled against (%d) doesn't support "
-	        "'GEOSClipByRect' function _r(ctx->gctx, 3.3.5+ required)",
-	        RTGEOM_GEOS_VERSION);
-	return NULL;
+  rterror(ctx, "The GEOS version this postgis binary "
+          "was compiled against (%d) doesn't support "
+          "'GEOSClipByRect' function _r(ctx->gctx, 3.3.5+ required)",
+          RTGEOM_GEOS_VERSION);
+  return NULL;
 #else /* RTGEOM_GEOS_VERSION >= 35 */
-	RTGEOM *result ;
-	GEOSGeometry *g1, *g3 ;
-	int is3d ;
+  RTGEOM *result ;
+  GEOSGeometry *g1, *g3 ;
+  int is3d ;
 
-	/* A.Intersection(Empty) == Empty */
-	if ( rtgeom_is_empty(ctx, geom1) )
-		return rtgeom_clone_deep(ctx, geom1);
+  /* A.Intersection(Empty) == Empty */
+  if ( rtgeom_is_empty(ctx, geom1) )
+    return rtgeom_clone_deep(ctx, geom1);
 
-	is3d = RTFLAGS_GET_Z(geom1->flags);
+  is3d = RTFLAGS_GET_Z(geom1->flags);
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	RTDEBUG(3, "clip_by_rect() START");
+  RTDEBUG(3, "clip_by_rect() START");
 
-	g1 = RTGEOM2GEOS(ctx, geom1, 1); /* auto-fix structure */
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ;
-	}
+  g1 = RTGEOM2GEOS(ctx, geom1, 1); /* auto-fix structure */
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ;
+  }
 
-	RTDEBUG(3, " constructed geometrys - calling geos");
-	RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
-	/*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
+  RTDEBUG(3, " constructed geometrys - calling geos");
+  RTDEBUGF(3, " g1 = %s", GEOSGeomToWKT_r(ctx->gctx, g1));
+  /*RTDEBUGF(3, "g1 is valid = %i",GEOSisvalid_r(ctx->gctx, g1)); */
 
-	g3 = GEOSClipByRect_r(ctx->gctx, g1,x0,y0,x1,y1);
-	GEOSGeom_destroy_r(ctx->gctx, g1);
+  g3 = GEOSClipByRect_r(ctx->gctx, g1,x0,y0,x1,y1);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
 
-	RTDEBUG(3, " clip_by_rect finished");
+  RTDEBUG(3, " clip_by_rect finished");
 
-	if (g3 == NULL)
-	{
-		rtnotice(ctx, "Error performing rectangular clipping: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  if (g3 == NULL)
+  {
+    rtnotice(ctx, "Error performing rectangular clipping: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3) ) ;
 
-	result = GEOS2RTGEOM(ctx, g3, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  result = GEOS2RTGEOM(ctx, g3, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	if (result == NULL)
-	{
-		rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL ; /* never get here */
-	}
+  if (result == NULL)
+  {
+    rterror(ctx, "Error performing intersection: GEOS2RTGEOM: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL ; /* never get here */
+  }
 
-	result->srid = geom1->srid;
+  result->srid = geom1->srid;
 
-	return result ;
+  return result ;
 #endif /* RTGEOM_GEOS_VERSION >= 35 */
 }
 
@@ -1120,10 +1121,10 @@ findFaceHoles(const RTCTX *ctx, Face** faces, int nfaces)
       const GEOSGeometry *hole = GEOSGetInteriorRingN_r(ctx->gctx, f->geom, h);
       RTDEBUGF(2, "Looking for hole %d/%d of face %d among %d other faces", h+1, nholes, i, nfaces-i-1);
       for (j=i+1; j<nfaces; ++j) {
-		const GEOSGeometry *f2er;
+    const GEOSGeometry *f2er;
         Face* f2 = faces[j];
         if ( f2->parent ) continue; /* hole already assigned */
-        f2er = GEOSGetExteriorRing_r(ctx->gctx, f2->geom); 
+        f2er = GEOSGetExteriorRing_r(ctx->gctx, f2->geom);
         /* TODO: can be optimized as the ring would have the
          *       same vertices, possibly in different order.
          *       maybe comparing number of points could already be
@@ -1243,7 +1244,7 @@ RTGEOM_GEOS_buildArea(const RTCTX *ctx, const GEOSGeometry* geom_in)
    * Example:
    *
    *   +---------------+
-   *   |     L0        |  L0 has no parents 
+   *   |     L0        |  L0 has no parents
    *   |  +---------+  |
    *   |  |   L1    |  |  L1 is an hole of L0
    *   |  |  +---+  |  |
@@ -1253,7 +1254,7 @@ RTGEOM_GEOS_buildArea(const RTCTX *ctx, const GEOSGeometry* geom_in)
    *   |  +---------+  |
    *   |               |
    *   +---------------+
-   * 
+   *
    * See http://trac.osgeo.org/postgis/ticket/1806
    *
    */
@@ -1320,92 +1321,92 @@ RTGEOM_GEOS_buildArea(const RTCTX *ctx, const GEOSGeometry* geom_in)
 RTGEOM*
 rtgeom_buildarea(const RTCTX *ctx, const RTGEOM *geom)
 {
-	GEOSGeometry* geos_in;
-	GEOSGeometry* geos_out;
-	RTGEOM* geom_out;
-	int SRID = (int)(geom->srid);
-	int is3d = RTFLAGS_GET_Z(geom->flags);
-
-	/* Can't build an area from an empty! */
-	if ( rtgeom_is_empty(ctx, geom) )
-	{
-		return (RTGEOM*)rtpoly_construct_empty(ctx, SRID, is3d, 0);
-	}
-
-	RTDEBUG(3, "buildarea called");
-
-	RTDEBUGF(3, "ST_BuildArea got geom @ %p", geom);
-
-	rtgeom_geos_ensure_init(ctx);
-
-	geos_in = RTGEOM2GEOS(ctx, geom, 0);
-	
-	if ( 0 == geos_in )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	geos_out = RTGEOM_GEOS_buildArea(ctx, geos_in);
-	GEOSGeom_destroy_r(ctx->gctx, geos_in);
-
-	if ( ! geos_out ) /* exception thrown.. */
-	{
-		rterror(ctx, "RTGEOM_GEOS_buildArea: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* If no geometries are in result collection, return NULL */
-	if ( GEOSGetNumGeometries_r(ctx->gctx, geos_out) == 0 )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, geos_out);
-		return NULL;
-	}
-
-	geom_out = GEOS2RTGEOM(ctx, geos_out, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, geos_out);
+  GEOSGeometry* geos_in;
+  GEOSGeometry* geos_out;
+  RTGEOM* geom_out;
+  int SRID = (int)(geom->srid);
+  int is3d = RTFLAGS_GET_Z(geom->flags);
+
+  /* Can't build an area from an empty! */
+  if ( rtgeom_is_empty(ctx, geom) )
+  {
+    return (RTGEOM*)rtpoly_construct_empty(ctx, SRID, is3d, 0);
+  }
+
+  RTDEBUG(3, "buildarea called");
+
+  RTDEBUGF(3, "ST_BuildArea got geom @ %p", geom);
+
+  rtgeom_geos_ensure_init(ctx);
+
+  geos_in = RTGEOM2GEOS(ctx, geom, 0);
+
+  if ( 0 == geos_in )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  geos_out = RTGEOM_GEOS_buildArea(ctx, geos_in);
+  GEOSGeom_destroy_r(ctx->gctx, geos_in);
+
+  if ( ! geos_out ) /* exception thrown.. */
+  {
+    rterror(ctx, "RTGEOM_GEOS_buildArea: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* If no geometries are in result collection, return NULL */
+  if ( GEOSGetNumGeometries_r(ctx->gctx, geos_out) == 0 )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, geos_out);
+    return NULL;
+  }
+
+  geom_out = GEOS2RTGEOM(ctx, geos_out, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, geos_out);
 
 #if PARANOIA_LEVEL > 0
-	if ( geom_out == NULL )
-	{
-		rterror(ctx, "serialization error");
-		return NULL;
-	}
+  if ( geom_out == NULL )
+  {
+    rterror(ctx, "serialization error");
+    return NULL;
+  }
 
 #endif
 
-	return geom_out;
+  return geom_out;
 }
 
 int
 rtgeom_is_simple(const RTCTX *ctx, const RTGEOM *geom)
 {
-	GEOSGeometry* geos_in;
-	int simple;
-
-	/* Empty is artays simple */
-	if ( rtgeom_is_empty(ctx, geom) )
-	{
-		return 1;
-	}
-
-	rtgeom_geos_ensure_init(ctx);
-
-	geos_in = RTGEOM2GEOS(ctx, geom, 0);
-	if ( 0 == geos_in )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return -1;
-	}
-	simple = GEOSisSimple_r(ctx->gctx, geos_in);
-	GEOSGeom_destroy_r(ctx->gctx, geos_in);
-
-	if ( simple == 2 ) /* exception thrown */
-	{
-		rterror(ctx, "rtgeom_is_simple: %s", rtgeom_get_last_geos_error(ctx));
-		return -1;
-	}
-
-	return simple ? 1 : 0;
+  GEOSGeometry* geos_in;
+  int simple;
+
+  /* Empty is artays simple */
+  if ( rtgeom_is_empty(ctx, geom) )
+  {
+    return 1;
+  }
+
+  rtgeom_geos_ensure_init(ctx);
+
+  geos_in = RTGEOM2GEOS(ctx, geom, 0);
+  if ( 0 == geos_in )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return -1;
+  }
+  simple = GEOSisSimple_r(ctx->gctx, geos_in);
+  GEOSGeom_destroy_r(ctx->gctx, geos_in);
+
+  if ( simple == 2 ) /* exception thrown */
+  {
+    rterror(ctx, "rtgeom_is_simple: %s", rtgeom_get_last_geos_error(ctx));
+    return -1;
+  }
+
+  return simple ? 1 : 0;
 }
 
 /* ------------ end of BuildArea stuff ---------------------------------------------------------------------} */
@@ -1413,88 +1414,88 @@ rtgeom_is_simple(const RTCTX *ctx, const RTGEOM *geom)
 RTGEOM*
 rtgeom_geos_noop(const RTCTX *ctx, const RTGEOM* geom_in)
 {
-	GEOSGeometry *geosgeom;
-	RTGEOM* geom_out;
-
-	int is3d = RTFLAGS_GET_Z(geom_in->flags);
-
-	rtgeom_geos_ensure_init(ctx);
-	geosgeom = RTGEOM2GEOS(ctx, geom_in, 0);
-	if ( ! geosgeom ) {
-		rterror(ctx, "Geometry could not be converted to GEOS: %s",
-			rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	geom_out = GEOS2RTGEOM(ctx, geosgeom, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, geosgeom);
-	if ( ! geom_out ) {
-		rterror(ctx, "GEOS Geometry could not be converted to RTGEOM: %s",
-			rtgeom_get_last_geos_error(ctx));
-	}
-	return geom_out;
-	
+  GEOSGeometry *geosgeom;
+  RTGEOM* geom_out;
+
+  int is3d = RTFLAGS_GET_Z(geom_in->flags);
+
+  rtgeom_geos_ensure_init(ctx);
+  geosgeom = RTGEOM2GEOS(ctx, geom_in, 0);
+  if ( ! geosgeom ) {
+    rterror(ctx, "Geometry could not be converted to GEOS: %s",
+      rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  geom_out = GEOS2RTGEOM(ctx, geosgeom, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, geosgeom);
+  if ( ! geom_out ) {
+    rterror(ctx, "GEOS Geometry could not be converted to RTGEOM: %s",
+      rtgeom_get_last_geos_error(ctx));
+  }
+  return geom_out;
+
 }
 
 RTGEOM*
 rtgeom_snap(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2, double tolerance)
 {
 #if RTGEOM_GEOS_VERSION < 33
-	rterror(ctx, "The GEOS version this rtgeom library "
-	        "was compiled against (%d) doesn't support "
-	        "'Snap' function (3.3.0+ required)",
-	        RTGEOM_GEOS_VERSION);
-	return NULL;
+  rterror(ctx, "The GEOS version this rtgeom library "
+          "was compiled against (%d) doesn't support "
+          "'Snap' function (3.3.0+ required)",
+          RTGEOM_GEOS_VERSION);
+  return NULL;
 #else /* RTGEOM_GEOS_VERSION >= 33 */
 
-	int srid, is3d;
-	GEOSGeometry *g1, *g2, *g3;
-	RTGEOM* out;
-
-	srid = geom1->srid;
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
-
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	g2 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom2, 0);
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		return NULL;
-	}
-
-	g3 = GEOSSnap_r(ctx->gctx, g1, g2, tolerance);
-	if (g3 == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		rterror(ctx, "GEOSSnap: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
-	out = GEOS2RTGEOM(ctx, g3, is3d);
-	if (out == NULL)
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g3);
-		rterror(ctx, "GEOSSnap_r(ctx->gctx) threw an error (result RTGEOM geometry formation)!");
-		return NULL;
-	}
-	GEOSGeom_destroy_r(ctx->gctx, g3);
-
-	return out;
+  int srid, is3d;
+  GEOSGeometry *g1, *g2, *g3;
+  RTGEOM* out;
+
+  srid = geom1->srid;
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  g2 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom2, 0);
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    return NULL;
+  }
+
+  g3 = GEOSSnap_r(ctx->gctx, g1, g2, tolerance);
+  if (g3 == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    rterror(ctx, "GEOSSnap: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
+  out = GEOS2RTGEOM(ctx, g3, is3d);
+  if (out == NULL)
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g3);
+    rterror(ctx, "GEOSSnap_r(ctx->gctx) threw an error (result RTGEOM geometry formation)!");
+    return NULL;
+  }
+  GEOSGeom_destroy_r(ctx->gctx, g3);
+
+  return out;
 
 #endif /* RTGEOM_GEOS_VERSION >= 33 */
 }
@@ -1503,60 +1504,60 @@ RTGEOM*
 rtgeom_sharedpaths(const RTCTX *ctx, const RTGEOM* geom1, const RTGEOM* geom2)
 {
 #if RTGEOM_GEOS_VERSION < 33
-	rterror(ctx, "The GEOS version this postgis binary "
-	        "was compiled against (%d) doesn't support "
-	        "'SharedPaths' function (3.3.0+ required)",
-	        RTGEOM_GEOS_VERSION);
-	return NULL;
+  rterror(ctx, "The GEOS version this postgis binary "
+          "was compiled against (%d) doesn't support "
+          "'SharedPaths' function (3.3.0+ required)",
+          RTGEOM_GEOS_VERSION);
+  return NULL;
 #else /* RTGEOM_GEOS_VERSION >= 33 */
-	GEOSGeometry *g1, *g2, *g3;
-	RTGEOM *out;
-	int is3d, srid;
-
-	srid = geom1->srid;
-	error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
-
-	is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom1, 0);
-	if ( 0 == g1 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	g2 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom2, 0);
-	if ( 0 == g2 )   /* exception thrown at construction */
-	{
-		rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		return NULL;
-	}
-
-	g3 = GEOSSharedPaths_r(ctx->gctx, g1,g2);
-
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-
-	if (g3 == NULL)
-	{
-		rterror(ctx, "GEOSSharedPaths: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	GEOSSetSRID_r(ctx->gctx, g3, srid);
-	out = GEOS2RTGEOM(ctx, g3, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, g3);
-
-	if (out == NULL)
-	{
-		rterror(ctx, "GEOS2RTGEOM threw an error");
-		return NULL;
-	}
-
-	return out;
+  GEOSGeometry *g1, *g2, *g3;
+  RTGEOM *out;
+  int is3d, srid;
+
+  srid = geom1->srid;
+  error_if_srid_mismatch(ctx, srid, (int)(geom2->srid));
+
+  is3d = (RTFLAGS_GET_Z(geom1->flags) || RTFLAGS_GET_Z(geom2->flags)) ;
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom1, 0);
+  if ( 0 == g1 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "First argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  g2 = (GEOSGeometry *)RTGEOM2GEOS(ctx, geom2, 0);
+  if ( 0 == g2 )   /* exception thrown at construction */
+  {
+    rterror(ctx, "Second argument geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    return NULL;
+  }
+
+  g3 = GEOSSharedPaths_r(ctx->gctx, g1,g2);
+
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+
+  if (g3 == NULL)
+  {
+    rterror(ctx, "GEOSSharedPaths: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  GEOSSetSRID_r(ctx->gctx, g3, srid);
+  out = GEOS2RTGEOM(ctx, g3, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, g3);
+
+  if (out == NULL)
+  {
+    rterror(ctx, "GEOS2RTGEOM threw an error");
+    return NULL;
+  }
+
+  return out;
 #endif /* RTGEOM_GEOS_VERSION >= 33 */
 }
 
@@ -1564,176 +1565,176 @@ RTGEOM*
 rtgeom_offsetcurve(const RTCTX *ctx, const RTLINE *rtline, double size, int quadsegs, int joinStyle, double mitreLimit)
 {
 #if RTGEOM_GEOS_VERSION < 32
-	rterror(ctx, "rtgeom_offsetcurve: GEOS 3.2 or higher required");
+  rterror(ctx, "rtgeom_offsetcurve: GEOS 3.2 or higher required");
 #else
-	GEOSGeometry *g1, *g3;
-	RTGEOM *rtgeom_result;
-	RTGEOM *rtgeom_in = rtline_as_rtgeom(ctx, rtline);
+  GEOSGeometry *g1, *g3;
+  RTGEOM *rtgeom_result;
+  RTGEOM *rtgeom_in = rtline_as_rtgeom(ctx, rtline);
 
-	rtgeom_geos_ensure_init(ctx);
+  rtgeom_geos_ensure_init(ctx);
 
-	g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, rtgeom_in, 0);
-	if ( ! g1 ) 
-	{
-		rterror(ctx, "rtgeom_offsetcurve: Geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, rtgeom_in, 0);
+  if ( ! g1 )
+  {
+    rterror(ctx, "rtgeom_offsetcurve: Geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
 #if RTGEOM_GEOS_VERSION < 33
-	/* Size is artays positive for GEOSSingleSidedBuffer, and a flag determines left/right */
-	g3 = GEOSSingleSidedBuffer_r(ctx->gctx, g1, size < 0 ? -size : size,
-	                           quadsegs, joinStyle, mitreLimit,
-	                           size < 0 ? 0 : 1);
+  /* Size is artays positive for GEOSSingleSidedBuffer, and a flag determines left/right */
+  g3 = GEOSSingleSidedBuffer_r(ctx->gctx, g1, size < 0 ? -size : size,
+                             quadsegs, joinStyle, mitreLimit,
+                             size < 0 ? 0 : 1);
 #else
-	g3 = GEOSOffsetCurve_r(ctx->gctx, g1, size, quadsegs, joinStyle, mitreLimit);
+  g3 = GEOSOffsetCurve_r(ctx->gctx, g1, size, quadsegs, joinStyle, mitreLimit);
 #endif
-	/* Don't need input geometry anymore */
-	GEOSGeom_destroy_r(ctx->gctx, g1);
+  /* Don't need input geometry anymore */
+  GEOSGeom_destroy_r(ctx->gctx, g1);
 
-	if (g3 == NULL)
-	{
-		rterror(ctx, "GEOSOffsetCurve: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  if (g3 == NULL)
+  {
+    rterror(ctx, "GEOSOffsetCurve: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3));
+  RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3));
 
-	GEOSSetSRID_r(ctx->gctx, g3, rtgeom_get_srid(ctx, rtgeom_in));
-	rtgeom_result = GEOS2RTGEOM(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
-	GEOSGeom_destroy_r(ctx->gctx, g3);
+  GEOSSetSRID_r(ctx->gctx, g3, rtgeom_get_srid(ctx, rtgeom_in));
+  rtgeom_result = GEOS2RTGEOM(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
+  GEOSGeom_destroy_r(ctx->gctx, g3);
 
-	if (rtgeom_result == NULL)
-	{
-		rterror(ctx, "rtgeom_offsetcurve: GEOS2RTGEOM returned null");
-		return NULL;
-	}
+  if (rtgeom_result == NULL)
+  {
+    rterror(ctx, "rtgeom_offsetcurve: GEOS2RTGEOM returned null");
+    return NULL;
+  }
+
+  return rtgeom_result;
 
-	return rtgeom_result;
-	
 #endif /* RTGEOM_GEOS_VERSION < 32 */
 }
 
 RTTIN * rttin_from_geos(const RTCTX *ctx, const GEOSGeometry *geom, int want3d) {
-	int type = GEOSGeomTypeId_r(ctx->gctx, geom);
-	int hasZ;
-	int SRID = GEOSGetSRID_r(ctx->gctx, geom);
-
-	/* GEOS's 0 is equivalent to our unknown as for SRID values */
-	if ( SRID == 0 ) SRID = SRID_UNKNOWN;
-
-	if ( want3d ) {
-		hasZ = GEOSHasZ_r(ctx->gctx, geom);
-		if ( ! hasZ ) {
-			RTDEBUG(3, "Geometry has no Z, won't provide one");
-			want3d = 0;
-		}
-	}
-
-	switch (type) {
-		RTTRIANGLE **geoms;
-		uint32_t i, ngeoms;
-	case GEOS_GEOMETRYCOLLECTION:
-		RTDEBUG(4, "rtgeom_from_geometry: it's a Collection or Multi");
-
-		ngeoms = GEOSGetNumGeometries_r(ctx->gctx, geom);
-		geoms = NULL;
-		if ( ngeoms ) {
-			geoms = rtalloc(ctx, ngeoms * sizeof *geoms);
-			if (!geoms) {
-				rterror(ctx, "rttin_from_geos: can't allocate geoms");
-				return NULL;
-			}
-			for (i=0; i<ngeoms; i++) {
-				const GEOSGeometry *poly, *ring;
-				const GEOSCoordSequence *cs;
-				RTPOINTARRAY *pa;
-
-				poly = GEOSGetGeometryN_r(ctx->gctx, geom, i);
-				ring = GEOSGetExteriorRing_r(ctx->gctx, poly);
-				cs = GEOSGeom_getCoordSeq_r(ctx->gctx, ring);
-				pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
-
-				geoms[i] = rttriangle_construct(ctx, SRID, NULL, pa);
-			}
-		}
-		return (RTTIN *)rtcollection_construct(ctx, RTTINTYPE, SRID, NULL, ngeoms, (RTGEOM **)geoms);
-	case GEOS_POLYGON:
-	case GEOS_MULTIPOINT:
-	case GEOS_MULTILINESTRING:
-	case GEOS_MULTIPOLYGON:
-	case GEOS_LINESTRING:
-	case GEOS_LINEARRING:
-	case GEOS_POINT:
-		rterror(ctx, "rttin_from_geos: invalid geometry type for tin: %d", type);
-		break;
-
-	default:
-		rterror(ctx, "GEOS2RTGEOM: unknown geometry type: %d", type);
-		return NULL;
-	}
-
-	/* shouldn't get here */
-	return NULL;
+  int type = GEOSGeomTypeId_r(ctx->gctx, geom);
+  int hasZ;
+  int SRID = GEOSGetSRID_r(ctx->gctx, geom);
+
+  /* GEOS's 0 is equivalent to our unknown as for SRID values */
+  if ( SRID == 0 ) SRID = SRID_UNKNOWN;
+
+  if ( want3d ) {
+    hasZ = GEOSHasZ_r(ctx->gctx, geom);
+    if ( ! hasZ ) {
+      RTDEBUG(3, "Geometry has no Z, won't provide one");
+      want3d = 0;
+    }
+  }
+
+  switch (type) {
+    RTTRIANGLE **geoms;
+    uint32_t i, ngeoms;
+  case GEOS_GEOMETRYCOLLECTION:
+    RTDEBUG(4, "rtgeom_from_geometry: it's a Collection or Multi");
+
+    ngeoms = GEOSGetNumGeometries_r(ctx->gctx, geom);
+    geoms = NULL;
+    if ( ngeoms ) {
+      geoms = rtalloc(ctx, ngeoms * sizeof *geoms);
+      if (!geoms) {
+        rterror(ctx, "rttin_from_geos: can't allocate geoms");
+        return NULL;
+      }
+      for (i=0; i<ngeoms; i++) {
+        const GEOSGeometry *poly, *ring;
+        const GEOSCoordSequence *cs;
+        RTPOINTARRAY *pa;
+
+        poly = GEOSGetGeometryN_r(ctx->gctx, geom, i);
+        ring = GEOSGetExteriorRing_r(ctx->gctx, poly);
+        cs = GEOSGeom_getCoordSeq_r(ctx->gctx, ring);
+        pa = ptarray_from_GEOSCoordSeq(ctx, cs, want3d);
+
+        geoms[i] = rttriangle_construct(ctx, SRID, NULL, pa);
+      }
+    }
+    return (RTTIN *)rtcollection_construct(ctx, RTTINTYPE, SRID, NULL, ngeoms, (RTGEOM **)geoms);
+  case GEOS_POLYGON:
+  case GEOS_MULTIPOINT:
+  case GEOS_MULTILINESTRING:
+  case GEOS_MULTIPOLYGON:
+  case GEOS_LINESTRING:
+  case GEOS_LINEARRING:
+  case GEOS_POINT:
+    rterror(ctx, "rttin_from_geos: invalid geometry type for tin: %d", type);
+    break;
+
+  default:
+    rterror(ctx, "GEOS2RTGEOM: unknown geometry type: %d", type);
+    return NULL;
+  }
+
+  /* shouldn't get here */
+  return NULL;
 }
 /*
  * output = 1 for edges, 2 for TIN, 0 for polygons
  */
 RTGEOM* rtgeom_delaunay_triangulation(const RTCTX *ctx, const RTGEOM *rtgeom_in, double tolerance, int output) {
 #if RTGEOM_GEOS_VERSION < 34
-	rterror(ctx, "rtgeom_delaunay_triangulation: GEOS 3.4 or higher required");
-	return NULL;
+  rterror(ctx, "rtgeom_delaunay_triangulation: GEOS 3.4 or higher required");
+  return NULL;
 #else
-	GEOSGeometry *g1, *g3;
-	RTGEOM *rtgeom_result;
-
-	if (output < 0 || output > 2) {
-		rterror(ctx, "rtgeom_delaunay_triangulation: invalid output type specified %d", output);
-		return NULL;
-	}
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, rtgeom_in, 0);
-	if ( ! g1 ) 
-	{
-		rterror(ctx, "rtgeom_delaunay_triangulation: Geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* if output != 1 we want polys */
-	g3 = GEOSDelaunayTriangulation_r(ctx->gctx, g1, tolerance, output == 1);
-
-	/* Don't need input geometry anymore */
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-
-	if (g3 == NULL)
-	{
-		rterror(ctx, "GEOSDelaunayTriangulation: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3)); */
-
-	GEOSSetSRID_r(ctx->gctx, g3, rtgeom_get_srid(ctx, rtgeom_in));
-
-	if (output == 2) {
-		rtgeom_result = (RTGEOM *)rttin_from_geos(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
-	} else {
-		rtgeom_result = GEOS2RTGEOM(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, g3);
-
-	if (rtgeom_result == NULL) {
-		if (output != 2) {
-			rterror(ctx, "rtgeom_delaunay_triangulation: GEOS2RTGEOM returned null");
-		} else {
-			rterror(ctx, "rtgeom_delaunay_triangulation: rttin_from_geos returned null");
-		}
-		return NULL;
-	}
-
-	return rtgeom_result;
-	
+  GEOSGeometry *g1, *g3;
+  RTGEOM *rtgeom_result;
+
+  if (output < 0 || output > 2) {
+    rterror(ctx, "rtgeom_delaunay_triangulation: invalid output type specified %d", output);
+    return NULL;
+  }
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = (GEOSGeometry *)RTGEOM2GEOS(ctx, rtgeom_in, 0);
+  if ( ! g1 )
+  {
+    rterror(ctx, "rtgeom_delaunay_triangulation: Geometry could not be converted to GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* if output != 1 we want polys */
+  g3 = GEOSDelaunayTriangulation_r(ctx->gctx, g1, tolerance, output == 1);
+
+  /* Don't need input geometry anymore */
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+
+  if (g3 == NULL)
+  {
+    rterror(ctx, "GEOSDelaunayTriangulation: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* RTDEBUGF(3, "result: %s", GEOSGeomToWKT_r(ctx->gctx, g3)); */
+
+  GEOSSetSRID_r(ctx->gctx, g3, rtgeom_get_srid(ctx, rtgeom_in));
+
+  if (output == 2) {
+    rtgeom_result = (RTGEOM *)rttin_from_geos(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
+  } else {
+    rtgeom_result = GEOS2RTGEOM(ctx, g3, rtgeom_has_z(ctx, rtgeom_in));
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, g3);
+
+  if (rtgeom_result == NULL) {
+    if (output != 2) {
+      rterror(ctx, "rtgeom_delaunay_triangulation: GEOS2RTGEOM returned null");
+    } else {
+      rterror(ctx, "rtgeom_delaunay_triangulation: rttin_from_geos returned null");
+    }
+    return NULL;
+  }
+
+  return rtgeom_result;
+
 #endif /* RTGEOM_GEOS_VERSION < 34 */
 }
diff --git a/src/rtgeom_geos_clean.c b/src/rtgeom_geos_clean.c
index 635a00f..d62c53c 100644
--- a/src/rtgeom_geos_clean.c
+++ b/src/rtgeom_geos_clean.c
@@ -45,71 +45,71 @@
 static GEOSGeometry*
 RTGEOM_GEOS_getPointN(const RTCTX *ctx, const GEOSGeometry* g_in, uint32_t n)
 {
-	uint32_t dims;
-	const GEOSCoordSequence* seq_in;
-	GEOSCoordSeq seq_out;
-	double val;
-	uint32_t sz;
-	int gn;
-	GEOSGeometry* ret;
-
-	switch ( GEOSGeomTypeId_r(ctx->gctx, g_in) )
-	{
-	case GEOS_MULTIPOINT:
-	case GEOS_MULTILINESTRING:
-	case GEOS_MULTIPOLYGON:
-	case GEOS_GEOMETRYCOLLECTION:
-	{
-		for (gn=0; gn<GEOSGetNumGeometries_r(ctx->gctx, g_in); ++gn)
-		{
-			const GEOSGeometry* g = GEOSGetGeometryN_r(ctx->gctx, g_in, gn);
-			ret = RTGEOM_GEOS_getPointN(ctx, g,n);
-			if ( ret ) return ret;
-		}
-		break;
-	}
-
-	case GEOS_POLYGON:
-	{
-		ret = RTGEOM_GEOS_getPointN(ctx, GEOSGetExteriorRing_r(ctx->gctx, g_in), n);
-		if ( ret ) return ret;
-		for (gn=0; gn<GEOSGetNumInteriorRings_r(ctx->gctx, g_in); ++gn)
-		{
-			const GEOSGeometry* g = GEOSGetInteriorRingN_r(ctx->gctx, g_in, gn);
-			ret = RTGEOM_GEOS_getPointN(ctx, g, n);
-			if ( ret ) return ret;
-		}
-		break;
-	}
-
-	case GEOS_POINT:
-	case GEOS_LINESTRING:
-	case GEOS_LINEARRING:
-		break;
-
-	}
-
-	seq_in = GEOSGeom_getCoordSeq_r(ctx->gctx, g_in);
-	if ( ! seq_in ) return NULL;
-	if ( ! GEOSCoordSeq_getSize_r(ctx->gctx, seq_in, &sz) ) return NULL;
-	if ( ! sz ) return NULL;
-
-	if ( ! GEOSCoordSeq_getDimensions_r(ctx->gctx, seq_in, &dims) ) return NULL;
-
-	seq_out = GEOSCoordSeq_create_r(ctx->gctx, 1, dims);
-	if ( ! seq_out ) return NULL;
-
-	if ( ! GEOSCoordSeq_getX_r(ctx->gctx, seq_in, n, &val) ) return NULL;
-	if ( ! GEOSCoordSeq_setX_r(ctx->gctx, seq_out, n, val) ) return NULL;
-	if ( ! GEOSCoordSeq_getY_r(ctx->gctx, seq_in, n, &val) ) return NULL;
-	if ( ! GEOSCoordSeq_setY_r(ctx->gctx, seq_out, n, val) ) return NULL;
-	if ( dims > 2 )
-	{
-		if ( ! GEOSCoordSeq_getZ_r(ctx->gctx, seq_in, n, &val) ) return NULL;
-		if ( ! GEOSCoordSeq_setZ_r(ctx->gctx, seq_out, n, val) ) return NULL;
-	}
-
-	return GEOSGeom_createPoint_r(ctx->gctx, seq_out);
+  uint32_t dims;
+  const GEOSCoordSequence* seq_in;
+  GEOSCoordSeq seq_out;
+  double val;
+  uint32_t sz;
+  int gn;
+  GEOSGeometry* ret;
+
+  switch ( GEOSGeomTypeId_r(ctx->gctx, g_in) )
+  {
+  case GEOS_MULTIPOINT:
+  case GEOS_MULTILINESTRING:
+  case GEOS_MULTIPOLYGON:
+  case GEOS_GEOMETRYCOLLECTION:
+  {
+    for (gn=0; gn<GEOSGetNumGeometries_r(ctx->gctx, g_in); ++gn)
+    {
+      const GEOSGeometry* g = GEOSGetGeometryN_r(ctx->gctx, g_in, gn);
+      ret = RTGEOM_GEOS_getPointN(ctx, g,n);
+      if ( ret ) return ret;
+    }
+    break;
+  }
+
+  case GEOS_POLYGON:
+  {
+    ret = RTGEOM_GEOS_getPointN(ctx, GEOSGetExteriorRing_r(ctx->gctx, g_in), n);
+    if ( ret ) return ret;
+    for (gn=0; gn<GEOSGetNumInteriorRings_r(ctx->gctx, g_in); ++gn)
+    {
+      const GEOSGeometry* g = GEOSGetInteriorRingN_r(ctx->gctx, g_in, gn);
+      ret = RTGEOM_GEOS_getPointN(ctx, g, n);
+      if ( ret ) return ret;
+    }
+    break;
+  }
+
+  case GEOS_POINT:
+  case GEOS_LINESTRING:
+  case GEOS_LINEARRING:
+    break;
+
+  }
+
+  seq_in = GEOSGeom_getCoordSeq_r(ctx->gctx, g_in);
+  if ( ! seq_in ) return NULL;
+  if ( ! GEOSCoordSeq_getSize_r(ctx->gctx, seq_in, &sz) ) return NULL;
+  if ( ! sz ) return NULL;
+
+  if ( ! GEOSCoordSeq_getDimensions_r(ctx->gctx, seq_in, &dims) ) return NULL;
+
+  seq_out = GEOSCoordSeq_create_r(ctx->gctx, 1, dims);
+  if ( ! seq_out ) return NULL;
+
+  if ( ! GEOSCoordSeq_getX_r(ctx->gctx, seq_in, n, &val) ) return NULL;
+  if ( ! GEOSCoordSeq_setX_r(ctx->gctx, seq_out, n, val) ) return NULL;
+  if ( ! GEOSCoordSeq_getY_r(ctx->gctx, seq_in, n, &val) ) return NULL;
+  if ( ! GEOSCoordSeq_setY_r(ctx->gctx, seq_out, n, val) ) return NULL;
+  if ( dims > 2 )
+  {
+    if ( ! GEOSCoordSeq_getZ_r(ctx->gctx, seq_in, n, &val) ) return NULL;
+    if ( ! GEOSCoordSeq_setZ_r(ctx->gctx, seq_out, n, val) ) return NULL;
+  }
+
+  return GEOSGeom_createPoint_r(ctx->gctx, seq_out);
 }
 
 
@@ -128,41 +128,41 @@ RTPOINTARRAY* ring_make_geos_friendly(const RTCTX *ctx, RTPOINTARRAY* ring);
 static RTGEOM *
 rtgeom_make_geos_friendly(const RTCTX *ctx, RTGEOM *geom)
 {
-	RTDEBUGF(2, "rtgeom_make_geos_friendly enter (type %d)", geom->type);
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-	case RTMULTIPOINTTYPE:
-		/* a point is artays valid */
-		return geom;
-		break;
-
-	case RTLINETYPE:
-		/* lines need at least 2 points */
-		return rtline_make_geos_friendly(ctx, (RTLINE *)geom);
-		break;
-
-	case RTPOLYGONTYPE:
-		/* polygons need all rings closed and with npoints > 3 */
-		return rtpoly_make_geos_friendly(ctx, (RTPOLY *)geom);
-		break;
-
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_make_geos_friendly(ctx, (RTCOLLECTION *)geom);
-		break;
-
-	case RTCIRCSTRINGTYPE:
-	case RTCOMPOUNDTYPE:
-	case RTCURVEPOLYTYPE:
-	case RTMULTISURFACETYPE:
-	case RTMULTICURVETYPE:
-	default:
-		rterror(ctx, "rtgeom_make_geos_friendly: unsupported input geometry type: %s (%d)", rttype_name(ctx, geom->type), geom->type);
-		break;
-	}
-	return 0;
+  RTDEBUGF(2, "rtgeom_make_geos_friendly enter (type %d)", geom->type);
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+  case RTMULTIPOINTTYPE:
+    /* a point is artays valid */
+    return geom;
+    break;
+
+  case RTLINETYPE:
+    /* lines need at least 2 points */
+    return rtline_make_geos_friendly(ctx, (RTLINE *)geom);
+    break;
+
+  case RTPOLYGONTYPE:
+    /* polygons need all rings closed and with npoints > 3 */
+    return rtpoly_make_geos_friendly(ctx, (RTPOLY *)geom);
+    break;
+
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_make_geos_friendly(ctx, (RTCOLLECTION *)geom);
+    break;
+
+  case RTCIRCSTRINGTYPE:
+  case RTCOMPOUNDTYPE:
+  case RTCURVEPOLYTYPE:
+  case RTMULTISURFACETYPE:
+  case RTMULTICURVETYPE:
+  default:
+    rterror(ctx, "rtgeom_make_geos_friendly: unsupported input geometry type: %s (%d)", rttype_name(ctx, geom->type), geom->type);
+    break;
+  }
+  return 0;
 }
 
 /*
@@ -175,51 +175,51 @@ RTPOINTARRAY* ptarray_close2d(const RTCTX *ctx, RTPOINTARRAY* ring);
 RTPOINTARRAY*
 ptarray_close2d(const RTCTX *ctx, RTPOINTARRAY* ring)
 {
-	RTPOINTARRAY* newring;
-
-	/* close the ring if not already closed (2d only) */
-	if ( ! ptarray_is_closed_2d(ctx, ring) )
-	{
-		/* close it up */
-		newring = ptarray_addPoint(ctx, ring,
-		                           rt_getPoint_internal(ctx, ring, 0),
-		                           RTFLAGS_NDIMS(ring->flags),
-		                           ring->npoints);
-		ring = newring;
-	}
-	return ring;
+  RTPOINTARRAY* newring;
+
+  /* close the ring if not already closed (2d only) */
+  if ( ! ptarray_is_closed_2d(ctx, ring) )
+  {
+    /* close it up */
+    newring = ptarray_addPoint(ctx, ring,
+                               rt_getPoint_internal(ctx, ring, 0),
+                               RTFLAGS_NDIMS(ring->flags),
+                               ring->npoints);
+    ring = newring;
+  }
+  return ring;
 }
 
 /* May return the same input or a new one (never zero) */
 RTPOINTARRAY*
 ring_make_geos_friendly(const RTCTX *ctx, RTPOINTARRAY* ring)
 {
-	RTPOINTARRAY* closedring;
-	RTPOINTARRAY* ring_in = ring;
-
-	/* close the ring if not already closed (2d only) */
-	closedring = ptarray_close2d(ctx, ring);
-	if (closedring != ring )
-	{
-		ring = closedring;
-	}
-
-	/* return 0 for collapsed ring (after closeup) */
-
-	while ( ring->npoints < 4 )
-	{
-		RTPOINTARRAY *oring = ring;
-		RTDEBUGF(4, "ring has %d points, adding another", ring->npoints);
-		/* let's add another... */
-		ring = ptarray_addPoint(ctx, ring,
-		                        rt_getPoint_internal(ctx, ring, 0),
-		                        RTFLAGS_NDIMS(ring->flags),
-		                        ring->npoints);
-		if ( oring != ring_in ) ptarray_free(ctx, oring);
-	}
-
-
-	return ring;
+  RTPOINTARRAY* closedring;
+  RTPOINTARRAY* ring_in = ring;
+
+  /* close the ring if not already closed (2d only) */
+  closedring = ptarray_close2d(ctx, ring);
+  if (closedring != ring )
+  {
+    ring = closedring;
+  }
+
+  /* return 0 for collapsed ring (after closeup) */
+
+  while ( ring->npoints < 4 )
+  {
+    RTPOINTARRAY *oring = ring;
+    RTDEBUGF(4, "ring has %d points, adding another", ring->npoints);
+    /* let's add another... */
+    ring = ptarray_addPoint(ctx, ring,
+                            rt_getPoint_internal(ctx, ring, 0),
+                            RTFLAGS_NDIMS(ring->flags),
+                            ring->npoints);
+    if ( oring != ring_in ) ptarray_free(ctx, oring);
+  }
+
+
+  return ring;
 }
 
 /* Make sure all rings are closed and have > 3 points.
@@ -228,106 +228,106 @@ ring_make_geos_friendly(const RTCTX *ctx, RTPOINTARRAY* ring)
 RTGEOM *
 rtpoly_make_geos_friendly(const RTCTX *ctx, RTPOLY *poly)
 {
-	RTGEOM* ret;
-	RTPOINTARRAY **new_rings;
-	int i;
-
-	/* If the polygon has no rings there's nothing to do */
-	if ( ! poly->nrings ) return (RTGEOM*)poly;
-
-	/* Allocate enough pointers for all rings */
-	new_rings = rtalloc(ctx, sizeof(RTPOINTARRAY*)*poly->nrings);
-
-	/* All rings must be closed and have > 3 points */
-	for (i=0; i<poly->nrings; i++)
-	{
-		RTPOINTARRAY* ring_in = poly->rings[i];
-		RTPOINTARRAY* ring_out = ring_make_geos_friendly(ctx, ring_in);
-
-		if ( ring_in != ring_out )
-		{
-			RTDEBUGF(3, "rtpoly_make_geos_friendly: ring %d cleaned, now has %d points", i, ring_out->npoints);
-			ptarray_free(ctx, ring_in);
-		}
-		else
-		{
-			RTDEBUGF(3, "rtpoly_make_geos_friendly: ring %d untouched", i);
-		}
-
-		assert ( ring_out );
-		new_rings[i] = ring_out;
-	}
-
-	rtfree(ctx, poly->rings);
-	poly->rings = new_rings;
-	ret = (RTGEOM*)poly;
-
-	return ret;
+  RTGEOM* ret;
+  RTPOINTARRAY **new_rings;
+  int i;
+
+  /* If the polygon has no rings there's nothing to do */
+  if ( ! poly->nrings ) return (RTGEOM*)poly;
+
+  /* Allocate enough pointers for all rings */
+  new_rings = rtalloc(ctx, sizeof(RTPOINTARRAY*)*poly->nrings);
+
+  /* All rings must be closed and have > 3 points */
+  for (i=0; i<poly->nrings; i++)
+  {
+    RTPOINTARRAY* ring_in = poly->rings[i];
+    RTPOINTARRAY* ring_out = ring_make_geos_friendly(ctx, ring_in);
+
+    if ( ring_in != ring_out )
+    {
+      RTDEBUGF(3, "rtpoly_make_geos_friendly: ring %d cleaned, now has %d points", i, ring_out->npoints);
+      ptarray_free(ctx, ring_in);
+    }
+    else
+    {
+      RTDEBUGF(3, "rtpoly_make_geos_friendly: ring %d untouched", i);
+    }
+
+    assert ( ring_out );
+    new_rings[i] = ring_out;
+  }
+
+  rtfree(ctx, poly->rings);
+  poly->rings = new_rings;
+  ret = (RTGEOM*)poly;
+
+  return ret;
 }
 
 /* Need NO or >1 points. Duplicate first if only one. */
 RTGEOM *
 rtline_make_geos_friendly(const RTCTX *ctx, RTLINE *line)
 {
-	RTGEOM *ret;
+  RTGEOM *ret;
 
-	if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
-	{
+  if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
+  {
 #if 1
-		/* Duplicate point */
-		line->points = ptarray_addPoint(ctx, line->points,
-		                                rt_getPoint_internal(ctx, line->points, 0),
-		                                RTFLAGS_NDIMS(line->points->flags),
-		                                line->points->npoints);
-		ret = (RTGEOM*)line;
+    /* Duplicate point */
+    line->points = ptarray_addPoint(ctx, line->points,
+                                    rt_getPoint_internal(ctx, line->points, 0),
+                                    RTFLAGS_NDIMS(line->points->flags),
+                                    line->points->npoints);
+    ret = (RTGEOM*)line;
 #else
-		/* Turn into a point */
-		ret = (RTGEOM*)rtpoint_construct(ctx, line->srid, 0, line->points);
+    /* Turn into a point */
+    ret = (RTGEOM*)rtpoint_construct(ctx, line->srid, 0, line->points);
 #endif
-		return ret;
-	}
-	else
-	{
-		return (RTGEOM*)line;
-		/* return rtline_clone(ctx, line); */
-	}
+    return ret;
+  }
+  else
+  {
+    return (RTGEOM*)line;
+    /* return rtline_clone(ctx, line); */
+  }
 }
 
 RTGEOM *
 rtcollection_make_geos_friendly(const RTCTX *ctx, RTCOLLECTION *g)
 {
-	RTGEOM **new_geoms;
-	uint32_t i, new_ngeoms=0;
-	RTCOLLECTION *ret;
+  RTGEOM **new_geoms;
+  uint32_t i, new_ngeoms=0;
+  RTCOLLECTION *ret;
 
-	/* enough space for all components */
-	new_geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
+  /* enough space for all components */
+  new_geoms = rtalloc(ctx, sizeof(RTGEOM *)*g->ngeoms);
 
-	ret = rtalloc(ctx, sizeof(RTCOLLECTION));
-	memcpy(ret, g, sizeof(RTCOLLECTION));
+  ret = rtalloc(ctx, sizeof(RTCOLLECTION));
+  memcpy(ret, g, sizeof(RTCOLLECTION));
     ret->maxgeoms = g->ngeoms;
 
-	for (i=0; i<g->ngeoms; i++)
-	{
-		RTGEOM* newg = rtgeom_make_geos_friendly(ctx, g->geoms[i]);
-		if ( newg ) new_geoms[new_ngeoms++] = newg;
-	}
-
-	ret->bbox = NULL; /* recompute later... */
-
-	ret->ngeoms = new_ngeoms;
-	if ( new_ngeoms )
-	{
-		ret->geoms = new_geoms;
-	}
-	else
-	{
-		free(new_geoms);
-		ret->geoms = NULL;
+  for (i=0; i<g->ngeoms; i++)
+  {
+    RTGEOM* newg = rtgeom_make_geos_friendly(ctx, g->geoms[i]);
+    if ( newg ) new_geoms[new_ngeoms++] = newg;
+  }
+
+  ret->bbox = NULL; /* recompute later... */
+
+  ret->ngeoms = new_ngeoms;
+  if ( new_ngeoms )
+  {
+    ret->geoms = new_geoms;
+  }
+  else
+  {
+    free(new_geoms);
+    ret->geoms = NULL;
         ret->maxgeoms = 0;
-	}
+  }
 
-	return (RTGEOM*)ret;
+  return (RTGEOM*)ret;
 }
 
 /*
@@ -336,38 +336,38 @@ rtcollection_make_geos_friendly(const RTCTX *ctx, RTCOLLECTION *g)
 static GEOSGeometry*
 RTGEOM_GEOS_nodeLines(const RTCTX *ctx, const GEOSGeometry* lines)
 {
-	GEOSGeometry* noded;
-	GEOSGeometry* point;
-
-	/*
-	 * Union with first geometry point, obtaining full noding
-	 * and dissolving of duplicated repeated points
-	 *
-	 * TODO: substitute this with UnaryUnion?
-	 */
-
-	point = RTGEOM_GEOS_getPointN(ctx, lines, 0);
-	if ( ! point ) return NULL;
-
-	RTDEBUGF(3,
-	               "Boundary point: %s",
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, point, 0)));
-
-	noded = GEOSUnion_r(ctx->gctx, lines, point);
-	if ( NULL == noded )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, point);
-		return NULL;
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, point);
-
-	RTDEBUGF(3,
-	               "RTGEOM_GEOS_nodeLines: in[%s] out[%s]",
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, lines, 0)),
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, noded, 0)));
-
-	return noded;
+  GEOSGeometry* noded;
+  GEOSGeometry* point;
+
+  /*
+   * Union with first geometry point, obtaining full noding
+   * and dissolving of duplicated repeated points
+   *
+   * TODO: substitute this with UnaryUnion?
+   */
+
+  point = RTGEOM_GEOS_getPointN(ctx, lines, 0);
+  if ( ! point ) return NULL;
+
+  RTDEBUGF(3,
+                 "Boundary point: %s",
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, point, 0)));
+
+  noded = GEOSUnion_r(ctx->gctx, lines, point);
+  if ( NULL == noded )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, point);
+    return NULL;
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, point);
+
+  RTDEBUGF(3,
+                 "RTGEOM_GEOS_nodeLines: in[%s] out[%s]",
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, lines, 0)),
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, noded, 0)));
+
+  return noded;
 }
 
 #if RTGEOM_GEOS_VERSION >= 33
@@ -379,409 +379,409 @@ RTGEOM_GEOS_nodeLines(const RTCTX *ctx, const GEOSGeometry* lines)
 static GEOSGeometry*
 RTGEOM_GEOS_makeValidPolygon(const RTCTX *ctx, const GEOSGeometry* gin)
 {
-	GEOSGeom gout;
-	GEOSGeom geos_bound;
-	GEOSGeom geos_cut_edges, geos_area, collapse_points;
-	GEOSGeometry *vgeoms[3]; /* One for area, one for cut-edges */
-	unsigned int nvgeoms=0;
+  GEOSGeom gout;
+  GEOSGeom geos_bound;
+  GEOSGeom geos_cut_edges, geos_area, collapse_points;
+  GEOSGeometry *vgeoms[3]; /* One for area, one for cut-edges */
+  unsigned int nvgeoms=0;
 
-	assert (GEOSGeomTypeId_r(ctx->gctx, gin) == GEOS_POLYGON ||
-	        GEOSGeomTypeId_r(ctx->gctx, gin) == GEOS_MULTIPOLYGON);
+  assert (GEOSGeomTypeId_r(ctx->gctx, gin) == GEOS_POLYGON ||
+          GEOSGeomTypeId_r(ctx->gctx, gin) == GEOS_MULTIPOLYGON);
 
-	geos_bound = GEOSBoundary_r(ctx->gctx, gin);
-	if ( NULL == geos_bound )
-	{
-		return NULL;
-	}
+  geos_bound = GEOSBoundary_r(ctx->gctx, gin);
+  if ( NULL == geos_bound )
+  {
+    return NULL;
+  }
 
-	RTDEBUGF(3,
-	               "Boundaries: %s",
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, geos_bound, 0)));
+  RTDEBUGF(3,
+                 "Boundaries: %s",
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, geos_bound, 0)));
 
-	/* Use noded boundaries as initial "cut" edges */
+  /* Use noded boundaries as initial "cut" edges */
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
   rtnotice(ctx, "ST_MakeValid: noding lines");
 #endif
 
 
-	geos_cut_edges = RTGEOM_GEOS_nodeLines(ctx, geos_bound);
-	if ( NULL == geos_cut_edges )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, geos_bound);
-		rtnotice(ctx, "RTGEOM_GEOS_nodeLines(ctx): %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  geos_cut_edges = RTGEOM_GEOS_nodeLines(ctx, geos_bound);
+  if ( NULL == geos_cut_edges )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, geos_bound);
+    rtnotice(ctx, "RTGEOM_GEOS_nodeLines(ctx): %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
-	/* NOTE: the noding process may drop lines collapsing to points.
-	 *       We want to retrive any of those */
-	{
-		GEOSGeometry* pi;
-		GEOSGeometry* po;
+  /* NOTE: the noding process may drop lines collapsing to points.
+   *       We want to retrive any of those */
+  {
+    GEOSGeometry* pi;
+    GEOSGeometry* po;
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
     rtnotice(ctx, "ST_MakeValid: extracting unique points from bounds");
 #endif
 
-		pi = GEOSGeom_extractUniquePoints_r(ctx->gctx, geos_bound);
-		if ( NULL == pi )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, geos_bound);
-			rtnotice(ctx, "GEOSGeom_extractUniquePoints_r(ctx->gctx): %s",
-			         rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
+    pi = GEOSGeom_extractUniquePoints_r(ctx->gctx, geos_bound);
+    if ( NULL == pi )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, geos_bound);
+      rtnotice(ctx, "GEOSGeom_extractUniquePoints_r(ctx->gctx): %s",
+               rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
 
-		RTDEBUGF(3,
-		               "Boundaries input points %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, pi, 0)));
+    RTDEBUGF(3,
+                   "Boundaries input points %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, pi, 0)));
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
     rtnotice(ctx, "ST_MakeValid: extracting unique points from cut_edges");
 #endif
 
-		po = GEOSGeom_extractUniquePoints_r(ctx->gctx, geos_cut_edges);
-		if ( NULL == po )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, geos_bound);
-			GEOSGeom_destroy_r(ctx->gctx, pi);
-			rtnotice(ctx, "GEOSGeom_extractUniquePoints_r(ctx->gctx): %s",
-			         rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
+    po = GEOSGeom_extractUniquePoints_r(ctx->gctx, geos_cut_edges);
+    if ( NULL == po )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, geos_bound);
+      GEOSGeom_destroy_r(ctx->gctx, pi);
+      rtnotice(ctx, "GEOSGeom_extractUniquePoints_r(ctx->gctx): %s",
+               rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
 
-		RTDEBUGF(3,
-		               "Boundaries output points %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, po, 0)));
+    RTDEBUGF(3,
+                   "Boundaries output points %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, po, 0)));
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
     rtnotice(ctx, "ST_MakeValid: find collapse points");
 #endif
 
-		collapse_points = GEOSDifference_r(ctx->gctx, pi, po);
-		if ( NULL == collapse_points )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, geos_bound);
-			GEOSGeom_destroy_r(ctx->gctx, pi);
-			GEOSGeom_destroy_r(ctx->gctx, po);
-			rtnotice(ctx, "GEOSDifference_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
+    collapse_points = GEOSDifference_r(ctx->gctx, pi, po);
+    if ( NULL == collapse_points )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, geos_bound);
+      GEOSGeom_destroy_r(ctx->gctx, pi);
+      GEOSGeom_destroy_r(ctx->gctx, po);
+      rtnotice(ctx, "GEOSDifference_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
 
-		RTDEBUGF(3,
-		               "Collapse points: %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, collapse_points, 0)));
+    RTDEBUGF(3,
+                   "Collapse points: %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, collapse_points, 0)));
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
     rtnotice(ctx, "ST_MakeValid: cleanup(1)");
 #endif
 
-		GEOSGeom_destroy_r(ctx->gctx, pi);
-		GEOSGeom_destroy_r(ctx->gctx, po);
-	}
-	GEOSGeom_destroy_r(ctx->gctx, geos_bound);
-
-	RTDEBUGF(3,
-	               "Noded Boundaries: %s",
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, geos_cut_edges, 0)));
-
-	/* And use an empty geometry as initial "area" */
-	geos_area = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
-	if ( ! geos_area )
-	{
-		rtnotice(ctx, "GEOSGeom_createEmptyPolygon_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
-		GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-		return NULL;
-	}
-
-	/*
-	 * See if an area can be build with the remaining edges
-	 * and if it can, symdifference with the original area.
-	 * Iterate this until no more polygons can be created
-	 * with left-over edges.
-	 */
-	while (GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges))
-	{
-		GEOSGeometry* new_area=0;
-		GEOSGeometry* new_area_bound=0;
-		GEOSGeometry* symdif=0;
-		GEOSGeometry* new_cut_edges=0;
+    GEOSGeom_destroy_r(ctx->gctx, pi);
+    GEOSGeom_destroy_r(ctx->gctx, po);
+  }
+  GEOSGeom_destroy_r(ctx->gctx, geos_bound);
+
+  RTDEBUGF(3,
+                 "Noded Boundaries: %s",
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, geos_cut_edges, 0)));
+
+  /* And use an empty geometry as initial "area" */
+  geos_area = GEOSGeom_createEmptyPolygon_r(ctx->gctx);
+  if ( ! geos_area )
+  {
+    rtnotice(ctx, "GEOSGeom_createEmptyPolygon_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
+    GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+    return NULL;
+  }
+
+  /*
+   * See if an area can be build with the remaining edges
+   * and if it can, symdifference with the original area.
+   * Iterate this until no more polygons can be created
+   * with left-over edges.
+   */
+  while (GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges))
+  {
+    GEOSGeometry* new_area=0;
+    GEOSGeometry* new_area_bound=0;
+    GEOSGeometry* symdif=0;
+    GEOSGeometry* new_cut_edges=0;
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
-    rtnotice(ctx, "ST_MakeValid: building area from %d edges", GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges)); 
+    rtnotice(ctx, "ST_MakeValid: building area from %d edges", GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges));
 #endif
 
-		/*
-		 * ASSUMPTION: cut_edges should already be fully noded
-		 */
-
-		new_area = RTGEOM_GEOS_buildArea(ctx, geos_cut_edges);
-		if ( ! new_area )   /* must be an exception */
-		{
-			GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-			GEOSGeom_destroy_r(ctx->gctx, geos_area);
-			rtnotice(ctx, "RTGEOM_GEOS_buildArea(ctx) threw an error: %s",
-			         rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-
-		if ( GEOSisEmpty_r(ctx->gctx, new_area) )
-		{
-			/* no more rings can be build with thes edges */
-			GEOSGeom_destroy_r(ctx->gctx, new_area);
-			break;
-		}
-
-		/*
-		 * We succeeded in building a ring !
-		 */
+    /*
+     * ASSUMPTION: cut_edges should already be fully noded
+     */
+
+    new_area = RTGEOM_GEOS_buildArea(ctx, geos_cut_edges);
+    if ( ! new_area )   /* must be an exception */
+    {
+      GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+      GEOSGeom_destroy_r(ctx->gctx, geos_area);
+      rtnotice(ctx, "RTGEOM_GEOS_buildArea(ctx) threw an error: %s",
+               rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+
+    if ( GEOSisEmpty_r(ctx->gctx, new_area) )
+    {
+      /* no more rings can be build with thes edges */
+      GEOSGeom_destroy_r(ctx->gctx, new_area);
+      break;
+    }
+
+    /*
+     * We succeeded in building a ring !
+     */
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
-    rtnotice(ctx, "ST_MakeValid: ring built with %d cut edges, saving boundaries", GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges)); 
+    rtnotice(ctx, "ST_MakeValid: ring built with %d cut edges, saving boundaries", GEOSGetNumGeometries_r(ctx->gctx, geos_cut_edges));
 #endif
 
-		/*
-		 * Save the new ring boundaries first (to compute
-		 * further cut edges later)
-		 */
-		new_area_bound = GEOSBoundary_r(ctx->gctx, new_area);
-		if ( ! new_area_bound )
-		{
-			/* We did check for empty area already so
-			 * this must be some other error */
-			rtnotice(ctx, "GEOSBoundary_r(ctx->gctx, '%s') threw an error: %s",
-			         rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, new_area, 0)),
-			         rtgeom_get_last_geos_error(ctx));
-			GEOSGeom_destroy_r(ctx->gctx, new_area);
-			GEOSGeom_destroy_r(ctx->gctx, geos_area);
-			return NULL;
-		}
+    /*
+     * Save the new ring boundaries first (to compute
+     * further cut edges later)
+     */
+    new_area_bound = GEOSBoundary_r(ctx->gctx, new_area);
+    if ( ! new_area_bound )
+    {
+      /* We did check for empty area already so
+       * this must be some other error */
+      rtnotice(ctx, "GEOSBoundary_r(ctx->gctx, '%s') threw an error: %s",
+               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, new_area, 0)),
+               rtgeom_get_last_geos_error(ctx));
+      GEOSGeom_destroy_r(ctx->gctx, new_area);
+      GEOSGeom_destroy_r(ctx->gctx, geos_area);
+      return NULL;
+    }
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
-    rtnotice(ctx, "ST_MakeValid: running SymDifference with new area"); 
+    rtnotice(ctx, "ST_MakeValid: running SymDifference with new area");
 #endif
 
-		/*
-		 * Now symdif new and old area
-		 */
-		symdif = GEOSSymDifference_r(ctx->gctx, geos_area, new_area);
-		if ( ! symdif )   /* must be an exception */
-		{
-			GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-			GEOSGeom_destroy_r(ctx->gctx, new_area);
-			GEOSGeom_destroy_r(ctx->gctx, new_area_bound);
-			GEOSGeom_destroy_r(ctx->gctx, geos_area);
-			rtnotice(ctx, "GEOSSymDifference_r(ctx->gctx) threw an error: %s",
-			         rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-
-		GEOSGeom_destroy_r(ctx->gctx, geos_area);
-		GEOSGeom_destroy_r(ctx->gctx, new_area);
-		geos_area = symdif;
-		symdif = 0;
-
-		/*
-		 * Now let's re-set geos_cut_edges with what's left
-		 * from the original boundary.
-		 * ASSUMPTION: only the previous cut-edges can be
-		 *             left, so we don't need to reconsider
-		 *             the whole original boundaries
-		 *
-		 * NOTE: this is an expensive operation. 
-		 *
-		 */
+    /*
+     * Now symdif new and old area
+     */
+    symdif = GEOSSymDifference_r(ctx->gctx, geos_area, new_area);
+    if ( ! symdif )   /* must be an exception */
+    {
+      GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+      GEOSGeom_destroy_r(ctx->gctx, new_area);
+      GEOSGeom_destroy_r(ctx->gctx, new_area_bound);
+      GEOSGeom_destroy_r(ctx->gctx, geos_area);
+      rtnotice(ctx, "GEOSSymDifference_r(ctx->gctx) threw an error: %s",
+               rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+
+    GEOSGeom_destroy_r(ctx->gctx, geos_area);
+    GEOSGeom_destroy_r(ctx->gctx, new_area);
+    geos_area = symdif;
+    symdif = 0;
+
+    /*
+     * Now let's re-set geos_cut_edges with what's left
+     * from the original boundary.
+     * ASSUMPTION: only the previous cut-edges can be
+     *             left, so we don't need to reconsider
+     *             the whole original boundaries
+     *
+     * NOTE: this is an expensive operation.
+     *
+     */
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
-    rtnotice(ctx, "ST_MakeValid: computing new cut_edges (GEOSDifference)"); 
+    rtnotice(ctx, "ST_MakeValid: computing new cut_edges (GEOSDifference)");
 #endif
 
-		new_cut_edges = GEOSDifference_r(ctx->gctx, geos_cut_edges, new_area_bound);
-		GEOSGeom_destroy_r(ctx->gctx, new_area_bound);
-		if ( ! new_cut_edges )   /* an exception ? */
-		{
-			/* cleanup and throw */
-			GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-			GEOSGeom_destroy_r(ctx->gctx, geos_area);
-			/* TODO: Shouldn't this be an rterror ? */
-			rtnotice(ctx, "GEOSDifference_r(ctx->gctx) threw an error: %s",
-			         rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-		geos_cut_edges = new_cut_edges;
-	}
+    new_cut_edges = GEOSDifference_r(ctx->gctx, geos_cut_edges, new_area_bound);
+    GEOSGeom_destroy_r(ctx->gctx, new_area_bound);
+    if ( ! new_cut_edges )   /* an exception ? */
+    {
+      /* cleanup and throw */
+      GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+      GEOSGeom_destroy_r(ctx->gctx, geos_area);
+      /* TODO: Shouldn't this be an rterror ? */
+      rtnotice(ctx, "GEOSDifference_r(ctx->gctx) threw an error: %s",
+               rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+    geos_cut_edges = new_cut_edges;
+  }
 
 #ifdef RTGEOM_PROFILE_MAKEVALID
   rtnotice(ctx, "ST_MakeValid: final checks");
 #endif
 
-	if ( ! GEOSisEmpty_r(ctx->gctx, geos_area) )
-	{
-		vgeoms[nvgeoms++] = geos_area;
-	}
-	else
-	{
-		GEOSGeom_destroy_r(ctx->gctx, geos_area);
-	}
-
-	if ( ! GEOSisEmpty_r(ctx->gctx, geos_cut_edges) )
-	{
-		vgeoms[nvgeoms++] = geos_cut_edges;
-	}
-	else
-	{
-		GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
-	}
-
-	if ( ! GEOSisEmpty_r(ctx->gctx, collapse_points) )
-	{
-		vgeoms[nvgeoms++] = collapse_points;
-	}
-	else
-	{
-		GEOSGeom_destroy_r(ctx->gctx, collapse_points);
-	}
-
-	if ( 1 == nvgeoms )
-	{
-		/* Return cut edges */
-		gout = vgeoms[0];
-	}
-	else
-	{
-		/* Collect areas and lines (if any line) */
-		gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);
-		if ( ! gout )   /* an exception again */
-		{
-			/* cleanup and throw */
-			/* TODO: Shouldn't this be an rterror ? */
-			rtnotice(ctx, "GEOSGeom_createCollection_r(ctx->gctx) threw an error: %s",
-			         rtgeom_get_last_geos_error(ctx));
-			/* TODO: cleanup! */
-			return NULL;
-		}
-	}
-
-	return gout;
+  if ( ! GEOSisEmpty_r(ctx->gctx, geos_area) )
+  {
+    vgeoms[nvgeoms++] = geos_area;
+  }
+  else
+  {
+    GEOSGeom_destroy_r(ctx->gctx, geos_area);
+  }
+
+  if ( ! GEOSisEmpty_r(ctx->gctx, geos_cut_edges) )
+  {
+    vgeoms[nvgeoms++] = geos_cut_edges;
+  }
+  else
+  {
+    GEOSGeom_destroy_r(ctx->gctx, geos_cut_edges);
+  }
+
+  if ( ! GEOSisEmpty_r(ctx->gctx, collapse_points) )
+  {
+    vgeoms[nvgeoms++] = collapse_points;
+  }
+  else
+  {
+    GEOSGeom_destroy_r(ctx->gctx, collapse_points);
+  }
+
+  if ( 1 == nvgeoms )
+  {
+    /* Return cut edges */
+    gout = vgeoms[0];
+  }
+  else
+  {
+    /* Collect areas and lines (if any line) */
+    gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);
+    if ( ! gout )   /* an exception again */
+    {
+      /* cleanup and throw */
+      /* TODO: Shouldn't this be an rterror ? */
+      rtnotice(ctx, "GEOSGeom_createCollection_r(ctx->gctx) threw an error: %s",
+               rtgeom_get_last_geos_error(ctx));
+      /* TODO: cleanup! */
+      return NULL;
+    }
+  }
+
+  return gout;
 
 }
 
 static GEOSGeometry*
 RTGEOM_GEOS_makeValidLine(const RTCTX *ctx, const GEOSGeometry* gin)
 {
-	GEOSGeometry* noded;
-	noded = RTGEOM_GEOS_nodeLines(ctx, gin);
-	return noded;
+  GEOSGeometry* noded;
+  noded = RTGEOM_GEOS_nodeLines(ctx, gin);
+  return noded;
 }
 
 static GEOSGeometry*
 RTGEOM_GEOS_makeValidMultiLine(const RTCTX *ctx, const GEOSGeometry* gin)
 {
-	GEOSGeometry** lines;
-	GEOSGeometry** points;
-	GEOSGeometry* mline_out=0;
-	GEOSGeometry* mpoint_out=0;
-	GEOSGeometry* gout=0;
-	uint32_t nlines=0, nlines_alloc;
-	uint32_t npoints=0;
-	uint32_t ngeoms=0, nsubgeoms;
-	uint32_t i, j;
-
-	ngeoms = GEOSGetNumGeometries_r(ctx->gctx, gin);
-
-	nlines_alloc = ngeoms;
-	lines = rtalloc(ctx, sizeof(GEOSGeometry*)*nlines_alloc);
-	points = rtalloc(ctx, sizeof(GEOSGeometry*)*ngeoms);
-
-	for (i=0; i<ngeoms; ++i)
-	{
-		const GEOSGeometry* g = GEOSGetGeometryN_r(ctx->gctx, gin, i);
-		GEOSGeometry* vg;
-		vg = RTGEOM_GEOS_makeValidLine(ctx, g);
-		if ( GEOSisEmpty_r(ctx->gctx, vg) )
-		{
-			/* we don't care about this one */
-			GEOSGeom_destroy_r(ctx->gctx, vg);
-		}
-		if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_POINT )
-		{
-			points[npoints++] = vg;
-		}
-		else if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_LINESTRING )
-		{
-			lines[nlines++] = vg;
-		}
-		else if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_MULTILINESTRING )
-		{
-			nsubgeoms=GEOSGetNumGeometries_r(ctx->gctx, vg);
-			nlines_alloc += nsubgeoms;
-			lines = rtrealloc(ctx, lines, sizeof(GEOSGeometry*)*nlines_alloc);
-			for (j=0; j<nsubgeoms; ++j)
-			{
-				const GEOSGeometry* gc = GEOSGetGeometryN_r(ctx->gctx, vg, j);
-				/* NOTE: ownership of the cloned geoms will be
-				 *       taken by final collection */
-				lines[nlines++] = GEOSGeom_clone_r(ctx->gctx, gc);
-			}
-		}
-		else
-		{
-			/* NOTE: return from GEOSGeomType will leak
-			 * but we really don't expect this to happen */
-			rterror(ctx, "unexpected geom type returned "
-			        "by RTGEOM_GEOS_makeValid: %s",
-			        GEOSGeomType_r(ctx->gctx, vg));
-		}
-	}
-
-	if ( npoints )
-	{
-		if ( npoints > 1 )
-		{
-			mpoint_out = GEOSGeom_createCollection_r(ctx->gctx, GEOS_MULTIPOINT,
-			                                       points, npoints);
-		}
-		else
-		{
-			mpoint_out = points[0];
-		}
-	}
-
-	if ( nlines )
-	{
-		if ( nlines > 1 )
-		{
-			mline_out = GEOSGeom_createCollection_r(ctx->gctx, 
-			                GEOS_MULTILINESTRING, lines, nlines);
-		}
-		else
-		{
-			mline_out = lines[0];
-		}
-	}
-
-	rtfree(ctx, lines);
-
-	if ( mline_out && mpoint_out )
-	{
-		points[0] = mline_out;
-		points[1] = mpoint_out;
-		gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION,
-		                                 points, 2);
-	}
-	else if ( mline_out )
-	{
-		gout = mline_out;
-	}
-	else if ( mpoint_out )
-	{
-		gout = mpoint_out;
-	}
-
-	rtfree(ctx, points);
-
-	return gout;
+  GEOSGeometry** lines;
+  GEOSGeometry** points;
+  GEOSGeometry* mline_out=0;
+  GEOSGeometry* mpoint_out=0;
+  GEOSGeometry* gout=0;
+  uint32_t nlines=0, nlines_alloc;
+  uint32_t npoints=0;
+  uint32_t ngeoms=0, nsubgeoms;
+  uint32_t i, j;
+
+  ngeoms = GEOSGetNumGeometries_r(ctx->gctx, gin);
+
+  nlines_alloc = ngeoms;
+  lines = rtalloc(ctx, sizeof(GEOSGeometry*)*nlines_alloc);
+  points = rtalloc(ctx, sizeof(GEOSGeometry*)*ngeoms);
+
+  for (i=0; i<ngeoms; ++i)
+  {
+    const GEOSGeometry* g = GEOSGetGeometryN_r(ctx->gctx, gin, i);
+    GEOSGeometry* vg;
+    vg = RTGEOM_GEOS_makeValidLine(ctx, g);
+    if ( GEOSisEmpty_r(ctx->gctx, vg) )
+    {
+      /* we don't care about this one */
+      GEOSGeom_destroy_r(ctx->gctx, vg);
+    }
+    if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_POINT )
+    {
+      points[npoints++] = vg;
+    }
+    else if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_LINESTRING )
+    {
+      lines[nlines++] = vg;
+    }
+    else if ( GEOSGeomTypeId_r(ctx->gctx, vg) == GEOS_MULTILINESTRING )
+    {
+      nsubgeoms=GEOSGetNumGeometries_r(ctx->gctx, vg);
+      nlines_alloc += nsubgeoms;
+      lines = rtrealloc(ctx, lines, sizeof(GEOSGeometry*)*nlines_alloc);
+      for (j=0; j<nsubgeoms; ++j)
+      {
+        const GEOSGeometry* gc = GEOSGetGeometryN_r(ctx->gctx, vg, j);
+        /* NOTE: ownership of the cloned geoms will be
+         *       taken by final collection */
+        lines[nlines++] = GEOSGeom_clone_r(ctx->gctx, gc);
+      }
+    }
+    else
+    {
+      /* NOTE: return from GEOSGeomType will leak
+       * but we really don't expect this to happen */
+      rterror(ctx, "unexpected geom type returned "
+              "by RTGEOM_GEOS_makeValid: %s",
+              GEOSGeomType_r(ctx->gctx, vg));
+    }
+  }
+
+  if ( npoints )
+  {
+    if ( npoints > 1 )
+    {
+      mpoint_out = GEOSGeom_createCollection_r(ctx->gctx, GEOS_MULTIPOINT,
+                                             points, npoints);
+    }
+    else
+    {
+      mpoint_out = points[0];
+    }
+  }
+
+  if ( nlines )
+  {
+    if ( nlines > 1 )
+    {
+      mline_out = GEOSGeom_createCollection_r(ctx->gctx,
+                      GEOS_MULTILINESTRING, lines, nlines);
+    }
+    else
+    {
+      mline_out = lines[0];
+    }
+  }
+
+  rtfree(ctx, lines);
+
+  if ( mline_out && mpoint_out )
+  {
+    points[0] = mline_out;
+    points[1] = mpoint_out;
+    gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION,
+                                     points, 2);
+  }
+  else if ( mline_out )
+  {
+    gout = mline_out;
+  }
+  else if ( mpoint_out )
+  {
+    gout = mpoint_out;
+  }
+
+  rtfree(ctx, points);
+
+  return gout;
 }
 
 static GEOSGeometry* RTGEOM_GEOS_makeValid(const RTCTX *ctx, const GEOSGeometry*);
@@ -793,47 +793,47 @@ static GEOSGeometry* RTGEOM_GEOS_makeValid(const RTCTX *ctx, const GEOSGeometry*
 static GEOSGeometry*
 RTGEOM_GEOS_makeValidCollection(const RTCTX *ctx, const GEOSGeometry* gin)
 {
-	int nvgeoms;
-	GEOSGeometry **vgeoms;
-	GEOSGeom gout;
-	unsigned int i;
-
-	nvgeoms = GEOSGetNumGeometries_r(ctx->gctx, gin);
-	if ( nvgeoms == -1 ) {
-		rterror(ctx, "GEOSGetNumGeometries: %s", rtgeom_get_last_geos_error(ctx));
-		return 0;
-	}
-
-	vgeoms = rtalloc(ctx,  sizeof(GEOSGeometry*) * nvgeoms );
-	if ( ! vgeoms ) {
-		rterror(ctx, "RTGEOM_GEOS_makeValidCollection: out of memory");
-		return 0;
-	}
-
-	for ( i=0; i<nvgeoms; ++i ) {
-		vgeoms[i] = RTGEOM_GEOS_makeValid(ctx,  GEOSGetGeometryN_r(ctx->gctx, gin, i) );
-		if ( ! vgeoms[i] ) {
-			while (i--) GEOSGeom_destroy_r(ctx->gctx, vgeoms[i]);
-			rtfree(ctx, vgeoms);
-			/* we expect rterror being called already by makeValid */
-			return NULL;
-		}
-	}
-
-	/* Collect areas and lines (if any line) */
-	gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);
-	if ( ! gout )   /* an exception again */
-	{
-		/* cleanup and throw */
-		for ( i=0; i<nvgeoms; ++i ) GEOSGeom_destroy_r(ctx->gctx, vgeoms[i]);
-		rtfree(ctx, vgeoms);
-		rterror(ctx, "GEOSGeom_createCollection_r(ctx->gctx) threw an error: %s",
-		         rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	rtfree(ctx, vgeoms);
-
-	return gout;
+  int nvgeoms;
+  GEOSGeometry **vgeoms;
+  GEOSGeom gout;
+  unsigned int i;
+
+  nvgeoms = GEOSGetNumGeometries_r(ctx->gctx, gin);
+  if ( nvgeoms == -1 ) {
+    rterror(ctx, "GEOSGetNumGeometries: %s", rtgeom_get_last_geos_error(ctx));
+    return 0;
+  }
+
+  vgeoms = rtalloc(ctx,  sizeof(GEOSGeometry*) * nvgeoms );
+  if ( ! vgeoms ) {
+    rterror(ctx, "RTGEOM_GEOS_makeValidCollection: out of memory");
+    return 0;
+  }
+
+  for ( i=0; i<nvgeoms; ++i ) {
+    vgeoms[i] = RTGEOM_GEOS_makeValid(ctx,  GEOSGetGeometryN_r(ctx->gctx, gin, i) );
+    if ( ! vgeoms[i] ) {
+      while (i--) GEOSGeom_destroy_r(ctx->gctx, vgeoms[i]);
+      rtfree(ctx, vgeoms);
+      /* we expect rterror being called already by makeValid */
+      return NULL;
+    }
+  }
+
+  /* Collect areas and lines (if any line) */
+  gout = GEOSGeom_createCollection_r(ctx->gctx, GEOS_GEOMETRYCOLLECTION, vgeoms, nvgeoms);
+  if ( ! gout )   /* an exception again */
+  {
+    /* cleanup and throw */
+    for ( i=0; i<nvgeoms; ++i ) GEOSGeom_destroy_r(ctx->gctx, vgeoms[i]);
+    rtfree(ctx, vgeoms);
+    rterror(ctx, "GEOSGeom_createCollection_r(ctx->gctx) threw an error: %s",
+             rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  rtfree(ctx, vgeoms);
+
+  return gout;
 
 }
 
@@ -841,218 +841,218 @@ RTGEOM_GEOS_makeValidCollection(const RTCTX *ctx, const GEOSGeometry* gin)
 static GEOSGeometry*
 RTGEOM_GEOS_makeValid(const RTCTX *ctx, const GEOSGeometry* gin)
 {
-	GEOSGeometry* gout;
-	char ret_char;
-
-	/*
-	 * Step 2: return what we got so far if already valid
-	 */
-
-	ret_char = GEOSisValid_r(ctx->gctx, gin);
-	if ( ret_char == 2 )
-	{
-		/* I don't think should ever happen */
-		rterror(ctx, "GEOSisValid_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	else if ( ret_char )
-	{
-		RTDEBUGF(3,
-		               "Geometry [%s] is valid. ",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, gin, 0)));
-
-		/* It's valid at this step, return what we have */
-		return GEOSGeom_clone_r(ctx->gctx, gin);
-	}
-
-	RTDEBUGF(3,
-	               "Geometry [%s] is still not valid: %s. "
-	               "Will try to clean up further.",
-	               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, gin, 0)), rtgeom_get_last_geos_error(ctx));
-
-
-
-	/*
-	 * Step 3 : make what we got valid
-	 */
-
-	switch (GEOSGeomTypeId_r(ctx->gctx, gin))
-	{
-	case GEOS_MULTIPOINT:
-	case GEOS_POINT:
-		/* points are artays valid, but we might have invalid ordinate values */
-		rtnotice(ctx, "PUNTUAL geometry resulted invalid to GEOS -- dunno how to clean that up");
-		return NULL;
-		break;
-
-	case GEOS_LINESTRING:
-		gout = RTGEOM_GEOS_makeValidLine(ctx, gin);
-		if ( ! gout )  /* an exception or something */
-		{
-			/* cleanup and throw */
-			rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		break; /* we've done */
-
-	case GEOS_MULTILINESTRING:
-		gout = RTGEOM_GEOS_makeValidMultiLine(ctx, gin);
-		if ( ! gout )  /* an exception or something */
-		{
-			/* cleanup and throw */
-			rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		break; /* we've done */
-
-	case GEOS_POLYGON:
-	case GEOS_MULTIPOLYGON:
-	{
-		gout = RTGEOM_GEOS_makeValidPolygon(ctx, gin);
-		if ( ! gout )  /* an exception or something */
-		{
-			/* cleanup and throw */
-			rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		break; /* we've done */
-	}
-
-	case GEOS_GEOMETRYCOLLECTION:
-	{
-		gout = RTGEOM_GEOS_makeValidCollection(ctx, gin);
-		if ( ! gout )  /* an exception or something */
-		{
-			/* cleanup and throw */
-			rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		break; /* we've done */
-	}
-
-	default:
-	{
-		char* typname = GEOSGeomType_r(ctx->gctx, gin);
-		rtnotice(ctx, "ST_MakeValid: doesn't support geometry type: %s",
-		         typname);
-		GEOSFree_r(ctx->gctx, typname);
-		return NULL;
-		break;
-	}
-	}
+  GEOSGeometry* gout;
+  char ret_char;
+
+  /*
+   * Step 2: return what we got so far if already valid
+   */
+
+  ret_char = GEOSisValid_r(ctx->gctx, gin);
+  if ( ret_char == 2 )
+  {
+    /* I don't think should ever happen */
+    rterror(ctx, "GEOSisValid_r(ctx->gctx): %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  else if ( ret_char )
+  {
+    RTDEBUGF(3,
+                   "Geometry [%s] is valid. ",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, gin, 0)));
+
+    /* It's valid at this step, return what we have */
+    return GEOSGeom_clone_r(ctx->gctx, gin);
+  }
+
+  RTDEBUGF(3,
+                 "Geometry [%s] is still not valid: %s. "
+                 "Will try to clean up further.",
+                 rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, gin, 0)), rtgeom_get_last_geos_error(ctx));
+
+
+
+  /*
+   * Step 3 : make what we got valid
+   */
+
+  switch (GEOSGeomTypeId_r(ctx->gctx, gin))
+  {
+  case GEOS_MULTIPOINT:
+  case GEOS_POINT:
+    /* points are artays valid, but we might have invalid ordinate values */
+    rtnotice(ctx, "PUNTUAL geometry resulted invalid to GEOS -- dunno how to clean that up");
+    return NULL;
+    break;
+
+  case GEOS_LINESTRING:
+    gout = RTGEOM_GEOS_makeValidLine(ctx, gin);
+    if ( ! gout )  /* an exception or something */
+    {
+      /* cleanup and throw */
+      rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    break; /* we've done */
+
+  case GEOS_MULTILINESTRING:
+    gout = RTGEOM_GEOS_makeValidMultiLine(ctx, gin);
+    if ( ! gout )  /* an exception or something */
+    {
+      /* cleanup and throw */
+      rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    break; /* we've done */
+
+  case GEOS_POLYGON:
+  case GEOS_MULTIPOLYGON:
+  {
+    gout = RTGEOM_GEOS_makeValidPolygon(ctx, gin);
+    if ( ! gout )  /* an exception or something */
+    {
+      /* cleanup and throw */
+      rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    break; /* we've done */
+  }
+
+  case GEOS_GEOMETRYCOLLECTION:
+  {
+    gout = RTGEOM_GEOS_makeValidCollection(ctx, gin);
+    if ( ! gout )  /* an exception or something */
+    {
+      /* cleanup and throw */
+      rterror(ctx, "%s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    break; /* we've done */
+  }
+
+  default:
+  {
+    char* typname = GEOSGeomType_r(ctx->gctx, gin);
+    rtnotice(ctx, "ST_MakeValid: doesn't support geometry type: %s",
+             typname);
+    GEOSFree_r(ctx->gctx, typname);
+    return NULL;
+    break;
+  }
+  }
 
 #if PARANOIA_LEVEL > 1
-	/*
-	 * Now check if every point of input is also found
-	 * in output, or abort by returning NULL
-	 *
-	 * Input geometry was rtgeom_in
-	 */
-	{
-			int loss;
-			GEOSGeometry *pi, *po, *pd;
-
-			/* TODO: handle some errors here...
-			 * Lack of exceptions is annoying indeed,
-			 * I'm getting old --strk;
-			 */
-			pi = GEOSGeom_extractUniquePoints_r(ctx->gctx, gin);
-			po = GEOSGeom_extractUniquePoints_r(ctx->gctx, gout);
-			pd = GEOSDifference_r(ctx->gctx, pi, po); /* input points - output points */
-			GEOSGeom_destroy_r(ctx->gctx, pi);
-			GEOSGeom_destroy_r(ctx->gctx, po);
-			loss = !GEOSisEmpty_r(ctx->gctx, pd);
-			GEOSGeom_destroy_r(ctx->gctx, pd);
-			if ( loss )
-			{
-				rtnotice(ctx, "Vertices lost in RTGEOM_GEOS_makeValid");
-				/* return NULL */
-			}
-	}
+  /*
+   * Now check if every point of input is also found
+   * in output, or abort by returning NULL
+   *
+   * Input geometry was rtgeom_in
+   */
+  {
+      int loss;
+      GEOSGeometry *pi, *po, *pd;
+
+      /* TODO: handle some errors here...
+       * Lack of exceptions is annoying indeed,
+       * I'm getting old --strk;
+       */
+      pi = GEOSGeom_extractUniquePoints_r(ctx->gctx, gin);
+      po = GEOSGeom_extractUniquePoints_r(ctx->gctx, gout);
+      pd = GEOSDifference_r(ctx->gctx, pi, po); /* input points - output points */
+      GEOSGeom_destroy_r(ctx->gctx, pi);
+      GEOSGeom_destroy_r(ctx->gctx, po);
+      loss = !GEOSisEmpty_r(ctx->gctx, pd);
+      GEOSGeom_destroy_r(ctx->gctx, pd);
+      if ( loss )
+      {
+        rtnotice(ctx, "Vertices lost in RTGEOM_GEOS_makeValid");
+        /* return NULL */
+      }
+  }
 #endif /* PARANOIA_LEVEL > 1 */
 
 
-	return gout;
+  return gout;
 }
 
 /* Exported. Uses GEOS internally */
 RTGEOM*
 rtgeom_make_valid(const RTCTX *ctx, RTGEOM* rtgeom_in)
 {
-	int is3d;
-	GEOSGeom geosgeom;
-	GEOSGeometry* geosout;
-	RTGEOM *rtgeom_out;
-
-	is3d = RTFLAGS_GET_Z(rtgeom_in->flags);
-
-	/*
-	 * Step 1 : try to convert to GEOS, if impossible, clean that up first
-	 *          otherwise (adding only duplicates of existing points)
-	 */
-
-	rtgeom_geos_ensure_init(ctx);
-
-	rtgeom_out = rtgeom_in;
-	geosgeom = RTGEOM2GEOS(ctx, rtgeom_out, 0);
-	if ( ! geosgeom )
-	{
-		RTDEBUGF(4,
-		               "Original geom can't be converted to GEOS _r(ctx->gctx, %s)"
-		               " - will try cleaning that up first",
-		               rtgeom_get_last_geos_error(ctx));
-
-
-		rtgeom_out = rtgeom_make_geos_friendly(ctx, rtgeom_out);
-		if ( ! rtgeom_out )
-		{
-			rterror(ctx, "Could not make a valid geometry out of input");
-		}
-
-		/* try again as we did cleanup now */
-		/* TODO: invoke RTGEOM2GEOS directly with autoclean ? */
-		geosgeom = RTGEOM2GEOS(ctx, rtgeom_out, 0);
-		if ( ! geosgeom )
-		{
-			rterror(ctx, "Couldn't convert RTGEOM geom to GEOS: %s",
-			        rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-
-	}
-	else
-	{
-		RTDEBUG(4, "original geom converted to GEOS");
-		rtgeom_out = rtgeom_in;
-	}
-
-	geosout = RTGEOM_GEOS_makeValid(ctx, geosgeom);
-	GEOSGeom_destroy_r(ctx->gctx, geosgeom);
-	if ( ! geosout )
-	{
-		return NULL;
-	}
-
-	rtgeom_out = GEOS2RTGEOM(ctx, geosout, is3d);
-	GEOSGeom_destroy_r(ctx->gctx, geosout);
-
-	if ( rtgeom_is_collection(ctx, rtgeom_in) && ! rtgeom_is_collection(ctx, rtgeom_out) )
-	{{
-		RTGEOM **ogeoms = rtalloc(ctx, sizeof(RTGEOM*));
-		RTGEOM *ogeom;
-		RTDEBUG(3, "rtgeom_make_valid: forcing multi");
-		/* NOTE: this is safe because rtgeom_out is surely not rtgeom_in or
-		 * otherwise we couldn't have a collection and a non-collection */
-		assert(rtgeom_in != rtgeom_out);
-		ogeoms[0] = rtgeom_out;
-		ogeom = (RTGEOM *)rtcollection_construct(ctx, RTMULTITYPE[rtgeom_out->type],
-		                          rtgeom_out->srid, rtgeom_out->bbox, 1, ogeoms);
-		rtgeom_out->bbox = NULL;
-		rtgeom_out = ogeom;
-	}}
-
-	rtgeom_out->srid = rtgeom_in->srid;
-	return rtgeom_out;
+  int is3d;
+  GEOSGeom geosgeom;
+  GEOSGeometry* geosout;
+  RTGEOM *rtgeom_out;
+
+  is3d = RTFLAGS_GET_Z(rtgeom_in->flags);
+
+  /*
+   * Step 1 : try to convert to GEOS, if impossible, clean that up first
+   *          otherwise (adding only duplicates of existing points)
+   */
+
+  rtgeom_geos_ensure_init(ctx);
+
+  rtgeom_out = rtgeom_in;
+  geosgeom = RTGEOM2GEOS(ctx, rtgeom_out, 0);
+  if ( ! geosgeom )
+  {
+    RTDEBUGF(4,
+                   "Original geom can't be converted to GEOS _r(ctx->gctx, %s)"
+                   " - will try cleaning that up first",
+                   rtgeom_get_last_geos_error(ctx));
+
+
+    rtgeom_out = rtgeom_make_geos_friendly(ctx, rtgeom_out);
+    if ( ! rtgeom_out )
+    {
+      rterror(ctx, "Could not make a valid geometry out of input");
+    }
+
+    /* try again as we did cleanup now */
+    /* TODO: invoke RTGEOM2GEOS directly with autoclean ? */
+    geosgeom = RTGEOM2GEOS(ctx, rtgeom_out, 0);
+    if ( ! geosgeom )
+    {
+      rterror(ctx, "Couldn't convert RTGEOM geom to GEOS: %s",
+              rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+
+  }
+  else
+  {
+    RTDEBUG(4, "original geom converted to GEOS");
+    rtgeom_out = rtgeom_in;
+  }
+
+  geosout = RTGEOM_GEOS_makeValid(ctx, geosgeom);
+  GEOSGeom_destroy_r(ctx->gctx, geosgeom);
+  if ( ! geosout )
+  {
+    return NULL;
+  }
+
+  rtgeom_out = GEOS2RTGEOM(ctx, geosout, is3d);
+  GEOSGeom_destroy_r(ctx->gctx, geosout);
+
+  if ( rtgeom_is_collection(ctx, rtgeom_in) && ! rtgeom_is_collection(ctx, rtgeom_out) )
+  {{
+    RTGEOM **ogeoms = rtalloc(ctx, sizeof(RTGEOM*));
+    RTGEOM *ogeom;
+    RTDEBUG(3, "rtgeom_make_valid: forcing multi");
+    /* NOTE: this is safe because rtgeom_out is surely not rtgeom_in or
+     * otherwise we couldn't have a collection and a non-collection */
+    assert(rtgeom_in != rtgeom_out);
+    ogeoms[0] = rtgeom_out;
+    ogeom = (RTGEOM *)rtcollection_construct(ctx, RTMULTITYPE[rtgeom_out->type],
+                              rtgeom_out->srid, rtgeom_out->bbox, 1, ogeoms);
+    rtgeom_out->bbox = NULL;
+    rtgeom_out = ogeom;
+  }}
+
+  rtgeom_out->srid = rtgeom_in->srid;
+  return rtgeom_out;
 }
 
 #endif /* RTGEOM_GEOS_VERSION >= 33 */
diff --git a/src/rtgeom_geos_node.c b/src/rtgeom_geos_node.c
index cea91c3..6cedeb8 100644
--- a/src/rtgeom_geos_node.c
+++ b/src/rtgeom_geos_node.c
@@ -33,61 +33,61 @@
 static int
 rtgeom_ngeoms(const RTCTX *ctx, const RTGEOM* n)
 {
-	const RTCOLLECTION* c = rtgeom_as_rtcollection(ctx, n);
-	if ( c ) return c->ngeoms;
-	else return 1;
+  const RTCOLLECTION* c = rtgeom_as_rtcollection(ctx, n);
+  if ( c ) return c->ngeoms;
+  else return 1;
 }
 
 static const RTGEOM*
 rtgeom_subgeom(const RTCTX *ctx, const RTGEOM* g, int n)
 {
-	const RTCOLLECTION* c = rtgeom_as_rtcollection(ctx, g);
-	if ( c ) return rtcollection_getsubgeom(ctx, (RTCOLLECTION*)c, n);
-	else return g;
+  const RTCOLLECTION* c = rtgeom_as_rtcollection(ctx, g);
+  if ( c ) return rtcollection_getsubgeom(ctx, (RTCOLLECTION*)c, n);
+  else return g;
 }
 
 
 static void
 rtgeom_collect_endpoints(const RTCTX *ctx, const RTGEOM* rtg, RTMPOINT* col)
 {
-	int i, n;
-	RTLINE* l;
-
-	switch (rtg->type)
-	{
-		case RTMULTILINETYPE:
-			for ( i = 0,
-			        n = rtgeom_ngeoms(ctx, rtg);
-			      i < n; ++i )
-			{
-				rtgeom_collect_endpoints(ctx, 
-					rtgeom_subgeom(ctx, rtg, i),
-					col);
-			}
-			break;
-		case RTLINETYPE:
-			l = (RTLINE*)rtg;
-			col = rtmpoint_add_rtpoint(ctx, col,
-				rtline_get_rtpoint(ctx, l, 0));
-			col = rtmpoint_add_rtpoint(ctx, col,
-				rtline_get_rtpoint(ctx, l, l->points->npoints-1));
-			break;
-		default:
-			rterror(ctx, "rtgeom_collect_endpoints: invalid type %s",
-				rttype_name(ctx, rtg->type));
-			break;
-	}
+  int i, n;
+  RTLINE* l;
+
+  switch (rtg->type)
+  {
+    case RTMULTILINETYPE:
+      for ( i = 0,
+              n = rtgeom_ngeoms(ctx, rtg);
+            i < n; ++i )
+      {
+        rtgeom_collect_endpoints(ctx,
+          rtgeom_subgeom(ctx, rtg, i),
+          col);
+      }
+      break;
+    case RTLINETYPE:
+      l = (RTLINE*)rtg;
+      col = rtmpoint_add_rtpoint(ctx, col,
+        rtline_get_rtpoint(ctx, l, 0));
+      col = rtmpoint_add_rtpoint(ctx, col,
+        rtline_get_rtpoint(ctx, l, l->points->npoints-1));
+      break;
+    default:
+      rterror(ctx, "rtgeom_collect_endpoints: invalid type %s",
+        rttype_name(ctx, rtg->type));
+      break;
+  }
 }
 
 static RTMPOINT*
 rtgeom_extract_endpoints(const RTCTX *ctx, const RTGEOM* rtg)
 {
-	RTMPOINT* col = rtmpoint_construct_empty(ctx, SRID_UNKNOWN,
-	                              RTFLAGS_GET_Z(rtg->flags),
-	                              RTFLAGS_GET_M(rtg->flags));
-	rtgeom_collect_endpoints(ctx, rtg, col);
+  RTMPOINT* col = rtmpoint_construct_empty(ctx, SRID_UNKNOWN,
+                                RTFLAGS_GET_Z(rtg->flags),
+                                RTFLAGS_GET_M(rtg->flags));
+  rtgeom_collect_endpoints(ctx, rtg, col);
 
-	return col;
+  return col;
 }
 
 /* Assumes rtgeom_geos_ensure_init(ctx) was called */
@@ -96,40 +96,40 @@ static RTGEOM*
 rtgeom_extract_unique_endpoints(const RTCTX *ctx, const RTGEOM* rtg)
 {
 #if RTGEOM_GEOS_VERSION < 33
-	rterror(ctx, "The GEOS version this postgis binary "
-	        "was compiled against (%d) doesn't support "
-	        "'GEOSUnaryUnion' function _r(ctx->gctx, 3.3.0+ required)",
-	        RTGEOM_GEOS_VERSION);
-	return NULL;
+  rterror(ctx, "The GEOS version this postgis binary "
+          "was compiled against (%d) doesn't support "
+          "'GEOSUnaryUnion' function _r(ctx->gctx, 3.3.0+ required)",
+          RTGEOM_GEOS_VERSION);
+  return NULL;
 #else /* RTGEOM_GEOS_VERSION >= 33 */
-	RTGEOM* ret;
-	GEOSGeometry *gepu;
-	RTMPOINT *epall = rtgeom_extract_endpoints(ctx, rtg);
-	GEOSGeometry *gepall = RTGEOM2GEOS(ctx, (RTGEOM*)epall, 1);
-	rtmpoint_free(ctx, epall);
-	if ( ! gepall ) {
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* UnaryUnion to remove duplicates */
-	/* TODO: do it all within pgis using indices */
-	gepu = GEOSUnaryUnion_r(ctx->gctx, gepall);
-	if ( ! gepu ) {
-		GEOSGeom_destroy_r(ctx->gctx, gepall);
-		rterror(ctx, "GEOSUnaryUnion: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	GEOSGeom_destroy_r(ctx->gctx, gepall);
-
-	ret = GEOS2RTGEOM(ctx, gepu, RTFLAGS_GET_Z(rtg->flags));
-	GEOSGeom_destroy_r(ctx->gctx, gepu);
-	if ( ! ret ) {
-		rterror(ctx, "Error during GEOS2RTGEOM");
-		return NULL;
-	}
-
-	return ret;
+  RTGEOM* ret;
+  GEOSGeometry *gepu;
+  RTMPOINT *epall = rtgeom_extract_endpoints(ctx, rtg);
+  GEOSGeometry *gepall = RTGEOM2GEOS(ctx, (RTGEOM*)epall, 1);
+  rtmpoint_free(ctx, epall);
+  if ( ! gepall ) {
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* UnaryUnion to remove duplicates */
+  /* TODO: do it all within pgis using indices */
+  gepu = GEOSUnaryUnion_r(ctx->gctx, gepall);
+  if ( ! gepu ) {
+    GEOSGeom_destroy_r(ctx->gctx, gepall);
+    rterror(ctx, "GEOSUnaryUnion: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  GEOSGeom_destroy_r(ctx->gctx, gepall);
+
+  ret = GEOS2RTGEOM(ctx, gepu, RTFLAGS_GET_Z(rtg->flags));
+  GEOSGeom_destroy_r(ctx->gctx, gepu);
+  if ( ! ret ) {
+    rterror(ctx, "Error during GEOS2RTGEOM");
+    return NULL;
+  }
+
+  return ret;
 #endif /* RTGEOM_GEOS_VERSION >= 33 */
 }
 
@@ -139,131 +139,131 @@ RTGEOM*
 rtgeom_node(const RTCTX *ctx, const RTGEOM* rtgeom_in)
 {
 #if RTGEOM_GEOS_VERSION < 33
-	rterror(ctx, "The GEOS version this postgis binary "
-	        "was compiled against (%d) doesn't support "
-	        "'GEOSUnaryUnion' function _r(ctx->gctx, 3.3.0+ required)",
-	        RTGEOM_GEOS_VERSION);
-	return NULL;
+  rterror(ctx, "The GEOS version this postgis binary "
+          "was compiled against (%d) doesn't support "
+          "'GEOSUnaryUnion' function _r(ctx->gctx, 3.3.0+ required)",
+          RTGEOM_GEOS_VERSION);
+  return NULL;
 #else /* RTGEOM_GEOS_VERSION >= 33 */
-	GEOSGeometry *g1, *gu, *gm;
-	RTGEOM *ep, *lines;
-	RTCOLLECTION *col, *tc;
-	int pn, ln, np, nl;
-
-	if ( rtgeom_dimension(ctx, rtgeom_in) != 1 ) {
-		rterror(ctx, "Noding geometries of dimension != 1 is unsupported");
-		return NULL;
-	}
-
-	rtgeom_geos_ensure_init(ctx);
-	g1 = RTGEOM2GEOS(ctx, rtgeom_in, 1);
-	if ( ! g1 ) {
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	ep = rtgeom_extract_unique_endpoints(ctx, rtgeom_in);
-	if ( ! ep ) {
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "Error extracting unique endpoints from input");
-		return NULL;
-	}
-
-	/* Unary union input to fully node */
-	gu = GEOSUnaryUnion_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	if ( ! gu ) {
-		rtgeom_free(ctx, ep);
-		rterror(ctx, "GEOSUnaryUnion: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* Linemerge (in case of overlaps) */
-	gm = GEOSLineMerge_r(ctx->gctx, gu);
-	GEOSGeom_destroy_r(ctx->gctx, gu);
-	if ( ! gm ) {
-		rtgeom_free(ctx, ep);
-		rterror(ctx, "GEOSLineMerge: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	lines = GEOS2RTGEOM(ctx, gm, RTFLAGS_GET_Z(rtgeom_in->flags));
-	GEOSGeom_destroy_r(ctx->gctx, gm);
-	if ( ! lines ) {
-		rtgeom_free(ctx, ep);
-		rterror(ctx, "Error during GEOS2RTGEOM");
-		return NULL;
-	}
-
-	/*
-	 * Reintroduce endpoints from input, using split-line-by-point.
-	 * Note that by now we can be sure that each point splits at 
-	 * most _one_ segment as any point shared by multiple segments
-	 * would already be a node. Also we can be sure that any of
-	 * the segments endpoints won't split any other segment.
-	 * We can use the above 2 assertions to early exit the loop.
-	 */
-
-	col = rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtgeom_in->srid,
-	                              RTFLAGS_GET_Z(rtgeom_in->flags),
-	                              RTFLAGS_GET_M(rtgeom_in->flags));
-
-	np = rtgeom_ngeoms(ctx, ep);
-	for (pn=0; pn<np; ++pn) { /* for each point */
-
-		const RTPOINT* p = (RTPOINT*)rtgeom_subgeom(ctx, ep, pn);
-
-		nl = rtgeom_ngeoms(ctx, lines);
-		for (ln=0; ln<nl; ++ln) { /* for each line */
-
-			const RTLINE* l = (RTLINE*)rtgeom_subgeom(ctx, lines, ln);
-
-			int s = rtline_split_by_point_to(ctx, l, p, (RTMLINE*)col);
-
-			if ( ! s ) continue; /* not on this line */
-
-			if ( s == 1 ) {
-				/* found on this line, but not splitting it */
-				break;
-			}
-
-			/* splits this line */
-
-			/* replace this line with the two splits */
-			if ( rtgeom_is_collection(ctx, lines) ) {
-				tc = (RTCOLLECTION*)lines;
-				rtcollection_reserve(ctx, tc, nl + 1);
-				while (nl > ln+1) {
-					tc->geoms[nl] = tc->geoms[nl-1];
-					--nl;
-				}
-				rtgeom_free(ctx, tc->geoms[ln]);
-				tc->geoms[ln]   = col->geoms[0];
-				tc->geoms[ln+1] = col->geoms[1];
-				tc->ngeoms++;
-			} else {
-				rtgeom_free(ctx, lines);
-				/* transfer ownership rather than cloning */
-				lines = (RTGEOM*)rtcollection_clone_deep(ctx, col);
-				assert(col->ngeoms == 2);
-				rtgeom_free(ctx, col->geoms[0]);
-				rtgeom_free(ctx, col->geoms[1]);
-			}
-
-			/* reset the vector */
-			assert(col->ngeoms == 2);
-			col->ngeoms = 0;
-
-			break;
-		}
-
-	}
-
-	rtgeom_free(ctx, ep);
-	rtcollection_free(ctx, col);
-
-	lines->srid = rtgeom_in->srid;
-	return (RTGEOM*)lines;
+  GEOSGeometry *g1, *gu, *gm;
+  RTGEOM *ep, *lines;
+  RTCOLLECTION *col, *tc;
+  int pn, ln, np, nl;
+
+  if ( rtgeom_dimension(ctx, rtgeom_in) != 1 ) {
+    rterror(ctx, "Noding geometries of dimension != 1 is unsupported");
+    return NULL;
+  }
+
+  rtgeom_geos_ensure_init(ctx);
+  g1 = RTGEOM2GEOS(ctx, rtgeom_in, 1);
+  if ( ! g1 ) {
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  ep = rtgeom_extract_unique_endpoints(ctx, rtgeom_in);
+  if ( ! ep ) {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "Error extracting unique endpoints from input");
+    return NULL;
+  }
+
+  /* Unary union input to fully node */
+  gu = GEOSUnaryUnion_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  if ( ! gu ) {
+    rtgeom_free(ctx, ep);
+    rterror(ctx, "GEOSUnaryUnion: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* Linemerge (in case of overlaps) */
+  gm = GEOSLineMerge_r(ctx->gctx, gu);
+  GEOSGeom_destroy_r(ctx->gctx, gu);
+  if ( ! gm ) {
+    rtgeom_free(ctx, ep);
+    rterror(ctx, "GEOSLineMerge: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  lines = GEOS2RTGEOM(ctx, gm, RTFLAGS_GET_Z(rtgeom_in->flags));
+  GEOSGeom_destroy_r(ctx->gctx, gm);
+  if ( ! lines ) {
+    rtgeom_free(ctx, ep);
+    rterror(ctx, "Error during GEOS2RTGEOM");
+    return NULL;
+  }
+
+  /*
+   * Reintroduce endpoints from input, using split-line-by-point.
+   * Note that by now we can be sure that each point splits at
+   * most _one_ segment as any point shared by multiple segments
+   * would already be a node. Also we can be sure that any of
+   * the segments endpoints won't split any other segment.
+   * We can use the above 2 assertions to early exit the loop.
+   */
+
+  col = rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtgeom_in->srid,
+                                RTFLAGS_GET_Z(rtgeom_in->flags),
+                                RTFLAGS_GET_M(rtgeom_in->flags));
+
+  np = rtgeom_ngeoms(ctx, ep);
+  for (pn=0; pn<np; ++pn) { /* for each point */
+
+    const RTPOINT* p = (RTPOINT*)rtgeom_subgeom(ctx, ep, pn);
+
+    nl = rtgeom_ngeoms(ctx, lines);
+    for (ln=0; ln<nl; ++ln) { /* for each line */
+
+      const RTLINE* l = (RTLINE*)rtgeom_subgeom(ctx, lines, ln);
+
+      int s = rtline_split_by_point_to(ctx, l, p, (RTMLINE*)col);
+
+      if ( ! s ) continue; /* not on this line */
+
+      if ( s == 1 ) {
+        /* found on this line, but not splitting it */
+        break;
+      }
+
+      /* splits this line */
+
+      /* replace this line with the two splits */
+      if ( rtgeom_is_collection(ctx, lines) ) {
+        tc = (RTCOLLECTION*)lines;
+        rtcollection_reserve(ctx, tc, nl + 1);
+        while (nl > ln+1) {
+          tc->geoms[nl] = tc->geoms[nl-1];
+          --nl;
+        }
+        rtgeom_free(ctx, tc->geoms[ln]);
+        tc->geoms[ln]   = col->geoms[0];
+        tc->geoms[ln+1] = col->geoms[1];
+        tc->ngeoms++;
+      } else {
+        rtgeom_free(ctx, lines);
+        /* transfer ownership rather than cloning */
+        lines = (RTGEOM*)rtcollection_clone_deep(ctx, col);
+        assert(col->ngeoms == 2);
+        rtgeom_free(ctx, col->geoms[0]);
+        rtgeom_free(ctx, col->geoms[1]);
+      }
+
+      /* reset the vector */
+      assert(col->ngeoms == 2);
+      col->ngeoms = 0;
+
+      break;
+    }
+
+  }
+
+  rtgeom_free(ctx, ep);
+  rtcollection_free(ctx, col);
+
+  lines->srid = rtgeom_in->srid;
+  return (RTGEOM*)lines;
 #endif /* RTGEOM_GEOS_VERSION >= 33 */
 }
 
diff --git a/src/rtgeom_geos_split.c b/src/rtgeom_geos_split.c
index 3437a6d..ef4a4a8 100644
--- a/src/rtgeom_geos_split.c
+++ b/src/rtgeom_geos_split.c
@@ -42,130 +42,130 @@ static RTGEOM* rtpoly_split(const RTCTX *ctx, const RTPOLY* rtpoly_in, const RTG
 static RTGEOM*
 rtline_split_by_line(const RTCTX *ctx, const RTLINE* rtline_in, const RTGEOM* blade_in)
 {
-	RTGEOM** components;
-	RTGEOM* diff;
-	RTCOLLECTION* out;
-	GEOSGeometry* gdiff; /* difference */
-	GEOSGeometry* g1;
-	GEOSGeometry* g2;
-	int ret;
-
-	/* ASSERT blade_in is LINE or MULTILINE */
-	assert (blade_in->type == RTLINETYPE ||
-	        blade_in->type == RTMULTILINETYPE ||
-	        blade_in->type == RTPOLYGONTYPE ||
-	        blade_in->type == RTMULTIPOLYGONTYPE );
-
-	/* Possible outcomes:
-	 *
-	 *  1. The lines do not cross or overlap
-	 *      -> Return a collection with single element
-	 *  2. The lines cross
-	 *      -> Return a collection of all elements resulting from the split
-	 */
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = RTGEOM2GEOS(ctx, (RTGEOM*)rtline_in, 0);
-	if ( ! g1 )
-	{
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	g2 = RTGEOM2GEOS(ctx, blade_in, 0);
-	if ( ! g2 )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* If blade is a polygon, pick its boundary */
-	if ( blade_in->type == RTPOLYGONTYPE || blade_in->type == RTMULTIPOLYGONTYPE )
-	{
-		gdiff = GEOSBoundary_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		if ( ! gdiff )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, g1);
-			rterror(ctx, "GEOSBoundary: %s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-		g2 = gdiff; gdiff = NULL;
-	}
-
-	/* If interior intersecton is linear we can't split */
-	ret = GEOSRelatePattern_r(ctx->gctx, g1, g2, "1********");
-	if ( 2 == ret )
-	{
-		rterror(ctx, "GEOSRelatePattern: %s", rtgeom_get_last_geos_error(ctx));
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		return NULL;
-	}
-	if ( ret )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		rterror(ctx, "Splitter line has linear intersection with input");
-		return NULL;
-	}
-
-
-	gdiff = GEOSDifference_r(ctx->gctx, g1,g2);
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-	if (gdiff == NULL)
-	{
-		rterror(ctx, "GEOSDifference: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	diff = GEOS2RTGEOM(ctx, gdiff, RTFLAGS_GET_Z(rtline_in->flags));
-	GEOSGeom_destroy_r(ctx->gctx, gdiff);
-	if (NULL == diff)
-	{
-		rterror(ctx, "GEOS2RTGEOM: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	out = rtgeom_as_rtcollection(ctx, diff);
-	if ( ! out )
-	{
-		components = rtalloc(ctx, sizeof(RTGEOM*)*1);
-		components[0] = diff;
-		out = rtcollection_construct(ctx, RTCOLLECTIONTYPE, rtline_in->srid,
-		                             NULL, 1, components);
-	}
-	else
-	{
-	  /* Set SRID */
-		rtgeom_set_srid(ctx, (RTGEOM*)out, rtline_in->srid);
-	  /* Force collection type */
-	  out->type = RTCOLLECTIONTYPE;
-	}
-
-
-	return (RTGEOM*)out;
+  RTGEOM** components;
+  RTGEOM* diff;
+  RTCOLLECTION* out;
+  GEOSGeometry* gdiff; /* difference */
+  GEOSGeometry* g1;
+  GEOSGeometry* g2;
+  int ret;
+
+  /* ASSERT blade_in is LINE or MULTILINE */
+  assert (blade_in->type == RTLINETYPE ||
+          blade_in->type == RTMULTILINETYPE ||
+          blade_in->type == RTPOLYGONTYPE ||
+          blade_in->type == RTMULTIPOLYGONTYPE );
+
+  /* Possible outcomes:
+   *
+   *  1. The lines do not cross or overlap
+   *      -> Return a collection with single element
+   *  2. The lines cross
+   *      -> Return a collection of all elements resulting from the split
+   */
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = RTGEOM2GEOS(ctx, (RTGEOM*)rtline_in, 0);
+  if ( ! g1 )
+  {
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  g2 = RTGEOM2GEOS(ctx, blade_in, 0);
+  if ( ! g2 )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* If blade is a polygon, pick its boundary */
+  if ( blade_in->type == RTPOLYGONTYPE || blade_in->type == RTMULTIPOLYGONTYPE )
+  {
+    gdiff = GEOSBoundary_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    if ( ! gdiff )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, g1);
+      rterror(ctx, "GEOSBoundary: %s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+    g2 = gdiff; gdiff = NULL;
+  }
+
+  /* If interior intersecton is linear we can't split */
+  ret = GEOSRelatePattern_r(ctx->gctx, g1, g2, "1********");
+  if ( 2 == ret )
+  {
+    rterror(ctx, "GEOSRelatePattern: %s", rtgeom_get_last_geos_error(ctx));
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    return NULL;
+  }
+  if ( ret )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    rterror(ctx, "Splitter line has linear intersection with input");
+    return NULL;
+  }
+
+
+  gdiff = GEOSDifference_r(ctx->gctx, g1,g2);
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+  if (gdiff == NULL)
+  {
+    rterror(ctx, "GEOSDifference: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  diff = GEOS2RTGEOM(ctx, gdiff, RTFLAGS_GET_Z(rtline_in->flags));
+  GEOSGeom_destroy_r(ctx->gctx, gdiff);
+  if (NULL == diff)
+  {
+    rterror(ctx, "GEOS2RTGEOM: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  out = rtgeom_as_rtcollection(ctx, diff);
+  if ( ! out )
+  {
+    components = rtalloc(ctx, sizeof(RTGEOM*)*1);
+    components[0] = diff;
+    out = rtcollection_construct(ctx, RTCOLLECTIONTYPE, rtline_in->srid,
+                                 NULL, 1, components);
+  }
+  else
+  {
+    /* Set SRID */
+    rtgeom_set_srid(ctx, (RTGEOM*)out, rtline_in->srid);
+    /* Force collection type */
+    out->type = RTCOLLECTIONTYPE;
+  }
+
+
+  return (RTGEOM*)out;
 }
 
 static RTGEOM*
 rtline_split_by_point(const RTCTX *ctx, const RTLINE* rtline_in, const RTPOINT* blade_in)
 {
-	RTMLINE* out;
+  RTMLINE* out;
 
-	out = rtmline_construct_empty(ctx, rtline_in->srid,
-		RTFLAGS_GET_Z(rtline_in->flags),
-		RTFLAGS_GET_M(rtline_in->flags));
-	if ( rtline_split_by_point_to(ctx, rtline_in, blade_in, out) < 2 )
-	{
-		rtmline_add_rtline(ctx, out, rtline_clone_deep(ctx, rtline_in));
-	}
+  out = rtmline_construct_empty(ctx, rtline_in->srid,
+    RTFLAGS_GET_Z(rtline_in->flags),
+    RTFLAGS_GET_M(rtline_in->flags));
+  if ( rtline_split_by_point_to(ctx, rtline_in, blade_in, out) < 2 )
+  {
+    rtmline_add_rtline(ctx, out, rtline_clone_deep(ctx, rtline_in));
+  }
 
-	/* Turn multiline into collection */
-	out->type = RTCOLLECTIONTYPE;
+  /* Turn multiline into collection */
+  out->type = RTCOLLECTIONTYPE;
 
-	return (RTGEOM*)out;
+  return (RTGEOM*)out;
 }
 
 static RTGEOM*
@@ -209,337 +209,337 @@ int
 rtline_split_by_point_to(const RTCTX *ctx, const RTLINE* rtline_in, const RTPOINT* blade_in,
                          RTMLINE* v)
 {
-	double loc, dist;
-	RTPOINT4D pt, pt_projected;
-	RTPOINTARRAY* pa1;
-	RTPOINTARRAY* pa2;
-	double vstol; /* vertex snap tolerance */
-
-	/* Possible outcomes:
-	 *
-	 *  1. The point is not on the line or on the boundary
-	 *      -> Leave collection untouched, return 0
-	 *  2. The point is on the boundary
-	 *      -> Leave collection untouched, return 1
-	 *  3. The point is in the line
-	 *      -> Push 2 elements on the collection:
-	 *         o start_point - cut_point
-	 *         o cut_point - last_point
-	 *      -> Return 2
-	 */
-
-	rt_getPoint4d_p(ctx, blade_in->point, 0, &pt);
-	loc = ptarray_locate_point(ctx, rtline_in->points, &pt, &dist, &pt_projected);
-
-	/* rtnotice(ctx, "Location: %g -- Distance: %g", loc, dist); */
-
-	if ( dist > 0 )   /* TODO: accept a tolerance ? */
-	{
-		/* No intersection */
-		return 0;
-	}
-
-	if ( loc == 0 || loc == 1 )
-	{
-		/* Intersection is on the boundary */
-		return 1;
-	}
-
-	/* There is a real intersection, let's get two substrings */
-
-	/* Compute vertex snap tolerance based on line length
-	 * TODO: take as parameter ? */
-	vstol = ptarray_length_2d(ctx, rtline_in->points) / 1e14;
-
-	pa1 = ptarray_substring(ctx, rtline_in->points, 0, loc, vstol);
-	pa2 = ptarray_substring(ctx, rtline_in->points, loc, 1, vstol);
-
-	/* NOTE: I've seen empty pointarrays with loc != 0 and loc != 1 */
-	if ( pa1->npoints == 0 || pa2->npoints == 0 ) {
-		ptarray_free(ctx, pa1);
-		ptarray_free(ctx, pa2);
-		/* Intersection is on the boundary */
-		return 1;
-	}
-
-	rtmline_add_rtline(ctx, v, rtline_construct(ctx, SRID_UNKNOWN, NULL, pa1));
-	rtmline_add_rtline(ctx, v, rtline_construct(ctx, SRID_UNKNOWN, NULL, pa2));
-	return 2;
+  double loc, dist;
+  RTPOINT4D pt, pt_projected;
+  RTPOINTARRAY* pa1;
+  RTPOINTARRAY* pa2;
+  double vstol; /* vertex snap tolerance */
+
+  /* Possible outcomes:
+   *
+   *  1. The point is not on the line or on the boundary
+   *      -> Leave collection untouched, return 0
+   *  2. The point is on the boundary
+   *      -> Leave collection untouched, return 1
+   *  3. The point is in the line
+   *      -> Push 2 elements on the collection:
+   *         o start_point - cut_point
+   *         o cut_point - last_point
+   *      -> Return 2
+   */
+
+  rt_getPoint4d_p(ctx, blade_in->point, 0, &pt);
+  loc = ptarray_locate_point(ctx, rtline_in->points, &pt, &dist, &pt_projected);
+
+  /* rtnotice(ctx, "Location: %g -- Distance: %g", loc, dist); */
+
+  if ( dist > 0 )   /* TODO: accept a tolerance ? */
+  {
+    /* No intersection */
+    return 0;
+  }
+
+  if ( loc == 0 || loc == 1 )
+  {
+    /* Intersection is on the boundary */
+    return 1;
+  }
+
+  /* There is a real intersection, let's get two substrings */
+
+  /* Compute vertex snap tolerance based on line length
+   * TODO: take as parameter ? */
+  vstol = ptarray_length_2d(ctx, rtline_in->points) / 1e14;
+
+  pa1 = ptarray_substring(ctx, rtline_in->points, 0, loc, vstol);
+  pa2 = ptarray_substring(ctx, rtline_in->points, loc, 1, vstol);
+
+  /* NOTE: I've seen empty pointarrays with loc != 0 and loc != 1 */
+  if ( pa1->npoints == 0 || pa2->npoints == 0 ) {
+    ptarray_free(ctx, pa1);
+    ptarray_free(ctx, pa2);
+    /* Intersection is on the boundary */
+    return 1;
+  }
+
+  rtmline_add_rtline(ctx, v, rtline_construct(ctx, SRID_UNKNOWN, NULL, pa1));
+  rtmline_add_rtline(ctx, v, rtline_construct(ctx, SRID_UNKNOWN, NULL, pa2));
+  return 2;
 }
 
 static RTGEOM*
 rtline_split(const RTCTX *ctx, const RTLINE* rtline_in, const RTGEOM* blade_in)
 {
-	switch (blade_in->type)
-	{
-	case RTPOINTTYPE:
-		return rtline_split_by_point(ctx, rtline_in, (RTPOINT*)blade_in);
-	case RTMULTIPOINTTYPE:
-		return rtline_split_by_mpoint(ctx, rtline_in, (RTMPOINT*)blade_in);
-
-	case RTLINETYPE:
-	case RTMULTILINETYPE:
-	case RTPOLYGONTYPE:
-	case RTMULTIPOLYGONTYPE:
-		return rtline_split_by_line(ctx, rtline_in, blade_in);
-
-	default:
-		rterror(ctx, "Splitting a Line by a %s is unsupported",
-		        rttype_name(ctx, blade_in->type));
-		return NULL;
-	}
-	return NULL;
+  switch (blade_in->type)
+  {
+  case RTPOINTTYPE:
+    return rtline_split_by_point(ctx, rtline_in, (RTPOINT*)blade_in);
+  case RTMULTIPOINTTYPE:
+    return rtline_split_by_mpoint(ctx, rtline_in, (RTMPOINT*)blade_in);
+
+  case RTLINETYPE:
+  case RTMULTILINETYPE:
+  case RTPOLYGONTYPE:
+  case RTMULTIPOLYGONTYPE:
+    return rtline_split_by_line(ctx, rtline_in, blade_in);
+
+  default:
+    rterror(ctx, "Splitting a Line by a %s is unsupported",
+            rttype_name(ctx, blade_in->type));
+    return NULL;
+  }
+  return NULL;
 }
 
 /* Initializes and uses GEOS internally */
 static RTGEOM*
 rtpoly_split_by_line(const RTCTX *ctx, const RTPOLY* rtpoly_in, const RTLINE* blade_in)
 {
-	RTCOLLECTION* out;
-	GEOSGeometry* g1;
-	GEOSGeometry* g2;
-	GEOSGeometry* g1_bounds;
-	GEOSGeometry* polygons;
-	const GEOSGeometry *vgeoms[1];
-	int i,n;
-	int hasZ = RTFLAGS_GET_Z(rtpoly_in->flags);
-
-
-	/* Possible outcomes:
-	 *
-	 *  1. The line does not split the polygon
-	 *      -> Return a collection with single element
-	 *  2. The line does split the polygon
-	 *      -> Return a collection of all elements resulting from the split
-	 */
-
-	rtgeom_geos_ensure_init(ctx);
-
-	g1 = RTGEOM2GEOS(ctx, (RTGEOM*)rtpoly_in, 0);
-	if ( NULL == g1 )
-	{
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-	g1_bounds = GEOSBoundary_r(ctx->gctx, g1);
-	if ( NULL == g1_bounds )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		rterror(ctx, "GEOSBoundary: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	g2 = RTGEOM2GEOS(ctx, (RTGEOM*)blade_in, 0);
-	if ( NULL == g2 )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-		rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	vgeoms[0] = GEOSUnion_r(ctx->gctx, g1_bounds, g2);
-	if ( NULL == vgeoms[0] )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-		rterror(ctx, "GEOSUnion: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
-
-	/* debugging..
-		rtnotice(ctx, "Bounds poly: %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, g1_bounds, hasZ)));
-		rtnotice(ctx, "Line: %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, g2, hasZ)));
-
-		rtnotice(ctx, "Noded bounds: %s",
-		               rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, vgeoms[0], hasZ)));
-	*/
-
-	polygons = GEOSPolygonize_r(ctx->gctx, vgeoms, 1);
-	if ( NULL == polygons )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-		GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
-		rterror(ctx, "GEOSPolygonize: %s", rtgeom_get_last_geos_error(ctx));
-		return NULL;
-	}
+  RTCOLLECTION* out;
+  GEOSGeometry* g1;
+  GEOSGeometry* g2;
+  GEOSGeometry* g1_bounds;
+  GEOSGeometry* polygons;
+  const GEOSGeometry *vgeoms[1];
+  int i,n;
+  int hasZ = RTFLAGS_GET_Z(rtpoly_in->flags);
+
+
+  /* Possible outcomes:
+   *
+   *  1. The line does not split the polygon
+   *      -> Return a collection with single element
+   *  2. The line does split the polygon
+   *      -> Return a collection of all elements resulting from the split
+   */
+
+  rtgeom_geos_ensure_init(ctx);
+
+  g1 = RTGEOM2GEOS(ctx, (RTGEOM*)rtpoly_in, 0);
+  if ( NULL == g1 )
+  {
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+  g1_bounds = GEOSBoundary_r(ctx->gctx, g1);
+  if ( NULL == g1_bounds )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    rterror(ctx, "GEOSBoundary: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  g2 = RTGEOM2GEOS(ctx, (RTGEOM*)blade_in, 0);
+  if ( NULL == g2 )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+    rterror(ctx, "RTGEOM2GEOS: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  vgeoms[0] = GEOSUnion_r(ctx->gctx, g1_bounds, g2);
+  if ( NULL == vgeoms[0] )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+    rterror(ctx, "GEOSUnion: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
+
+  /* debugging..
+    rtnotice(ctx, "Bounds poly: %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, g1_bounds, hasZ)));
+    rtnotice(ctx, "Line: %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, g2, hasZ)));
+
+    rtnotice(ctx, "Noded bounds: %s",
+                   rtgeom_to_ewkt(ctx, GEOS2RTGEOM(ctx, vgeoms[0], hasZ)));
+  */
+
+  polygons = GEOSPolygonize_r(ctx->gctx, vgeoms, 1);
+  if ( NULL == polygons )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+    GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
+    rterror(ctx, "GEOSPolygonize: %s", rtgeom_get_last_geos_error(ctx));
+    return NULL;
+  }
 
 #if PARANOIA_LEVEL > 0
-	if ( GEOSGeometryTypeId_r(ctx->gctx, polygons) != RTCOLLECTIONTYPE )
-	{
-		GEOSGeom_destroy_r(ctx->gctx, g1);
-		GEOSGeom_destroy_r(ctx->gctx, g2);
-		GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-		GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
-		GEOSGeom_destroy_r(ctx->gctx, polygons);
-		rterror(ctx, "Unexpected return from GEOSpolygonize");
-		return 0;
-	}
+  if ( GEOSGeometryTypeId_r(ctx->gctx, polygons) != RTCOLLECTIONTYPE )
+  {
+    GEOSGeom_destroy_r(ctx->gctx, g1);
+    GEOSGeom_destroy_r(ctx->gctx, g2);
+    GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+    GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
+    GEOSGeom_destroy_r(ctx->gctx, polygons);
+    rterror(ctx, "Unexpected return from GEOSpolygonize");
+    return 0;
+  }
 #endif
 
-	/* We should now have all polygons, just skip
-	 * the ones which are in holes of the original
-	 * geometries and return the rest in a collection
-	 */
-	n = GEOSGetNumGeometries_r(ctx->gctx, polygons);
-	out = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, rtpoly_in->srid,
-				     hasZ, 0);
-	/* Allocate space for all polys */
-	out->geoms = rtrealloc(ctx, out->geoms, sizeof(RTGEOM*)*n);
-	assert(0 == out->ngeoms);
-	for (i=0; i<n; ++i)
-	{
-		GEOSGeometry* pos; /* point on surface */
-		const GEOSGeometry* p = GEOSGetGeometryN_r(ctx->gctx, polygons, i);
-		int contains;
-
-		pos = GEOSPointOnSurface_r(ctx->gctx, p);
-		if ( ! pos )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, g1);
-			GEOSGeom_destroy_r(ctx->gctx, g2);
-			GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-			GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
-			GEOSGeom_destroy_r(ctx->gctx, polygons);
-			rterror(ctx, "GEOSPointOnSurface: %s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-
-		contains = GEOSContains_r(ctx->gctx, g1, pos);
-		if ( 2 == contains )
-		{
-			GEOSGeom_destroy_r(ctx->gctx, g1);
-			GEOSGeom_destroy_r(ctx->gctx, g2);
-			GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-			GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
-			GEOSGeom_destroy_r(ctx->gctx, polygons);
-			GEOSGeom_destroy_r(ctx->gctx, pos);
-			rterror(ctx, "GEOSContains: %s", rtgeom_get_last_geos_error(ctx));
-			return NULL;
-		}
-
-		GEOSGeom_destroy_r(ctx->gctx, pos);
-
-		if ( 0 == contains )
-		{
-			/* Original geometry doesn't contain
-			 * a point in this ring, must be an hole
-			 */
-			continue;
-		}
-
-		out->geoms[out->ngeoms++] = GEOS2RTGEOM(ctx, p, hasZ);
-	}
-
-	GEOSGeom_destroy_r(ctx->gctx, g1);
-	GEOSGeom_destroy_r(ctx->gctx, g2);
-	GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
-	GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
-	GEOSGeom_destroy_r(ctx->gctx, polygons);
-
-	return (RTGEOM*)out;
+  /* We should now have all polygons, just skip
+   * the ones which are in holes of the original
+   * geometries and return the rest in a collection
+   */
+  n = GEOSGetNumGeometries_r(ctx->gctx, polygons);
+  out = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, rtpoly_in->srid,
+             hasZ, 0);
+  /* Allocate space for all polys */
+  out->geoms = rtrealloc(ctx, out->geoms, sizeof(RTGEOM*)*n);
+  assert(0 == out->ngeoms);
+  for (i=0; i<n; ++i)
+  {
+    GEOSGeometry* pos; /* point on surface */
+    const GEOSGeometry* p = GEOSGetGeometryN_r(ctx->gctx, polygons, i);
+    int contains;
+
+    pos = GEOSPointOnSurface_r(ctx->gctx, p);
+    if ( ! pos )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, g1);
+      GEOSGeom_destroy_r(ctx->gctx, g2);
+      GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+      GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
+      GEOSGeom_destroy_r(ctx->gctx, polygons);
+      rterror(ctx, "GEOSPointOnSurface: %s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+
+    contains = GEOSContains_r(ctx->gctx, g1, pos);
+    if ( 2 == contains )
+    {
+      GEOSGeom_destroy_r(ctx->gctx, g1);
+      GEOSGeom_destroy_r(ctx->gctx, g2);
+      GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+      GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
+      GEOSGeom_destroy_r(ctx->gctx, polygons);
+      GEOSGeom_destroy_r(ctx->gctx, pos);
+      rterror(ctx, "GEOSContains: %s", rtgeom_get_last_geos_error(ctx));
+      return NULL;
+    }
+
+    GEOSGeom_destroy_r(ctx->gctx, pos);
+
+    if ( 0 == contains )
+    {
+      /* Original geometry doesn't contain
+       * a point in this ring, must be an hole
+       */
+      continue;
+    }
+
+    out->geoms[out->ngeoms++] = GEOS2RTGEOM(ctx, p, hasZ);
+  }
+
+  GEOSGeom_destroy_r(ctx->gctx, g1);
+  GEOSGeom_destroy_r(ctx->gctx, g2);
+  GEOSGeom_destroy_r(ctx->gctx, g1_bounds);
+  GEOSGeom_destroy_r(ctx->gctx, (GEOSGeometry*)vgeoms[0]);
+  GEOSGeom_destroy_r(ctx->gctx, polygons);
+
+  return (RTGEOM*)out;
 }
 
 static RTGEOM*
 rtcollection_split(const RTCTX *ctx, const RTCOLLECTION* rtcoll_in, const RTGEOM* blade_in)
 {
-	RTGEOM** split_vector=NULL;
-	RTCOLLECTION* out;
-	size_t split_vector_capacity;
-	size_t split_vector_size=0;
-	size_t i,j;
-
-	split_vector_capacity=8;
-	split_vector = rtalloc(ctx, split_vector_capacity * sizeof(RTGEOM*));
-	if ( ! split_vector )
-	{
-		rterror(ctx, "Out of virtual memory");
-		return NULL;
-	}
-
-	for (i=0; i<rtcoll_in->ngeoms; ++i)
-	{
-		RTCOLLECTION* col;
-		RTGEOM* split = rtgeom_split(ctx, rtcoll_in->geoms[i], blade_in);
-		/* an exception should prevent this from ever returning NULL */
-		if ( ! split ) return NULL;
-
-		col = rtgeom_as_rtcollection(ctx, split);
-		/* Output, if any, will artays be a collection */
-		assert(col);
-
-		/* Reallocate split_vector if needed */
-		if ( split_vector_size + col->ngeoms > split_vector_capacity )
-		{
-			/* NOTE: we could be smarter on reallocations here */
-			split_vector_capacity += col->ngeoms;
-			split_vector = rtrealloc(ctx, split_vector,
-			                         split_vector_capacity * sizeof(RTGEOM*));
-			if ( ! split_vector )
-			{
-				rterror(ctx, "Out of virtual memory");
-				return NULL;
-			}
-		}
-
-		for (j=0; j<col->ngeoms; ++j)
-		{
-			col->geoms[j]->srid = SRID_UNKNOWN; /* strip srid */
-			split_vector[split_vector_size++] = col->geoms[j];
-		}
-		rtfree(ctx, col->geoms);
-		rtfree(ctx, col);
-	}
-
-	/* Now split_vector has split_vector_size geometries */
-	out = rtcollection_construct(ctx, RTCOLLECTIONTYPE, rtcoll_in->srid,
-	                             NULL, split_vector_size, split_vector);
-
-	return (RTGEOM*)out;
+  RTGEOM** split_vector=NULL;
+  RTCOLLECTION* out;
+  size_t split_vector_capacity;
+  size_t split_vector_size=0;
+  size_t i,j;
+
+  split_vector_capacity=8;
+  split_vector = rtalloc(ctx, split_vector_capacity * sizeof(RTGEOM*));
+  if ( ! split_vector )
+  {
+    rterror(ctx, "Out of virtual memory");
+    return NULL;
+  }
+
+  for (i=0; i<rtcoll_in->ngeoms; ++i)
+  {
+    RTCOLLECTION* col;
+    RTGEOM* split = rtgeom_split(ctx, rtcoll_in->geoms[i], blade_in);
+    /* an exception should prevent this from ever returning NULL */
+    if ( ! split ) return NULL;
+
+    col = rtgeom_as_rtcollection(ctx, split);
+    /* Output, if any, will artays be a collection */
+    assert(col);
+
+    /* Reallocate split_vector if needed */
+    if ( split_vector_size + col->ngeoms > split_vector_capacity )
+    {
+      /* NOTE: we could be smarter on reallocations here */
+      split_vector_capacity += col->ngeoms;
+      split_vector = rtrealloc(ctx, split_vector,
+                               split_vector_capacity * sizeof(RTGEOM*));
+      if ( ! split_vector )
+      {
+        rterror(ctx, "Out of virtual memory");
+        return NULL;
+      }
+    }
+
+    for (j=0; j<col->ngeoms; ++j)
+    {
+      col->geoms[j]->srid = SRID_UNKNOWN; /* strip srid */
+      split_vector[split_vector_size++] = col->geoms[j];
+    }
+    rtfree(ctx, col->geoms);
+    rtfree(ctx, col);
+  }
+
+  /* Now split_vector has split_vector_size geometries */
+  out = rtcollection_construct(ctx, RTCOLLECTIONTYPE, rtcoll_in->srid,
+                               NULL, split_vector_size, split_vector);
+
+  return (RTGEOM*)out;
 }
 
 static RTGEOM*
 rtpoly_split(const RTCTX *ctx, const RTPOLY* rtpoly_in, const RTGEOM* blade_in)
 {
-	switch (blade_in->type)
-	{
-	case RTLINETYPE:
-		return rtpoly_split_by_line(ctx, rtpoly_in, (RTLINE*)blade_in);
-	default:
-		rterror(ctx, "Splitting a Polygon by a %s is unsupported",
-		        rttype_name(ctx, blade_in->type));
-		return NULL;
-	}
-	return NULL;
+  switch (blade_in->type)
+  {
+  case RTLINETYPE:
+    return rtpoly_split_by_line(ctx, rtpoly_in, (RTLINE*)blade_in);
+  default:
+    rterror(ctx, "Splitting a Polygon by a %s is unsupported",
+            rttype_name(ctx, blade_in->type));
+    return NULL;
+  }
+  return NULL;
 }
 
 /* exported */
 RTGEOM*
 rtgeom_split(const RTCTX *ctx, const RTGEOM* rtgeom_in, const RTGEOM* blade_in)
 {
-	switch (rtgeom_in->type)
-	{
-	case RTLINETYPE:
-		return rtline_split(ctx, (const RTLINE*)rtgeom_in, blade_in);
-
-	case RTPOLYGONTYPE:
-		return rtpoly_split(ctx, (const RTPOLY*)rtgeom_in, blade_in);
-
-	case RTMULTIPOLYGONTYPE:
-	case RTMULTILINETYPE:
-	case RTCOLLECTIONTYPE:
-		return rtcollection_split(ctx, (const RTCOLLECTION*)rtgeom_in, blade_in);
-
-	default:
-		rterror(ctx, "Splitting of %s geometries is unsupported",
-		        rttype_name(ctx, rtgeom_in->type));
-		return NULL;
-	}
+  switch (rtgeom_in->type)
+  {
+  case RTLINETYPE:
+    return rtline_split(ctx, (const RTLINE*)rtgeom_in, blade_in);
+
+  case RTPOLYGONTYPE:
+    return rtpoly_split(ctx, (const RTPOLY*)rtgeom_in, blade_in);
+
+  case RTMULTIPOLYGONTYPE:
+  case RTMULTILINETYPE:
+  case RTCOLLECTIONTYPE:
+    return rtcollection_split(ctx, (const RTCOLLECTION*)rtgeom_in, blade_in);
+
+  default:
+    rterror(ctx, "Splitting of %s geometries is unsupported",
+            rttype_name(ctx, rtgeom_in->type));
+    return NULL;
+  }
 
 }
 
diff --git a/src/rtgeom_log.h b/src/rtgeom_log.h
index 72f8672..9c0d84a 100644
--- a/src/rtgeom_log.h
+++ b/src/rtgeom_log.h
@@ -89,8 +89,8 @@ void rtnotice(const RTCTX *ctx, const char *fmt, ...);
 void rterror(const RTCTX *ctx, const char *fmt, ...);
 
 /**
- * Write a debug message out. 
- * Don't call this function directly, use the 
+ * Write a debug message out.
+ * Don't call this function directly, use the
  * macros, RTDEBUG() or RTDEBUGF(), for
  * efficiency.
  * @ingroup logging
diff --git a/src/rtgeom_topo.c b/src/rtgeom_topo.c
index a541142..1c60b06 100644
--- a/src/rtgeom_topo.c
+++ b/src/rtgeom_topo.c
@@ -5038,14 +5038,14 @@ typedef struct scored_pointer_t {
 static int
 compare_scored_pointer(const void *si1, const void *si2)
 {
-	double a = ((scored_pointer *)si1)->score;
-	double b = ((scored_pointer *)si2)->score;
-	if ( a < b )
-		return -1;
-	else if ( a > b )
-		return 1;
-	else
-		return 0;
+  double a = ((scored_pointer *)si1)->score;
+  double b = ((scored_pointer *)si2)->score;
+  if ( a < b )
+    return -1;
+  else if ( a > b )
+    return 1;
+  else
+    return 0;
 }
 
 RTT_ELEMID
diff --git a/src/rthomogenize.c b/src/rthomogenize.c
index c86bd95..773a8b7 100644
--- a/src/rthomogenize.c
+++ b/src/rthomogenize.c
@@ -30,33 +30,33 @@
 
 
 typedef struct {
-	int cnt[RTNUMTYPES];
-	RTCOLLECTION* buf[RTNUMTYPES];
+  int cnt[RTNUMTYPES];
+  RTCOLLECTION* buf[RTNUMTYPES];
 } HomogenizeBuffer;
 
 static void
 init_homogenizebuffer(const RTCTX *ctx, HomogenizeBuffer *buffer)
 {
-	int i;
-	for ( i = 0; i < RTNUMTYPES; i++ )
-	{
-		buffer->cnt[i] = 0;
-		buffer->buf[i] = NULL;
-	}
+  int i;
+  for ( i = 0; i < RTNUMTYPES; i++ )
+  {
+    buffer->cnt[i] = 0;
+    buffer->buf[i] = NULL;
+  }
 }
 
 /*
 static void
 free_homogenizebuffer(HomogenizeBuffer *buffer)
 {
-	int i;
-	for ( i = 0; i < RTNUMTYPES; i++ )
-	{
-		if ( buffer->buf[i] )
-		{
-			rtcollection_free(ctx, buffer->buf[i]);
-		}
-	}
+  int i;
+  for ( i = 0; i < RTNUMTYPES; i++ )
+  {
+    if ( buffer->buf[i] )
+    {
+      rtcollection_free(ctx, buffer->buf[i]);
+    }
+  }
 }
 */
 
@@ -76,117 +76,117 @@ free_homogenizebuffer(HomogenizeBuffer *buffer)
 static void
 rtcollection_build_buffer(const RTCTX *ctx, const RTCOLLECTION *col, HomogenizeBuffer *buffer)
 {
-	int i;
-	
-	if ( ! col ) return;
-	if ( rtgeom_is_empty(ctx, rtcollection_as_rtgeom(ctx, col)) ) return;
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		RTGEOM *geom = col->geoms[i];
-		switch(geom->type)
-		{
-			case RTPOINTTYPE:
-			case RTLINETYPE:
-			case RTCIRCSTRINGTYPE:
-			case RTCOMPOUNDTYPE:
-			case RTTRIANGLETYPE:
-			case RTCURVEPOLYTYPE:
-			case RTPOLYGONTYPE:
-			{
-				/* Init if necessary */
-				if ( ! buffer->buf[geom->type] )
-				{
-					RTCOLLECTION *bufcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
-					bufcol->type = rttype_get_collectiontype(ctx, geom->type);
-					buffer->buf[geom->type] = bufcol;
-				}
-				/* Add sub-geom to buffer */
-				rtcollection_add_rtgeom(ctx, buffer->buf[geom->type], rtgeom_clone(ctx, geom));
-				/* Increment count for this singleton type */
-				buffer->cnt[geom->type] = buffer->cnt[geom->type] + 1;
-			}
-			default:
-			{
-				rtcollection_build_buffer(ctx, rtgeom_as_rtcollection(ctx, geom), buffer);
-			}
-		}
-	}
-	return;
+  int i;
+
+  if ( ! col ) return;
+  if ( rtgeom_is_empty(ctx, rtcollection_as_rtgeom(ctx, col)) ) return;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    RTGEOM *geom = col->geoms[i];
+    switch(geom->type)
+    {
+      case RTPOINTTYPE:
+      case RTLINETYPE:
+      case RTCIRCSTRINGTYPE:
+      case RTCOMPOUNDTYPE:
+      case RTTRIANGLETYPE:
+      case RTCURVEPOLYTYPE:
+      case RTPOLYGONTYPE:
+      {
+        /* Init if necessary */
+        if ( ! buffer->buf[geom->type] )
+        {
+          RTCOLLECTION *bufcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
+          bufcol->type = rttype_get_collectiontype(ctx, geom->type);
+          buffer->buf[geom->type] = bufcol;
+        }
+        /* Add sub-geom to buffer */
+        rtcollection_add_rtgeom(ctx, buffer->buf[geom->type], rtgeom_clone(ctx, geom));
+        /* Increment count for this singleton type */
+        buffer->cnt[geom->type] = buffer->cnt[geom->type] + 1;
+      }
+      default:
+      {
+        rtcollection_build_buffer(ctx, rtgeom_as_rtcollection(ctx, geom), buffer);
+      }
+    }
+  }
+  return;
 }
 
 static RTGEOM*
 rtcollection_homogenize(const RTCTX *ctx, const RTCOLLECTION *col)
 {
-	int i;
-	int ntypes = 0;
-	int type = 0;
-	RTGEOM *outgeom = NULL;
-	
-	HomogenizeBuffer buffer;
+  int i;
+  int ntypes = 0;
+  int type = 0;
+  RTGEOM *outgeom = NULL;
+
+  HomogenizeBuffer buffer;
+
+  /* Sort all the parts into a buffer */
+  init_homogenizebuffer(ctx, &buffer);
+  rtcollection_build_buffer(ctx, col, &buffer);
 
-	/* Sort all the parts into a buffer */
-	init_homogenizebuffer(ctx, &buffer);
-	rtcollection_build_buffer(ctx, col, &buffer);
-	
-	/* Check for homogeneity */
-	for ( i = 0; i < RTNUMTYPES; i++ )
-	{
-		if ( buffer.cnt[i] > 0 )
-		{
-			ntypes++;
-			type = i;
-		}
-	}
-	
-	/* No types? Huh. Return empty. */
-	if ( ntypes == 0 )
-	{
-		RTCOLLECTION *outcol;
-		outcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
-		outgeom = rtcollection_as_rtgeom(ctx, outcol);
-	}
-	/* One type, return homogeneous collection */
-	else if ( ntypes == 1 )
-	{
-		RTCOLLECTION *outcol;
-		outcol = buffer.buf[type];
-		if ( outcol->ngeoms == 1 )
-		{
-			outgeom = outcol->geoms[0];
-			outcol->ngeoms=0; rtcollection_free(ctx, outcol);
-		}
-		else
-		{
-			outgeom = rtcollection_as_rtgeom(ctx, outcol);
-		}
-		outgeom->srid = col->srid;
-	}
-	/* Bah, more than out type, return anonymous collection */
-	else if ( ntypes > 1 )
-	{
-		int j;
-		RTCOLLECTION *outcol;
-		outcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
-		for ( j = 0; j < RTNUMTYPES; j++ )
-		{
-			if ( buffer.buf[j] )
-			{
-				RTCOLLECTION *bcol = buffer.buf[j];
-				if ( bcol->ngeoms == 1 )
-				{
-					rtcollection_add_rtgeom(ctx, outcol, bcol->geoms[0]);
-					bcol->ngeoms=0; rtcollection_free(ctx, bcol);
-				}
-				else 
-				{
-					rtcollection_add_rtgeom(ctx, outcol, rtcollection_as_rtgeom(ctx, bcol));
-				}
-			}
-		}
-		outgeom = rtcollection_as_rtgeom(ctx, outcol);
-	}
+  /* Check for homogeneity */
+  for ( i = 0; i < RTNUMTYPES; i++ )
+  {
+    if ( buffer.cnt[i] > 0 )
+    {
+      ntypes++;
+      type = i;
+    }
+  }
 
-	return outgeom;
+  /* No types? Huh. Return empty. */
+  if ( ntypes == 0 )
+  {
+    RTCOLLECTION *outcol;
+    outcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
+    outgeom = rtcollection_as_rtgeom(ctx, outcol);
+  }
+  /* One type, return homogeneous collection */
+  else if ( ntypes == 1 )
+  {
+    RTCOLLECTION *outcol;
+    outcol = buffer.buf[type];
+    if ( outcol->ngeoms == 1 )
+    {
+      outgeom = outcol->geoms[0];
+      outcol->ngeoms=0; rtcollection_free(ctx, outcol);
+    }
+    else
+    {
+      outgeom = rtcollection_as_rtgeom(ctx, outcol);
+    }
+    outgeom->srid = col->srid;
+  }
+  /* Bah, more than out type, return anonymous collection */
+  else if ( ntypes > 1 )
+  {
+    int j;
+    RTCOLLECTION *outcol;
+    outcol = rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, col->srid, RTFLAGS_GET_Z(col->flags), RTFLAGS_GET_M(col->flags));
+    for ( j = 0; j < RTNUMTYPES; j++ )
+    {
+      if ( buffer.buf[j] )
+      {
+        RTCOLLECTION *bcol = buffer.buf[j];
+        if ( bcol->ngeoms == 1 )
+        {
+          rtcollection_add_rtgeom(ctx, outcol, bcol->geoms[0]);
+          bcol->ngeoms=0; rtcollection_free(ctx, bcol);
+        }
+        else
+        {
+          rtcollection_add_rtgeom(ctx, outcol, rtcollection_as_rtgeom(ctx, bcol));
+        }
+      }
+    }
+    outgeom = rtcollection_as_rtgeom(ctx, outcol);
+  }
+
+  return outgeom;
 }
 
 
@@ -209,65 +209,65 @@ rtcollection_homogenize(const RTCTX *ctx, const RTCOLLECTION *col)
 RTGEOM *
 rtgeom_homogenize(const RTCTX *ctx, const RTGEOM *geom)
 {
-	RTGEOM *hgeom;
+  RTGEOM *hgeom;
+
+  /* EMPTY Geometry */
+  if (rtgeom_is_empty(ctx, geom))
+  {
+    if( rtgeom_is_collection(ctx, geom) )
+    {
+      return rtcollection_as_rtgeom(ctx, rtcollection_construct_empty(ctx, geom->type, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom)));
+    }
+
+    return rtgeom_clone(ctx, geom);
+  }
 
-	/* EMPTY Geometry */
-	if (rtgeom_is_empty(ctx, geom)) 
-	{
-		if( rtgeom_is_collection(ctx, geom) )
-		{
-			return rtcollection_as_rtgeom(ctx, rtcollection_construct_empty(ctx, geom->type, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom)));
-		}
-		
-		return rtgeom_clone(ctx, geom);
-	}
+  switch (geom->type)
+  {
 
-	switch (geom->type)
-	{
+    /* Return simple geometries untouched */
+    case RTPOINTTYPE:
+    case RTLINETYPE:
+    case RTCIRCSTRINGTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTTRIANGLETYPE:
+    case RTCURVEPOLYTYPE:
+    case RTPOLYGONTYPE:
+      return rtgeom_clone(ctx, geom);
 
-		/* Return simple geometries untouched */
-		case RTPOINTTYPE:
-		case RTLINETYPE:
-		case RTCIRCSTRINGTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTTRIANGLETYPE:
-		case RTCURVEPOLYTYPE:
-		case RTPOLYGONTYPE:
-			return rtgeom_clone(ctx, geom);
+    /* Process homogeneous geometries lightly */
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+    case RTPOLYHEDRALSURFACETYPE:
+    case RTTINTYPE:
+    {
+      RTCOLLECTION *col = (RTCOLLECTION*)geom;
 
-		/* Process homogeneous geometries lightly */
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-		case RTPOLYHEDRALSURFACETYPE:
-		case RTTINTYPE:
-		{
-			RTCOLLECTION *col = (RTCOLLECTION*)geom;
+      /* Strip single-entry multi-geometries down to singletons */
+      if ( col->ngeoms == 1 )
+      {
+        hgeom = rtgeom_clone(ctx, (RTGEOM*)(col->geoms[0]));
+        hgeom->srid = geom->srid;
+        if (geom->bbox)
+          hgeom->bbox = gbox_copy(ctx, geom->bbox);
+        return hgeom;
+      }
 
-			/* Strip single-entry multi-geometries down to singletons */
-			if ( col->ngeoms == 1 )
-			{
-				hgeom = rtgeom_clone(ctx, (RTGEOM*)(col->geoms[0]));
-				hgeom->srid = geom->srid;
-				if (geom->bbox)
-					hgeom->bbox = gbox_copy(ctx, geom->bbox);
-				return hgeom;
-			}
+      /* Return proper multigeometry untouched */
+      return rtgeom_clone(ctx, geom);
+    }
 
-			/* Return proper multigeometry untouched */
-			return rtgeom_clone(ctx, geom);
-		}
-	
-		/* Work on anonymous collections separately */
-		case RTCOLLECTIONTYPE: 
-			return rtcollection_homogenize(ctx, (RTCOLLECTION *) geom);
-	}
+    /* Work on anonymous collections separately */
+    case RTCOLLECTIONTYPE:
+      return rtcollection_homogenize(ctx, (RTCOLLECTION *) geom);
+  }
 
-	/* Unknown type */
-	rterror(ctx, "rtgeom_homogenize: Geometry Type not supported (%i)",
-	        rttype_name(ctx, geom->type));
+  /* Unknown type */
+  rterror(ctx, "rtgeom_homogenize: Geometry Type not supported (%i)",
+          rttype_name(ctx, geom->type));
 
-	return NULL; /* Never get here! */
+  return NULL; /* Never get here! */
 }
diff --git a/src/rtin_geojson.c b/src/rtin_geojson.c
index 7df78c6..2cc1048 100644
--- a/src/rtin_geojson.c
+++ b/src/rtin_geojson.c
@@ -49,8 +49,8 @@
 
 static void geojson_rterror(char *msg, int error_code)
 {
-	RTDEBUGF(3, "rtgeom_from_geojson ERROR %i", error_code);
-	rterror(ctx, "%s", msg);
+  RTDEBUGF(3, "rtgeom_from_geojson ERROR %i", error_code);
+  rterror(ctx, "%s", msg);
 }
 
 /* Prototype */
@@ -59,466 +59,466 @@ static RTGEOM* parse_geojson(json_object *geojson, int *hasz, int root_srid);
 static json_object*
 findMemberByName(json_object* poObj, const char* pszName )
 {
-	json_object* poTmp;
-	json_object_iter it;
-
-	poTmp = poObj;
-
-	if( NULL == pszName || NULL == poObj)
-		return NULL;
-
-	it.key = NULL;
-	it.val = NULL;
-	it.entry = NULL;
-
-	if( NULL != json_object_get_object(poTmp) )
-	{
-		if( NULL == json_object_get_object(poTmp)->head )
-		{
-			geojson_rterror("invalid GeoJSON representation", 2);
-			return NULL;
-		}
-
-		for( it.entry = json_object_get_object(poTmp)->head;
-		        ( it.entry ?
-		          ( it.key = (char*)it.entry->k,
-		            it.val = (json_object*)it.entry->v, it.entry) : 0);
-		        it.entry = it.entry->next)
-		{
-			if( strcasecmp((char *)it.key, pszName )==0 )
-				return it.val;
-		}
-	}
-
-	return NULL;
+  json_object* poTmp;
+  json_object_iter it;
+
+  poTmp = poObj;
+
+  if( NULL == pszName || NULL == poObj)
+    return NULL;
+
+  it.key = NULL;
+  it.val = NULL;
+  it.entry = NULL;
+
+  if( NULL != json_object_get_object(poTmp) )
+  {
+    if( NULL == json_object_get_object(poTmp)->head )
+    {
+      geojson_rterror("invalid GeoJSON representation", 2);
+      return NULL;
+    }
+
+    for( it.entry = json_object_get_object(poTmp)->head;
+            ( it.entry ?
+              ( it.key = (char*)it.entry->k,
+                it.val = (json_object*)it.entry->v, it.entry) : 0);
+            it.entry = it.entry->next)
+    {
+      if( strcasecmp((char *)it.key, pszName )==0 )
+        return it.val;
+    }
+  }
+
+  return NULL;
 }
 
 
 static int
 parse_geojson_coord(json_object *poObj, int *hasz, RTPOINTARRAY *pa)
 {
-	RTPOINT4D pt;
-
-	RTDEBUGF(3, "parse_geojson_coord called for object %s.", json_object_to_json_string( poObj ) );
-
-	if( json_type_array == json_object_get_type( poObj ) )
-	{
-
-		json_object* poObjCoord = NULL;
-		const int nSize = json_object_array_length( poObj );
-		RTDEBUGF(3, "parse_geojson_coord called for array size %d.", nSize );
-
-		if ( nSize < 2 )
-		{
-			geojson_rterror("Too few ordinates in GeoJSON", 4);
-			return RT_FAILURE;
-		}
-		
-		/* Read X coordinate */
-		poObjCoord = json_object_array_get_idx( poObj, 0 );
-		pt.x = json_object_get_double( poObjCoord );
-		RTDEBUGF(3, "parse_geojson_coord pt.x = %f.", pt.x );
-
-		/* Read Y coordinate */
-		poObjCoord = json_object_array_get_idx( poObj, 1 );
-		pt.y = json_object_get_double( poObjCoord );
-		RTDEBUGF(3, "parse_geojson_coord pt.y = %f.", pt.y );
-
-		if( nSize > 2 ) /* should this be >= 3 ? */
-		{
-			/* Read Z coordinate */
-			poObjCoord = json_object_array_get_idx( poObj, 2 );
-			pt.z = json_object_get_double( poObjCoord );
-			RTDEBUGF(3, "parse_geojson_coord pt.z = %f.", pt.z );
-			*hasz = RT_TRUE;
-		}
-		else if ( nSize == 2 )
-		{
-			*hasz = RT_FALSE;
-			/* Initialize Z coordinate, if required */
-			if ( RTFLAGS_GET_Z(pa->flags) ) pt.z = 0.0;
-		}
-		else 
-		{
-			/* TODO: should we account for nSize > 3 ? */
-			/* more than 3 coordinates, we're just dropping dimensions here... */
-		}
-
-		/* Initialize M coordinate, if required */
-		if ( RTFLAGS_GET_M(pa->flags) ) pt.m = 0.0;
-
-	}
-	else
-	{
-		/* If it's not an array, just don't handle it */
-		return RT_FAILURE;
-	}
-
-	return ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  RTPOINT4D pt;
+
+  RTDEBUGF(3, "parse_geojson_coord called for object %s.", json_object_to_json_string( poObj ) );
+
+  if( json_type_array == json_object_get_type( poObj ) )
+  {
+
+    json_object* poObjCoord = NULL;
+    const int nSize = json_object_array_length( poObj );
+    RTDEBUGF(3, "parse_geojson_coord called for array size %d.", nSize );
+
+    if ( nSize < 2 )
+    {
+      geojson_rterror("Too few ordinates in GeoJSON", 4);
+      return RT_FAILURE;
+    }
+
+    /* Read X coordinate */
+    poObjCoord = json_object_array_get_idx( poObj, 0 );
+    pt.x = json_object_get_double( poObjCoord );
+    RTDEBUGF(3, "parse_geojson_coord pt.x = %f.", pt.x );
+
+    /* Read Y coordinate */
+    poObjCoord = json_object_array_get_idx( poObj, 1 );
+    pt.y = json_object_get_double( poObjCoord );
+    RTDEBUGF(3, "parse_geojson_coord pt.y = %f.", pt.y );
+
+    if( nSize > 2 ) /* should this be >= 3 ? */
+    {
+      /* Read Z coordinate */
+      poObjCoord = json_object_array_get_idx( poObj, 2 );
+      pt.z = json_object_get_double( poObjCoord );
+      RTDEBUGF(3, "parse_geojson_coord pt.z = %f.", pt.z );
+      *hasz = RT_TRUE;
+    }
+    else if ( nSize == 2 )
+    {
+      *hasz = RT_FALSE;
+      /* Initialize Z coordinate, if required */
+      if ( RTFLAGS_GET_Z(pa->flags) ) pt.z = 0.0;
+    }
+    else
+    {
+      /* TODO: should we account for nSize > 3 ? */
+      /* more than 3 coordinates, we're just dropping dimensions here... */
+    }
+
+    /* Initialize M coordinate, if required */
+    if ( RTFLAGS_GET_M(pa->flags) ) pt.m = 0.0;
+
+  }
+  else
+  {
+    /* If it's not an array, just don't handle it */
+    return RT_FAILURE;
+  }
+
+  return ptarray_append_point(ctx, pa, &pt, RT_TRUE);
 }
 
 static RTGEOM*
 parse_geojson_point(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom;
-	RTPOINTARRAY *pa;
-	json_object* coords = NULL;
-
-	RTDEBUGF(3, "parse_geojson_point called with root_srid = %d.", root_srid );
-
-	coords = findMemberByName( geojson, "coordinates" );
-	if ( ! coords ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-		return NULL;
-	}
-	
-	pa = ptarray_construct_empty(ctx, 1, 0, 1);
-	parse_geojson_coord(coords, hasz, pa);
-
-	geom = (RTGEOM *) rtpoint_construct(ctx, root_srid, NULL, pa);
-	RTDEBUG(2, "parse_geojson_point finished.");
-	return geom;
+  RTGEOM *geom;
+  RTPOINTARRAY *pa;
+  json_object* coords = NULL;
+
+  RTDEBUGF(3, "parse_geojson_point called with root_srid = %d.", root_srid );
+
+  coords = findMemberByName( geojson, "coordinates" );
+  if ( ! coords )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  pa = ptarray_construct_empty(ctx, 1, 0, 1);
+  parse_geojson_coord(coords, hasz, pa);
+
+  geom = (RTGEOM *) rtpoint_construct(ctx, root_srid, NULL, pa);
+  RTDEBUG(2, "parse_geojson_point finished.");
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson_linestring(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom;
-	RTPOINTARRAY *pa;
-	json_object* points = NULL;
-	int i = 0;
-
-	RTDEBUG(2, "parse_geojson_linestring called.");
-
-	points = findMemberByName( geojson, "coordinates" );
-	if ( ! points ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-	return NULL;
-	}
-
-	pa = ptarray_construct_empty(ctx, 1, 0, 1);
-
-	if( json_type_array == json_object_get_type( points ) )
-	{
-		const int nPoints = json_object_array_length( points );
-		for(i = 0; i < nPoints; ++i)
-		{
-			json_object* coords = NULL;
-			coords = json_object_array_get_idx( points, i );
-			parse_geojson_coord(coords, hasz, pa);
-		}
-	}
-
-	geom = (RTGEOM *) rtline_construct(ctx, root_srid, NULL, pa);
-
-	RTDEBUG(2, "parse_geojson_linestring finished.");
-	return geom;
+  RTGEOM *geom;
+  RTPOINTARRAY *pa;
+  json_object* points = NULL;
+  int i = 0;
+
+  RTDEBUG(2, "parse_geojson_linestring called.");
+
+  points = findMemberByName( geojson, "coordinates" );
+  if ( ! points )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+  return NULL;
+  }
+
+  pa = ptarray_construct_empty(ctx, 1, 0, 1);
+
+  if( json_type_array == json_object_get_type( points ) )
+  {
+    const int nPoints = json_object_array_length( points );
+    for(i = 0; i < nPoints; ++i)
+    {
+      json_object* coords = NULL;
+      coords = json_object_array_get_idx( points, i );
+      parse_geojson_coord(coords, hasz, pa);
+    }
+  }
+
+  geom = (RTGEOM *) rtline_construct(ctx, root_srid, NULL, pa);
+
+  RTDEBUG(2, "parse_geojson_linestring finished.");
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson_polygon(json_object *geojson, int *hasz, int root_srid)
 {
-	RTPOINTARRAY **ppa = NULL;
-	json_object* rings = NULL;
-	json_object* points = NULL;
-	int i = 0, j = 0;
-	int nRings = 0, nPoints = 0;
-
-	rings = findMemberByName( geojson, "coordinates" );
-	if ( ! rings ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-		return NULL;
-	}
-
-	if ( json_type_array != json_object_get_type(rings) )
-	{
-		geojson_rterror("The 'coordinates' in GeoJSON are not an array", 4);
-		return NULL;
-	}
-
-	nRings = json_object_array_length( rings );
-
-	/* No rings => POLYGON EMPTY */
-	if ( ! nRings )
-	{
-		return (RTGEOM *)rtpoly_construct_empty(ctx, root_srid, 0, 0);
-	}
-	
-	for ( i = 0; i < nRings; i++ )
-	{
-		points = json_object_array_get_idx(rings, i);
-		if ( ! points || json_object_get_type(points) != json_type_array )
-		{
-			geojson_rterror("The 'coordinates' in GeoJSON ring are not an array", 4);
-			return NULL;
-		}
-		nPoints = json_object_array_length(points);
-		
-		/* Skip empty rings */
-		if ( nPoints == 0 ) continue;
-		
-		if ( ! ppa )
-			ppa = (RTPOINTARRAY**)rtalloc(ctx, sizeof(RTPOINTARRAY*) * nRings);
-		
-		ppa[i] = ptarray_construct_empty(ctx, 1, 0, 1);
-		for ( j = 0; j < nPoints; j++ )
-		{
-			json_object* coords = NULL;
-			coords = json_object_array_get_idx( points, j );
-			parse_geojson_coord(coords, hasz, ppa[i]);
-		}
-	}	
-	
-	/* All the rings were empty! */
-	if ( ! ppa )
-		return (RTGEOM *)rtpoly_construct_empty(ctx, root_srid, 0, 0);
-	
-	return (RTGEOM *) rtpoly_construct(ctx, root_srid, NULL, nRings, ppa);
+  RTPOINTARRAY **ppa = NULL;
+  json_object* rings = NULL;
+  json_object* points = NULL;
+  int i = 0, j = 0;
+  int nRings = 0, nPoints = 0;
+
+  rings = findMemberByName( geojson, "coordinates" );
+  if ( ! rings )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  if ( json_type_array != json_object_get_type(rings) )
+  {
+    geojson_rterror("The 'coordinates' in GeoJSON are not an array", 4);
+    return NULL;
+  }
+
+  nRings = json_object_array_length( rings );
+
+  /* No rings => POLYGON EMPTY */
+  if ( ! nRings )
+  {
+    return (RTGEOM *)rtpoly_construct_empty(ctx, root_srid, 0, 0);
+  }
+
+  for ( i = 0; i < nRings; i++ )
+  {
+    points = json_object_array_get_idx(rings, i);
+    if ( ! points || json_object_get_type(points) != json_type_array )
+    {
+      geojson_rterror("The 'coordinates' in GeoJSON ring are not an array", 4);
+      return NULL;
+    }
+    nPoints = json_object_array_length(points);
+
+    /* Skip empty rings */
+    if ( nPoints == 0 ) continue;
+
+    if ( ! ppa )
+      ppa = (RTPOINTARRAY**)rtalloc(ctx, sizeof(RTPOINTARRAY*) * nRings);
+
+    ppa[i] = ptarray_construct_empty(ctx, 1, 0, 1);
+    for ( j = 0; j < nPoints; j++ )
+    {
+      json_object* coords = NULL;
+      coords = json_object_array_get_idx( points, j );
+      parse_geojson_coord(coords, hasz, ppa[i]);
+    }
+  }
+
+  /* All the rings were empty! */
+  if ( ! ppa )
+    return (RTGEOM *)rtpoly_construct_empty(ctx, root_srid, 0, 0);
+
+  return (RTGEOM *) rtpoly_construct(ctx, root_srid, NULL, nRings, ppa);
 }
 
 static RTGEOM*
 parse_geojson_multipoint(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom;
-	int i = 0;
-	json_object* poObjPoints = NULL;
-
-	if (!root_srid)
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, root_srid, 1, 0);
-	}
-	else
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, -1, 1, 0);
-	}
-
-	poObjPoints = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjPoints ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-		return NULL;
-	}
-
-	if( json_type_array == json_object_get_type( poObjPoints ) )
-	{
-		const int nPoints = json_object_array_length( poObjPoints );
-		for( i = 0; i < nPoints; ++i)
-		{
-			RTPOINTARRAY *pa;
-			json_object* poObjCoords = NULL;
-			poObjCoords = json_object_array_get_idx( poObjPoints, i );
-
-			pa = ptarray_construct_empty(ctx, 1, 0, 1);
-			parse_geojson_coord(poObjCoords, hasz, pa);
-
-			geom = (RTGEOM*)rtmpoint_add_rtpoint(ctx, (RTMPOINT*)geom,
-			                                     (RTPOINT*)rtpoint_construct(ctx, root_srid, NULL, pa));
-		}
-	}
-
-	return geom;
+  RTGEOM *geom;
+  int i = 0;
+  json_object* poObjPoints = NULL;
+
+  if (!root_srid)
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, root_srid, 1, 0);
+  }
+  else
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, -1, 1, 0);
+  }
+
+  poObjPoints = findMemberByName( geojson, "coordinates" );
+  if ( ! poObjPoints )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  if( json_type_array == json_object_get_type( poObjPoints ) )
+  {
+    const int nPoints = json_object_array_length( poObjPoints );
+    for( i = 0; i < nPoints; ++i)
+    {
+      RTPOINTARRAY *pa;
+      json_object* poObjCoords = NULL;
+      poObjCoords = json_object_array_get_idx( poObjPoints, i );
+
+      pa = ptarray_construct_empty(ctx, 1, 0, 1);
+      parse_geojson_coord(poObjCoords, hasz, pa);
+
+      geom = (RTGEOM*)rtmpoint_add_rtpoint(ctx, (RTMPOINT*)geom,
+                                           (RTPOINT*)rtpoint_construct(ctx, root_srid, NULL, pa));
+    }
+  }
+
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson_multilinestring(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom = NULL;
-	int i, j;
-	json_object* poObjLines = NULL;
-
-	if (!root_srid)
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTILINETYPE, root_srid, 1, 0);
-	}
-	else
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTILINETYPE, -1, 1, 0);
-	}
-
-	poObjLines = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjLines ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-		return NULL;
-	}
-
-	if( json_type_array == json_object_get_type( poObjLines ) )
-	{
-		const int nLines = json_object_array_length( poObjLines );
-		for( i = 0; i < nLines; ++i)
-		{
-			RTPOINTARRAY *pa = NULL;
-			json_object* poObjLine = NULL;
-			poObjLine = json_object_array_get_idx( poObjLines, i );
-			pa = ptarray_construct_empty(ctx, 1, 0, 1);
-
-			if( json_type_array == json_object_get_type( poObjLine ) )
-			{
-				const int nPoints = json_object_array_length( poObjLine );
-				for(j = 0; j < nPoints; ++j)
-				{
-					json_object* coords = NULL;
-					coords = json_object_array_get_idx( poObjLine, j );
-					parse_geojson_coord(coords, hasz, pa);
-				}
-
-				geom = (RTGEOM*)rtmline_add_rtline(ctx, (RTMLINE*)geom,
-				                                   (RTLINE*)rtline_construct(ctx, root_srid, NULL, pa));
-			}
-		}
-	}
-
-	return geom;
+  RTGEOM *geom = NULL;
+  int i, j;
+  json_object* poObjLines = NULL;
+
+  if (!root_srid)
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTILINETYPE, root_srid, 1, 0);
+  }
+  else
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTILINETYPE, -1, 1, 0);
+  }
+
+  poObjLines = findMemberByName( geojson, "coordinates" );
+  if ( ! poObjLines )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  if( json_type_array == json_object_get_type( poObjLines ) )
+  {
+    const int nLines = json_object_array_length( poObjLines );
+    for( i = 0; i < nLines; ++i)
+    {
+      RTPOINTARRAY *pa = NULL;
+      json_object* poObjLine = NULL;
+      poObjLine = json_object_array_get_idx( poObjLines, i );
+      pa = ptarray_construct_empty(ctx, 1, 0, 1);
+
+      if( json_type_array == json_object_get_type( poObjLine ) )
+      {
+        const int nPoints = json_object_array_length( poObjLine );
+        for(j = 0; j < nPoints; ++j)
+        {
+          json_object* coords = NULL;
+          coords = json_object_array_get_idx( poObjLine, j );
+          parse_geojson_coord(coords, hasz, pa);
+        }
+
+        geom = (RTGEOM*)rtmline_add_rtline(ctx, (RTMLINE*)geom,
+                                           (RTLINE*)rtline_construct(ctx, root_srid, NULL, pa));
+      }
+    }
+  }
+
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson_multipolygon(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom = NULL;
-	int i, j, k;
-	json_object* poObjPolys = NULL;
-
-	if (!root_srid)
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, root_srid, 1, 0);
-	}
-	else
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, -1, 1, 0);
-	}
-
-	poObjPolys = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjPolys ) 
-	{
-		geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
-		return NULL;
-	}
-
-	if( json_type_array == json_object_get_type( poObjPolys ) )
-	{
-		const int nPolys = json_object_array_length( poObjPolys );
-
-		for(i = 0; i < nPolys; ++i)
-		{			
-			json_object* poObjPoly = json_object_array_get_idx( poObjPolys, i );
-
-			if( json_type_array == json_object_get_type( poObjPoly ) )
-			{
-				RTPOLY *rtpoly = rtpoly_construct_empty(ctx, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom));
-				int nRings = json_object_array_length( poObjPoly );
-				
-				for(j = 0; j < nRings; ++j)
-				{
-					json_object* points = json_object_array_get_idx( poObjPoly, j );
-					
-					if( json_type_array == json_object_get_type( points ) )
-					{
-
-						RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 0, 1);
-
-						int nPoints = json_object_array_length( points );
-						for ( k=0; k < nPoints; k++ )
-						{
-							json_object* coords = json_object_array_get_idx( points, k );
-							parse_geojson_coord(coords, hasz, pa);
-						}
-						
-						rtpoly_add_ring(ctx, rtpoly, pa);
-					}
-				}
-				geom = (RTGEOM*)rtmpoly_add_rtpoly(ctx, (RTMPOLY*)geom, rtpoly);
-			}
-		}
-	}
-
-	return geom;
+  RTGEOM *geom = NULL;
+  int i, j, k;
+  json_object* poObjPolys = NULL;
+
+  if (!root_srid)
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, root_srid, 1, 0);
+  }
+  else
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, -1, 1, 0);
+  }
+
+  poObjPolys = findMemberByName( geojson, "coordinates" );
+  if ( ! poObjPolys )
+  {
+    geojson_rterror("Unable to find 'coordinates' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  if( json_type_array == json_object_get_type( poObjPolys ) )
+  {
+    const int nPolys = json_object_array_length( poObjPolys );
+
+    for(i = 0; i < nPolys; ++i)
+    {
+      json_object* poObjPoly = json_object_array_get_idx( poObjPolys, i );
+
+      if( json_type_array == json_object_get_type( poObjPoly ) )
+      {
+        RTPOLY *rtpoly = rtpoly_construct_empty(ctx, geom->srid, rtgeom_has_z(ctx, geom), rtgeom_has_m(ctx, geom));
+        int nRings = json_object_array_length( poObjPoly );
+
+        for(j = 0; j < nRings; ++j)
+        {
+          json_object* points = json_object_array_get_idx( poObjPoly, j );
+
+          if( json_type_array == json_object_get_type( points ) )
+          {
+
+            RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 0, 1);
+
+            int nPoints = json_object_array_length( points );
+            for ( k=0; k < nPoints; k++ )
+            {
+              json_object* coords = json_object_array_get_idx( points, k );
+              parse_geojson_coord(coords, hasz, pa);
+            }
+
+            rtpoly_add_ring(ctx, rtpoly, pa);
+          }
+        }
+        geom = (RTGEOM*)rtmpoly_add_rtpoly(ctx, (RTMPOLY*)geom, rtpoly);
+      }
+    }
+  }
+
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson_geometrycollection(json_object *geojson, int *hasz, int root_srid)
 {
-	RTGEOM *geom = NULL;
-	int i;
-	json_object* poObjGeoms = NULL;
-
-	if (!root_srid)
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, root_srid, 1, 0);
-	}
-	else
-	{
-		geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, -1, 1, 0);
-	}
-
-	poObjGeoms = findMemberByName( geojson, "geometries" );
-	if ( ! poObjGeoms ) 
-	{
-		geojson_rterror("Unable to find 'geometries' in GeoJSON string", 4);
-		return NULL;
-	}
-
-	if( json_type_array == json_object_get_type( poObjGeoms ) )
-	{
-		const int nGeoms = json_object_array_length( poObjGeoms );
-		json_object* poObjGeom = NULL;
-		for(i = 0; i < nGeoms; ++i )
-		{
-			poObjGeom = json_object_array_get_idx( poObjGeoms, i );
-			geom = (RTGEOM*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION *)geom,
-			                                        parse_geojson(poObjGeom, hasz, root_srid));
-		}
-	}
-
-	return geom;
+  RTGEOM *geom = NULL;
+  int i;
+  json_object* poObjGeoms = NULL;
+
+  if (!root_srid)
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, root_srid, 1, 0);
+  }
+  else
+  {
+    geom = (RTGEOM *)rtcollection_construct_empty(ctx, RTCOLLECTIONTYPE, -1, 1, 0);
+  }
+
+  poObjGeoms = findMemberByName( geojson, "geometries" );
+  if ( ! poObjGeoms )
+  {
+    geojson_rterror("Unable to find 'geometries' in GeoJSON string", 4);
+    return NULL;
+  }
+
+  if( json_type_array == json_object_get_type( poObjGeoms ) )
+  {
+    const int nGeoms = json_object_array_length( poObjGeoms );
+    json_object* poObjGeom = NULL;
+    for(i = 0; i < nGeoms; ++i )
+    {
+      poObjGeom = json_object_array_get_idx( poObjGeoms, i );
+      geom = (RTGEOM*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION *)geom,
+                                              parse_geojson(poObjGeom, hasz, root_srid));
+    }
+  }
+
+  return geom;
 }
 
 static RTGEOM*
 parse_geojson(json_object *geojson, int *hasz, int root_srid)
 {
-	json_object* type = NULL;
-	const char* name;
+  json_object* type = NULL;
+  const char* name;
 
-	if( NULL == geojson ) 
-	{
-		geojson_rterror("invalid GeoJSON representation", 2);
-		return NULL;
-	}
+  if( NULL == geojson )
+  {
+    geojson_rterror("invalid GeoJSON representation", 2);
+    return NULL;
+  }
 
-	type = findMemberByName( geojson, "type" );
-	if( NULL == type ) 
-	{
-		geojson_rterror("unknown GeoJSON type", 3);
-		return NULL;
-	}
+  type = findMemberByName( geojson, "type" );
+  if( NULL == type )
+  {
+    geojson_rterror("unknown GeoJSON type", 3);
+    return NULL;
+  }
 
-	name = json_object_get_string( type );
+  name = json_object_get_string( type );
 
-	if( strcasecmp( name, "Point" )==0 )
-		return parse_geojson_point(geojson, hasz, root_srid);
+  if( strcasecmp( name, "Point" )==0 )
+    return parse_geojson_point(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "LineString" )==0 )
-		return parse_geojson_linestring(geojson, hasz, root_srid);
+  if( strcasecmp( name, "LineString" )==0 )
+    return parse_geojson_linestring(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "Polygon" )==0 )
-		return parse_geojson_polygon(geojson, hasz, root_srid);
+  if( strcasecmp( name, "Polygon" )==0 )
+    return parse_geojson_polygon(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "MultiPoint" )==0 )
-		return parse_geojson_multipoint(geojson, hasz, root_srid);
+  if( strcasecmp( name, "MultiPoint" )==0 )
+    return parse_geojson_multipoint(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "MultiLineString" )==0 )
-		return parse_geojson_multilinestring(geojson, hasz, root_srid);
+  if( strcasecmp( name, "MultiLineString" )==0 )
+    return parse_geojson_multilinestring(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "MultiPolygon" )==0 )
-		return parse_geojson_multipolygon(geojson, hasz, root_srid);
+  if( strcasecmp( name, "MultiPolygon" )==0 )
+    return parse_geojson_multipolygon(geojson, hasz, root_srid);
 
-	if( strcasecmp( name, "GeometryCollection" )==0 )
-		return parse_geojson_geometrycollection(geojson, hasz, root_srid);
+  if( strcasecmp( name, "GeometryCollection" )==0 )
+    return parse_geojson_geometrycollection(geojson, hasz, root_srid);
 
-	rterror(ctx, "invalid GeoJson representation");
-	return NULL; /* Never reach */
+  rterror(ctx, "invalid GeoJson representation");
+  return NULL; /* Never reach */
 }
 
 #endif /* HAVE_LIBJSON or HAVE_LIBJSON_C --} */
@@ -527,72 +527,72 @@ RTGEOM*
 rtgeom_from_geojson(const RTCTX *ctx, const char *geojson, char **srs)
 {
 #ifndef HAVE_LIBJSON
-	*srs = NULL;
-	rterror(ctx, "You need JSON-C for rtgeom_from_geojson");
-	return NULL;
+  *srs = NULL;
+  rterror(ctx, "You need JSON-C for rtgeom_from_geojson");
+  return NULL;
 #else /* HAVE_LIBJSON */
 
-	/* size_t geojson_size = strlen(geojson); */
-
-	RTGEOM *rtgeom;
-	int hasz=RT_TRUE;
-	json_tokener* jstok = NULL;
-	json_object* poObj = NULL;
-	json_object* poObjSrs = NULL;
-	*srs = NULL;
-
-	/* Begin to Parse json */
-	jstok = json_tokener_new();
-	poObj = json_tokener_parse_ex(jstok, geojson, -1);
-	if( jstok->err != json_tokener_success)
-	{
-		char err[256];
-		snprintf(err, 256, "%s (at offset %d)", json_tokener_error_desc(jstok->err), jstok->char_offset);
-		json_tokener_free(jstok);
-		json_object_put(poObj);
-		geojson_rterror(err, 1);
-		return NULL;
-	}
-	json_tokener_free(jstok);
-
-	poObjSrs = findMemberByName( poObj, "crs" );
-	if (poObjSrs != NULL)
-	{
-		json_object* poObjSrsType = findMemberByName( poObjSrs, "type" );
-		if (poObjSrsType != NULL)
-		{
-			json_object* poObjSrsProps = findMemberByName( poObjSrs, "properties" );
-			if ( poObjSrsProps )
-			{
-				json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
-				if ( poNameURL )
-				{
-					const char* pszName = json_object_get_string( poNameURL );
-					if ( pszName )
-					{
-						*srs = rtalloc(ctx, strlen(pszName) + 1);
-						strcpy(*srs, pszName);
-					}
-				}
-			}
-		}
-	}
-
-	rtgeom = parse_geojson(poObj, &hasz, 0);
-	json_object_put(poObj);
-
-	rtgeom_add_bbox(ctx, rtgeom);
-
-	if (!hasz)
-	{
-		RTGEOM *tmp = rtgeom_force_2d(ctx, rtgeom);
-		rtgeom_free(ctx, rtgeom);
-		rtgeom = tmp;
-
-		RTDEBUG(2, "geom_from_geojson called.");
-	}
-
-	return rtgeom;
+  /* size_t geojson_size = strlen(geojson); */
+
+  RTGEOM *rtgeom;
+  int hasz=RT_TRUE;
+  json_tokener* jstok = NULL;
+  json_object* poObj = NULL;
+  json_object* poObjSrs = NULL;
+  *srs = NULL;
+
+  /* Begin to Parse json */
+  jstok = json_tokener_new();
+  poObj = json_tokener_parse_ex(jstok, geojson, -1);
+  if( jstok->err != json_tokener_success)
+  {
+    char err[256];
+    snprintf(err, 256, "%s (at offset %d)", json_tokener_error_desc(jstok->err), jstok->char_offset);
+    json_tokener_free(jstok);
+    json_object_put(poObj);
+    geojson_rterror(err, 1);
+    return NULL;
+  }
+  json_tokener_free(jstok);
+
+  poObjSrs = findMemberByName( poObj, "crs" );
+  if (poObjSrs != NULL)
+  {
+    json_object* poObjSrsType = findMemberByName( poObjSrs, "type" );
+    if (poObjSrsType != NULL)
+    {
+      json_object* poObjSrsProps = findMemberByName( poObjSrs, "properties" );
+      if ( poObjSrsProps )
+      {
+        json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
+        if ( poNameURL )
+        {
+          const char* pszName = json_object_get_string( poNameURL );
+          if ( pszName )
+          {
+            *srs = rtalloc(ctx, strlen(pszName) + 1);
+            strcpy(*srs, pszName);
+          }
+        }
+      }
+    }
+  }
+
+  rtgeom = parse_geojson(poObj, &hasz, 0);
+  json_object_put(poObj);
+
+  rtgeom_add_bbox(ctx, rtgeom);
+
+  if (!hasz)
+  {
+    RTGEOM *tmp = rtgeom_force_2d(ctx, rtgeom);
+    rtgeom_free(ctx, rtgeom);
+    rtgeom = tmp;
+
+    RTDEBUG(2, "geom_from_geojson called.");
+  }
+
+  return rtgeom;
 #endif /* HAVE_LIBJSON } */
 }
 
diff --git a/src/rtin_twkb.c b/src/rtin_twkb.c
index 1d5a76a..5e9eda0 100644
--- a/src/rtin_twkb.c
+++ b/src/rtin_twkb.c
@@ -36,34 +36,34 @@
 */
 typedef struct
 {
-	/* Pointers to the bytes */
-	uint8_t *twkb; /* Points to start of TWKB */
-	uint8_t *twkb_end; /* Points to end of TWKB */
-	uint8_t *pos; /* Current read position */
+  /* Pointers to the bytes */
+  uint8_t *twkb; /* Points to start of TWKB */
+  uint8_t *twkb_end; /* Points to end of TWKB */
+  uint8_t *pos; /* Current read position */
 
-	uint32_t check; /* Simple validity checks on geometries */
-	uint32_t rttype; /* Current type we are handling */
+  uint32_t check; /* Simple validity checks on geometries */
+  uint32_t rttype; /* Current type we are handling */
 
-	uint8_t has_bbox;
-	uint8_t has_size;
-	uint8_t has_idlist;
-	uint8_t has_z;
-	uint8_t has_m;
-	uint8_t is_empty;
+  uint8_t has_bbox;
+  uint8_t has_size;
+  uint8_t has_idlist;
+  uint8_t has_z;
+  uint8_t has_m;
+  uint8_t is_empty;
 
-	/* Precision factors to convert ints to double */
-	double factor;
-	double factor_z;
-	double factor_m;
+  /* Precision factors to convert ints to double */
+  double factor;
+  double factor_z;
+  double factor_m;
 
-	uint64_t size;
+  uint64_t size;
 
-	/* Info about current geometry */
-	uint8_t magic_byte; /* the magic byte contain info about if twkb contain id, size info, bboxes and precision */
+  /* Info about current geometry */
+  uint8_t magic_byte; /* the magic byte contain info about if twkb contain id, size info, bboxes and precision */
 
-	int ndims; /* Number of dimensions */
+  int ndims; /* Number of dimensions */
 
-	int64_t *coords; /* An array to keep delta values from 4 dimensions */
+  int64_t *coords; /* An array to keep delta values from 4 dimensions */
 
 } twkb_parse_state;
 
@@ -82,76 +82,76 @@ RTGEOM* rtgeom_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s);
 */
 static inline void twkb_parse_state_advance(const RTCTX *ctx, twkb_parse_state *s, size_t next)
 {
-	if( (s->pos + next) > s->twkb_end)
-	{
-		rterror(ctx, "%s: TWKB structure does not match expected size!", __func__);
-		// rtnotice(ctx, "TWKB structure does not match expected size!");
-	}
+  if( (s->pos + next) > s->twkb_end)
+  {
+    rterror(ctx, "%s: TWKB structure does not match expected size!", __func__);
+    // rtnotice(ctx, "TWKB structure does not match expected size!");
+  }
 
-	s->pos += next;
+  s->pos += next;
 }
 
 static inline int64_t twkb_parse_state_varint(const RTCTX *ctx, twkb_parse_state *s)
 {
-	size_t size;
-	int64_t val = varint_s64_decode(ctx, s->pos, s->twkb_end, &size);
-	twkb_parse_state_advance(ctx, s, size);
-	return val;
+  size_t size;
+  int64_t val = varint_s64_decode(ctx, s->pos, s->twkb_end, &size);
+  twkb_parse_state_advance(ctx, s, size);
+  return val;
 }
 
 static inline uint64_t twkb_parse_state_uvarint(const RTCTX *ctx, twkb_parse_state *s)
 {
-	size_t size;
-	uint64_t val = varint_u64_decode(ctx, s->pos, s->twkb_end, &size);
-	twkb_parse_state_advance(ctx, s, size);
-	return val;
+  size_t size;
+  uint64_t val = varint_u64_decode(ctx, s->pos, s->twkb_end, &size);
+  twkb_parse_state_advance(ctx, s, size);
+  return val;
 }
 
 static inline double twkb_parse_state_double(const RTCTX *ctx, twkb_parse_state *s, double factor)
 {
-	size_t size;
-	int64_t val = varint_s64_decode(ctx, s->pos, s->twkb_end, &size);
-	twkb_parse_state_advance(ctx, s, size);
-	return val / factor;
+  size_t size;
+  int64_t val = varint_s64_decode(ctx, s->pos, s->twkb_end, &size);
+  twkb_parse_state_advance(ctx, s, size);
+  return val / factor;
 }
 
 static inline void twkb_parse_state_varint_skip(const RTCTX *ctx, twkb_parse_state *s)
 {
-	size_t size = varint_size(ctx, s->pos, s->twkb_end);
+  size_t size = varint_size(ctx, s->pos, s->twkb_end);
 
-	if ( ! size )
-		rterror(ctx, "%s: no varint to skip", __func__);
+  if ( ! size )
+    rterror(ctx, "%s: no varint to skip", __func__);
 
-	twkb_parse_state_advance(ctx, s, size);
-	return;
+  twkb_parse_state_advance(ctx, s, size);
+  return;
 }
 
 
 
 static uint32_t rttype_from_twkb_type(const RTCTX *ctx, uint8_t twkb_type)
 {
-	switch (twkb_type)
-	{
-		case 1:
-			return RTPOINTTYPE;
-		case 2:
-			return RTLINETYPE;
-		case 3:
-			return RTPOLYGONTYPE;
-		case 4:
-			return RTMULTIPOINTTYPE;
-		case 5:
-			return RTMULTILINETYPE;
-		case 6:
-			return RTMULTIPOLYGONTYPE;
-		case 7:
-			return RTCOLLECTIONTYPE;
-
-		default: /* Error! */
-			rterror(ctx, "Unknown RTWKB type");
-			return 0;
-	}
-	return 0;
+  switch (twkb_type)
+  {
+    case 1:
+      return RTPOINTTYPE;
+    case 2:
+      return RTLINETYPE;
+    case 3:
+      return RTPOLYGONTYPE;
+    case 4:
+      return RTMULTIPOINTTYPE;
+    case 5:
+      return RTMULTILINETYPE;
+    case 6:
+      return RTMULTIPOLYGONTYPE;
+    case 7:
+      return RTCOLLECTIONTYPE;
+
+    default: /* Error! */
+      rterror(ctx, "Unknown RTWKB type");
+      return 0;
+  }
+  return 0;
 }
 
 /**
@@ -160,9 +160,9 @@ static uint32_t rttype_from_twkb_type(const RTCTX *ctx, uint8_t twkb_type)
 */
 static uint8_t byte_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	uint8_t val = *(s->pos);
-	twkb_parse_state_advance(ctx, s, RTWKB_BYTE_SIZE);
-	return val;
+  uint8_t val = *(s->pos);
+  twkb_parse_state_advance(ctx, s, RTWKB_BYTE_SIZE);
+  return val;
 }
 
 
@@ -172,48 +172,48 @@ static uint8_t byte_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 static RTPOINTARRAY* ptarray_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s, uint32_t npoints)
 {
-	RTPOINTARRAY *pa = NULL;
-	uint32_t ndims = s->ndims;
-	int i;
-	double *dlist;
-
-	RTDEBUG(2,"Entering ptarray_from_twkb_state");
-	RTDEBUGF(4,"Pointarray has %d points", npoints);
-
-	/* Empty! */
-	if( npoints == 0 )
-		return ptarray_construct_empty(ctx, s->has_z, s->has_m, 0);
-
-	pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
-	dlist = (double*)(pa->serialized_pointlist);
-	for( i = 0; i < npoints; i++ )
-	{
-		int j = 0;
-		/* X */
-		s->coords[j] += twkb_parse_state_varint(ctx, s);
-		dlist[ndims*i + j] = s->coords[j] / s->factor;
-		j++;
-		/* Y */
-		s->coords[j] += twkb_parse_state_varint(ctx, s);
-		dlist[ndims*i + j] = s->coords[j] / s->factor;
-		j++;
-		/* Z */
-		if ( s->has_z )
-		{
-			s->coords[j] += twkb_parse_state_varint(ctx, s);
-			dlist[ndims*i + j] = s->coords[j] / s->factor_z;
-			j++;
-		}
-		/* M */
-		if ( s->has_m )
-		{
-			s->coords[j] += twkb_parse_state_varint(ctx, s);
-			dlist[ndims*i + j] = s->coords[j] / s->factor_m;
-			j++;
-		}
-	}
-
-	return pa;
+  RTPOINTARRAY *pa = NULL;
+  uint32_t ndims = s->ndims;
+  int i;
+  double *dlist;
+
+  RTDEBUG(2,"Entering ptarray_from_twkb_state");
+  RTDEBUGF(4,"Pointarray has %d points", npoints);
+
+  /* Empty! */
+  if( npoints == 0 )
+    return ptarray_construct_empty(ctx, s->has_z, s->has_m, 0);
+
+  pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
+  dlist = (double*)(pa->serialized_pointlist);
+  for( i = 0; i < npoints; i++ )
+  {
+    int j = 0;
+    /* X */
+    s->coords[j] += twkb_parse_state_varint(ctx, s);
+    dlist[ndims*i + j] = s->coords[j] / s->factor;
+    j++;
+    /* Y */
+    s->coords[j] += twkb_parse_state_varint(ctx, s);
+    dlist[ndims*i + j] = s->coords[j] / s->factor;
+    j++;
+    /* Z */
+    if ( s->has_z )
+    {
+      s->coords[j] += twkb_parse_state_varint(ctx, s);
+      dlist[ndims*i + j] = s->coords[j] / s->factor_z;
+      j++;
+    }
+    /* M */
+    if ( s->has_m )
+    {
+      s->coords[j] += twkb_parse_state_varint(ctx, s);
+      dlist[ndims*i + j] = s->coords[j] / s->factor_m;
+      j++;
+    }
+  }
+
+  return pa;
 }
 
 /**
@@ -221,16 +221,16 @@ static RTPOINTARRAY* ptarray_from_twkb_state(const RTCTX *ctx, twkb_parse_state
 */
 static RTPOINT* rtpoint_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	static uint32_t npoints = 1;
-	RTPOINTARRAY *pa;
+  static uint32_t npoints = 1;
+  RTPOINTARRAY *pa;
 
-	RTDEBUG(2,"Entering rtpoint_from_twkb_state");
+  RTDEBUG(2,"Entering rtpoint_from_twkb_state");
 
-	if ( s->is_empty )
-		return rtpoint_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+  if ( s->is_empty )
+    return rtpoint_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
 
-	pa = ptarray_from_twkb_state(ctx, s, npoints);
-	return rtpoint_construct(ctx, SRID_UNKNOWN, NULL, pa);
+  pa = ptarray_from_twkb_state(ctx, s, npoints);
+  return rtpoint_construct(ctx, SRID_UNKNOWN, NULL, pa);
 }
 
 /**
@@ -238,33 +238,33 @@ static RTPOINT* rtpoint_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 static RTLINE* rtline_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	uint32_t npoints;
-	RTPOINTARRAY *pa;
+  uint32_t npoints;
+  RTPOINTARRAY *pa;
 
-	RTDEBUG(2,"Entering rtline_from_twkb_state");
+  RTDEBUG(2,"Entering rtline_from_twkb_state");
 
-	if ( s->is_empty )
-		return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+  if ( s->is_empty )
+    return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
 
-	/* Read number of points */
-	npoints = twkb_parse_state_uvarint(ctx, s);
+  /* Read number of points */
+  npoints = twkb_parse_state_uvarint(ctx, s);
 
-	if ( npoints == 0 )
-		return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+  if ( npoints == 0 )
+    return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
 
-	/* Read coordinates */
-	pa = ptarray_from_twkb_state(ctx, s, npoints);
+  /* Read coordinates */
+  pa = ptarray_from_twkb_state(ctx, s, npoints);
 
-	if( pa == NULL )
-		return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+  if( pa == NULL )
+    return rtline_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
 
-	if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
-	{
-		rterror(ctx, "%s must have at least two points", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
+  if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
+  {
+    rterror(ctx, "%s must have at least two points", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
 
-	return rtline_construct(ctx, SRID_UNKNOWN, NULL, pa);
+  return rtline_construct(ctx, SRID_UNKNOWN, NULL, pa);
 }
 
 /**
@@ -272,62 +272,62 @@ static RTLINE* rtline_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 static RTPOLY* rtpoly_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	uint32_t nrings;
-	int i;
-	RTPOLY *poly;
-
-	RTDEBUG(2,"Entering rtpoly_from_twkb_state");
-
-	if ( s->is_empty )
-		return rtpoly_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
-
-	/* Read number of rings */
-	nrings = twkb_parse_state_uvarint(ctx, s);
-
-	/* Start w/ empty polygon */
-	poly = rtpoly_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
-
-	RTDEBUGF(4,"Polygon has %d rings", nrings);
-
-	/* Empty polygon? */
-	if( nrings == 0 )
-		return poly;
-
-	for( i = 0; i < nrings; i++ )
-	{
-		/* Ret number of points */
-		uint32_t npoints = twkb_parse_state_uvarint(ctx, s);
-		RTPOINTARRAY *pa = ptarray_from_twkb_state(ctx, s, npoints);
-
-		/* Skip empty rings */
-		if( pa == NULL )
-			continue;
-
-		/* Force first and last points to be the same. */
-		if( ! ptarray_is_closed_2d(ctx, pa) )
-		{
-			RTPOINT4D pt;
-			rt_getPoint4d_p(ctx, pa, 0, &pt);
-			ptarray_append_point(ctx, pa, &pt, RT_FALSE);
-		}
-
-		/* Check for at least four points. */
-		if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
-		{
-			RTDEBUGF(2, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
-			rterror(ctx, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
-			return NULL;
-		}
-
-		/* Add ring to polygon */
-		if ( rtpoly_add_ring(ctx, poly, pa) == RT_FAILURE )
-		{
-			RTDEBUG(2, "Unable to add ring to polygon");
-			rterror(ctx, "Unable to add ring to polygon");
-		}
-
-	}
-	return poly;
+  uint32_t nrings;
+  int i;
+  RTPOLY *poly;
+
+  RTDEBUG(2,"Entering rtpoly_from_twkb_state");
+
+  if ( s->is_empty )
+    return rtpoly_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+
+  /* Read number of rings */
+  nrings = twkb_parse_state_uvarint(ctx, s);
+
+  /* Start w/ empty polygon */
+  poly = rtpoly_construct_empty(ctx, SRID_UNKNOWN, s->has_z, s->has_m);
+
+  RTDEBUGF(4,"Polygon has %d rings", nrings);
+
+  /* Empty polygon? */
+  if( nrings == 0 )
+    return poly;
+
+  for( i = 0; i < nrings; i++ )
+  {
+    /* Ret number of points */
+    uint32_t npoints = twkb_parse_state_uvarint(ctx, s);
+    RTPOINTARRAY *pa = ptarray_from_twkb_state(ctx, s, npoints);
+
+    /* Skip empty rings */
+    if( pa == NULL )
+      continue;
+
+    /* Force first and last points to be the same. */
+    if( ! ptarray_is_closed_2d(ctx, pa) )
+    {
+      RTPOINT4D pt;
+      rt_getPoint4d_p(ctx, pa, 0, &pt);
+      ptarray_append_point(ctx, pa, &pt, RT_FALSE);
+    }
+
+    /* Check for at least four points. */
+    if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
+    {
+      RTDEBUGF(2, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
+      rterror(ctx, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
+      return NULL;
+    }
+
+    /* Add ring to polygon */
+    if ( rtpoly_add_ring(ctx, poly, pa) == RT_FAILURE )
+    {
+      RTDEBUG(2, "Unable to add ring to polygon");
+      rterror(ctx, "Unable to add ring to polygon");
+    }
+
+  }
+  return poly;
 }
 
 
@@ -336,37 +336,37 @@ static RTPOLY* rtpoly_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 static RTCOLLECTION* rtmultipoint_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	int ngeoms, i;
-	RTGEOM *geom = NULL;
-	RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
-
-	RTDEBUG(2,"Entering rtmultipoint_from_twkb_state");
-
-	if ( s->is_empty )
-		return col;
-
-	/* Read number of geometries */
-	ngeoms = twkb_parse_state_uvarint(ctx, s);
-	RTDEBUGF(4,"Number of geometries %d", ngeoms);
-
-	/* It has an idlist, we need to skip that */
-	if ( s->has_idlist )
-	{
-		for ( i = 0; i < ngeoms; i++ )
-			twkb_parse_state_varint_skip(ctx, s);
-	}
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtpoint_as_rtgeom(ctx, rtpoint_from_twkb_state(ctx, s));
-		if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
-		{
-			rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
-			return NULL;
-		}
-	}
-
-	return col;
+  int ngeoms, i;
+  RTGEOM *geom = NULL;
+  RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
+
+  RTDEBUG(2,"Entering rtmultipoint_from_twkb_state");
+
+  if ( s->is_empty )
+    return col;
+
+  /* Read number of geometries */
+  ngeoms = twkb_parse_state_uvarint(ctx, s);
+  RTDEBUGF(4,"Number of geometries %d", ngeoms);
+
+  /* It has an idlist, we need to skip that */
+  if ( s->has_idlist )
+  {
+    for ( i = 0; i < ngeoms; i++ )
+      twkb_parse_state_varint_skip(ctx, s);
+  }
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtpoint_as_rtgeom(ctx, rtpoint_from_twkb_state(ctx, s));
+    if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
+    {
+      rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
+      return NULL;
+    }
+  }
+
+  return col;
 }
 
 /**
@@ -374,38 +374,38 @@ static RTCOLLECTION* rtmultipoint_from_twkb_state(const RTCTX *ctx, twkb_parse_s
 */
 static RTCOLLECTION* rtmultiline_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	int ngeoms, i;
-	RTGEOM *geom = NULL;
-	RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
-
-	RTDEBUG(2,"Entering rtmultilinestring_from_twkb_state");
-
-	if ( s->is_empty )
-		return col;
-
-	/* Read number of geometries */
-	ngeoms = twkb_parse_state_uvarint(ctx, s);
-
-	RTDEBUGF(4,"Number of geometries %d",ngeoms);
-
-	/* It has an idlist, we need to skip that */
-	if ( s->has_idlist )
-	{
-		for ( i = 0; i < ngeoms; i++ )
-			twkb_parse_state_varint_skip(ctx, s);
-	}
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtline_as_rtgeom(ctx, rtline_from_twkb_state(ctx, s));
-		if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
-		{
-			rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
-			return NULL;
-		}
-	}
-
-	return col;
+  int ngeoms, i;
+  RTGEOM *geom = NULL;
+  RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
+
+  RTDEBUG(2,"Entering rtmultilinestring_from_twkb_state");
+
+  if ( s->is_empty )
+    return col;
+
+  /* Read number of geometries */
+  ngeoms = twkb_parse_state_uvarint(ctx, s);
+
+  RTDEBUGF(4,"Number of geometries %d",ngeoms);
+
+  /* It has an idlist, we need to skip that */
+  if ( s->has_idlist )
+  {
+    for ( i = 0; i < ngeoms; i++ )
+      twkb_parse_state_varint_skip(ctx, s);
+  }
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtline_as_rtgeom(ctx, rtline_from_twkb_state(ctx, s));
+    if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
+    {
+      rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
+      return NULL;
+    }
+  }
+
+  return col;
 }
 
 /**
@@ -413,37 +413,37 @@ static RTCOLLECTION* rtmultiline_from_twkb_state(const RTCTX *ctx, twkb_parse_st
 */
 static RTCOLLECTION* rtmultipoly_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	int ngeoms, i;
-	RTGEOM *geom = NULL;
-	RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
-
-	RTDEBUG(2,"Entering rtmultipolygon_from_twkb_state");
-
-	if ( s->is_empty )
-		return col;
-
-	/* Read number of geometries */
-	ngeoms = twkb_parse_state_uvarint(ctx, s);
-	RTDEBUGF(4,"Number of geometries %d",ngeoms);
-
-	/* It has an idlist, we need to skip that */
-	if ( s->has_idlist )
-	{
-		for ( i = 0; i < ngeoms; i++ )
-			twkb_parse_state_varint_skip(ctx, s);
-	}
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtpoly_as_rtgeom(ctx, rtpoly_from_twkb_state(ctx, s));
-		if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
-		{
-			rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
-			return NULL;
-		}
-	}
-
-	return col;
+  int ngeoms, i;
+  RTGEOM *geom = NULL;
+  RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
+
+  RTDEBUG(2,"Entering rtmultipolygon_from_twkb_state");
+
+  if ( s->is_empty )
+    return col;
+
+  /* Read number of geometries */
+  ngeoms = twkb_parse_state_uvarint(ctx, s);
+  RTDEBUGF(4,"Number of geometries %d",ngeoms);
+
+  /* It has an idlist, we need to skip that */
+  if ( s->has_idlist )
+  {
+    for ( i = 0; i < ngeoms; i++ )
+      twkb_parse_state_varint_skip(ctx, s);
+  }
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtpoly_as_rtgeom(ctx, rtpoly_from_twkb_state(ctx, s));
+    if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
+    {
+      rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
+      return NULL;
+    }
+  }
+
+  return col;
 }
 
 
@@ -452,104 +452,104 @@ static RTCOLLECTION* rtmultipoly_from_twkb_state(const RTCTX *ctx, twkb_parse_st
 **/
 static RTCOLLECTION* rtcollection_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	int ngeoms, i;
-	RTGEOM *geom = NULL;
-	RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
+  int ngeoms, i;
+  RTGEOM *geom = NULL;
+  RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, SRID_UNKNOWN, s->has_z, s->has_m);
 
-	RTDEBUG(2,"Entering rtcollection_from_twkb_state");
+  RTDEBUG(2,"Entering rtcollection_from_twkb_state");
 
-	if ( s->is_empty )
-		return col;
+  if ( s->is_empty )
+    return col;
 
-	/* Read number of geometries */
-	ngeoms = twkb_parse_state_uvarint(ctx, s);
+  /* Read number of geometries */
+  ngeoms = twkb_parse_state_uvarint(ctx, s);
 
-	RTDEBUGF(4,"Number of geometries %d",ngeoms);
+  RTDEBUGF(4,"Number of geometries %d",ngeoms);
 
-	/* It has an idlist, we need to skip that */
-	if ( s->has_idlist )
-	{
-		for ( i = 0; i < ngeoms; i++ )
-			twkb_parse_state_varint_skip(ctx, s);
-	}
+  /* It has an idlist, we need to skip that */
+  if ( s->has_idlist )
+  {
+    for ( i = 0; i < ngeoms; i++ )
+      twkb_parse_state_varint_skip(ctx, s);
+  }
 
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtgeom_from_twkb_state(ctx, s);
-		if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
-		{
-			rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
-			return NULL;
-		}
-	}
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtgeom_from_twkb_state(ctx, s);
+    if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
+    {
+      rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
+      return NULL;
+    }
+  }
 
 
-	return col;
+  return col;
 }
 
 
 static void header_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	RTDEBUG(2,"Entering magicbyte_from_twkb_state");
-
-	uint8_t extended_dims;
-
-	/* Read the first two bytes */
-	uint8_t type_precision = byte_from_twkb_state(ctx, s);
-	uint8_t metadata = byte_from_twkb_state(ctx, s);
-
-	/* Strip type and precision out of first byte */
-	uint8_t type = type_precision & 0x0F;
-	int8_t precision = unzigzag8(ctx, (type_precision & 0xF0) >> 4);
-
-	/* Convert TWKB type to internal type */
-	s->rttype = rttype_from_twkb_type(ctx, type);
-
-	/* Convert the precision into factor */
-	s->factor = pow(10, (double)precision);
-
-	/* Strip metadata flags out of second byte */
-	s->has_bbox   =  metadata & 0x01;
-	s->has_size   = (metadata & 0x02) >> 1;
-	s->has_idlist = (metadata & 0x04) >> 2;
-	extended_dims = (metadata & 0x08) >> 3;
-	s->is_empty   = (metadata & 0x10) >> 4;
-
-	/* Flag for higher dims means read a third byte */
-	if ( extended_dims )
-	{
-		int8_t precision_z, precision_m;
-
-		extended_dims = byte_from_twkb_state(ctx, s);
-
-		/* Strip Z/M presence and precision from ext byte */
-		s->has_z    = (extended_dims & 0x01);
-		s->has_m    = (extended_dims & 0x02) >> 1;
-		precision_z = (extended_dims & 0x1C) >> 2;
-		precision_m = (extended_dims & 0xE0) >> 5;
-
-		/* Convert the precision into factor */
-		s->factor_z = pow(10, (double)precision_z);
-		s->factor_m = pow(10, (double)precision_m);
-	}
-	else
-	{
-		s->has_z = 0;
-		s->has_m = 0;
-		s->factor_z = 0;
-		s->factor_m = 0;
-	}
-
-	/* Read the size, if there is one */
-	if ( s->has_size )
-	{
-		s->size = twkb_parse_state_uvarint(ctx, s);
-	}
-
-	/* Calculate the number of dimensions */
-	s->ndims = 2 + s->has_z + s->has_m;
-
-	return;
+  RTDEBUG(2,"Entering magicbyte_from_twkb_state");
+
+  uint8_t extended_dims;
+
+  /* Read the first two bytes */
+  uint8_t type_precision = byte_from_twkb_state(ctx, s);
+  uint8_t metadata = byte_from_twkb_state(ctx, s);
+
+  /* Strip type and precision out of first byte */
+  uint8_t type = type_precision & 0x0F;
+  int8_t precision = unzigzag8(ctx, (type_precision & 0xF0) >> 4);
+
+  /* Convert TWKB type to internal type */
+  s->rttype = rttype_from_twkb_type(ctx, type);
+
+  /* Convert the precision into factor */
+  s->factor = pow(10, (double)precision);
+
+  /* Strip metadata flags out of second byte */
+  s->has_bbox   =  metadata & 0x01;
+  s->has_size   = (metadata & 0x02) >> 1;
+  s->has_idlist = (metadata & 0x04) >> 2;
+  extended_dims = (metadata & 0x08) >> 3;
+  s->is_empty   = (metadata & 0x10) >> 4;
+
+  /* Flag for higher dims means read a third byte */
+  if ( extended_dims )
+  {
+    int8_t precision_z, precision_m;
+
+    extended_dims = byte_from_twkb_state(ctx, s);
+
+    /* Strip Z/M presence and precision from ext byte */
+    s->has_z    = (extended_dims & 0x01);
+    s->has_m    = (extended_dims & 0x02) >> 1;
+    precision_z = (extended_dims & 0x1C) >> 2;
+    precision_m = (extended_dims & 0xE0) >> 5;
+
+    /* Convert the precision into factor */
+    s->factor_z = pow(10, (double)precision_z);
+    s->factor_m = pow(10, (double)precision_m);
+  }
+  else
+  {
+    s->has_z = 0;
+    s->has_m = 0;
+    s->factor_z = 0;
+    s->factor_m = 0;
+  }
+
+  /* Read the size, if there is one */
+  if ( s->has_size )
+  {
+    s->size = twkb_parse_state_uvarint(ctx, s);
+  }
+
+  /* Calculate the number of dimensions */
+  s->ndims = 2 + s->has_z + s->has_m;
+
+  return;
 }
 
 
@@ -562,86 +562,86 @@ static void header_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 RTGEOM* rtgeom_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 {
-	RTGBOX bbox;
-	RTGEOM *geom = NULL;
-	uint32_t has_bbox = RT_FALSE;
-	int i;
-
-	/* Read the first two bytes, and optional */
-	/* extended precision info and optional size info */
-	header_from_twkb_state(ctx, s);
-
-	/* Just experienced a geometry header, so now we */
-	/* need to reset our coordinate deltas */
-	for ( i = 0; i < TWKB_IN_MAXCOORDS; i++ )
-	{
-		s->coords[i] = 0.0;
-	}
-
-	/* Read the bounding box, is there is one */
-	if ( s->has_bbox )
-	{
-		/* Initialize */
-		has_bbox = s->has_bbox;
-		memset(&bbox, 0, sizeof(RTGBOX));
-		bbox.flags = gflags(ctx, s->has_z, s->has_m, 0);
-
-		/* X */
-		bbox.xmin = twkb_parse_state_double(ctx, s, s->factor);
-		bbox.xmax = bbox.xmin + twkb_parse_state_double(ctx, s, s->factor);
-		/* Y */
-		bbox.ymin = twkb_parse_state_double(ctx, s, s->factor);
-		bbox.ymax = bbox.ymin + twkb_parse_state_double(ctx, s, s->factor);
-		/* Z */
-		if ( s->has_z )
-		{
-			bbox.zmin = twkb_parse_state_double(ctx, s, s->factor_z);
-			bbox.zmax = bbox.zmin + twkb_parse_state_double(ctx, s, s->factor_z);
-		}
-		/* M */
-		if ( s->has_z )
-		{
-			bbox.mmin = twkb_parse_state_double(ctx, s, s->factor_m);
-			bbox.mmax = bbox.mmin + twkb_parse_state_double(ctx, s, s->factor_m);
-		}
-	}
-
-	/* Switch to code for the particular type we're dealing with */
-	switch( s->rttype )
-	{
-		case RTPOINTTYPE:
-			geom = rtpoint_as_rtgeom(ctx, rtpoint_from_twkb_state(ctx, s));
-			break;
-		case RTLINETYPE:
-			geom = rtline_as_rtgeom(ctx, rtline_from_twkb_state(ctx, s));
-			break;
-		case RTPOLYGONTYPE:
-			geom = rtpoly_as_rtgeom(ctx, rtpoly_from_twkb_state(ctx, s));
-			break;
-		case RTMULTIPOINTTYPE:
-			geom = rtcollection_as_rtgeom(ctx, rtmultipoint_from_twkb_state(ctx, s));
-			break;
-		case RTMULTILINETYPE:
-			geom = rtcollection_as_rtgeom(ctx, rtmultiline_from_twkb_state(ctx, s));
-			break;
-		case RTMULTIPOLYGONTYPE:
-			geom = rtcollection_as_rtgeom(ctx, rtmultipoly_from_twkb_state(ctx, s));
-			break;
-		case RTCOLLECTIONTYPE:
-			geom = rtcollection_as_rtgeom(ctx, rtcollection_from_twkb_state(ctx, s));
-			break;
-		/* Unknown type! */
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, s->rttype), s->rttype);
-			break;
-	}
-
-	if ( has_bbox )
-	{
-		geom->bbox = gbox_clone(ctx, &bbox);
-	}
-
-	return geom;
+  RTGBOX bbox;
+  RTGEOM *geom = NULL;
+  uint32_t has_bbox = RT_FALSE;
+  int i;
+
+  /* Read the first two bytes, and optional */
+  /* extended precision info and optional size info */
+  header_from_twkb_state(ctx, s);
+
+  /* Just experienced a geometry header, so now we */
+  /* need to reset our coordinate deltas */
+  for ( i = 0; i < TWKB_IN_MAXCOORDS; i++ )
+  {
+    s->coords[i] = 0.0;
+  }
+
+  /* Read the bounding box, is there is one */
+  if ( s->has_bbox )
+  {
+    /* Initialize */
+    has_bbox = s->has_bbox;
+    memset(&bbox, 0, sizeof(RTGBOX));
+    bbox.flags = gflags(ctx, s->has_z, s->has_m, 0);
+
+    /* X */
+    bbox.xmin = twkb_parse_state_double(ctx, s, s->factor);
+    bbox.xmax = bbox.xmin + twkb_parse_state_double(ctx, s, s->factor);
+    /* Y */
+    bbox.ymin = twkb_parse_state_double(ctx, s, s->factor);
+    bbox.ymax = bbox.ymin + twkb_parse_state_double(ctx, s, s->factor);
+    /* Z */
+    if ( s->has_z )
+    {
+      bbox.zmin = twkb_parse_state_double(ctx, s, s->factor_z);
+      bbox.zmax = bbox.zmin + twkb_parse_state_double(ctx, s, s->factor_z);
+    }
+    /* M */
+    if ( s->has_z )
+    {
+      bbox.mmin = twkb_parse_state_double(ctx, s, s->factor_m);
+      bbox.mmax = bbox.mmin + twkb_parse_state_double(ctx, s, s->factor_m);
+    }
+  }
+
+  /* Switch to code for the particular type we're dealing with */
+  switch( s->rttype )
+  {
+    case RTPOINTTYPE:
+      geom = rtpoint_as_rtgeom(ctx, rtpoint_from_twkb_state(ctx, s));
+      break;
+    case RTLINETYPE:
+      geom = rtline_as_rtgeom(ctx, rtline_from_twkb_state(ctx, s));
+      break;
+    case RTPOLYGONTYPE:
+      geom = rtpoly_as_rtgeom(ctx, rtpoly_from_twkb_state(ctx, s));
+      break;
+    case RTMULTIPOINTTYPE:
+      geom = rtcollection_as_rtgeom(ctx, rtmultipoint_from_twkb_state(ctx, s));
+      break;
+    case RTMULTILINETYPE:
+      geom = rtcollection_as_rtgeom(ctx, rtmultiline_from_twkb_state(ctx, s));
+      break;
+    case RTMULTIPOLYGONTYPE:
+      geom = rtcollection_as_rtgeom(ctx, rtmultipoly_from_twkb_state(ctx, s));
+      break;
+    case RTCOLLECTIONTYPE:
+      geom = rtcollection_as_rtgeom(ctx, rtcollection_from_twkb_state(ctx, s));
+      break;
+    /* Unknown type! */
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, s->rttype), s->rttype);
+      break;
+  }
+
+  if ( has_bbox )
+  {
+    geom->bbox = gbox_clone(ctx, &bbox);
+  }
+
+  return geom;
 }
 
 
@@ -656,28 +656,28 @@ RTGEOM* rtgeom_from_twkb_state(const RTCTX *ctx, twkb_parse_state *s)
 */
 RTGEOM* rtgeom_from_twkb(const RTCTX *ctx, uint8_t *twkb, size_t twkb_size, char check)
 {
-	int64_t coords[TWKB_IN_MAXCOORDS] = {0, 0, 0, 0};
-	twkb_parse_state s;
+  int64_t coords[TWKB_IN_MAXCOORDS] = {0, 0, 0, 0};
+  twkb_parse_state s;
 
-	RTDEBUG(2,"Entering rtgeom_from_twkb");
-	RTDEBUGF(4,"twkb_size: %d",(int) twkb_size);
+  RTDEBUG(2,"Entering rtgeom_from_twkb");
+  RTDEBUGF(4,"twkb_size: %d",(int) twkb_size);
 
-	/* Zero out the state */
-	memset(&s, 0, sizeof(twkb_parse_state));
+  /* Zero out the state */
+  memset(&s, 0, sizeof(twkb_parse_state));
 
-	/* Initialize the state appropriately */
-	s.twkb = s.pos = twkb;
-	s.twkb_end = twkb + twkb_size;
-	s.check = check;
-	s.coords = coords;
+  /* Initialize the state appropriately */
+  s.twkb = s.pos = twkb;
+  s.twkb_end = twkb + twkb_size;
+  s.check = check;
+  s.coords = coords;
 
-	/* Handle the check catch-all values */
-	if ( check & RT_PARSER_CHECK_NONE )
-		s.check = 0;
-	else
-		s.check = check;
+  /* Handle the check catch-all values */
+  if ( check & RT_PARSER_CHECK_NONE )
+    s.check = 0;
+  else
+    s.check = check;
 
 
-	/* Read the rest of the geometry */
-	return rtgeom_from_twkb_state(ctx, &s);
+  /* Read the rest of the geometry */
+  return rtgeom_from_twkb_state(ctx, &s);
 }
diff --git a/src/rtin_wkb.c b/src/rtin_wkb.c
index 703fd52..dd0ba42 100644
--- a/src/rtin_wkb.c
+++ b/src/rtin_wkb.c
@@ -33,18 +33,18 @@
 /**
 * Used for passing the parse state between the parsing functions.
 */
-typedef struct 
+typedef struct
 {
-	const uint8_t *wkb; /* Points to start of RTWKB */
-	size_t wkb_size; /* Expected size of RTWKB */
-	int swap_bytes; /* Do an endian flip? */
-	int check; /* Simple validity checks on geometries */
-	uint32_t rttype; /* Current type we are handling */
-	uint32_t srid; /* Current SRID we are handling */
-	int has_z; /* Z? */
-	int has_m; /* M? */
-	int has_srid; /* SRID? */
-	const uint8_t *pos; /* Current parse position */
+  const uint8_t *wkb; /* Points to start of RTWKB */
+  size_t wkb_size; /* Expected size of RTWKB */
+  int swap_bytes; /* Do an endian flip? */
+  int check; /* Simple validity checks on geometries */
+  uint32_t rttype; /* Current type we are handling */
+  uint32_t srid; /* Current SRID we are handling */
+  int has_z; /* Z? */
+  int has_m; /* M? */
+  int has_srid; /* SRID? */
+  const uint8_t *pos; /* Current parse position */
 } wkb_parse_state;
 
 
@@ -69,7 +69,7 @@ static uint8_t hex2char[256] = {
     20,10,11,12,13,14,15,20,20,20,20,20,20,20,20,20,
     /* not Hex characters */
     20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
-	/* a-f */
+  /* a-f */
     20,10,11,12,13,14,15,20,20,20,20,20,20,20,20,20,
     20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
     /* not Hex characters (upper 128 characters) */
@@ -86,30 +86,30 @@ static uint8_t hex2char[256] = {
 
 uint8_t* bytes_from_hexbytes(const RTCTX *ctx, const char *hexbuf, size_t hexsize)
 {
-	uint8_t *buf = NULL;
-	register uint8_t h1, h2;
-	int i;
-	
-	if( hexsize % 2 )
-		rterror(ctx, "Invalid hex string, length (%d) has to be a multiple of two!", hexsize);
-
-	buf = rtalloc(ctx, hexsize/2);
-	
-	if( ! buf )
-		rterror(ctx, "Unable to allocate memory buffer.");
-		
-	for( i = 0; i < hexsize/2; i++ )
-	{
-		h1 = hex2char[(int)hexbuf[2*i]];
-		h2 = hex2char[(int)hexbuf[2*i+1]];
-		if( h1 > 15 )
-			rterror(ctx, "Invalid hex character (%c) encountered", hexbuf[2*i]);
-		if( h2 > 15 )
-			rterror(ctx, "Invalid hex character (%c) encountered", hexbuf[2*i+1]);
-		/* First character is high bits, second is low bits */
-		buf[i] = ((h1 & 0x0F) << 4) | (h2 & 0x0F);
-	}
-	return buf;
+  uint8_t *buf = NULL;
+  register uint8_t h1, h2;
+  int i;
+
+  if( hexsize % 2 )
+    rterror(ctx, "Invalid hex string, length (%d) has to be a multiple of two!", hexsize);
+
+  buf = rtalloc(ctx, hexsize/2);
+
+  if( ! buf )
+    rterror(ctx, "Unable to allocate memory buffer.");
+
+  for( i = 0; i < hexsize/2; i++ )
+  {
+    h1 = hex2char[(int)hexbuf[2*i]];
+    h2 = hex2char[(int)hexbuf[2*i+1]];
+    if( h1 > 15 )
+      rterror(ctx, "Invalid hex character (%c) encountered", hexbuf[2*i]);
+    if( h2 > 15 )
+      rterror(ctx, "Invalid hex character (%c) encountered", hexbuf[2*i+1]);
+    /* First character is high bits, second is low bits */
+    buf[i] = ((h1 & 0x0F) << 4) | (h2 & 0x0F);
+  }
+  return buf;
 }
 
 
@@ -120,126 +120,126 @@ uint8_t* bytes_from_hexbytes(const RTCTX *ctx, const char *hexbuf, size_t hexsiz
 
 
 /**
-* Check that we are not about to read off the end of the RTWKB 
+* Check that we are not about to read off the end of the RTWKB
 * array.
 */
 static inline void wkb_parse_state_check(const RTCTX *ctx, wkb_parse_state *s, size_t next)
 {
-	if( (s->pos + next) > (s->wkb + s->wkb_size) )
-		rterror(ctx, "RTWKB structure does not match expected size!");
-} 
+  if( (s->pos + next) > (s->wkb + s->wkb_size) )
+    rterror(ctx, "RTWKB structure does not match expected size!");
+}
 
 /**
 * Take in an unknown kind of wkb type number and ensure it comes out
-* as an extended RTWKB type number (with Z/M/SRID flags masked onto the 
+* as an extended RTWKB type number (with Z/M/SRID flags masked onto the
 * high bits).
 */
 static void rttype_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s, uint32_t wkb_type)
 {
-	uint32_t wkb_simple_type;
-	
-	RTDEBUG(4, "Entered function");
-	
-	s->has_z = RT_FALSE;
-	s->has_m = RT_FALSE;
-	s->has_srid = RT_FALSE;
-
-	/* If any of the higher bits are set, this is probably an extended type. */
-	if( wkb_type & 0xF0000000 )
-	{
-		if( wkb_type & RTWKBZOFFSET ) s->has_z = RT_TRUE;
-		if( wkb_type & RTWKBMOFFSET ) s->has_m = RT_TRUE;
-		if( wkb_type & RTWKBSRIDFLAG ) s->has_srid = RT_TRUE;
-		RTDEBUGF(4, "Extended type: has_z=%d has_m=%d has_srid=%d", s->has_z, s->has_m, s->has_srid);
-	}
-	
-	/* Mask off the flags */
-	wkb_type = wkb_type & 0x0FFFFFFF;
-	/* Strip out just the type number (1-12) from the ISO number (eg 3001-3012) */
-	wkb_simple_type = wkb_type % 1000;
-	
-	/* Extract the Z/M information from ISO style numbers */
-	if( wkb_type >= 3000 && wkb_type < 4000 )
-	{
-		s->has_z = RT_TRUE;
-		s->has_m = RT_TRUE;
-	}
-	else if ( wkb_type >= 2000 && wkb_type < 3000 )
-	{
-		s->has_m = RT_TRUE;
-	}
-	else if ( wkb_type >= 1000 && wkb_type < 2000 )
-	{
-		s->has_z = RT_TRUE;
-	}
-
-	switch (wkb_simple_type)
-	{
-		case RTWKB_POINT_TYPE: 
-			s->rttype = RTPOINTTYPE;
-			break;
-		case RTWKB_LINESTRING_TYPE: 
-			s->rttype = RTLINETYPE;
-			break;
-		case RTWKB_POLYGON_TYPE:
-			s->rttype = RTPOLYGONTYPE;
-			break;
-		case RTWKB_MULTIPOINT_TYPE:
-			s->rttype = RTMULTIPOINTTYPE;
-			break;
-		case RTWKB_MULTILINESTRING_TYPE:
-			s->rttype = RTMULTILINETYPE;
-			break;
-		case RTWKB_MULTIPOLYGON_TYPE:
-			s->rttype = RTMULTIPOLYGONTYPE;
-			break;
-		case RTWKB_GEOMETRYCOLLECTION_TYPE: 
-			s->rttype = RTCOLLECTIONTYPE;
-			break;
-		case RTWKB_CIRCULARSTRING_TYPE:
-			s->rttype = RTCIRCSTRINGTYPE;
-			break;
-		case RTWKB_COMPOUNDCURVE_TYPE:
-			s->rttype = RTCOMPOUNDTYPE;
-			break;
-		case RTWKB_CURVEPOLYGON_TYPE:
-			s->rttype = RTCURVEPOLYTYPE;
-			break;
-		case RTWKB_MULTICURVE_TYPE:
-			s->rttype = RTMULTICURVETYPE;
-			break;
-		case RTWKB_MULTISURFACE_TYPE: 
-			s->rttype = RTMULTISURFACETYPE;
-			break;
-		case RTWKB_POLYHEDRALSURFACE_TYPE:
-			s->rttype = RTPOLYHEDRALSURFACETYPE;
-			break;
-		case RTWKB_TIN_TYPE:
-			s->rttype = RTTINTYPE;
-			break;
-		case RTWKB_TRIANGLE_TYPE:
-			s->rttype = RTTRIANGLETYPE;
-			break;
-		
-		/* PostGIS 1.5 emits 13, 14 for CurvePolygon, MultiCurve */
-		/* These numbers aren't SQL/MM (numbers currently only */
-		/* go up to 12. We can handle the old data here (for now??) */
-		/* converting them into the rttypes that are intended. */
-		case RTWKB_CURVE_TYPE:
-			s->rttype = RTCURVEPOLYTYPE;
-			break;
-		case RTWKB_SURFACE_TYPE:
-			s->rttype = RTMULTICURVETYPE;
-			break;
-		
-		default: /* Error! */
-			rterror(ctx, "Unknown RTWKB type (%d)! Full RTWKB type number was (%d).", wkb_simple_type, wkb_type);
-			break;	
-	}
-
-	RTDEBUGF(4,"Got rttype %s (%u)", rttype_name(ctx, s->rttype), s->rttype);
-
-	return;
+  uint32_t wkb_simple_type;
+
+  RTDEBUG(4, "Entered function");
+
+  s->has_z = RT_FALSE;
+  s->has_m = RT_FALSE;
+  s->has_srid = RT_FALSE;
+
+  /* If any of the higher bits are set, this is probably an extended type. */
+  if( wkb_type & 0xF0000000 )
+  {
+    if( wkb_type & RTWKBZOFFSET ) s->has_z = RT_TRUE;
+    if( wkb_type & RTWKBMOFFSET ) s->has_m = RT_TRUE;
+    if( wkb_type & RTWKBSRIDFLAG ) s->has_srid = RT_TRUE;
+    RTDEBUGF(4, "Extended type: has_z=%d has_m=%d has_srid=%d", s->has_z, s->has_m, s->has_srid);
+  }
+
+  /* Mask off the flags */
+  wkb_type = wkb_type & 0x0FFFFFFF;
+  /* Strip out just the type number (1-12) from the ISO number (eg 3001-3012) */
+  wkb_simple_type = wkb_type % 1000;
+
+  /* Extract the Z/M information from ISO style numbers */
+  if( wkb_type >= 3000 && wkb_type < 4000 )
+  {
+    s->has_z = RT_TRUE;
+    s->has_m = RT_TRUE;
+  }
+  else if ( wkb_type >= 2000 && wkb_type < 3000 )
+  {
+    s->has_m = RT_TRUE;
+  }
+  else if ( wkb_type >= 1000 && wkb_type < 2000 )
+  {
+    s->has_z = RT_TRUE;
+  }
+
+  switch (wkb_simple_type)
+  {
+    case RTWKB_POINT_TYPE:
+      s->rttype = RTPOINTTYPE;
+      break;
+    case RTWKB_LINESTRING_TYPE:
+      s->rttype = RTLINETYPE;
+      break;
+    case RTWKB_POLYGON_TYPE:
+      s->rttype = RTPOLYGONTYPE;
+      break;
+    case RTWKB_MULTIPOINT_TYPE:
+      s->rttype = RTMULTIPOINTTYPE;
+      break;
+    case RTWKB_MULTILINESTRING_TYPE:
+      s->rttype = RTMULTILINETYPE;
+      break;
+    case RTWKB_MULTIPOLYGON_TYPE:
+      s->rttype = RTMULTIPOLYGONTYPE;
+      break;
+    case RTWKB_GEOMETRYCOLLECTION_TYPE:
+      s->rttype = RTCOLLECTIONTYPE;
+      break;
+    case RTWKB_CIRCULARSTRING_TYPE:
+      s->rttype = RTCIRCSTRINGTYPE;
+      break;
+    case RTWKB_COMPOUNDCURVE_TYPE:
+      s->rttype = RTCOMPOUNDTYPE;
+      break;
+    case RTWKB_CURVEPOLYGON_TYPE:
+      s->rttype = RTCURVEPOLYTYPE;
+      break;
+    case RTWKB_MULTICURVE_TYPE:
+      s->rttype = RTMULTICURVETYPE;
+      break;
+    case RTWKB_MULTISURFACE_TYPE:
+      s->rttype = RTMULTISURFACETYPE;
+      break;
+    case RTWKB_POLYHEDRALSURFACE_TYPE:
+      s->rttype = RTPOLYHEDRALSURFACETYPE;
+      break;
+    case RTWKB_TIN_TYPE:
+      s->rttype = RTTINTYPE;
+      break;
+    case RTWKB_TRIANGLE_TYPE:
+      s->rttype = RTTRIANGLETYPE;
+      break;
+
+    /* PostGIS 1.5 emits 13, 14 for CurvePolygon, MultiCurve */
+    /* These numbers aren't SQL/MM (numbers currently only */
+    /* go up to 12. We can handle the old data here (for now??) */
+    /* converting them into the rttypes that are intended. */
+    case RTWKB_CURVE_TYPE:
+      s->rttype = RTCURVEPOLYTYPE;
+      break;
+    case RTWKB_SURFACE_TYPE:
+      s->rttype = RTMULTICURVETYPE;
+      break;
+
+    default: /* Error! */
+      rterror(ctx, "Unknown RTWKB type (%d)! Full RTWKB type number was (%d).", wkb_simple_type, wkb_type);
+      break;
+  }
+
+  RTDEBUGF(4,"Got rttype %s (%u)", rttype_name(ctx, s->rttype), s->rttype);
+
+  return;
 }
 
 /**
@@ -248,17 +248,17 @@ static void rttype_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s, uint32_t
 */
 static char byte_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	char char_value = 0;
-	RTDEBUG(4, "Entered function");
-
-	wkb_parse_state_check(ctx, s, RTWKB_BYTE_SIZE);
-	RTDEBUG(4, "Passed state check");
-	
-	char_value = s->pos[0];
-	RTDEBUGF(4, "Read byte value: %x", char_value);
-	s->pos += RTWKB_BYTE_SIZE;
-	
-	return char_value;
+  char char_value = 0;
+  RTDEBUG(4, "Entered function");
+
+  wkb_parse_state_check(ctx, s, RTWKB_BYTE_SIZE);
+  RTDEBUG(4, "Passed state check");
+
+  char_value = s->pos[0];
+  RTDEBUGF(4, "Read byte value: %x", char_value);
+  s->pos += RTWKB_BYTE_SIZE;
+
+  return char_value;
 }
 
 /**
@@ -267,28 +267,28 @@ static char byte_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 */
 static uint32_t integer_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	uint32_t i = 0;
-
-	wkb_parse_state_check(ctx, s, RTWKB_INT_SIZE);
-	
-	memcpy(&i, s->pos, RTWKB_INT_SIZE);
-	
-	/* Swap? Copy into a stack-allocated integer. */
-	if( s->swap_bytes )
-	{
-		int j = 0;
-		uint8_t tmp;
-		
-		for( j = 0; j < RTWKB_INT_SIZE/2; j++ )
-		{
-			tmp = ((uint8_t*)(&i))[j];
-			((uint8_t*)(&i))[j] = ((uint8_t*)(&i))[RTWKB_INT_SIZE - j - 1];
-			((uint8_t*)(&i))[RTWKB_INT_SIZE - j - 1] = tmp;
-		}
-	}
-
-	s->pos += RTWKB_INT_SIZE;
-	return i;
+  uint32_t i = 0;
+
+  wkb_parse_state_check(ctx, s, RTWKB_INT_SIZE);
+
+  memcpy(&i, s->pos, RTWKB_INT_SIZE);
+
+  /* Swap? Copy into a stack-allocated integer. */
+  if( s->swap_bytes )
+  {
+    int j = 0;
+    uint8_t tmp;
+
+    for( j = 0; j < RTWKB_INT_SIZE/2; j++ )
+    {
+      tmp = ((uint8_t*)(&i))[j];
+      ((uint8_t*)(&i))[j] = ((uint8_t*)(&i))[RTWKB_INT_SIZE - j - 1];
+      ((uint8_t*)(&i))[RTWKB_INT_SIZE - j - 1] = tmp;
+    }
+  }
+
+  s->pos += RTWKB_INT_SIZE;
+  return i;
 }
 
 /**
@@ -297,29 +297,29 @@ static uint32_t integer_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 */
 static double double_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	double d = 0;
+  double d = 0;
 
-	wkb_parse_state_check(ctx, s, RTWKB_DOUBLE_SIZE);
+  wkb_parse_state_check(ctx, s, RTWKB_DOUBLE_SIZE);
 
-	memcpy(&d, s->pos, RTWKB_DOUBLE_SIZE);
+  memcpy(&d, s->pos, RTWKB_DOUBLE_SIZE);
 
-	/* Swap? Copy into a stack-allocated integer. */
-	if( s->swap_bytes )
-	{
-		int i = 0;
-		uint8_t tmp;
-		
-		for( i = 0; i < RTWKB_DOUBLE_SIZE/2; i++ )
-		{
-			tmp = ((uint8_t*)(&d))[i];
-			((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[RTWKB_DOUBLE_SIZE - i - 1];
-			((uint8_t*)(&d))[RTWKB_DOUBLE_SIZE - i - 1] = tmp;
-		}
+  /* Swap? Copy into a stack-allocated integer. */
+  if( s->swap_bytes )
+  {
+    int i = 0;
+    uint8_t tmp;
 
-	}
+    for( i = 0; i < RTWKB_DOUBLE_SIZE/2; i++ )
+    {
+      tmp = ((uint8_t*)(&d))[i];
+      ((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[RTWKB_DOUBLE_SIZE - i - 1];
+      ((uint8_t*)(&d))[RTWKB_DOUBLE_SIZE - i - 1] = tmp;
+    }
 
-	s->pos += RTWKB_DOUBLE_SIZE;
-	return d;
+  }
+
+  s->pos += RTWKB_DOUBLE_SIZE;
+  return d;
 }
 
 /**
@@ -329,269 +329,269 @@ static double double_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 */
 static RTPOINTARRAY* ptarray_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	RTPOINTARRAY *pa = NULL;
-	size_t pa_size;
-	uint32_t ndims = 2;
-	uint32_t npoints = 0;
-
-	/* Calculate the size of this point array. */
-	npoints = integer_from_wkb_state(ctx, s);
-
-	RTDEBUGF(4,"Pointarray has %d points", npoints);
-
-	if( s->has_z ) ndims++;
-	if( s->has_m ) ndims++;
-	pa_size = npoints * ndims * RTWKB_DOUBLE_SIZE;
-
-	/* Empty! */
-	if( npoints == 0 )
-		return ptarray_construct(ctx, s->has_z, s->has_m, npoints);
-
-	/* Does the data we want to read exist? */
-	wkb_parse_state_check(ctx, s, pa_size);
-	
-	/* If we're in a native endianness, we can just copy the data directly! */
-	if( ! s->swap_bytes )
-	{
-		pa = ptarray_construct_copy_data(ctx, s->has_z, s->has_m, npoints, (uint8_t*)s->pos);
-		s->pos += pa_size;
-	}
-	/* Otherwise we have to read each double, separately. */
-	else
-	{
-		int i = 0;
-		double *dlist;
-		pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
-		dlist = (double*)(pa->serialized_pointlist);
-		for( i = 0; i < npoints * ndims; i++ )
-		{
-			dlist[i] = double_from_wkb_state(ctx, s);
-		}
-	}
-
-	return pa;
+  RTPOINTARRAY *pa = NULL;
+  size_t pa_size;
+  uint32_t ndims = 2;
+  uint32_t npoints = 0;
+
+  /* Calculate the size of this point array. */
+  npoints = integer_from_wkb_state(ctx, s);
+
+  RTDEBUGF(4,"Pointarray has %d points", npoints);
+
+  if( s->has_z ) ndims++;
+  if( s->has_m ) ndims++;
+  pa_size = npoints * ndims * RTWKB_DOUBLE_SIZE;
+
+  /* Empty! */
+  if( npoints == 0 )
+    return ptarray_construct(ctx, s->has_z, s->has_m, npoints);
+
+  /* Does the data we want to read exist? */
+  wkb_parse_state_check(ctx, s, pa_size);
+
+  /* If we're in a native endianness, we can just copy the data directly! */
+  if( ! s->swap_bytes )
+  {
+    pa = ptarray_construct_copy_data(ctx, s->has_z, s->has_m, npoints, (uint8_t*)s->pos);
+    s->pos += pa_size;
+  }
+  /* Otherwise we have to read each double, separately. */
+  else
+  {
+    int i = 0;
+    double *dlist;
+    pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
+    dlist = (double*)(pa->serialized_pointlist);
+    for( i = 0; i < npoints * ndims; i++ )
+    {
+      dlist[i] = double_from_wkb_state(ctx, s);
+    }
+  }
+
+  return pa;
 }
 
 /**
 * POINT
-* Read a RTWKB point, starting just after the endian byte, 
+* Read a RTWKB point, starting just after the endian byte,
 * type number and optional srid number.
 * Advance the parse state forward appropriately.
-* RTWKB point has just a set of doubles, with the quantity depending on the 
+* RTWKB point has just a set of doubles, with the quantity depending on the
 * dimension of the point, so this looks like a special case of the above
 * with only one point.
 */
 static RTPOINT* rtpoint_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	static uint32_t npoints = 1;
-	RTPOINTARRAY *pa = NULL;
-	size_t pa_size;
-	uint32_t ndims = 2;
-	const RTPOINT2D *pt;
-
-	/* Count the dimensions. */
-	if( s->has_z ) ndims++;
-	if( s->has_m ) ndims++;
-	pa_size = ndims * RTWKB_DOUBLE_SIZE;
-
-	/* Does the data we want to read exist? */
-	wkb_parse_state_check(ctx, s, pa_size);
-
-	/* If we're in a native endianness, we can just copy the data directly! */
-	if( ! s->swap_bytes )
-	{
-		pa = ptarray_construct_copy_data(ctx, s->has_z, s->has_m, npoints, (uint8_t*)s->pos);
-		s->pos += pa_size;
-	}
-	/* Otherwise we have to read each double, separately */
-	else
-	{
-		int i = 0;
-		double *dlist;
-		pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
-		dlist = (double*)(pa->serialized_pointlist);
-		for( i = 0; i < ndims; i++ )
-		{
-			dlist[i] = double_from_wkb_state(ctx, s);
-		}
-	}
-	
-	/* Check for POINT(NaN NaN) ==> POINT EMPTY */
-	pt = rt_getPoint2d_cp(ctx, pa, 0);
-	if ( isnan(pt->x) && isnan(pt->y) )
-	{
-		ptarray_free(ctx, pa);
-		return rtpoint_construct_empty(ctx, s->srid, s->has_z, s->has_m);
-	}
-	else
-	{
-		return rtpoint_construct(ctx, s->srid, NULL, pa);
-	}
+  static uint32_t npoints = 1;
+  RTPOINTARRAY *pa = NULL;
+  size_t pa_size;
+  uint32_t ndims = 2;
+  const RTPOINT2D *pt;
+
+  /* Count the dimensions. */
+  if( s->has_z ) ndims++;
+  if( s->has_m ) ndims++;
+  pa_size = ndims * RTWKB_DOUBLE_SIZE;
+
+  /* Does the data we want to read exist? */
+  wkb_parse_state_check(ctx, s, pa_size);
+
+  /* If we're in a native endianness, we can just copy the data directly! */
+  if( ! s->swap_bytes )
+  {
+    pa = ptarray_construct_copy_data(ctx, s->has_z, s->has_m, npoints, (uint8_t*)s->pos);
+    s->pos += pa_size;
+  }
+  /* Otherwise we have to read each double, separately */
+  else
+  {
+    int i = 0;
+    double *dlist;
+    pa = ptarray_construct(ctx, s->has_z, s->has_m, npoints);
+    dlist = (double*)(pa->serialized_pointlist);
+    for( i = 0; i < ndims; i++ )
+    {
+      dlist[i] = double_from_wkb_state(ctx, s);
+    }
+  }
+
+  /* Check for POINT(NaN NaN) ==> POINT EMPTY */
+  pt = rt_getPoint2d_cp(ctx, pa, 0);
+  if ( isnan(pt->x) && isnan(pt->y) )
+  {
+    ptarray_free(ctx, pa);
+    return rtpoint_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+  }
+  else
+  {
+    return rtpoint_construct(ctx, s->srid, NULL, pa);
+  }
 }
 
 /**
 * LINESTRING
-* Read a RTWKB linestring, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a RTWKB linestring, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * There is only one pointarray in a linestring. Optionally
 * check for minimal following of rules (two point minimum).
 */
 static RTLINE* rtline_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
+  RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
 
-	if( pa == NULL || pa->npoints == 0 )
-		return rtline_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+  if( pa == NULL || pa->npoints == 0 )
+    return rtline_construct_empty(ctx, s->srid, s->has_z, s->has_m);
 
-	if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
-	{
-		rterror(ctx, "%s must have at least two points", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
+  if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
+  {
+    rterror(ctx, "%s must have at least two points", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
 
-	return rtline_construct(ctx, s->srid, NULL, pa);
+  return rtline_construct(ctx, s->srid, NULL, pa);
 }
 
 /**
 * CIRCULARSTRING
-* Read a RTWKB circularstring, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a RTWKB circularstring, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * There is only one pointarray in a linestring. Optionally
 * check for minimal following of rules (three point minimum,
 * odd number of points).
 */
 static RTCIRCSTRING* rtcircstring_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
+  RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
 
-	if( pa == NULL || pa->npoints == 0 )
-		return rtcircstring_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+  if( pa == NULL || pa->npoints == 0 )
+    return rtcircstring_construct_empty(ctx, s->srid, s->has_z, s->has_m);
 
-	if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 3 )
-	{
-		rterror(ctx, "%s must have at least three points", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
+  if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 3 )
+  {
+    rterror(ctx, "%s must have at least three points", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
 
-	if( s->check & RT_PARSER_CHECK_ODD && ! (pa->npoints % 2) )
-	{
-		rterror(ctx, "%s must have an odd number of points", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
+  if( s->check & RT_PARSER_CHECK_ODD && ! (pa->npoints % 2) )
+  {
+    rterror(ctx, "%s must have an odd number of points", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
 
-	return rtcircstring_construct(ctx, s->srid, NULL, pa);	
+  return rtcircstring_construct(ctx, s->srid, NULL, pa);
 }
 
 /**
 * POLYGON
-* Read a RTWKB polygon, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a RTWKB polygon, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * First read the number of rings, then read each ring
 * (which are structured as point arrays)
 */
 static RTPOLY* rtpoly_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	uint32_t nrings = integer_from_wkb_state(ctx, s);
-	int i = 0;
-	RTPOLY *poly = rtpoly_construct_empty(ctx, s->srid, s->has_z, s->has_m);
-
-	RTDEBUGF(4,"Polygon has %d rings", nrings);
-	
-	/* Empty polygon? */
-	if( nrings == 0 )
-		return poly;
-
-	for( i = 0; i < nrings; i++ )
-	{
-		RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
-		if( pa == NULL )
-			continue;
-
-		/* Check for at least four points. */
-		if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
-		{
-			RTDEBUGF(2, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
-			rterror(ctx, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
-			return NULL;
-		}
-
-		/* Check that first and last points are the same. */
-		if( s->check & RT_PARSER_CHECK_CLOSURE && ! ptarray_is_closed_2d(ctx, pa) )
-		{
-			RTDEBUGF(2, "%s must have closed rings", rttype_name(ctx, s->rttype));
-			rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
-			return NULL;
-		}
-		
-		/* Add ring to polygon */
-		if ( rtpoly_add_ring(ctx, poly, pa) == RT_FAILURE )
-		{
-			RTDEBUG(2, "Unable to add ring to polygon");
-			rterror(ctx, "Unable to add ring to polygon");
-		}
-
-	}
-	return poly;
+  uint32_t nrings = integer_from_wkb_state(ctx, s);
+  int i = 0;
+  RTPOLY *poly = rtpoly_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+
+  RTDEBUGF(4,"Polygon has %d rings", nrings);
+
+  /* Empty polygon? */
+  if( nrings == 0 )
+    return poly;
+
+  for( i = 0; i < nrings; i++ )
+  {
+    RTPOINTARRAY *pa = ptarray_from_wkb_state(ctx, s);
+    if( pa == NULL )
+      continue;
+
+    /* Check for at least four points. */
+    if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
+    {
+      RTDEBUGF(2, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
+      rterror(ctx, "%s must have at least four points in each ring", rttype_name(ctx, s->rttype));
+      return NULL;
+    }
+
+    /* Check that first and last points are the same. */
+    if( s->check & RT_PARSER_CHECK_CLOSURE && ! ptarray_is_closed_2d(ctx, pa) )
+    {
+      RTDEBUGF(2, "%s must have closed rings", rttype_name(ctx, s->rttype));
+      rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
+      return NULL;
+    }
+
+    /* Add ring to polygon */
+    if ( rtpoly_add_ring(ctx, poly, pa) == RT_FAILURE )
+    {
+      RTDEBUG(2, "Unable to add ring to polygon");
+      rterror(ctx, "Unable to add ring to polygon");
+    }
+
+  }
+  return poly;
 }
 
 /**
 * TRIANGLE
-* Read a RTWKB triangle, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a RTWKB triangle, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * Triangles are encoded like polygons in RTWKB, but more like linestrings
 * as rtgeometries.
 */
 static RTTRIANGLE* rttriangle_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	uint32_t nrings = integer_from_wkb_state(ctx, s);
-	RTTRIANGLE *tri = rttriangle_construct_empty(ctx, s->srid, s->has_z, s->has_m);
-	RTPOINTARRAY *pa = NULL;
-
-	/* Empty triangle? */
-	if( nrings == 0 )
-		return tri;
-
-	/* Should be only one ring. */
-	if ( nrings != 1 )
-		rterror(ctx, "Triangle has wrong number of rings: %d", nrings);
-
-	/* There's only one ring, we hope? */	
-	pa = ptarray_from_wkb_state(ctx, s);
-
-	/* If there's no points, return an empty triangle. */
-	if( pa == NULL )
-		return tri;
-
-	/* Check for at least four points. */
-	if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
-	{
-		RTDEBUGF(2, "%s must have at least four points", rttype_name(ctx, s->rttype));
-		rterror(ctx, "%s must have at least four points", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
-
-	if( s->check & RT_PARSER_CHECK_CLOSURE && ! ptarray_is_closed(ctx, pa) )
-	{
-		rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
-
-	if( s->check & RT_PARSER_CHECK_ZCLOSURE && ! ptarray_is_closed_z(ctx, pa) )
-	{
-		rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
-		return NULL;
-	}
-
-	/* Empty TRIANGLE starts w/ empty RTPOINTARRAY, free it first */
-	if (tri->points)
-		ptarray_free(ctx, tri->points);
-	
-	tri->points = pa;	
-	return tri;
+  uint32_t nrings = integer_from_wkb_state(ctx, s);
+  RTTRIANGLE *tri = rttriangle_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+  RTPOINTARRAY *pa = NULL;
+
+  /* Empty triangle? */
+  if( nrings == 0 )
+    return tri;
+
+  /* Should be only one ring. */
+  if ( nrings != 1 )
+    rterror(ctx, "Triangle has wrong number of rings: %d", nrings);
+
+  /* There's only one ring, we hope? */
+  pa = ptarray_from_wkb_state(ctx, s);
+
+  /* If there's no points, return an empty triangle. */
+  if( pa == NULL )
+    return tri;
+
+  /* Check for at least four points. */
+  if( s->check & RT_PARSER_CHECK_MINPOINTS && pa->npoints < 4 )
+  {
+    RTDEBUGF(2, "%s must have at least four points", rttype_name(ctx, s->rttype));
+    rterror(ctx, "%s must have at least four points", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
+
+  if( s->check & RT_PARSER_CHECK_CLOSURE && ! ptarray_is_closed(ctx, pa) )
+  {
+    rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
+
+  if( s->check & RT_PARSER_CHECK_ZCLOSURE && ! ptarray_is_closed_z(ctx, pa) )
+  {
+    rterror(ctx, "%s must have closed rings", rttype_name(ctx, s->rttype));
+    return NULL;
+  }
+
+  /* Empty TRIANGLE starts w/ empty RTPOINTARRAY, free it first */
+  if (tri->points)
+    ptarray_free(ctx, tri->points);
+
+  tri->points = pa;
+  return tri;
 }
 
 /**
@@ -599,23 +599,23 @@ static RTTRIANGLE* rttriangle_from_wkb_state(const RTCTX *ctx, wkb_parse_state *
 */
 static RTCURVEPOLY* rtcurvepoly_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	uint32_t ngeoms = integer_from_wkb_state(ctx, s);
-	RTCURVEPOLY *cp = rtcurvepoly_construct_empty(ctx, s->srid, s->has_z, s->has_m);
-	RTGEOM *geom = NULL;
-	int i;
-	
-	/* Empty collection? */
-	if ( ngeoms == 0 )
-		return cp;
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtgeom_from_wkb_state(ctx, s);
-		if ( rtcurvepoly_add_ring(ctx, cp, geom) == RT_FAILURE )
-			rterror(ctx, "Unable to add geometry (%p) to curvepoly (%p)", geom, cp);
-	}
-	
-	return cp;
+  uint32_t ngeoms = integer_from_wkb_state(ctx, s);
+  RTCURVEPOLY *cp = rtcurvepoly_construct_empty(ctx, s->srid, s->has_z, s->has_m);
+  RTGEOM *geom = NULL;
+  int i;
+
+  /* Empty collection? */
+  if ( ngeoms == 0 )
+    return cp;
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtgeom_from_wkb_state(ctx, s);
+    if ( rtcurvepoly_add_ring(ctx, cp, geom) == RT_FAILURE )
+      rterror(ctx, "Unable to add geometry (%p) to curvepoly (%p)", geom, cp);
+  }
+
+  return cp;
 }
 
 /**
@@ -624,37 +624,37 @@ static RTCURVEPOLY* rtcurvepoly_from_wkb_state(const RTCTX *ctx, wkb_parse_state
 
 /**
 * COLLECTION, RTMULTIPOINTTYPE, RTMULTILINETYPE, RTMULTIPOLYGONTYPE, RTCOMPOUNDTYPE,
-* RTMULTICURVETYPE, RTMULTISURFACETYPE, 
+* RTMULTICURVETYPE, RTMULTISURFACETYPE,
 * RTTINTYPE
 */
 static RTCOLLECTION* rtcollection_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	uint32_t ngeoms = integer_from_wkb_state(ctx, s);
-	RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, s->srid, s->has_z, s->has_m);
-	RTGEOM *geom = NULL;
-	int i;
-
-	RTDEBUGF(4,"Collection has %d components", ngeoms);
-	
-	/* Empty collection? */
-	if ( ngeoms == 0 )
-		return col;
-
-	/* Be strict in polyhedral surface closures */
-	if ( s->rttype == RTPOLYHEDRALSURFACETYPE )
-		s->check |= RT_PARSER_CHECK_ZCLOSURE;
-
-	for ( i = 0; i < ngeoms; i++ )
-	{
-		geom = rtgeom_from_wkb_state(ctx, s);
-		if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
-		{
-			rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
-			return NULL;
-		}
-	}
-	
-	return col;
+  uint32_t ngeoms = integer_from_wkb_state(ctx, s);
+  RTCOLLECTION *col = rtcollection_construct_empty(ctx, s->rttype, s->srid, s->has_z, s->has_m);
+  RTGEOM *geom = NULL;
+  int i;
+
+  RTDEBUGF(4,"Collection has %d components", ngeoms);
+
+  /* Empty collection? */
+  if ( ngeoms == 0 )
+    return col;
+
+  /* Be strict in polyhedral surface closures */
+  if ( s->rttype == RTPOLYHEDRALSURFACETYPE )
+    s->check |= RT_PARSER_CHECK_ZCLOSURE;
+
+  for ( i = 0; i < ngeoms; i++ )
+  {
+    geom = rtgeom_from_wkb_state(ctx, s);
+    if ( rtcollection_add_rtgeom(ctx, col, geom) == NULL )
+    {
+      rterror(ctx, "Unable to add geometry (%p) to collection (%p)", geom, col);
+      return NULL;
+    }
+  }
+
+  return col;
 }
 
 
@@ -667,87 +667,87 @@ static RTCOLLECTION* rtcollection_from_wkb_state(const RTCTX *ctx, wkb_parse_sta
 */
 RTGEOM* rtgeom_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 {
-	char wkb_little_endian;
-	uint32_t wkb_type;
-	
-	RTDEBUG(4,"Entered function");
-	
-	/* Fail when handed incorrect starting byte */
-	wkb_little_endian = byte_from_wkb_state(ctx, s);
-	if( wkb_little_endian != 1 && wkb_little_endian != 0 )
-	{
-		RTDEBUG(4,"Leaving due to bad first byte!");
-		rterror(ctx, "Invalid endian flag value encountered.");
-		return NULL;
-	}
-
-	/* Check the endianness of our input  */
-	s->swap_bytes = RT_FALSE;
-	if( getMachineEndian(ctx) == NDR ) /* Machine arch is little */
-	{
-		if ( ! wkb_little_endian )    /* Data is big! */
-			s->swap_bytes = RT_TRUE;
-	}
-	else                              /* Machine arch is big */
-	{
-		if ( wkb_little_endian )      /* Data is little! */
-			s->swap_bytes = RT_TRUE;
-	}
-
-	/* Read the type number */
-	wkb_type = integer_from_wkb_state(ctx, s);
-	RTDEBUGF(4,"Got RTWKB type number: 0x%X", wkb_type);
-	rttype_from_wkb_state(ctx, s, wkb_type);
-	
-	/* Read the SRID, if necessary */
-	if( s->has_srid )
-	{
-		s->srid = clamp_srid(ctx, integer_from_wkb_state(ctx, s));
-		/* TODO: warn on explicit UNKNOWN srid ? */
-		RTDEBUGF(4,"Got SRID: %u", s->srid);
-	}
-	
-	/* Do the right thing */
-	switch( s->rttype )
-	{
-		case RTPOINTTYPE:
-			return (RTGEOM*)rtpoint_from_wkb_state(ctx, s);
-			break;
-		case RTLINETYPE:
-			return (RTGEOM*)rtline_from_wkb_state(ctx, s);
-			break;
-		case RTCIRCSTRINGTYPE:
-			return (RTGEOM*)rtcircstring_from_wkb_state(ctx, s);
-			break;
-		case RTPOLYGONTYPE:
-			return (RTGEOM*)rtpoly_from_wkb_state(ctx, s);
-			break;
-		case RTTRIANGLETYPE:
-			return (RTGEOM*)rttriangle_from_wkb_state(ctx, s);
-			break;
-		case RTCURVEPOLYTYPE:
-			return (RTGEOM*)rtcurvepoly_from_wkb_state(ctx, s);
-			break;
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-		case RTPOLYHEDRALSURFACETYPE:
-		case RTTINTYPE:
-		case RTCOLLECTIONTYPE:
-			return (RTGEOM*)rtcollection_from_wkb_state(ctx, s);
-			break;
-
-		/* Unknown type! */
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, s->rttype), s->rttype);
-	}
-
-	/* Return value to keep compiler happy. */
-	return NULL;
-	
+  char wkb_little_endian;
+  uint32_t wkb_type;
+
+  RTDEBUG(4,"Entered function");
+
+  /* Fail when handed incorrect starting byte */
+  wkb_little_endian = byte_from_wkb_state(ctx, s);
+  if( wkb_little_endian != 1 && wkb_little_endian != 0 )
+  {
+    RTDEBUG(4,"Leaving due to bad first byte!");
+    rterror(ctx, "Invalid endian flag value encountered.");
+    return NULL;
+  }
+
+  /* Check the endianness of our input  */
+  s->swap_bytes = RT_FALSE;
+  if( getMachineEndian(ctx) == NDR ) /* Machine arch is little */
+  {
+    if ( ! wkb_little_endian )    /* Data is big! */
+      s->swap_bytes = RT_TRUE;
+  }
+  else                              /* Machine arch is big */
+  {
+    if ( wkb_little_endian )      /* Data is little! */
+      s->swap_bytes = RT_TRUE;
+  }
+
+  /* Read the type number */
+  wkb_type = integer_from_wkb_state(ctx, s);
+  RTDEBUGF(4,"Got RTWKB type number: 0x%X", wkb_type);
+  rttype_from_wkb_state(ctx, s, wkb_type);
+
+  /* Read the SRID, if necessary */
+  if( s->has_srid )
+  {
+    s->srid = clamp_srid(ctx, integer_from_wkb_state(ctx, s));
+    /* TODO: warn on explicit UNKNOWN srid ? */
+    RTDEBUGF(4,"Got SRID: %u", s->srid);
+  }
+
+  /* Do the right thing */
+  switch( s->rttype )
+  {
+    case RTPOINTTYPE:
+      return (RTGEOM*)rtpoint_from_wkb_state(ctx, s);
+      break;
+    case RTLINETYPE:
+      return (RTGEOM*)rtline_from_wkb_state(ctx, s);
+      break;
+    case RTCIRCSTRINGTYPE:
+      return (RTGEOM*)rtcircstring_from_wkb_state(ctx, s);
+      break;
+    case RTPOLYGONTYPE:
+      return (RTGEOM*)rtpoly_from_wkb_state(ctx, s);
+      break;
+    case RTTRIANGLETYPE:
+      return (RTGEOM*)rttriangle_from_wkb_state(ctx, s);
+      break;
+    case RTCURVEPOLYTYPE:
+      return (RTGEOM*)rtcurvepoly_from_wkb_state(ctx, s);
+      break;
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+    case RTPOLYHEDRALSURFACETYPE:
+    case RTTINTYPE:
+    case RTCOLLECTIONTYPE:
+      return (RTGEOM*)rtcollection_from_wkb_state(ctx, s);
+      break;
+
+    /* Unknown type! */
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, s->rttype), s->rttype);
+  }
+
+  /* Return value to keep compiler happy. */
+  return NULL;
+
 }
 
 /* TODO add check for SRID consistency */
@@ -755,52 +755,52 @@ RTGEOM* rtgeom_from_wkb_state(const RTCTX *ctx, wkb_parse_state *s)
 /**
 * RTWKB inputs *must* have a declared size, to prevent malformed RTWKB from reading
 * off the end of the memory segment (this stops a malevolent user from declaring
-* a one-ring polygon to have 10 rings, causing the RTWKB reader to walk off the 
+* a one-ring polygon to have 10 rings, causing the RTWKB reader to walk off the
 * end of the memory).
 *
-* Check is a bitmask of: RT_PARSER_CHECK_MINPOINTS, RT_PARSER_CHECK_ODD, 
+* Check is a bitmask of: RT_PARSER_CHECK_MINPOINTS, RT_PARSER_CHECK_ODD,
 * RT_PARSER_CHECK_CLOSURE, RT_PARSER_CHECK_NONE, RT_PARSER_CHECK_ALL
 */
 RTGEOM* rtgeom_from_wkb(const RTCTX *ctx, const uint8_t *wkb, const size_t wkb_size, const char check)
 {
-	wkb_parse_state s;
-	
-	/* Initialize the state appropriately */
-	s.wkb = wkb;
-	s.wkb_size = wkb_size;
-	s.swap_bytes = RT_FALSE;
-	s.check = check;
-	s.rttype = 0;
-	s.srid = SRID_UNKNOWN;
-	s.has_z = RT_FALSE;
-	s.has_m = RT_FALSE;
-	s.has_srid = RT_FALSE;
-	s.pos = wkb;
-	
-	/* Hand the check catch-all values */
-	if ( check & RT_PARSER_CHECK_NONE ) 
-		s.check = 0;
-	else
-		s.check = check;
-
-	return rtgeom_from_wkb_state(ctx, &s);
+  wkb_parse_state s;
+
+  /* Initialize the state appropriately */
+  s.wkb = wkb;
+  s.wkb_size = wkb_size;
+  s.swap_bytes = RT_FALSE;
+  s.check = check;
+  s.rttype = 0;
+  s.srid = SRID_UNKNOWN;
+  s.has_z = RT_FALSE;
+  s.has_m = RT_FALSE;
+  s.has_srid = RT_FALSE;
+  s.pos = wkb;
+
+  /* Hand the check catch-all values */
+  if ( check & RT_PARSER_CHECK_NONE )
+    s.check = 0;
+  else
+    s.check = check;
+
+  return rtgeom_from_wkb_state(ctx, &s);
 }
 
 RTGEOM* rtgeom_from_hexwkb(const RTCTX *ctx, const char *hexwkb, const char check)
 {
-	int hexwkb_len;
-	uint8_t *wkb;
-	RTGEOM *rtgeom;
-	
-	if ( ! hexwkb )	
-	{
-		rterror(ctx, "rtgeom_from_hexwkb: null input");
-		return NULL;
-	}
-	
-	hexwkb_len = strlen(hexwkb);
-	wkb = bytes_from_hexbytes(ctx, hexwkb, hexwkb_len);
-	rtgeom = rtgeom_from_wkb(ctx, wkb, hexwkb_len/2, check);
-	rtfree(ctx, wkb);
-	return rtgeom;	
+  int hexwkb_len;
+  uint8_t *wkb;
+  RTGEOM *rtgeom;
+
+  if ( ! hexwkb )
+  {
+    rterror(ctx, "rtgeom_from_hexwkb: null input");
+    return NULL;
+  }
+
+  hexwkb_len = strlen(hexwkb);
+  wkb = bytes_from_hexbytes(ctx, hexwkb, hexwkb_len);
+  rtgeom = rtgeom_from_wkb(ctx, wkb, hexwkb_len/2, check);
+  rtfree(ctx, wkb);
+  return rtgeom;
 }
diff --git a/src/rtiterator.c b/src/rtiterator.c
index 95e0322..447c14b 100644
--- a/src/rtiterator.c
+++ b/src/rtiterator.c
@@ -29,8 +29,8 @@
 
 struct LISTNODE
 {
-	struct LISTNODE* next;
-	void* item;
+  struct LISTNODE* next;
+  void* item;
 };
 typedef struct LISTNODE LISTNODE;
 
@@ -44,38 +44,38 @@ typedef struct LISTNODE LISTNODE;
  */
 struct RTPOINTITERATOR
 {
-	LISTNODE* geoms;
-	LISTNODE* pointarrays;
-	uint32_t i;
-	char allow_modification;
+  LISTNODE* geoms;
+  LISTNODE* pointarrays;
+  uint32_t i;
+  char allow_modification;
 };
 
 static LISTNODE*
 prepend_node(const RTCTX *ctx, void* g, LISTNODE* front)
 {
-	LISTNODE* n = rtalloc(ctx, sizeof(LISTNODE));
-	n->item = g;
-	n->next = front;
+  LISTNODE* n = rtalloc(ctx, sizeof(LISTNODE));
+  n->item = g;
+  n->next = front;
 
-	return n;
+  return n;
 }
 
 static LISTNODE*
 pop_node(const RTCTX *ctx, LISTNODE* i)
 {
-	LISTNODE* next = i->next;
-	rtfree(ctx, i);
-	return next;
+  LISTNODE* next = i->next;
+  rtfree(ctx, i);
+  return next;
 }
 
 static int
 add_rtgeom_to_stack(const RTCTX *ctx, RTPOINTITERATOR* s, RTGEOM* g)
 {
-	if (rtgeom_is_empty(ctx, g))
-		return RT_FAILURE;
+  if (rtgeom_is_empty(ctx, g))
+    return RT_FAILURE;
 
-	s->geoms = prepend_node(ctx, g, s->geoms);
-	return RT_SUCCESS;
+  s->geoms = prepend_node(ctx, g, s->geoms);
+  return RT_SUCCESS;
 }
 
 /** Return a pointer to the first of one or more LISTNODEs holding the RTPOINTARRAYs
@@ -84,34 +84,34 @@ add_rtgeom_to_stack(const RTCTX *ctx, RTPOINTITERATOR* s, RTGEOM* g)
 static LISTNODE*
 extract_pointarrays_from_rtgeom(const RTCTX *ctx, RTGEOM* g)
 {
-	switch(rtgeom_get_type(ctx, g))
-	{
-	case RTPOINTTYPE:
-		return prepend_node(ctx, rtgeom_as_rtpoint(ctx, g)->point, NULL);
-	case RTLINETYPE:
-		return prepend_node(ctx, rtgeom_as_rtline(ctx, g)->points, NULL);
-	case RTTRIANGLETYPE:
-		return prepend_node(ctx, rtgeom_as_rttriangle(ctx, g)->points, NULL);
-	case RTCIRCSTRINGTYPE:
-		return prepend_node(ctx, rtgeom_as_rtcircstring(ctx, g)->points, NULL);
-	case RTPOLYGONTYPE:
-	{
-		LISTNODE* n = NULL;
-
-		RTPOLY* p = rtgeom_as_rtpoly(ctx, g);
-		int i;
-		for (i = p->nrings - 1; i >= 0; i--)
-		{
-			n = prepend_node(ctx, p->rings[i], n);
-		}
-
-		return n;
-	}
-	default:
-		rterror(ctx, "Unsupported geometry type for rtpointiterator");
-	}
-
-	return NULL;
+  switch(rtgeom_get_type(ctx, g))
+  {
+  case RTPOINTTYPE:
+    return prepend_node(ctx, rtgeom_as_rtpoint(ctx, g)->point, NULL);
+  case RTLINETYPE:
+    return prepend_node(ctx, rtgeom_as_rtline(ctx, g)->points, NULL);
+  case RTTRIANGLETYPE:
+    return prepend_node(ctx, rtgeom_as_rttriangle(ctx, g)->points, NULL);
+  case RTCIRCSTRINGTYPE:
+    return prepend_node(ctx, rtgeom_as_rtcircstring(ctx, g)->points, NULL);
+  case RTPOLYGONTYPE:
+  {
+    LISTNODE* n = NULL;
+
+    RTPOLY* p = rtgeom_as_rtpoly(ctx, g);
+    int i;
+    for (i = p->nrings - 1; i >= 0; i--)
+    {
+      n = prepend_node(ctx, p->rings[i], n);
+    }
+
+    return n;
+  }
+  default:
+    rterror(ctx, "Unsupported geometry type for rtpointiterator");
+  }
+
+  return NULL;
 }
 
 /** Remove an RTCOLLECTION from the iterator stack, and add the components of the
@@ -120,23 +120,23 @@ extract_pointarrays_from_rtgeom(const RTCTX *ctx, RTGEOM* g)
 static void
 unroll_collection(const RTCTX *ctx, RTPOINTITERATOR* s)
 {
-	int i;
-	RTCOLLECTION* c;
+  int i;
+  RTCOLLECTION* c;
 
-	if (!s->geoms)
-	{
-		return;
-	}
+  if (!s->geoms)
+  {
+    return;
+  }
 
-	c = (RTCOLLECTION*) s->geoms->item;
-	s->geoms = pop_node(ctx, s->geoms);
+  c = (RTCOLLECTION*) s->geoms->item;
+  s->geoms = pop_node(ctx, s->geoms);
 
-	for (i = c->ngeoms - 1; i >= 0; i--)
-	{
-		RTGEOM* g = rtcollection_getsubgeom(ctx, c, i);
+  for (i = c->ngeoms - 1; i >= 0; i--)
+  {
+    RTGEOM* g = rtcollection_getsubgeom(ctx, c, i);
 
-		add_rtgeom_to_stack(ctx, s, g);
-	}
+    add_rtgeom_to_stack(ctx, s, g);
+  }
 }
 
 /** Unroll RTCOLLECTIONs from the top of the stack, as necessary, until the element at the
@@ -145,49 +145,49 @@ unroll_collection(const RTCTX *ctx, RTPOINTITERATOR* s)
 static void
 unroll_collections(const RTCTX *ctx, RTPOINTITERATOR* s)
 {
-	while(s->geoms && rtgeom_is_collection(ctx, s->geoms->item))
-	{
-		unroll_collection(ctx, s);
-	}
+  while(s->geoms && rtgeom_is_collection(ctx, s->geoms->item))
+  {
+    unroll_collection(ctx, s);
+  }
 }
 
 static int
 rtpointiterator_advance(const RTCTX *ctx, RTPOINTITERATOR* s)
 {
-	s->i += 1;
-
-	/* We've reached the end of our current RTPOINTARRAY.  Try to see if there
-	 * are any more RTPOINTARRAYS on the stack. */
-	if (s->pointarrays && s->i >= ((RTPOINTARRAY*) s->pointarrays->item)->npoints)
-	{
-		s->pointarrays = pop_node(ctx, s->pointarrays);
-		s->i = 0;
-	}
-
-	/* We don't have a current RTPOINTARRAY.  Pull a geometry from the stack, and
-	 * decompose it into its POINTARRARYs. */
-	if (!s->pointarrays)
-	{
-		RTGEOM* g;
-		unroll_collections(ctx, s);
-
-		if (!s->geoms)
-		{
-			return RT_FAILURE;
-		}
-
-		s->i = 0;
-		g = s->geoms->item;
-		s->pointarrays = extract_pointarrays_from_rtgeom(ctx, g);
-
-		s->geoms = pop_node(ctx, s->geoms);
-	}
-
-	if (!s->pointarrays)
-	{
-		return RT_FAILURE;
-	}
-	return RT_SUCCESS;
+  s->i += 1;
+
+  /* We've reached the end of our current RTPOINTARRAY.  Try to see if there
+   * are any more RTPOINTARRAYS on the stack. */
+  if (s->pointarrays && s->i >= ((RTPOINTARRAY*) s->pointarrays->item)->npoints)
+  {
+    s->pointarrays = pop_node(ctx, s->pointarrays);
+    s->i = 0;
+  }
+
+  /* We don't have a current RTPOINTARRAY.  Pull a geometry from the stack, and
+   * decompose it into its POINTARRARYs. */
+  if (!s->pointarrays)
+  {
+    RTGEOM* g;
+    unroll_collections(ctx, s);
+
+    if (!s->geoms)
+    {
+      return RT_FAILURE;
+    }
+
+    s->i = 0;
+    g = s->geoms->item;
+    s->pointarrays = extract_pointarrays_from_rtgeom(ctx, g);
+
+    s->geoms = pop_node(ctx, s->geoms);
+  }
+
+  if (!s->pointarrays)
+  {
+    return RT_FAILURE;
+  }
+  return RT_SUCCESS;
 }
 
 /* Public API implementation */
@@ -195,89 +195,89 @@ rtpointiterator_advance(const RTCTX *ctx, RTPOINTITERATOR* s)
 int
 rtpointiterator_peek(const RTCTX *ctx, RTPOINTITERATOR* s, RTPOINT4D* p)
 {
-	if (!rtpointiterator_has_next(ctx, s))
-		return RT_FAILURE;
+  if (!rtpointiterator_has_next(ctx, s))
+    return RT_FAILURE;
 
-	return rt_getPoint4d_p(ctx, s->pointarrays->item, s->i, p);
+  return rt_getPoint4d_p(ctx, s->pointarrays->item, s->i, p);
 }
 
 int
 rtpointiterator_has_next(const RTCTX *ctx, RTPOINTITERATOR* s)
 {
-	if (s->pointarrays && s->i < ((RTPOINTARRAY*) s->pointarrays->item)->npoints)
-		return RT_TRUE;
-	return RT_FALSE;
+  if (s->pointarrays && s->i < ((RTPOINTARRAY*) s->pointarrays->item)->npoints)
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 int
 rtpointiterator_next(const RTCTX *ctx, RTPOINTITERATOR* s, RTPOINT4D* p)
 {
-	if (!rtpointiterator_has_next(ctx, s))
-		return RT_FAILURE;
+  if (!rtpointiterator_has_next(ctx, s))
+    return RT_FAILURE;
 
-	/* If p is NULL, just advance without reading */
-	if (p && !rtpointiterator_peek(ctx, s, p))
-		return RT_FAILURE;
+  /* If p is NULL, just advance without reading */
+  if (p && !rtpointiterator_peek(ctx, s, p))
+    return RT_FAILURE;
 
-	rtpointiterator_advance(ctx, s);
-	return RT_SUCCESS;
+  rtpointiterator_advance(ctx, s);
+  return RT_SUCCESS;
 }
 
 int
 rtpointiterator_modify_next(const RTCTX *ctx, RTPOINTITERATOR* s, const RTPOINT4D* p)
 {
-	if (!rtpointiterator_has_next(ctx, s))
-		return RT_FAILURE;
+  if (!rtpointiterator_has_next(ctx, s))
+    return RT_FAILURE;
 
-	if (!s->allow_modification)
-	{
-		rterror(ctx, "Cannot write to read-only iterator");
-		return RT_FAILURE;
-	}
+  if (!s->allow_modification)
+  {
+    rterror(ctx, "Cannot write to read-only iterator");
+    return RT_FAILURE;
+  }
 
-	ptarray_set_point4d(ctx, s->pointarrays->item, s->i, p);
+  ptarray_set_point4d(ctx, s->pointarrays->item, s->i, p);
 
-	rtpointiterator_advance(ctx, s);
-	return RT_SUCCESS;
+  rtpointiterator_advance(ctx, s);
+  return RT_SUCCESS;
 }
 
 RTPOINTITERATOR*
 rtpointiterator_create(const RTCTX *ctx, const RTGEOM* g)
 {
-	RTPOINTITERATOR* it = rtpointiterator_create_rw(ctx, (RTGEOM*) g);
-	it->allow_modification = RT_FALSE;
+  RTPOINTITERATOR* it = rtpointiterator_create_rw(ctx, (RTGEOM*) g);
+  it->allow_modification = RT_FALSE;
 
-	return it;
+  return it;
 }
 
 RTPOINTITERATOR*
 rtpointiterator_create_rw(const RTCTX *ctx, RTGEOM* g)
 {
-	RTPOINTITERATOR* it = rtalloc(ctx, sizeof(RTPOINTITERATOR));
+  RTPOINTITERATOR* it = rtalloc(ctx, sizeof(RTPOINTITERATOR));
 
-	it->geoms = NULL;
-	it->pointarrays = NULL;
-	it->i = 0;
-	it->allow_modification = RT_TRUE;
+  it->geoms = NULL;
+  it->pointarrays = NULL;
+  it->i = 0;
+  it->allow_modification = RT_TRUE;
 
-	add_rtgeom_to_stack(ctx, it, g);
-	rtpointiterator_advance(ctx, it);
+  add_rtgeom_to_stack(ctx, it, g);
+  rtpointiterator_advance(ctx, it);
 
-	return it;
+  return it;
 }
 
 void
 rtpointiterator_destroy(const RTCTX *ctx, RTPOINTITERATOR* s)
 {
-	while (s->geoms != NULL)
-	{
-		s->geoms = pop_node(ctx, s->geoms);
-	}
+  while (s->geoms != NULL)
+  {
+    s->geoms = pop_node(ctx, s->geoms);
+  }
 
-	while (s->pointarrays != NULL)
-	{
-		s->pointarrays = pop_node(ctx, s->pointarrays);
-	}
+  while (s->pointarrays != NULL)
+  {
+    s->pointarrays = pop_node(ctx, s->pointarrays);
+  }
 
-	rtfree(ctx, s);
+  rtfree(ctx, s);
 }
diff --git a/src/rtline.c b/src/rtline.c
index d1f5b32..fb7bf1d 100644
--- a/src/rtline.c
+++ b/src/rtline.c
@@ -42,121 +42,121 @@
 RTLINE *
 rtline_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points)
 {
-	RTLINE *result;
-	result = (RTLINE*) rtalloc(ctx, sizeof(RTLINE));
+  RTLINE *result;
+  result = (RTLINE*) rtalloc(ctx, sizeof(RTLINE));
 
-	RTDEBUG(2, "rtline_construct called.");
+  RTDEBUG(2, "rtline_construct called.");
 
-	result->type = RTLINETYPE;
-	
-	result->flags = points->flags;
-	RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
+  result->type = RTLINETYPE;
 
-	RTDEBUGF(3, "rtline_construct type=%d", result->type);
+  result->flags = points->flags;
+  RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
 
-	result->srid = srid;
-	result->points = points;
-	result->bbox = bbox;
+  RTDEBUGF(3, "rtline_construct type=%d", result->type);
 
-	return result;
+  result->srid = srid;
+  result->points = points;
+  result->bbox = bbox;
+
+  return result;
 }
 
 RTLINE *
 rtline_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTLINE *result = rtalloc(ctx, sizeof(RTLINE));
-	result->type = RTLINETYPE;
-	result->flags = gflags(ctx, hasz,hasm,0);
-	result->srid = srid;
-	result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
-	result->bbox = NULL;
-	return result;
+  RTLINE *result = rtalloc(ctx, sizeof(RTLINE));
+  result->type = RTLINETYPE;
+  result->flags = gflags(ctx, hasz,hasm,0);
+  result->srid = srid;
+  result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
+  result->bbox = NULL;
+  return result;
 }
 
 
 void rtline_free(const RTCTX *ctx, RTLINE  *line)
 {
-	if ( ! line ) return;
-	
-	if ( line->bbox )
-		rtfree(ctx, line->bbox);
-	if ( line->points )
-		ptarray_free(ctx, line->points);
-	rtfree(ctx, line);
+  if ( ! line ) return;
+
+  if ( line->bbox )
+    rtfree(ctx, line->bbox);
+  if ( line->points )
+    ptarray_free(ctx, line->points);
+  rtfree(ctx, line);
 }
 
 
 void printRTLINE(const RTCTX *ctx, RTLINE *line)
 {
-	rtnotice(ctx, "RTLINE {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(line->flags));
-	rtnotice(ctx, "    srid = %i", (int)line->srid);
-	printPA(ctx, line->points);
-	rtnotice(ctx, "}");
+  rtnotice(ctx, "RTLINE {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(line->flags));
+  rtnotice(ctx, "    srid = %i", (int)line->srid);
+  printPA(ctx, line->points);
+  rtnotice(ctx, "}");
 }
 
 /* @brief Clone RTLINE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTLINE *
 rtline_clone(const RTCTX *ctx, const RTLINE *g)
 {
-	RTLINE *ret = rtalloc(ctx, sizeof(RTLINE));
+  RTLINE *ret = rtalloc(ctx, sizeof(RTLINE));
 
-	RTDEBUGF(2, "rtline_clone called with %p", g);
+  RTDEBUGF(2, "rtline_clone called with %p", g);
 
-	memcpy(ret, g, sizeof(RTLINE));
+  memcpy(ret, g, sizeof(RTLINE));
 
-	ret->points = ptarray_clone(ctx, g->points);
+  ret->points = ptarray_clone(ctx, g->points);
 
-	if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	return ret;
+  if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  return ret;
 }
 
 /* Deep clone RTLINE object. RTPOINTARRAY *is* copied. */
 RTLINE *
 rtline_clone_deep(const RTCTX *ctx, const RTLINE *g)
 {
-	RTLINE *ret = rtalloc(ctx, sizeof(RTLINE));
+  RTLINE *ret = rtalloc(ctx, sizeof(RTLINE));
 
-	RTDEBUGF(2, "rtline_clone_deep called with %p", g);
-	memcpy(ret, g, sizeof(RTLINE));
+  RTDEBUGF(2, "rtline_clone_deep called with %p", g);
+  memcpy(ret, g, sizeof(RTLINE));
 
-	if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	if ( g->points ) ret->points = ptarray_clone_deep(ctx, g->points);
-	RTFLAGS_SET_READONLY(ret->flags,0);
+  if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  if ( g->points ) ret->points = ptarray_clone_deep(ctx, g->points);
+  RTFLAGS_SET_READONLY(ret->flags,0);
 
-	return ret;
+  return ret;
 }
 
 
 void
 rtline_release(const RTCTX *ctx, RTLINE *rtline)
 {
-	rtgeom_release(ctx, rtline_as_rtgeom(ctx, rtline));
+  rtgeom_release(ctx, rtline_as_rtgeom(ctx, rtline));
 }
 
 void
 rtline_reverse(const RTCTX *ctx, RTLINE *line)
 {
-	if ( rtline_is_empty(ctx, line) ) return;
-	ptarray_reverse(ctx, line->points);
+  if ( rtline_is_empty(ctx, line) ) return;
+  ptarray_reverse(ctx, line->points);
 }
 
 RTLINE *
 rtline_segmentize2d(const RTCTX *ctx, RTLINE *line, double dist)
 {
-	RTPOINTARRAY *segmentized = ptarray_segmentize2d(ctx, line->points, dist);
-	if ( ! segmentized ) return NULL;
-	return rtline_construct(ctx, line->srid, NULL, segmentized);
+  RTPOINTARRAY *segmentized = ptarray_segmentize2d(ctx, line->points, dist);
+  if ( ! segmentized ) return NULL;
+  return rtline_construct(ctx, line->srid, NULL, segmentized);
 }
 
 /* check coordinate equality  */
 char
 rtline_same(const RTCTX *ctx, const RTLINE *l1, const RTLINE *l2)
 {
-	return ptarray_same(ctx, l1->points, l2->points);
+  return ptarray_same(ctx, l1->points, l2->points);
 }
 
 /*
@@ -166,58 +166,58 @@ rtline_same(const RTCTX *ctx, const RTLINE *l1, const RTLINE *l2)
 RTLINE *
 rtline_from_rtgeom_array(const RTCTX *ctx, int srid, uint32_t ngeoms, RTGEOM **geoms)
 {
- 	int i;
-	int hasz = RT_FALSE;
-	int hasm = RT_FALSE;
-	RTPOINTARRAY *pa;
-	RTLINE *line;
-	RTPOINT4D pt;
-
-	/*
-	 * Find output dimensions, check integrity
-	 */
-	for (i=0; i<ngeoms; i++)
-	{
-		if ( RTFLAGS_GET_Z(geoms[i]->flags) ) hasz = RT_TRUE;
-		if ( RTFLAGS_GET_M(geoms[i]->flags) ) hasm = RT_TRUE;
-		if ( hasz && hasm ) break; /* Nothing more to learn! */
-	}
-
-	/* ngeoms should be a guess about how many points we have in input */
-	pa = ptarray_construct_empty(ctx, hasz, hasm, ngeoms);
-	
-	for ( i=0; i < ngeoms; i++ )
-	{
-		RTGEOM *g = geoms[i];
-
-		if ( rtgeom_is_empty(ctx, g) ) continue;
-
-		if ( g->type == RTPOINTTYPE )
-		{
-			rtpoint_getPoint4d_p(ctx, (RTPOINT*)g, &pt);
-			ptarray_append_point(ctx, pa, &pt, RT_TRUE);
-		}
-		else if ( g->type == RTLINETYPE )
-		{
-			ptarray_append_ptarray(ctx, pa, ((RTLINE*)g)->points, -1);
-		}
-		else
-		{
-			ptarray_free(ctx, pa);
-			rterror(ctx, "rtline_from_ptarray: invalid input type: %s", rttype_name(ctx, g->type));
-			return NULL;
-		}
-	}
-
-	if ( pa->npoints > 0 )
-		line = rtline_construct(ctx, srid, NULL, pa);
-	else  {
-		/* Is this really any different from the above ? */
-		ptarray_free(ctx, pa);
-		line = rtline_construct_empty(ctx, srid, hasz, hasm);
-	}
-	
-	return line;
+   int i;
+  int hasz = RT_FALSE;
+  int hasm = RT_FALSE;
+  RTPOINTARRAY *pa;
+  RTLINE *line;
+  RTPOINT4D pt;
+
+  /*
+   * Find output dimensions, check integrity
+   */
+  for (i=0; i<ngeoms; i++)
+  {
+    if ( RTFLAGS_GET_Z(geoms[i]->flags) ) hasz = RT_TRUE;
+    if ( RTFLAGS_GET_M(geoms[i]->flags) ) hasm = RT_TRUE;
+    if ( hasz && hasm ) break; /* Nothing more to learn! */
+  }
+
+  /* ngeoms should be a guess about how many points we have in input */
+  pa = ptarray_construct_empty(ctx, hasz, hasm, ngeoms);
+
+  for ( i=0; i < ngeoms; i++ )
+  {
+    RTGEOM *g = geoms[i];
+
+    if ( rtgeom_is_empty(ctx, g) ) continue;
+
+    if ( g->type == RTPOINTTYPE )
+    {
+      rtpoint_getPoint4d_p(ctx, (RTPOINT*)g, &pt);
+      ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+    }
+    else if ( g->type == RTLINETYPE )
+    {
+      ptarray_append_ptarray(ctx, pa, ((RTLINE*)g)->points, -1);
+    }
+    else
+    {
+      ptarray_free(ctx, pa);
+      rterror(ctx, "rtline_from_ptarray: invalid input type: %s", rttype_name(ctx, g->type));
+      return NULL;
+    }
+  }
+
+  if ( pa->npoints > 0 )
+    line = rtline_construct(ctx, srid, NULL, pa);
+  else  {
+    /* Is this really any different from the above ? */
+    ptarray_free(ctx, pa);
+    line = rtline_construct_empty(ctx, srid, hasz, hasm);
+  }
+
+  return line;
 }
 
 /*
@@ -227,45 +227,45 @@ rtline_from_rtgeom_array(const RTCTX *ctx, int srid, uint32_t ngeoms, RTGEOM **g
 RTLINE *
 rtline_from_ptarray(const RTCTX *ctx, int srid, uint32_t npoints, RTPOINT **points)
 {
- 	int i;
-	int hasz = RT_FALSE;
-	int hasm = RT_FALSE;
-	RTPOINTARRAY *pa;
-	RTLINE *line;
-	RTPOINT4D pt;
-
-	/*
-	 * Find output dimensions, check integrity
-	 */
-	for (i=0; i<npoints; i++)
-	{
-		if ( points[i]->type != RTPOINTTYPE )
-		{
-			rterror(ctx, "rtline_from_ptarray: invalid input type: %s", rttype_name(ctx, points[i]->type));
-			return NULL;
-		}
-		if ( RTFLAGS_GET_Z(points[i]->flags) ) hasz = RT_TRUE;
-		if ( RTFLAGS_GET_M(points[i]->flags) ) hasm = RT_TRUE;
-		if ( hasz && hasm ) break; /* Nothing more to learn! */
-	}
-
-	pa = ptarray_construct_empty(ctx, hasz, hasm, npoints);
-	
-	for ( i=0; i < npoints; i++ )
-	{
-		if ( ! rtpoint_is_empty(ctx, points[i]) )
-		{
-			rtpoint_getPoint4d_p(ctx, points[i], &pt);
-			ptarray_append_point(ctx, pa, &pt, RT_TRUE);
-		}
-	}
-
-	if ( pa->npoints > 0 )
-		line = rtline_construct(ctx, srid, NULL, pa);
-	else 
-		line = rtline_construct_empty(ctx, srid, hasz, hasm);
-	
-	return line;
+   int i;
+  int hasz = RT_FALSE;
+  int hasm = RT_FALSE;
+  RTPOINTARRAY *pa;
+  RTLINE *line;
+  RTPOINT4D pt;
+
+  /*
+   * Find output dimensions, check integrity
+   */
+  for (i=0; i<npoints; i++)
+  {
+    if ( points[i]->type != RTPOINTTYPE )
+    {
+      rterror(ctx, "rtline_from_ptarray: invalid input type: %s", rttype_name(ctx, points[i]->type));
+      return NULL;
+    }
+    if ( RTFLAGS_GET_Z(points[i]->flags) ) hasz = RT_TRUE;
+    if ( RTFLAGS_GET_M(points[i]->flags) ) hasm = RT_TRUE;
+    if ( hasz && hasm ) break; /* Nothing more to learn! */
+  }
+
+  pa = ptarray_construct_empty(ctx, hasz, hasm, npoints);
+
+  for ( i=0; i < npoints; i++ )
+  {
+    if ( ! rtpoint_is_empty(ctx, points[i]) )
+    {
+      rtpoint_getPoint4d_p(ctx, points[i], &pt);
+      ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+    }
+  }
+
+  if ( pa->npoints > 0 )
+    line = rtline_construct(ctx, srid, NULL, pa);
+  else
+    line = rtline_construct_empty(ctx, srid, hasz, hasm);
+
+  return line;
 }
 
 /*
@@ -274,31 +274,31 @@ rtline_from_ptarray(const RTCTX *ctx, int srid, uint32_t npoints, RTPOINT **poin
 RTLINE *
 rtline_from_rtmpoint(const RTCTX *ctx, int srid, const RTMPOINT *mpoint)
 {
-	uint32_t i;
-	RTPOINTARRAY *pa = NULL;
-	RTGEOM *rtgeom = (RTGEOM*)mpoint;
-	RTPOINT4D pt;
-
-	char hasz = rtgeom_has_z(ctx, rtgeom);
-	char hasm = rtgeom_has_m(ctx, rtgeom);
-	uint32_t npoints = mpoint->ngeoms;
-
-	if ( rtgeom_is_empty(ctx, rtgeom) ) 
-	{
-		return rtline_construct_empty(ctx, srid, hasz, hasm);
-	}
-
-	pa = ptarray_construct(ctx, hasz, hasm, npoints);
-
-	for (i=0; i < npoints; i++)
-	{
-		rt_getPoint4d_p(ctx, mpoint->geoms[i]->point, 0, &pt);
-		ptarray_set_point4d(ctx, pa, i, &pt);
-	}
-	
-	RTDEBUGF(3, "rtline_from_rtmpoint: constructed pointarray for %d points", mpoint->ngeoms);
-
-	return rtline_construct(ctx, srid, NULL, pa);
+  uint32_t i;
+  RTPOINTARRAY *pa = NULL;
+  RTGEOM *rtgeom = (RTGEOM*)mpoint;
+  RTPOINT4D pt;
+
+  char hasz = rtgeom_has_z(ctx, rtgeom);
+  char hasm = rtgeom_has_m(ctx, rtgeom);
+  uint32_t npoints = mpoint->ngeoms;
+
+  if ( rtgeom_is_empty(ctx, rtgeom) )
+  {
+    return rtline_construct_empty(ctx, srid, hasz, hasm);
+  }
+
+  pa = ptarray_construct(ctx, hasz, hasm, npoints);
+
+  for (i=0; i < npoints; i++)
+  {
+    rt_getPoint4d_p(ctx, mpoint->geoms[i]->point, 0, &pt);
+    ptarray_set_point4d(ctx, pa, i, &pt);
+  }
+
+  RTDEBUGF(3, "rtline_from_rtmpoint: constructed pointarray for %d points", mpoint->ngeoms);
+
+  return rtline_construct(ctx, srid, NULL, pa);
 }
 
 /**
@@ -308,38 +308,38 @@ rtline_from_rtmpoint(const RTCTX *ctx, int srid, const RTMPOINT *mpoint)
 RTPOINT*
 rtline_get_rtpoint(const RTCTX *ctx, const RTLINE *line, int where)
 {
-	RTPOINT4D pt;
-	RTPOINT *rtpoint;
-	RTPOINTARRAY *pa;
-
-	if ( rtline_is_empty(ctx, line) || where < 0 || where >= line->points->npoints )
-		return NULL;
-
-	pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(line->flags), RTFLAGS_GET_M(line->flags), 1);
-	pt = rt_getPoint4d(ctx, line->points, where);
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
-	rtpoint = rtpoint_construct(ctx, line->srid, NULL, pa);
-	return rtpoint;
+  RTPOINT4D pt;
+  RTPOINT *rtpoint;
+  RTPOINTARRAY *pa;
+
+  if ( rtline_is_empty(ctx, line) || where < 0 || where >= line->points->npoints )
+    return NULL;
+
+  pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(line->flags), RTFLAGS_GET_M(line->flags), 1);
+  pt = rt_getPoint4d(ctx, line->points, where);
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  rtpoint = rtpoint_construct(ctx, line->srid, NULL, pa);
+  return rtpoint;
 }
 
 
 int
 rtline_add_rtpoint(const RTCTX *ctx, RTLINE *line, RTPOINT *point, int where)
 {
-	RTPOINT4D pt;	
-	rt_getPoint4d_p(ctx, point->point, 0, &pt);
-
-	if ( ptarray_insert_point(ctx, line->points, &pt, where) != RT_SUCCESS )
-		return RT_FAILURE;
-
-	/* Update the bounding box */
-	if ( line->bbox )
-	{
-		rtgeom_drop_bbox(ctx, rtline_as_rtgeom(ctx, line));
-		rtgeom_add_bbox(ctx, rtline_as_rtgeom(ctx, line));
-	}
-	
-	return RT_SUCCESS;
+  RTPOINT4D pt;
+  rt_getPoint4d_p(ctx, point->point, 0, &pt);
+
+  if ( ptarray_insert_point(ctx, line->points, &pt, where) != RT_SUCCESS )
+    return RT_FAILURE;
+
+  /* Update the bounding box */
+  if ( line->bbox )
+  {
+    rtgeom_drop_bbox(ctx, rtline_as_rtgeom(ctx, line));
+    rtgeom_add_bbox(ctx, rtline_as_rtgeom(ctx, line));
+  }
+
+  return RT_SUCCESS;
 }
 
 
@@ -347,15 +347,15 @@ rtline_add_rtpoint(const RTCTX *ctx, RTLINE *line, RTPOINT *point, int where)
 RTLINE *
 rtline_removepoint(const RTCTX *ctx, RTLINE *line, uint32_t index)
 {
-	RTPOINTARRAY *newpa;
-	RTLINE *ret;
+  RTPOINTARRAY *newpa;
+  RTLINE *ret;
 
-	newpa = ptarray_removePoint(ctx, line->points, index);
+  newpa = ptarray_removePoint(ctx, line->points, index);
 
-	ret = rtline_construct(ctx, line->srid, NULL, newpa);
-	rtgeom_add_bbox(ctx, (RTGEOM *) ret);
+  ret = rtline_construct(ctx, line->srid, NULL, newpa);
+  rtgeom_add_bbox(ctx, (RTGEOM *) ret);
 
-	return ret;
+  return ret;
 }
 
 /*
@@ -364,13 +364,13 @@ rtline_removepoint(const RTCTX *ctx, RTLINE *line, uint32_t index)
 void
 rtline_setPoint4d(const RTCTX *ctx, RTLINE *line, uint32_t index, RTPOINT4D *newpoint)
 {
-	ptarray_set_point4d(ctx, line->points, index, newpoint);
-	/* Update the box, if there is one to update */
-	if ( line->bbox )
-	{
-		rtgeom_drop_bbox(ctx, (RTGEOM*)line);
-		rtgeom_add_bbox(ctx, (RTGEOM*)line);
-	}
+  ptarray_set_point4d(ctx, line->points, index, newpoint);
+  /* Update the box, if there is one to update */
+  if ( line->bbox )
+  {
+    rtgeom_drop_bbox(ctx, (RTGEOM*)line);
+    rtgeom_add_bbox(ctx, (RTGEOM*)line);
+  }
 }
 
 /**
@@ -380,82 +380,82 @@ rtline_setPoint4d(const RTCTX *ctx, RTLINE *line, uint32_t index, RTPOINT4D *new
 RTLINE*
 rtline_measured_from_rtline(const RTCTX *ctx, const RTLINE *rtline, double m_start, double m_end)
 {
-	int i = 0;
-	int hasm = 0, hasz = 0;
-	int npoints = 0;
-	double length = 0.0;
-	double length_so_far = 0.0;
-	double m_range = m_end - m_start;
-	double m;
-	RTPOINTARRAY *pa = NULL;
-	RTPOINT3DZ p1, p2;
-
-	if ( rtline->type != RTLINETYPE )
-	{
-		rterror(ctx, "rtline_construct_from_rtline: only line types supported");
-		return NULL;
-	}
-
-	hasz = RTFLAGS_GET_Z(rtline->flags);
-	hasm = 1;
-
-	/* Null points or npoints == 0 will result in empty return geometry */
-	if ( rtline->points )
-	{
-		npoints = rtline->points->npoints;
-		length = ptarray_length_2d(ctx, rtline->points);
-		rt_getPoint3dz_p(ctx, rtline->points, 0, &p1);
-	}
-
-	pa = ptarray_construct(ctx, hasz, hasm, npoints);
-
-	for ( i = 0; i < npoints; i++ )
-	{
-		RTPOINT4D q;
-		RTPOINT2D a, b;
-		rt_getPoint3dz_p(ctx, rtline->points, i, &p2);
-		a.x = p1.x;
-		a.y = p1.y;
-		b.x = p2.x;
-		b.y = p2.y;
-		length_so_far += distance2d_pt_pt(ctx, &a, &b);
-		if ( length > 0.0 )
-			m = m_start + m_range * length_so_far / length;
-		/* #3172, support (valid) zero-length inputs */
-		else if ( length == 0.0 && npoints > 1 )
-			m = m_start + m_range * i / (npoints-1);
-		else
-			m = 0.0;
-		q.x = p2.x;
-		q.y = p2.y;
-		q.z = p2.z;
-		q.m = m;
-		ptarray_set_point4d(ctx, pa, i, &q);
-		p1 = p2;
-	}
-
-	return rtline_construct(ctx, rtline->srid, NULL, pa);
+  int i = 0;
+  int hasm = 0, hasz = 0;
+  int npoints = 0;
+  double length = 0.0;
+  double length_so_far = 0.0;
+  double m_range = m_end - m_start;
+  double m;
+  RTPOINTARRAY *pa = NULL;
+  RTPOINT3DZ p1, p2;
+
+  if ( rtline->type != RTLINETYPE )
+  {
+    rterror(ctx, "rtline_construct_from_rtline: only line types supported");
+    return NULL;
+  }
+
+  hasz = RTFLAGS_GET_Z(rtline->flags);
+  hasm = 1;
+
+  /* Null points or npoints == 0 will result in empty return geometry */
+  if ( rtline->points )
+  {
+    npoints = rtline->points->npoints;
+    length = ptarray_length_2d(ctx, rtline->points);
+    rt_getPoint3dz_p(ctx, rtline->points, 0, &p1);
+  }
+
+  pa = ptarray_construct(ctx, hasz, hasm, npoints);
+
+  for ( i = 0; i < npoints; i++ )
+  {
+    RTPOINT4D q;
+    RTPOINT2D a, b;
+    rt_getPoint3dz_p(ctx, rtline->points, i, &p2);
+    a.x = p1.x;
+    a.y = p1.y;
+    b.x = p2.x;
+    b.y = p2.y;
+    length_so_far += distance2d_pt_pt(ctx, &a, &b);
+    if ( length > 0.0 )
+      m = m_start + m_range * length_so_far / length;
+    /* #3172, support (valid) zero-length inputs */
+    else if ( length == 0.0 && npoints > 1 )
+      m = m_start + m_range * i / (npoints-1);
+    else
+      m = 0.0;
+    q.x = p2.x;
+    q.y = p2.y;
+    q.z = p2.z;
+    q.m = m;
+    ptarray_set_point4d(ctx, pa, i, &q);
+    p1 = p2;
+  }
+
+  return rtline_construct(ctx, rtline->srid, NULL, pa);
 }
 
 RTGEOM*
 rtline_remove_repeated_points(const RTCTX *ctx, const RTLINE *rtline, double tolerance)
 {
-	RTPOINTARRAY* npts = ptarray_remove_repeated_points_minpoints(ctx, rtline->points, tolerance, 2);
+  RTPOINTARRAY* npts = ptarray_remove_repeated_points_minpoints(ctx, rtline->points, tolerance, 2);
 
-	RTDEBUGF(3, "%s: npts %p", __func__, npts);
+  RTDEBUGF(3, "%s: npts %p", __func__, npts);
 
-	return (RTGEOM*)rtline_construct(ctx, rtline->srid,
-	                                 rtline->bbox ? gbox_copy(ctx, rtline->bbox) : 0,
-	                                 npts);
+  return (RTGEOM*)rtline_construct(ctx, rtline->srid,
+                                   rtline->bbox ? gbox_copy(ctx, rtline->bbox) : 0,
+                                   npts);
 }
 
 int
 rtline_is_closed(const RTCTX *ctx, const RTLINE *line)
 {
-	if (RTFLAGS_GET_Z(line->flags))
-		return ptarray_is_closed_3d(ctx, line->points);
+  if (RTFLAGS_GET_Z(line->flags))
+    return ptarray_is_closed_3d(ctx, line->points);
 
-	return ptarray_is_closed_2d(ctx, line->points);
+  return ptarray_is_closed_2d(ctx, line->points);
 }
 
 int
@@ -490,106 +490,106 @@ rtline_is_trajectory(const RTCTX *ctx, const RTLINE *line)
 RTLINE*
 rtline_force_dims(const RTCTX *ctx, const RTLINE *line, int hasz, int hasm)
 {
-	RTPOINTARRAY *pdims = NULL;
-	RTLINE *lineout;
-	
-	/* Return 2D empty */
-	if( rtline_is_empty(ctx, line) )
-	{
-		lineout = rtline_construct_empty(ctx, line->srid, hasz, hasm);
-	}
-	else
-	{	
-		pdims = ptarray_force_dims(ctx, line->points, hasz, hasm);
-		lineout = rtline_construct(ctx, line->srid, NULL, pdims);
-	}
-	lineout->type = line->type;
-	return lineout;
+  RTPOINTARRAY *pdims = NULL;
+  RTLINE *lineout;
+
+  /* Return 2D empty */
+  if( rtline_is_empty(ctx, line) )
+  {
+    lineout = rtline_construct_empty(ctx, line->srid, hasz, hasm);
+  }
+  else
+  {
+    pdims = ptarray_force_dims(ctx, line->points, hasz, hasm);
+    lineout = rtline_construct(ctx, line->srid, NULL, pdims);
+  }
+  lineout->type = line->type;
+  return lineout;
 }
 
 int rtline_is_empty(const RTCTX *ctx, const RTLINE *line)
 {
-	if ( !line->points || line->points->npoints < 1 )
-		return RT_TRUE;
-	return RT_FALSE;
+  if ( !line->points || line->points->npoints < 1 )
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 
 int rtline_count_vertices(const RTCTX *ctx, RTLINE *line)
 {
-	assert(line);
-	if ( ! line->points )
-		return 0;
-	return line->points->npoints;
+  assert(line);
+  if ( ! line->points )
+    return 0;
+  return line->points->npoints;
 }
 
 RTLINE* rtline_simplify(const RTCTX *ctx, const RTLINE *iline, double dist, int preserve_collapsed)
 {
-	static const int minvertices = 2; /* TODO: allow setting this */
-	RTLINE *oline;
-	RTPOINTARRAY *pa;
-
-	RTDEBUG(2, "function called");
-
-	/* Skip empty case */
-	if( rtline_is_empty(ctx, iline) )
-		return NULL;
-
-	pa = ptarray_simplify(ctx, iline->points, dist, minvertices);
-	if ( ! pa ) return NULL;
-
-	/* Make sure single-point collapses have two points */
-	if ( pa->npoints == 1 )
-	{
-		/* Make sure single-point collapses have two points */
-		if ( preserve_collapsed )
-		{
-			RTPOINT4D pt;
-			rt_getPoint4d_p(ctx, pa, 0, &pt);		
-			ptarray_append_point(ctx, pa, &pt, RT_TRUE);
-		}
-		/* Return null for collapse */
-		else 
-		{
-			ptarray_free(ctx, pa);
-			return NULL;
-		}
-	}
-
-	oline = rtline_construct(ctx, iline->srid, NULL, pa);
-	oline->type = iline->type;
-	return oline;
+  static const int minvertices = 2; /* TODO: allow setting this */
+  RTLINE *oline;
+  RTPOINTARRAY *pa;
+
+  RTDEBUG(2, "function called");
+
+  /* Skip empty case */
+  if( rtline_is_empty(ctx, iline) )
+    return NULL;
+
+  pa = ptarray_simplify(ctx, iline->points, dist, minvertices);
+  if ( ! pa ) return NULL;
+
+  /* Make sure single-point collapses have two points */
+  if ( pa->npoints == 1 )
+  {
+    /* Make sure single-point collapses have two points */
+    if ( preserve_collapsed )
+    {
+      RTPOINT4D pt;
+      rt_getPoint4d_p(ctx, pa, 0, &pt);
+      ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+    }
+    /* Return null for collapse */
+    else
+    {
+      ptarray_free(ctx, pa);
+      return NULL;
+    }
+  }
+
+  oline = rtline_construct(ctx, iline->srid, NULL, pa);
+  oline->type = iline->type;
+  return oline;
 }
 
 double rtline_length(const RTCTX *ctx, const RTLINE *line)
 {
-	if ( rtline_is_empty(ctx, line) )
-		return 0.0;
-	return ptarray_length(ctx, line->points);
+  if ( rtline_is_empty(ctx, line) )
+    return 0.0;
+  return ptarray_length(ctx, line->points);
 }
 
 double rtline_length_2d(const RTCTX *ctx, const RTLINE *line)
 {
-	if ( rtline_is_empty(ctx, line) )
-		return 0.0;
-	return ptarray_length_2d(ctx, line->points);
+  if ( rtline_is_empty(ctx, line) )
+    return 0.0;
+  return ptarray_length_2d(ctx, line->points);
 }
 
 
 
 RTLINE* rtline_grid(const RTCTX *ctx, const RTLINE *line, const gridspec *grid)
 {
-	RTLINE *oline;
-	RTPOINTARRAY *opa;
+  RTLINE *oline;
+  RTPOINTARRAY *opa;
 
-	opa = ptarray_grid(ctx, line->points, grid);
+  opa = ptarray_grid(ctx, line->points, grid);
 
-	/* Skip line3d with less then 2 points */
-	if ( opa->npoints < 2 ) return NULL;
+  /* Skip line3d with less then 2 points */
+  if ( opa->npoints < 2 ) return NULL;
 
-	/* TODO: grid bounding box... */
-	oline = rtline_construct(ctx, line->srid, NULL, opa);
+  /* TODO: grid bounding box... */
+  oline = rtline_construct(ctx, line->srid, NULL, opa);
 
-	return oline;
+  return oline;
 }
 
diff --git a/src/rtlinearreferencing.c b/src/rtlinearreferencing.c
index f07102f..e4a211e 100644
--- a/src/rtlinearreferencing.c
+++ b/src/rtlinearreferencing.c
@@ -32,214 +32,214 @@
 static int
 segment_locate_along(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2, double m, double offset, RTPOINT4D *pn)
 {
-	double m1 = p1->m;
-	double m2 = p2->m;
-	double mprop;
-
-	/* M is out of range, no new point generated. */
-	if ( (m < FP_MIN(m1,m2)) || (m > FP_MAX(m1,m2)) )
-	{
-		return RT_FALSE;
-	}
-
-	if( m1 == m2 )
-	{
-		/* Degenerate case: same M on both points.
-		   If they are the same point we just return one of them. */
-		if ( p4d_same(ctx, p1,p2) )
-		{
-			*pn = *p1;
-			return RT_TRUE;
-		}
-		/* If the points are different we can out.
-		   Correct behavior is probably an mprop of 0.5? */
-		rterror(ctx, "Zero measure-length line encountered!");
-		return RT_FALSE;
-	}
-
-	/* M is in range, new point to be generated. */
-	mprop = (m - m1) / (m2 - m1);
-	pn->x = p1->x + (p2->x - p1->x) * mprop;
-	pn->y = p1->y + (p2->y - p1->y) * mprop;
-	pn->z = p1->z + (p2->z - p1->z) * mprop;
-	pn->m = m;
-
-	/* Offset to the left or right, if necessary. */
-	if ( offset != 0.0 )
-	{
-		double theta = atan2(p2->y - p1->y, p2->x - p1->x);
-		pn->x -= sin(theta) * offset;
-		pn->y += cos(theta) * offset;
-	}
-
-	return RT_TRUE;
+  double m1 = p1->m;
+  double m2 = p2->m;
+  double mprop;
+
+  /* M is out of range, no new point generated. */
+  if ( (m < FP_MIN(m1,m2)) || (m > FP_MAX(m1,m2)) )
+  {
+    return RT_FALSE;
+  }
+
+  if( m1 == m2 )
+  {
+    /* Degenerate case: same M on both points.
+       If they are the same point we just return one of them. */
+    if ( p4d_same(ctx, p1,p2) )
+    {
+      *pn = *p1;
+      return RT_TRUE;
+    }
+    /* If the points are different we can out.
+       Correct behavior is probably an mprop of 0.5? */
+    rterror(ctx, "Zero measure-length line encountered!");
+    return RT_FALSE;
+  }
+
+  /* M is in range, new point to be generated. */
+  mprop = (m - m1) / (m2 - m1);
+  pn->x = p1->x + (p2->x - p1->x) * mprop;
+  pn->y = p1->y + (p2->y - p1->y) * mprop;
+  pn->z = p1->z + (p2->z - p1->z) * mprop;
+  pn->m = m;
+
+  /* Offset to the left or right, if necessary. */
+  if ( offset != 0.0 )
+  {
+    double theta = atan2(p2->y - p1->y, p2->x - p1->x);
+    pn->x -= sin(theta) * offset;
+    pn->y += cos(theta) * offset;
+  }
+
+  return RT_TRUE;
 }
 
 
 static RTPOINTARRAY*
 ptarray_locate_along(const RTCTX *ctx, const RTPOINTARRAY *pa, double m, double offset)
 {
-	int i;
-	RTPOINT4D p1, p2, pn;
-	RTPOINTARRAY *dpa = NULL;
+  int i;
+  RTPOINT4D p1, p2, pn;
+  RTPOINTARRAY *dpa = NULL;
 
-	/* Can't do anything with degenerate point arrays */
-	if ( ! pa || pa->npoints < 2 ) return NULL;
+  /* Can't do anything with degenerate point arrays */
+  if ( ! pa || pa->npoints < 2 ) return NULL;
 
-	/* Walk through each segment in the point array */
-	for ( i = 1; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i-1, &p1);
-		rt_getPoint4d_p(ctx, pa, i, &p2);
+  /* Walk through each segment in the point array */
+  for ( i = 1; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i-1, &p1);
+    rt_getPoint4d_p(ctx, pa, i, &p2);
 
-		/* No derived point? Move to next segment. */
-		if ( segment_locate_along(ctx, &p1, &p2, m, offset, &pn) == RT_FALSE )
-			continue;
+    /* No derived point? Move to next segment. */
+    if ( segment_locate_along(ctx, &p1, &p2, m, offset, &pn) == RT_FALSE )
+      continue;
 
-		/* No pointarray, make a fresh one */
-		if ( dpa == NULL )
-			dpa = ptarray_construct_empty(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), 8);
+    /* No pointarray, make a fresh one */
+    if ( dpa == NULL )
+      dpa = ptarray_construct_empty(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), 8);
 
-		/* Add our new point to the array */
-		ptarray_append_point(ctx, dpa, &pn, 0);
-	}
+    /* Add our new point to the array */
+    ptarray_append_point(ctx, dpa, &pn, 0);
+  }
 
-	return dpa;
+  return dpa;
 }
 
 static RTMPOINT*
 rtline_locate_along(const RTCTX *ctx, const RTLINE *rtline, double m, double offset)
 {
-	RTPOINTARRAY *opa = NULL;
-	RTMPOINT *mp = NULL;
-	RTGEOM *rtg = rtline_as_rtgeom(ctx, rtline);
-	int hasz, hasm, srid;
-
-	/* Return degenerates upwards */
-	if ( ! rtline ) return NULL;
-
-	/* Create empty return shell */
-	srid = rtgeom_get_srid(ctx, rtg);
-	hasz = rtgeom_has_z(ctx, rtg);
-	hasm = rtgeom_has_m(ctx, rtg);
-
-	if ( hasm )
-	{
-		/* Find points along */
-		opa = ptarray_locate_along(ctx, rtline->points, m, offset);
-	}
-	else
-	{
-		RTLINE *rtline_measured = rtline_measured_from_rtline(ctx, rtline, 0.0, 1.0);
-		opa = ptarray_locate_along(ctx, rtline_measured->points, m, offset);
-		rtline_free(ctx, rtline_measured);
-	}
-
-	/* Return NULL as EMPTY */
-	if ( ! opa )
-		return rtmpoint_construct_empty(ctx, srid, hasz, hasm);
-
-	/* Convert pointarray into a multipoint */
-	mp = rtmpoint_construct(ctx, srid, opa);
-	ptarray_free(ctx, opa);
-	return mp;
+  RTPOINTARRAY *opa = NULL;
+  RTMPOINT *mp = NULL;
+  RTGEOM *rtg = rtline_as_rtgeom(ctx, rtline);
+  int hasz, hasm, srid;
+
+  /* Return degenerates upwards */
+  if ( ! rtline ) return NULL;
+
+  /* Create empty return shell */
+  srid = rtgeom_get_srid(ctx, rtg);
+  hasz = rtgeom_has_z(ctx, rtg);
+  hasm = rtgeom_has_m(ctx, rtg);
+
+  if ( hasm )
+  {
+    /* Find points along */
+    opa = ptarray_locate_along(ctx, rtline->points, m, offset);
+  }
+  else
+  {
+    RTLINE *rtline_measured = rtline_measured_from_rtline(ctx, rtline, 0.0, 1.0);
+    opa = ptarray_locate_along(ctx, rtline_measured->points, m, offset);
+    rtline_free(ctx, rtline_measured);
+  }
+
+  /* Return NULL as EMPTY */
+  if ( ! opa )
+    return rtmpoint_construct_empty(ctx, srid, hasz, hasm);
+
+  /* Convert pointarray into a multipoint */
+  mp = rtmpoint_construct(ctx, srid, opa);
+  ptarray_free(ctx, opa);
+  return mp;
 }
 
 static RTMPOINT*
 rtmline_locate_along(const RTCTX *ctx, const RTMLINE *rtmline, double m, double offset)
 {
-	RTMPOINT *rtmpoint = NULL;
-	RTGEOM *rtg = rtmline_as_rtgeom(ctx, rtmline);
-	int i, j;
-
-	/* Return degenerates upwards */
-	if ( (!rtmline) || (rtmline->ngeoms < 1) ) return NULL;
-
-	/* Construct return */
-	rtmpoint = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
-
-	/* Locate along each sub-line */
-	for ( i = 0; i < rtmline->ngeoms; i++ )
-	{
-		RTMPOINT *along = rtline_locate_along(ctx, rtmline->geoms[i], m, offset);
-		if ( along )
-		{
-			if ( ! rtgeom_is_empty(ctx, (RTGEOM*)along) )
-			{
-				for ( j = 0; j < along->ngeoms; j++ )
-				{
-					rtmpoint_add_rtpoint(ctx, rtmpoint, along->geoms[j]);
-				}
-			}
-			/* Free the containing geometry, but leave the sub-geometries around */
-			along->ngeoms = 0;
-			rtmpoint_free(ctx, along);
-		}
-	}
-	return rtmpoint;
+  RTMPOINT *rtmpoint = NULL;
+  RTGEOM *rtg = rtmline_as_rtgeom(ctx, rtmline);
+  int i, j;
+
+  /* Return degenerates upwards */
+  if ( (!rtmline) || (rtmline->ngeoms < 1) ) return NULL;
+
+  /* Construct return */
+  rtmpoint = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
+
+  /* Locate along each sub-line */
+  for ( i = 0; i < rtmline->ngeoms; i++ )
+  {
+    RTMPOINT *along = rtline_locate_along(ctx, rtmline->geoms[i], m, offset);
+    if ( along )
+    {
+      if ( ! rtgeom_is_empty(ctx, (RTGEOM*)along) )
+      {
+        for ( j = 0; j < along->ngeoms; j++ )
+        {
+          rtmpoint_add_rtpoint(ctx, rtmpoint, along->geoms[j]);
+        }
+      }
+      /* Free the containing geometry, but leave the sub-geometries around */
+      along->ngeoms = 0;
+      rtmpoint_free(ctx, along);
+    }
+  }
+  return rtmpoint;
 }
 
 static RTMPOINT*
 rtpoint_locate_along(const RTCTX *ctx, const RTPOINT *rtpoint, double m, double offset)
 {
-	double point_m = rtpoint_get_m(ctx, rtpoint);
-	RTGEOM *rtg = rtpoint_as_rtgeom(ctx, rtpoint);
-	RTMPOINT *r = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
-	if ( FP_EQUALS(m, point_m) )
-	{
-		rtmpoint_add_rtpoint(ctx, r, rtpoint_clone(ctx, rtpoint));
-	}
-	return r;
+  double point_m = rtpoint_get_m(ctx, rtpoint);
+  RTGEOM *rtg = rtpoint_as_rtgeom(ctx, rtpoint);
+  RTMPOINT *r = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
+  if ( FP_EQUALS(m, point_m) )
+  {
+    rtmpoint_add_rtpoint(ctx, r, rtpoint_clone(ctx, rtpoint));
+  }
+  return r;
 }
 
 static RTMPOINT*
 rtmpoint_locate_along(const RTCTX *ctx, const RTMPOINT *rtin, double m, double offset)
 {
-	RTGEOM *rtg = rtmpoint_as_rtgeom(ctx, rtin);
-	RTMPOINT *rtout = NULL;
-	int i;
-
-	/* Construct return */
-	rtout = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
-
-	for ( i = 0; i < rtin->ngeoms; i++ )
-	{
-		double point_m = rtpoint_get_m(ctx, rtin->geoms[i]);
-		if ( FP_EQUALS(m, point_m) )
-		{
-			rtmpoint_add_rtpoint(ctx, rtout, rtpoint_clone(ctx, rtin->geoms[i]));
-		}
-	}
-
-	return rtout;
+  RTGEOM *rtg = rtmpoint_as_rtgeom(ctx, rtin);
+  RTMPOINT *rtout = NULL;
+  int i;
+
+  /* Construct return */
+  rtout = rtmpoint_construct_empty(ctx, rtgeom_get_srid(ctx, rtg), rtgeom_has_z(ctx, rtg), rtgeom_has_m(ctx, rtg));
+
+  for ( i = 0; i < rtin->ngeoms; i++ )
+  {
+    double point_m = rtpoint_get_m(ctx, rtin->geoms[i]);
+    if ( FP_EQUALS(m, point_m) )
+    {
+      rtmpoint_add_rtpoint(ctx, rtout, rtpoint_clone(ctx, rtin->geoms[i]));
+    }
+  }
+
+  return rtout;
 }
 
 RTGEOM*
 rtgeom_locate_along(const RTCTX *ctx, const RTGEOM *rtin, double m, double offset)
 {
-	if ( ! rtin ) return NULL;
-
-	if ( ! rtgeom_has_m(ctx, rtin) )
-		rterror(ctx, "Input geometry does not have a measure dimension");
-
-	switch (rtin->type)
-	{
-	case RTPOINTTYPE:
-		return (RTGEOM*)rtpoint_locate_along(ctx, (RTPOINT*)rtin, m, offset);
-	case RTMULTIPOINTTYPE:
-		return (RTGEOM*)rtmpoint_locate_along(ctx, (RTMPOINT*)rtin, m, offset);
-	case RTLINETYPE:
-		return (RTGEOM*)rtline_locate_along(ctx, (RTLINE*)rtin, m, offset);
-	case RTMULTILINETYPE:
-		return (RTGEOM*)rtmline_locate_along(ctx, (RTMLINE*)rtin, m, offset);
-	/* Only line types supported right now */
-	/* TO DO: CurveString, CompoundCurve, MultiCurve */
-	/* TO DO: Point, MultiPoint */
-	default:
-		rterror(ctx, "Only linear geometries are supported, %s provided.",rttype_name(ctx, rtin->type));
-		return NULL;
-	}
-	return NULL;
+  if ( ! rtin ) return NULL;
+
+  if ( ! rtgeom_has_m(ctx, rtin) )
+    rterror(ctx, "Input geometry does not have a measure dimension");
+
+  switch (rtin->type)
+  {
+  case RTPOINTTYPE:
+    return (RTGEOM*)rtpoint_locate_along(ctx, (RTPOINT*)rtin, m, offset);
+  case RTMULTIPOINTTYPE:
+    return (RTGEOM*)rtmpoint_locate_along(ctx, (RTMPOINT*)rtin, m, offset);
+  case RTLINETYPE:
+    return (RTGEOM*)rtline_locate_along(ctx, (RTLINE*)rtin, m, offset);
+  case RTMULTILINETYPE:
+    return (RTGEOM*)rtmline_locate_along(ctx, (RTMLINE*)rtin, m, offset);
+  /* Only line types supported right now */
+  /* TO DO: CurveString, CompoundCurve, MultiCurve */
+  /* TO DO: Point, MultiPoint */
+  default:
+    rterror(ctx, "Only linear geometries are supported, %s provided.",rttype_name(ctx, rtin->type));
+    return NULL;
+  }
+  return NULL;
 }
 
 /**
@@ -251,29 +251,29 @@ rtgeom_locate_along(const RTCTX *ctx, const RTGEOM *rtin, double m, double offse
 */
 double rtpoint_get_ordinate(const RTCTX *ctx, const RTPOINT4D *p, char ordinate)
 {
-	if ( ! p )
-	{
-		rterror(ctx, "Null input geometry.");
-		return 0.0;
-	}
-
-	if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
-	{
-		rterror(ctx, "Cannot extract %c ordinate.", ordinate);
-		return 0.0;
-	}
-
-	if ( ordinate == 'X' )
-		return p->x;
-	if ( ordinate == 'Y' )
-		return p->y;
-	if ( ordinate == 'Z' )
-		return p->z;
-	if ( ordinate == 'M' )
-		return p->m;
-
-	/* X */
-	return p->x;
+  if ( ! p )
+  {
+    rterror(ctx, "Null input geometry.");
+    return 0.0;
+  }
+
+  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
+  {
+    rterror(ctx, "Cannot extract %c ordinate.", ordinate);
+    return 0.0;
+  }
+
+  if ( ordinate == 'X' )
+    return p->x;
+  if ( ordinate == 'Y' )
+    return p->y;
+  if ( ordinate == 'Z' )
+    return p->z;
+  if ( ordinate == 'M' )
+    return p->m;
+
+  /* X */
+  return p->x;
 
 }
 
@@ -283,35 +283,35 @@ double rtpoint_get_ordinate(const RTCTX *ctx, const RTPOINT4D *p, char ordinate)
 */
 void rtpoint_set_ordinate(const RTCTX *ctx, RTPOINT4D *p, char ordinate, double value)
 {
-	if ( ! p )
-	{
-		rterror(ctx, "Null input geometry.");
-		return;
-	}
-
-	if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
-	{
-		rterror(ctx, "Cannot set %c ordinate.", ordinate);
-		return;
-	}
-
-	RTDEBUGF(4, "    setting ordinate %c to %g", ordinate, value);
-
-	switch ( ordinate )
-	{
-	case 'X':
-		p->x = value;
-		return;
-	case 'Y':
-		p->y = value;
-		return;
-	case 'Z':
-		p->z = value;
-		return;
-	case 'M':
-		p->m = value;
-		return;
-	}
+  if ( ! p )
+  {
+    rterror(ctx, "Null input geometry.");
+    return;
+  }
+
+  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
+  {
+    rterror(ctx, "Cannot set %c ordinate.", ordinate);
+    return;
+  }
+
+  RTDEBUGF(4, "    setting ordinate %c to %g", ordinate, value);
+
+  switch ( ordinate )
+  {
+  case 'X':
+    p->x = value;
+    return;
+  case 'Y':
+    p->y = value;
+    return;
+  case 'Z':
+    p->z = value;
+    return;
+  case 'M':
+    p->m = value;
+    return;
+  }
 }
 
 /**
@@ -321,40 +321,40 @@ void rtpoint_set_ordinate(const RTCTX *ctx, RTPOINT4D *p, char ordinate, double
 */
 int point_interpolate(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2, RTPOINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value)
 {
-	static char* dims = "XYZM";
-	double p1_value = rtpoint_get_ordinate(ctx, p1, ordinate);
-	double p2_value = rtpoint_get_ordinate(ctx, p2, ordinate);
-	double proportion;
-	int i = 0;
-
-	if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
-	{
-		rterror(ctx, "Cannot set %c ordinate.", ordinate);
-		return 0;
-	}
-
-	if ( FP_MIN(p1_value, p2_value) > interpolation_value ||
-	        FP_MAX(p1_value, p2_value) < interpolation_value )
-	{
-		rterror(ctx, "Cannot interpolate to a value (%g) not between the input points (%g, %g).", interpolation_value, p1_value, p2_value);
-		return 0;
-	}
-
-	proportion = fabs((interpolation_value - p1_value) / (p2_value - p1_value));
-
-	for ( i = 0; i < 4; i++ )
-	{
-		double newordinate = 0.0;
-		if ( dims[i] == 'Z' && ! hasz ) continue;
-		if ( dims[i] == 'M' && ! hasm ) continue;
-		p1_value = rtpoint_get_ordinate(ctx, p1, dims[i]);
-		p2_value = rtpoint_get_ordinate(ctx, p2, dims[i]);
-		newordinate = p1_value + proportion * (p2_value - p1_value);
-		rtpoint_set_ordinate(ctx, p, dims[i], newordinate);
-		RTDEBUGF(4, "   clip ordinate(%c) p1_value(%g) p2_value(%g) proportion(%g) newordinate(%g) ", dims[i], p1_value, p2_value, proportion, newordinate );
-	}
-
-	return 1;
+  static char* dims = "XYZM";
+  double p1_value = rtpoint_get_ordinate(ctx, p1, ordinate);
+  double p2_value = rtpoint_get_ordinate(ctx, p2, ordinate);
+  double proportion;
+  int i = 0;
+
+  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
+  {
+    rterror(ctx, "Cannot set %c ordinate.", ordinate);
+    return 0;
+  }
+
+  if ( FP_MIN(p1_value, p2_value) > interpolation_value ||
+          FP_MAX(p1_value, p2_value) < interpolation_value )
+  {
+    rterror(ctx, "Cannot interpolate to a value (%g) not between the input points (%g, %g).", interpolation_value, p1_value, p2_value);
+    return 0;
+  }
+
+  proportion = fabs((interpolation_value - p1_value) / (p2_value - p1_value));
+
+  for ( i = 0; i < 4; i++ )
+  {
+    double newordinate = 0.0;
+    if ( dims[i] == 'Z' && ! hasz ) continue;
+    if ( dims[i] == 'M' && ! hasm ) continue;
+    p1_value = rtpoint_get_ordinate(ctx, p1, dims[i]);
+    p2_value = rtpoint_get_ordinate(ctx, p2, dims[i]);
+    newordinate = p1_value + proportion * (p2_value - p1_value);
+    rtpoint_set_ordinate(ctx, p, dims[i], newordinate);
+    RTDEBUGF(4, "   clip ordinate(%c) p1_value(%g) p2_value(%g) proportion(%g) newordinate(%g) ", dims[i], p1_value, p2_value, proportion, newordinate );
+  }
+
+  return 1;
 }
 
 
@@ -364,47 +364,47 @@ int point_interpolate(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2
 RTCOLLECTION*
 rtpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTPOINT *point, char ordinate, double from, double to)
 {
-	RTCOLLECTION *rtgeom_out = NULL;
-	char hasz, hasm;
-	RTPOINT4D p4d;
-	double ordinate_value;
-
-	/* Nothing to do with NULL */
-	if ( ! point )
-		rterror(ctx, "Null input geometry.");
-
-	/* Ensure 'from' is less than 'to'. */
-	if ( to < from )
-	{
-		double t = from;
-		from = to;
-		to = t;
-	}
-
-	/* Read Z/M info */
-	hasz = rtgeom_has_z(ctx, rtpoint_as_rtgeom(ctx, point));
-	hasm = rtgeom_has_m(ctx, rtpoint_as_rtgeom(ctx, point));
-
-	/* Prepare return object */
-	rtgeom_out = rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, point->srid, hasz, hasm);
-
-	/* Test if ordinate is in range */
-	rtpoint_getPoint4d_p(ctx, point, &p4d);
-	ordinate_value = rtpoint_get_ordinate(ctx, &p4d, ordinate);
-	if ( from <= ordinate_value && to >= ordinate_value )
-	{
-		RTPOINT *rtp = rtpoint_clone(ctx, point);
-		rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, rtp));
-	}
-
-	/* Set the bbox, if necessary */
-	if ( rtgeom_out->bbox )
-	{
-		rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
-		rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
-	}
-
-	return rtgeom_out;
+  RTCOLLECTION *rtgeom_out = NULL;
+  char hasz, hasm;
+  RTPOINT4D p4d;
+  double ordinate_value;
+
+  /* Nothing to do with NULL */
+  if ( ! point )
+    rterror(ctx, "Null input geometry.");
+
+  /* Ensure 'from' is less than 'to'. */
+  if ( to < from )
+  {
+    double t = from;
+    from = to;
+    to = t;
+  }
+
+  /* Read Z/M info */
+  hasz = rtgeom_has_z(ctx, rtpoint_as_rtgeom(ctx, point));
+  hasm = rtgeom_has_m(ctx, rtpoint_as_rtgeom(ctx, point));
+
+  /* Prepare return object */
+  rtgeom_out = rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, point->srid, hasz, hasm);
+
+  /* Test if ordinate is in range */
+  rtpoint_getPoint4d_p(ctx, point, &p4d);
+  ordinate_value = rtpoint_get_ordinate(ctx, &p4d, ordinate);
+  if ( from <= ordinate_value && to >= ordinate_value )
+  {
+    RTPOINT *rtp = rtpoint_clone(ctx, point);
+    rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, rtp));
+  }
+
+  /* Set the bbox, if necessary */
+  if ( rtgeom_out->bbox )
+  {
+    rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
+    rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
+  }
+
+  return rtgeom_out;
 }
 
 
@@ -415,53 +415,53 @@ rtpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTPOINT *point, char ordi
 RTCOLLECTION*
 rtmpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTMPOINT *mpoint, char ordinate, double from, double to)
 {
-	RTCOLLECTION *rtgeom_out = NULL;
-	char hasz, hasm;
-	int i;
-
-	/* Nothing to do with NULL */
-	if ( ! mpoint )
-		rterror(ctx, "Null input geometry.");
-
-	/* Ensure 'from' is less than 'to'. */
-	if ( to < from )
-	{
-		double t = from;
-		from = to;
-		to = t;
-	}
-
-	/* Read Z/M info */
-	hasz = rtgeom_has_z(ctx, rtmpoint_as_rtgeom(ctx, mpoint));
-	hasm = rtgeom_has_m(ctx, rtmpoint_as_rtgeom(ctx, mpoint));
-
-	/* Prepare return object */
-	rtgeom_out = rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, mpoint->srid, hasz, hasm);
-
-	/* For each point, is its ordinate value between from and to? */
-	for ( i = 0; i < mpoint->ngeoms; i ++ )
-	{
-		RTPOINT4D p4d;
-		double ordinate_value;
-
-		rtpoint_getPoint4d_p(ctx, mpoint->geoms[i], &p4d);
-		ordinate_value = rtpoint_get_ordinate(ctx, &p4d, ordinate);
-
-		if ( from <= ordinate_value && to >= ordinate_value )
-		{
-			RTPOINT *rtp = rtpoint_clone(ctx, mpoint->geoms[i]);
-			rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, rtp));
-		}
-	}
-
-	/* Set the bbox, if necessary */
-	if ( rtgeom_out->bbox )
-	{
-		rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
-		rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
-	}
-
-	return rtgeom_out;
+  RTCOLLECTION *rtgeom_out = NULL;
+  char hasz, hasm;
+  int i;
+
+  /* Nothing to do with NULL */
+  if ( ! mpoint )
+    rterror(ctx, "Null input geometry.");
+
+  /* Ensure 'from' is less than 'to'. */
+  if ( to < from )
+  {
+    double t = from;
+    from = to;
+    to = t;
+  }
+
+  /* Read Z/M info */
+  hasz = rtgeom_has_z(ctx, rtmpoint_as_rtgeom(ctx, mpoint));
+  hasm = rtgeom_has_m(ctx, rtmpoint_as_rtgeom(ctx, mpoint));
+
+  /* Prepare return object */
+  rtgeom_out = rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, mpoint->srid, hasz, hasm);
+
+  /* For each point, is its ordinate value between from and to? */
+  for ( i = 0; i < mpoint->ngeoms; i ++ )
+  {
+    RTPOINT4D p4d;
+    double ordinate_value;
+
+    rtpoint_getPoint4d_p(ctx, mpoint->geoms[i], &p4d);
+    ordinate_value = rtpoint_get_ordinate(ctx, &p4d, ordinate);
+
+    if ( from <= ordinate_value && to >= ordinate_value )
+    {
+      RTPOINT *rtp = rtpoint_clone(ctx, mpoint->geoms[i]);
+      rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, rtp));
+    }
+  }
+
+  /* Set the bbox, if necessary */
+  if ( rtgeom_out->bbox )
+  {
+    rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
+    rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
+  }
+
+  return rtgeom_out;
 }
 
 /**
@@ -470,80 +470,80 @@ rtmpoint_clip_to_ordinate_range(const RTCTX *ctx, const RTMPOINT *mpoint, char o
 RTCOLLECTION*
 rtmline_clip_to_ordinate_range(const RTCTX *ctx, const RTMLINE *mline, char ordinate, double from, double to)
 {
-	RTCOLLECTION *rtgeom_out = NULL;
-
-	if ( ! mline )
-	{
-		rterror(ctx, "Null input geometry.");
-		return NULL;
-	}
-
-	if ( mline->ngeoms == 1)
-	{
-		rtgeom_out = rtline_clip_to_ordinate_range(ctx, mline->geoms[0], ordinate, from, to);
-	}
-	else
-	{
-		RTCOLLECTION *col;
-		char hasz = rtgeom_has_z(ctx, rtmline_as_rtgeom(ctx, mline));
-		char hasm = rtgeom_has_m(ctx, rtmline_as_rtgeom(ctx, mline));
-		int i, j;
-		char homogeneous = 1;
-		size_t geoms_size = 0;
-		rtgeom_out = rtcollection_construct_empty(ctx, RTMULTILINETYPE, mline->srid, hasz, hasm);
-		RTFLAGS_SET_Z(rtgeom_out->flags, hasz);
-		RTFLAGS_SET_M(rtgeom_out->flags, hasm);
-		for ( i = 0; i < mline->ngeoms; i ++ )
-		{
-			col = rtline_clip_to_ordinate_range(ctx, mline->geoms[i], ordinate, from, to);
-			if ( col )
-			{
-				/* Something was left after the clip. */
-				if ( rtgeom_out->ngeoms + col->ngeoms > geoms_size )
-				{
-					geoms_size += 16;
-					if ( rtgeom_out->geoms )
-					{
-						rtgeom_out->geoms = rtrealloc(ctx, rtgeom_out->geoms, geoms_size * sizeof(RTGEOM*));
-					}
-					else
-					{
-						rtgeom_out->geoms = rtalloc(ctx, geoms_size * sizeof(RTGEOM*));
-					}
-				}
-				for ( j = 0; j < col->ngeoms; j++ )
-				{
-					rtgeom_out->geoms[rtgeom_out->ngeoms] = col->geoms[j];
-					rtgeom_out->ngeoms++;
-				}
-				if ( col->type != mline->type )
-				{
-					homogeneous = 0;
-				}
-				/* Shallow free the struct, leaving the geoms behind. */
-				if ( col->bbox ) rtfree(ctx, col->bbox);
-				rtfree(ctx, col->geoms);
-				rtfree(ctx, col);
-			}
-		}
-		if ( rtgeom_out->bbox )
-		{
-			rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
-			rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
-		}
-
-		if ( ! homogeneous )
-		{
-			rtgeom_out->type = RTCOLLECTIONTYPE;
-		}
-	}
-
-	if ( ! rtgeom_out || rtgeom_out->ngeoms == 0 ) /* Nothing left after clip. */
-	{
-		return NULL;
-	}
-
-	return rtgeom_out;
+  RTCOLLECTION *rtgeom_out = NULL;
+
+  if ( ! mline )
+  {
+    rterror(ctx, "Null input geometry.");
+    return NULL;
+  }
+
+  if ( mline->ngeoms == 1)
+  {
+    rtgeom_out = rtline_clip_to_ordinate_range(ctx, mline->geoms[0], ordinate, from, to);
+  }
+  else
+  {
+    RTCOLLECTION *col;
+    char hasz = rtgeom_has_z(ctx, rtmline_as_rtgeom(ctx, mline));
+    char hasm = rtgeom_has_m(ctx, rtmline_as_rtgeom(ctx, mline));
+    int i, j;
+    char homogeneous = 1;
+    size_t geoms_size = 0;
+    rtgeom_out = rtcollection_construct_empty(ctx, RTMULTILINETYPE, mline->srid, hasz, hasm);
+    RTFLAGS_SET_Z(rtgeom_out->flags, hasz);
+    RTFLAGS_SET_M(rtgeom_out->flags, hasm);
+    for ( i = 0; i < mline->ngeoms; i ++ )
+    {
+      col = rtline_clip_to_ordinate_range(ctx, mline->geoms[i], ordinate, from, to);
+      if ( col )
+      {
+        /* Something was left after the clip. */
+        if ( rtgeom_out->ngeoms + col->ngeoms > geoms_size )
+        {
+          geoms_size += 16;
+          if ( rtgeom_out->geoms )
+          {
+            rtgeom_out->geoms = rtrealloc(ctx, rtgeom_out->geoms, geoms_size * sizeof(RTGEOM*));
+          }
+          else
+          {
+            rtgeom_out->geoms = rtalloc(ctx, geoms_size * sizeof(RTGEOM*));
+          }
+        }
+        for ( j = 0; j < col->ngeoms; j++ )
+        {
+          rtgeom_out->geoms[rtgeom_out->ngeoms] = col->geoms[j];
+          rtgeom_out->ngeoms++;
+        }
+        if ( col->type != mline->type )
+        {
+          homogeneous = 0;
+        }
+        /* Shallow free the struct, leaving the geoms behind. */
+        if ( col->bbox ) rtfree(ctx, col->bbox);
+        rtfree(ctx, col->geoms);
+        rtfree(ctx, col);
+      }
+    }
+    if ( rtgeom_out->bbox )
+    {
+      rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
+      rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
+    }
+
+    if ( ! homogeneous )
+    {
+      rtgeom_out->type = RTCOLLECTIONTYPE;
+    }
+  }
+
+  if ( ! rtgeom_out || rtgeom_out->ngeoms == 0 ) /* Nothing left after clip. */
+  {
+    return NULL;
+  }
+
+  return rtgeom_out;
 
 }
 
@@ -556,332 +556,332 @@ RTCOLLECTION*
 rtline_clip_to_ordinate_range(const RTCTX *ctx, const RTLINE *line, char ordinate, double from, double to)
 {
 
-	RTPOINTARRAY *pa_in = NULL;
-	RTCOLLECTION *rtgeom_out = NULL;
-	RTPOINTARRAY *dp = NULL;
-	int i;
-	int added_last_point = 0;
-	RTPOINT4D *p = NULL, *q = NULL, *r = NULL;
-	double ordinate_value_p = 0.0, ordinate_value_q = 0.0;
-	char hasz = rtgeom_has_z(ctx, rtline_as_rtgeom(ctx, line));
-	char hasm = rtgeom_has_m(ctx, rtline_as_rtgeom(ctx, line));
-	char dims = RTFLAGS_NDIMS(line->flags);
-
-	/* Null input, nothing we can do. */
-	if ( ! line )
-	{
-		rterror(ctx, "Null input geometry.");
-		return NULL;
-	}
-
-	/* Ensure 'from' is less than 'to'. */
-	if ( to < from )
-	{
-		double t = from;
-		from = to;
-		to = t;
-	}
-
-	RTDEBUGF(4, "from = %g, to = %g, ordinate = %c", from, to, ordinate);
-	RTDEBUGF(4, "%s", rtgeom_to_ewkt(ctx, (RTGEOM*)line));
-
-	/* Asking for an ordinate we don't have. Error. */
-	if ( (ordinate == 'Z' && ! hasz) || (ordinate == 'M' && ! hasm) )
-	{
-		rterror(ctx, "Cannot clip on ordinate %d in a %d-d geometry.", ordinate, dims);
-		return NULL;
-	}
-
-	/* Prepare our working point objects. */
-	p = rtalloc(ctx, sizeof(RTPOINT4D));
-	q = rtalloc(ctx, sizeof(RTPOINT4D));
-	r = rtalloc(ctx, sizeof(RTPOINT4D));
-
-	/* Construct a collection to hold our outputs. */
-	rtgeom_out = rtcollection_construct_empty(ctx, RTMULTILINETYPE, line->srid, hasz, hasm);
-
-	/* Get our input point array */
-	pa_in = line->points;
-
-	for ( i = 0; i < pa_in->npoints; i++ )
-	{
-		RTDEBUGF(4, "Point #%d", i);
-		RTDEBUGF(4, "added_last_point %d", added_last_point);
-		if ( i > 0 )
-		{
-			*q = *p;
-			ordinate_value_q = ordinate_value_p;
-		}
-		rt_getPoint4d_p(ctx, pa_in, i, p);
-		ordinate_value_p = rtpoint_get_ordinate(ctx, p, ordinate);
-		RTDEBUGF(4, " ordinate_value_p %g (current)", ordinate_value_p);
-		RTDEBUGF(4, " ordinate_value_q %g (previous)", ordinate_value_q);
-
-		/* Is this point inside the ordinate range? Yes. */
-		if ( ordinate_value_p >= from && ordinate_value_p <= to )
-		{
-			RTDEBUGF(4, " inside ordinate range (%g, %g)", from, to);
-
-			if ( ! added_last_point )
-			{
-				RTDEBUG(4,"  new ptarray required");
-				/* We didn't add the previous point, so this is a new segment.
-				*  Make a new point array. */
-				dp = ptarray_construct_empty(ctx, hasz, hasm, 32);
-
-				/* We're transiting into the range so add an interpolated
-				*  point at the range boundary.
-				*  If we're on a boundary and crossing from the far side,
-				*  we also need an interpolated point. */
-				if ( i > 0 && ( /* Don't try to interpolate if this is the first point */
-				            ( ordinate_value_p > from && ordinate_value_p < to ) || /* Inside */
-				            ( ordinate_value_p == from && ordinate_value_q > to ) || /* Hopping from above */
-				            ( ordinate_value_p == to && ordinate_value_q < from ) ) ) /* Hopping from below */
-				{
-					double interpolation_value;
-					(ordinate_value_q > to) ? (interpolation_value = to) : (interpolation_value = from);
-					point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
-					ptarray_append_point(ctx, dp, r, RT_FALSE);
-					RTDEBUGF(4, "[0] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
-				}
-			}
-			/* Add the current vertex to the point array. */
-			ptarray_append_point(ctx, dp, p, RT_FALSE);
-			if ( ordinate_value_p == from || ordinate_value_p == to )
-			{
-				added_last_point = 2; /* Added on boundary. */
-			}
-			else
-			{
-				added_last_point = 1; /* Added inside range. */
-			}
-		}
-		/* Is this point inside the ordinate range? No. */
-		else
-		{
-			RTDEBUGF(4, "  added_last_point (%d)", added_last_point);
-			if ( added_last_point == 1 )
-			{
-				/* We're transiting out of the range, so add an interpolated point
-				*  to the point array at the range boundary. */
-				double interpolation_value;
-				(ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
-				point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
-				ptarray_append_point(ctx, dp, r, RT_FALSE);
-				RTDEBUGF(4, " [1] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
-			}
-			else if ( added_last_point == 2 )
-			{
-				/* We're out and the last point was on the boundary.
-				*  If the last point was the near boundary, nothing to do.
-				*  If it was the far boundary, we need an interpolated point. */
-				if ( from != to && (
-				            (ordinate_value_q == from && ordinate_value_p > from) ||
-				            (ordinate_value_q == to && ordinate_value_p < to) ) )
-				{
-					double interpolation_value;
-					(ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
-					point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
-					ptarray_append_point(ctx, dp, r, RT_FALSE);
-					RTDEBUGF(4, " [2] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
-				}
-			}
-			else if ( i && ordinate_value_q < from && ordinate_value_p > to )
-			{
-				/* We just hopped over the whole range, from bottom to top,
-				*  so we need to add *two* interpolated points! */
-				dp = ptarray_construct(ctx, hasz, hasm, 2);
-				/* Interpolate lower point. */
-				point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, from);
-				ptarray_set_point4d(ctx, dp, 0, r);
-				/* Interpolate upper point. */
-				point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, to);
-				ptarray_set_point4d(ctx, dp, 1, r);
-			}
-			else if ( i && ordinate_value_q > to && ordinate_value_p < from )
-			{
-				/* We just hopped over the whole range, from top to bottom,
-				*  so we need to add *two* interpolated points! */
-				dp = ptarray_construct(ctx, hasz, hasm, 2);
-				/* Interpolate upper point. */
-				point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, to);
-				ptarray_set_point4d(ctx, dp, 0, r);
-				/* Interpolate lower point. */
-				point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, from);
-				ptarray_set_point4d(ctx, dp, 1, r);
-			}
-			/* We have an extant point-array, save it out to a multi-line. */
-			if ( dp )
-			{
-				RTDEBUG(4, "saving pointarray to multi-line (1)");
-
-				/* Only one point, so we have to make an rtpoint to hold this
-				*  and set the overall output type to a generic collection. */
-				if ( dp->npoints == 1 )
-				{
-					RTPOINT *opoint = rtpoint_construct(ctx, line->srid, NULL, dp);
-					rtgeom_out->type = RTCOLLECTIONTYPE;
-					rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, opoint));
-
-				}
-				else
-				{
-					RTLINE *oline = rtline_construct(ctx, line->srid, NULL, dp);
-					rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtline_as_rtgeom(ctx, oline));
-				}
-
-				/* Pointarray is now owned by rtgeom_out, so drop reference to it */
-				dp = NULL;
-			}
-			added_last_point = 0;
-
-		}
-	}
-
-	/* Still some points left to be saved out. */
-	if ( dp && dp->npoints > 0 )
-	{
-		RTDEBUG(4, "saving pointarray to multi-line (2)");
-		RTDEBUGF(4, "dp->npoints == %d", dp->npoints);
-		RTDEBUGF(4, "rtgeom_out->ngeoms == %d", rtgeom_out->ngeoms);
-
-		if ( dp->npoints == 1 )
-		{
-			RTPOINT *opoint = rtpoint_construct(ctx, line->srid, NULL, dp);
-			rtgeom_out->type = RTCOLLECTIONTYPE;
-			rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, opoint));
-		}
-		else
-		{
-			RTLINE *oline = rtline_construct(ctx, line->srid, NULL, dp);
-			rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtline_as_rtgeom(ctx, oline));
-		}
-
-		/* Pointarray is now owned by rtgeom_out, so drop reference to it */
-		dp = NULL;
-	}
-
-	rtfree(ctx, p);
-	rtfree(ctx, q);
-	rtfree(ctx, r);
-
-	if ( rtgeom_out->bbox && rtgeom_out->ngeoms > 0 )
-	{
-		rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
-		rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
-	}
-
-	return rtgeom_out;
+  RTPOINTARRAY *pa_in = NULL;
+  RTCOLLECTION *rtgeom_out = NULL;
+  RTPOINTARRAY *dp = NULL;
+  int i;
+  int added_last_point = 0;
+  RTPOINT4D *p = NULL, *q = NULL, *r = NULL;
+  double ordinate_value_p = 0.0, ordinate_value_q = 0.0;
+  char hasz = rtgeom_has_z(ctx, rtline_as_rtgeom(ctx, line));
+  char hasm = rtgeom_has_m(ctx, rtline_as_rtgeom(ctx, line));
+  char dims = RTFLAGS_NDIMS(line->flags);
+
+  /* Null input, nothing we can do. */
+  if ( ! line )
+  {
+    rterror(ctx, "Null input geometry.");
+    return NULL;
+  }
+
+  /* Ensure 'from' is less than 'to'. */
+  if ( to < from )
+  {
+    double t = from;
+    from = to;
+    to = t;
+  }
+
+  RTDEBUGF(4, "from = %g, to = %g, ordinate = %c", from, to, ordinate);
+  RTDEBUGF(4, "%s", rtgeom_to_ewkt(ctx, (RTGEOM*)line));
+
+  /* Asking for an ordinate we don't have. Error. */
+  if ( (ordinate == 'Z' && ! hasz) || (ordinate == 'M' && ! hasm) )
+  {
+    rterror(ctx, "Cannot clip on ordinate %d in a %d-d geometry.", ordinate, dims);
+    return NULL;
+  }
+
+  /* Prepare our working point objects. */
+  p = rtalloc(ctx, sizeof(RTPOINT4D));
+  q = rtalloc(ctx, sizeof(RTPOINT4D));
+  r = rtalloc(ctx, sizeof(RTPOINT4D));
+
+  /* Construct a collection to hold our outputs. */
+  rtgeom_out = rtcollection_construct_empty(ctx, RTMULTILINETYPE, line->srid, hasz, hasm);
+
+  /* Get our input point array */
+  pa_in = line->points;
+
+  for ( i = 0; i < pa_in->npoints; i++ )
+  {
+    RTDEBUGF(4, "Point #%d", i);
+    RTDEBUGF(4, "added_last_point %d", added_last_point);
+    if ( i > 0 )
+    {
+      *q = *p;
+      ordinate_value_q = ordinate_value_p;
+    }
+    rt_getPoint4d_p(ctx, pa_in, i, p);
+    ordinate_value_p = rtpoint_get_ordinate(ctx, p, ordinate);
+    RTDEBUGF(4, " ordinate_value_p %g (current)", ordinate_value_p);
+    RTDEBUGF(4, " ordinate_value_q %g (previous)", ordinate_value_q);
+
+    /* Is this point inside the ordinate range? Yes. */
+    if ( ordinate_value_p >= from && ordinate_value_p <= to )
+    {
+      RTDEBUGF(4, " inside ordinate range (%g, %g)", from, to);
+
+      if ( ! added_last_point )
+      {
+        RTDEBUG(4,"  new ptarray required");
+        /* We didn't add the previous point, so this is a new segment.
+        *  Make a new point array. */
+        dp = ptarray_construct_empty(ctx, hasz, hasm, 32);
+
+        /* We're transiting into the range so add an interpolated
+        *  point at the range boundary.
+        *  If we're on a boundary and crossing from the far side,
+        *  we also need an interpolated point. */
+        if ( i > 0 && ( /* Don't try to interpolate if this is the first point */
+                    ( ordinate_value_p > from && ordinate_value_p < to ) || /* Inside */
+                    ( ordinate_value_p == from && ordinate_value_q > to ) || /* Hopping from above */
+                    ( ordinate_value_p == to && ordinate_value_q < from ) ) ) /* Hopping from below */
+        {
+          double interpolation_value;
+          (ordinate_value_q > to) ? (interpolation_value = to) : (interpolation_value = from);
+          point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
+          ptarray_append_point(ctx, dp, r, RT_FALSE);
+          RTDEBUGF(4, "[0] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
+        }
+      }
+      /* Add the current vertex to the point array. */
+      ptarray_append_point(ctx, dp, p, RT_FALSE);
+      if ( ordinate_value_p == from || ordinate_value_p == to )
+      {
+        added_last_point = 2; /* Added on boundary. */
+      }
+      else
+      {
+        added_last_point = 1; /* Added inside range. */
+      }
+    }
+    /* Is this point inside the ordinate range? No. */
+    else
+    {
+      RTDEBUGF(4, "  added_last_point (%d)", added_last_point);
+      if ( added_last_point == 1 )
+      {
+        /* We're transiting out of the range, so add an interpolated point
+        *  to the point array at the range boundary. */
+        double interpolation_value;
+        (ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
+        point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
+        ptarray_append_point(ctx, dp, r, RT_FALSE);
+        RTDEBUGF(4, " [1] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
+      }
+      else if ( added_last_point == 2 )
+      {
+        /* We're out and the last point was on the boundary.
+        *  If the last point was the near boundary, nothing to do.
+        *  If it was the far boundary, we need an interpolated point. */
+        if ( from != to && (
+                    (ordinate_value_q == from && ordinate_value_p > from) ||
+                    (ordinate_value_q == to && ordinate_value_p < to) ) )
+        {
+          double interpolation_value;
+          (ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
+          point_interpolate(ctx, q, p, r, hasz, hasm, ordinate, interpolation_value);
+          ptarray_append_point(ctx, dp, r, RT_FALSE);
+          RTDEBUGF(4, " [2] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
+        }
+      }
+      else if ( i && ordinate_value_q < from && ordinate_value_p > to )
+      {
+        /* We just hopped over the whole range, from bottom to top,
+        *  so we need to add *two* interpolated points! */
+        dp = ptarray_construct(ctx, hasz, hasm, 2);
+        /* Interpolate lower point. */
+        point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, from);
+        ptarray_set_point4d(ctx, dp, 0, r);
+        /* Interpolate upper point. */
+        point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, to);
+        ptarray_set_point4d(ctx, dp, 1, r);
+      }
+      else if ( i && ordinate_value_q > to && ordinate_value_p < from )
+      {
+        /* We just hopped over the whole range, from top to bottom,
+        *  so we need to add *two* interpolated points! */
+        dp = ptarray_construct(ctx, hasz, hasm, 2);
+        /* Interpolate upper point. */
+        point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, to);
+        ptarray_set_point4d(ctx, dp, 0, r);
+        /* Interpolate lower point. */
+        point_interpolate(ctx, p, q, r, hasz, hasm, ordinate, from);
+        ptarray_set_point4d(ctx, dp, 1, r);
+      }
+      /* We have an extant point-array, save it out to a multi-line. */
+      if ( dp )
+      {
+        RTDEBUG(4, "saving pointarray to multi-line (1)");
+
+        /* Only one point, so we have to make an rtpoint to hold this
+        *  and set the overall output type to a generic collection. */
+        if ( dp->npoints == 1 )
+        {
+          RTPOINT *opoint = rtpoint_construct(ctx, line->srid, NULL, dp);
+          rtgeom_out->type = RTCOLLECTIONTYPE;
+          rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, opoint));
+
+        }
+        else
+        {
+          RTLINE *oline = rtline_construct(ctx, line->srid, NULL, dp);
+          rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtline_as_rtgeom(ctx, oline));
+        }
+
+        /* Pointarray is now owned by rtgeom_out, so drop reference to it */
+        dp = NULL;
+      }
+      added_last_point = 0;
+
+    }
+  }
+
+  /* Still some points left to be saved out. */
+  if ( dp && dp->npoints > 0 )
+  {
+    RTDEBUG(4, "saving pointarray to multi-line (2)");
+    RTDEBUGF(4, "dp->npoints == %d", dp->npoints);
+    RTDEBUGF(4, "rtgeom_out->ngeoms == %d", rtgeom_out->ngeoms);
+
+    if ( dp->npoints == 1 )
+    {
+      RTPOINT *opoint = rtpoint_construct(ctx, line->srid, NULL, dp);
+      rtgeom_out->type = RTCOLLECTIONTYPE;
+      rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtpoint_as_rtgeom(ctx, opoint));
+    }
+    else
+    {
+      RTLINE *oline = rtline_construct(ctx, line->srid, NULL, dp);
+      rtgeom_out = rtcollection_add_rtgeom(ctx, rtgeom_out, rtline_as_rtgeom(ctx, oline));
+    }
+
+    /* Pointarray is now owned by rtgeom_out, so drop reference to it */
+    dp = NULL;
+  }
+
+  rtfree(ctx, p);
+  rtfree(ctx, q);
+  rtfree(ctx, r);
+
+  if ( rtgeom_out->bbox && rtgeom_out->ngeoms > 0 )
+  {
+    rtgeom_drop_bbox(ctx, (RTGEOM*)rtgeom_out);
+    rtgeom_add_bbox(ctx, (RTGEOM*)rtgeom_out);
+  }
+
+  return rtgeom_out;
 
 }
 
 RTCOLLECTION*
 rtgeom_clip_to_ordinate_range(const RTCTX *ctx, const RTGEOM *rtin, char ordinate, double from, double to, double offset)
 {
-	RTCOLLECTION *out_col;
-	RTCOLLECTION *out_offset;
-	int i;
-
-	if ( ! rtin )
-		rterror(ctx, "rtgeom_clip_to_ordinate_range: null input geometry!");
-
-	switch ( rtin->type )
-	{
-	case RTLINETYPE:
-		out_col = rtline_clip_to_ordinate_range(ctx, (RTLINE*)rtin, ordinate, from, to);
-		break;
-	case RTMULTILINETYPE:
-		out_col = rtmline_clip_to_ordinate_range(ctx, (RTMLINE*)rtin, ordinate, from, to);
-		break;
-	case RTMULTIPOINTTYPE:
-		out_col = rtmpoint_clip_to_ordinate_range(ctx, (RTMPOINT*)rtin, ordinate, from, to);
-		break;
-	case RTPOINTTYPE:
-		out_col = rtpoint_clip_to_ordinate_range(ctx, (RTPOINT*)rtin, ordinate, from, to);
-		break;
-	default:
-		rterror(ctx, "This function does not accept %s geometries.", rttype_name(ctx, rtin->type));
-		return NULL;;
-	}
-
-	/* Stop if result is NULL */
-	if ( out_col == NULL )
-		rterror(ctx, "rtgeom_clip_to_ordinate_range clipping routine returned NULL");
-
-	/* Return if we aren't going to offset the result */
-	if ( FP_EQUALS(offset, 0.0) || rtgeom_is_empty(ctx, rtcollection_as_rtgeom(ctx, out_col)) )
-		return out_col;
-
-	/* Construct a collection to hold our outputs. */
-	/* Things get ugly: GEOS offset drops Z's and M's so we have to drop ours */
-	out_offset = rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtin->srid, 0, 0);
-
-	/* Try and offset the linear portions of the return value */
-	for ( i = 0; i < out_col->ngeoms; i++ )
-	{
-		int type = out_col->geoms[i]->type;
-		if ( type == RTPOINTTYPE )
-		{
-			rtnotice(ctx, "rtgeom_clip_to_ordinate_range cannot offset a clipped point");
-			continue;
-		}
-		else if ( type == RTLINETYPE )
-		{
-			/* rtgeom_offsetcurve(ctx, line, offset, quadsegs, joinstyle (round), mitrelimit) */
-			RTGEOM *rtoff = rtgeom_offsetcurve(ctx, rtgeom_as_rtline(ctx, out_col->geoms[i]), offset, 8, 1, 5.0);
-			if ( ! rtoff )
-			{
-				rterror(ctx, "rtgeom_offsetcurve returned null");
-			}
-			rtcollection_add_rtgeom(ctx, out_offset, rtoff);
-		}
-		else
-		{
-			rterror(ctx, "rtgeom_clip_to_ordinate_range found an unexpected type (%s) in the offset routine",rttype_name(ctx, type));
-		}
-	}
-
-	return out_offset;
+  RTCOLLECTION *out_col;
+  RTCOLLECTION *out_offset;
+  int i;
+
+  if ( ! rtin )
+    rterror(ctx, "rtgeom_clip_to_ordinate_range: null input geometry!");
+
+  switch ( rtin->type )
+  {
+  case RTLINETYPE:
+    out_col = rtline_clip_to_ordinate_range(ctx, (RTLINE*)rtin, ordinate, from, to);
+    break;
+  case RTMULTILINETYPE:
+    out_col = rtmline_clip_to_ordinate_range(ctx, (RTMLINE*)rtin, ordinate, from, to);
+    break;
+  case RTMULTIPOINTTYPE:
+    out_col = rtmpoint_clip_to_ordinate_range(ctx, (RTMPOINT*)rtin, ordinate, from, to);
+    break;
+  case RTPOINTTYPE:
+    out_col = rtpoint_clip_to_ordinate_range(ctx, (RTPOINT*)rtin, ordinate, from, to);
+    break;
+  default:
+    rterror(ctx, "This function does not accept %s geometries.", rttype_name(ctx, rtin->type));
+    return NULL;;
+  }
+
+  /* Stop if result is NULL */
+  if ( out_col == NULL )
+    rterror(ctx, "rtgeom_clip_to_ordinate_range clipping routine returned NULL");
+
+  /* Return if we aren't going to offset the result */
+  if ( FP_EQUALS(offset, 0.0) || rtgeom_is_empty(ctx, rtcollection_as_rtgeom(ctx, out_col)) )
+    return out_col;
+
+  /* Construct a collection to hold our outputs. */
+  /* Things get ugly: GEOS offset drops Z's and M's so we have to drop ours */
+  out_offset = rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtin->srid, 0, 0);
+
+  /* Try and offset the linear portions of the return value */
+  for ( i = 0; i < out_col->ngeoms; i++ )
+  {
+    int type = out_col->geoms[i]->type;
+    if ( type == RTPOINTTYPE )
+    {
+      rtnotice(ctx, "rtgeom_clip_to_ordinate_range cannot offset a clipped point");
+      continue;
+    }
+    else if ( type == RTLINETYPE )
+    {
+      /* rtgeom_offsetcurve(ctx, line, offset, quadsegs, joinstyle (round), mitrelimit) */
+      RTGEOM *rtoff = rtgeom_offsetcurve(ctx, rtgeom_as_rtline(ctx, out_col->geoms[i]), offset, 8, 1, 5.0);
+      if ( ! rtoff )
+      {
+        rterror(ctx, "rtgeom_offsetcurve returned null");
+      }
+      rtcollection_add_rtgeom(ctx, out_offset, rtoff);
+    }
+    else
+    {
+      rterror(ctx, "rtgeom_clip_to_ordinate_range found an unexpected type (%s) in the offset routine",rttype_name(ctx, type));
+    }
+  }
+
+  return out_offset;
 }
 
 RTCOLLECTION*
 rtgeom_locate_between(const RTCTX *ctx, const RTGEOM *rtin, double from, double to, double offset)
 {
-	if ( ! rtgeom_has_m(ctx, rtin) )
-		rterror(ctx, "Input geometry does not have a measure dimension");
+  if ( ! rtgeom_has_m(ctx, rtin) )
+    rterror(ctx, "Input geometry does not have a measure dimension");
 
-	return rtgeom_clip_to_ordinate_range(ctx, rtin, 'M', from, to, offset);
+  return rtgeom_clip_to_ordinate_range(ctx, rtin, 'M', from, to, offset);
 }
 
 double
 rtgeom_interpolate_point(const RTCTX *ctx, const RTGEOM *rtin, const RTPOINT *rtpt)
 {
-	RTPOINT4D p, p_proj;
-	double ret = 0.0;
-
-	if ( ! rtin )
-		rterror(ctx, "rtgeom_interpolate_point: null input geometry!");
-
-	if ( ! rtgeom_has_m(ctx, rtin) )
-		rterror(ctx, "Input geometry does not have a measure dimension");
-
-	if ( rtgeom_is_empty(ctx, rtin) || rtpoint_is_empty(ctx, rtpt) )
-		rterror(ctx, "Input geometry is empty");
-
-	switch ( rtin->type )
-	{
-	case RTLINETYPE:
-	{
-		RTLINE *rtline = rtgeom_as_rtline(ctx, rtin);
-		rtpoint_getPoint4d_p(ctx, rtpt, &p);
-		ret = ptarray_locate_point(ctx, rtline->points, &p, NULL, &p_proj);
-		ret = p_proj.m;
-		break;
-	}
-	default:
-		rterror(ctx, "This function does not accept %s geometries.", rttype_name(ctx, rtin->type));
-	}
-	return ret;
+  RTPOINT4D p, p_proj;
+  double ret = 0.0;
+
+  if ( ! rtin )
+    rterror(ctx, "rtgeom_interpolate_point: null input geometry!");
+
+  if ( ! rtgeom_has_m(ctx, rtin) )
+    rterror(ctx, "Input geometry does not have a measure dimension");
+
+  if ( rtgeom_is_empty(ctx, rtin) || rtpoint_is_empty(ctx, rtpt) )
+    rterror(ctx, "Input geometry is empty");
+
+  switch ( rtin->type )
+  {
+  case RTLINETYPE:
+  {
+    RTLINE *rtline = rtgeom_as_rtline(ctx, rtin);
+    rtpoint_getPoint4d_p(ctx, rtpt, &p);
+    ret = ptarray_locate_point(ctx, rtline->points, &p, NULL, &p_proj);
+    ret = p_proj.m;
+    break;
+  }
+  default:
+    rterror(ctx, "This function does not accept %s geometries.", rttype_name(ctx, rtin->type));
+  }
+  return ret;
 }
 
 /*
@@ -913,129 +913,129 @@ segments_tcpa(const RTCTX *ctx, RTPOINT4D* p0, const RTPOINT4D* p1,
               RTPOINT4D* q0, const RTPOINT4D* q1,
               double t0, double t1)
 {
-	RTPOINT3DZ pv; /* velocity of p, aka u */
-	RTPOINT3DZ qv; /* velocity of q, aka v */
-	RTPOINT3DZ dv; /* velocity difference */
-	RTPOINT3DZ w0; /* vector between first points */
-
-	/*
-	  rtnotice(ctx, "FROM %g,%g,%g,%g -- %g,%g,%g,%g",
-	    p0->x, p0->y, p0->z, p0->m,
-	    p1->x, p1->y, p1->z, p1->m);
-	  rtnotice(ctx, "  TO %g,%g,%g,%g -- %g,%g,%g,%g",
-	    q0->x, q0->y, q0->z, q0->m,
-	    q1->x, q1->y, q1->z, q1->m);
-	*/
-
-	/* PV aka U */
-	pv.x = ( p1->x - p0->x );
-	pv.y = ( p1->y - p0->y );
-	pv.z = ( p1->z - p0->z );
-	/*rtnotice(ctx, "PV:  %g, %g, %g", pv.x, pv.y, pv.z);*/
-
-	/* QV aka V */
-	qv.x = ( q1->x - q0->x );
-	qv.y = ( q1->y - q0->y );
-	qv.z = ( q1->z - q0->z );
-	/*rtnotice(ctx, "QV:  %g, %g, %g", qv.x, qv.y, qv.z);*/
-
-	dv.x = pv.x - qv.x;
-	dv.y = pv.y - qv.y;
-	dv.z = pv.z - qv.z;
-	/*rtnotice(ctx, "DV:  %g, %g, %g", dv.x, dv.y, dv.z);*/
-
-	double dv2 = DOT(dv,dv);
-	/*rtnotice(ctx, "DOT: %g", dv2);*/
-
-	if ( dv2 == 0.0 )
-	{
-		/* Distance is the same at any time, we pick the earliest */
-		return t0;
-	}
-
-	/* Distance at any given time, with t0 */
-	w0.x = ( p0->x - q0->x );
-	w0.y = ( p0->y - q0->y );
-	w0.z = ( p0->z - q0->z );
-
-	/*rtnotice(ctx, "W0:  %g, %g, %g", w0.x, w0.y, w0.z);*/
-
-	/* Check that at distance dt w0 is distance */
-
-	/* This is the fraction of measure difference */
-	double t = -DOT(w0,dv) / dv2;
-	/*rtnotice(ctx, "CLOSEST TIME (fraction): %g", t);*/
-
-	if ( t > 1.0 )
-	{
-		/* Getting closer as we move to the end */
-		/*rtnotice(ctx, "Converging");*/
-		t = 1;
-	}
-	else if ( t < 0.0 )
-	{
-		/*rtnotice(ctx, "Diverging");*/
-		t = 0;
-	}
-
-	/* Interpolate the actual points now */
-
-	p0->x += pv.x * t;
-	p0->y += pv.y * t;
-	p0->z += pv.z * t;
-
-	q0->x += qv.x * t;
-	q0->y += qv.y * t;
-	q0->z += qv.z * t;
-
-	t = t0 + (t1 - t0) * t;
-	/*rtnotice(ctx, "CLOSEST TIME (real): %g", t);*/
-
-	return t;
+  RTPOINT3DZ pv; /* velocity of p, aka u */
+  RTPOINT3DZ qv; /* velocity of q, aka v */
+  RTPOINT3DZ dv; /* velocity difference */
+  RTPOINT3DZ w0; /* vector between first points */
+
+  /*
+    rtnotice(ctx, "FROM %g,%g,%g,%g -- %g,%g,%g,%g",
+      p0->x, p0->y, p0->z, p0->m,
+      p1->x, p1->y, p1->z, p1->m);
+    rtnotice(ctx, "  TO %g,%g,%g,%g -- %g,%g,%g,%g",
+      q0->x, q0->y, q0->z, q0->m,
+      q1->x, q1->y, q1->z, q1->m);
+  */
+
+  /* PV aka U */
+  pv.x = ( p1->x - p0->x );
+  pv.y = ( p1->y - p0->y );
+  pv.z = ( p1->z - p0->z );
+  /*rtnotice(ctx, "PV:  %g, %g, %g", pv.x, pv.y, pv.z);*/
+
+  /* QV aka V */
+  qv.x = ( q1->x - q0->x );
+  qv.y = ( q1->y - q0->y );
+  qv.z = ( q1->z - q0->z );
+  /*rtnotice(ctx, "QV:  %g, %g, %g", qv.x, qv.y, qv.z);*/
+
+  dv.x = pv.x - qv.x;
+  dv.y = pv.y - qv.y;
+  dv.z = pv.z - qv.z;
+  /*rtnotice(ctx, "DV:  %g, %g, %g", dv.x, dv.y, dv.z);*/
+
+  double dv2 = DOT(dv,dv);
+  /*rtnotice(ctx, "DOT: %g", dv2);*/
+
+  if ( dv2 == 0.0 )
+  {
+    /* Distance is the same at any time, we pick the earliest */
+    return t0;
+  }
+
+  /* Distance at any given time, with t0 */
+  w0.x = ( p0->x - q0->x );
+  w0.y = ( p0->y - q0->y );
+  w0.z = ( p0->z - q0->z );
+
+  /*rtnotice(ctx, "W0:  %g, %g, %g", w0.x, w0.y, w0.z);*/
+
+  /* Check that at distance dt w0 is distance */
+
+  /* This is the fraction of measure difference */
+  double t = -DOT(w0,dv) / dv2;
+  /*rtnotice(ctx, "CLOSEST TIME (fraction): %g", t);*/
+
+  if ( t > 1.0 )
+  {
+    /* Getting closer as we move to the end */
+    /*rtnotice(ctx, "Converging");*/
+    t = 1;
+  }
+  else if ( t < 0.0 )
+  {
+    /*rtnotice(ctx, "Diverging");*/
+    t = 0;
+  }
+
+  /* Interpolate the actual points now */
+
+  p0->x += pv.x * t;
+  p0->y += pv.y * t;
+  p0->z += pv.z * t;
+
+  q0->x += qv.x * t;
+  q0->y += qv.y * t;
+  q0->z += qv.z * t;
+
+  t = t0 + (t1 - t0) * t;
+  /*rtnotice(ctx, "CLOSEST TIME (real): %g", t);*/
+
+  return t;
 }
 
 static int
 ptarray_collect_mvals(const RTCTX *ctx, const RTPOINTARRAY *pa, double tmin, double tmax, double *mvals)
 {
-	RTPOINT4D pbuf;
-	int i, n=0;
-	for (i=0; i<pa->npoints; ++i)
-	{
-		rt_getPoint4d_p(ctx, pa, i, &pbuf); /* could be optimized */
-		if ( pbuf.m >= tmin && pbuf.m <= tmax )
-			mvals[n++] = pbuf.m;
-	}
-	return n;
+  RTPOINT4D pbuf;
+  int i, n=0;
+  for (i=0; i<pa->npoints; ++i)
+  {
+    rt_getPoint4d_p(ctx, pa, i, &pbuf); /* could be optimized */
+    if ( pbuf.m >= tmin && pbuf.m <= tmax )
+      mvals[n++] = pbuf.m;
+  }
+  return n;
 }
 
 static int
 compare_double(const void *pa, const void *pb)
 {
-	double a = *((double *)pa);
-	double b = *((double *)pb);
-	if ( a < b )
-		return -1;
-	else if ( a > b )
-		return 1;
-	else
-		return 0;
+  double a = *((double *)pa);
+  double b = *((double *)pb);
+  if ( a < b )
+    return -1;
+  else if ( a > b )
+    return 1;
+  else
+    return 0;
 }
 
 /* Return number of elements in unique array */
 static int
 uniq(const RTCTX *ctx, double *vals, int nvals)
 {
-	int i, last=0;
-	for (i=1; i<nvals; ++i)
-	{
-		// rtnotice(ctx, "(I%d):%g", i, vals[i]);
-		if ( vals[i] != vals[last] )
-		{
-			vals[++last] = vals[i];
-			// rtnotice(ctx, "(O%d):%g", last, vals[last]);
-		}
-	}
-	return last+1;
+  int i, last=0;
+  for (i=1; i<nvals; ++i)
+  {
+    // rtnotice(ctx, "(I%d):%g", i, vals[i]);
+    if ( vals[i] != vals[last] )
+    {
+      vals[++last] = vals[i];
+      // rtnotice(ctx, "(O%d):%g", last, vals[last]);
+    }
+  }
+  return last+1;
 }
 
 /*
@@ -1055,347 +1055,347 @@ uniq(const RTCTX *ctx, double *vals, int nvals)
 static int
 ptarray_locate_along_linear(const RTCTX *ctx, const RTPOINTARRAY *pa, double m, RTPOINT4D *p, int from)
 {
-	int i = from;
-	RTPOINT4D p1, p2;
+  int i = from;
+  RTPOINT4D p1, p2;
 
-	/* Walk through each segment in the point array */
-	rt_getPoint4d_p(ctx, pa, i, &p1);
-	for ( i = from+1; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p2);
+  /* Walk through each segment in the point array */
+  rt_getPoint4d_p(ctx, pa, i, &p1);
+  for ( i = from+1; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p2);
 
-		if ( segment_locate_along(ctx, &p1, &p2, m, 0, p) == RT_TRUE )
-			return i-1; /* found */
+    if ( segment_locate_along(ctx, &p1, &p2, m, 0, p) == RT_TRUE )
+      return i-1; /* found */
 
-		p1 = p2;
-	}
+    p1 = p2;
+  }
 
-	return -1; /* not found */
+  return -1; /* not found */
 }
 
 double
 rtgeom_tcpa(const RTCTX *ctx, const RTGEOM *g1, const RTGEOM *g2, double *mindist)
 {
-	RTLINE *l1, *l2;
-	int i;
-	const RTGBOX *gbox1, *gbox2;
-	double tmin, tmax;
-	double *mvals;
-	int nmvals = 0;
-	double mintime;
-	double mindist2 = FLT_MAX; /* minimum distance, squared */
-
-	if ( ! rtgeom_has_m(ctx, g1) || ! rtgeom_has_m(ctx, g2) )
-	{
-		rterror(ctx, "Both input geometries must have a measure dimension");
-		return -1;
-	}
-
-	l1 = rtgeom_as_rtline(ctx, g1);
-	l2 = rtgeom_as_rtline(ctx, g2);
-
-	if ( ! l1 || ! l2 )
-	{
-		rterror(ctx, "Both input geometries must be linestrings");
-		return -1;
-	}
-
-	if ( l1->points->npoints < 2 || l2->points->npoints < 2 )
-	{
-		rterror(ctx, "Both input lines must have at least 2 points");
-		return -1;
-	}
-
-	/* WARNING: these ranges may be wider than real ones */
-	gbox1 = rtgeom_get_bbox(ctx, g1);
-	gbox2 = rtgeom_get_bbox(ctx, g2);
-
-	assert(gbox1); /* or the npoints check above would have failed */
-	assert(gbox2); /* or the npoints check above would have failed */
-
-	/*
-	 * Find overlapping M range
-	 * WARNING: may be larger than the real one
-	 */
-
-	tmin = FP_MAX(gbox1->mmin, gbox2->mmin);
-	tmax = FP_MIN(gbox1->mmax, gbox2->mmax);
-
-	if ( tmax < tmin )
-	{
-		RTDEBUG(1, "Inputs never exist at the same time");
-		return -2;
-	}
-
-	// rtnotice(ctx, "Min:%g, Max:%g", tmin, tmax);
-
-	/*
-	 * Collect M values in common time range from inputs
-	 */
-
-	mvals = rtalloc(ctx,  sizeof(double) *
-	                 ( l1->points->npoints + l2->points->npoints ) );
-
-	/* TODO: also clip the lines ? */
-	nmvals  = ptarray_collect_mvals(ctx, l1->points, tmin, tmax, mvals);
-	nmvals += ptarray_collect_mvals(ctx, l2->points, tmin, tmax, mvals + nmvals);
-
-	/* Sort values in ascending order */
-	qsort(mvals, nmvals, sizeof(double), compare_double);
-
-	/* Remove duplicated values */
-	nmvals = uniq(ctx, mvals, nmvals);
-
-	if ( nmvals < 2 )
-	{
-		{
-			/* there's a single time, must be that one... */
-			double t0 = mvals[0];
-			RTPOINT4D p0, p1;
-			RTDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
-			if ( mindist )
-			{
-				if ( -1 == ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0) )
-				{
-					rtfree(ctx, mvals);
-					rterror(ctx, "Could not find point with M=%g on first geom", t0);
-					return -1;
-				}
-				if ( -1 == ptarray_locate_along_linear(ctx, l2->points, t0, &p1, 0) )
-				{
-					rtfree(ctx, mvals);
-					rterror(ctx, "Could not find point with M=%g on second geom", t0);
-					return -1;
-				}
-				*mindist = distance3d_pt_pt(ctx, (POINT3D*)&p0, (POINT3D*)&p1);
-			}
-			rtfree(ctx, mvals);
-			return t0;
-		}
-	}
-
-	/*
-	 * For each consecutive pair of measures, compute time of closest point
-	 * approach and actual distance between points at that time
-	 */
-	mintime = tmin;
-	for (i=1; i<nmvals; ++i)
-	{
-		double t0 = mvals[i-1];
-		double t1 = mvals[i];
-		double t;
-		RTPOINT4D p0, p1, q0, q1;
-		int seg;
-		double dist2;
-
-		// rtnotice(ctx, "T %g-%g", t0, t1);
-
-		seg = ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t0, seg, p0.x, p0.y, p0.z);
-
-		seg = ptarray_locate_along_linear(ctx, l1->points, t1, &p1, seg);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t1, seg, p1.x, p1.y, p1.z);
-
-		seg = ptarray_locate_along_linear(ctx, l2->points, t0, &q0, 0);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t0, seg, q0.x, q0.y, q0.z);
-
-		seg = ptarray_locate_along_linear(ctx, l2->points, t1, &q1, seg);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t1, seg, q1.x, q1.y, q1.z);
-
-		t = segments_tcpa(ctx, &p0, &p1, &q0, &q1, t0, t1);
-
-		/*
-		rtnotice(ctx, "Closest points: %g,%g,%g and %g,%g,%g at time %g",
-		p0.x, p0.y, p0.z,
-		q0.x, q0.y, q0.z, t);
-		*/
-
-		dist2 = ( q0.x - p0.x ) * ( q0.x - p0.x ) +
-		        ( q0.y - p0.y ) * ( q0.y - p0.y ) +
-		        ( q0.z - p0.z ) * ( q0.z - p0.z );
-		if ( dist2 < mindist2 )
-		{
-			mindist2 = dist2;
-			mintime = t;
-			// rtnotice(ctx, "MINTIME: %g", mintime);
-		}
-	}
-
-	/*
-	 * Release memory
-	 */
-
-	rtfree(ctx, mvals);
-
-	if ( mindist )
-	{
-		*mindist = sqrt(mindist2);
-	}
-	/*rtnotice(ctx, "MINDIST: %g", sqrt(mindist2));*/
-
-	return mintime;
+  RTLINE *l1, *l2;
+  int i;
+  const RTGBOX *gbox1, *gbox2;
+  double tmin, tmax;
+  double *mvals;
+  int nmvals = 0;
+  double mintime;
+  double mindist2 = FLT_MAX; /* minimum distance, squared */
+
+  if ( ! rtgeom_has_m(ctx, g1) || ! rtgeom_has_m(ctx, g2) )
+  {
+    rterror(ctx, "Both input geometries must have a measure dimension");
+    return -1;
+  }
+
+  l1 = rtgeom_as_rtline(ctx, g1);
+  l2 = rtgeom_as_rtline(ctx, g2);
+
+  if ( ! l1 || ! l2 )
+  {
+    rterror(ctx, "Both input geometries must be linestrings");
+    return -1;
+  }
+
+  if ( l1->points->npoints < 2 || l2->points->npoints < 2 )
+  {
+    rterror(ctx, "Both input lines must have at least 2 points");
+    return -1;
+  }
+
+  /* WARNING: these ranges may be wider than real ones */
+  gbox1 = rtgeom_get_bbox(ctx, g1);
+  gbox2 = rtgeom_get_bbox(ctx, g2);
+
+  assert(gbox1); /* or the npoints check above would have failed */
+  assert(gbox2); /* or the npoints check above would have failed */
+
+  /*
+   * Find overlapping M range
+   * WARNING: may be larger than the real one
+   */
+
+  tmin = FP_MAX(gbox1->mmin, gbox2->mmin);
+  tmax = FP_MIN(gbox1->mmax, gbox2->mmax);
+
+  if ( tmax < tmin )
+  {
+    RTDEBUG(1, "Inputs never exist at the same time");
+    return -2;
+  }
+
+  // rtnotice(ctx, "Min:%g, Max:%g", tmin, tmax);
+
+  /*
+   * Collect M values in common time range from inputs
+   */
+
+  mvals = rtalloc(ctx,  sizeof(double) *
+                   ( l1->points->npoints + l2->points->npoints ) );
+
+  /* TODO: also clip the lines ? */
+  nmvals  = ptarray_collect_mvals(ctx, l1->points, tmin, tmax, mvals);
+  nmvals += ptarray_collect_mvals(ctx, l2->points, tmin, tmax, mvals + nmvals);
+
+  /* Sort values in ascending order */
+  qsort(mvals, nmvals, sizeof(double), compare_double);
+
+  /* Remove duplicated values */
+  nmvals = uniq(ctx, mvals, nmvals);
+
+  if ( nmvals < 2 )
+  {
+    {
+      /* there's a single time, must be that one... */
+      double t0 = mvals[0];
+      RTPOINT4D p0, p1;
+      RTDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
+      if ( mindist )
+      {
+        if ( -1 == ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0) )
+        {
+          rtfree(ctx, mvals);
+          rterror(ctx, "Could not find point with M=%g on first geom", t0);
+          return -1;
+        }
+        if ( -1 == ptarray_locate_along_linear(ctx, l2->points, t0, &p1, 0) )
+        {
+          rtfree(ctx, mvals);
+          rterror(ctx, "Could not find point with M=%g on second geom", t0);
+          return -1;
+        }
+        *mindist = distance3d_pt_pt(ctx, (POINT3D*)&p0, (POINT3D*)&p1);
+      }
+      rtfree(ctx, mvals);
+      return t0;
+    }
+  }
+
+  /*
+   * For each consecutive pair of measures, compute time of closest point
+   * approach and actual distance between points at that time
+   */
+  mintime = tmin;
+  for (i=1; i<nmvals; ++i)
+  {
+    double t0 = mvals[i-1];
+    double t1 = mvals[i];
+    double t;
+    RTPOINT4D p0, p1, q0, q1;
+    int seg;
+    double dist2;
+
+    // rtnotice(ctx, "T %g-%g", t0, t1);
+
+    seg = ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t0, seg, p0.x, p0.y, p0.z);
+
+    seg = ptarray_locate_along_linear(ctx, l1->points, t1, &p1, seg);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t1, seg, p1.x, p1.y, p1.z);
+
+    seg = ptarray_locate_along_linear(ctx, l2->points, t0, &q0, 0);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t0, seg, q0.x, q0.y, q0.z);
+
+    seg = ptarray_locate_along_linear(ctx, l2->points, t1, &q1, seg);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t1, seg, q1.x, q1.y, q1.z);
+
+    t = segments_tcpa(ctx, &p0, &p1, &q0, &q1, t0, t1);
+
+    /*
+    rtnotice(ctx, "Closest points: %g,%g,%g and %g,%g,%g at time %g",
+    p0.x, p0.y, p0.z,
+    q0.x, q0.y, q0.z, t);
+    */
+
+    dist2 = ( q0.x - p0.x ) * ( q0.x - p0.x ) +
+            ( q0.y - p0.y ) * ( q0.y - p0.y ) +
+            ( q0.z - p0.z ) * ( q0.z - p0.z );
+    if ( dist2 < mindist2 )
+    {
+      mindist2 = dist2;
+      mintime = t;
+      // rtnotice(ctx, "MINTIME: %g", mintime);
+    }
+  }
+
+  /*
+   * Release memory
+   */
+
+  rtfree(ctx, mvals);
+
+  if ( mindist )
+  {
+    *mindist = sqrt(mindist2);
+  }
+  /*rtnotice(ctx, "MINDIST: %g", sqrt(mindist2));*/
+
+  return mintime;
 }
 
 int
 rtgeom_cpa_within(const RTCTX *ctx, const RTGEOM *g1, const RTGEOM *g2, double maxdist)
 {
-	RTLINE *l1, *l2;
-	int i;
-	const RTGBOX *gbox1, *gbox2;
-	double tmin, tmax;
-	double *mvals;
-	int nmvals = 0;
-	double maxdist2 = maxdist * maxdist;
-	int within = RT_FALSE;
-
-	if ( ! rtgeom_has_m(ctx, g1) || ! rtgeom_has_m(ctx, g2) )
-	{
-		rterror(ctx, "Both input geometries must have a measure dimension");
-		return RT_FALSE;
-	}
-
-	l1 = rtgeom_as_rtline(ctx, g1);
-	l2 = rtgeom_as_rtline(ctx, g2);
-
-	if ( ! l1 || ! l2 )
-	{
-		rterror(ctx, "Both input geometries must be linestrings");
-		return RT_FALSE;
-	}
-
-	if ( l1->points->npoints < 2 || l2->points->npoints < 2 )
-	{
-		/* TODO: return distance between these two points */
-		rterror(ctx, "Both input lines must have at least 2 points");
-		return RT_FALSE;
-	}
-
-	/* WARNING: these ranges may be wider than real ones */
-	gbox1 = rtgeom_get_bbox(ctx, g1);
-	gbox2 = rtgeom_get_bbox(ctx, g2);
-
-	assert(gbox1); /* or the npoints check above would have failed */
-	assert(gbox2); /* or the npoints check above would have failed */
-
-	/*
-	 * Find overlapping M range
-	 * WARNING: may be larger than the real one
-	 */
-
-	tmin = FP_MAX(gbox1->mmin, gbox2->mmin);
-	tmax = FP_MIN(gbox1->mmax, gbox2->mmax);
-
-	if ( tmax < tmin )
-	{
-		RTDEBUG(1, "Inputs never exist at the same time");
-		return RT_FALSE;
-	}
-
-	// rtnotice(ctx, "Min:%g, Max:%g", tmin, tmax);
-
-	/*
-	 * Collect M values in common time range from inputs
-	 */
-
-	mvals = rtalloc(ctx,  sizeof(double) *
-	                 ( l1->points->npoints + l2->points->npoints ) );
-
-	/* TODO: also clip the lines ? */
-	nmvals  = ptarray_collect_mvals(ctx, l1->points, tmin, tmax, mvals);
-	nmvals += ptarray_collect_mvals(ctx, l2->points, tmin, tmax, mvals + nmvals);
-
-	/* Sort values in ascending order */
-	qsort(mvals, nmvals, sizeof(double), compare_double);
-
-	/* Remove duplicated values */
-	nmvals = uniq(ctx, mvals, nmvals);
-
-	if ( nmvals < 2 )
-	{
-		/* there's a single time, must be that one... */
-		double t0 = mvals[0];
-		RTPOINT4D p0, p1;
-		RTDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
-		if ( -1 == ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0) )
-		{
-			rtnotice(ctx, "Could not find point with M=%g on first geom", t0);
-			return RT_FALSE;
-		}
-		if ( -1 == ptarray_locate_along_linear(ctx, l2->points, t0, &p1, 0) )
-		{
-			rtnotice(ctx, "Could not find point with M=%g on second geom", t0);
-			return RT_FALSE;
-		}
-		if ( distance3d_pt_pt(ctx, (POINT3D*)&p0, (POINT3D*)&p1) <= maxdist )
-			within = RT_TRUE;
-		rtfree(ctx, mvals);
-		return within;
-	}
-
-	/*
-	 * For each consecutive pair of measures, compute time of closest point
-	 * approach and actual distance between points at that time
-	 */
-	for (i=1; i<nmvals; ++i)
-	{
-		double t0 = mvals[i-1];
-		double t1 = mvals[i];
+  RTLINE *l1, *l2;
+  int i;
+  const RTGBOX *gbox1, *gbox2;
+  double tmin, tmax;
+  double *mvals;
+  int nmvals = 0;
+  double maxdist2 = maxdist * maxdist;
+  int within = RT_FALSE;
+
+  if ( ! rtgeom_has_m(ctx, g1) || ! rtgeom_has_m(ctx, g2) )
+  {
+    rterror(ctx, "Both input geometries must have a measure dimension");
+    return RT_FALSE;
+  }
+
+  l1 = rtgeom_as_rtline(ctx, g1);
+  l2 = rtgeom_as_rtline(ctx, g2);
+
+  if ( ! l1 || ! l2 )
+  {
+    rterror(ctx, "Both input geometries must be linestrings");
+    return RT_FALSE;
+  }
+
+  if ( l1->points->npoints < 2 || l2->points->npoints < 2 )
+  {
+    /* TODO: return distance between these two points */
+    rterror(ctx, "Both input lines must have at least 2 points");
+    return RT_FALSE;
+  }
+
+  /* WARNING: these ranges may be wider than real ones */
+  gbox1 = rtgeom_get_bbox(ctx, g1);
+  gbox2 = rtgeom_get_bbox(ctx, g2);
+
+  assert(gbox1); /* or the npoints check above would have failed */
+  assert(gbox2); /* or the npoints check above would have failed */
+
+  /*
+   * Find overlapping M range
+   * WARNING: may be larger than the real one
+   */
+
+  tmin = FP_MAX(gbox1->mmin, gbox2->mmin);
+  tmax = FP_MIN(gbox1->mmax, gbox2->mmax);
+
+  if ( tmax < tmin )
+  {
+    RTDEBUG(1, "Inputs never exist at the same time");
+    return RT_FALSE;
+  }
+
+  // rtnotice(ctx, "Min:%g, Max:%g", tmin, tmax);
+
+  /*
+   * Collect M values in common time range from inputs
+   */
+
+  mvals = rtalloc(ctx,  sizeof(double) *
+                   ( l1->points->npoints + l2->points->npoints ) );
+
+  /* TODO: also clip the lines ? */
+  nmvals  = ptarray_collect_mvals(ctx, l1->points, tmin, tmax, mvals);
+  nmvals += ptarray_collect_mvals(ctx, l2->points, tmin, tmax, mvals + nmvals);
+
+  /* Sort values in ascending order */
+  qsort(mvals, nmvals, sizeof(double), compare_double);
+
+  /* Remove duplicated values */
+  nmvals = uniq(ctx, mvals, nmvals);
+
+  if ( nmvals < 2 )
+  {
+    /* there's a single time, must be that one... */
+    double t0 = mvals[0];
+    RTPOINT4D p0, p1;
+    RTDEBUGF(1, "Inputs only exist both at a single time (%g)", t0);
+    if ( -1 == ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0) )
+    {
+      rtnotice(ctx, "Could not find point with M=%g on first geom", t0);
+      return RT_FALSE;
+    }
+    if ( -1 == ptarray_locate_along_linear(ctx, l2->points, t0, &p1, 0) )
+    {
+      rtnotice(ctx, "Could not find point with M=%g on second geom", t0);
+      return RT_FALSE;
+    }
+    if ( distance3d_pt_pt(ctx, (POINT3D*)&p0, (POINT3D*)&p1) <= maxdist )
+      within = RT_TRUE;
+    rtfree(ctx, mvals);
+    return within;
+  }
+
+  /*
+   * For each consecutive pair of measures, compute time of closest point
+   * approach and actual distance between points at that time
+   */
+  for (i=1; i<nmvals; ++i)
+  {
+    double t0 = mvals[i-1];
+    double t1 = mvals[i];
 #if RTGEOM_DEBUG_LEVEL >= 1
-		double t;
+    double t;
 #endif
-		RTPOINT4D p0, p1, q0, q1;
-		int seg;
-		double dist2;
+    RTPOINT4D p0, p1, q0, q1;
+    int seg;
+    double dist2;
 
-		// rtnotice(ctx, "T %g-%g", t0, t1);
+    // rtnotice(ctx, "T %g-%g", t0, t1);
 
-		seg = ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t0, seg, p0.x, p0.y, p0.z);
+    seg = ptarray_locate_along_linear(ctx, l1->points, t0, &p0, 0);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t0, seg, p0.x, p0.y, p0.z);
 
-		seg = ptarray_locate_along_linear(ctx, l1->points, t1, &p1, seg);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t1, seg, p1.x, p1.y, p1.z);
+    seg = ptarray_locate_along_linear(ctx, l1->points, t1, &p1, seg);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 1: %g, %g, %g", t1, seg, p1.x, p1.y, p1.z);
 
-		seg = ptarray_locate_along_linear(ctx, l2->points, t0, &q0, 0);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t0, seg, q0.x, q0.y, q0.z);
+    seg = ptarray_locate_along_linear(ctx, l2->points, t0, &q0, 0);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t0, seg, q0.x, q0.y, q0.z);
 
-		seg = ptarray_locate_along_linear(ctx, l2->points, t1, &q1, seg);
-		if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
-		// rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t1, seg, q1.x, q1.y, q1.z);
+    seg = ptarray_locate_along_linear(ctx, l2->points, t1, &q1, seg);
+    if ( -1 == seg ) continue; /* possible, if RTGBOX is approximated */
+    // rtnotice(ctx, "Measure %g on segment %d of line 2: %g, %g, %g", t1, seg, q1.x, q1.y, q1.z);
 
 #if RTGEOM_DEBUG_LEVEL >= 1
-		t =
+    t =
 #endif
-		segments_tcpa(ctx, &p0, &p1, &q0, &q1, t0, t1);
-
-		/*
-		rtnotice(ctx, "Closest points: %g,%g,%g and %g,%g,%g at time %g",
-		p0.x, p0.y, p0.z,
-		q0.x, q0.y, q0.z, t);
-		*/
-
-		dist2 = ( q0.x - p0.x ) * ( q0.x - p0.x ) +
-		        ( q0.y - p0.y ) * ( q0.y - p0.y ) +
-		        ( q0.z - p0.z ) * ( q0.z - p0.z );
-		if ( dist2 <= maxdist2 )
-		{
-			RTDEBUGF(1, "Within distance %g at time %g, breaking", sqrt(dist2), t);
-			within = RT_TRUE;
-			break;
-		}
-	}
-
-	/*
-	 * Release memory
-	 */
-
-	rtfree(ctx, mvals);
-
-	return within;
+    segments_tcpa(ctx, &p0, &p1, &q0, &q1, t0, t1);
+
+    /*
+    rtnotice(ctx, "Closest points: %g,%g,%g and %g,%g,%g at time %g",
+    p0.x, p0.y, p0.z,
+    q0.x, q0.y, q0.z, t);
+    */
+
+    dist2 = ( q0.x - p0.x ) * ( q0.x - p0.x ) +
+            ( q0.y - p0.y ) * ( q0.y - p0.y ) +
+            ( q0.z - p0.z ) * ( q0.z - p0.z );
+    if ( dist2 <= maxdist2 )
+    {
+      RTDEBUGF(1, "Within distance %g at time %g, breaking", sqrt(dist2), t);
+      within = RT_TRUE;
+      break;
+    }
+  }
+
+  /*
+   * Release memory
+   */
+
+  rtfree(ctx, mvals);
+
+  return within;
 }
diff --git a/src/rtmline.c b/src/rtmline.c
index 198ec9c..328fbb4 100644
--- a/src/rtmline.c
+++ b/src/rtmline.c
@@ -32,21 +32,21 @@
 void
 rtmline_release(const RTCTX *ctx, RTMLINE *rtmline)
 {
-	rtgeom_release(ctx, rtmline_as_rtgeom(ctx, rtmline));
+  rtgeom_release(ctx, rtmline_as_rtgeom(ctx, rtmline));
 }
 
 RTMLINE *
 rtmline_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTMLINE *ret = (RTMLINE*)rtcollection_construct_empty(ctx, RTMULTILINETYPE, srid, hasz, hasm);
-	return ret;
+  RTMLINE *ret = (RTMLINE*)rtcollection_construct_empty(ctx, RTMULTILINETYPE, srid, hasz, hasm);
+  return ret;
 }
 
 
 
 RTMLINE* rtmline_add_rtline(const RTCTX *ctx, RTMLINE *mobj, const RTLINE *obj)
 {
-	return (RTMLINE*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
+  return (RTMLINE*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
 }
 
 /**
@@ -56,74 +56,74 @@ RTMLINE* rtmline_add_rtline(const RTCTX *ctx, RTMLINE *mobj, const RTLINE *obj)
 RTMLINE*
 rtmline_measured_from_rtmline(const RTCTX *ctx, const RTMLINE *rtmline, double m_start, double m_end)
 {
-	int i = 0;
-	int hasm = 0, hasz = 0;
-	double length = 0.0, length_so_far = 0.0;
-	double m_range = m_end - m_start;
-	RTGEOM **geoms = NULL;
-
-	if ( rtmline->type != RTMULTILINETYPE )
-	{
-		rterror(ctx, "rtmline_measured_from_lmwline: only multiline types supported");
-		return NULL;
-	}
-
-	hasz = RTFLAGS_GET_Z(rtmline->flags);
-	hasm = 1;
-
-	/* Calculate the total length of the mline */
-	for ( i = 0; i < rtmline->ngeoms; i++ )
-	{
-		RTLINE *rtline = (RTLINE*)rtmline->geoms[i];
-		if ( rtline->points && rtline->points->npoints > 1 )
-		{
-			length += ptarray_length_2d(ctx, rtline->points);
-		}
-	}
-
-	if ( rtgeom_is_empty(ctx, (RTGEOM*)rtmline) )
-	{
-		return (RTMLINE*)rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtmline->srid, hasz, hasm);
-	}
-
-	geoms = rtalloc(ctx, sizeof(RTGEOM*) * rtmline->ngeoms);
-
-	for ( i = 0; i < rtmline->ngeoms; i++ )
-	{
-		double sub_m_start, sub_m_end;
-		double sub_length = 0.0;
-		RTLINE *rtline = (RTLINE*)rtmline->geoms[i];
-
-		if ( rtline->points && rtline->points->npoints > 1 )
-		{
-			sub_length = ptarray_length_2d(ctx, rtline->points);
-		}
-
-		sub_m_start = (m_start + m_range * length_so_far / length);
-		sub_m_end = (m_start + m_range * (length_so_far + sub_length) / length);
-
-		geoms[i] = (RTGEOM*)rtline_measured_from_rtline(ctx, rtline, sub_m_start, sub_m_end);
-
-		length_so_far += sub_length;
-	}
-
-	return (RTMLINE*)rtcollection_construct(ctx, rtmline->type, rtmline->srid, NULL, rtmline->ngeoms, geoms);
+  int i = 0;
+  int hasm = 0, hasz = 0;
+  double length = 0.0, length_so_far = 0.0;
+  double m_range = m_end - m_start;
+  RTGEOM **geoms = NULL;
+
+  if ( rtmline->type != RTMULTILINETYPE )
+  {
+    rterror(ctx, "rtmline_measured_from_lmwline: only multiline types supported");
+    return NULL;
+  }
+
+  hasz = RTFLAGS_GET_Z(rtmline->flags);
+  hasm = 1;
+
+  /* Calculate the total length of the mline */
+  for ( i = 0; i < rtmline->ngeoms; i++ )
+  {
+    RTLINE *rtline = (RTLINE*)rtmline->geoms[i];
+    if ( rtline->points && rtline->points->npoints > 1 )
+    {
+      length += ptarray_length_2d(ctx, rtline->points);
+    }
+  }
+
+  if ( rtgeom_is_empty(ctx, (RTGEOM*)rtmline) )
+  {
+    return (RTMLINE*)rtcollection_construct_empty(ctx, RTMULTILINETYPE, rtmline->srid, hasz, hasm);
+  }
+
+  geoms = rtalloc(ctx, sizeof(RTGEOM*) * rtmline->ngeoms);
+
+  for ( i = 0; i < rtmline->ngeoms; i++ )
+  {
+    double sub_m_start, sub_m_end;
+    double sub_length = 0.0;
+    RTLINE *rtline = (RTLINE*)rtmline->geoms[i];
+
+    if ( rtline->points && rtline->points->npoints > 1 )
+    {
+      sub_length = ptarray_length_2d(ctx, rtline->points);
+    }
+
+    sub_m_start = (m_start + m_range * length_so_far / length);
+    sub_m_end = (m_start + m_range * (length_so_far + sub_length) / length);
+
+    geoms[i] = (RTGEOM*)rtline_measured_from_rtline(ctx, rtline, sub_m_start, sub_m_end);
+
+    length_so_far += sub_length;
+  }
+
+  return (RTMLINE*)rtcollection_construct(ctx, rtmline->type, rtmline->srid, NULL, rtmline->ngeoms, geoms);
 }
 
 void rtmline_free(const RTCTX *ctx, RTMLINE *mline)
 {
-	int i;
-	if ( ! mline ) return;
-	
-	if ( mline->bbox )
-		rtfree(ctx, mline->bbox);
+  int i;
+  if ( ! mline ) return;
 
-	for ( i = 0; i < mline->ngeoms; i++ )
-		if ( mline->geoms && mline->geoms[i] )
-			rtline_free(ctx, mline->geoms[i]);
+  if ( mline->bbox )
+    rtfree(ctx, mline->bbox);
 
-	if ( mline->geoms )
-		rtfree(ctx, mline->geoms);
+  for ( i = 0; i < mline->ngeoms; i++ )
+    if ( mline->geoms && mline->geoms[i] )
+      rtline_free(ctx, mline->geoms[i]);
 
-	rtfree(ctx, mline);
+  if ( mline->geoms )
+    rtfree(ctx, mline->geoms);
+
+  rtfree(ctx, mline);
 }
diff --git a/src/rtmpoint.c b/src/rtmpoint.c
index 3dbf7d2..cb6997f 100644
--- a/src/rtmpoint.c
+++ b/src/rtmpoint.c
@@ -33,91 +33,91 @@
 void
 rtmpoint_release(const RTCTX *ctx, RTMPOINT *rtmpoint)
 {
-	rtgeom_release(ctx, rtmpoint_as_rtgeom(ctx, rtmpoint));
+  rtgeom_release(ctx, rtmpoint_as_rtgeom(ctx, rtmpoint));
 }
 
 RTMPOINT *
 rtmpoint_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTMPOINT *ret = (RTMPOINT*)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, srid, hasz, hasm);
-	return ret;
+  RTMPOINT *ret = (RTMPOINT*)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, srid, hasz, hasm);
+  return ret;
 }
 
 RTMPOINT* rtmpoint_add_rtpoint(const RTCTX *ctx, RTMPOINT *mobj, const RTPOINT *obj)
 {
-	RTDEBUG(4, "Called");
-	return (RTMPOINT*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
+  RTDEBUG(4, "Called");
+  return (RTMPOINT*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
 }
 
 RTMPOINT *
 rtmpoint_construct(const RTCTX *ctx, int srid, const RTPOINTARRAY *pa)
 {
-	int i;
-	int hasz = ptarray_has_z(ctx, pa);
-	int hasm = ptarray_has_m(ctx, pa);
-	RTMPOINT *ret = (RTMPOINT*)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, srid, hasz, hasm);
-	
-	for ( i = 0; i < pa->npoints; i++ )
-	{
-		RTPOINT *rtp;
-		RTPOINT4D p;
-		rt_getPoint4d_p(ctx, pa, i, &p);		
-		rtp = rtpoint_make(ctx, srid, hasz, hasm, &p);
-		rtmpoint_add_rtpoint(ctx, ret, rtp);
-	}
-	
-	return ret;
+  int i;
+  int hasz = ptarray_has_z(ctx, pa);
+  int hasm = ptarray_has_m(ctx, pa);
+  RTMPOINT *ret = (RTMPOINT*)rtcollection_construct_empty(ctx, RTMULTIPOINTTYPE, srid, hasz, hasm);
+
+  for ( i = 0; i < pa->npoints; i++ )
+  {
+    RTPOINT *rtp;
+    RTPOINT4D p;
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    rtp = rtpoint_make(ctx, srid, hasz, hasm, &p);
+    rtmpoint_add_rtpoint(ctx, ret, rtp);
+  }
+
+  return ret;
 }
 
 
 void rtmpoint_free(const RTCTX *ctx, RTMPOINT *mpt)
 {
-	int i;
+  int i;
 
-	if ( ! mpt ) return;
-	
-	if ( mpt->bbox )
-		rtfree(ctx, mpt->bbox);
+  if ( ! mpt ) return;
 
-	for ( i = 0; i < mpt->ngeoms; i++ )
-		if ( mpt->geoms && mpt->geoms[i] )
-			rtpoint_free(ctx, mpt->geoms[i]);
+  if ( mpt->bbox )
+    rtfree(ctx, mpt->bbox);
 
-	if ( mpt->geoms )
-		rtfree(ctx, mpt->geoms);
+  for ( i = 0; i < mpt->ngeoms; i++ )
+    if ( mpt->geoms && mpt->geoms[i] )
+      rtpoint_free(ctx, mpt->geoms[i]);
 
-	rtfree(ctx, mpt);
+  if ( mpt->geoms )
+    rtfree(ctx, mpt->geoms);
+
+  rtfree(ctx, mpt);
 }
 
 RTGEOM*
 rtmpoint_remove_repeated_points(const RTCTX *ctx, const RTMPOINT *mpoint, double tolerance)
 {
-	uint32_t nnewgeoms;
-	uint32_t i, j;
-	RTGEOM **newgeoms;
-
-	newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*mpoint->ngeoms);
-	nnewgeoms = 0;
-	for (i=0; i<mpoint->ngeoms; ++i)
-	{
-		/* Brute force, may be optimized by building an index */
-		int seen=0;
-		for (j=0; j<nnewgeoms; ++j)
-		{
-			if ( rtpoint_same(ctx, (RTPOINT*)newgeoms[j],
-			                  (RTPOINT*)mpoint->geoms[i]) )
-			{
-				seen=1;
-				break;
-			}
-		}
-		if ( seen ) continue;
-		newgeoms[nnewgeoms++] = (RTGEOM*)rtpoint_clone(ctx, mpoint->geoms[i]);
-	}
-
-	return (RTGEOM*)rtcollection_construct(ctx, mpoint->type,
-	                                       mpoint->srid, mpoint->bbox ? gbox_copy(ctx, mpoint->bbox) : NULL,
-	                                       nnewgeoms, newgeoms);
+  uint32_t nnewgeoms;
+  uint32_t i, j;
+  RTGEOM **newgeoms;
+
+  newgeoms = rtalloc(ctx, sizeof(RTGEOM *)*mpoint->ngeoms);
+  nnewgeoms = 0;
+  for (i=0; i<mpoint->ngeoms; ++i)
+  {
+    /* Brute force, may be optimized by building an index */
+    int seen=0;
+    for (j=0; j<nnewgeoms; ++j)
+    {
+      if ( rtpoint_same(ctx, (RTPOINT*)newgeoms[j],
+                        (RTPOINT*)mpoint->geoms[i]) )
+      {
+        seen=1;
+        break;
+      }
+    }
+    if ( seen ) continue;
+    newgeoms[nnewgeoms++] = (RTGEOM*)rtpoint_clone(ctx, mpoint->geoms[i]);
+  }
+
+  return (RTGEOM*)rtcollection_construct(ctx, mpoint->type,
+                                         mpoint->srid, mpoint->bbox ? gbox_copy(ctx, mpoint->bbox) : NULL,
+                                         nnewgeoms, newgeoms);
 
 }
 
diff --git a/src/rtmpoly.c b/src/rtmpoly.c
index d679698..2cf95bb 100644
--- a/src/rtmpoly.c
+++ b/src/rtmpoly.c
@@ -34,37 +34,37 @@
 void
 rtmpoly_release(const RTCTX *ctx, RTMPOLY *rtmpoly)
 {
-	rtgeom_release(ctx, rtmpoly_as_rtgeom(ctx, rtmpoly));
+  rtgeom_release(ctx, rtmpoly_as_rtgeom(ctx, rtmpoly));
 }
 
 RTMPOLY *
 rtmpoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTMPOLY *ret = (RTMPOLY*)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, srid, hasz, hasm);
-	return ret;
+  RTMPOLY *ret = (RTMPOLY*)rtcollection_construct_empty(ctx, RTMULTIPOLYGONTYPE, srid, hasz, hasm);
+  return ret;
 }
 
 
 RTMPOLY* rtmpoly_add_rtpoly(const RTCTX *ctx, RTMPOLY *mobj, const RTPOLY *obj)
 {
-	return (RTMPOLY*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
+  return (RTMPOLY*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
 }
 
 
 void rtmpoly_free(const RTCTX *ctx, RTMPOLY *mpoly)
 {
-	int i;
-	if ( ! mpoly ) return;
-	if ( mpoly->bbox )
-		rtfree(ctx, mpoly->bbox);
+  int i;
+  if ( ! mpoly ) return;
+  if ( mpoly->bbox )
+    rtfree(ctx, mpoly->bbox);
 
-	for ( i = 0; i < mpoly->ngeoms; i++ )
-		if ( mpoly->geoms && mpoly->geoms[i] )
-			rtpoly_free(ctx, mpoly->geoms[i]);
+  for ( i = 0; i < mpoly->ngeoms; i++ )
+    if ( mpoly->geoms && mpoly->geoms[i] )
+      rtpoly_free(ctx, mpoly->geoms[i]);
 
-	if ( mpoly->geoms )
-		rtfree(ctx, mpoly->geoms);
+  if ( mpoly->geoms )
+    rtfree(ctx, mpoly->geoms);
 
-	rtfree(ctx, mpoly);
+  rtfree(ctx, mpoly);
 }
 
diff --git a/src/rtout_encoded_polyline.c b/src/rtout_encoded_polyline.c
index a472b1e..68883dd 100644
--- a/src/rtout_encoded_polyline.c
+++ b/src/rtout_encoded_polyline.c
@@ -35,96 +35,96 @@ static char * pointarray_to_encoded_polyline(const RTCTX *ctx, const RTPOINTARRA
 extern char *
 rtgeom_to_encoded_polyline(const RTCTX *ctx, const RTGEOM *geom, int precision)
 {
-	int type = geom->type;
-	switch (type)
-	{
-	case RTLINETYPE:
-		return rtline_to_encoded_polyline(ctx, (RTLINE*)geom, precision);
-	case RTMULTIPOINTTYPE:
-		return rtmmpoint_to_encoded_polyline(ctx, (RTMPOINT*)geom, precision);
-	default:
-		rterror(ctx, "rtgeom_to_encoded_polyline: '%s' geometry type not supported", rttype_name(ctx, type));
-		return NULL;
-	}
+  int type = geom->type;
+  switch (type)
+  {
+  case RTLINETYPE:
+    return rtline_to_encoded_polyline(ctx, (RTLINE*)geom, precision);
+  case RTMULTIPOINTTYPE:
+    return rtmmpoint_to_encoded_polyline(ctx, (RTMPOINT*)geom, precision);
+  default:
+    rterror(ctx, "rtgeom_to_encoded_polyline: '%s' geometry type not supported", rttype_name(ctx, type));
+    return NULL;
+  }
 }
 
 static
 char * rtline_to_encoded_polyline(const RTCTX *ctx, const RTLINE *line, int precision)
 {
-	return pointarray_to_encoded_polyline(ctx, line->points, precision);
+  return pointarray_to_encoded_polyline(ctx, line->points, precision);
 }
 
 static
 char * rtmmpoint_to_encoded_polyline(const RTCTX *ctx, const RTMPOINT *mpoint, int precision)
 {
-	RTLINE *line = rtline_from_rtmpoint(ctx, mpoint->srid, mpoint);
-	char *encoded_polyline = rtline_to_encoded_polyline(ctx, line, precision);
+  RTLINE *line = rtline_from_rtmpoint(ctx, mpoint->srid, mpoint);
+  char *encoded_polyline = rtline_to_encoded_polyline(ctx, line, precision);
 
-	rtline_free(ctx, line);
-	return encoded_polyline;
+  rtline_free(ctx, line);
+  return encoded_polyline;
 }
 
 static
 char * pointarray_to_encoded_polyline(const RTCTX *ctx, const RTPOINTARRAY *pa, int precision)
 {
-	int i;
-	const RTPOINT2D *prevPoint;
-	int *delta = rtalloc(ctx, 2*sizeof(int)*pa->npoints);
-	char *encoded_polyline = NULL;
-	stringbuffer_t *sb;
-	double scale = pow(10,precision);
-
-	/* Take the double value and multiply it by 1x10^percision, rounding the result */
-	prevPoint = rt_getPoint2d_cp(ctx, pa, 0);
-	delta[0] = round(prevPoint->y*scale);
-	delta[1] = round(prevPoint->x*scale);
-
-	/*  points only include the offset from the previous point */
-	for (i=1; i<pa->npoints; i++)
-	{
-		const RTPOINT2D *point = rt_getPoint2d_cp(ctx, pa, i);
-		delta[2*i] = round(point->y*scale) - round(prevPoint->y*scale);
-		delta[(2*i)+1] = round(point->x*scale) - round(prevPoint->x*scale);
-		prevPoint = point;
-	}
-
-	/* value to binary: a negative value must be calculated using its two's complement */
-	for (i=0; i<pa->npoints*2; i++)
-	{
-		/* Left-shift the binary value one bit */
-		delta[i] <<= 1;
-		/* if value is negative, invert this encoding */
-		if (delta[i] < 0) {
-			delta[i] = ~(delta[i]);
-		}
-	}
-
-	sb = stringbuffer_create(ctx);
-	for (i=0; i<pa->npoints*2; i++)
-	{
-		int numberToEncode = delta[i];
-
-		while (numberToEncode >= 0x20) {
-			/* Place the 5-bit chunks into reverse order or
-			 each value with 0x20 if another bit chunk follows and add 63*/
-			int nextValue = (0x20 | (numberToEncode & 0x1f)) + 63;
-			stringbuffer_aprintf(ctx, sb, "%c", (char)nextValue);
-			if(92 == nextValue)
-				stringbuffer_aprintf(ctx, sb, "%c", (char)nextValue);
-
-			/* Break the binary value out into 5-bit chunks */
-			numberToEncode >>= 5;
-		}
-
-		numberToEncode += 63;
-		stringbuffer_aprintf(ctx, sb, "%c", (char)numberToEncode);
-		if(92 == numberToEncode)
-			stringbuffer_aprintf(ctx, sb, "%c", (char)numberToEncode);
-	}
-
-	rtfree(ctx, delta);
-	encoded_polyline = stringbuffer_getstringcopy(ctx, sb);
-	stringbuffer_destroy(ctx, sb);
-
-	return encoded_polyline;
+  int i;
+  const RTPOINT2D *prevPoint;
+  int *delta = rtalloc(ctx, 2*sizeof(int)*pa->npoints);
+  char *encoded_polyline = NULL;
+  stringbuffer_t *sb;
+  double scale = pow(10,precision);
+
+  /* Take the double value and multiply it by 1x10^percision, rounding the result */
+  prevPoint = rt_getPoint2d_cp(ctx, pa, 0);
+  delta[0] = round(prevPoint->y*scale);
+  delta[1] = round(prevPoint->x*scale);
+
+  /*  points only include the offset from the previous point */
+  for (i=1; i<pa->npoints; i++)
+  {
+    const RTPOINT2D *point = rt_getPoint2d_cp(ctx, pa, i);
+    delta[2*i] = round(point->y*scale) - round(prevPoint->y*scale);
+    delta[(2*i)+1] = round(point->x*scale) - round(prevPoint->x*scale);
+    prevPoint = point;
+  }
+
+  /* value to binary: a negative value must be calculated using its two's complement */
+  for (i=0; i<pa->npoints*2; i++)
+  {
+    /* Left-shift the binary value one bit */
+    delta[i] <<= 1;
+    /* if value is negative, invert this encoding */
+    if (delta[i] < 0) {
+      delta[i] = ~(delta[i]);
+    }
+  }
+
+  sb = stringbuffer_create(ctx);
+  for (i=0; i<pa->npoints*2; i++)
+  {
+    int numberToEncode = delta[i];
+
+    while (numberToEncode >= 0x20) {
+      /* Place the 5-bit chunks into reverse order or
+       each value with 0x20 if another bit chunk follows and add 63*/
+      int nextValue = (0x20 | (numberToEncode & 0x1f)) + 63;
+      stringbuffer_aprintf(ctx, sb, "%c", (char)nextValue);
+      if(92 == nextValue)
+        stringbuffer_aprintf(ctx, sb, "%c", (char)nextValue);
+
+      /* Break the binary value out into 5-bit chunks */
+      numberToEncode >>= 5;
+    }
+
+    numberToEncode += 63;
+    stringbuffer_aprintf(ctx, sb, "%c", (char)numberToEncode);
+    if(92 == numberToEncode)
+      stringbuffer_aprintf(ctx, sb, "%c", (char)numberToEncode);
+  }
+
+  rtfree(ctx, delta);
+  encoded_polyline = stringbuffer_getstringcopy(ctx, sb);
+  stringbuffer_destroy(ctx, sb);
+
+  return encoded_polyline;
 }
diff --git a/src/rtout_geojson.c b/src/rtout_geojson.c
index 0bd36e5..4a545c6 100644
--- a/src/rtout_geojson.c
+++ b/src/rtout_geojson.c
@@ -26,7 +26,7 @@
 
 
 #include "librttopo_geom_internal.h"
-#include <string.h>	/* strlen */
+#include <string.h>  /* strlen */
 #include <assert.h>
 
 static char * asgeojson_point(const RTCTX *ctx, const RTPOINT *point, char *srs, RTGBOX *bbox, int precision);
@@ -48,43 +48,43 @@ static size_t pointArray_geojson_size(const RTCTX *ctx, RTPOINTARRAY *pa, int pr
 char *
 rtgeom_to_geojson(const RTCTX *ctx, const RTGEOM *geom, char *srs, int precision, int has_bbox)
 {
-	int type = geom->type;
-	RTGBOX *bbox = NULL;
-	RTGBOX tmp;
-
-	if ( precision > OUT_MAX_DOUBLE_PRECISION ) precision = OUT_MAX_DOUBLE_PRECISION;
-
-	if (has_bbox) 
-	{
-		/* Whether these are geography or geometry, 
-		   the GeoJSON expects a cartesian bounding box */
-		rtgeom_calculate_gbox_cartesian(ctx, geom, &tmp);
-		bbox = &tmp;
-	}		
-
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		return asgeojson_point(ctx, (RTPOINT*)geom, srs, bbox, precision);
-	case RTLINETYPE:
-		return asgeojson_line(ctx, (RTLINE*)geom, srs, bbox, precision);
-	case RTPOLYGONTYPE:
-		return asgeojson_poly(ctx, (RTPOLY*)geom, srs, bbox, precision);
-	case RTMULTIPOINTTYPE:
-		return asgeojson_multipoint(ctx, (RTMPOINT*)geom, srs, bbox, precision);
-	case RTMULTILINETYPE:
-		return asgeojson_multiline(ctx, (RTMLINE*)geom, srs, bbox, precision);
-	case RTMULTIPOLYGONTYPE:
-		return asgeojson_multipolygon(ctx, (RTMPOLY*)geom, srs, bbox, precision);
-	case RTCOLLECTIONTYPE:
-		return asgeojson_collection(ctx, (RTCOLLECTION*)geom, srs, bbox, precision);
-	default:
-		rterror(ctx, "rtgeom_to_geojson: '%s' geometry type not supported",
-		        rttype_name(ctx, type));
-	}
-
-	/* Never get here */
-	return NULL;
+  int type = geom->type;
+  RTGBOX *bbox = NULL;
+  RTGBOX tmp;
+
+  if ( precision > OUT_MAX_DOUBLE_PRECISION ) precision = OUT_MAX_DOUBLE_PRECISION;
+
+  if (has_bbox)
+  {
+    /* Whether these are geography or geometry,
+       the GeoJSON expects a cartesian bounding box */
+    rtgeom_calculate_gbox_cartesian(ctx, geom, &tmp);
+    bbox = &tmp;
+  }
+
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    return asgeojson_point(ctx, (RTPOINT*)geom, srs, bbox, precision);
+  case RTLINETYPE:
+    return asgeojson_line(ctx, (RTLINE*)geom, srs, bbox, precision);
+  case RTPOLYGONTYPE:
+    return asgeojson_poly(ctx, (RTPOLY*)geom, srs, bbox, precision);
+  case RTMULTIPOINTTYPE:
+    return asgeojson_multipoint(ctx, (RTMPOINT*)geom, srs, bbox, precision);
+  case RTMULTILINETYPE:
+    return asgeojson_multiline(ctx, (RTMLINE*)geom, srs, bbox, precision);
+  case RTMULTIPOLYGONTYPE:
+    return asgeojson_multipolygon(ctx, (RTMPOLY*)geom, srs, bbox, precision);
+  case RTCOLLECTIONTYPE:
+    return asgeojson_collection(ctx, (RTCOLLECTION*)geom, srs, bbox, precision);
+  default:
+    rterror(ctx, "rtgeom_to_geojson: '%s' geometry type not supported",
+            rttype_name(ctx, type));
+  }
+
+  /* Never get here */
+  return NULL;
 }
 
 
@@ -95,24 +95,24 @@ rtgeom_to_geojson(const RTCTX *ctx, const RTGEOM *geom, char *srs, int precision
 static size_t
 asgeojson_srs_size(const RTCTX *ctx, char *srs)
 {
-	int size;
+  int size;
 
-	size = sizeof("'crs':{'type':'name',");
-	size += sizeof("'properties':{'name':''}},");
-	size += strlen(srs) * sizeof(char);
+  size = sizeof("'crs':{'type':'name',");
+  size += sizeof("'properties':{'name':''}},");
+  size += strlen(srs) * sizeof(char);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgeojson_srs_buf(const RTCTX *ctx, char *output, char *srs)
 {
-	char *ptr = output;
+  char *ptr = output;
 
-	ptr += sprintf(ptr, "\"crs\":{\"type\":\"name\",");
-	ptr += sprintf(ptr, "\"properties\":{\"name\":\"%s\"}},", srs);
+  ptr += sprintf(ptr, "\"crs\":{\"type\":\"name\",");
+  ptr += sprintf(ptr, "\"properties\":{\"name\":\"%s\"}},", srs);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 
@@ -123,37 +123,37 @@ asgeojson_srs_buf(const RTCTX *ctx, char *output, char *srs)
 static size_t
 asgeojson_bbox_size(const RTCTX *ctx, int hasz, int precision)
 {
-	int size;
-
-	if (!hasz)
-	{
-		size = sizeof("\"bbox\":[,,,],");
-		size +=	2 * 2 * (OUT_MAX_DIGS_DOUBLE + precision);
-	}
-	else
-	{
-		size = sizeof("\"bbox\":[,,,,,],");
-		size +=	2 * 3 * (OUT_MAX_DIGS_DOUBLE + precision);
-	}
-
-	return size;
+  int size;
+
+  if (!hasz)
+  {
+    size = sizeof("\"bbox\":[,,,],");
+    size +=  2 * 2 * (OUT_MAX_DIGS_DOUBLE + precision);
+  }
+  else
+  {
+    size = sizeof("\"bbox\":[,,,,,],");
+    size +=  2 * 3 * (OUT_MAX_DIGS_DOUBLE + precision);
+  }
+
+  return size;
 }
 
 static size_t
 asgeojson_bbox_buf(const RTCTX *ctx, char *output, RTGBOX *bbox, int hasz, int precision)
 {
-	char *ptr = output;
-
-	if (!hasz)
-		ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f],",
-		               precision, bbox->xmin, precision, bbox->ymin,
-		               precision, bbox->xmax, precision, bbox->ymax);
-	else
-		ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f,%.*f,%.*f],",
-		               precision, bbox->xmin, precision, bbox->ymin, precision, bbox->zmin,
-		               precision, bbox->xmax, precision, bbox->ymax, precision, bbox->zmax);
-
-	return (ptr-output);
+  char *ptr = output;
+
+  if (!hasz)
+    ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f],",
+                   precision, bbox->xmin, precision, bbox->ymin,
+                   precision, bbox->xmax, precision, bbox->ymax);
+  else
+    ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f,%.*f,%.*f],",
+                   precision, bbox->xmin, precision, bbox->ymin, precision, bbox->zmin,
+                   precision, bbox->xmax, precision, bbox->ymax, precision, bbox->zmax);
+
+  return (ptr-output);
 }
 
 
@@ -165,49 +165,49 @@ asgeojson_bbox_buf(const RTCTX *ctx, char *output, RTGBOX *bbox, int hasz, int p
 static size_t
 asgeojson_point_size(const RTCTX *ctx, const RTPOINT *point, char *srs, RTGBOX *bbox, int precision)
 {
-	int size;
+  int size;
 
-	size = pointArray_geojson_size(ctx, point->point, precision);
-	size += sizeof("{'type':'Point',");
-	size += sizeof("'coordinates':}");
+  size = pointArray_geojson_size(ctx, point->point, precision);
+  size += sizeof("{'type':'Point',");
+  size += sizeof("'coordinates':}");
 
-	if ( rtpoint_is_empty(ctx, point) )
-		size += 2; /* [] */
+  if ( rtpoint_is_empty(ctx, point) )
+    size += 2; /* [] */
 
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(point->flags), precision);
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(point->flags), precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgeojson_point_buf(const RTCTX *ctx, const RTPOINT *point, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	char *ptr = output;
+  char *ptr = output;
 
-	ptr += sprintf(ptr, "{\"type\":\"Point\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(point->flags), precision);
+  ptr += sprintf(ptr, "{\"type\":\"Point\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(point->flags), precision);
 
-	ptr += sprintf(ptr, "\"coordinates\":");
-	if ( rtpoint_is_empty(ctx, point) )
-		ptr += sprintf(ptr, "[]");
-	ptr += pointArray_to_geojson(ctx, point->point, ptr, precision);
-	ptr += sprintf(ptr, "}");
+  ptr += sprintf(ptr, "\"coordinates\":");
+  if ( rtpoint_is_empty(ctx, point) )
+    ptr += sprintf(ptr, "[]");
+  ptr += pointArray_to_geojson(ctx, point->point, ptr, precision);
+  ptr += sprintf(ptr, "}");
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 asgeojson_point(const RTCTX *ctx, const RTPOINT *point, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_point_size(ctx, point, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_point_buf(ctx, point, srs, output, bbox, precision);
-	return output;
+  size = asgeojson_point_size(ctx, point, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_point_buf(ctx, point, srs, output, bbox, precision);
+  return output;
 }
 
 
@@ -219,43 +219,43 @@ asgeojson_point(const RTCTX *ctx, const RTPOINT *point, char *srs, RTGBOX *bbox,
 static size_t
 asgeojson_line_size(const RTCTX *ctx, const RTLINE *line, char *srs, RTGBOX *bbox, int precision)
 {
-	int size;
+  int size;
 
-	size = sizeof("{'type':'LineString',");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(line->flags), precision);
-	size += sizeof("'coordinates':[]}");
-	size += pointArray_geojson_size(ctx, line->points, precision);
+  size = sizeof("{'type':'LineString',");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(line->flags), precision);
+  size += sizeof("'coordinates':[]}");
+  size += pointArray_geojson_size(ctx, line->points, precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgeojson_line_buf(const RTCTX *ctx, const RTLINE *line, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	char *ptr=output;
+  char *ptr=output;
 
-	ptr += sprintf(ptr, "{\"type\":\"LineString\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(line->flags), precision);
-	ptr += sprintf(ptr, "\"coordinates\":[");
-	ptr += pointArray_to_geojson(ctx, line->points, ptr, precision);
-	ptr += sprintf(ptr, "]}");
+  ptr += sprintf(ptr, "{\"type\":\"LineString\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(line->flags), precision);
+  ptr += sprintf(ptr, "\"coordinates\":[");
+  ptr += pointArray_to_geojson(ctx, line->points, ptr, precision);
+  ptr += sprintf(ptr, "]}");
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 asgeojson_line(const RTCTX *ctx, const RTLINE *line, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_line_size(ctx, line, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_line_buf(ctx, line, srs, output, bbox, precision);
+  size = asgeojson_line_size(ctx, line, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_line_buf(ctx, line, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -267,57 +267,57 @@ asgeojson_line(const RTCTX *ctx, const RTLINE *line, char *srs, RTGBOX *bbox, in
 static size_t
 asgeojson_poly_size(const RTCTX *ctx, const RTPOLY *poly, char *srs, RTGBOX *bbox, int precision)
 {
-	size_t size;
-	int i;
-
-	size = sizeof("{\"type\":\"Polygon\",");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(poly->flags), precision);
-	size += sizeof("\"coordinates\":[");
-	for (i=0, size=0; i<poly->nrings; i++)
-	{
-		size += pointArray_geojson_size(ctx, poly->rings[i], precision);
-		size += sizeof("[]");
-	}
-	size += sizeof(",") * i;
-	size += sizeof("]}");
-
-	return size;
+  size_t size;
+  int i;
+
+  size = sizeof("{\"type\":\"Polygon\",");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(poly->flags), precision);
+  size += sizeof("\"coordinates\":[");
+  for (i=0, size=0; i<poly->nrings; i++)
+  {
+    size += pointArray_geojson_size(ctx, poly->rings[i], precision);
+    size += sizeof("[]");
+  }
+  size += sizeof(",") * i;
+  size += sizeof("]}");
+
+  return size;
 }
 
 static size_t
 asgeojson_poly_buf(const RTCTX *ctx, const RTPOLY *poly, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	int i;
-	char *ptr=output;
-
-	ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(poly->flags), precision);
-	ptr += sprintf(ptr, "\"coordinates\":[");
-	for (i=0; i<poly->nrings; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");
-		ptr += sprintf(ptr, "[");
-		ptr += pointArray_to_geojson(ctx, poly->rings[i], ptr, precision);
-		ptr += sprintf(ptr, "]");
-	}
-	ptr += sprintf(ptr, "]}");
-
-	return (ptr-output);
+  int i;
+  char *ptr=output;
+
+  ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(poly->flags), precision);
+  ptr += sprintf(ptr, "\"coordinates\":[");
+  for (i=0; i<poly->nrings; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");
+    ptr += sprintf(ptr, "[");
+    ptr += pointArray_to_geojson(ctx, poly->rings[i], ptr, precision);
+    ptr += sprintf(ptr, "]");
+  }
+  ptr += sprintf(ptr, "]}");
+
+  return (ptr-output);
 }
 
 static char *
 asgeojson_poly(const RTCTX *ctx, const RTPOLY *poly, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_poly_size(ctx, poly, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_poly_buf(ctx, poly, srs, output, bbox, precision);
+  size = asgeojson_poly_size(ctx, poly, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_poly_buf(ctx, poly, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -329,59 +329,59 @@ asgeojson_poly(const RTCTX *ctx, const RTPOLY *poly, char *srs, RTGBOX *bbox, in
 static size_t
 asgeojson_multipoint_size(const RTCTX *ctx, const RTMPOINT *mpoint, char *srs, RTGBOX *bbox, int precision)
 {
-	RTPOINT * point;
-	int size;
-	int i;
-
-	size = sizeof("{'type':'MultiPoint',");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mpoint->flags), precision);
-	size += sizeof("'coordinates':[]}");
-
-	for (i=0; i<mpoint->ngeoms; i++)
-	{
-		point = mpoint->geoms[i];
-		size += pointArray_geojson_size(ctx, point->point, precision);
-	}
-	size += sizeof(",") * i;
-
-	return size;
+  RTPOINT * point;
+  int size;
+  int i;
+
+  size = sizeof("{'type':'MultiPoint',");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mpoint->flags), precision);
+  size += sizeof("'coordinates':[]}");
+
+  for (i=0; i<mpoint->ngeoms; i++)
+  {
+    point = mpoint->geoms[i];
+    size += pointArray_geojson_size(ctx, point->point, precision);
+  }
+  size += sizeof(",") * i;
+
+  return size;
 }
 
 static size_t
 asgeojson_multipoint_buf(const RTCTX *ctx, const RTMPOINT *mpoint, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	RTPOINT *point;
-	int i;
-	char *ptr=output;
-
-	ptr += sprintf(ptr, "{\"type\":\"MultiPoint\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mpoint->flags), precision);
-	ptr += sprintf(ptr, "\"coordinates\":[");
-
-	for (i=0; i<mpoint->ngeoms; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");
-		point = mpoint->geoms[i];
-		ptr += pointArray_to_geojson(ctx, point->point, ptr, precision);
-	}
-	ptr += sprintf(ptr, "]}");
-
-	return (ptr - output);
+  RTPOINT *point;
+  int i;
+  char *ptr=output;
+
+  ptr += sprintf(ptr, "{\"type\":\"MultiPoint\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mpoint->flags), precision);
+  ptr += sprintf(ptr, "\"coordinates\":[");
+
+  for (i=0; i<mpoint->ngeoms; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");
+    point = mpoint->geoms[i];
+    ptr += pointArray_to_geojson(ctx, point->point, ptr, precision);
+  }
+  ptr += sprintf(ptr, "]}");
+
+  return (ptr - output);
 }
 
 static char *
 asgeojson_multipoint(const RTCTX *ctx, const RTMPOINT *mpoint, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_multipoint_size(ctx, mpoint, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_multipoint_buf(ctx, mpoint, srs, output, bbox, precision);
+  size = asgeojson_multipoint_size(ctx, mpoint, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_multipoint_buf(ctx, mpoint, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -393,63 +393,63 @@ asgeojson_multipoint(const RTCTX *ctx, const RTMPOINT *mpoint, char *srs, RTGBOX
 static size_t
 asgeojson_multiline_size(const RTCTX *ctx, const RTMLINE *mline, char *srs, RTGBOX *bbox, int precision)
 {
-	RTLINE * line;
-	int size;
-	int i;
-
-	size = sizeof("{'type':'MultiLineString',");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mline->flags), precision);
-	size += sizeof("'coordinates':[]}");
-
-	for (i=0 ; i<mline->ngeoms; i++)
-	{
-		line = mline->geoms[i];
-		size += pointArray_geojson_size(ctx, line->points, precision);
-		size += sizeof("[]");
-	}
-	size += sizeof(",") * i;
-
-	return size;
+  RTLINE * line;
+  int size;
+  int i;
+
+  size = sizeof("{'type':'MultiLineString',");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mline->flags), precision);
+  size += sizeof("'coordinates':[]}");
+
+  for (i=0 ; i<mline->ngeoms; i++)
+  {
+    line = mline->geoms[i];
+    size += pointArray_geojson_size(ctx, line->points, precision);
+    size += sizeof("[]");
+  }
+  size += sizeof(",") * i;
+
+  return size;
 }
 
 static size_t
 asgeojson_multiline_buf(const RTCTX *ctx, const RTMLINE *mline, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	RTLINE *line;
-	int i;
-	char *ptr=output;
-
-	ptr += sprintf(ptr, "{\"type\":\"MultiLineString\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mline->flags), precision);
-	ptr += sprintf(ptr, "\"coordinates\":[");
-
-	for (i=0; i<mline->ngeoms; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");
-		ptr += sprintf(ptr, "[");
-		line = mline->geoms[i];
-		ptr += pointArray_to_geojson(ctx, line->points, ptr, precision);
-		ptr += sprintf(ptr, "]");
-	}
-
-	ptr += sprintf(ptr, "]}");
-
-	return (ptr - output);
+  RTLINE *line;
+  int i;
+  char *ptr=output;
+
+  ptr += sprintf(ptr, "{\"type\":\"MultiLineString\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mline->flags), precision);
+  ptr += sprintf(ptr, "\"coordinates\":[");
+
+  for (i=0; i<mline->ngeoms; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");
+    ptr += sprintf(ptr, "[");
+    line = mline->geoms[i];
+    ptr += pointArray_to_geojson(ctx, line->points, ptr, precision);
+    ptr += sprintf(ptr, "]");
+  }
+
+  ptr += sprintf(ptr, "]}");
+
+  return (ptr - output);
 }
 
 static char *
 asgeojson_multiline(const RTCTX *ctx, const RTMLINE *mline, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_multiline_size(ctx, mline, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_multiline_buf(ctx, mline, srs, output, bbox, precision);
+  size = asgeojson_multiline_size(ctx, mline, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_multiline_buf(ctx, mline, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -461,72 +461,72 @@ asgeojson_multiline(const RTCTX *ctx, const RTMLINE *mline, char *srs, RTGBOX *b
 static size_t
 asgeojson_multipolygon_size(const RTCTX *ctx, const RTMPOLY *mpoly, char *srs, RTGBOX *bbox, int precision)
 {
-	RTPOLY *poly;
-	int size;
-	int i, j;
-
-	size = sizeof("{'type':'MultiPolygon',");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mpoly->flags), precision);
-	size += sizeof("'coordinates':[]}");
-
-	for (i=0; i < mpoly->ngeoms; i++)
-	{
-		poly = mpoly->geoms[i];
-		for (j=0 ; j <poly->nrings ; j++)
-		{
-			size += pointArray_geojson_size(ctx, poly->rings[j], precision);
-			size += sizeof("[]");
-		}
-		size += sizeof("[]");
-	}
-	size += sizeof(",") * i;
-	size += sizeof("]}");
-
-	return size;
+  RTPOLY *poly;
+  int size;
+  int i, j;
+
+  size = sizeof("{'type':'MultiPolygon',");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(mpoly->flags), precision);
+  size += sizeof("'coordinates':[]}");
+
+  for (i=0; i < mpoly->ngeoms; i++)
+  {
+    poly = mpoly->geoms[i];
+    for (j=0 ; j <poly->nrings ; j++)
+    {
+      size += pointArray_geojson_size(ctx, poly->rings[j], precision);
+      size += sizeof("[]");
+    }
+    size += sizeof("[]");
+  }
+  size += sizeof(",") * i;
+  size += sizeof("]}");
+
+  return size;
 }
 
 static size_t
 asgeojson_multipolygon_buf(const RTCTX *ctx, const RTMPOLY *mpoly, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	RTPOLY *poly;
-	int i, j;
-	char *ptr=output;
-
-	ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mpoly->flags), precision);
-	ptr += sprintf(ptr, "\"coordinates\":[");
-	for (i=0; i<mpoly->ngeoms; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");
-		ptr += sprintf(ptr, "[");
-		poly = mpoly->geoms[i];
-		for (j=0 ; j < poly->nrings ; j++)
-		{
-			if (j) ptr += sprintf(ptr, ",");
-			ptr += sprintf(ptr, "[");
-			ptr += pointArray_to_geojson(ctx, poly->rings[j], ptr, precision);
-			ptr += sprintf(ptr, "]");
-		}
-		ptr += sprintf(ptr, "]");
-	}
-	ptr += sprintf(ptr, "]}");
-
-	return (ptr - output);
+  RTPOLY *poly;
+  int i, j;
+  char *ptr=output;
+
+  ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(mpoly->flags), precision);
+  ptr += sprintf(ptr, "\"coordinates\":[");
+  for (i=0; i<mpoly->ngeoms; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");
+    ptr += sprintf(ptr, "[");
+    poly = mpoly->geoms[i];
+    for (j=0 ; j < poly->nrings ; j++)
+    {
+      if (j) ptr += sprintf(ptr, ",");
+      ptr += sprintf(ptr, "[");
+      ptr += pointArray_to_geojson(ctx, poly->rings[j], ptr, precision);
+      ptr += sprintf(ptr, "]");
+    }
+    ptr += sprintf(ptr, "]");
+  }
+  ptr += sprintf(ptr, "]}");
+
+  return (ptr - output);
 }
 
 static char *
 asgeojson_multipolygon(const RTCTX *ctx, const RTMPOLY *mpoly, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_multipolygon_size(ctx, mpoly, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_multipolygon_buf(ctx, mpoly, srs, output, bbox, precision);
+  size = asgeojson_multipolygon_size(ctx, mpoly, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_multipolygon_buf(ctx, mpoly, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -538,61 +538,61 @@ asgeojson_multipolygon(const RTCTX *ctx, const RTMPOLY *mpoly, char *srs, RTGBOX
 static size_t
 asgeojson_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, RTGBOX *bbox, int precision)
 {
-	int i;
-	int size;
-	RTGEOM *subgeom;
-
-	size = sizeof("{'type':'GeometryCollection',");
-	if (srs) size += asgeojson_srs_size(ctx, srs);
-	if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(col->flags), precision);
-	size += sizeof("'geometries':");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		size += asgeojson_geom_size(ctx, subgeom, NULL, precision);
-	}
-	size += sizeof(",") * i;
-	size += sizeof("]}");
-
-	return size;
+  int i;
+  int size;
+  RTGEOM *subgeom;
+
+  size = sizeof("{'type':'GeometryCollection',");
+  if (srs) size += asgeojson_srs_size(ctx, srs);
+  if (bbox) size += asgeojson_bbox_size(ctx, RTFLAGS_GET_Z(col->flags), precision);
+  size += sizeof("'geometries':");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    size += asgeojson_geom_size(ctx, subgeom, NULL, precision);
+  }
+  size += sizeof(",") * i;
+  size += sizeof("]}");
+
+  return size;
 }
 
 static size_t
 asgeojson_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char *output, RTGBOX *bbox, int precision)
 {
-	int i;
-	char *ptr=output;
-	RTGEOM *subgeom;
+  int i;
+  char *ptr=output;
+  RTGEOM *subgeom;
 
-	ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
-	if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
-	if (col->ngeoms && bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(col->flags), precision);
-	ptr += sprintf(ptr, "\"geometries\":[");
+  ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
+  if (srs) ptr += asgeojson_srs_buf(ctx, ptr, srs);
+  if (col->ngeoms && bbox) ptr += asgeojson_bbox_buf(ctx, ptr, bbox, RTFLAGS_GET_Z(col->flags), precision);
+  ptr += sprintf(ptr, "\"geometries\":[");
 
-	for (i=0; i<col->ngeoms; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");
-		subgeom = col->geoms[i];
-		ptr += asgeojson_geom_buf(ctx, subgeom, ptr, NULL, precision);
-	}
+  for (i=0; i<col->ngeoms; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");
+    subgeom = col->geoms[i];
+    ptr += asgeojson_geom_buf(ctx, subgeom, ptr, NULL, precision);
+  }
 
-	ptr += sprintf(ptr, "]}");
+  ptr += sprintf(ptr, "]}");
 
-	return (ptr - output);
+  return (ptr - output);
 }
 
 static char *
 asgeojson_collection(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, RTGBOX *bbox, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgeojson_collection_size(ctx, col, srs, bbox, precision);
-	output = rtalloc(ctx, size);
-	asgeojson_collection_buf(ctx, col, srs, output, bbox, precision);
+  size = asgeojson_collection_size(ctx, col, srs, bbox, precision);
+  output = rtalloc(ctx, size);
+  asgeojson_collection_buf(ctx, col, srs, output, bbox, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -600,81 +600,81 @@ asgeojson_collection(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, RTGBO
 static size_t
 asgeojson_geom_size(const RTCTX *ctx, const RTGEOM *geom, RTGBOX *bbox, int precision)
 {
-	int type = geom->type;
-	size_t size = 0;
+  int type = geom->type;
+  size_t size = 0;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		size = asgeojson_point_size(ctx, (RTPOINT*)geom, NULL, bbox, precision);
-		break;
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    size = asgeojson_point_size(ctx, (RTPOINT*)geom, NULL, bbox, precision);
+    break;
 
-	case RTLINETYPE:
-		size = asgeojson_line_size(ctx, (RTLINE*)geom, NULL, bbox, precision);
-		break;
+  case RTLINETYPE:
+    size = asgeojson_line_size(ctx, (RTLINE*)geom, NULL, bbox, precision);
+    break;
 
-	case RTPOLYGONTYPE:
-		size = asgeojson_poly_size(ctx, (RTPOLY*)geom, NULL, bbox, precision);
-		break;
+  case RTPOLYGONTYPE:
+    size = asgeojson_poly_size(ctx, (RTPOLY*)geom, NULL, bbox, precision);
+    break;
 
-	case RTMULTIPOINTTYPE:
-		size = asgeojson_multipoint_size(ctx, (RTMPOINT*)geom, NULL, bbox, precision);
-		break;
+  case RTMULTIPOINTTYPE:
+    size = asgeojson_multipoint_size(ctx, (RTMPOINT*)geom, NULL, bbox, precision);
+    break;
 
-	case RTMULTILINETYPE:
-		size = asgeojson_multiline_size(ctx, (RTMLINE*)geom, NULL, bbox, precision);
-		break;
+  case RTMULTILINETYPE:
+    size = asgeojson_multiline_size(ctx, (RTMLINE*)geom, NULL, bbox, precision);
+    break;
 
-	case RTMULTIPOLYGONTYPE:
-		size = asgeojson_multipolygon_size(ctx, (RTMPOLY*)geom, NULL, bbox, precision);
-		break;
+  case RTMULTIPOLYGONTYPE:
+    size = asgeojson_multipolygon_size(ctx, (RTMPOLY*)geom, NULL, bbox, precision);
+    break;
 
-	default:
-		rterror(ctx, "GeoJson: geometry not supported.");
-	}
+  default:
+    rterror(ctx, "GeoJson: geometry not supported.");
+  }
 
-	return size;
+  return size;
 }
 
 
 static size_t
 asgeojson_geom_buf(const RTCTX *ctx, const RTGEOM *geom, char *output, RTGBOX *bbox, int precision)
 {
-	int type = geom->type;
-	char *ptr=output;
+  int type = geom->type;
+  char *ptr=output;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		ptr += asgeojson_point_buf(ctx, (RTPOINT*)geom, NULL, ptr, bbox, precision);
-		break;
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    ptr += asgeojson_point_buf(ctx, (RTPOINT*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	case RTLINETYPE:
-		ptr += asgeojson_line_buf(ctx, (RTLINE*)geom, NULL, ptr, bbox, precision);
-		break;
+  case RTLINETYPE:
+    ptr += asgeojson_line_buf(ctx, (RTLINE*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	case RTPOLYGONTYPE:
-		ptr += asgeojson_poly_buf(ctx, (RTPOLY*)geom, NULL, ptr, bbox, precision);
-		break;
+  case RTPOLYGONTYPE:
+    ptr += asgeojson_poly_buf(ctx, (RTPOLY*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	case RTMULTIPOINTTYPE:
-		ptr += asgeojson_multipoint_buf(ctx, (RTMPOINT*)geom, NULL, ptr, bbox, precision);
-		break;
+  case RTMULTIPOINTTYPE:
+    ptr += asgeojson_multipoint_buf(ctx, (RTMPOINT*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	case RTMULTILINETYPE:
-		ptr += asgeojson_multiline_buf(ctx, (RTMLINE*)geom, NULL, ptr, bbox, precision);
-		break;
+  case RTMULTILINETYPE:
+    ptr += asgeojson_multiline_buf(ctx, (RTMLINE*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	case RTMULTIPOLYGONTYPE:
-		ptr += asgeojson_multipolygon_buf(ctx, (RTMPOLY*)geom, NULL, ptr, bbox, precision);
-		break;
+  case RTMULTIPOLYGONTYPE:
+    ptr += asgeojson_multipolygon_buf(ctx, (RTMPOLY*)geom, NULL, ptr, bbox, precision);
+    break;
 
-	default:
-		if (bbox) rtfree(ctx, bbox);
-		rterror(ctx, "GeoJson: geometry not supported.");
-	}
+  default:
+    if (bbox) rtfree(ctx, bbox);
+    rterror(ctx, "GeoJson: geometry not supported.");
+  }
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 /*
@@ -713,14 +713,14 @@ rtprint_double(const RTCTX *ctx, double d, int maxdd, char *buf, size_t bufsize)
 static size_t
 pointArray_to_geojson(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precision)
 {
-	int i;
-	char *ptr;
+  int i;
+  char *ptr;
 #define BUFSIZE OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION
-	char x[BUFSIZE+1];
-	char y[BUFSIZE+1];
-	char z[BUFSIZE+1];
+  char x[BUFSIZE+1];
+  char y[BUFSIZE+1];
+  char z[BUFSIZE+1];
 
-	assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
+  assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
 
   /* Ensure a terminating NULL at the end of buffers
    * so that we don't need to check for truncation
@@ -729,45 +729,45 @@ pointArray_to_geojson(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int prec
   y[BUFSIZE] = '\0';
   z[BUFSIZE] = '\0';
 
-	ptr = output;
+  ptr = output;
 
   /* TODO: rewrite this loop to be simpler and possibly quicker */
-	if (!RTFLAGS_GET_Z(pa->flags))
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT2D *pt;
-			pt = rt_getPoint2d_cp(ctx, pa, i);
-
-			rtprint_double(ctx, pt->x, precision, x, BUFSIZE);
-			trim_trailing_zeros(ctx, x);
-			rtprint_double(ctx, pt->y, precision, y, BUFSIZE);
-			trim_trailing_zeros(ctx, y);
-
-			if ( i ) ptr += sprintf(ptr, ",");
-			ptr += sprintf(ptr, "[%s,%s]", x, y);
-		}
-	}
-	else
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT3DZ *pt;
-			pt = rt_getPoint3dz_cp(ctx, pa, i);
-
-			rtprint_double(ctx, pt->x, precision, x, BUFSIZE);
-			trim_trailing_zeros(ctx, x);
-			rtprint_double(ctx, pt->y, precision, y, BUFSIZE);
-			trim_trailing_zeros(ctx, y);
-			rtprint_double(ctx, pt->z, precision, z, BUFSIZE);
-			trim_trailing_zeros(ctx, z);
-
-			if ( i ) ptr += sprintf(ptr, ",");
-			ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
-		}
-	}
-
-	return (ptr-output);
+  if (!RTFLAGS_GET_Z(pa->flags))
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT2D *pt;
+      pt = rt_getPoint2d_cp(ctx, pa, i);
+
+      rtprint_double(ctx, pt->x, precision, x, BUFSIZE);
+      trim_trailing_zeros(ctx, x);
+      rtprint_double(ctx, pt->y, precision, y, BUFSIZE);
+      trim_trailing_zeros(ctx, y);
+
+      if ( i ) ptr += sprintf(ptr, ",");
+      ptr += sprintf(ptr, "[%s,%s]", x, y);
+    }
+  }
+  else
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT3DZ *pt;
+      pt = rt_getPoint3dz_cp(ctx, pa, i);
+
+      rtprint_double(ctx, pt->x, precision, x, BUFSIZE);
+      trim_trailing_zeros(ctx, x);
+      rtprint_double(ctx, pt->y, precision, y, BUFSIZE);
+      trim_trailing_zeros(ctx, y);
+      rtprint_double(ctx, pt->z, precision, z, BUFSIZE);
+      trim_trailing_zeros(ctx, z);
+
+      if ( i ) ptr += sprintf(ptr, ",");
+      ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
+    }
+  }
+
+  return (ptr-output);
 }
 
 
@@ -778,11 +778,11 @@ pointArray_to_geojson(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int prec
 static size_t
 pointArray_geojson_size(const RTCTX *ctx, RTPOINTARRAY *pa, int precision)
 {
-	assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
-	if (RTFLAGS_NDIMS(pa->flags) == 2)
-		return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(","))
-		       * 2 * pa->npoints + sizeof(",[]");
+  assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
+  if (RTFLAGS_NDIMS(pa->flags) == 2)
+    return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(","))
+           * 2 * pa->npoints + sizeof(",[]");
 
-	return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(",,"))
-	       * 3 * pa->npoints + sizeof(",[]");
+  return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(",,"))
+         * 3 * pa->npoints + sizeof(",[]");
 }
diff --git a/src/rtout_gml.c b/src/rtout_gml.c
index 2965c20..4a8357b 100644
--- a/src/rtout_gml.c
+++ b/src/rtout_gml.c
@@ -75,350 +75,350 @@ static size_t pointArray_GMLsize(const RTCTX *ctx, RTPOINTARRAY *pa, int precisi
 static char *
 gbox_to_gml2(const RTCTX *ctx, const RTGBOX *bbox, const char *srs, int precision, const char *prefix)
 {
-	int size;
-	RTPOINT4D pt;
-	RTPOINTARRAY *pa;
-	char *ptr, *output;
-	size_t prefixlen = strlen(prefix);
+  int size;
+  RTPOINT4D pt;
+  RTPOINTARRAY *pa;
+  char *ptr, *output;
+  size_t prefixlen = strlen(prefix);
 
-	if ( ! bbox )
-	{
-		size = ( sizeof("<Box>/") + (prefixlen*2) ) * 2;
-		if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  if ( ! bbox )
+  {
+    size = ( sizeof("<Box>/") + (prefixlen*2) ) * 2;
+    if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
 
-		ptr = output = rtalloc(ctx, size);
+    ptr = output = rtalloc(ctx, size);
 
-		ptr += sprintf(ptr, "<%sBox", prefix);
+    ptr += sprintf(ptr, "<%sBox", prefix);
 
-		if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+    if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
 
-		ptr += sprintf(ptr, "/>");
+    ptr += sprintf(ptr, "/>");
 
-		return output;
-	}
+    return output;
+  }
 
-	pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(bbox->flags), 0, 2);
+  pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(bbox->flags), 0, 2);
 
-	pt.x = bbox->xmin;
-	pt.y = bbox->ymin;
-	if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmin;
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  pt.x = bbox->xmin;
+  pt.y = bbox->ymin;
+  if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmin;
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
 
-	pt.x = bbox->xmax;
-	pt.y = bbox->ymax;
-	if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmax;
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  pt.x = bbox->xmax;
+  pt.y = bbox->ymax;
+  if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmax;
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
 
-	size = pointArray_GMLsize(ctx, pa, precision);
-	size += ( sizeof("<Box><coordinates>/") + (prefixlen*2) ) * 2;
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  size = pointArray_GMLsize(ctx, pa, precision);
+  size += ( sizeof("<Box><coordinates>/") + (prefixlen*2) ) * 2;
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
 
-	ptr = output = rtalloc(ctx, size);
+  ptr = output = rtalloc(ctx, size);
 
-	if ( srs ) ptr += sprintf(ptr, "<%sBox srsName=\"%s\">", prefix, srs);
-	else       ptr += sprintf(ptr, "<%sBox>", prefix);
+  if ( srs ) ptr += sprintf(ptr, "<%sBox srsName=\"%s\">", prefix, srs);
+  else       ptr += sprintf(ptr, "<%sBox>", prefix);
 
-	ptr += sprintf(ptr, "<%scoordinates>", prefix);
-	ptr += pointArray_toGML2(ctx, pa, ptr, precision);
-	ptr += sprintf(ptr, "</%scoordinates></%sBox>", prefix, prefix);
+  ptr += sprintf(ptr, "<%scoordinates>", prefix);
+  ptr += pointArray_toGML2(ctx, pa, ptr, precision);
+  ptr += sprintf(ptr, "</%scoordinates></%sBox>", prefix, prefix);
 
-	ptarray_free(ctx, pa);
+  ptarray_free(ctx, pa);
 
-	return output;
+  return output;
 }
 
 static char *
 gbox_to_gml3(const RTCTX *ctx, const RTGBOX *bbox, const char *srs, int precision, int opts, const char *prefix)
 {
-	int size;
-	RTPOINT4D pt;
-	RTPOINTARRAY *pa;
-	char *ptr, *output;
-	size_t prefixlen = strlen(prefix);
-	int dimension = 2;
+  int size;
+  RTPOINT4D pt;
+  RTPOINTARRAY *pa;
+  char *ptr, *output;
+  size_t prefixlen = strlen(prefix);
+  int dimension = 2;
 
-	if ( ! bbox )
-	{
-		size = ( sizeof("<Envelope>/") + (prefixlen*2) ) * 2;
-		if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  if ( ! bbox )
+  {
+    size = ( sizeof("<Envelope>/") + (prefixlen*2) ) * 2;
+    if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
 
-		ptr = output = rtalloc(ctx, size);
+    ptr = output = rtalloc(ctx, size);
 
-		ptr += sprintf(ptr, "<%sEnvelope", prefix);
-		if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+    ptr += sprintf(ptr, "<%sEnvelope", prefix);
+    if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
 
-		ptr += sprintf(ptr, "/>");
+    ptr += sprintf(ptr, "/>");
 
-		return output;
-	}
+    return output;
+  }
 
-	if (RTFLAGS_GET_Z(bbox->flags)) dimension = 3;
+  if (RTFLAGS_GET_Z(bbox->flags)) dimension = 3;
 
-	pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(bbox->flags), 0, 1);
+  pa = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(bbox->flags), 0, 1);
 
-	pt.x = bbox->xmin;
-	pt.y = bbox->ymin;
-	if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmin;
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  pt.x = bbox->xmin;
+  pt.y = bbox->ymin;
+  if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmin;
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
 
-	size = pointArray_GMLsize(ctx, pa, precision) * 2;
-	size += ( sizeof("<Envelope><lowerCorner><upperCorner>//") + (prefixlen*3) ) * 2;
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-	if ( IS_DIMS(opts) ) size += sizeof(" srsDimension=. .");
+  size = pointArray_GMLsize(ctx, pa, precision) * 2;
+  size += ( sizeof("<Envelope><lowerCorner><upperCorner>//") + (prefixlen*3) ) * 2;
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  if ( IS_DIMS(opts) ) size += sizeof(" srsDimension=. .");
 
-	ptr = output = rtalloc(ctx, size);
+  ptr = output = rtalloc(ctx, size);
 
-	ptr += sprintf(ptr, "<%sEnvelope", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if ( IS_DIMS(opts) ) ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
-	ptr += sprintf(ptr, ">");
+  ptr += sprintf(ptr, "<%sEnvelope", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if ( IS_DIMS(opts) ) ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
+  ptr += sprintf(ptr, ">");
 
-	ptr += sprintf(ptr, "<%slowerCorner>", prefix);
-	ptr += pointArray_toGML3(ctx, pa, ptr, precision, opts);
-	ptr += sprintf(ptr, "</%slowerCorner>", prefix);
+  ptr += sprintf(ptr, "<%slowerCorner>", prefix);
+  ptr += pointArray_toGML3(ctx, pa, ptr, precision, opts);
+  ptr += sprintf(ptr, "</%slowerCorner>", prefix);
 
-	ptarray_remove_point(ctx, pa, 0);
-	pt.x = bbox->xmax;
-	pt.y = bbox->ymax;
-	if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmax;
-	ptarray_append_point(ctx, pa, &pt, RT_TRUE);
+  ptarray_remove_point(ctx, pa, 0);
+  pt.x = bbox->xmax;
+  pt.y = bbox->ymax;
+  if (RTFLAGS_GET_Z(bbox->flags)) pt.z = bbox->zmax;
+  ptarray_append_point(ctx, pa, &pt, RT_TRUE);
 
-	ptr += sprintf(ptr, "<%supperCorner>", prefix);
-	ptr += pointArray_toGML3(ctx, pa, ptr, precision, opts);
-	ptr += sprintf(ptr, "</%supperCorner>", prefix);
+  ptr += sprintf(ptr, "<%supperCorner>", prefix);
+  ptr += pointArray_toGML3(ctx, pa, ptr, precision, opts);
+  ptr += sprintf(ptr, "</%supperCorner>", prefix);
 
-	ptr += sprintf(ptr, "</%sEnvelope>", prefix);
+  ptr += sprintf(ptr, "</%sEnvelope>", prefix);
 
-	ptarray_free(ctx, pa);
+  ptarray_free(ctx, pa);
 
-	return output;
+  return output;
 }
 
 
 extern char *
 rtgeom_extent_to_gml2(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, const char *prefix)
 {
-	const RTGBOX* bbox = rtgeom_get_bbox(ctx, geom);
-	/*
-		if ( ! bbox ) {
-			rterror(ctx, "rtgeom_extent_to_gml2: empty geometry doesn't have a bounding box");
-			return NULL;
-		}
-	*/
-	char *ret = gbox_to_gml2(ctx, bbox, srs, precision, prefix);
-	return ret;
+  const RTGBOX* bbox = rtgeom_get_bbox(ctx, geom);
+  /*
+    if ( ! bbox ) {
+      rterror(ctx, "rtgeom_extent_to_gml2: empty geometry doesn't have a bounding box");
+      return NULL;
+    }
+  */
+  char *ret = gbox_to_gml2(ctx, bbox, srs, precision, prefix);
+  return ret;
 }
 
 
 extern char *
 rtgeom_extent_to_gml3(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, int opts, const char *prefix)
 {
-	const RTGBOX* bbox = rtgeom_get_bbox(ctx, geom);
-	/*
-		if ( ! bbox ) {
-			rterror(ctx, "rtgeom_extent_to_gml3: empty geometry doesn't have a bounding box");
-			return NULL;
-		}
-	*/
-	return gbox_to_gml3(ctx, bbox, srs, precision, opts, prefix);
+  const RTGBOX* bbox = rtgeom_get_bbox(ctx, geom);
+  /*
+    if ( ! bbox ) {
+      rterror(ctx, "rtgeom_extent_to_gml3: empty geometry doesn't have a bounding box");
+      return NULL;
+    }
+  */
+  return gbox_to_gml3(ctx, bbox, srs, precision, opts, prefix);
 }
 
 
 /**
  *  @brief VERSION GML 2
- *  	takes a GEOMETRY and returns a GML2 representation
+ *    takes a GEOMETRY and returns a GML2 representation
  */
 extern char *
 rtgeom_to_gml2(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, const char* prefix)
 {
-	int type = geom->type;
+  int type = geom->type;
 
-	/* Return null for empty (#1377) */
-	if ( rtgeom_is_empty(ctx, geom) )
-		return NULL;
+  /* Return null for empty (#1377) */
+  if ( rtgeom_is_empty(ctx, geom) )
+    return NULL;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		return asgml2_point(ctx, (RTPOINT*)geom, srs, precision, prefix);
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    return asgml2_point(ctx, (RTPOINT*)geom, srs, precision, prefix);
 
-	case RTLINETYPE:
-		return asgml2_line(ctx, (RTLINE*)geom, srs, precision, prefix);
+  case RTLINETYPE:
+    return asgml2_line(ctx, (RTLINE*)geom, srs, precision, prefix);
 
-	case RTPOLYGONTYPE:
-		return asgml2_poly(ctx, (RTPOLY*)geom, srs, precision, prefix);
+  case RTPOLYGONTYPE:
+    return asgml2_poly(ctx, (RTPOLY*)geom, srs, precision, prefix);
 
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-		return asgml2_multi(ctx, (RTCOLLECTION*)geom, srs, precision, prefix);
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+    return asgml2_multi(ctx, (RTCOLLECTION*)geom, srs, precision, prefix);
 
-	case RTCOLLECTIONTYPE:
-		return asgml2_collection(ctx, (RTCOLLECTION*)geom, srs, precision, prefix);
+  case RTCOLLECTIONTYPE:
+    return asgml2_collection(ctx, (RTCOLLECTION*)geom, srs, precision, prefix);
 
-	case RTTRIANGLETYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-		rterror(ctx, "Cannot convert %s to GML2. Try ST_AsGML(3, <geometry>) to generate GML3.", rttype_name(ctx, type));
-		return NULL;
+  case RTTRIANGLETYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+    rterror(ctx, "Cannot convert %s to GML2. Try ST_AsGML(3, <geometry>) to generate GML3.", rttype_name(ctx, type));
+    return NULL;
 
-	default:
-		rterror(ctx, "rtgeom_to_gml2: '%s' geometry type not supported", rttype_name(ctx, type));
-		return NULL;
-	}
+  default:
+    rterror(ctx, "rtgeom_to_gml2: '%s' geometry type not supported", rttype_name(ctx, type));
+    return NULL;
+  }
 }
 
 static size_t
 asgml2_point_size(const RTCTX *ctx, const RTPOINT *point, const char *srs, int precision, const char* prefix)
 {
-	int size;
-	size_t prefixlen = strlen(prefix);
+  int size;
+  size_t prefixlen = strlen(prefix);
 
-	size = pointArray_GMLsize(ctx, point->point, precision);
-	size += ( sizeof("<point><coordinates>/") + (prefixlen*2) ) * 2;
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-	return size;
+  size = pointArray_GMLsize(ctx, point->point, precision);
+  size += ( sizeof("<point><coordinates>/") + (prefixlen*2) ) * 2;
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  return size;
 }
 
 static size_t
 asgml2_point_buf(const RTCTX *ctx, const RTPOINT *point, const char *srs, char *output, int precision, const char* prefix)
 {
-	char *ptr = output;
-
-	ptr += sprintf(ptr, "<%sPoint", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if ( rtpoint_is_empty(ctx, point) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-	ptr += sprintf(ptr, "<%scoordinates>", prefix);
-	ptr += pointArray_toGML2(ctx, point->point, ptr, precision);
-	ptr += sprintf(ptr, "</%scoordinates></%sPoint>", prefix, prefix);
-
-	return (ptr-output);
+  char *ptr = output;
+
+  ptr += sprintf(ptr, "<%sPoint", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if ( rtpoint_is_empty(ctx, point) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+  ptr += sprintf(ptr, "<%scoordinates>", prefix);
+  ptr += pointArray_toGML2(ctx, point->point, ptr, precision);
+  ptr += sprintf(ptr, "</%scoordinates></%sPoint>", prefix, prefix);
+
+  return (ptr-output);
 }
 
 static char *
 asgml2_point(const RTCTX *ctx, const RTPOINT *point, const char *srs, int precision, const char *prefix)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml2_point_size(ctx, point, srs, precision, prefix);
-	output = rtalloc(ctx, size);
-	asgml2_point_buf(ctx, point, srs, output, precision, prefix);
-	return output;
+  size = asgml2_point_size(ctx, point, srs, precision, prefix);
+  output = rtalloc(ctx, size);
+  asgml2_point_buf(ctx, point, srs, output, precision, prefix);
+  return output;
 }
 
 static size_t
 asgml2_line_size(const RTCTX *ctx, const RTLINE *line, const char *srs, int precision, const char *prefix)
 {
-	int size;
-	size_t prefixlen = strlen(prefix);
+  int size;
+  size_t prefixlen = strlen(prefix);
 
-	size = pointArray_GMLsize(ctx, line->points, precision);
-	size += ( sizeof("<linestring><coordinates>/") + (prefixlen*2) ) * 2;
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-	return size;
+  size = pointArray_GMLsize(ctx, line->points, precision);
+  size += ( sizeof("<linestring><coordinates>/") + (prefixlen*2) ) * 2;
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  return size;
 }
 
 static size_t
 asgml2_line_buf(const RTCTX *ctx, const RTLINE *line, const char *srs, char *output, int precision,
                 const char *prefix)
 {
-	char *ptr=output;
+  char *ptr=output;
 
-	ptr += sprintf(ptr, "<%sLineString", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  ptr += sprintf(ptr, "<%sLineString", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
 
-	if ( rtline_is_empty(ctx, line) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
+  if ( rtline_is_empty(ctx, line) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
 
-	ptr += sprintf(ptr, "<%scoordinates>", prefix);
-	ptr += pointArray_toGML2(ctx, line->points, ptr, precision);
-	ptr += sprintf(ptr, "</%scoordinates></%sLineString>", prefix, prefix);
+  ptr += sprintf(ptr, "<%scoordinates>", prefix);
+  ptr += pointArray_toGML2(ctx, line->points, ptr, precision);
+  ptr += sprintf(ptr, "</%scoordinates></%sLineString>", prefix, prefix);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 asgml2_line(const RTCTX *ctx, const RTLINE *line, const char *srs, int precision, const char *prefix)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml2_line_size(ctx, line, srs, precision, prefix);
-	output = rtalloc(ctx, size);
-	asgml2_line_buf(ctx, line, srs, output, precision, prefix);
-	return output;
+  size = asgml2_line_size(ctx, line, srs, precision, prefix);
+  output = rtalloc(ctx, size);
+  asgml2_line_buf(ctx, line, srs, output, precision, prefix);
+  return output;
 }
 
 static size_t
 asgml2_poly_size(const RTCTX *ctx, const RTPOLY *poly, const char *srs, int precision, const char *prefix)
 {
-	size_t size;
-	int i;
-	size_t prefixlen = strlen(prefix);
+  size_t size;
+  int i;
+  size_t prefixlen = strlen(prefix);
 
-	size = sizeof("<polygon></polygon>") + prefixlen*2;
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-	if ( rtpoly_is_empty(ctx, poly) )
-		return size;
-	size += ( sizeof("<outerboundaryis><linearring><coordinates>/") + ( prefixlen*3) ) * 2;
-	size += ( sizeof("<innerboundaryis><linearring><coordinates>/") + ( prefixlen*2) ) * 2 * poly->nrings;
+  size = sizeof("<polygon></polygon>") + prefixlen*2;
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+  if ( rtpoly_is_empty(ctx, poly) )
+    return size;
+  size += ( sizeof("<outerboundaryis><linearring><coordinates>/") + ( prefixlen*3) ) * 2;
+  size += ( sizeof("<innerboundaryis><linearring><coordinates>/") + ( prefixlen*2) ) * 2 * poly->nrings;
 
-	for (i=0; i<poly->nrings; i++)
-		size += pointArray_GMLsize(ctx, poly->rings[i], precision);
+  for (i=0; i<poly->nrings; i++)
+    size += pointArray_GMLsize(ctx, poly->rings[i], precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgml2_poly_buf(const RTCTX *ctx, const RTPOLY *poly, const char *srs, char *output, int precision,
                 const char *prefix)
 {
-	int i;
-	char *ptr=output;
-
-	ptr += sprintf(ptr, "<%sPolygon", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if ( rtpoly_is_empty(ctx, poly) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-	ptr += sprintf(ptr, "<%souterBoundaryIs><%sLinearRing><%scoordinates>",
-	               prefix, prefix, prefix);
-	ptr += pointArray_toGML2(ctx, poly->rings[0], ptr, precision);
-	ptr += sprintf(ptr, "</%scoordinates></%sLinearRing></%souterBoundaryIs>", prefix, prefix, prefix);
-	for (i=1; i<poly->nrings; i++)
-	{
-		ptr += sprintf(ptr, "<%sinnerBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
-		ptr += pointArray_toGML2(ctx, poly->rings[i], ptr, precision);
-		ptr += sprintf(ptr, "</%scoordinates></%sLinearRing></%sinnerBoundaryIs>", prefix, prefix, prefix);
-	}
-	ptr += sprintf(ptr, "</%sPolygon>", prefix);
-
-	return (ptr-output);
+  int i;
+  char *ptr=output;
+
+  ptr += sprintf(ptr, "<%sPolygon", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if ( rtpoly_is_empty(ctx, poly) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+  ptr += sprintf(ptr, "<%souterBoundaryIs><%sLinearRing><%scoordinates>",
+                 prefix, prefix, prefix);
+  ptr += pointArray_toGML2(ctx, poly->rings[0], ptr, precision);
+  ptr += sprintf(ptr, "</%scoordinates></%sLinearRing></%souterBoundaryIs>", prefix, prefix, prefix);
+  for (i=1; i<poly->nrings; i++)
+  {
+    ptr += sprintf(ptr, "<%sinnerBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
+    ptr += pointArray_toGML2(ctx, poly->rings[i], ptr, precision);
+    ptr += sprintf(ptr, "</%scoordinates></%sLinearRing></%sinnerBoundaryIs>", prefix, prefix, prefix);
+  }
+  ptr += sprintf(ptr, "</%sPolygon>", prefix);
+
+  return (ptr-output);
 }
 
 static char *
 asgml2_poly(const RTCTX *ctx, const RTPOLY *poly, const char *srs, int precision, const char *prefix)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml2_poly_size(ctx, poly, srs, precision, prefix);
-	output = rtalloc(ctx, size);
-	asgml2_poly_buf(ctx, poly, srs, output, precision, prefix);
-	return output;
+  size = asgml2_poly_size(ctx, poly, srs, precision, prefix);
+  output = rtalloc(ctx, size);
+  asgml2_poly_buf(ctx, poly, srs, output, precision, prefix);
+  return output;
 }
 
 /*
@@ -430,38 +430,38 @@ static size_t
 asgml2_multi_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision,
                   const char *prefix)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
-	RTGEOM *subgeom;
-
-	/* the longest possible multi version */
-	size = sizeof("<MultiLineString></MultiLineString>");
-	size += 2*prefixlen;
-
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
-			size += asgml2_point_size(ctx, (RTPOINT*)subgeom, 0, precision, prefix);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			size += ( sizeof("<lineStringMember>/") + prefixlen ) * 2;
-			size += asgml2_line_size(ctx, (RTLINE*)subgeom, 0, precision, prefix);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			size += ( sizeof("<polygonMember>/") + prefixlen ) * 2;
-			size += asgml2_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, prefix);
-		}
-	}
-
-	return size;
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
+  RTGEOM *subgeom;
+
+  /* the longest possible multi version */
+  size = sizeof("<MultiLineString></MultiLineString>");
+  size += 2*prefixlen;
+
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
+      size += asgml2_point_size(ctx, (RTPOINT*)subgeom, 0, precision, prefix);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      size += ( sizeof("<lineStringMember>/") + prefixlen ) * 2;
+      size += asgml2_line_size(ctx, (RTLINE*)subgeom, 0, precision, prefix);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      size += ( sizeof("<polygonMember>/") + prefixlen ) * 2;
+      size += asgml2_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, prefix);
+    }
+  }
+
+  return size;
 }
 
 /*
@@ -471,56 +471,56 @@ static size_t
 asgml2_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, char *output,
                  int precision, const char *prefix)
 {
-	int type = col->type;
-	char *ptr, *gmltype;
-	int i;
-	RTGEOM *subgeom;
-
-	ptr = output;
-	gmltype="";
-
-	if 	(type == RTMULTIPOINTTYPE)   gmltype = "MultiPoint";
-	else if (type == RTMULTILINETYPE)	   gmltype = "MultiLineString";
-	else if (type == RTMULTIPOLYGONTYPE) gmltype = "MultiPolygon";
-
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-
-	if (!col->ngeoms)
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			ptr += sprintf(ptr, "<%spointMember>", prefix);
-			ptr += asgml2_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, prefix);
-			ptr += sprintf(ptr, "</%spointMember>", prefix);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			ptr += sprintf(ptr, "<%slineStringMember>", prefix);
-			ptr += asgml2_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, prefix);
-			ptr += sprintf(ptr, "</%slineStringMember>", prefix);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			ptr += sprintf(ptr, "<%spolygonMember>", prefix);
-			ptr += asgml2_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, prefix);
-			ptr += sprintf(ptr, "</%spolygonMember>", prefix);
-		}
-	}
-
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
-
-	return (ptr-output);
+  int type = col->type;
+  char *ptr, *gmltype;
+  int i;
+  RTGEOM *subgeom;
+
+  ptr = output;
+  gmltype="";
+
+  if   (type == RTMULTIPOINTTYPE)   gmltype = "MultiPoint";
+  else if (type == RTMULTILINETYPE)     gmltype = "MultiLineString";
+  else if (type == RTMULTIPOLYGONTYPE) gmltype = "MultiPolygon";
+
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+
+  if (!col->ngeoms)
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      ptr += sprintf(ptr, "<%spointMember>", prefix);
+      ptr += asgml2_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, prefix);
+      ptr += sprintf(ptr, "</%spointMember>", prefix);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      ptr += sprintf(ptr, "<%slineStringMember>", prefix);
+      ptr += asgml2_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, prefix);
+      ptr += sprintf(ptr, "</%slineStringMember>", prefix);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      ptr += sprintf(ptr, "<%spolygonMember>", prefix);
+      ptr += asgml2_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, prefix);
+      ptr += sprintf(ptr, "</%spolygonMember>", prefix);
+    }
+  }
+
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
+
+  return (ptr-output);
 }
 
 /*
@@ -530,13 +530,13 @@ static char *
 asgml2_multi(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision,
              const char *prefix)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml2_multi_size(ctx, col, srs, precision, prefix);
-	gml = rtalloc(ctx, size);
-	asgml2_multi_buf(ctx, col, srs, gml, precision, prefix);
-	return gml;
+  size = asgml2_multi_size(ctx, col, srs, precision, prefix);
+  gml = rtalloc(ctx, size);
+  asgml2_multi_buf(ctx, col, srs, gml, precision, prefix);
+  return gml;
 }
 
 
@@ -547,43 +547,43 @@ static size_t
 asgml2_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision,
                        const char *prefix)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
-	RTGEOM *subgeom;
-
-	size = sizeof("<MultiGeometry></MultiGeometry>");
-	size += (prefixlen * 2);
-
-	if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-
-		size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
-		if ( subgeom->type == RTPOINTTYPE)
-		{
-			size += asgml2_point_size(ctx, (RTPOINT*)subgeom, 0, precision, prefix);
-		}
-		else if ( subgeom->type == RTLINETYPE)
-		{
-			size += asgml2_line_size(ctx, (RTLINE*)subgeom, 0, precision, prefix);
-		}
-		else if ( subgeom->type == RTPOLYGONTYPE)
-		{
-			size += asgml2_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, prefix);
-		}
-		else if ( rtgeom_is_collection(ctx, subgeom) )
-		{
-			size += asgml2_collection_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, prefix);
-		}
-		else
-			rterror(ctx, "asgml2_collection_size: Unable to process geometry type!");
-	}
-
-
-	return size;
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
+  RTGEOM *subgeom;
+
+  size = sizeof("<MultiGeometry></MultiGeometry>");
+  size += (prefixlen * 2);
+
+  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+
+    size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
+    if ( subgeom->type == RTPOINTTYPE)
+    {
+      size += asgml2_point_size(ctx, (RTPOINT*)subgeom, 0, precision, prefix);
+    }
+    else if ( subgeom->type == RTLINETYPE)
+    {
+      size += asgml2_line_size(ctx, (RTLINE*)subgeom, 0, precision, prefix);
+    }
+    else if ( subgeom->type == RTPOLYGONTYPE)
+    {
+      size += asgml2_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, prefix);
+    }
+    else if ( rtgeom_is_collection(ctx, subgeom) )
+    {
+      size += asgml2_collection_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, prefix);
+    }
+    else
+      rterror(ctx, "asgml2_collection_size: Unable to process geometry type!");
+  }
+
+
+  return size;
 }
 
 /*
@@ -592,54 +592,54 @@ asgml2_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *sr
 static size_t
 asgml2_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, char *output, int precision, const char *prefix)
 {
-	char *ptr;
-	int i;
-	RTGEOM *subgeom;
-
-	ptr = output;
-
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-
-	if (!col->ngeoms)
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-
-		ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			ptr += asgml2_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, prefix);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			ptr += asgml2_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, prefix);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			ptr += asgml2_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, prefix);
-		}
-		else if (rtgeom_is_collection(ctx, subgeom))
-		{
-			if (subgeom->type == RTCOLLECTIONTYPE)
-				ptr += asgml2_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, prefix);
-			else
-				ptr += asgml2_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, prefix);
-		}
-		ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
-	}
-
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
-
-	return (ptr-output);
+  char *ptr;
+  int i;
+  RTGEOM *subgeom;
+
+  ptr = output;
+
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+
+  if (!col->ngeoms)
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+
+    ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      ptr += asgml2_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, prefix);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      ptr += asgml2_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, prefix);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      ptr += asgml2_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, prefix);
+    }
+    else if (rtgeom_is_collection(ctx, subgeom))
+    {
+      if (subgeom->type == RTCOLLECTIONTYPE)
+        ptr += asgml2_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, prefix);
+      else
+        ptr += asgml2_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, prefix);
+    }
+    ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
+  }
+
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
+
+  return (ptr-output);
 }
 
 /*
@@ -649,81 +649,81 @@ static char *
 asgml2_collection(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision,
                   const char *prefix)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml2_collection_size(ctx, col, srs, precision, prefix);
-	gml = rtalloc(ctx, size);
-	asgml2_collection_buf(ctx, col, srs, gml, precision, prefix);
-	return gml;
+  size = asgml2_collection_size(ctx, col, srs, precision, prefix);
+  gml = rtalloc(ctx, size);
+  asgml2_collection_buf(ctx, col, srs, gml, precision, prefix);
+  return gml;
 }
 
 
 static size_t
 pointArray_toGML2(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precision)
 {
-	int i;
-	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-
-	ptr = output;
-
-	if ( ! RTFLAGS_GET_Z(pa->flags) )
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT2D *pt;
-			pt = rt_getPoint2d_cp(ctx, pa, i);
-
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(ctx, x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(ctx, y);
-
-			if ( i ) ptr += sprintf(ptr, " ");
-			ptr += sprintf(ptr, "%s,%s", x, y);
-		}
-	}
-	else
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT3DZ *pt;
-			pt = rt_getPoint3dz_cp(ctx, pa, i);
-
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(ctx, x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(ctx, y);
-
-			if (fabs(pt->z) < OUT_MAX_DOUBLE)
-				sprintf(z, "%.*f", precision, pt->z);
-			else
-				sprintf(z, "%g", pt->z);
-			trim_trailing_zeros(ctx, z);
-
-			if ( i ) ptr += sprintf(ptr, " ");
-			ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
-		}
-	}
-
-	return ptr-output;
+  int i;
+  char *ptr;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+
+  ptr = output;
+
+  if ( ! RTFLAGS_GET_Z(pa->flags) )
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT2D *pt;
+      pt = rt_getPoint2d_cp(ctx, pa, i);
+
+      if (fabs(pt->x) < OUT_MAX_DOUBLE)
+        sprintf(x, "%.*f", precision, pt->x);
+      else
+        sprintf(x, "%g", pt->x);
+      trim_trailing_zeros(ctx, x);
+
+      if (fabs(pt->y) < OUT_MAX_DOUBLE)
+        sprintf(y, "%.*f", precision, pt->y);
+      else
+        sprintf(y, "%g", pt->y);
+      trim_trailing_zeros(ctx, y);
+
+      if ( i ) ptr += sprintf(ptr, " ");
+      ptr += sprintf(ptr, "%s,%s", x, y);
+    }
+  }
+  else
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT3DZ *pt;
+      pt = rt_getPoint3dz_cp(ctx, pa, i);
+
+      if (fabs(pt->x) < OUT_MAX_DOUBLE)
+        sprintf(x, "%.*f", precision, pt->x);
+      else
+        sprintf(x, "%g", pt->x);
+      trim_trailing_zeros(ctx, x);
+
+      if (fabs(pt->y) < OUT_MAX_DOUBLE)
+        sprintf(y, "%.*f", precision, pt->y);
+      else
+        sprintf(y, "%g", pt->y);
+      trim_trailing_zeros(ctx, y);
+
+      if (fabs(pt->z) < OUT_MAX_DOUBLE)
+        sprintf(z, "%.*f", precision, pt->z);
+      else
+        sprintf(z, "%g", pt->z);
+      trim_trailing_zeros(ctx, z);
+
+      if ( i ) ptr += sprintf(ptr, " ");
+      ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
+    }
+  }
+
+  return ptr-output;
 }
 
 
@@ -736,669 +736,669 @@ pointArray_toGML2(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precisio
 extern char *
 rtgeom_to_gml3(const RTCTX *ctx, const RTGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int type = geom->type;
+  int type = geom->type;
 
-	/* Return null for empty (#1377) */
-	if ( rtgeom_is_empty(ctx, geom) )
-		return NULL;
+  /* Return null for empty (#1377) */
+  if ( rtgeom_is_empty(ctx, geom) )
+    return NULL;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		return asgml3_point(ctx, (RTPOINT*)geom, srs, precision, opts, prefix, id);
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    return asgml3_point(ctx, (RTPOINT*)geom, srs, precision, opts, prefix, id);
 
-	case RTLINETYPE:
-		return asgml3_line(ctx, (RTLINE*)geom, srs, precision, opts, prefix, id);
+  case RTLINETYPE:
+    return asgml3_line(ctx, (RTLINE*)geom, srs, precision, opts, prefix, id);
 
-	case RTCIRCSTRINGTYPE:
-		return asgml3_circstring(ctx, (RTCIRCSTRING*)geom, srs, precision, opts, prefix, id );
+  case RTCIRCSTRINGTYPE:
+    return asgml3_circstring(ctx, (RTCIRCSTRING*)geom, srs, precision, opts, prefix, id );
 
-	case RTPOLYGONTYPE:
-		return asgml3_poly(ctx, (RTPOLY*)geom, srs, precision, opts, 0, prefix, id);
+  case RTPOLYGONTYPE:
+    return asgml3_poly(ctx, (RTPOLY*)geom, srs, precision, opts, 0, prefix, id);
 
-	case RTCURVEPOLYTYPE:
-		return asgml3_curvepoly(ctx, (RTCURVEPOLY*)geom, srs, precision, opts, prefix, id);
+  case RTCURVEPOLYTYPE:
+    return asgml3_curvepoly(ctx, (RTCURVEPOLY*)geom, srs, precision, opts, prefix, id);
 
-	case RTTRIANGLETYPE:
-		return asgml3_triangle(ctx, (RTTRIANGLE*)geom, srs, precision, opts, prefix, id);
+  case RTTRIANGLETYPE:
+    return asgml3_triangle(ctx, (RTTRIANGLE*)geom, srs, precision, opts, prefix, id);
 
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-		return asgml3_multi(ctx, (RTCOLLECTION*)geom, srs, precision, opts, prefix, id);
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+    return asgml3_multi(ctx, (RTCOLLECTION*)geom, srs, precision, opts, prefix, id);
 
-	case RTPOLYHEDRALSURFACETYPE:
-		return asgml3_psurface(ctx, (RTPSURFACE*)geom, srs, precision, opts, prefix, id);
+  case RTPOLYHEDRALSURFACETYPE:
+    return asgml3_psurface(ctx, (RTPSURFACE*)geom, srs, precision, opts, prefix, id);
 
-	case RTTINTYPE:
-		return asgml3_tin(ctx, (RTTIN*)geom, srs, precision, opts, prefix, id);
+  case RTTINTYPE:
+    return asgml3_tin(ctx, (RTTIN*)geom, srs, precision, opts, prefix, id);
 
-	case RTCOLLECTIONTYPE:
-		return asgml3_collection(ctx, (RTCOLLECTION*)geom, srs, precision, opts, prefix, id);
+  case RTCOLLECTIONTYPE:
+    return asgml3_collection(ctx, (RTCOLLECTION*)geom, srs, precision, opts, prefix, id);
 
-	case RTCOMPOUNDTYPE:
-		return asgml3_compound(ctx,  (RTCOMPOUND*)geom, srs, precision, opts, prefix, id );
+  case RTCOMPOUNDTYPE:
+    return asgml3_compound(ctx,  (RTCOMPOUND*)geom, srs, precision, opts, prefix, id );
 
-	case RTMULTICURVETYPE:
-		return asgml3_multicurve(ctx,  (RTMCURVE*)geom, srs, precision, opts, prefix, id );
+  case RTMULTICURVETYPE:
+    return asgml3_multicurve(ctx,  (RTMCURVE*)geom, srs, precision, opts, prefix, id );
 
-	case RTMULTISURFACETYPE:
-		return asgml3_multisurface(ctx,  (RTMSURFACE*)geom, srs, precision, opts, prefix, id );
+  case RTMULTISURFACETYPE:
+    return asgml3_multisurface(ctx,  (RTMSURFACE*)geom, srs, precision, opts, prefix, id );
 
-	default:
-		rterror(ctx, "rtgeom_to_gml3: '%s' geometry type not supported", rttype_name(ctx, type));
-		return NULL;
-	}
+  default:
+    rterror(ctx, "rtgeom_to_gml3: '%s' geometry type not supported", rttype_name(ctx, type));
+    return NULL;
+  }
 }
 
 static size_t
 asgml3_point_size(const RTCTX *ctx, const RTPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int size;
-	size_t prefixlen = strlen(prefix);
-
-	size = pointArray_GMLsize(ctx, point->point, precision);
-	size += ( sizeof("<point><pos>/") + (prefixlen*2) ) * 2;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
-	return size;
+  int size;
+  size_t prefixlen = strlen(prefix);
+
+  size = pointArray_GMLsize(ctx, point->point, precision);
+  size += ( sizeof("<point><pos>/") + (prefixlen*2) ) * 2;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
+  return size;
 }
 
 static size_t
 asgml3_point_buf(const RTCTX *ctx, const RTPOINT *point, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr = output;
-	int dimension=2;
-
-	if (RTFLAGS_GET_Z(point->flags)) dimension = 3;
-
-	ptr += sprintf(ptr, "<%sPoint", prefix);
-	if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if ( id )  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-	if ( rtpoint_is_empty(ctx, point) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-
-	ptr += sprintf(ptr, ">");
-	if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%spos srsDimension=\"%d\">", prefix, dimension);
-	else         ptr += sprintf(ptr, "<%spos>", prefix);
-	ptr += pointArray_toGML3(ctx, point->point, ptr, precision, opts);
-	ptr += sprintf(ptr, "</%spos></%sPoint>", prefix, prefix);
-
-	return (ptr-output);
+  char *ptr = output;
+  int dimension=2;
+
+  if (RTFLAGS_GET_Z(point->flags)) dimension = 3;
+
+  ptr += sprintf(ptr, "<%sPoint", prefix);
+  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if ( id )  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+  if ( rtpoint_is_empty(ctx, point) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+
+  ptr += sprintf(ptr, ">");
+  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%spos srsDimension=\"%d\">", prefix, dimension);
+  else         ptr += sprintf(ptr, "<%spos>", prefix);
+  ptr += pointArray_toGML3(ctx, point->point, ptr, precision, opts);
+  ptr += sprintf(ptr, "</%spos></%sPoint>", prefix, prefix);
+
+  return (ptr-output);
 }
 
 static char *
 asgml3_point(const RTCTX *ctx, const RTPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml3_point_size(ctx, point, srs, precision, opts, prefix, id);
-	output = rtalloc(ctx, size);
-	asgml3_point_buf(ctx, point, srs, output, precision, opts, prefix, id);
-	return output;
+  size = asgml3_point_size(ctx, point, srs, precision, opts, prefix, id);
+  output = rtalloc(ctx, size);
+  asgml3_point_buf(ctx, point, srs, output, precision, opts, prefix, id);
+  return output;
 }
 
 
 static size_t
 asgml3_line_size(const RTCTX *ctx, const RTLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int size;
-	size_t prefixlen = strlen(prefix);
-
-	size = pointArray_GMLsize(ctx, line->points, precision);
-	if ( opts & RT_GML_SHORTLINE )
-	{
-		size += (
-		            sizeof("<LineString><posList>/") +
-		            ( prefixlen * 2 )
-		        ) * 2;
-	}
-	else
-	{
-		size += (
-		            sizeof("<Curve><segments><LineStringSegment><posList>/") +
-		            ( prefixlen * 4 )
-		        ) * 2;
-	}
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
-	return size;
+  int size;
+  size_t prefixlen = strlen(prefix);
+
+  size = pointArray_GMLsize(ctx, line->points, precision);
+  if ( opts & RT_GML_SHORTLINE )
+  {
+    size += (
+                sizeof("<LineString><posList>/") +
+                ( prefixlen * 2 )
+            ) * 2;
+  }
+  else
+  {
+    size += (
+                sizeof("<Curve><segments><LineStringSegment><posList>/") +
+                ( prefixlen * 4 )
+            ) * 2;
+  }
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
+  return size;
 }
 
 static size_t
 asgml3_line_buf(const RTCTX *ctx, const RTLINE *line, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr=output;
-	int dimension=2;
-	int shortline = ( opts & RT_GML_SHORTLINE );
-
-	if (RTFLAGS_GET_Z(line->flags)) dimension = 3;
-
-	if ( shortline )
-	{
-		ptr += sprintf(ptr, "<%sLineString", prefix);
-	}
-	else
-	{
-		ptr += sprintf(ptr, "<%sCurve", prefix);
-	}
-
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-
-	if ( rtline_is_empty(ctx, line) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	if ( ! shortline )
-	{
-		ptr += sprintf(ptr, "<%ssegments>", prefix);
-		ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
-	}
-
-	if (IS_DIMS(opts))
-	{
-		ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
-		               prefix, dimension);
-	}
-	else
-	{
-		ptr += sprintf(ptr, "<%sposList>", prefix);
-	}
-
-	ptr += pointArray_toGML3(ctx, line->points, ptr, precision, opts);
-
-	ptr += sprintf(ptr, "</%sposList>", prefix);
-
-	if ( shortline )
-	{
-		ptr += sprintf(ptr, "</%sLineString>", prefix);
-	}
-	else
-	{
-		ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
-		ptr += sprintf(ptr, "</%ssegments>", prefix);
-		ptr += sprintf(ptr, "</%sCurve>", prefix);
-	}
-
-	return (ptr-output);
+  char *ptr=output;
+  int dimension=2;
+  int shortline = ( opts & RT_GML_SHORTLINE );
+
+  if (RTFLAGS_GET_Z(line->flags)) dimension = 3;
+
+  if ( shortline )
+  {
+    ptr += sprintf(ptr, "<%sLineString", prefix);
+  }
+  else
+  {
+    ptr += sprintf(ptr, "<%sCurve", prefix);
+  }
+
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+
+  if ( rtline_is_empty(ctx, line) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  if ( ! shortline )
+  {
+    ptr += sprintf(ptr, "<%ssegments>", prefix);
+    ptr += sprintf(ptr, "<%sLineStringSegment>", prefix);
+  }
+
+  if (IS_DIMS(opts))
+  {
+    ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">",
+                   prefix, dimension);
+  }
+  else
+  {
+    ptr += sprintf(ptr, "<%sposList>", prefix);
+  }
+
+  ptr += pointArray_toGML3(ctx, line->points, ptr, precision, opts);
+
+  ptr += sprintf(ptr, "</%sposList>", prefix);
+
+  if ( shortline )
+  {
+    ptr += sprintf(ptr, "</%sLineString>", prefix);
+  }
+  else
+  {
+    ptr += sprintf(ptr, "</%sLineStringSegment>", prefix);
+    ptr += sprintf(ptr, "</%ssegments>", prefix);
+    ptr += sprintf(ptr, "</%sCurve>", prefix);
+  }
+
+  return (ptr-output);
 }
 
 static char *
 asgml3_line(const RTCTX *ctx, const RTLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml3_line_size(ctx, line, srs, precision, opts, prefix, id);
-	output = rtalloc(ctx, size);
-	asgml3_line_buf(ctx, line, srs, output, precision, opts, prefix, id);
-	return output;
+  size = asgml3_line_size(ctx, line, srs, precision, opts, prefix, id);
+  output = rtalloc(ctx, size);
+  asgml3_line_buf(ctx, line, srs, output, precision, opts, prefix, id);
+  return output;
 }
 
 
 static size_t
 asgml3_circstring_size(const RTCTX *ctx, const RTCIRCSTRING *circ, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int size = pointArray_GMLsize(ctx,  circ->points, precision );
-	size_t prefixlen = strlen(prefix);
-	size += 2 * ( sizeof( "<Curve><segments>/" ) + 2 * prefixlen );
-	size += 2 * ( sizeof( "<ArcString><posList>/" ) + 2 * prefixlen );
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
-	return size;
+  int size = pointArray_GMLsize(ctx,  circ->points, precision );
+  size_t prefixlen = strlen(prefix);
+  size += 2 * ( sizeof( "<Curve><segments>/" ) + 2 * prefixlen );
+  size += 2 * ( sizeof( "<ArcString><posList>/" ) + 2 * prefixlen );
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
+  return size;
 }
 
 static size_t
 asgml3_circstring_buf(const RTCTX *ctx, const RTCIRCSTRING *circ, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char* ptr = output;
-	int dimension=2;
-
-	if (RTFLAGS_GET_Z(circ->flags))
-	{
-		dimension = 3;
-	}
-
-	ptr += sprintf(ptr, "<%sCurve", prefix);
-	if (srs)
-	{
-		ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	}
-	if (id)
-	{
-		ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-	}
-	ptr += sprintf(ptr, ">");
-	ptr += sprintf(ptr, "<%ssegments>", prefix);
-	ptr += sprintf(ptr, "<%sArcString>", prefix);
-	ptr += sprintf(ptr, "<%sposList", prefix);
-
-	if (IS_DIMS(opts))
-	{
-		ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
-	}
-	ptr += sprintf(ptr, ">");
-
-	ptr += pointArray_toGML3(ctx, circ->points, ptr, precision, opts);
-	ptr += sprintf(ptr, "</%sposList>", prefix);
-	ptr += sprintf(ptr, "</%sArcString>", prefix);
-	ptr += sprintf(ptr, "</%ssegments>", prefix);
-	ptr += sprintf(ptr, "</%sCurve>", prefix);
-	return (ptr-output);
+  char* ptr = output;
+  int dimension=2;
+
+  if (RTFLAGS_GET_Z(circ->flags))
+  {
+    dimension = 3;
+  }
+
+  ptr += sprintf(ptr, "<%sCurve", prefix);
+  if (srs)
+  {
+    ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  }
+  if (id)
+  {
+    ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+  }
+  ptr += sprintf(ptr, ">");
+  ptr += sprintf(ptr, "<%ssegments>", prefix);
+  ptr += sprintf(ptr, "<%sArcString>", prefix);
+  ptr += sprintf(ptr, "<%sposList", prefix);
+
+  if (IS_DIMS(opts))
+  {
+    ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
+  }
+  ptr += sprintf(ptr, ">");
+
+  ptr += pointArray_toGML3(ctx, circ->points, ptr, precision, opts);
+  ptr += sprintf(ptr, "</%sposList>", prefix);
+  ptr += sprintf(ptr, "</%sArcString>", prefix);
+  ptr += sprintf(ptr, "</%ssegments>", prefix);
+  ptr += sprintf(ptr, "</%sCurve>", prefix);
+  return (ptr-output);
 }
 
 static char *
 asgml3_circstring(const RTCTX *ctx,  const RTCIRCSTRING *circ, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml3_circstring_size(ctx, circ, srs, precision, opts, prefix, id);
-	output = rtalloc(ctx,  size );
-	asgml3_circstring_buf(ctx, circ, srs, output, precision, opts, prefix, id);
-	return output;
+  size = asgml3_circstring_size(ctx, circ, srs, precision, opts, prefix, id);
+  output = rtalloc(ctx,  size );
+  asgml3_circstring_buf(ctx, circ, srs, output, precision, opts, prefix, id);
+  return output;
 }
 
 
 static size_t
 asgml3_poly_size(const RTCTX *ctx, const RTPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	size_t size;
-	size_t prefixlen = strlen(prefix);
-	int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
+  int i;
 
-	size = ( sizeof("<PolygonPatch><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
-	size += ( sizeof("<interior><LinearRing>//") + (prefixlen*2) ) * 2 * (poly->nrings - 1);
-	size += ( sizeof("<posList></posList>") + (prefixlen*2) ) * poly->nrings;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'") * poly->nrings;
+  size = ( sizeof("<PolygonPatch><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
+  size += ( sizeof("<interior><LinearRing>//") + (prefixlen*2) ) * 2 * (poly->nrings - 1);
+  size += ( sizeof("<posList></posList>") + (prefixlen*2) ) * poly->nrings;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'") * poly->nrings;
 
-	for (i=0; i<poly->nrings; i++)
-		size += pointArray_GMLsize(ctx, poly->rings[i], precision);
+  for (i=0; i<poly->nrings; i++)
+    size += pointArray_GMLsize(ctx, poly->rings[i], precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgml3_poly_buf(const RTCTX *ctx, const RTPOLY *poly, const char *srs, char *output, int precision, int opts, int is_patch, const char *prefix, const char *id)
 {
-	int i;
-	char *ptr=output;
-	int dimension=2;
-
-	if (RTFLAGS_GET_Z(poly->flags)) dimension = 3;
-	if (is_patch)
-	{
-		ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
-
-	}
-	else
-	{
-		ptr += sprintf(ptr, "<%sPolygon", prefix);
-	}
-
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-
-	if ( rtpoly_is_empty(ctx, poly) )
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
-	if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
-	else         ptr += sprintf(ptr, "<%sposList>", prefix);
-
-	ptr += pointArray_toGML3(ctx, poly->rings[0], ptr, precision, opts);
-	ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
-	               prefix, prefix, prefix);
-	for (i=1; i<poly->nrings; i++)
-	{
-		ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
-		if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
-		else         ptr += sprintf(ptr, "<%sposList>", prefix);
-		ptr += pointArray_toGML3(ctx, poly->rings[i], ptr, precision, opts);
-		ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
-		               prefix, prefix, prefix);
-	}
-	if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
-	else ptr += sprintf(ptr, "</%sPolygon>", prefix);
-
-	return (ptr-output);
+  int i;
+  char *ptr=output;
+  int dimension=2;
+
+  if (RTFLAGS_GET_Z(poly->flags)) dimension = 3;
+  if (is_patch)
+  {
+    ptr += sprintf(ptr, "<%sPolygonPatch", prefix);
+
+  }
+  else
+  {
+    ptr += sprintf(ptr, "<%sPolygon", prefix);
+  }
+
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+
+  if ( rtpoly_is_empty(ctx, poly) )
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
+  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
+  else         ptr += sprintf(ptr, "<%sposList>", prefix);
+
+  ptr += pointArray_toGML3(ctx, poly->rings[0], ptr, precision, opts);
+  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
+                 prefix, prefix, prefix);
+  for (i=1; i<poly->nrings; i++)
+  {
+    ptr += sprintf(ptr, "<%sinterior><%sLinearRing>", prefix, prefix);
+    if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
+    else         ptr += sprintf(ptr, "<%sposList>", prefix);
+    ptr += pointArray_toGML3(ctx, poly->rings[i], ptr, precision, opts);
+    ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sinterior>",
+                   prefix, prefix, prefix);
+  }
+  if (is_patch) ptr += sprintf(ptr, "</%sPolygonPatch>", prefix);
+  else ptr += sprintf(ptr, "</%sPolygon>", prefix);
+
+  return (ptr-output);
 }
 
 static char *
 asgml3_poly(const RTCTX *ctx, const RTPOLY *poly, const char *srs, int precision, int opts, int is_patch, const char *prefix, const char *id)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml3_poly_size(ctx, poly, srs, precision, opts, prefix, id);
-	output = rtalloc(ctx, size);
-	asgml3_poly_buf(ctx, poly, srs, output, precision, opts, is_patch, prefix, id);
-	return output;
+  size = asgml3_poly_size(ctx, poly, srs, precision, opts, prefix, id);
+  output = rtalloc(ctx, size);
+  asgml3_poly_buf(ctx, poly, srs, output, precision, opts, is_patch, prefix, id);
+  return output;
 }
 
-static size_t 
+static size_t
 asgml3_compound_size(const RTCTX *ctx, const RTCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
-	int i;
-	size_t size;
-	RTGEOM *subgeom;
-	size_t prefixlen = strlen(prefix);
-
-	size = ( sizeof( "<Curve></Curve>" ) + 2 * prefixlen );
-
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-
-	size += ( sizeof("<segments></segments>") + 2 * prefixlen );
-
-	for(i= 0; i < col->ngeoms; ++i )
-	{
-		subgeom = col->geoms[i];
-		if ( subgeom->type == RTLINETYPE )
-		{
-
-			size += sizeof( "<LineStringSegment></LineStringSegment" ) + 2 * prefixlen;
-			size += sizeof( "<posList></posList" ) + 2 * prefixlen;
-			size += pointArray_GMLsize(ctx,  ((RTLINE*)subgeom)->points, precision );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			size += sizeof( "<ArcString><posList></ArcString></posList>") + 4 * prefixlen;
-			size += pointArray_GMLsize(ctx,  ((RTCIRCSTRING*)subgeom)->points, precision );
-		}
-		else
-		{
-			continue;
-		}
-		if (IS_DIMS(opts))
-		{
-			size += sizeof(" srsDimension='x'");
-		}
-	}
-	return size;
+  int i;
+  size_t size;
+  RTGEOM *subgeom;
+  size_t prefixlen = strlen(prefix);
+
+  size = ( sizeof( "<Curve></Curve>" ) + 2 * prefixlen );
+
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+
+  size += ( sizeof("<segments></segments>") + 2 * prefixlen );
+
+  for(i= 0; i < col->ngeoms; ++i )
+  {
+    subgeom = col->geoms[i];
+    if ( subgeom->type == RTLINETYPE )
+    {
+
+      size += sizeof( "<LineStringSegment></LineStringSegment" ) + 2 * prefixlen;
+      size += sizeof( "<posList></posList" ) + 2 * prefixlen;
+      size += pointArray_GMLsize(ctx,  ((RTLINE*)subgeom)->points, precision );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      size += sizeof( "<ArcString><posList></ArcString></posList>") + 4 * prefixlen;
+      size += pointArray_GMLsize(ctx,  ((RTCIRCSTRING*)subgeom)->points, precision );
+    }
+    else
+    {
+      continue;
+    }
+    if (IS_DIMS(opts))
+    {
+      size += sizeof(" srsDimension='x'");
+    }
+  }
+  return size;
 }
 
-static size_t 
+static size_t
 asgml3_compound_buf(const RTCTX *ctx, const RTCOMPOUND *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	RTGEOM *subgeom;
-	int i;
-	char* ptr = output;
-	int dimension=2;
-
-	if (RTFLAGS_GET_Z(col->flags))
-	{
-		dimension = 3;
-	}
-
-	ptr += sprintf( ptr, "<%sCurve", prefix );
-	if (srs)
-	{
-		ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	}
-	if (id)
-	{
-		ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
-	}
-	ptr += sprintf( ptr, ">" );
-	ptr += sprintf( ptr, "<%ssegments>", prefix );
-
-	for( i = 0; i < col->ngeoms; ++i )
-	{
-		subgeom = col->geoms[i];
-		if( subgeom->type != RTLINETYPE && subgeom->type != RTCIRCSTRINGTYPE )
-		{
-			continue;
-		}
-
-		if ( subgeom->type == RTLINETYPE )
-		{
-			ptr += sprintf( ptr, "<%sLineStringSegment><%sposList", prefix, prefix );
-			if (IS_DIMS(opts))
-			{
-				ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
-			}
-			ptr += sprintf(ptr, ">");
-			ptr += pointArray_toGML3(ctx, ((RTCIRCSTRING*)subgeom)->points, ptr, precision, opts);
-			ptr += sprintf( ptr, "</%sposList></%sLineStringSegment>", prefix, prefix );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			ptr += sprintf( ptr, "<%sArcString><%sposList" , prefix, prefix );
-			if (IS_DIMS(opts))
-			{
-				ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
-			}
-			ptr += sprintf(ptr, ">");
-			ptr += pointArray_toGML3(ctx, ((RTLINE*)subgeom)->points, ptr, precision, opts);
-			ptr += sprintf( ptr, "</%sposList></%sArcString>", prefix, prefix );
-		}
-	}
-
-	ptr += sprintf( ptr, "</%ssegments>", prefix );
-	ptr += sprintf( ptr, "</%sCurve>", prefix );
-	return ( ptr - output );
+  RTGEOM *subgeom;
+  int i;
+  char* ptr = output;
+  int dimension=2;
+
+  if (RTFLAGS_GET_Z(col->flags))
+  {
+    dimension = 3;
+  }
+
+  ptr += sprintf( ptr, "<%sCurve", prefix );
+  if (srs)
+  {
+    ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  }
+  if (id)
+  {
+    ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
+  }
+  ptr += sprintf( ptr, ">" );
+  ptr += sprintf( ptr, "<%ssegments>", prefix );
+
+  for( i = 0; i < col->ngeoms; ++i )
+  {
+    subgeom = col->geoms[i];
+    if( subgeom->type != RTLINETYPE && subgeom->type != RTCIRCSTRINGTYPE )
+    {
+      continue;
+    }
+
+    if ( subgeom->type == RTLINETYPE )
+    {
+      ptr += sprintf( ptr, "<%sLineStringSegment><%sposList", prefix, prefix );
+      if (IS_DIMS(opts))
+      {
+        ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
+      }
+      ptr += sprintf(ptr, ">");
+      ptr += pointArray_toGML3(ctx, ((RTCIRCSTRING*)subgeom)->points, ptr, precision, opts);
+      ptr += sprintf( ptr, "</%sposList></%sLineStringSegment>", prefix, prefix );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      ptr += sprintf( ptr, "<%sArcString><%sposList" , prefix, prefix );
+      if (IS_DIMS(opts))
+      {
+        ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
+      }
+      ptr += sprintf(ptr, ">");
+      ptr += pointArray_toGML3(ctx, ((RTLINE*)subgeom)->points, ptr, precision, opts);
+      ptr += sprintf( ptr, "</%sposList></%sArcString>", prefix, prefix );
+    }
+  }
+
+  ptr += sprintf( ptr, "</%ssegments>", prefix );
+  ptr += sprintf( ptr, "</%sCurve>", prefix );
+  return ( ptr - output );
 }
 
 static char *
 asgml3_compound(const RTCTX *ctx, const RTCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
-	char* gml;
-	size_t size;
+  char* gml;
+  size_t size;
 
-	size = asgml3_compound_size(ctx,  col, srs, precision, opts, prefix, id );
-	gml = rtalloc(ctx,  size );
-	asgml3_compound_buf(ctx,  col, srs, gml, precision, opts, prefix, id );
-	return gml;
+  size = asgml3_compound_size(ctx,  col, srs, precision, opts, prefix, id );
+  gml = rtalloc(ctx,  size );
+  asgml3_compound_buf(ctx,  col, srs, gml, precision, opts, prefix, id );
+  return gml;
 }
 
 static size_t asgml3_curvepoly_size(const RTCTX *ctx, const RTCURVEPOLY* poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	size_t prefixlen = strlen(prefix);
-	RTGEOM* subgeom;
-	size_t size = sizeof( "<Polygon></Polygon" ) + 2 * prefixlen;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	int i;
-
-	for( i = 0; i < poly->nrings; ++i )
-	{
-		if( i == 0 )
-		{
-			size += sizeof( "<exterior></exterior>" ) + 2 * prefixlen;
-		}
-		else
-		{
-			size += sizeof( "<interior></interior>" ) + 2 * prefixlen;
-		}
-		subgeom = poly->rings[i];
-
-		if ( subgeom->type == RTLINETYPE )
-		{
-			size += sizeof("<LinearRing></LinearRing>") + 2 * prefixlen;
-			size += sizeof("<posList></posList") + 2 * prefixlen;
-			if (IS_DIMS(opts))
-			{
-				size += sizeof(" srsDimension='x'");
-			}
-			size += pointArray_GMLsize(ctx,  ((RTLINE*)subgeom)->points, precision );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			size += sizeof("<Ring></Ring>") + 2 * prefixlen;
-			size += sizeof("<CurveMember></CurveMember>") + 2 * prefixlen;
-			size += asgml3_circstring_size(ctx, (RTCIRCSTRING*)subgeom, srs, precision, opts, prefix, id);
-		}
-		else if( subgeom->type == RTCOMPOUNDTYPE )
-		{
-			size += sizeof("<Ring></Ring>") + 2 * prefixlen;
-			size += sizeof("<curveMember></curveMember>") + 2 * prefixlen;
-			size += asgml3_compound_size(ctx,  (RTCOMPOUND*)subgeom, srs, precision, opts, prefix, id );
-		}
-	}
-	return size;
+  size_t prefixlen = strlen(prefix);
+  RTGEOM* subgeom;
+  size_t size = sizeof( "<Polygon></Polygon" ) + 2 * prefixlen;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  int i;
+
+  for( i = 0; i < poly->nrings; ++i )
+  {
+    if( i == 0 )
+    {
+      size += sizeof( "<exterior></exterior>" ) + 2 * prefixlen;
+    }
+    else
+    {
+      size += sizeof( "<interior></interior>" ) + 2 * prefixlen;
+    }
+    subgeom = poly->rings[i];
+
+    if ( subgeom->type == RTLINETYPE )
+    {
+      size += sizeof("<LinearRing></LinearRing>") + 2 * prefixlen;
+      size += sizeof("<posList></posList") + 2 * prefixlen;
+      if (IS_DIMS(opts))
+      {
+        size += sizeof(" srsDimension='x'");
+      }
+      size += pointArray_GMLsize(ctx,  ((RTLINE*)subgeom)->points, precision );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      size += sizeof("<Ring></Ring>") + 2 * prefixlen;
+      size += sizeof("<CurveMember></CurveMember>") + 2 * prefixlen;
+      size += asgml3_circstring_size(ctx, (RTCIRCSTRING*)subgeom, srs, precision, opts, prefix, id);
+    }
+    else if( subgeom->type == RTCOMPOUNDTYPE )
+    {
+      size += sizeof("<Ring></Ring>") + 2 * prefixlen;
+      size += sizeof("<curveMember></curveMember>") + 2 * prefixlen;
+      size += asgml3_compound_size(ctx,  (RTCOMPOUND*)subgeom, srs, precision, opts, prefix, id );
+    }
+  }
+  return size;
 }
 
 static size_t asgml3_curvepoly_buf(const RTCTX *ctx, const RTCURVEPOLY* poly, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	int i;
-	RTGEOM* subgeom;
-	char *ptr=output;
-	int dimension=2;
-
-	if (RTFLAGS_GET_Z(poly->flags))
-	{
-		dimension = 3;
-	}
-
-	ptr += sprintf( ptr, "<%sPolygon", prefix );
-	if (srs)
-	{
-		ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	}
-	if (id)
-	{
-		ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
-	}
-	ptr += sprintf(ptr, ">");
-
-	for( i = 0; i < poly->nrings; ++i )
-	{
-		if( i == 0 )
-		{
-			ptr += sprintf( ptr, "<%sexterior>", prefix);
-		}
-		else
-		{
-			ptr += sprintf( ptr, "<%sinterior>", prefix);
-		}
-
-		subgeom = poly->rings[i];
-		if ( subgeom->type == RTLINETYPE )
-		{
-			ptr += sprintf( ptr, "<%sLinearRing>", prefix );
-			ptr += sprintf( ptr, "<%sposList", prefix );
-			if (IS_DIMS(opts))
-			{
-				ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
-			}
-			ptr += sprintf( ptr, ">" );
-			ptr += pointArray_toGML3(ctx, ((RTLINE*)subgeom)->points, ptr, precision, opts);
-			ptr += sprintf( ptr, "</%sposList>", prefix );
-			ptr += sprintf( ptr, "</%sLinearRing>", prefix );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			ptr += sprintf( ptr, "<%sRing>", prefix );
-			ptr += sprintf( ptr, "<%scurveMember>", prefix );
-			ptr += asgml3_circstring_buf(ctx,  (RTCIRCSTRING*)subgeom, srs, ptr, precision, opts, prefix, id );
-			ptr += sprintf( ptr, "</%scurveMember>", prefix );
-			ptr += sprintf( ptr, "</%sRing>", prefix );
-		}
-		else if( subgeom->type == RTCOMPOUNDTYPE )
-		{
-			ptr += sprintf( ptr, "<%sRing>", prefix );
-			ptr += sprintf( ptr, "<%scurveMember>", prefix );
-			ptr += asgml3_compound_buf(ctx,  (RTCOMPOUND*)subgeom, srs, ptr, precision, opts, prefix, id );
-			ptr += sprintf( ptr, "</%scurveMember>", prefix );
-			ptr += sprintf( ptr, "</%sRing>", prefix );
-		}
-
-		if( i == 0 )
-		{
-			ptr += sprintf( ptr, "</%sexterior>", prefix);
-		}
-		else
-		{
-			ptr += sprintf( ptr, "</%sinterior>", prefix);
-		}
-	}
-
-	ptr += sprintf( ptr, "</%sPolygon>", prefix );
-	return (ptr - output);
+  int i;
+  RTGEOM* subgeom;
+  char *ptr=output;
+  int dimension=2;
+
+  if (RTFLAGS_GET_Z(poly->flags))
+  {
+    dimension = 3;
+  }
+
+  ptr += sprintf( ptr, "<%sPolygon", prefix );
+  if (srs)
+  {
+    ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  }
+  if (id)
+  {
+    ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
+  }
+  ptr += sprintf(ptr, ">");
+
+  for( i = 0; i < poly->nrings; ++i )
+  {
+    if( i == 0 )
+    {
+      ptr += sprintf( ptr, "<%sexterior>", prefix);
+    }
+    else
+    {
+      ptr += sprintf( ptr, "<%sinterior>", prefix);
+    }
+
+    subgeom = poly->rings[i];
+    if ( subgeom->type == RTLINETYPE )
+    {
+      ptr += sprintf( ptr, "<%sLinearRing>", prefix );
+      ptr += sprintf( ptr, "<%sposList", prefix );
+      if (IS_DIMS(opts))
+      {
+        ptr += sprintf(ptr, " srsDimension=\"%d\"", dimension);
+      }
+      ptr += sprintf( ptr, ">" );
+      ptr += pointArray_toGML3(ctx, ((RTLINE*)subgeom)->points, ptr, precision, opts);
+      ptr += sprintf( ptr, "</%sposList>", prefix );
+      ptr += sprintf( ptr, "</%sLinearRing>", prefix );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      ptr += sprintf( ptr, "<%sRing>", prefix );
+      ptr += sprintf( ptr, "<%scurveMember>", prefix );
+      ptr += asgml3_circstring_buf(ctx,  (RTCIRCSTRING*)subgeom, srs, ptr, precision, opts, prefix, id );
+      ptr += sprintf( ptr, "</%scurveMember>", prefix );
+      ptr += sprintf( ptr, "</%sRing>", prefix );
+    }
+    else if( subgeom->type == RTCOMPOUNDTYPE )
+    {
+      ptr += sprintf( ptr, "<%sRing>", prefix );
+      ptr += sprintf( ptr, "<%scurveMember>", prefix );
+      ptr += asgml3_compound_buf(ctx,  (RTCOMPOUND*)subgeom, srs, ptr, precision, opts, prefix, id );
+      ptr += sprintf( ptr, "</%scurveMember>", prefix );
+      ptr += sprintf( ptr, "</%sRing>", prefix );
+    }
+
+    if( i == 0 )
+    {
+      ptr += sprintf( ptr, "</%sexterior>", prefix);
+    }
+    else
+    {
+      ptr += sprintf( ptr, "</%sinterior>", prefix);
+    }
+  }
+
+  ptr += sprintf( ptr, "</%sPolygon>", prefix );
+  return (ptr - output);
 }
 
 static char* asgml3_curvepoly(const RTCTX *ctx, const RTCURVEPOLY* poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char* gml;
-	size_t size;
+  char* gml;
+  size_t size;
 
-	size = asgml3_curvepoly_size(ctx,  poly, srs, precision, opts, prefix, id );
-	gml = rtalloc(ctx,  size );
-	asgml3_curvepoly_buf(ctx,  poly, srs, gml, precision, opts, prefix, id );
-	return gml;
+  size = asgml3_curvepoly_size(ctx,  poly, srs, precision, opts, prefix, id );
+  gml = rtalloc(ctx,  size );
+  asgml3_curvepoly_buf(ctx,  poly, srs, gml, precision, opts, prefix, id );
+  return gml;
 }
 
 
 static size_t
 asgml3_triangle_size(const RTCTX *ctx, const RTTRIANGLE *triangle, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	size_t size;
-	size_t prefixlen = strlen(prefix);
+  size_t size;
+  size_t prefixlen = strlen(prefix);
 
-	size =  ( sizeof("<Triangle><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
-	size +=   sizeof("<posList></posList>") + (prefixlen*2);
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(prefix) + strlen(id) + sizeof(" id=..");
-	if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
+  size =  ( sizeof("<Triangle><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
+  size +=   sizeof("<posList></posList>") + (prefixlen*2);
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(prefix) + strlen(id) + sizeof(" id=..");
+  if (IS_DIMS(opts)) size += sizeof(" srsDimension='x'");
 
-	size += pointArray_GMLsize(ctx, triangle->points, precision);
+  size += pointArray_GMLsize(ctx, triangle->points, precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asgml3_triangle_buf(const RTCTX *ctx, const RTTRIANGLE *triangle, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr=output;
-	int dimension=2;
+  char *ptr=output;
+  int dimension=2;
 
-	if (RTFLAGS_GET_Z(triangle->flags)) dimension = 3;
-	ptr += sprintf(ptr, "<%sTriangle", prefix);
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-	ptr += sprintf(ptr, ">");
+  if (RTFLAGS_GET_Z(triangle->flags)) dimension = 3;
+  ptr += sprintf(ptr, "<%sTriangle", prefix);
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+  ptr += sprintf(ptr, ">");
 
-	ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
-	if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
-	else         ptr += sprintf(ptr, "<%sposList>", prefix);
+  ptr += sprintf(ptr, "<%sexterior><%sLinearRing>", prefix, prefix);
+  if (IS_DIMS(opts)) ptr += sprintf(ptr, "<%sposList srsDimension=\"%d\">", prefix, dimension);
+  else         ptr += sprintf(ptr, "<%sposList>", prefix);
 
-	ptr += pointArray_toGML3(ctx, triangle->points, ptr, precision, opts);
-	ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
-	               prefix, prefix, prefix);
+  ptr += pointArray_toGML3(ctx, triangle->points, ptr, precision, opts);
+  ptr += sprintf(ptr, "</%sposList></%sLinearRing></%sexterior>",
+                 prefix, prefix, prefix);
 
-	ptr += sprintf(ptr, "</%sTriangle>", prefix);
+  ptr += sprintf(ptr, "</%sTriangle>", prefix);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 asgml3_triangle(const RTCTX *ctx, const RTTRIANGLE *triangle, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asgml3_triangle_size(ctx, triangle, srs, precision, opts, prefix, id);
-	output = rtalloc(ctx, size);
-	asgml3_triangle_buf(ctx, triangle, srs, output, precision, opts, prefix, id);
-	return output;
+  size = asgml3_triangle_size(ctx, triangle, srs, precision, opts, prefix, id);
+  output = rtalloc(ctx, size);
+  asgml3_triangle_buf(ctx, triangle, srs, output, precision, opts, prefix, id);
+  return output;
 }
 
 
@@ -1410,38 +1410,38 @@ asgml3_triangle(const RTCTX *ctx, const RTTRIANGLE *triangle, const char *srs, i
 static size_t
 asgml3_multi_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
-	RTGEOM *subgeom;
-
-	/* the longest possible multi version */
-	size = sizeof("<MultiLineString></MultiLineString>") + prefixlen*2;
-
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
-			size += asgml3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			size += ( sizeof("<curveMember>/") + prefixlen ) * 2;
-			size += asgml3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			size += ( sizeof("<surfaceMember>/") + prefixlen ) * 2;
-			size += asgml3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, prefix, id);
-		}
-	}
-
-	return size;
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
+  RTGEOM *subgeom;
+
+  /* the longest possible multi version */
+  size = sizeof("<MultiLineString></MultiLineString>") + prefixlen*2;
+
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
+      size += asgml3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      size += ( sizeof("<curveMember>/") + prefixlen ) * 2;
+      size += asgml3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      size += ( sizeof("<surfaceMember>/") + prefixlen ) * 2;
+      size += asgml3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, prefix, id);
+    }
+  }
+
+  return size;
 }
 
 /*
@@ -1450,57 +1450,57 @@ asgml3_multi_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, in
 static size_t
 asgml3_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	int type = col->type;
-	char *ptr, *gmltype;
-	int i;
-	RTGEOM *subgeom;
-
-	ptr = output;
-	gmltype="";
-
-	if 	(type == RTMULTIPOINTTYPE)   gmltype = "MultiPoint";
-	else if (type == RTMULTILINETYPE)    gmltype = "MultiCurve";
-	else if (type == RTMULTIPOLYGONTYPE) gmltype = "MultiSurface";
-
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-
-	if (!col->ngeoms)
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			ptr += sprintf(ptr, "<%spointMember>", prefix);
-			ptr += asgml3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
-			ptr += sprintf(ptr, "</%spointMember>", prefix);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			ptr += sprintf(ptr, "<%scurveMember>", prefix);
-			ptr += asgml3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
-			ptr += sprintf(ptr, "</%scurveMember>", prefix);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			ptr += sprintf(ptr, "<%ssurfaceMember>", prefix);
-			ptr += asgml3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
-			ptr += sprintf(ptr, "</%ssurfaceMember>", prefix);
-		}
-	}
-
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
-
-	return (ptr-output);
+  int type = col->type;
+  char *ptr, *gmltype;
+  int i;
+  RTGEOM *subgeom;
+
+  ptr = output;
+  gmltype="";
+
+  if   (type == RTMULTIPOINTTYPE)   gmltype = "MultiPoint";
+  else if (type == RTMULTILINETYPE)    gmltype = "MultiCurve";
+  else if (type == RTMULTIPOLYGONTYPE) gmltype = "MultiSurface";
+
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+
+  if (!col->ngeoms)
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      ptr += sprintf(ptr, "<%spointMember>", prefix);
+      ptr += asgml3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
+      ptr += sprintf(ptr, "</%spointMember>", prefix);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      ptr += sprintf(ptr, "<%scurveMember>", prefix);
+      ptr += asgml3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
+      ptr += sprintf(ptr, "</%scurveMember>", prefix);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      ptr += sprintf(ptr, "<%ssurfaceMember>", prefix);
+      ptr += asgml3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
+      ptr += sprintf(ptr, "</%ssurfaceMember>", prefix);
+    }
+  }
+
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
+
+  return (ptr-output);
 }
 
 /*
@@ -1509,33 +1509,33 @@ asgml3_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, cha
 static char *
 asgml3_multi(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml3_multi_size(ctx, col, srs, precision, opts, prefix, id);
-	gml = rtalloc(ctx, size);
-	asgml3_multi_buf(ctx, col, srs, gml, precision, opts, prefix, id);
-	return gml;
+  size = asgml3_multi_size(ctx, col, srs, precision, opts, prefix, id);
+  gml = rtalloc(ctx, size);
+  asgml3_multi_buf(ctx, col, srs, gml, precision, opts, prefix, id);
+  return gml;
 }
 
 
 static size_t
 asgml3_psurface_size(const RTCTX *ctx, const RTPSURFACE *psur, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
 
-	size = (sizeof("<PolyhedralSurface><polygonPatches>/") + prefixlen*2) * 2;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  size = (sizeof("<PolyhedralSurface><polygonPatches>/") + prefixlen*2) * 2;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
 
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		size += asgml3_poly_size(ctx, psur->geoms[i], 0, precision, opts, prefix, id);
-	}
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    size += asgml3_poly_size(ctx, psur->geoms[i], 0, precision, opts, prefix, id);
+  }
 
-	return size;
+  return size;
 }
 
 
@@ -1545,27 +1545,27 @@ asgml3_psurface_size(const RTCTX *ctx, const RTPSURFACE *psur, const char *srs,
 static size_t
 asgml3_psurface_buf(const RTCTX *ctx, const RTPSURFACE *psur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr;
-	int i;
+  char *ptr;
+  int i;
 
-	ptr = output;
+  ptr = output;
 
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%sPolyhedralSurface", prefix);
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-	ptr += sprintf(ptr, "><%spolygonPatches>", prefix);
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%sPolyhedralSurface", prefix);
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+  ptr += sprintf(ptr, "><%spolygonPatches>", prefix);
 
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		ptr += asgml3_poly_buf(ctx, psur->geoms[i], 0, ptr, precision, opts, 1, prefix, id);
-	}
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    ptr += asgml3_poly_buf(ctx, psur->geoms[i], 0, ptr, precision, opts, 1, prefix, id);
+  }
 
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%spolygonPatches></%sPolyhedralSurface>",
-	               prefix, prefix);
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%spolygonPatches></%sPolyhedralSurface>",
+                 prefix, prefix);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 /*
@@ -1574,33 +1574,33 @@ asgml3_psurface_buf(const RTCTX *ctx, const RTPSURFACE *psur, const char *srs, c
 static char *
 asgml3_psurface(const RTCTX *ctx, const RTPSURFACE *psur, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml3_psurface_size(ctx, psur, srs, precision, opts, prefix, id);
-	gml = rtalloc(ctx, size);
-	asgml3_psurface_buf(ctx, psur, srs, gml, precision, opts, prefix, id);
-	return gml;
+  size = asgml3_psurface_size(ctx, psur, srs, precision, opts, prefix, id);
+  gml = rtalloc(ctx, size);
+  asgml3_psurface_buf(ctx, psur, srs, gml, precision, opts, prefix, id);
+  return gml;
 }
 
 
 static size_t
 asgml3_tin_size(const RTCTX *ctx, const RTTIN *tin, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
 
-	size = (sizeof("<Tin><trianglePatches>/") + prefixlen*2) * 2;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  size = (sizeof("<Tin><trianglePatches>/") + prefixlen*2) * 2;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
 
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		size += asgml3_triangle_size(ctx, tin->geoms[i], 0, precision, opts, prefix, id);
-	}
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    size += asgml3_triangle_size(ctx, tin->geoms[i], 0, precision, opts, prefix, id);
+  }
 
-	return size;
+  return size;
 }
 
 
@@ -1610,27 +1610,27 @@ asgml3_tin_size(const RTCTX *ctx, const RTTIN *tin, const char *srs, int precisi
 static size_t
 asgml3_tin_buf(const RTCTX *ctx, const RTTIN *tin, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr;
-	int i;
+  char *ptr;
+  int i;
 
-	ptr = output;
+  ptr = output;
 
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%sTin", prefix);
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-	else	 ptr += sprintf(ptr, "><%strianglePatches>", prefix);
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%sTin", prefix);
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+  else   ptr += sprintf(ptr, "><%strianglePatches>", prefix);
 
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		ptr += asgml3_triangle_buf(ctx, tin->geoms[i], 0, ptr, precision,
-		                           opts, prefix, id);
-	}
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    ptr += asgml3_triangle_buf(ctx, tin->geoms[i], 0, ptr, precision,
+                               opts, prefix, id);
+  }
 
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%strianglePatches></%sTin>", prefix, prefix);
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%strianglePatches></%sTin>", prefix, prefix);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 /*
@@ -1639,109 +1639,109 @@ asgml3_tin_buf(const RTCTX *ctx, const RTTIN *tin, const char *srs, char *output
 static char *
 asgml3_tin(const RTCTX *ctx, const RTTIN *tin, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml3_tin_size(ctx, tin, srs, precision, opts, prefix, id);
-	gml = rtalloc(ctx, size);
-	asgml3_tin_buf(ctx, tin, srs, gml, precision, opts, prefix, id);
-	return gml;
+  size = asgml3_tin_size(ctx, tin, srs, precision, opts, prefix, id);
+  gml = rtalloc(ctx, size);
+  asgml3_tin_buf(ctx, tin, srs, gml, precision, opts, prefix, id);
+  return gml;
 }
 
 static size_t
 asgml3_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	int i;
-	size_t size;
-	size_t prefixlen = strlen(prefix);
-	RTGEOM *subgeom;
-
-	size = sizeof("<MultiGeometry></MultiGeometry>") + prefixlen*2;
-
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
-		if ( subgeom->type == RTPOINTTYPE )
-		{
-			size += asgml3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else if ( subgeom->type == RTLINETYPE )
-		{
-			size += asgml3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else if ( subgeom->type == RTPOLYGONTYPE )
-		{
-			size += asgml3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else if ( rtgeom_is_collection(ctx, subgeom) )
-		{
-			size += asgml3_multi_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, opts, prefix, id);
-		}
-		else
-			rterror(ctx, "asgml3_collection_size: unknown geometry type");
-	}
-
-	return size;
+  int i;
+  size_t size;
+  size_t prefixlen = strlen(prefix);
+  RTGEOM *subgeom;
+
+  size = sizeof("<MultiGeometry></MultiGeometry>") + prefixlen*2;
+
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
+    if ( subgeom->type == RTPOINTTYPE )
+    {
+      size += asgml3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else if ( subgeom->type == RTLINETYPE )
+    {
+      size += asgml3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else if ( subgeom->type == RTPOLYGONTYPE )
+    {
+      size += asgml3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else if ( rtgeom_is_collection(ctx, subgeom) )
+    {
+      size += asgml3_multi_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, opts, prefix, id);
+    }
+    else
+      rterror(ctx, "asgml3_collection_size: unknown geometry type");
+  }
+
+  return size;
 }
 
 static size_t
 asgml3_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char *ptr;
-	int i;
-	RTGEOM *subgeom;
-
-	ptr = output;
-
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
-	if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
-
-	if (!col->ngeoms)
-	{
-		ptr += sprintf(ptr, "/>");
-		return (ptr-output);
-	}
-	ptr += sprintf(ptr, ">");
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
-		if ( subgeom->type == RTPOINTTYPE )
-		{
-			ptr += asgml3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
-		}
-		else if ( subgeom->type == RTLINETYPE )
-		{
-			ptr += asgml3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
-		}
-		else if ( subgeom->type == RTPOLYGONTYPE )
-		{
-			ptr += asgml3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
-		}
-		else if ( rtgeom_is_collection(ctx, subgeom) )
-		{
-			if ( subgeom->type == RTCOLLECTIONTYPE )
-				ptr += asgml3_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
-			else
-				ptr += asgml3_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
-		}
-		else
-			rterror(ctx, "asgml3_collection_buf: unknown geometry type");
-
-		ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
-	}
-
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
-
-	return (ptr-output);
+  char *ptr;
+  int i;
+  RTGEOM *subgeom;
+
+  ptr = output;
+
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
+  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  if (id)  ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
+
+  if (!col->ngeoms)
+  {
+    ptr += sprintf(ptr, "/>");
+    return (ptr-output);
+  }
+  ptr += sprintf(ptr, ">");
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
+    if ( subgeom->type == RTPOINTTYPE )
+    {
+      ptr += asgml3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
+    }
+    else if ( subgeom->type == RTLINETYPE )
+    {
+      ptr += asgml3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
+    }
+    else if ( subgeom->type == RTPOLYGONTYPE )
+    {
+      ptr += asgml3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
+    }
+    else if ( rtgeom_is_collection(ctx, subgeom) )
+    {
+      if ( subgeom->type == RTCOLLECTIONTYPE )
+        ptr += asgml3_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
+      else
+        ptr += asgml3_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
+    }
+    else
+      rterror(ctx, "asgml3_collection_buf: unknown geometry type");
+
+    ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
+  }
+
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
+
+  return (ptr-output);
 }
 
 /*
@@ -1750,156 +1750,156 @@ asgml3_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs
 static char *
 asgml3_collection(const RTCTX *ctx, const RTCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char *gml;
-	size_t size;
+  char *gml;
+  size_t size;
 
-	size = asgml3_collection_size(ctx, col, srs, precision, opts, prefix, id);
-	gml = rtalloc(ctx, size);
-	asgml3_collection_buf(ctx, col, srs, gml, precision, opts, prefix, id);
-	return gml;
+  size = asgml3_collection_size(ctx, col, srs, precision, opts, prefix, id);
+  gml = rtalloc(ctx, size);
+  asgml3_collection_buf(ctx, col, srs, gml, precision, opts, prefix, id);
+  return gml;
 }
 
 static size_t asgml3_multicurve_size(const RTCTX *ctx,  const RTMCURVE* cur, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
-	size_t prefixlen = strlen(prefix);
-	size_t size = sizeof( "<MultiCurve></MultiCurve>" ) + 2 * prefixlen;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	RTGEOM* subgeom;
-	int i;
-
-	for( i = 0; i < cur->ngeoms; ++i )
-	{
-		size += sizeof( "<curveMember></curveMember>" ) + 2 * prefixlen;
-		subgeom = cur->geoms[i];
-		if ( subgeom->type == RTLINETYPE )
-		{
-			size += asgml3_line_size(ctx,  (RTLINE*)subgeom, srs, precision, opts, prefix, id );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			size += asgml3_circstring_size(ctx,  (RTCIRCSTRING*)subgeom, srs, precision, opts, prefix, id );
-		}
-		else if( subgeom->type == RTCOMPOUNDTYPE )
-		{
-			size += asgml3_compound_size(ctx,  (RTCOMPOUND*)subgeom, srs, precision, opts, prefix, id );
-		}
-	}
-	return size;
+  size_t prefixlen = strlen(prefix);
+  size_t size = sizeof( "<MultiCurve></MultiCurve>" ) + 2 * prefixlen;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  RTGEOM* subgeom;
+  int i;
+
+  for( i = 0; i < cur->ngeoms; ++i )
+  {
+    size += sizeof( "<curveMember></curveMember>" ) + 2 * prefixlen;
+    subgeom = cur->geoms[i];
+    if ( subgeom->type == RTLINETYPE )
+    {
+      size += asgml3_line_size(ctx,  (RTLINE*)subgeom, srs, precision, opts, prefix, id );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      size += asgml3_circstring_size(ctx,  (RTCIRCSTRING*)subgeom, srs, precision, opts, prefix, id );
+    }
+    else if( subgeom->type == RTCOMPOUNDTYPE )
+    {
+      size += asgml3_compound_size(ctx,  (RTCOMPOUND*)subgeom, srs, precision, opts, prefix, id );
+    }
+  }
+  return size;
 }
 
 static size_t asgml3_multicurve_buf(const RTCTX *ctx,  const RTMCURVE* cur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id )
 {
-	char* ptr = output;
-	RTGEOM* subgeom;
-	int i;
-
-	ptr += sprintf(ptr, "<%sMultiCurve", prefix );
-	if (srs)
-	{
-		ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	}
-	if (id)
-	{
-		ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
-	}
-	ptr += sprintf( ptr, ">");
-
-	for( i = 0; i < cur->ngeoms; ++i )
-	{
-		ptr += sprintf(ptr, "<%scurveMember>", prefix );
-		subgeom = cur->geoms[i];
-		if ( subgeom->type == RTLINETYPE )
-		{
-			ptr += asgml3_line_buf(ctx,  (RTLINE*)subgeom, srs, ptr, precision, opts, prefix, id );
-		}
-		else if( subgeom->type == RTCIRCSTRINGTYPE )
-		{
-			ptr += asgml3_circstring_buf(ctx,  (RTCIRCSTRING*)subgeom, srs, ptr, precision, opts, prefix, id );
-		}
-		else if( subgeom->type == RTCOMPOUNDTYPE )
-		{
-			ptr += asgml3_compound_buf(ctx,  (RTCOMPOUND*)subgeom, srs, ptr, precision, opts, prefix, id );
-		}
-		ptr += sprintf(ptr, "</%scurveMember>", prefix );
-	}
-	ptr += sprintf(ptr, "</%sMultiCurve>", prefix );
-	return (ptr - output);
+  char* ptr = output;
+  RTGEOM* subgeom;
+  int i;
+
+  ptr += sprintf(ptr, "<%sMultiCurve", prefix );
+  if (srs)
+  {
+    ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  }
+  if (id)
+  {
+    ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
+  }
+  ptr += sprintf( ptr, ">");
+
+  for( i = 0; i < cur->ngeoms; ++i )
+  {
+    ptr += sprintf(ptr, "<%scurveMember>", prefix );
+    subgeom = cur->geoms[i];
+    if ( subgeom->type == RTLINETYPE )
+    {
+      ptr += asgml3_line_buf(ctx,  (RTLINE*)subgeom, srs, ptr, precision, opts, prefix, id );
+    }
+    else if( subgeom->type == RTCIRCSTRINGTYPE )
+    {
+      ptr += asgml3_circstring_buf(ctx,  (RTCIRCSTRING*)subgeom, srs, ptr, precision, opts, prefix, id );
+    }
+    else if( subgeom->type == RTCOMPOUNDTYPE )
+    {
+      ptr += asgml3_compound_buf(ctx,  (RTCOMPOUND*)subgeom, srs, ptr, precision, opts, prefix, id );
+    }
+    ptr += sprintf(ptr, "</%scurveMember>", prefix );
+  }
+  ptr += sprintf(ptr, "</%sMultiCurve>", prefix );
+  return (ptr - output);
 }
 
 static char * asgml3_multicurve(const RTCTX *ctx,  const RTMCURVE* cur, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
-	char* gml;
-	size_t size =asgml3_multicurve_size(ctx,  cur, srs, precision, opts, prefix, id );
-	gml = rtalloc(ctx,  size );
-	asgml3_multicurve_buf(ctx,  cur, srs, gml, precision, opts, prefix, id );
-	return gml;
+  char* gml;
+  size_t size =asgml3_multicurve_size(ctx,  cur, srs, precision, opts, prefix, id );
+  gml = rtalloc(ctx,  size );
+  asgml3_multicurve_buf(ctx,  cur, srs, gml, precision, opts, prefix, id );
+  return gml;
 }
 
 static size_t asgml3_multisurface_size(const RTCTX *ctx, const RTMSURFACE *sur, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	size_t prefixlen = strlen(prefix);
-	size_t size = sizeof( "<MultiSurface></MultiSurface>" ) + 2 * prefixlen;
-	if (srs) size += strlen(srs) + sizeof(" srsName=..");
-	if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
-	RTGEOM* subgeom;
-	int i;
-
-	for( i = 0; i < sur->ngeoms; ++i )
-	{
-		subgeom = sur->geoms[i];
-		if( subgeom->type == RTPOLYGONTYPE )
-		{
-			size += asgml3_poly_size(ctx,  (RTPOLY*)sur->geoms[i], srs, precision, opts, prefix, id );
-		}
-		else if( subgeom->type == RTCURVEPOLYTYPE )
-		{
-			size += asgml3_curvepoly_size(ctx,  (RTCURVEPOLY*)sur->geoms[i], srs, precision, opts, prefix, id );
-		}
-	}
-	return size;
+  size_t prefixlen = strlen(prefix);
+  size_t size = sizeof( "<MultiSurface></MultiSurface>" ) + 2 * prefixlen;
+  if (srs) size += strlen(srs) + sizeof(" srsName=..");
+  if (id)  size += strlen(id) + strlen(prefix) + sizeof(" id=..");
+  RTGEOM* subgeom;
+  int i;
+
+  for( i = 0; i < sur->ngeoms; ++i )
+  {
+    subgeom = sur->geoms[i];
+    if( subgeom->type == RTPOLYGONTYPE )
+    {
+      size += asgml3_poly_size(ctx,  (RTPOLY*)sur->geoms[i], srs, precision, opts, prefix, id );
+    }
+    else if( subgeom->type == RTCURVEPOLYTYPE )
+    {
+      size += asgml3_curvepoly_size(ctx,  (RTCURVEPOLY*)sur->geoms[i], srs, precision, opts, prefix, id );
+    }
+  }
+  return size;
 }
 
 static size_t asgml3_multisurface_buf(const RTCTX *ctx, const RTMSURFACE *sur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
-	char* ptr = output;
-	int i;
-	RTGEOM* subgeom;
-
-	ptr += sprintf( ptr, "<%sMultiSurface", prefix );
-	if (srs)
-	{
-		ptr += sprintf(ptr, " srsName=\"%s\"", srs);
-	}
-	if (id)
-	{
-		ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
-	}
-	ptr += sprintf( ptr, ">" );
-
-	for( i = 0; i < sur->ngeoms; ++i )
-	{
-		subgeom = sur->geoms[i];
-		if( subgeom->type == RTPOLYGONTYPE )
-		{
-			ptr += asgml3_poly_buf(ctx,  (RTPOLY*)sur->geoms[i], srs, ptr, precision, opts, 0, prefix, id );
-		}
-		else if( subgeom->type == RTCURVEPOLYTYPE )
-		{
-			ptr += asgml3_curvepoly_buf(ctx,  (RTCURVEPOLY*)sur->geoms[i], srs, ptr, precision, opts, prefix, id );
-		}
-	}
-	ptr += sprintf( ptr, "</%sMultiSurface>", prefix );
-	return ptr - output;
+  char* ptr = output;
+  int i;
+  RTGEOM* subgeom;
+
+  ptr += sprintf( ptr, "<%sMultiSurface", prefix );
+  if (srs)
+  {
+    ptr += sprintf(ptr, " srsName=\"%s\"", srs);
+  }
+  if (id)
+  {
+    ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id );
+  }
+  ptr += sprintf( ptr, ">" );
+
+  for( i = 0; i < sur->ngeoms; ++i )
+  {
+    subgeom = sur->geoms[i];
+    if( subgeom->type == RTPOLYGONTYPE )
+    {
+      ptr += asgml3_poly_buf(ctx,  (RTPOLY*)sur->geoms[i], srs, ptr, precision, opts, 0, prefix, id );
+    }
+    else if( subgeom->type == RTCURVEPOLYTYPE )
+    {
+      ptr += asgml3_curvepoly_buf(ctx,  (RTCURVEPOLY*)sur->geoms[i], srs, ptr, precision, opts, prefix, id );
+    }
+  }
+  ptr += sprintf( ptr, "</%sMultiSurface>", prefix );
+  return ptr - output;
 }
 
 static char * asgml3_multisurface(const RTCTX *ctx, const RTMSURFACE *sur, const char *srs, int precision, int opts, const char *prefix, const char *id)
 {
-	char* gml;
-	size_t size = asgml3_multisurface_size(ctx,  sur, srs, precision, opts, prefix, id );
-	gml = rtalloc(ctx,  size );
-	asgml3_multisurface_buf(ctx,  sur, srs, gml, precision, opts, prefix, id );
-	return gml;
+  char* gml;
+  size_t size = asgml3_multisurface_size(ctx,  sur, srs, precision, opts, prefix, id );
+  gml = rtalloc(ctx,  size );
+  asgml3_multisurface_buf(ctx,  sur, srs, gml, precision, opts, prefix, id );
+  return gml;
 }
 
 
@@ -1909,74 +1909,74 @@ static char * asgml3_multisurface(const RTCTX *ctx, const RTMSURFACE *sur, const
 static size_t
 pointArray_toGML3(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precision, int opts)
 {
-	int i;
-	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-
-	ptr = output;
-
-	if ( ! RTFLAGS_GET_Z(pa->flags) )
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT2D *pt;
-			pt = rt_getPoint2d_cp(ctx, pa, i);
-
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(ctx, x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(ctx, y);
-
-			if ( i ) ptr += sprintf(ptr, " ");
-			if (IS_DEGREE(opts))
-				ptr += sprintf(ptr, "%s %s", y, x);
-			else
-				ptr += sprintf(ptr, "%s %s", x, y);
-		}
-	}
-	else
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			const RTPOINT3DZ *pt;
-			pt = rt_getPoint3dz_cp(ctx, pa, i);
-
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(ctx, x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(ctx, y);
-
-			if (fabs(pt->z) < OUT_MAX_DOUBLE)
-				sprintf(z, "%.*f", precision, pt->z);
-			else
-				sprintf(z, "%g", pt->z);
-			trim_trailing_zeros(ctx, z);
-
-			if ( i ) ptr += sprintf(ptr, " ");
-			if (IS_DEGREE(opts))
-				ptr += sprintf(ptr, "%s %s %s", y, x, z);
-			else
-				ptr += sprintf(ptr, "%s %s %s", x, y, z);
-		}
-	}
-
-	return ptr-output;
+  int i;
+  char *ptr;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+
+  ptr = output;
+
+  if ( ! RTFLAGS_GET_Z(pa->flags) )
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT2D *pt;
+      pt = rt_getPoint2d_cp(ctx, pa, i);
+
+      if (fabs(pt->x) < OUT_MAX_DOUBLE)
+        sprintf(x, "%.*f", precision, pt->x);
+      else
+        sprintf(x, "%g", pt->x);
+      trim_trailing_zeros(ctx, x);
+
+      if (fabs(pt->y) < OUT_MAX_DOUBLE)
+        sprintf(y, "%.*f", precision, pt->y);
+      else
+        sprintf(y, "%g", pt->y);
+      trim_trailing_zeros(ctx, y);
+
+      if ( i ) ptr += sprintf(ptr, " ");
+      if (IS_DEGREE(opts))
+        ptr += sprintf(ptr, "%s %s", y, x);
+      else
+        ptr += sprintf(ptr, "%s %s", x, y);
+    }
+  }
+  else
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      const RTPOINT3DZ *pt;
+      pt = rt_getPoint3dz_cp(ctx, pa, i);
+
+      if (fabs(pt->x) < OUT_MAX_DOUBLE)
+        sprintf(x, "%.*f", precision, pt->x);
+      else
+        sprintf(x, "%g", pt->x);
+      trim_trailing_zeros(ctx, x);
+
+      if (fabs(pt->y) < OUT_MAX_DOUBLE)
+        sprintf(y, "%.*f", precision, pt->y);
+      else
+        sprintf(y, "%g", pt->y);
+      trim_trailing_zeros(ctx, y);
+
+      if (fabs(pt->z) < OUT_MAX_DOUBLE)
+        sprintf(z, "%.*f", precision, pt->z);
+      else
+        sprintf(z, "%g", pt->z);
+      trim_trailing_zeros(ctx, z);
+
+      if ( i ) ptr += sprintf(ptr, " ");
+      if (IS_DEGREE(opts))
+        ptr += sprintf(ptr, "%s %s %s", y, x, z);
+      else
+        ptr += sprintf(ptr, "%s %s %s", x, y, z);
+    }
+  }
+
+  return ptr-output;
 }
 
 
@@ -1987,8 +1987,8 @@ pointArray_toGML3(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precisio
 static size_t
 pointArray_GMLsize(const RTCTX *ctx, RTPOINTARRAY *pa, int precision)
 {
-	if (RTFLAGS_NDIMS(pa->flags) == 2)
-		return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 2 * pa->npoints;
+  if (RTFLAGS_NDIMS(pa->flags) == 2)
+    return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 2 * pa->npoints;
 
-	return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 3 * pa->npoints;
+  return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(", ")) * 3 * pa->npoints;
 }
diff --git a/src/rtout_kml.c b/src/rtout_kml.c
index 72f1763..d3367f3 100644
--- a/src/rtout_kml.c
+++ b/src/rtout_kml.c
@@ -18,7 +18,7 @@
  *
  **********************************************************************
  *
- * Copyright 2006 Corporacion Autonoma Regional de Santander 
+ * Copyright 2006 Corporacion Autonoma Regional de Santander
  * Copyright 2010 Paul Ramsey <pramsey at cleverelephant.ca>
  *
  **********************************************************************/
@@ -43,156 +43,156 @@ static int ptarray_to_kml2_sb(const RTCTX *ctx, const RTPOINTARRAY *pa, int prec
 char*
 rtgeom_to_kml2(const RTCTX *ctx, const RTGEOM *geom, int precision, const char *prefix)
 {
-	stringbuffer_t *sb;
-	int rv;
-	char *kml;
-
-	/* Can't do anything with empty */
-	if( rtgeom_is_empty(ctx, geom) )
-		return NULL;
-
-	sb = stringbuffer_create(ctx);
-	rv = rtgeom_to_kml2_sb(ctx, geom, precision, prefix, sb);
-	
-	if ( rv == RT_FAILURE )
-	{
-		stringbuffer_destroy(ctx, sb);
-		return NULL;
-	}
-	
-	kml = stringbuffer_getstringcopy(ctx, sb);
-	stringbuffer_destroy(ctx, sb);
-	
-	return kml;
+  stringbuffer_t *sb;
+  int rv;
+  char *kml;
+
+  /* Can't do anything with empty */
+  if( rtgeom_is_empty(ctx, geom) )
+    return NULL;
+
+  sb = stringbuffer_create(ctx);
+  rv = rtgeom_to_kml2_sb(ctx, geom, precision, prefix, sb);
+
+  if ( rv == RT_FAILURE )
+  {
+    stringbuffer_destroy(ctx, sb);
+    return NULL;
+  }
+
+  kml = stringbuffer_getstringcopy(ctx, sb);
+  stringbuffer_destroy(ctx, sb);
+
+  return kml;
 }
 
-static int 
+static int
 rtgeom_to_kml2_sb(const RTCTX *ctx, const RTGEOM *geom, int precision, const char *prefix, stringbuffer_t *sb)
 {
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		return rtpoint_to_kml2_sb(ctx, (RTPOINT*)geom, precision, prefix, sb);
-
-	case RTLINETYPE:
-		return rtline_to_kml2_sb(ctx, (RTLINE*)geom, precision, prefix, sb);
-
-	case RTPOLYGONTYPE:
-		return rtpoly_to_kml2_sb(ctx, (RTPOLY*)geom, precision, prefix, sb);
-
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-		return rtcollection_to_kml2_sb(ctx, (RTCOLLECTION*)geom, precision, prefix, sb);
-
-	default:
-		rterror(ctx, "rtgeom_to_kml2: '%s' geometry type not supported", rttype_name(ctx, geom->type));
-		return RT_FAILURE;
-	}
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    return rtpoint_to_kml2_sb(ctx, (RTPOINT*)geom, precision, prefix, sb);
+
+  case RTLINETYPE:
+    return rtline_to_kml2_sb(ctx, (RTLINE*)geom, precision, prefix, sb);
+
+  case RTPOLYGONTYPE:
+    return rtpoly_to_kml2_sb(ctx, (RTPOLY*)geom, precision, prefix, sb);
+
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+    return rtcollection_to_kml2_sb(ctx, (RTCOLLECTION*)geom, precision, prefix, sb);
+
+  default:
+    rterror(ctx, "rtgeom_to_kml2: '%s' geometry type not supported", rttype_name(ctx, geom->type));
+    return RT_FAILURE;
+  }
 }
 
-static int 
+static int
 ptarray_to_kml2_sb(const RTCTX *ctx, const RTPOINTARRAY *pa, int precision, stringbuffer_t *sb)
 {
-	int i, j;
-	int dims = RTFLAGS_GET_Z(pa->flags) ? 3 : 2;
-	RTPOINT4D pt;
-	double *d;
-	
-	for ( i = 0; i < pa->npoints; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &pt);
-		d = (double*)(&pt);
-		if ( i ) stringbuffer_append(ctx, sb," ");
-		for (j = 0; j < dims; j++)
-		{
-			if ( j ) stringbuffer_append(ctx, sb,",");
-			if( fabs(d[j]) < OUT_MAX_DOUBLE )
-			{
-				if ( stringbuffer_aprintf(ctx, sb, "%.*f", precision, d[j]) < 0 ) return RT_FAILURE;
-			}
-			else 
-			{
-				if ( stringbuffer_aprintf(ctx, sb, "%g", d[j]) < 0 ) return RT_FAILURE;
-			}
-			stringbuffer_trim_trailing_zeroes(ctx, sb);
-		}
-	}
-	return RT_SUCCESS;
+  int i, j;
+  int dims = RTFLAGS_GET_Z(pa->flags) ? 3 : 2;
+  RTPOINT4D pt;
+  double *d;
+
+  for ( i = 0; i < pa->npoints; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &pt);
+    d = (double*)(&pt);
+    if ( i ) stringbuffer_append(ctx, sb," ");
+    for (j = 0; j < dims; j++)
+    {
+      if ( j ) stringbuffer_append(ctx, sb,",");
+      if( fabs(d[j]) < OUT_MAX_DOUBLE )
+      {
+        if ( stringbuffer_aprintf(ctx, sb, "%.*f", precision, d[j]) < 0 ) return RT_FAILURE;
+      }
+      else
+      {
+        if ( stringbuffer_aprintf(ctx, sb, "%g", d[j]) < 0 ) return RT_FAILURE;
+      }
+      stringbuffer_trim_trailing_zeroes(ctx, sb);
+    }
+  }
+  return RT_SUCCESS;
 }
 
 
-static int 
+static int
 rtpoint_to_kml2_sb(const RTCTX *ctx, const RTPOINT *point, int precision, const char *prefix, stringbuffer_t *sb)
 {
-	/* Open point */
-	if ( stringbuffer_aprintf(ctx, sb, "<%sPoint><%scoordinates>", prefix, prefix) < 0 ) return RT_FAILURE;
-	/* Coordinate array */
-	if ( ptarray_to_kml2_sb(ctx, point->point, precision, sb) == RT_FAILURE ) return RT_FAILURE;
-	/* Close point */
-	if ( stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sPoint>", prefix, prefix) < 0 ) return RT_FAILURE;
-	return RT_SUCCESS;
+  /* Open point */
+  if ( stringbuffer_aprintf(ctx, sb, "<%sPoint><%scoordinates>", prefix, prefix) < 0 ) return RT_FAILURE;
+  /* Coordinate array */
+  if ( ptarray_to_kml2_sb(ctx, point->point, precision, sb) == RT_FAILURE ) return RT_FAILURE;
+  /* Close point */
+  if ( stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sPoint>", prefix, prefix) < 0 ) return RT_FAILURE;
+  return RT_SUCCESS;
 }
 
-static int 
+static int
 rtline_to_kml2_sb(const RTCTX *ctx, const RTLINE *line, int precision, const char *prefix, stringbuffer_t *sb)
 {
-	/* Open linestring */
-	if ( stringbuffer_aprintf(ctx, sb, "<%sLineString><%scoordinates>", prefix, prefix) < 0 ) return RT_FAILURE;
-	/* Coordinate array */
-	if ( ptarray_to_kml2_sb(ctx, line->points, precision, sb) == RT_FAILURE ) return RT_FAILURE;
-	/* Close linestring */
-	if ( stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLineString>", prefix, prefix) < 0 ) return RT_FAILURE;
-	
-	return RT_SUCCESS;
+  /* Open linestring */
+  if ( stringbuffer_aprintf(ctx, sb, "<%sLineString><%scoordinates>", prefix, prefix) < 0 ) return RT_FAILURE;
+  /* Coordinate array */
+  if ( ptarray_to_kml2_sb(ctx, line->points, precision, sb) == RT_FAILURE ) return RT_FAILURE;
+  /* Close linestring */
+  if ( stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLineString>", prefix, prefix) < 0 ) return RT_FAILURE;
+
+  return RT_SUCCESS;
 }
 
-static int 
+static int
 rtpoly_to_kml2_sb(const RTCTX *ctx, const RTPOLY *poly, int precision, const char *prefix, stringbuffer_t *sb)
 {
-	int i, rv;
-	
-	/* Open polygon */
-	if ( stringbuffer_aprintf(ctx, sb, "<%sPolygon>", prefix) < 0 ) return RT_FAILURE;
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		/* Inner or outer ring opening tags */
-		if( i )
-			rv = stringbuffer_aprintf(ctx, sb, "<%sinnerBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
-		else
-			rv = stringbuffer_aprintf(ctx, sb, "<%souterBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);		
-		if ( rv < 0 ) return RT_FAILURE;
-		
-		/* Coordinate array */
-		if ( ptarray_to_kml2_sb(ctx, poly->rings[i], precision, sb) == RT_FAILURE ) return RT_FAILURE;
-		
-		/* Inner or outer ring closing tags */
-		if( i )
-			rv = stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLinearRing></%sinnerBoundaryIs>", prefix, prefix, prefix);
-		else
-			rv = stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLinearRing></%souterBoundaryIs>", prefix, prefix, prefix);		
-		if ( rv < 0 ) return RT_FAILURE;
-	}
-	/* Close polygon */
-	if ( stringbuffer_aprintf(ctx, sb, "</%sPolygon>", prefix) < 0 ) return RT_FAILURE;
-
-	return RT_SUCCESS;
+  int i, rv;
+
+  /* Open polygon */
+  if ( stringbuffer_aprintf(ctx, sb, "<%sPolygon>", prefix) < 0 ) return RT_FAILURE;
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    /* Inner or outer ring opening tags */
+    if( i )
+      rv = stringbuffer_aprintf(ctx, sb, "<%sinnerBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
+    else
+      rv = stringbuffer_aprintf(ctx, sb, "<%souterBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
+    if ( rv < 0 ) return RT_FAILURE;
+
+    /* Coordinate array */
+    if ( ptarray_to_kml2_sb(ctx, poly->rings[i], precision, sb) == RT_FAILURE ) return RT_FAILURE;
+
+    /* Inner or outer ring closing tags */
+    if( i )
+      rv = stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLinearRing></%sinnerBoundaryIs>", prefix, prefix, prefix);
+    else
+      rv = stringbuffer_aprintf(ctx, sb, "</%scoordinates></%sLinearRing></%souterBoundaryIs>", prefix, prefix, prefix);
+    if ( rv < 0 ) return RT_FAILURE;
+  }
+  /* Close polygon */
+  if ( stringbuffer_aprintf(ctx, sb, "</%sPolygon>", prefix) < 0 ) return RT_FAILURE;
+
+  return RT_SUCCESS;
 }
 
-static int 
+static int
 rtcollection_to_kml2_sb(const RTCTX *ctx, const RTCOLLECTION *col, int precision, const char *prefix, stringbuffer_t *sb)
 {
-	int i, rv;
-		
-	/* Open geometry */
-	if ( stringbuffer_aprintf(ctx, sb, "<%sMultiGeometry>", prefix) < 0 ) return RT_FAILURE;
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		rv = rtgeom_to_kml2_sb(ctx, col->geoms[i], precision, prefix, sb);
-		if ( rv == RT_FAILURE ) return RT_FAILURE;		
-	}
-	/* Close geometry */
-	if ( stringbuffer_aprintf(ctx, sb, "</%sMultiGeometry>", prefix) < 0 ) return RT_FAILURE;
-
-	return RT_SUCCESS;
+  int i, rv;
+
+  /* Open geometry */
+  if ( stringbuffer_aprintf(ctx, sb, "<%sMultiGeometry>", prefix) < 0 ) return RT_FAILURE;
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    rv = rtgeom_to_kml2_sb(ctx, col->geoms[i], precision, prefix, sb);
+    if ( rv == RT_FAILURE ) return RT_FAILURE;
+  }
+  /* Close geometry */
+  if ( stringbuffer_aprintf(ctx, sb, "</%sMultiGeometry>", prefix) < 0 ) return RT_FAILURE;
+
+  return RT_SUCCESS;
 }
diff --git a/src/rtout_svg.c b/src/rtout_svg.c
index 977f9d2..3b87f1b 100644
--- a/src/rtout_svg.c
+++ b/src/rtout_svg.c
@@ -56,47 +56,47 @@ static size_t pointArray_svg_abs(const RTCTX *ctx, RTPOINTARRAY *pa, char * outp
 char *
 rtgeom_to_svg(const RTCTX *ctx, const RTGEOM *geom, int precision, int relative)
 {
-	char *ret = NULL;
-	int type = geom->type;
-
-	/* Empty string for empties */
-	if( rtgeom_is_empty(ctx, geom) )
-	{
-		ret = rtalloc(ctx, 1);
-		ret[0] = '\0';
-		return ret;
-	}
-	
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		ret = assvg_point(ctx, (RTPOINT*)geom, relative, precision);
-		break;
-	case RTLINETYPE:
-		ret = assvg_line(ctx, (RTLINE*)geom, relative, precision);
-		break;
-	case RTPOLYGONTYPE:
-		ret = assvg_polygon(ctx, (RTPOLY*)geom, relative, precision);
-		break;
-	case RTMULTIPOINTTYPE:
-		ret = assvg_multipoint(ctx, (RTMPOINT*)geom, relative, precision);
-		break;
-	case RTMULTILINETYPE:
-		ret = assvg_multiline(ctx, (RTMLINE*)geom, relative, precision);
-		break;
-	case RTMULTIPOLYGONTYPE:
-		ret = assvg_multipolygon(ctx, (RTMPOLY*)geom, relative, precision);
-		break;
-	case RTCOLLECTIONTYPE:
-		ret = assvg_collection(ctx, (RTCOLLECTION*)geom, relative, precision);
-		break;
-
-	default:
-		rterror(ctx, "rtgeom_to_svg: '%s' geometry type not supported",
-		        rttype_name(ctx, type));
-	}
-
-	return ret;
+  char *ret = NULL;
+  int type = geom->type;
+
+  /* Empty string for empties */
+  if( rtgeom_is_empty(ctx, geom) )
+  {
+    ret = rtalloc(ctx, 1);
+    ret[0] = '\0';
+    return ret;
+  }
+
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    ret = assvg_point(ctx, (RTPOINT*)geom, relative, precision);
+    break;
+  case RTLINETYPE:
+    ret = assvg_line(ctx, (RTLINE*)geom, relative, precision);
+    break;
+  case RTPOLYGONTYPE:
+    ret = assvg_polygon(ctx, (RTPOLY*)geom, relative, precision);
+    break;
+  case RTMULTIPOINTTYPE:
+    ret = assvg_multipoint(ctx, (RTMPOINT*)geom, relative, precision);
+    break;
+  case RTMULTILINETYPE:
+    ret = assvg_multiline(ctx, (RTMLINE*)geom, relative, precision);
+    break;
+  case RTMULTIPOLYGONTYPE:
+    ret = assvg_multipolygon(ctx, (RTMPOLY*)geom, relative, precision);
+    break;
+  case RTCOLLECTIONTYPE:
+    ret = assvg_collection(ctx, (RTCOLLECTION*)geom, relative, precision);
+    break;
+
+  default:
+    rterror(ctx, "rtgeom_to_svg: '%s' geometry type not supported",
+            rttype_name(ctx, type));
+  }
+
+  return ret;
 }
 
 
@@ -107,55 +107,55 @@ rtgeom_to_svg(const RTCTX *ctx, const RTGEOM *geom, int precision, int relative)
 static size_t
 assvg_point_size(const RTCTX *ctx, const RTPOINT *point, int circle, int precision)
 {
-	size_t size;
+  size_t size;
 
-	size = (OUT_MAX_DIGS_DOUBLE + precision) * 2;
-	if (circle) size += sizeof("cx='' cy=''");
-	else size += sizeof("x='' y=''");
+  size = (OUT_MAX_DIGS_DOUBLE + precision) * 2;
+  if (circle) size += sizeof("cx='' cy=''");
+  else size += sizeof("x='' y=''");
 
-	return size;
+  return size;
 }
 
 static size_t
 assvg_point_buf(const RTCTX *ctx, const RTPOINT *point, char * output, int circle, int precision)
 {
-	char *ptr=output;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	RTPOINT2D pt;
-
-	rt_getPoint2d_p(ctx, point->point, 0, &pt);
-
-	if (fabs(pt.x) < OUT_MAX_DOUBLE)
-		sprintf(x, "%.*f", precision, pt.x);
-	else
-		sprintf(x, "%g", pt.x);
-	trim_trailing_zeros(ctx, x);
-
-	/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-	if (fabs(pt.y) < OUT_MAX_DOUBLE)
-		sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
-	else
-		sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
-	trim_trailing_zeros(ctx, y);
-
-	if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
-	else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
-
-	return (ptr-output);
+  char *ptr=output;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  RTPOINT2D pt;
+
+  rt_getPoint2d_p(ctx, point->point, 0, &pt);
+
+  if (fabs(pt.x) < OUT_MAX_DOUBLE)
+    sprintf(x, "%.*f", precision, pt.x);
+  else
+    sprintf(x, "%g", pt.x);
+  trim_trailing_zeros(ctx, x);
+
+  /* SVG Y axis is reversed, an no need to transform 0 into -0 */
+  if (fabs(pt.y) < OUT_MAX_DOUBLE)
+    sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
+  else
+    sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
+  trim_trailing_zeros(ctx, y);
+
+  if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
+  else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
+
+  return (ptr-output);
 }
 
 static char *
 assvg_point(const RTCTX *ctx, const RTPOINT *point, int circle, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_point_size(ctx, point, circle, precision);
-	output = rtalloc(ctx, size);
-	assvg_point_buf(ctx, point, output, circle, precision);
+  size = assvg_point_size(ctx, point, circle, precision);
+  output = rtalloc(ctx, size);
+  assvg_point_buf(ctx, point, output, circle, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -166,40 +166,40 @@ assvg_point(const RTCTX *ctx, const RTPOINT *point, int circle, int precision)
 static size_t
 assvg_line_size(const RTCTX *ctx, const RTLINE *line, int relative, int precision)
 {
-	size_t size;
+  size_t size;
 
-	size = sizeof("M ");
-	size += pointArray_svg_size(ctx, line->points, precision);
+  size = sizeof("M ");
+  size += pointArray_svg_size(ctx, line->points, precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 assvg_line_buf(const RTCTX *ctx, const RTLINE *line, char * output, int relative, int precision)
 {
-	char *ptr=output;
+  char *ptr=output;
 
-	/* Start path with SVG MoveTo */
-	ptr += sprintf(ptr, "M ");
-	if (relative)
-		ptr += pointArray_svg_rel(ctx, line->points, ptr, 1, precision);
-	else
-		ptr += pointArray_svg_abs(ctx, line->points, ptr, 1, precision);
+  /* Start path with SVG MoveTo */
+  ptr += sprintf(ptr, "M ");
+  if (relative)
+    ptr += pointArray_svg_rel(ctx, line->points, ptr, 1, precision);
+  else
+    ptr += pointArray_svg_abs(ctx, line->points, ptr, 1, precision);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 assvg_line(const RTCTX *ctx, const RTLINE *line, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_line_size(ctx, line, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_line_buf(ctx, line, output, relative, precision);
+  size = assvg_line_size(ctx, line, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_line_buf(ctx, line, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -210,53 +210,53 @@ assvg_line(const RTCTX *ctx, const RTLINE *line, int relative, int precision)
 static size_t
 assvg_polygon_size(const RTCTX *ctx, const RTPOLY *poly, int relative, int precision)
 {
-	int i;
-	size_t size=0;
+  int i;
+  size_t size=0;
 
-	for (i=0; i<poly->nrings; i++)
-		size += pointArray_svg_size(ctx, poly->rings[i], precision) + sizeof(" ");
-	size += sizeof("M  Z") * poly->nrings;
+  for (i=0; i<poly->nrings; i++)
+    size += pointArray_svg_size(ctx, poly->rings[i], precision) + sizeof(" ");
+  size += sizeof("M  Z") * poly->nrings;
 
-	return size;
+  return size;
 }
 
 static size_t
 assvg_polygon_buf(const RTCTX *ctx, const RTPOLY *poly, char * output, int relative, int precision)
 {
-	int i;
-	char *ptr=output;
-
-	for (i=0; i<poly->nrings; i++)
-	{
-		if (i) ptr += sprintf(ptr, " ");	/* Space beetween each ring */
-		ptr += sprintf(ptr, "M ");		/* Start path with SVG MoveTo */
-
-		if (relative)
-		{
-			ptr += pointArray_svg_rel(ctx, poly->rings[i], ptr, 0, precision);
-			ptr += sprintf(ptr, " z");	/* SVG closepath */
-		}
-		else
-		{
-			ptr += pointArray_svg_abs(ctx, poly->rings[i], ptr, 0, precision);
-			ptr += sprintf(ptr, " Z");	/* SVG closepath */
-		}
-	}
-
-	return (ptr-output);
+  int i;
+  char *ptr=output;
+
+  for (i=0; i<poly->nrings; i++)
+  {
+    if (i) ptr += sprintf(ptr, " ");  /* Space beetween each ring */
+    ptr += sprintf(ptr, "M ");    /* Start path with SVG MoveTo */
+
+    if (relative)
+    {
+      ptr += pointArray_svg_rel(ctx, poly->rings[i], ptr, 0, precision);
+      ptr += sprintf(ptr, " z");  /* SVG closepath */
+    }
+    else
+    {
+      ptr += pointArray_svg_abs(ctx, poly->rings[i], ptr, 0, precision);
+      ptr += sprintf(ptr, " Z");  /* SVG closepath */
+    }
+  }
+
+  return (ptr-output);
 }
 
 static char *
 assvg_polygon(const RTCTX *ctx, const RTPOLY *poly, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_polygon_size(ctx, poly, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_polygon_buf(ctx, poly, output, relative, precision);
+  size = assvg_polygon_size(ctx, poly, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_polygon_buf(ctx, poly, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -267,48 +267,48 @@ assvg_polygon(const RTCTX *ctx, const RTPOLY *poly, int relative, int precision)
 static size_t
 assvg_multipoint_size(const RTCTX *ctx, const RTMPOINT *mpoint, int relative, int precision)
 {
-	const RTPOINT *point;
-	size_t size=0;
-	int i;
-
-	for (i=0 ; i<mpoint->ngeoms ; i++)
-	{
-		point = mpoint->geoms[i];
-		size += assvg_point_size(ctx, point, relative, precision);
-	}
-	size += sizeof(",") * --i;  /* Arbitrary comma separator */
-
-	return size;
+  const RTPOINT *point;
+  size_t size=0;
+  int i;
+
+  for (i=0 ; i<mpoint->ngeoms ; i++)
+  {
+    point = mpoint->geoms[i];
+    size += assvg_point_size(ctx, point, relative, precision);
+  }
+  size += sizeof(",") * --i;  /* Arbitrary comma separator */
+
+  return size;
 }
 
 static size_t
 assvg_multipoint_buf(const RTCTX *ctx, const RTMPOINT *mpoint, char *output, int relative, int precision)
 {
-	const RTPOINT *point;
-	int i;
-	char *ptr=output;
-
-	for (i=0 ; i<mpoint->ngeoms ; i++)
-	{
-		if (i) ptr += sprintf(ptr, ",");  /* Arbitrary comma separator */
-		point = mpoint->geoms[i];
-		ptr += assvg_point_buf(ctx, point, ptr, relative, precision);
-	}
-
-	return (ptr-output);
+  const RTPOINT *point;
+  int i;
+  char *ptr=output;
+
+  for (i=0 ; i<mpoint->ngeoms ; i++)
+  {
+    if (i) ptr += sprintf(ptr, ",");  /* Arbitrary comma separator */
+    point = mpoint->geoms[i];
+    ptr += assvg_point_buf(ctx, point, ptr, relative, precision);
+  }
+
+  return (ptr-output);
 }
 
 static char *
 assvg_multipoint(const RTCTX *ctx, const RTMPOINT *mpoint, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_multipoint_size(ctx, mpoint, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_multipoint_buf(ctx, mpoint, output, relative, precision);
+  size = assvg_multipoint_size(ctx, mpoint, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_multipoint_buf(ctx, mpoint, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -319,48 +319,48 @@ assvg_multipoint(const RTCTX *ctx, const RTMPOINT *mpoint, int relative, int pre
 static size_t
 assvg_multiline_size(const RTCTX *ctx, const RTMLINE *mline, int relative, int precision)
 {
-	const RTLINE *line;
-	size_t size=0;
-	int i;
-
-	for (i=0 ; i<mline->ngeoms ; i++)
-	{
-		line = mline->geoms[i];
-		size += assvg_line_size(ctx, line, relative, precision);
-	}
-	size += sizeof(" ") * --i;   /* SVG whitespace Separator */
-
-	return size;
+  const RTLINE *line;
+  size_t size=0;
+  int i;
+
+  for (i=0 ; i<mline->ngeoms ; i++)
+  {
+    line = mline->geoms[i];
+    size += assvg_line_size(ctx, line, relative, precision);
+  }
+  size += sizeof(" ") * --i;   /* SVG whitespace Separator */
+
+  return size;
 }
 
 static size_t
 assvg_multiline_buf(const RTCTX *ctx, const RTMLINE *mline, char *output, int relative, int precision)
 {
-	const RTLINE *line;
-	int i;
-	char *ptr=output;
-
-	for (i=0 ; i<mline->ngeoms ; i++)
-	{
-		if (i) ptr += sprintf(ptr, " ");  /* SVG whitespace Separator */
-		line = mline->geoms[i];
-		ptr += assvg_line_buf(ctx, line, ptr, relative, precision);
-	}
-
-	return (ptr-output);
+  const RTLINE *line;
+  int i;
+  char *ptr=output;
+
+  for (i=0 ; i<mline->ngeoms ; i++)
+  {
+    if (i) ptr += sprintf(ptr, " ");  /* SVG whitespace Separator */
+    line = mline->geoms[i];
+    ptr += assvg_line_buf(ctx, line, ptr, relative, precision);
+  }
+
+  return (ptr-output);
 }
 
 static char *
 assvg_multiline(const RTCTX *ctx, const RTMLINE *mline, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_multiline_size(ctx, mline, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_multiline_buf(ctx, mline, output, relative, precision);
+  size = assvg_multiline_size(ctx, mline, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_multiline_buf(ctx, mline, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -371,48 +371,48 @@ assvg_multiline(const RTCTX *ctx, const RTMLINE *mline, int relative, int precis
 static size_t
 assvg_multipolygon_size(const RTCTX *ctx, const RTMPOLY *mpoly, int relative, int precision)
 {
-	const RTPOLY *poly;
-	size_t size=0;
-	int i;
-
-	for (i=0 ; i<mpoly->ngeoms ; i++)
-	{
-		poly = mpoly->geoms[i];
-		size += assvg_polygon_size(ctx, poly, relative, precision);
-	}
-	size += sizeof(" ") * --i;   /* SVG whitespace Separator */
-
-	return size;
+  const RTPOLY *poly;
+  size_t size=0;
+  int i;
+
+  for (i=0 ; i<mpoly->ngeoms ; i++)
+  {
+    poly = mpoly->geoms[i];
+    size += assvg_polygon_size(ctx, poly, relative, precision);
+  }
+  size += sizeof(" ") * --i;   /* SVG whitespace Separator */
+
+  return size;
 }
 
 static size_t
 assvg_multipolygon_buf(const RTCTX *ctx, const RTMPOLY *mpoly, char *output, int relative, int precision)
 {
-	const RTPOLY *poly;
-	int i;
-	char *ptr=output;
-
-	for (i=0 ; i<mpoly->ngeoms ; i++)
-	{
-		if (i) ptr += sprintf(ptr, " ");  /* SVG whitespace Separator */
-		poly = mpoly->geoms[i];
-		ptr += assvg_polygon_buf(ctx, poly, ptr, relative, precision);
-	}
-
-	return (ptr-output);
+  const RTPOLY *poly;
+  int i;
+  char *ptr=output;
+
+  for (i=0 ; i<mpoly->ngeoms ; i++)
+  {
+    if (i) ptr += sprintf(ptr, " ");  /* SVG whitespace Separator */
+    poly = mpoly->geoms[i];
+    ptr += assvg_polygon_buf(ctx, poly, ptr, relative, precision);
+  }
+
+  return (ptr-output);
 }
 
 static char *
 assvg_multipolygon(const RTCTX *ctx, const RTMPOLY *mpoly, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_multipolygon_size(ctx, mpoly, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_multipolygon_buf(ctx, mpoly, output, relative, precision);
+  size = assvg_multipolygon_size(ctx, mpoly, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_multipolygon_buf(ctx, mpoly, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -423,55 +423,55 @@ assvg_multipolygon(const RTCTX *ctx, const RTMPOLY *mpoly, int relative, int pre
 static size_t
 assvg_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, int relative, int precision)
 {
-	int i = 0;
-	size_t size=0;
-	const RTGEOM *subgeom;
+  int i = 0;
+  size_t size=0;
+  const RTGEOM *subgeom;
 
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		size += assvg_geom_size(ctx, subgeom, relative, precision);
-	}
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    size += assvg_geom_size(ctx, subgeom, relative, precision);
+  }
 
-	if ( i ) /* We have some geometries, so add space for delimiters. */
-		size += sizeof(";") * --i;
+  if ( i ) /* We have some geometries, so add space for delimiters. */
+    size += sizeof(";") * --i;
 
-	if (size == 0) size++; /* GEOMETRYCOLLECTION EMPTY, space for null terminator */
+  if (size == 0) size++; /* GEOMETRYCOLLECTION EMPTY, space for null terminator */
 
-	return size;
+  return size;
 }
 
 static size_t
 assvg_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *output, int relative, int precision)
 {
-	int i;
-	char *ptr=output;
-	const RTGEOM *subgeom;
+  int i;
+  char *ptr=output;
+  const RTGEOM *subgeom;
 
-	/* EMPTY GEOMETRYCOLLECTION */
-	if (col->ngeoms == 0) *ptr = '\0';
+  /* EMPTY GEOMETRYCOLLECTION */
+  if (col->ngeoms == 0) *ptr = '\0';
 
-	for (i=0; i<col->ngeoms; i++)
-	{
-		if (i) ptr += sprintf(ptr, ";");
-		subgeom = col->geoms[i];
-		ptr += assvg_geom_buf(ctx, subgeom, ptr, relative, precision);
-	}
+  for (i=0; i<col->ngeoms; i++)
+  {
+    if (i) ptr += sprintf(ptr, ";");
+    subgeom = col->geoms[i];
+    ptr += assvg_geom_buf(ctx, subgeom, ptr, relative, precision);
+  }
 
-	return (ptr - output);
+  return (ptr - output);
 }
 
 static char *
 assvg_collection(const RTCTX *ctx, const RTCOLLECTION *col, int relative, int precision)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = assvg_collection_size(ctx, col, relative, precision);
-	output = rtalloc(ctx, size);
-	assvg_collection_buf(ctx, col, output, relative, precision);
+  size = assvg_collection_size(ctx, col, relative, precision);
+  output = rtalloc(ctx, size);
+  assvg_collection_buf(ctx, col, output, relative, precision);
 
-	return output;
+  return output;
 }
 
 
@@ -479,40 +479,40 @@ static size_t
 assvg_geom_buf(const RTCTX *ctx, const RTGEOM *geom, char *output, int relative, int precision)
 {
     int type = geom->type;
-	char *ptr=output;
+  char *ptr=output;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		ptr += assvg_point_buf(ctx, (RTPOINT*)geom, ptr, relative, precision);
-		break;
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    ptr += assvg_point_buf(ctx, (RTPOINT*)geom, ptr, relative, precision);
+    break;
 
-	case RTLINETYPE:
-		ptr += assvg_line_buf(ctx, (RTLINE*)geom, ptr, relative, precision);
-		break;
+  case RTLINETYPE:
+    ptr += assvg_line_buf(ctx, (RTLINE*)geom, ptr, relative, precision);
+    break;
 
-	case RTPOLYGONTYPE:
-		ptr += assvg_polygon_buf(ctx, (RTPOLY*)geom, ptr, relative, precision);
-		break;
+  case RTPOLYGONTYPE:
+    ptr += assvg_polygon_buf(ctx, (RTPOLY*)geom, ptr, relative, precision);
+    break;
 
-	case RTMULTIPOINTTYPE:
-		ptr += assvg_multipoint_buf(ctx, (RTMPOINT*)geom, ptr, relative, precision);
-		break;
+  case RTMULTIPOINTTYPE:
+    ptr += assvg_multipoint_buf(ctx, (RTMPOINT*)geom, ptr, relative, precision);
+    break;
 
-	case RTMULTILINETYPE:
-		ptr += assvg_multiline_buf(ctx, (RTMLINE*)geom, ptr, relative, precision);
-		break;
+  case RTMULTILINETYPE:
+    ptr += assvg_multiline_buf(ctx, (RTMLINE*)geom, ptr, relative, precision);
+    break;
 
-	case RTMULTIPOLYGONTYPE:
-		ptr += assvg_multipolygon_buf(ctx, (RTMPOLY*)geom, ptr, relative, precision);
-		break;
+  case RTMULTIPOLYGONTYPE:
+    ptr += assvg_multipolygon_buf(ctx, (RTMPOLY*)geom, ptr, relative, precision);
+    break;
 
-	default:
-		rterror(ctx, "assvg_geom_buf: '%s' geometry type not supported.",
-		        rttype_name(ctx, type));
-	}
+  default:
+    rterror(ctx, "assvg_geom_buf: '%s' geometry type not supported.",
+            rttype_name(ctx, type));
+  }
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 
@@ -520,99 +520,99 @@ static size_t
 assvg_geom_size(const RTCTX *ctx, const RTGEOM *geom, int relative, int precision)
 {
     int type = geom->type;
-	size_t size = 0;
+  size_t size = 0;
 
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		size = assvg_point_size(ctx, (RTPOINT*)geom, relative, precision);
-		break;
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    size = assvg_point_size(ctx, (RTPOINT*)geom, relative, precision);
+    break;
 
-	case RTLINETYPE:
-		size = assvg_line_size(ctx, (RTLINE*)geom, relative, precision);
-		break;
+  case RTLINETYPE:
+    size = assvg_line_size(ctx, (RTLINE*)geom, relative, precision);
+    break;
 
-	case RTPOLYGONTYPE:
-		size = assvg_polygon_size(ctx, (RTPOLY*)geom, relative, precision);
-		break;
+  case RTPOLYGONTYPE:
+    size = assvg_polygon_size(ctx, (RTPOLY*)geom, relative, precision);
+    break;
 
-	case RTMULTIPOINTTYPE:
-		size = assvg_multipoint_size(ctx, (RTMPOINT*)geom, relative, precision);
-		break;
+  case RTMULTIPOINTTYPE:
+    size = assvg_multipoint_size(ctx, (RTMPOINT*)geom, relative, precision);
+    break;
 
-	case RTMULTILINETYPE:
-		size = assvg_multiline_size(ctx, (RTMLINE*)geom, relative, precision);
-		break;
+  case RTMULTILINETYPE:
+    size = assvg_multiline_size(ctx, (RTMLINE*)geom, relative, precision);
+    break;
 
-	case RTMULTIPOLYGONTYPE:
-		size = assvg_multipolygon_size(ctx, (RTMPOLY*)geom, relative, precision);
-		break;
+  case RTMULTIPOLYGONTYPE:
+    size = assvg_multipolygon_size(ctx, (RTMPOLY*)geom, relative, precision);
+    break;
 
-	default:
-		rterror(ctx, "assvg_geom_size: '%s' geometry type not supported.",
-		        rttype_name(ctx, type));
-	}
+  default:
+    rterror(ctx, "assvg_geom_size: '%s' geometry type not supported.",
+            rttype_name(ctx, type));
+  }
 
-	return size;
+  return size;
 }
 
 
 static size_t
 pointArray_svg_rel(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int close_ring, int precision)
 {
-	int i, end;
-	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	RTPOINT2D pt, lpt;
-
-	ptr = output;
-
-	if (close_ring) end = pa->npoints;
-	else end = pa->npoints - 1;
-
-	/* Starting point */
-	rt_getPoint2d_p(ctx, pa, 0, &pt);
-
-	if (fabs(pt.x) < OUT_MAX_DOUBLE)
-		sprintf(x, "%.*f", precision, pt.x);
-	else
-		sprintf(x, "%g", pt.x);
-	trim_trailing_zeros(ctx, x);
-
-	if (fabs(pt.y) < OUT_MAX_DOUBLE)
-		sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
-	else
-		sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
-	trim_trailing_zeros(ctx, y);
-
-	ptr += sprintf(ptr,"%s %s l", x, y);
-
-	/* All the following ones */
-	for (i=1 ; i < end ; i++)
-	{
-		lpt = pt;
-
-		rt_getPoint2d_p(ctx, pa, i, &pt);
-		if (fabs(pt.x -lpt.x) < OUT_MAX_DOUBLE)
-			sprintf(x, "%.*f", precision, pt.x -lpt.x);
-		else
-			sprintf(x, "%g", pt.x -lpt.x);
-		trim_trailing_zeros(ctx, x);
-
-		/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-		if (fabs(pt.y -lpt.y) < OUT_MAX_DOUBLE)
-			sprintf(y, "%.*f", precision,
-			        fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y));
-		else
-			sprintf(y, "%g",
-			        fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y));
-		trim_trailing_zeros(ctx, y);
-
-		ptr += sprintf(ptr," %s %s", x, y);
-	}
-
-	return (ptr-output);
+  int i, end;
+  char *ptr;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  RTPOINT2D pt, lpt;
+
+  ptr = output;
+
+  if (close_ring) end = pa->npoints;
+  else end = pa->npoints - 1;
+
+  /* Starting point */
+  rt_getPoint2d_p(ctx, pa, 0, &pt);
+
+  if (fabs(pt.x) < OUT_MAX_DOUBLE)
+    sprintf(x, "%.*f", precision, pt.x);
+  else
+    sprintf(x, "%g", pt.x);
+  trim_trailing_zeros(ctx, x);
+
+  if (fabs(pt.y) < OUT_MAX_DOUBLE)
+    sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
+  else
+    sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
+  trim_trailing_zeros(ctx, y);
+
+  ptr += sprintf(ptr,"%s %s l", x, y);
+
+  /* All the following ones */
+  for (i=1 ; i < end ; i++)
+  {
+    lpt = pt;
+
+    rt_getPoint2d_p(ctx, pa, i, &pt);
+    if (fabs(pt.x -lpt.x) < OUT_MAX_DOUBLE)
+      sprintf(x, "%.*f", precision, pt.x -lpt.x);
+    else
+      sprintf(x, "%g", pt.x -lpt.x);
+    trim_trailing_zeros(ctx, x);
+
+    /* SVG Y axis is reversed, an no need to transform 0 into -0 */
+    if (fabs(pt.y -lpt.y) < OUT_MAX_DOUBLE)
+      sprintf(y, "%.*f", precision,
+              fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y));
+    else
+      sprintf(y, "%g",
+              fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y));
+    trim_trailing_zeros(ctx, y);
+
+    ptr += sprintf(ptr," %s %s", x, y);
+  }
+
+  return (ptr-output);
 }
 
 
@@ -622,40 +622,40 @@ pointArray_svg_rel(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int close_r
 static size_t
 pointArray_svg_abs(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int close_ring, int precision)
 {
-	int i, end;
-	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	RTPOINT2D pt;
-
-	ptr = output;
-
-	if (close_ring) end = pa->npoints;
-	else end = pa->npoints - 1;
-
-	for (i=0 ; i < end ; i++)
-	{
-		rt_getPoint2d_p(ctx, pa, i, &pt);
-
-		if (fabs(pt.x) < OUT_MAX_DOUBLE)
-			sprintf(x, "%.*f", precision, pt.x);
-		else
-			sprintf(x, "%g", pt.x);
-		trim_trailing_zeros(ctx, x);
-
-		/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-		if (fabs(pt.y) < OUT_MAX_DOUBLE)
-			sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
-		else
-			sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
-		trim_trailing_zeros(ctx, y);
-
-		if (i == 1) ptr += sprintf(ptr, " L ");
-		else if (i) ptr += sprintf(ptr, " ");
-		ptr += sprintf(ptr,"%s %s", x, y);
-	}
-
-	return (ptr-output);
+  int i, end;
+  char *ptr;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  RTPOINT2D pt;
+
+  ptr = output;
+
+  if (close_ring) end = pa->npoints;
+  else end = pa->npoints - 1;
+
+  for (i=0 ; i < end ; i++)
+  {
+    rt_getPoint2d_p(ctx, pa, i, &pt);
+
+    if (fabs(pt.x) < OUT_MAX_DOUBLE)
+      sprintf(x, "%.*f", precision, pt.x);
+    else
+      sprintf(x, "%g", pt.x);
+    trim_trailing_zeros(ctx, x);
+
+    /* SVG Y axis is reversed, an no need to transform 0 into -0 */
+    if (fabs(pt.y) < OUT_MAX_DOUBLE)
+      sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
+    else
+      sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
+    trim_trailing_zeros(ctx, y);
+
+    if (i == 1) ptr += sprintf(ptr, " L ");
+    else if (i) ptr += sprintf(ptr, " ");
+    ptr += sprintf(ptr,"%s %s", x, y);
+  }
+
+  return (ptr-output);
 }
 
 
@@ -665,6 +665,6 @@ pointArray_svg_abs(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int close_r
 static size_t
 pointArray_svg_size(const RTCTX *ctx, RTPOINTARRAY *pa, int precision)
 {
-	return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" "))
-	       * 2 * pa->npoints + sizeof(" L ");
+  return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" "))
+         * 2 * pa->npoints + sizeof(" L ");
 }
diff --git a/src/rtout_twkb.c b/src/rtout_twkb.c
index 3c2171e..6532e02 100644
--- a/src/rtout_twkb.c
+++ b/src/rtout_twkb.c
@@ -31,38 +31,38 @@
 */
 static uint8_t rtgeom_twkb_type(const RTCTX *ctx, const RTGEOM *geom)
 {
-	uint8_t twkb_type = 0;
-
-	RTDEBUGF(2, "Entered  rtgeom_twkb_type",0);
-
-	switch ( geom->type )
-	{
-		case RTPOINTTYPE:
-			twkb_type = RTWKB_POINT_TYPE;
-			break;
-		case RTLINETYPE:
-			twkb_type = RTWKB_LINESTRING_TYPE;
-			break;
-		case RTPOLYGONTYPE:
-			twkb_type = RTWKB_POLYGON_TYPE;
-			break;
-		case RTMULTIPOINTTYPE:
-			twkb_type = RTWKB_MULTIPOINT_TYPE;
-			break;
-		case RTMULTILINETYPE:
-			twkb_type = RTWKB_MULTILINESTRING_TYPE;
-			break;
-		case RTMULTIPOLYGONTYPE:
-			twkb_type = RTWKB_MULTIPOLYGON_TYPE;
-			break;
-		case RTCOLLECTIONTYPE:
-			twkb_type = RTWKB_GEOMETRYCOLLECTION_TYPE;
-			break;
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]",
-				rttype_name(ctx, geom->type), geom->type);
-	}
-	return twkb_type;
+  uint8_t twkb_type = 0;
+
+  RTDEBUGF(2, "Entered  rtgeom_twkb_type",0);
+
+  switch ( geom->type )
+  {
+    case RTPOINTTYPE:
+      twkb_type = RTWKB_POINT_TYPE;
+      break;
+    case RTLINETYPE:
+      twkb_type = RTWKB_LINESTRING_TYPE;
+      break;
+    case RTPOLYGONTYPE:
+      twkb_type = RTWKB_POLYGON_TYPE;
+      break;
+    case RTMULTIPOINTTYPE:
+      twkb_type = RTWKB_MULTIPOINT_TYPE;
+      break;
+    case RTMULTILINETYPE:
+      twkb_type = RTWKB_MULTILINESTRING_TYPE;
+      break;
+    case RTMULTIPOLYGONTYPE:
+      twkb_type = RTWKB_MULTIPOLYGON_TYPE;
+      break;
+    case RTCOLLECTIONTYPE:
+      twkb_type = RTWKB_GEOMETRYCOLLECTION_TYPE;
+      break;
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]",
+        rttype_name(ctx, geom->type), geom->type);
+  }
+  return twkb_type;
 }
 
 
@@ -72,16 +72,16 @@ static uint8_t rtgeom_twkb_type(const RTCTX *ctx, const RTGEOM *geom)
 */
 static size_t sizeof_bbox(const RTCTX *ctx, TWKB_STATE *ts, int ndims)
 {
-	int i;
-	uint8_t buf[16];
-	size_t size = 0;
-	RTDEBUGF(2, "Entered %s", __func__);
-	for ( i = 0; i < ndims; i++ )
-	{
-		size += varint_s64_encode_buf(ctx, ts->bbox_min[i], buf);
-		size += varint_s64_encode_buf(ctx, (ts->bbox_max[i] - ts->bbox_min[i]), buf);
-	}
-	return size;
+  int i;
+  uint8_t buf[16];
+  size_t size = 0;
+  RTDEBUGF(2, "Entered %s", __func__);
+  for ( i = 0; i < ndims; i++ )
+  {
+    size += varint_s64_encode_buf(ctx, ts->bbox_min[i], buf);
+    size += varint_s64_encode_buf(ctx, (ts->bbox_max[i] - ts->bbox_min[i]), buf);
+  }
+  return size;
 }
 /**
 * Writes the bbox in varints in the form:
@@ -89,13 +89,13 @@ static size_t sizeof_bbox(const RTCTX *ctx, TWKB_STATE *ts, int ndims)
 */
 static void write_bbox(const RTCTX *ctx, TWKB_STATE *ts, int ndims)
 {
-	int i;
-	RTDEBUGF(2, "Entered %s", __func__);
-	for ( i = 0; i < ndims; i++ )
-	{
-		bytebuffer_append_varint(ctx, ts->header_buf, ts->bbox_min[i]);
-		bytebuffer_append_varint(ctx, ts->header_buf, (ts->bbox_max[i] - ts->bbox_min[i]));
-	}
+  int i;
+  RTDEBUGF(2, "Entered %s", __func__);
+  for ( i = 0; i < ndims; i++ )
+  {
+    bytebuffer_append_varint(ctx, ts->header_buf, ts->bbox_min[i]);
+    bytebuffer_append_varint(ctx, ts->header_buf, (ts->bbox_max[i] - ts->bbox_min[i]));
+  }
 }
 
 
@@ -106,123 +106,123 @@ static void write_bbox(const RTCTX *ctx, TWKB_STATE *ts, int ndims)
 */
 static int ptarray_to_twkb_buf(const RTCTX *ctx, const RTPOINTARRAY *pa, TWKB_GLOBALS *globals, TWKB_STATE *ts, int register_npoints, int minpoints)
 {
-	int ndims = RTFLAGS_NDIMS(pa->flags);
-	int i, j;
-	bytebuffer_t b;
-	bytebuffer_t *b_p;
-	int64_t nextdelta[MAX_N_DIMS];
-	int npoints = 0;
-	size_t npoints_offset = 0;
-
-	RTDEBUGF(2, "Entered %s", __func__);
-
-	/* Dispense with the empty case right away */
-	if ( pa->npoints == 0 && register_npoints )	
-	{		
-		RTDEBUGF(4, "Register npoints:%d", pa->npoints);
-		bytebuffer_append_uvarint(ctx, ts->geom_buf, pa->npoints);
-		return 0;
-	}
-
-	/* If npoints is more than 127 it is unpredictable how many bytes npoints will need */
-	/* Then we have to store the deltas in a temp buffer to later add them after npoints */
-	/* If noints is below 128 we know 1 byte will be needed */
-	/* Then we can make room for that 1 byte at once and write to */
-	/* ordinary buffer */
-	if( pa->npoints > 127 )
-	{
-		/* Independent buffer to hold the coordinates, so we can put the npoints */
-		/* into the stream once we know how many points we actually have */
-		bytebuffer_init_with_size(ctx, &b, 3 * ndims * pa->npoints);
-		b_p = &b;
-	}
-	else
-	{
-		/* We give an alias to our ordinary buffer */
-		b_p = ts->geom_buf;
-		if ( register_npoints )		
-		{		
-			/* We do not store a pointer to the place where we want the npoints value */
-			/* Instead we store how far from the beginning of the buffer we want the value */
-			/* That is because we otherwise will get in trouble if the buffer is reallocated */			
-			npoints_offset = b_p->writecursor - b_p->buf_start;
-			
-			/* We just move the cursor 1 step to make room for npoints byte */
-			/* We use the function append_byte even if we have no value yet, */
-			/* since that gives us the check for big enough buffer and moves the cursor */
-			bytebuffer_append_byte(ctx, b_p, 0);
-		}
-	}
-	
-	for ( i = 0; i < pa->npoints; i++ )
-	{
-		double *dbl_ptr = (double*)rt_getPoint_internal(ctx, pa, i);
-		int diff = 0;
-
-		/* Write this coordinate to the buffer as a varint */
-		for ( j = 0; j < ndims; j++ )
-		{
-			/* To get the relative coordinate we don't get the distance */
-			/* from the last point but instead the distance from our */
-			/* last accumulated point. This is important to not build up an */
-			/* accumulated error when rounding the coordinates */
-			nextdelta[j] = (int64_t) llround(globals->factor[j] * dbl_ptr[j]) - ts->accum_rels[j];
-			RTDEBUGF(4, "deltavalue: %d, ", nextdelta[j]);
-			diff += llabs(nextdelta[j]);
-		}
-		
-		/* Skipping the first point is not allowed */
-		/* If the sum(abs()) of all the deltas was zero, */
-		/* then this was a duplicate point, so we can ignore it */
-		if ( i > minpoints && diff == 0 )
-			continue;
-		
-		/* We really added a point, so... */
-		npoints++;
-		
-		/* Write this vertex to the temporary buffer as varints */
-		for ( j = 0; j < ndims; j++ )
-		{
-			ts->accum_rels[j] += nextdelta[j];
-			bytebuffer_append_varint(ctx, b_p, nextdelta[j]);
-		}
-
-		/* See if this coordinate expands the bounding box */
-		if( globals->variant & TWKB_BBOX )
-		{
-			for ( j = 0; j < ndims; j++ )
-			{
-				if( ts->accum_rels[j] > ts->bbox_max[j] )
-					ts->bbox_max[j] = ts->accum_rels[j];
-
-				if( ts->accum_rels[j] < ts->bbox_min[j] )
-					ts->bbox_min[j] = ts->accum_rels[j];
-			}
-		}
-
-	}	
-
-	if ( pa->npoints > 127 )
-	{		
-		/* Now write the temporary results into the main buffer */
-		/* First the npoints */
-		if ( register_npoints )	
-			bytebuffer_append_uvarint(ctx, ts->geom_buf, npoints);
-		/* Now the coordinates */
-		bytebuffer_append_bytebuffer(ctx, ts->geom_buf, b_p);
-		
-		/* Clear our temporary buffer */
-		rtfree(ctx, b.buf_start);
-	}
-	else
-	{
-		/* If we didn't use a temp buffer, we just write that npoints value */
-		/* to where it belongs*/
-		if ( register_npoints )	
-			varint_u64_encode_buf(ctx, npoints, b_p->buf_start + npoints_offset);
-	}
-	
-	return 0;
+  int ndims = RTFLAGS_NDIMS(pa->flags);
+  int i, j;
+  bytebuffer_t b;
+  bytebuffer_t *b_p;
+  int64_t nextdelta[MAX_N_DIMS];
+  int npoints = 0;
+  size_t npoints_offset = 0;
+
+  RTDEBUGF(2, "Entered %s", __func__);
+
+  /* Dispense with the empty case right away */
+  if ( pa->npoints == 0 && register_npoints )
+  {
+    RTDEBUGF(4, "Register npoints:%d", pa->npoints);
+    bytebuffer_append_uvarint(ctx, ts->geom_buf, pa->npoints);
+    return 0;
+  }
+
+  /* If npoints is more than 127 it is unpredictable how many bytes npoints will need */
+  /* Then we have to store the deltas in a temp buffer to later add them after npoints */
+  /* If noints is below 128 we know 1 byte will be needed */
+  /* Then we can make room for that 1 byte at once and write to */
+  /* ordinary buffer */
+  if( pa->npoints > 127 )
+  {
+    /* Independent buffer to hold the coordinates, so we can put the npoints */
+    /* into the stream once we know how many points we actually have */
+    bytebuffer_init_with_size(ctx, &b, 3 * ndims * pa->npoints);
+    b_p = &b;
+  }
+  else
+  {
+    /* We give an alias to our ordinary buffer */
+    b_p = ts->geom_buf;
+    if ( register_npoints )
+    {
+      /* We do not store a pointer to the place where we want the npoints value */
+      /* Instead we store how far from the beginning of the buffer we want the value */
+      /* That is because we otherwise will get in trouble if the buffer is reallocated */
+      npoints_offset = b_p->writecursor - b_p->buf_start;
+
+      /* We just move the cursor 1 step to make room for npoints byte */
+      /* We use the function append_byte even if we have no value yet, */
+      /* since that gives us the check for big enough buffer and moves the cursor */
+      bytebuffer_append_byte(ctx, b_p, 0);
+    }
+  }
+
+  for ( i = 0; i < pa->npoints; i++ )
+  {
+    double *dbl_ptr = (double*)rt_getPoint_internal(ctx, pa, i);
+    int diff = 0;
+
+    /* Write this coordinate to the buffer as a varint */
+    for ( j = 0; j < ndims; j++ )
+    {
+      /* To get the relative coordinate we don't get the distance */
+      /* from the last point but instead the distance from our */
+      /* last accumulated point. This is important to not build up an */
+      /* accumulated error when rounding the coordinates */
+      nextdelta[j] = (int64_t) llround(globals->factor[j] * dbl_ptr[j]) - ts->accum_rels[j];
+      RTDEBUGF(4, "deltavalue: %d, ", nextdelta[j]);
+      diff += llabs(nextdelta[j]);
+    }
+
+    /* Skipping the first point is not allowed */
+    /* If the sum(abs()) of all the deltas was zero, */
+    /* then this was a duplicate point, so we can ignore it */
+    if ( i > minpoints && diff == 0 )
+      continue;
+
+    /* We really added a point, so... */
+    npoints++;
+
+    /* Write this vertex to the temporary buffer as varints */
+    for ( j = 0; j < ndims; j++ )
+    {
+      ts->accum_rels[j] += nextdelta[j];
+      bytebuffer_append_varint(ctx, b_p, nextdelta[j]);
+    }
+
+    /* See if this coordinate expands the bounding box */
+    if( globals->variant & TWKB_BBOX )
+    {
+      for ( j = 0; j < ndims; j++ )
+      {
+        if( ts->accum_rels[j] > ts->bbox_max[j] )
+          ts->bbox_max[j] = ts->accum_rels[j];
+
+        if( ts->accum_rels[j] < ts->bbox_min[j] )
+          ts->bbox_min[j] = ts->accum_rels[j];
+      }
+    }
+
+  }
+
+  if ( pa->npoints > 127 )
+  {
+    /* Now write the temporary results into the main buffer */
+    /* First the npoints */
+    if ( register_npoints )
+      bytebuffer_append_uvarint(ctx, ts->geom_buf, npoints);
+    /* Now the coordinates */
+    bytebuffer_append_bytebuffer(ctx, ts->geom_buf, b_p);
+
+    /* Clear our temporary buffer */
+    rtfree(ctx, b.buf_start);
+  }
+  else
+  {
+    /* If we didn't use a temp buffer, we just write that npoints value */
+    /* to where it belongs*/
+    if ( register_npoints )
+      varint_u64_encode_buf(ctx, npoints, b_p->buf_start + npoints_offset);
+  }
+
+  return 0;
 }
 
 /******************************************************************
@@ -231,11 +231,11 @@ static int ptarray_to_twkb_buf(const RTCTX *ctx, const RTPOINTARRAY *pa, TWKB_GL
 
 static int rtpoint_to_twkb_buf(const RTCTX *ctx, const RTPOINT *pt, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	RTDEBUGF(2, "Entered %s", __func__);
+  RTDEBUGF(2, "Entered %s", __func__);
 
-	/* Set the coordinates (don't write npoints) */
-	ptarray_to_twkb_buf(ctx, pt->point, globals, ts, 0, 1);
-	return 0;
+  /* Set the coordinates (don't write npoints) */
+  ptarray_to_twkb_buf(ctx, pt->point, globals, ts, 0, 1);
+  return 0;
 }
 
 /******************************************************************
@@ -244,11 +244,11 @@ static int rtpoint_to_twkb_buf(const RTCTX *ctx, const RTPOINT *pt, TWKB_GLOBALS
 
 static int rtline_to_twkb_buf(const RTCTX *ctx, const RTLINE *line, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	RTDEBUGF(2, "Entered %s", __func__);
+  RTDEBUGF(2, "Entered %s", __func__);
 
-	/* Set the coordinates (do write npoints) */
-	ptarray_to_twkb_buf(ctx, line->points, globals, ts, 1, 2);
-	return 0;
+  /* Set the coordinates (do write npoints) */
+  ptarray_to_twkb_buf(ctx, line->points, globals, ts, 1, 2);
+  return 0;
 }
 
 /******************************************************************
@@ -257,18 +257,18 @@ static int rtline_to_twkb_buf(const RTCTX *ctx, const RTLINE *line, TWKB_GLOBALS
 
 static int rtpoly_to_twkb_buf(const RTCTX *ctx, const RTPOLY *poly, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	int i;
+  int i;
 
-	/* Set the number of rings */
-	bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) poly->nrings);
+  /* Set the number of rings */
+  bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) poly->nrings);
 
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		/* Set the coordinates (do write npoints) */
-		ptarray_to_twkb_buf(ctx, poly->rings[i], globals, ts, 1, 4);
-	}
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    /* Set the coordinates (do write npoints) */
+    ptarray_to_twkb_buf(ctx, poly->rings[i], globals, ts, 1, 4);
+  }
 
-	return 0;
+  return 0;
 }
 
 
@@ -279,48 +279,48 @@ static int rtpoly_to_twkb_buf(const RTCTX *ctx, const RTPOLY *poly, TWKB_GLOBALS
 
 static int rtmulti_to_twkb_buf(const RTCTX *ctx, const RTCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	int i;
-	int nempty = 0;
-
-	RTDEBUGF(2, "Entered %s", __func__);
-	RTDEBUGF(4, "Number of geometries in multi is %d", col->ngeoms);
-
-	/* Deal with special case for MULTIPOINT: skip any empty points */
-	if ( col->type == RTMULTIPOINTTYPE )
-	{
-		for ( i = 0; i < col->ngeoms; i++ )
-			if ( rtgeom_is_empty(ctx, col->geoms[i]) )
-				nempty++;
-	}
-
-	/* Set the number of geometries */
-	bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) (col->ngeoms - nempty));
-
-	/* We've been handed an idlist, so write it in */
-	if ( ts->idlist )
-	{
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			/* Skip empty points in multipoints, we can't represent them */
-			if ( col->type == RTMULTIPOINTTYPE && rtgeom_is_empty(ctx, col->geoms[i]) )
-				continue;
-			
-			bytebuffer_append_varint(ctx, ts->geom_buf, ts->idlist[i]);
-		}
-		
-		/* Empty it out to nobody else uses it now */
-		ts->idlist = NULL;
-	}
-
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		/* Skip empty points in multipoints, we can't represent them */
-		if ( col->type == RTMULTIPOINTTYPE && rtgeom_is_empty(ctx, col->geoms[i]) )
-			continue;
-
-		rtgeom_to_twkb_buf(ctx, col->geoms[i], globals, ts);
-	}
-	return 0;
+  int i;
+  int nempty = 0;
+
+  RTDEBUGF(2, "Entered %s", __func__);
+  RTDEBUGF(4, "Number of geometries in multi is %d", col->ngeoms);
+
+  /* Deal with special case for MULTIPOINT: skip any empty points */
+  if ( col->type == RTMULTIPOINTTYPE )
+  {
+    for ( i = 0; i < col->ngeoms; i++ )
+      if ( rtgeom_is_empty(ctx, col->geoms[i]) )
+        nempty++;
+  }
+
+  /* Set the number of geometries */
+  bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) (col->ngeoms - nempty));
+
+  /* We've been handed an idlist, so write it in */
+  if ( ts->idlist )
+  {
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      /* Skip empty points in multipoints, we can't represent them */
+      if ( col->type == RTMULTIPOINTTYPE && rtgeom_is_empty(ctx, col->geoms[i]) )
+        continue;
+
+      bytebuffer_append_varint(ctx, ts->geom_buf, ts->idlist[i]);
+    }
+
+    /* Empty it out to nobody else uses it now */
+    ts->idlist = NULL;
+  }
+
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    /* Skip empty points in multipoints, we can't represent them */
+    if ( col->type == RTMULTIPOINTTYPE && rtgeom_is_empty(ctx, col->geoms[i]) )
+      continue;
+
+    rtgeom_to_twkb_buf(ctx, col->geoms[i], globals, ts);
+  }
+  return 0;
 }
 
 /******************************************************************
@@ -329,30 +329,30 @@ static int rtmulti_to_twkb_buf(const RTCTX *ctx, const RTCOLLECTION *col, TWKB_G
 
 static int rtcollection_to_twkb_buf(const RTCTX *ctx, const RTCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	int i;
-
-	RTDEBUGF(2, "Entered %s", __func__);
-	RTDEBUGF(4, "Number of geometries in collection is %d", col->ngeoms);
-
-	/* Set the number of geometries */
-	bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) col->ngeoms);
-
-	/* We've been handed an idlist, so write it in */
-	if ( ts->idlist )
-	{
-		for ( i = 0; i < col->ngeoms; i++ )
-			bytebuffer_append_varint(ctx, ts->geom_buf, ts->idlist[i]);
-		
-		/* Empty it out to nobody else uses it now */
-		ts->idlist = NULL;
-	}
-
-	/* Write in the sub-geometries */
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		rtgeom_write_to_buffer(ctx, col->geoms[i], globals, ts);
-	}
-	return 0;
+  int i;
+
+  RTDEBUGF(2, "Entered %s", __func__);
+  RTDEBUGF(4, "Number of geometries in collection is %d", col->ngeoms);
+
+  /* Set the number of geometries */
+  bytebuffer_append_uvarint(ctx, ts->geom_buf, (uint64_t) col->ngeoms);
+
+  /* We've been handed an idlist, so write it in */
+  if ( ts->idlist )
+  {
+    for ( i = 0; i < col->ngeoms; i++ )
+      bytebuffer_append_varint(ctx, ts->geom_buf, ts->idlist[i]);
+
+    /* Empty it out to nobody else uses it now */
+    ts->idlist = NULL;
+  }
+
+  /* Write in the sub-geometries */
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    rtgeom_write_to_buffer(ctx, col->geoms[i], globals, ts);
+  }
+  return 0;
 }
 
 
@@ -362,194 +362,194 @@ static int rtcollection_to_twkb_buf(const RTCTX *ctx, const RTCOLLECTION *col, T
 
 static int rtgeom_to_twkb_buf(const RTCTX *ctx, const RTGEOM *geom, TWKB_GLOBALS *globals, TWKB_STATE *ts)
 {
-	RTDEBUGF(2, "Entered %s", __func__);
-
-	switch ( geom->type )
-	{
-		case RTPOINTTYPE:
-		{
-			RTDEBUGF(4,"Type found is Point, %d", geom->type);
-			return rtpoint_to_twkb_buf(ctx, (RTPOINT*) geom, globals, ts);
-		}
-		case RTLINETYPE:
-		{
-			RTDEBUGF(4,"Type found is Linestring, %d", geom->type);
-			return rtline_to_twkb_buf(ctx, (RTLINE*) geom, globals, ts);
-		}
-		/* Polygon has 'nrings' and 'rings' elements */
-		case RTPOLYGONTYPE:
-		{
-			RTDEBUGF(4,"Type found is Polygon, %d", geom->type);
-			return rtpoly_to_twkb_buf(ctx, (RTPOLY*)geom, globals, ts);
-		}
-
-		/* All these Collection types have 'ngeoms' and 'geoms' elements */
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		{
-			RTDEBUGF(4,"Type found is Multi, %d", geom->type);
-			return rtmulti_to_twkb_buf(ctx, (RTCOLLECTION*)geom, globals, ts);
-		}
-		case RTCOLLECTIONTYPE:
-		{
-			RTDEBUGF(4,"Type found is collection, %d", geom->type);
-			return rtcollection_to_twkb_buf(ctx, (RTCOLLECTION*) geom, globals, ts);
-		}
-		/* Unknown type! */
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, (geom)->type), (geom)->type);
-	}
-
-	return 0;
+  RTDEBUGF(2, "Entered %s", __func__);
+
+  switch ( geom->type )
+  {
+    case RTPOINTTYPE:
+    {
+      RTDEBUGF(4,"Type found is Point, %d", geom->type);
+      return rtpoint_to_twkb_buf(ctx, (RTPOINT*) geom, globals, ts);
+    }
+    case RTLINETYPE:
+    {
+      RTDEBUGF(4,"Type found is Linestring, %d", geom->type);
+      return rtline_to_twkb_buf(ctx, (RTLINE*) geom, globals, ts);
+    }
+    /* Polygon has 'nrings' and 'rings' elements */
+    case RTPOLYGONTYPE:
+    {
+      RTDEBUGF(4,"Type found is Polygon, %d", geom->type);
+      return rtpoly_to_twkb_buf(ctx, (RTPOLY*)geom, globals, ts);
+    }
+
+    /* All these Collection types have 'ngeoms' and 'geoms' elements */
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    {
+      RTDEBUGF(4,"Type found is Multi, %d", geom->type);
+      return rtmulti_to_twkb_buf(ctx, (RTCOLLECTION*)geom, globals, ts);
+    }
+    case RTCOLLECTIONTYPE:
+    {
+      RTDEBUGF(4,"Type found is collection, %d", geom->type);
+      return rtcollection_to_twkb_buf(ctx, (RTCOLLECTION*) geom, globals, ts);
+    }
+    /* Unknown type! */
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, (geom)->type), (geom)->type);
+  }
+
+  return 0;
 }
 
 
 static int rtgeom_write_to_buffer(const RTCTX *ctx, const RTGEOM *geom, TWKB_GLOBALS *globals, TWKB_STATE *parent_state)
 {
-	int i, is_empty, has_z, has_m, ndims;
-	size_t bbox_size = 0, optional_precision_byte = 0;
-	uint8_t flag = 0, type_prec = 0;
-
-	TWKB_STATE child_state;
-	memset(&child_state, 0, sizeof(TWKB_STATE));
-	child_state.header_buf = bytebuffer_create_with_size(ctx, 16);
-	child_state.geom_buf = bytebuffer_create_with_size(ctx, 64);
-	child_state.idlist = parent_state->idlist;
-
-	/* Read dimensionality from input */
-	has_z = rtgeom_has_z(ctx, geom);
-	has_m = rtgeom_has_m(ctx, geom);
-	ndims = rtgeom_ndims(ctx, geom);
-	is_empty = rtgeom_is_empty(ctx, geom);
-
-	/* Do we need extended precision? If we have a Z or M we do. */
-	optional_precision_byte = (has_z || has_m);
-
-	/* Both X and Y dimension use the same precision */
-	globals->factor[0] = pow(10, globals->prec_xy);
-	globals->factor[1] = globals->factor[0];
-
-	/* Z and M dimensions have their own precisions */
-	if ( has_z )
-		globals->factor[2] = pow(10, globals->prec_z);
-	if ( has_m )
-		globals->factor[2 + has_z] = pow(10, globals->prec_m);
-
-	/* Reset stats */
-	for ( i = 0; i < MAX_N_DIMS; i++ )
-	{
-		/* Reset bbox calculation */
-		child_state.bbox_max[i] = INT64_MIN;
-		child_state.bbox_min[i] = INT64_MAX;
-		/* Reset acumulated delta values to get absolute values on next point */
-		child_state.accum_rels[i] = 0;
-	}
-
-	/* RTTYPE/PRECISION BYTE */
-	if ( abs(globals->prec_xy) > 7 )
-		rterror(ctx, "%s: X/Z precision cannot be greater than 7 or less than -7", __func__);
-	
-	/* Read the TWKB type number from the geometry */
-	RTTYPE_PREC_SET_TYPE(type_prec, rtgeom_twkb_type(ctx, geom));
-	/* Zig-zag the precision value before encoding it since it is a signed value */
-	TYPE_PREC_SET_PREC(type_prec, zigzag8(ctx, globals->prec_xy));
-	/* Write the type and precision byte */
-	bytebuffer_append_byte(ctx, child_state.header_buf, type_prec);
-
-	/* METADATA BYTE */
-	/* Set first bit if we are going to store bboxes */
-	FIRST_BYTE_SET_BBOXES(flag, (globals->variant & TWKB_BBOX) && ! is_empty);
-	/* Set second bit if we are going to store resulting size */
-	FIRST_BYTE_SET_SIZES(flag, globals->variant & TWKB_SIZE);
-	/* There will be no ID-list (for now) */
-	FIRST_BYTE_SET_IDLIST(flag, parent_state->idlist && ! is_empty);
-	/* Are there higher dimensions */
-	FIRST_BYTE_SET_EXTENDED(flag, optional_precision_byte);
-	/* Empty? */
-	FIRST_BYTE_SET_EMPTY(flag, is_empty);
-	/* Write the header byte */
-	bytebuffer_append_byte(ctx, child_state.header_buf, flag);
-
-	/* EXTENDED PRECISION BYTE (OPTIONAL) */
-	/* If needed, write the extended dim byte */
-	if( optional_precision_byte )
-	{
-		uint8_t flag = 0;
-
-		if ( has_z && ( globals->prec_z > 7 || globals->prec_z < 0 ) )
-			rterror(ctx, "%s: Z precision cannot be negative or greater than 7", __func__);
-
-		if ( has_m && ( globals->prec_m > 7 || globals->prec_m < 0 ) )
-			rterror(ctx, "%s: M precision cannot be negative or greater than 7", __func__);
-
-		HIGHER_DIM_SET_HASZ(flag, has_z);
-		HIGHER_DIM_SET_HASM(flag, has_m);
-		HIGHER_DIM_SET_PRECZ(flag, globals->prec_z);
-		HIGHER_DIM_SET_PRECM(flag, globals->prec_m);
-		bytebuffer_append_byte(ctx, child_state.header_buf, flag);
-	}
-
-	/* It the geometry is empty, we're almost done */
-	if ( is_empty )
-	{
-		/* If this output is sized, write the size of */
-		/* all following content, which is zero because */
-		/* there is none */
-		if ( globals->variant & TWKB_SIZE )
-			bytebuffer_append_byte(ctx, child_state.header_buf, 0);
-
-		bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf, child_state.header_buf);
-		bytebuffer_destroy(ctx, child_state.header_buf);
-		bytebuffer_destroy(ctx, child_state.geom_buf);
-		return 0;
-	}
-
-	/* Write the TWKB into the output buffer */
-	rtgeom_to_twkb_buf(ctx, geom, globals, &child_state);
-
-	/*If we have a header_buf, we know that this function is called inside a collection*/
-	/*and then we have to merge the bboxes of the included geometries*/
-	/*and put the result to the parent (the collection)*/
-	if( (globals->variant & TWKB_BBOX) && parent_state->header_buf )
-	{
-		RTDEBUG(4,"Merge bboxes");
-		for ( i = 0; i < ndims; i++ )
-		{
-			if(child_state.bbox_min[i]<parent_state->bbox_min[i])
-				parent_state->bbox_min[i] = child_state.bbox_min[i];
-			if(child_state.bbox_max[i]>parent_state->bbox_max[i])
-				parent_state->bbox_max[i] = child_state.bbox_max[i];
-		}
-	}
-	
-	/* Did we have a box? If so, how big? */
-	bbox_size = 0;
-	if( globals->variant & TWKB_BBOX )
-	{
-		RTDEBUG(4,"We want boxes and will calculate required size");
-		bbox_size = sizeof_bbox(ctx, &child_state, ndims);
-	}
-
-	/* Write the size if wanted */
-	if( globals->variant & TWKB_SIZE )
-	{
-		/* Here we have to add what we know will be written to header */
-		/* buffer after size value is written */
-		size_t size_to_register = bytebuffer_getlength(ctx, child_state.geom_buf);
-		size_to_register += bbox_size;
-		bytebuffer_append_uvarint(ctx, child_state.header_buf, size_to_register);
-	}
-
-	if( globals->variant & TWKB_BBOX )
-		write_bbox(ctx, &child_state, ndims);
-
-	bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf,child_state.header_buf);
-	bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf,child_state.geom_buf);
-
-	bytebuffer_destroy(ctx, child_state.header_buf);
-	bytebuffer_destroy(ctx, child_state.geom_buf);
-	return 0;
+  int i, is_empty, has_z, has_m, ndims;
+  size_t bbox_size = 0, optional_precision_byte = 0;
+  uint8_t flag = 0, type_prec = 0;
+
+  TWKB_STATE child_state;
+  memset(&child_state, 0, sizeof(TWKB_STATE));
+  child_state.header_buf = bytebuffer_create_with_size(ctx, 16);
+  child_state.geom_buf = bytebuffer_create_with_size(ctx, 64);
+  child_state.idlist = parent_state->idlist;
+
+  /* Read dimensionality from input */
+  has_z = rtgeom_has_z(ctx, geom);
+  has_m = rtgeom_has_m(ctx, geom);
+  ndims = rtgeom_ndims(ctx, geom);
+  is_empty = rtgeom_is_empty(ctx, geom);
+
+  /* Do we need extended precision? If we have a Z or M we do. */
+  optional_precision_byte = (has_z || has_m);
+
+  /* Both X and Y dimension use the same precision */
+  globals->factor[0] = pow(10, globals->prec_xy);
+  globals->factor[1] = globals->factor[0];
+
+  /* Z and M dimensions have their own precisions */
+  if ( has_z )
+    globals->factor[2] = pow(10, globals->prec_z);
+  if ( has_m )
+    globals->factor[2 + has_z] = pow(10, globals->prec_m);
+
+  /* Reset stats */
+  for ( i = 0; i < MAX_N_DIMS; i++ )
+  {
+    /* Reset bbox calculation */
+    child_state.bbox_max[i] = INT64_MIN;
+    child_state.bbox_min[i] = INT64_MAX;
+    /* Reset acumulated delta values to get absolute values on next point */
+    child_state.accum_rels[i] = 0;
+  }
+
+  /* RTTYPE/PRECISION BYTE */
+  if ( abs(globals->prec_xy) > 7 )
+    rterror(ctx, "%s: X/Z precision cannot be greater than 7 or less than -7", __func__);
+
+  /* Read the TWKB type number from the geometry */
+  RTTYPE_PREC_SET_TYPE(type_prec, rtgeom_twkb_type(ctx, geom));
+  /* Zig-zag the precision value before encoding it since it is a signed value */
+  TYPE_PREC_SET_PREC(type_prec, zigzag8(ctx, globals->prec_xy));
+  /* Write the type and precision byte */
+  bytebuffer_append_byte(ctx, child_state.header_buf, type_prec);
+
+  /* METADATA BYTE */
+  /* Set first bit if we are going to store bboxes */
+  FIRST_BYTE_SET_BBOXES(flag, (globals->variant & TWKB_BBOX) && ! is_empty);
+  /* Set second bit if we are going to store resulting size */
+  FIRST_BYTE_SET_SIZES(flag, globals->variant & TWKB_SIZE);
+  /* There will be no ID-list (for now) */
+  FIRST_BYTE_SET_IDLIST(flag, parent_state->idlist && ! is_empty);
+  /* Are there higher dimensions */
+  FIRST_BYTE_SET_EXTENDED(flag, optional_precision_byte);
+  /* Empty? */
+  FIRST_BYTE_SET_EMPTY(flag, is_empty);
+  /* Write the header byte */
+  bytebuffer_append_byte(ctx, child_state.header_buf, flag);
+
+  /* EXTENDED PRECISION BYTE (OPTIONAL) */
+  /* If needed, write the extended dim byte */
+  if( optional_precision_byte )
+  {
+    uint8_t flag = 0;
+
+    if ( has_z && ( globals->prec_z > 7 || globals->prec_z < 0 ) )
+      rterror(ctx, "%s: Z precision cannot be negative or greater than 7", __func__);
+
+    if ( has_m && ( globals->prec_m > 7 || globals->prec_m < 0 ) )
+      rterror(ctx, "%s: M precision cannot be negative or greater than 7", __func__);
+
+    HIGHER_DIM_SET_HASZ(flag, has_z);
+    HIGHER_DIM_SET_HASM(flag, has_m);
+    HIGHER_DIM_SET_PRECZ(flag, globals->prec_z);
+    HIGHER_DIM_SET_PRECM(flag, globals->prec_m);
+    bytebuffer_append_byte(ctx, child_state.header_buf, flag);
+  }
+
+  /* It the geometry is empty, we're almost done */
+  if ( is_empty )
+  {
+    /* If this output is sized, write the size of */
+    /* all following content, which is zero because */
+    /* there is none */
+    if ( globals->variant & TWKB_SIZE )
+      bytebuffer_append_byte(ctx, child_state.header_buf, 0);
+
+    bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf, child_state.header_buf);
+    bytebuffer_destroy(ctx, child_state.header_buf);
+    bytebuffer_destroy(ctx, child_state.geom_buf);
+    return 0;
+  }
+
+  /* Write the TWKB into the output buffer */
+  rtgeom_to_twkb_buf(ctx, geom, globals, &child_state);
+
+  /*If we have a header_buf, we know that this function is called inside a collection*/
+  /*and then we have to merge the bboxes of the included geometries*/
+  /*and put the result to the parent (the collection)*/
+  if( (globals->variant & TWKB_BBOX) && parent_state->header_buf )
+  {
+    RTDEBUG(4,"Merge bboxes");
+    for ( i = 0; i < ndims; i++ )
+    {
+      if(child_state.bbox_min[i]<parent_state->bbox_min[i])
+        parent_state->bbox_min[i] = child_state.bbox_min[i];
+      if(child_state.bbox_max[i]>parent_state->bbox_max[i])
+        parent_state->bbox_max[i] = child_state.bbox_max[i];
+    }
+  }
+
+  /* Did we have a box? If so, how big? */
+  bbox_size = 0;
+  if( globals->variant & TWKB_BBOX )
+  {
+    RTDEBUG(4,"We want boxes and will calculate required size");
+    bbox_size = sizeof_bbox(ctx, &child_state, ndims);
+  }
+
+  /* Write the size if wanted */
+  if( globals->variant & TWKB_SIZE )
+  {
+    /* Here we have to add what we know will be written to header */
+    /* buffer after size value is written */
+    size_t size_to_register = bytebuffer_getlength(ctx, child_state.geom_buf);
+    size_to_register += bbox_size;
+    bytebuffer_append_uvarint(ctx, child_state.header_buf, size_to_register);
+  }
+
+  if( globals->variant & TWKB_BBOX )
+    write_bbox(ctx, &child_state, ndims);
+
+  bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf,child_state.header_buf);
+  bytebuffer_append_bytebuffer(ctx, parent_state->geom_buf,child_state.geom_buf);
+
+  bytebuffer_destroy(ctx, child_state.header_buf);
+  bytebuffer_destroy(ctx, child_state.geom_buf);
+  return 0;
 }
 
 
@@ -562,46 +562,46 @@ rtgeom_to_twkb_with_idlist(const RTCTX *ctx, const RTGEOM *geom, int64_t *idlist
                int8_t precision_xy, int8_t precision_z, int8_t precision_m,
                size_t *twkb_size)
 {
-	RTDEBUGF(2, "Entered %s", __func__);
-	RTDEBUGF(2, "variant value %x", variant);
-
-	TWKB_GLOBALS tg;
-	TWKB_STATE ts;
-
-	uint8_t *twkb;
-
-	memset(&ts, 0, sizeof(TWKB_STATE));
-	memset(&tg, 0, sizeof(TWKB_GLOBALS));
-	
-	tg.variant = variant;
-	tg.prec_xy = precision_xy;
-	tg.prec_z = precision_z;
-	tg.prec_m = precision_m;
-
-	if ( idlist && ! rtgeom_is_collection(ctx, geom) )
-	{
-		rterror(ctx, "Only collections can support ID lists");
-		return NULL;
-	}
-
-	if ( ! geom )
-	{
-		RTDEBUG(4,"Cannot convert NULL into TWKB.");
-		rterror(ctx, "Cannot convert NULL into TWKB");
-		return NULL;
-	}
-	
-	ts.idlist = idlist;
-	ts.header_buf = NULL;
-	ts.geom_buf = bytebuffer_create(ctx);
-	rtgeom_write_to_buffer(ctx, geom, &tg, &ts);
-
-	if ( twkb_size )
-		*twkb_size = bytebuffer_getlength(ctx, ts.geom_buf);
-
-	twkb = ts.geom_buf->buf_start;
-	rtfree(ctx, ts.geom_buf);
-	return twkb;
+  RTDEBUGF(2, "Entered %s", __func__);
+  RTDEBUGF(2, "variant value %x", variant);
+
+  TWKB_GLOBALS tg;
+  TWKB_STATE ts;
+
+  uint8_t *twkb;
+
+  memset(&ts, 0, sizeof(TWKB_STATE));
+  memset(&tg, 0, sizeof(TWKB_GLOBALS));
+
+  tg.variant = variant;
+  tg.prec_xy = precision_xy;
+  tg.prec_z = precision_z;
+  tg.prec_m = precision_m;
+
+  if ( idlist && ! rtgeom_is_collection(ctx, geom) )
+  {
+    rterror(ctx, "Only collections can support ID lists");
+    return NULL;
+  }
+
+  if ( ! geom )
+  {
+    RTDEBUG(4,"Cannot convert NULL into TWKB.");
+    rterror(ctx, "Cannot convert NULL into TWKB");
+    return NULL;
+  }
+
+  ts.idlist = idlist;
+  ts.header_buf = NULL;
+  ts.geom_buf = bytebuffer_create(ctx);
+  rtgeom_write_to_buffer(ctx, geom, &tg, &ts);
+
+  if ( twkb_size )
+    *twkb_size = bytebuffer_getlength(ctx, ts.geom_buf);
+
+  twkb = ts.geom_buf->buf_start;
+  rtfree(ctx, ts.geom_buf);
+  return twkb;
 }
 
 
@@ -610,7 +610,7 @@ rtgeom_to_twkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant,
                int8_t precision_xy, int8_t precision_z, int8_t precision_m,
                size_t *twkb_size)
 {
-	return rtgeom_to_twkb_with_idlist(ctx, geom, NULL, variant, precision_xy, precision_z, precision_m, twkb_size);
+  return rtgeom_to_twkb_with_idlist(ctx, geom, NULL, variant, precision_xy, precision_z, precision_m, twkb_size);
 }
 
 
diff --git a/src/rtout_twkb.h b/src/rtout_twkb.h
index f0ed9ac..20f1029 100644
--- a/src/rtout_twkb.h
+++ b/src/rtout_twkb.h
@@ -76,25 +76,25 @@
 
 typedef struct
 {
-	/* Options defined at start */
-	uint8_t variant;
-	int8_t prec_xy;
-	int8_t prec_z;
-	int8_t prec_m;
-	float factor[4]; /*What factor to multiply the coordiinates with to get the requested precision*/
+  /* Options defined at start */
+  uint8_t variant;
+  int8_t prec_xy;
+  int8_t prec_z;
+  int8_t prec_m;
+  float factor[4]; /*What factor to multiply the coordiinates with to get the requested precision*/
 } TWKB_GLOBALS;
 
 typedef struct
 {
-	uint8_t variant;  /*options that change at runtime*/
-	bytebuffer_t *header_buf;
-	bytebuffer_t *geom_buf;
-	int hasz;
-	int hasm;
-	const int64_t *idlist;
-	int64_t bbox_min[MAX_N_DIMS];
-	int64_t bbox_max[MAX_N_DIMS];
-	int64_t accum_rels[MAX_N_DIMS]; /*Holds the acculmulated relative values*/
+  uint8_t variant;  /*options that change at runtime*/
+  bytebuffer_t *header_buf;
+  bytebuffer_t *geom_buf;
+  int hasz;
+  int hasm;
+  const int64_t *idlist;
+  int64_t bbox_min[MAX_N_DIMS];
+  int64_t bbox_max[MAX_N_DIMS];
+  int64_t accum_rels[MAX_N_DIMS]; /*Holds the acculmulated relative values*/
 } TWKB_STATE;
 
 static int rtgeom_to_twkb_buf(const RTCTX *ctx, const RTGEOM *geom, TWKB_GLOBALS *global_values, TWKB_STATE *ts);
diff --git a/src/rtout_wkb.c b/src/rtout_wkb.c
index 7737846..b8c3370 100644
--- a/src/rtout_wkb.c
+++ b/src/rtout_wkb.c
@@ -37,25 +37,25 @@ static size_t rtgeom_to_wkb_size(const RTCTX *ctx, const RTGEOM *geom, uint8_t v
 */
 static char *hexchr = "0123456789ABCDEF";
 
-char* hexbytes_from_bytes(const RTCTX *ctx, uint8_t *bytes, size_t size) 
+char* hexbytes_from_bytes(const RTCTX *ctx, uint8_t *bytes, size_t size)
 {
-	char *hex;
-	int i;
-	if ( ! bytes || ! size )
-	{
-		rterror(ctx, "hexbutes_from_bytes: invalid input");
-		return NULL;
-	}
-	hex = rtalloc(ctx, size * 2 + 1);
-	hex[2*size] = '\0';
-	for( i = 0; i < size; i++ )
-	{
-		/* Top four bits to 0-F */
-		hex[2*i] = hexchr[bytes[i] >> 4];
-		/* Bottom four bits to 0-F */
-		hex[2*i+1] = hexchr[bytes[i] & 0x0F];
-	}
-	return hex;
+  char *hex;
+  int i;
+  if ( ! bytes || ! size )
+  {
+    rterror(ctx, "hexbutes_from_bytes: invalid input");
+    return NULL;
+  }
+  hex = rtalloc(ctx, size * 2 + 1);
+  hex[2*size] = '\0';
+  for( i = 0; i < size; i++ )
+  {
+    /* Top four bits to 0-F */
+    hex[2*i] = hexchr[bytes[i] >> 4];
+    /* Bottom four bits to 0-F */
+    hex[2*i+1] = hexchr[bytes[i] & 0x0F];
+  }
+  return hex;
 }
 
 /*
@@ -63,18 +63,18 @@ char* hexbytes_from_bytes(const RTCTX *ctx, uint8_t *bytes, size_t size)
 */
 static int rtgeom_wkb_needs_srid(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant)
 {
-	/* Sub-components of collections inherit their SRID from the parent.
-	   We force that behavior with the RTWKB_NO_SRID flag */
-	if ( variant & RTWKB_NO_SRID )
-		return RT_FALSE;
-		
-	/* We can only add an SRID if the geometry has one, and the 
-	   RTWKB form is extended */	
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_has_srid(ctx, geom) )
-		return RT_TRUE;
-		
-	/* Everything else doesn't get an SRID */
-	return RT_FALSE;
+  /* Sub-components of collections inherit their SRID from the parent.
+     We force that behavior with the RTWKB_NO_SRID flag */
+  if ( variant & RTWKB_NO_SRID )
+    return RT_FALSE;
+
+  /* We can only add an SRID if the geometry has one, and the
+     RTWKB form is extended */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_has_srid(ctx, geom) )
+    return RT_TRUE;
+
+  /* Everything else doesn't get an SRID */
+  return RT_FALSE;
 }
 
 /*
@@ -82,81 +82,81 @@ static int rtgeom_wkb_needs_srid(const RTCTX *ctx, const RTGEOM *geom, uint8_t v
 */
 static uint32_t rtgeom_wkb_type(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant)
 {
-	uint32_t wkb_type = 0;
-
-	switch ( geom->type )
-	{
-	case RTPOINTTYPE:
-		wkb_type = RTWKB_POINT_TYPE;
-		break;
-	case RTLINETYPE:
-		wkb_type = RTWKB_LINESTRING_TYPE;
-		break;
-	case RTPOLYGONTYPE:
-		wkb_type = RTWKB_POLYGON_TYPE;
-		break;
-	case RTMULTIPOINTTYPE:
-		wkb_type = RTWKB_MULTIPOINT_TYPE;
-		break;
-	case RTMULTILINETYPE:
-		wkb_type = RTWKB_MULTILINESTRING_TYPE;
-		break;
-	case RTMULTIPOLYGONTYPE:
-		wkb_type = RTWKB_MULTIPOLYGON_TYPE;
-		break;
-	case RTCOLLECTIONTYPE:
-		wkb_type = RTWKB_GEOMETRYCOLLECTION_TYPE;
-		break;
-	case RTCIRCSTRINGTYPE:
-		wkb_type = RTWKB_CIRCULARSTRING_TYPE;
-		break;
-	case RTCOMPOUNDTYPE:
-		wkb_type = RTWKB_COMPOUNDCURVE_TYPE;
-		break;
-	case RTCURVEPOLYTYPE:
-		wkb_type = RTWKB_CURVEPOLYGON_TYPE;
-		break;
-	case RTMULTICURVETYPE:
-		wkb_type = RTWKB_MULTICURVE_TYPE;
-		break;
-	case RTMULTISURFACETYPE:
-		wkb_type = RTWKB_MULTISURFACE_TYPE;
-		break;
-	case RTPOLYHEDRALSURFACETYPE:
-		wkb_type = RTWKB_POLYHEDRALSURFACE_TYPE;
-		break;
-	case RTTINTYPE:
-		wkb_type = RTWKB_TIN_TYPE;
-		break;
-	case RTTRIANGLETYPE:
-		wkb_type = RTWKB_TRIANGLE_TYPE;
-		break;
-	default:
-		rterror(ctx, "Unsupported geometry type: %s [%d]",
-			rttype_name(ctx, geom->type), geom->type);
-	}
-
-	if ( variant & RTWKB_EXTENDED )
-	{
-		if ( RTFLAGS_GET_Z(geom->flags) )
-			wkb_type |= RTWKBZOFFSET;
-		if ( RTFLAGS_GET_M(geom->flags) )
-			wkb_type |= RTWKBMOFFSET;
-/*		if ( geom->srid != SRID_UNKNOWN && ! (variant & RTWKB_NO_SRID) ) */
-		if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
-			wkb_type |= RTWKBSRIDFLAG;
-	}
-	else if ( variant & RTWKB_ISO )
-	{
-		/* Z types are in the 1000 range */
-		if ( RTFLAGS_GET_Z(geom->flags) )
-			wkb_type += 1000;
-		/* M types are in the 2000 range */
-		if ( RTFLAGS_GET_M(geom->flags) )
-			wkb_type += 2000;
-		/* ZM types are in the 1000 + 2000 = 3000 range, see above */
-	}
-	return wkb_type;
+  uint32_t wkb_type = 0;
+
+  switch ( geom->type )
+  {
+  case RTPOINTTYPE:
+    wkb_type = RTWKB_POINT_TYPE;
+    break;
+  case RTLINETYPE:
+    wkb_type = RTWKB_LINESTRING_TYPE;
+    break;
+  case RTPOLYGONTYPE:
+    wkb_type = RTWKB_POLYGON_TYPE;
+    break;
+  case RTMULTIPOINTTYPE:
+    wkb_type = RTWKB_MULTIPOINT_TYPE;
+    break;
+  case RTMULTILINETYPE:
+    wkb_type = RTWKB_MULTILINESTRING_TYPE;
+    break;
+  case RTMULTIPOLYGONTYPE:
+    wkb_type = RTWKB_MULTIPOLYGON_TYPE;
+    break;
+  case RTCOLLECTIONTYPE:
+    wkb_type = RTWKB_GEOMETRYCOLLECTION_TYPE;
+    break;
+  case RTCIRCSTRINGTYPE:
+    wkb_type = RTWKB_CIRCULARSTRING_TYPE;
+    break;
+  case RTCOMPOUNDTYPE:
+    wkb_type = RTWKB_COMPOUNDCURVE_TYPE;
+    break;
+  case RTCURVEPOLYTYPE:
+    wkb_type = RTWKB_CURVEPOLYGON_TYPE;
+    break;
+  case RTMULTICURVETYPE:
+    wkb_type = RTWKB_MULTICURVE_TYPE;
+    break;
+  case RTMULTISURFACETYPE:
+    wkb_type = RTWKB_MULTISURFACE_TYPE;
+    break;
+  case RTPOLYHEDRALSURFACETYPE:
+    wkb_type = RTWKB_POLYHEDRALSURFACE_TYPE;
+    break;
+  case RTTINTYPE:
+    wkb_type = RTWKB_TIN_TYPE;
+    break;
+  case RTTRIANGLETYPE:
+    wkb_type = RTWKB_TRIANGLE_TYPE;
+    break;
+  default:
+    rterror(ctx, "Unsupported geometry type: %s [%d]",
+      rttype_name(ctx, geom->type), geom->type);
+  }
+
+  if ( variant & RTWKB_EXTENDED )
+  {
+    if ( RTFLAGS_GET_Z(geom->flags) )
+      wkb_type |= RTWKBZOFFSET;
+    if ( RTFLAGS_GET_M(geom->flags) )
+      wkb_type |= RTWKBMOFFSET;
+/*    if ( geom->srid != SRID_UNKNOWN && ! (variant & RTWKB_NO_SRID) ) */
+    if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
+      wkb_type |= RTWKBSRIDFLAG;
+  }
+  else if ( variant & RTWKB_ISO )
+  {
+    /* Z types are in the 1000 range */
+    if ( RTFLAGS_GET_Z(geom->flags) )
+      wkb_type += 1000;
+    /* M types are in the 2000 range */
+    if ( RTFLAGS_GET_M(geom->flags) )
+      wkb_type += 2000;
+    /* ZM types are in the 1000 + 2000 = 3000 range, see above */
+  }
+  return wkb_type;
 }
 
 /*
@@ -164,17 +164,17 @@ static uint32_t rtgeom_wkb_type(const RTCTX *ctx, const RTGEOM *geom, uint8_t va
 */
 static uint8_t* endian_to_wkb_buf(const RTCTX *ctx, uint8_t *buf, uint8_t variant)
 {
-	if ( variant & RTWKB_HEX )
-	{
-		buf[0] = '0';
-		buf[1] = ((variant & RTWKB_NDR) ? '1' : '0');
-		return buf + 2;
-	}
-	else
-	{
-		buf[0] = ((variant & RTWKB_NDR) ? 1 : 0);
-		return buf + 1;
-	}
+  if ( variant & RTWKB_HEX )
+  {
+    buf[0] = '0';
+    buf[1] = ((variant & RTWKB_NDR) ? '1' : '0');
+    return buf + 2;
+  }
+  else
+  {
+    buf[0] = ((variant & RTWKB_NDR) ? 1 : 0);
+    return buf + 1;
+  }
 }
 
 /*
@@ -182,13 +182,13 @@ static uint8_t* endian_to_wkb_buf(const RTCTX *ctx, uint8_t *buf, uint8_t varian
 */
 static inline int wkb_swap_bytes(const RTCTX *ctx, uint8_t variant)
 {
-	/* If requested variant matches machine arch, we don't have to swap! */
-	if ( ((variant & RTWKB_NDR) && (getMachineEndian(ctx) == NDR)) ||
-	     ((! (variant & RTWKB_NDR)) && (getMachineEndian(ctx) == XDR)) )
-	{
-		return RT_FALSE;
-	}
-	return RT_TRUE;
+  /* If requested variant matches machine arch, we don't have to swap! */
+  if ( ((variant & RTWKB_NDR) && (getMachineEndian(ctx) == NDR)) ||
+       ((! (variant & RTWKB_NDR)) && (getMachineEndian(ctx) == XDR)) )
+  {
+    return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 /*
@@ -196,46 +196,46 @@ static inline int wkb_swap_bytes(const RTCTX *ctx, uint8_t variant)
 */
 static uint8_t* integer_to_wkb_buf(const RTCTX *ctx, const int ival, uint8_t *buf, uint8_t variant)
 {
-	char *iptr = (char*)(&ival);
-	int i = 0;
-
-	if ( sizeof(int) != RTWKB_INT_SIZE )
-	{
-		rterror(ctx, "Machine int size is not %d bytes!", RTWKB_INT_SIZE);
-	}
-	RTDEBUGF(4, "Writing value '%u'", ival);
-	if ( variant & RTWKB_HEX )
-	{
-		int swap = wkb_swap_bytes(ctx, variant);
-		/* Machine/request arch mismatch, so flip byte order */
-		for ( i = 0; i < RTWKB_INT_SIZE; i++ )
-		{
-			int j = (swap ? RTWKB_INT_SIZE - 1 - i : i);
-			uint8_t b = iptr[j];
-			/* Top four bits to 0-F */
-			buf[2*i] = hexchr[b >> 4];
-			/* Bottom four bits to 0-F */
-			buf[2*i+1] = hexchr[b & 0x0F];
-		}
-		return buf + (2 * RTWKB_INT_SIZE);
-	}
-	else
-	{
-		/* Machine/request arch mismatch, so flip byte order */
-		if ( wkb_swap_bytes(ctx, variant) )
-		{
-			for ( i = 0; i < RTWKB_INT_SIZE; i++ )
-			{
-				buf[i] = iptr[RTWKB_INT_SIZE - 1 - i];
-			}
-		}
-		/* If machine arch and requested arch match, don't flip byte order */
-		else
-		{
-			memcpy(buf, iptr, RTWKB_INT_SIZE);
-		}
-		return buf + RTWKB_INT_SIZE;
-	}
+  char *iptr = (char*)(&ival);
+  int i = 0;
+
+  if ( sizeof(int) != RTWKB_INT_SIZE )
+  {
+    rterror(ctx, "Machine int size is not %d bytes!", RTWKB_INT_SIZE);
+  }
+  RTDEBUGF(4, "Writing value '%u'", ival);
+  if ( variant & RTWKB_HEX )
+  {
+    int swap = wkb_swap_bytes(ctx, variant);
+    /* Machine/request arch mismatch, so flip byte order */
+    for ( i = 0; i < RTWKB_INT_SIZE; i++ )
+    {
+      int j = (swap ? RTWKB_INT_SIZE - 1 - i : i);
+      uint8_t b = iptr[j];
+      /* Top four bits to 0-F */
+      buf[2*i] = hexchr[b >> 4];
+      /* Bottom four bits to 0-F */
+      buf[2*i+1] = hexchr[b & 0x0F];
+    }
+    return buf + (2 * RTWKB_INT_SIZE);
+  }
+  else
+  {
+    /* Machine/request arch mismatch, so flip byte order */
+    if ( wkb_swap_bytes(ctx, variant) )
+    {
+      for ( i = 0; i < RTWKB_INT_SIZE; i++ )
+      {
+        buf[i] = iptr[RTWKB_INT_SIZE - 1 - i];
+      }
+    }
+    /* If machine arch and requested arch match, don't flip byte order */
+    else
+    {
+      memcpy(buf, iptr, RTWKB_INT_SIZE);
+    }
+    return buf + RTWKB_INT_SIZE;
+  }
 }
 
 /*
@@ -243,46 +243,46 @@ static uint8_t* integer_to_wkb_buf(const RTCTX *ctx, const int ival, uint8_t *bu
 */
 static uint8_t* double_to_wkb_buf(const RTCTX *ctx, const double d, uint8_t *buf, uint8_t variant)
 {
-	char *dptr = (char*)(&d);
-	int i = 0;
-
-	if ( sizeof(double) != RTWKB_DOUBLE_SIZE )
-	{
-		rterror(ctx, "Machine double size is not %d bytes!", RTWKB_DOUBLE_SIZE);
-	}
-
-	if ( variant & RTWKB_HEX )
-	{
-		int swap =  wkb_swap_bytes(ctx, variant);
-		/* Machine/request arch mismatch, so flip byte order */
-		for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
-		{
-			int j = (swap ? RTWKB_DOUBLE_SIZE - 1 - i : i);
-			uint8_t b = dptr[j];
-			/* Top four bits to 0-F */
-			buf[2*i] = hexchr[b >> 4];
-			/* Bottom four bits to 0-F */
-			buf[2*i+1] = hexchr[b & 0x0F];
-		}
-		return buf + (2 * RTWKB_DOUBLE_SIZE);
-	}
-	else
-	{
-		/* Machine/request arch mismatch, so flip byte order */
-		if ( wkb_swap_bytes(ctx, variant) )
-		{
-			for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
-			{
-				buf[i] = dptr[RTWKB_DOUBLE_SIZE - 1 - i];
-			}
-		}
-		/* If machine arch and requested arch match, don't flip byte order */
-		else
-		{
-			memcpy(buf, dptr, RTWKB_DOUBLE_SIZE);
-		}
-		return buf + RTWKB_DOUBLE_SIZE;
-	}
+  char *dptr = (char*)(&d);
+  int i = 0;
+
+  if ( sizeof(double) != RTWKB_DOUBLE_SIZE )
+  {
+    rterror(ctx, "Machine double size is not %d bytes!", RTWKB_DOUBLE_SIZE);
+  }
+
+  if ( variant & RTWKB_HEX )
+  {
+    int swap =  wkb_swap_bytes(ctx, variant);
+    /* Machine/request arch mismatch, so flip byte order */
+    for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
+    {
+      int j = (swap ? RTWKB_DOUBLE_SIZE - 1 - i : i);
+      uint8_t b = dptr[j];
+      /* Top four bits to 0-F */
+      buf[2*i] = hexchr[b >> 4];
+      /* Bottom four bits to 0-F */
+      buf[2*i+1] = hexchr[b & 0x0F];
+    }
+    return buf + (2 * RTWKB_DOUBLE_SIZE);
+  }
+  else
+  {
+    /* Machine/request arch mismatch, so flip byte order */
+    if ( wkb_swap_bytes(ctx, variant) )
+    {
+      for ( i = 0; i < RTWKB_DOUBLE_SIZE; i++ )
+      {
+        buf[i] = dptr[RTWKB_DOUBLE_SIZE - 1 - i];
+      }
+    }
+    /* If machine arch and requested arch match, don't flip byte order */
+    else
+    {
+      memcpy(buf, dptr, RTWKB_DOUBLE_SIZE);
+    }
+    return buf + RTWKB_DOUBLE_SIZE;
+  }
 }
 
 
@@ -291,61 +291,61 @@ static uint8_t* double_to_wkb_buf(const RTCTX *ctx, const double d, uint8_t *buf
 */
 static size_t empty_to_wkb_size(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant)
 {
-	/* endian byte + type integer */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
-
-	/* optional srid integer */
-	if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
-		size += RTWKB_INT_SIZE;
-
-	/* Represent POINT EMPTY as POINT(NaN NaN) */
-	if ( geom->type == RTPOINTTYPE )
-	{
-		const RTPOINT *pt = (RTPOINT*)geom;
-		size += RTWKB_DOUBLE_SIZE * RTFLAGS_NDIMS(pt->point->flags);		
-	}
-	/* num-elements */
-	else
-	{
-		size += RTWKB_INT_SIZE;
-	}
-
-	return size;
+  /* endian byte + type integer */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
+
+  /* optional srid integer */
+  if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
+    size += RTWKB_INT_SIZE;
+
+  /* Represent POINT EMPTY as POINT(NaN NaN) */
+  if ( geom->type == RTPOINTTYPE )
+  {
+    const RTPOINT *pt = (RTPOINT*)geom;
+    size += RTWKB_DOUBLE_SIZE * RTFLAGS_NDIMS(pt->point->flags);
+  }
+  /* num-elements */
+  else
+  {
+    size += RTWKB_INT_SIZE;
+  }
+
+  return size;
 }
 
 static uint8_t* empty_to_wkb_buf(const RTCTX *ctx, const RTGEOM *geom, uint8_t *buf, uint8_t variant)
 {
-	uint32_t wkb_type = rtgeom_wkb_type(ctx, geom, variant);
-
-	/* Set the endian flag */
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, wkb_type, buf, variant);
-
-	/* Set the SRID if necessary */
-	if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
-		buf = integer_to_wkb_buf(ctx, geom->srid, buf, variant);
-
-	/* Represent POINT EMPTY as POINT(NaN NaN) */
-	if ( geom->type == RTPOINTTYPE )
-	{
-		const RTPOINT *pt = (RTPOINT*)geom;
-		static double nn = NAN;
-		int i;
-		for ( i = 0; i < RTFLAGS_NDIMS(pt->point->flags); i++ )
-		{
-			buf = double_to_wkb_buf(ctx, nn, buf, variant);
-		}
-	}
-	/* Everything else is flagged as empty using num-elements == 0 */
-	else
-	{
-		/* Set nrings/npoints/ngeoms to zero */
-		buf = integer_to_wkb_buf(ctx, 0, buf, variant);
-	}
-	
-	return buf;
+  uint32_t wkb_type = rtgeom_wkb_type(ctx, geom, variant);
+
+  /* Set the endian flag */
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, wkb_type, buf, variant);
+
+  /* Set the SRID if necessary */
+  if ( rtgeom_wkb_needs_srid(ctx, geom, variant) )
+    buf = integer_to_wkb_buf(ctx, geom->srid, buf, variant);
+
+  /* Represent POINT EMPTY as POINT(NaN NaN) */
+  if ( geom->type == RTPOINTTYPE )
+  {
+    const RTPOINT *pt = (RTPOINT*)geom;
+    static double nn = NAN;
+    int i;
+    for ( i = 0; i < RTFLAGS_NDIMS(pt->point->flags); i++ )
+    {
+      buf = double_to_wkb_buf(ctx, nn, buf, variant);
+    }
+  }
+  /* Everything else is flagged as empty using num-elements == 0 */
+  else
+  {
+    /* Set nrings/npoints/ngeoms to zero */
+    buf = integer_to_wkb_buf(ctx, 0, buf, variant);
+  }
+
+  return buf;
 }
 
 /*
@@ -353,61 +353,61 @@ static uint8_t* empty_to_wkb_buf(const RTCTX *ctx, const RTGEOM *geom, uint8_t *
 */
 static size_t ptarray_to_wkb_size(const RTCTX *ctx, const RTPOINTARRAY *pa, uint8_t variant)
 {
-	int dims = 2;
-	size_t size = 0;
+  int dims = 2;
+  size_t size = 0;
 
-	if ( variant & (RTWKB_ISO | RTWKB_EXTENDED) )
-		dims = RTFLAGS_NDIMS(pa->flags);
+  if ( variant & (RTWKB_ISO | RTWKB_EXTENDED) )
+    dims = RTFLAGS_NDIMS(pa->flags);
 
-	/* Include the npoints if it's not a POINT type) */
-	if ( ! ( variant & RTWKB_NO_NPOINTS ) )
-		size += RTWKB_INT_SIZE;
+  /* Include the npoints if it's not a POINT type) */
+  if ( ! ( variant & RTWKB_NO_NPOINTS ) )
+    size += RTWKB_INT_SIZE;
 
-	/* size of the double list */
-	size += pa->npoints * dims * RTWKB_DOUBLE_SIZE;
+  /* size of the double list */
+  size += pa->npoints * dims * RTWKB_DOUBLE_SIZE;
 
-	return size;
+  return size;
 }
 
 static uint8_t* ptarray_to_wkb_buf(const RTCTX *ctx, const RTPOINTARRAY *pa, uint8_t *buf, uint8_t variant)
 {
-	int dims = 2;
-	int pa_dims = RTFLAGS_NDIMS(pa->flags);
-	int i, j;
-	double *dbl_ptr;
-
-	/* SFSQL is artays 2-d. Extended and ISO use all available dimensions */
-	if ( (variant & RTWKB_ISO) || (variant & RTWKB_EXTENDED) )
-		dims = pa_dims;
-
-	/* Set the number of points (if it's not a POINT type) */
-	if ( ! ( variant & RTWKB_NO_NPOINTS ) )
-		buf = integer_to_wkb_buf(ctx, pa->npoints, buf, variant);
-
-	/* Bulk copy the coordinates when: dimensionality matches, output format */
-	/* is not hex, and output endian matches internal endian. */
-	if ( pa->npoints && (dims == pa_dims) && ! wkb_swap_bytes(ctx, variant) && ! (variant & RTWKB_HEX)  )
-	{
-		size_t size = pa->npoints * dims * RTWKB_DOUBLE_SIZE;
-		memcpy(buf, rt_getPoint_internal(ctx, pa, 0), size);
-		buf += size;
-	}
-	/* Copy coordinates one-by-one otherwise */
-	else 
-	{
-		for ( i = 0; i < pa->npoints; i++ )
-		{
-			RTDEBUGF(4, "Writing point #%d", i);
-			dbl_ptr = (double*)rt_getPoint_internal(ctx, pa, i);
-			for ( j = 0; j < dims; j++ )
-			{
-				RTDEBUGF(4, "Writing dimension #%d (buf = %p)", j, buf);
-				buf = double_to_wkb_buf(ctx, dbl_ptr[j], buf, variant);
-			}
-		}
-	}
-	RTDEBUGF(4, "Done (buf = %p)", buf);
-	return buf;
+  int dims = 2;
+  int pa_dims = RTFLAGS_NDIMS(pa->flags);
+  int i, j;
+  double *dbl_ptr;
+
+  /* SFSQL is artays 2-d. Extended and ISO use all available dimensions */
+  if ( (variant & RTWKB_ISO) || (variant & RTWKB_EXTENDED) )
+    dims = pa_dims;
+
+  /* Set the number of points (if it's not a POINT type) */
+  if ( ! ( variant & RTWKB_NO_NPOINTS ) )
+    buf = integer_to_wkb_buf(ctx, pa->npoints, buf, variant);
+
+  /* Bulk copy the coordinates when: dimensionality matches, output format */
+  /* is not hex, and output endian matches internal endian. */
+  if ( pa->npoints && (dims == pa_dims) && ! wkb_swap_bytes(ctx, variant) && ! (variant & RTWKB_HEX)  )
+  {
+    size_t size = pa->npoints * dims * RTWKB_DOUBLE_SIZE;
+    memcpy(buf, rt_getPoint_internal(ctx, pa, 0), size);
+    buf += size;
+  }
+  /* Copy coordinates one-by-one otherwise */
+  else
+  {
+    for ( i = 0; i < pa->npoints; i++ )
+    {
+      RTDEBUGF(4, "Writing point #%d", i);
+      dbl_ptr = (double*)rt_getPoint_internal(ctx, pa, i);
+      for ( j = 0; j < dims; j++ )
+      {
+        RTDEBUGF(4, "Writing dimension #%d (buf = %p)", j, buf);
+        buf = double_to_wkb_buf(ctx, dbl_ptr[j], buf, variant);
+      }
+    }
+  }
+  RTDEBUGF(4, "Done (buf = %p)", buf);
+  return buf;
 }
 
 /*
@@ -415,45 +415,45 @@ static uint8_t* ptarray_to_wkb_buf(const RTCTX *ctx, const RTPOINTARRAY *pa, uin
 */
 static size_t rtpoint_to_wkb_size(const RTCTX *ctx, const RTPOINT *pt, uint8_t variant)
 {
-	/* Endian flag + type number */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
+  /* Endian flag + type number */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
 
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)pt) )
-		return empty_to_wkb_size(ctx, (RTGEOM*)pt, variant);
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)pt) )
+    return empty_to_wkb_size(ctx, (RTGEOM*)pt, variant);
 
-	/* Extended RTWKB needs space for optional SRID integer */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)pt, variant) )
-		size += RTWKB_INT_SIZE;
+  /* Extended RTWKB needs space for optional SRID integer */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)pt, variant) )
+    size += RTWKB_INT_SIZE;
 
-	/* Points */
-	size += ptarray_to_wkb_size(ctx, pt->point, variant | RTWKB_NO_NPOINTS);
-	return size;
+  /* Points */
+  size += ptarray_to_wkb_size(ctx, pt->point, variant | RTWKB_NO_NPOINTS);
+  return size;
 }
 
 static uint8_t* rtpoint_to_wkb_buf(const RTCTX *ctx, const RTPOINT *pt, uint8_t *buf, uint8_t variant)
 {
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)pt) )
-		return empty_to_wkb_buf(ctx, (RTGEOM*)pt, buf, variant);
-
-	/* Set the endian flag */
-	RTDEBUGF(4, "Entering function, buf = %p", buf);
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-	RTDEBUGF(4, "Endian set, buf = %p", buf);
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)pt, variant), buf, variant);
-	RTDEBUGF(4, "Type set, buf = %p", buf);
-	/* Set the optional SRID for extended variant */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)pt, variant) )
-	{
-		buf = integer_to_wkb_buf(ctx, pt->srid, buf, variant);
-		RTDEBUGF(4, "SRID set, buf = %p", buf);
-	}
-	/* Set the coordinates */
-	buf = ptarray_to_wkb_buf(ctx, pt->point, buf, variant | RTWKB_NO_NPOINTS);
-	RTDEBUGF(4, "Pointarray set, buf = %p", buf);
-	return buf;
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)pt) )
+    return empty_to_wkb_buf(ctx, (RTGEOM*)pt, buf, variant);
+
+  /* Set the endian flag */
+  RTDEBUGF(4, "Entering function, buf = %p", buf);
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+  RTDEBUGF(4, "Endian set, buf = %p", buf);
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)pt, variant), buf, variant);
+  RTDEBUGF(4, "Type set, buf = %p", buf);
+  /* Set the optional SRID for extended variant */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)pt, variant) )
+  {
+    buf = integer_to_wkb_buf(ctx, pt->srid, buf, variant);
+    RTDEBUGF(4, "SRID set, buf = %p", buf);
+  }
+  /* Set the coordinates */
+  buf = ptarray_to_wkb_buf(ctx, pt->point, buf, variant | RTWKB_NO_NPOINTS);
+  RTDEBUGF(4, "Pointarray set, buf = %p", buf);
+  return buf;
 }
 
 /*
@@ -461,38 +461,38 @@ static uint8_t* rtpoint_to_wkb_buf(const RTCTX *ctx, const RTPOINT *pt, uint8_t
 */
 static size_t rtline_to_wkb_size(const RTCTX *ctx, const RTLINE *line, uint8_t variant)
 {
-	/* Endian flag + type number */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
+  /* Endian flag + type number */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE;
 
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)line) )
-		return empty_to_wkb_size(ctx, (RTGEOM*)line, variant);
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)line) )
+    return empty_to_wkb_size(ctx, (RTGEOM*)line, variant);
 
-	/* Extended RTWKB needs space for optional SRID integer */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)line, variant) )
-		size += RTWKB_INT_SIZE;
+  /* Extended RTWKB needs space for optional SRID integer */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)line, variant) )
+    size += RTWKB_INT_SIZE;
 
-	/* Size of point array */
-	size += ptarray_to_wkb_size(ctx, line->points, variant);
-	return size;
+  /* Size of point array */
+  size += ptarray_to_wkb_size(ctx, line->points, variant);
+  return size;
 }
 
 static uint8_t* rtline_to_wkb_buf(const RTCTX *ctx, const RTLINE *line, uint8_t *buf, uint8_t variant)
 {
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)line) )
-		return empty_to_wkb_buf(ctx, (RTGEOM*)line, buf, variant);
-
-	/* Set the endian flag */
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)line, variant), buf, variant);
-	/* Set the optional SRID for extended variant */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)line, variant) )
-		buf = integer_to_wkb_buf(ctx, line->srid, buf, variant);
-	/* Set the coordinates */
-	buf = ptarray_to_wkb_buf(ctx, line->points, buf, variant);
-	return buf;
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)line) )
+    return empty_to_wkb_buf(ctx, (RTGEOM*)line, buf, variant);
+
+  /* Set the endian flag */
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)line, variant), buf, variant);
+  /* Set the optional SRID for extended variant */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)line, variant) )
+    buf = integer_to_wkb_buf(ctx, line->srid, buf, variant);
+  /* Set the coordinates */
+  buf = ptarray_to_wkb_buf(ctx, line->points, buf, variant);
+  return buf;
 }
 
 /*
@@ -500,46 +500,46 @@ static uint8_t* rtline_to_wkb_buf(const RTCTX *ctx, const RTLINE *line, uint8_t
 */
 static size_t rttriangle_to_wkb_size(const RTCTX *ctx, const RTTRIANGLE *tri, uint8_t variant)
 {
-	/* endian flag + type number + number of rings */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
+  /* endian flag + type number + number of rings */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
 
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)tri) )
-		return empty_to_wkb_size(ctx, (RTGEOM*)tri, variant);
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)tri) )
+    return empty_to_wkb_size(ctx, (RTGEOM*)tri, variant);
 
-	/* Extended RTWKB needs space for optional SRID integer */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)tri, variant) )
-		size += RTWKB_INT_SIZE;
+  /* Extended RTWKB needs space for optional SRID integer */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)tri, variant) )
+    size += RTWKB_INT_SIZE;
 
-	/* How big is this point array? */
-	size += ptarray_to_wkb_size(ctx, tri->points, variant);
+  /* How big is this point array? */
+  size += ptarray_to_wkb_size(ctx, tri->points, variant);
 
-	return size;
+  return size;
 }
 
 static uint8_t* rttriangle_to_wkb_buf(const RTCTX *ctx, const RTTRIANGLE *tri, uint8_t *buf, uint8_t variant)
 {
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)tri) )
-		return empty_to_wkb_buf(ctx, (RTGEOM*)tri, buf, variant);
-
-	/* Set the endian flag */
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-	
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)tri, variant), buf, variant);
-	
-	/* Set the optional SRID for extended variant */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)tri, variant) )
-		buf = integer_to_wkb_buf(ctx, tri->srid, buf, variant);
-
-	/* Set the number of rings (only one, it's a triangle, buddy) */
-	buf = integer_to_wkb_buf(ctx, 1, buf, variant);
-	
-	/* Write that ring */
-	buf = ptarray_to_wkb_buf(ctx, tri->points, buf, variant);
-
-	return buf;
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)tri) )
+    return empty_to_wkb_buf(ctx, (RTGEOM*)tri, buf, variant);
+
+  /* Set the endian flag */
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)tri, variant), buf, variant);
+
+  /* Set the optional SRID for extended variant */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)tri, variant) )
+    buf = integer_to_wkb_buf(ctx, tri->srid, buf, variant);
+
+  /* Set the number of rings (only one, it's a triangle, buddy) */
+  buf = integer_to_wkb_buf(ctx, 1, buf, variant);
+
+  /* Write that ring */
+  buf = ptarray_to_wkb_buf(ctx, tri->points, buf, variant);
+
+  return buf;
 }
 
 /*
@@ -547,100 +547,100 @@ static uint8_t* rttriangle_to_wkb_buf(const RTCTX *ctx, const RTTRIANGLE *tri, u
 */
 static size_t rtpoly_to_wkb_size(const RTCTX *ctx, const RTPOLY *poly, uint8_t variant)
 {
-	/* endian flag + type number + number of rings */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
-	int i = 0;
-	
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)poly) )
-		return empty_to_wkb_size(ctx, (RTGEOM*)poly, variant);
-
-	/* Extended RTWKB needs space for optional SRID integer */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)poly, variant) )
-		size += RTWKB_INT_SIZE;
-
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		/* Size of ring point array */
-		size += ptarray_to_wkb_size(ctx, poly->rings[i], variant);
-	}
-
-	return size;
+  /* endian flag + type number + number of rings */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
+  int i = 0;
+
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)poly) )
+    return empty_to_wkb_size(ctx, (RTGEOM*)poly, variant);
+
+  /* Extended RTWKB needs space for optional SRID integer */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)poly, variant) )
+    size += RTWKB_INT_SIZE;
+
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    /* Size of ring point array */
+    size += ptarray_to_wkb_size(ctx, poly->rings[i], variant);
+  }
+
+  return size;
 }
 
 static uint8_t* rtpoly_to_wkb_buf(const RTCTX *ctx, const RTPOLY *poly, uint8_t *buf, uint8_t variant)
 {
-	int i;
-
-	/* Only process empty at this level in the EXTENDED case */
-	if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)poly) )
-		return empty_to_wkb_buf(ctx, (RTGEOM*)poly, buf, variant);
-
-	/* Set the endian flag */
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)poly, variant), buf, variant);
-	/* Set the optional SRID for extended variant */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)poly, variant) )
-		buf = integer_to_wkb_buf(ctx, poly->srid, buf, variant);
-	/* Set the number of rings */
-	buf = integer_to_wkb_buf(ctx, poly->nrings, buf, variant);
-
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		buf = ptarray_to_wkb_buf(ctx, poly->rings[i], buf, variant);
-	}
-
-	return buf;
+  int i;
+
+  /* Only process empty at this level in the EXTENDED case */
+  if ( (variant & RTWKB_EXTENDED) && rtgeom_is_empty(ctx, (RTGEOM*)poly) )
+    return empty_to_wkb_buf(ctx, (RTGEOM*)poly, buf, variant);
+
+  /* Set the endian flag */
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)poly, variant), buf, variant);
+  /* Set the optional SRID for extended variant */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)poly, variant) )
+    buf = integer_to_wkb_buf(ctx, poly->srid, buf, variant);
+  /* Set the number of rings */
+  buf = integer_to_wkb_buf(ctx, poly->nrings, buf, variant);
+
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    buf = ptarray_to_wkb_buf(ctx, poly->rings[i], buf, variant);
+  }
+
+  return buf;
 }
 
 
 /*
 * MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION
-* MULTICURVE, COMPOUNDCURVE, MULTISURFACE, CURVEPOLYGON, TIN, 
+* MULTICURVE, COMPOUNDCURVE, MULTISURFACE, CURVEPOLYGON, TIN,
 * POLYHEDRALSURFACE
 */
 static size_t rtcollection_to_wkb_size(const RTCTX *ctx, const RTCOLLECTION *col, uint8_t variant)
 {
-	/* Endian flag + type number + number of subgeoms */
-	size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
-	int i = 0;
+  /* Endian flag + type number + number of subgeoms */
+  size_t size = RTWKB_BYTE_SIZE + RTWKB_INT_SIZE + RTWKB_INT_SIZE;
+  int i = 0;
 
-	/* Extended RTWKB needs space for optional SRID integer */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)col, variant) )
-		size += RTWKB_INT_SIZE;
+  /* Extended RTWKB needs space for optional SRID integer */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)col, variant) )
+    size += RTWKB_INT_SIZE;
 
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		/* size of subgeom */
-		size += rtgeom_to_wkb_size(ctx, (RTGEOM*)col->geoms[i], variant | RTWKB_NO_SRID);
-	}
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    /* size of subgeom */
+    size += rtgeom_to_wkb_size(ctx, (RTGEOM*)col->geoms[i], variant | RTWKB_NO_SRID);
+  }
 
-	return size;
+  return size;
 }
 
 static uint8_t* rtcollection_to_wkb_buf(const RTCTX *ctx, const RTCOLLECTION *col, uint8_t *buf, uint8_t variant)
 {
-	int i;
-
-	/* Set the endian flag */
-	buf = endian_to_wkb_buf(ctx, buf, variant);
-	/* Set the geometry type */
-	buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)col, variant), buf, variant);
-	/* Set the optional SRID for extended variant */
-	if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)col, variant) )
-		buf = integer_to_wkb_buf(ctx, col->srid, buf, variant);
-	/* Set the number of sub-geometries */
-	buf = integer_to_wkb_buf(ctx, col->ngeoms, buf, variant);
-
-	/* Write the sub-geometries. Sub-geometries do not get SRIDs, they
-	   inherit from their parents. */
-	for ( i = 0; i < col->ngeoms; i++ )
-	{
-		buf = rtgeom_to_wkb_buf(ctx, col->geoms[i], buf, variant | RTWKB_NO_SRID);
-	}
-
-	return buf;
+  int i;
+
+  /* Set the endian flag */
+  buf = endian_to_wkb_buf(ctx, buf, variant);
+  /* Set the geometry type */
+  buf = integer_to_wkb_buf(ctx, rtgeom_wkb_type(ctx, (RTGEOM*)col, variant), buf, variant);
+  /* Set the optional SRID for extended variant */
+  if ( rtgeom_wkb_needs_srid(ctx, (RTGEOM*)col, variant) )
+    buf = integer_to_wkb_buf(ctx, col->srid, buf, variant);
+  /* Set the number of sub-geometries */
+  buf = integer_to_wkb_buf(ctx, col->ngeoms, buf, variant);
+
+  /* Write the sub-geometries. Sub-geometries do not get SRIDs, they
+     inherit from their parents. */
+  for ( i = 0; i < col->ngeoms; i++ )
+  {
+    buf = rtgeom_to_wkb_buf(ctx, col->geoms[i], buf, variant | RTWKB_NO_SRID);
+  }
+
+  return buf;
 }
 
 /*
@@ -648,59 +648,59 @@ static uint8_t* rtcollection_to_wkb_buf(const RTCTX *ctx, const RTCOLLECTION *co
 */
 static size_t rtgeom_to_wkb_size(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant)
 {
-	size_t size = 0;
-
-	if ( geom == NULL )
-		return 0;
-
-	/* Short circuit out empty geometries */
-	if ( (!(variant & RTWKB_EXTENDED)) && rtgeom_is_empty(ctx, geom) )
-	{
-		return empty_to_wkb_size(ctx, geom, variant);
-	}
-
-	switch ( geom->type )
-	{
-		case RTPOINTTYPE:
-			size += rtpoint_to_wkb_size(ctx, (RTPOINT*)geom, variant);
-			break;
-
-		/* LineString and CircularString both have points elements */
-		case RTCIRCSTRINGTYPE:
-		case RTLINETYPE:
-			size += rtline_to_wkb_size(ctx, (RTLINE*)geom, variant);
-			break;
-
-		/* Polygon has nrings and rings elements */
-		case RTPOLYGONTYPE:
-			size += rtpoly_to_wkb_size(ctx, (RTPOLY*)geom, variant);
-			break;
-
-		/* Triangle has one ring of three points */
-		case RTTRIANGLETYPE:
-			size += rttriangle_to_wkb_size(ctx, (RTTRIANGLE*)geom, variant);
-			break;
-
-		/* All these Collection types have ngeoms and geoms elements */
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTCURVEPOLYTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-		case RTCOLLECTIONTYPE:
-		case RTPOLYHEDRALSURFACETYPE:
-		case RTTINTYPE:
-			size += rtcollection_to_wkb_size(ctx, (RTCOLLECTION*)geom, variant);
-			break;
-
-		/* Unknown type! */
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, geom->type), geom->type);
-	}
-
-	return size;
+  size_t size = 0;
+
+  if ( geom == NULL )
+    return 0;
+
+  /* Short circuit out empty geometries */
+  if ( (!(variant & RTWKB_EXTENDED)) && rtgeom_is_empty(ctx, geom) )
+  {
+    return empty_to_wkb_size(ctx, geom, variant);
+  }
+
+  switch ( geom->type )
+  {
+    case RTPOINTTYPE:
+      size += rtpoint_to_wkb_size(ctx, (RTPOINT*)geom, variant);
+      break;
+
+    /* LineString and CircularString both have points elements */
+    case RTCIRCSTRINGTYPE:
+    case RTLINETYPE:
+      size += rtline_to_wkb_size(ctx, (RTLINE*)geom, variant);
+      break;
+
+    /* Polygon has nrings and rings elements */
+    case RTPOLYGONTYPE:
+      size += rtpoly_to_wkb_size(ctx, (RTPOLY*)geom, variant);
+      break;
+
+    /* Triangle has one ring of three points */
+    case RTTRIANGLETYPE:
+      size += rttriangle_to_wkb_size(ctx, (RTTRIANGLE*)geom, variant);
+      break;
+
+    /* All these Collection types have ngeoms and geoms elements */
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTCURVEPOLYTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+    case RTCOLLECTIONTYPE:
+    case RTPOLYHEDRALSURFACETYPE:
+    case RTTINTYPE:
+      size += rtcollection_to_wkb_size(ctx, (RTCOLLECTION*)geom, variant);
+      break;
+
+    /* Unknown type! */
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, geom->type), geom->type);
+  }
+
+  return size;
 }
 
 /* TODO handle the TRIANGLE type properly */
@@ -708,47 +708,47 @@ static size_t rtgeom_to_wkb_size(const RTCTX *ctx, const RTGEOM *geom, uint8_t v
 static uint8_t* rtgeom_to_wkb_buf(const RTCTX *ctx, const RTGEOM *geom, uint8_t *buf, uint8_t variant)
 {
 
-	/* Do not simplify empties when outputting to canonical form */
-	if ( rtgeom_is_empty(ctx, geom) & ! (variant & RTWKB_EXTENDED) )
-		return empty_to_wkb_buf(ctx, geom, buf, variant);
-
-	switch ( geom->type )
-	{
-		case RTPOINTTYPE:
-			return rtpoint_to_wkb_buf(ctx, (RTPOINT*)geom, buf, variant);
-
-		/* LineString and CircularString both have 'points' elements */
-		case RTCIRCSTRINGTYPE:
-		case RTLINETYPE:
-			return rtline_to_wkb_buf(ctx, (RTLINE*)geom, buf, variant);
-
-		/* Polygon has 'nrings' and 'rings' elements */
-		case RTPOLYGONTYPE:
-			return rtpoly_to_wkb_buf(ctx, (RTPOLY*)geom, buf, variant);
-
-		/* Triangle has one ring of three points */
-		case RTTRIANGLETYPE:
-			return rttriangle_to_wkb_buf(ctx, (RTTRIANGLE*)geom, buf, variant);
-
-		/* All these Collection types have 'ngeoms' and 'geoms' elements */
-		case RTMULTIPOINTTYPE:
-		case RTMULTILINETYPE:
-		case RTMULTIPOLYGONTYPE:
-		case RTCOMPOUNDTYPE:
-		case RTCURVEPOLYTYPE:
-		case RTMULTICURVETYPE:
-		case RTMULTISURFACETYPE:
-		case RTCOLLECTIONTYPE:
-		case RTPOLYHEDRALSURFACETYPE:
-		case RTTINTYPE:
-			return rtcollection_to_wkb_buf(ctx, (RTCOLLECTION*)geom, buf, variant);
-
-		/* Unknown type! */
-		default:
-			rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, geom->type), geom->type);
-	}
-	/* Return value to keep compiler happy. */
-	return 0;
+  /* Do not simplify empties when outputting to canonical form */
+  if ( rtgeom_is_empty(ctx, geom) & ! (variant & RTWKB_EXTENDED) )
+    return empty_to_wkb_buf(ctx, geom, buf, variant);
+
+  switch ( geom->type )
+  {
+    case RTPOINTTYPE:
+      return rtpoint_to_wkb_buf(ctx, (RTPOINT*)geom, buf, variant);
+
+    /* LineString and CircularString both have 'points' elements */
+    case RTCIRCSTRINGTYPE:
+    case RTLINETYPE:
+      return rtline_to_wkb_buf(ctx, (RTLINE*)geom, buf, variant);
+
+    /* Polygon has 'nrings' and 'rings' elements */
+    case RTPOLYGONTYPE:
+      return rtpoly_to_wkb_buf(ctx, (RTPOLY*)geom, buf, variant);
+
+    /* Triangle has one ring of three points */
+    case RTTRIANGLETYPE:
+      return rttriangle_to_wkb_buf(ctx, (RTTRIANGLE*)geom, buf, variant);
+
+    /* All these Collection types have 'ngeoms' and 'geoms' elements */
+    case RTMULTIPOINTTYPE:
+    case RTMULTILINETYPE:
+    case RTMULTIPOLYGONTYPE:
+    case RTCOMPOUNDTYPE:
+    case RTCURVEPOLYTYPE:
+    case RTMULTICURVETYPE:
+    case RTMULTISURFACETYPE:
+    case RTCOLLECTIONTYPE:
+    case RTPOLYHEDRALSURFACETYPE:
+    case RTTINTYPE:
+      return rtcollection_to_wkb_buf(ctx, (RTCOLLECTION*)geom, buf, variant);
+
+    /* Unknown type! */
+    default:
+      rterror(ctx, "Unsupported geometry type: %s [%d]", rttype_name(ctx, geom->type), geom->type);
+  }
+  /* Return value to keep compiler happy. */
+  return 0;
 }
 
 /**
@@ -764,90 +764,90 @@ static uint8_t* rtgeom_to_wkb_buf(const RTCTX *ctx, const RTGEOM *geom, uint8_t
 */
 uint8_t* rtgeom_to_wkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, size_t *size_out)
 {
-	size_t buf_size;
-	uint8_t *buf = NULL;
-	uint8_t *wkb_out = NULL;
-
-	/* Initialize output size */
-	if ( size_out ) *size_out = 0;
-
-	if ( geom == NULL )
-	{
-		RTDEBUG(4,"Cannot convert NULL into RTWKB.");
-		rterror(ctx, "Cannot convert NULL into RTWKB.");
-		return NULL;
-	}
-
-	/* Calculate the required size of the output buffer */
-	buf_size = rtgeom_to_wkb_size(ctx, geom, variant);
-	RTDEBUGF(4, "RTWKB output size: %d", buf_size);
-
-	if ( buf_size == 0 )
-	{
-		RTDEBUG(4,"Error calculating output RTWKB buffer size.");
-		rterror(ctx, "Error calculating output RTWKB buffer size.");
-		return NULL;
-	}
-
-	/* Hex string takes twice as much space as binary + a null character */
-	if ( variant & RTWKB_HEX )
-	{
-		buf_size = 2 * buf_size + 1;
-		RTDEBUGF(4, "Hex RTWKB output size: %d", buf_size);
-	}
-
-	/* If neither or both variants are specified, choose the native order */
-	if ( ! (variant & RTWKB_NDR || variant & RTWKB_XDR) ||
-	       (variant & RTWKB_NDR && variant & RTWKB_XDR) )
-	{
-		if ( getMachineEndian(ctx) == NDR ) 
-			variant = variant | RTWKB_NDR;
-		else
-			variant = variant | RTWKB_XDR;
-	}
-
-	/* Allocate the buffer */
-	buf = rtalloc(ctx, buf_size);
-
-	if ( buf == NULL )
-	{
-		RTDEBUGF(4,"Unable to allocate %d bytes for RTWKB output buffer.", buf_size);
-		rterror(ctx, "Unable to allocate %d bytes for RTWKB output buffer.", buf_size);
-		return NULL;
-	}
-
-	/* Retain a pointer to the front of the buffer for later */
-	wkb_out = buf;
-
-	/* Write the RTWKB into the output buffer */
-	buf = rtgeom_to_wkb_buf(ctx, geom, buf, variant);
-
-	/* Null the last byte if this is a hex output */
-	if ( variant & RTWKB_HEX )
-	{
-		*buf = '\0';
-		buf++;
-	}
-
-	RTDEBUGF(4,"buf (%p) - wkb_out (%p) = %d", buf, wkb_out, buf - wkb_out);
-
-	/* The buffer pointer should now land at the end of the allocated buffer space. Let's check. */
-	if ( buf_size != (buf - wkb_out) )
-	{
-		RTDEBUG(4,"Output RTWKB is not the same size as the allocated buffer.");
-		rterror(ctx, "Output RTWKB is not the same size as the allocated buffer.");
-		rtfree(ctx, wkb_out);
-		return NULL;
-	}
-
-	/* Report output size */
-	if ( size_out ) *size_out = buf_size;
-
-	return wkb_out;
+  size_t buf_size;
+  uint8_t *buf = NULL;
+  uint8_t *wkb_out = NULL;
+
+  /* Initialize output size */
+  if ( size_out ) *size_out = 0;
+
+  if ( geom == NULL )
+  {
+    RTDEBUG(4,"Cannot convert NULL into RTWKB.");
+    rterror(ctx, "Cannot convert NULL into RTWKB.");
+    return NULL;
+  }
+
+  /* Calculate the required size of the output buffer */
+  buf_size = rtgeom_to_wkb_size(ctx, geom, variant);
+  RTDEBUGF(4, "RTWKB output size: %d", buf_size);
+
+  if ( buf_size == 0 )
+  {
+    RTDEBUG(4,"Error calculating output RTWKB buffer size.");
+    rterror(ctx, "Error calculating output RTWKB buffer size.");
+    return NULL;
+  }
+
+  /* Hex string takes twice as much space as binary + a null character */
+  if ( variant & RTWKB_HEX )
+  {
+    buf_size = 2 * buf_size + 1;
+    RTDEBUGF(4, "Hex RTWKB output size: %d", buf_size);
+  }
+
+  /* If neither or both variants are specified, choose the native order */
+  if ( ! (variant & RTWKB_NDR || variant & RTWKB_XDR) ||
+         (variant & RTWKB_NDR && variant & RTWKB_XDR) )
+  {
+    if ( getMachineEndian(ctx) == NDR )
+      variant = variant | RTWKB_NDR;
+    else
+      variant = variant | RTWKB_XDR;
+  }
+
+  /* Allocate the buffer */
+  buf = rtalloc(ctx, buf_size);
+
+  if ( buf == NULL )
+  {
+    RTDEBUGF(4,"Unable to allocate %d bytes for RTWKB output buffer.", buf_size);
+    rterror(ctx, "Unable to allocate %d bytes for RTWKB output buffer.", buf_size);
+    return NULL;
+  }
+
+  /* Retain a pointer to the front of the buffer for later */
+  wkb_out = buf;
+
+  /* Write the RTWKB into the output buffer */
+  buf = rtgeom_to_wkb_buf(ctx, geom, buf, variant);
+
+  /* Null the last byte if this is a hex output */
+  if ( variant & RTWKB_HEX )
+  {
+    *buf = '\0';
+    buf++;
+  }
+
+  RTDEBUGF(4,"buf (%p) - wkb_out (%p) = %d", buf, wkb_out, buf - wkb_out);
+
+  /* The buffer pointer should now land at the end of the allocated buffer space. Let's check. */
+  if ( buf_size != (buf - wkb_out) )
+  {
+    RTDEBUG(4,"Output RTWKB is not the same size as the allocated buffer.");
+    rterror(ctx, "Output RTWKB is not the same size as the allocated buffer.");
+    rtfree(ctx, wkb_out);
+    return NULL;
+  }
+
+  /* Report output size */
+  if ( size_out ) *size_out = buf_size;
+
+  return wkb_out;
 }
 
 char* rtgeom_to_hexwkb(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, size_t *size_out)
 {
-	return (char*)rtgeom_to_wkb(ctx, geom, variant | RTWKB_HEX, size_out);
+  return (char*)rtgeom_to_wkb(ctx, geom, variant | RTWKB_HEX, size_out);
 }
 
diff --git a/src/rtout_wkt.c b/src/rtout_wkt.c
index bb65013..65074f8 100644
--- a/src/rtout_wkt.c
+++ b/src/rtout_wkt.c
@@ -40,40 +40,40 @@ static void rtgeom_to_wkt_sb(const RTCTX *ctx, const RTGEOM *geom, stringbuffer_
 static void dimension_qualifiers_to_wkt_sb(const RTCTX *ctx, const RTGEOM *geom, stringbuffer_t *sb, uint8_t variant)
 {
 
-	/* Extended RTWKT: POINTM(0 0 0) */
+  /* Extended RTWKT: POINTM(0 0 0) */
 #if 0
-	if ( (variant & RTWKT_EXTENDED) && ! (variant & RTWKT_IS_CHILD) && RTFLAGS_GET_M(geom->flags) && (!RTFLAGS_GET_Z(geom->flags)) )
+  if ( (variant & RTWKT_EXTENDED) && ! (variant & RTWKT_IS_CHILD) && RTFLAGS_GET_M(geom->flags) && (!RTFLAGS_GET_Z(geom->flags)) )
 #else
-	if ( (variant & RTWKT_EXTENDED) && RTFLAGS_GET_M(geom->flags) && (!RTFLAGS_GET_Z(geom->flags)) )
+  if ( (variant & RTWKT_EXTENDED) && RTFLAGS_GET_M(geom->flags) && (!RTFLAGS_GET_Z(geom->flags)) )
 #endif
-	{
-		stringbuffer_append(ctx, sb, "M"); /* "M" */
-		return;
-	}
-
-	/* ISO RTWKT: POINT ZM (0 0 0 0) */
-	if ( (variant & RTWKT_ISO) && (RTFLAGS_NDIMS(geom->flags) > 2) )
-	{
-		stringbuffer_append(ctx, sb, " ");
-		if ( RTFLAGS_GET_Z(geom->flags) )
-			stringbuffer_append(ctx, sb, "Z");
-		if ( RTFLAGS_GET_M(geom->flags) )
-			stringbuffer_append(ctx, sb, "M");
-		stringbuffer_append(ctx, sb, " ");
-	}
+  {
+    stringbuffer_append(ctx, sb, "M"); /* "M" */
+    return;
+  }
+
+  /* ISO RTWKT: POINT ZM (0 0 0 0) */
+  if ( (variant & RTWKT_ISO) && (RTFLAGS_NDIMS(geom->flags) > 2) )
+  {
+    stringbuffer_append(ctx, sb, " ");
+    if ( RTFLAGS_GET_Z(geom->flags) )
+      stringbuffer_append(ctx, sb, "Z");
+    if ( RTFLAGS_GET_M(geom->flags) )
+      stringbuffer_append(ctx, sb, "M");
+    stringbuffer_append(ctx, sb, " ");
+  }
 }
 
 /*
 * Write an empty token out, padding with a space if
-* necessary. 
+* necessary.
 */
 static void empty_to_wkt_sb(const RTCTX *ctx, stringbuffer_t *sb)
 {
-	if ( ! strchr(" ,(", stringbuffer_lastchar(ctx, sb)) ) /* "EMPTY" */
-	{ 
-		stringbuffer_append(ctx, sb, " "); 
-	}
-	stringbuffer_append(ctx, sb, "EMPTY"); 
+  if ( ! strchr(" ,(", stringbuffer_lastchar(ctx, sb)) ) /* "EMPTY" */
+  {
+    stringbuffer_append(ctx, sb, " ");
+  }
+  stringbuffer_append(ctx, sb, "EMPTY");
 }
 
 /*
@@ -83,39 +83,39 @@ static void empty_to_wkt_sb(const RTCTX *ctx, stringbuffer_t *sb)
 */
 static void ptarray_to_wkt_sb(const RTCTX *ctx, const RTPOINTARRAY *ptarray, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	/* OGC only includes X/Y */
-	int dimensions = 2;
-	int i, j;
-
-	/* ISO and extended formats include all dimensions */
-	if ( variant & ( RTWKT_ISO | RTWKT_EXTENDED ) )
-		dimensions = RTFLAGS_NDIMS(ptarray->flags);
-
-	/* Opening paren? */
-	if ( ! (variant & RTWKT_NO_PARENS) )
-		stringbuffer_append(ctx, sb, "(");
-
-	/* Digits and commas */
-	for (i = 0; i < ptarray->npoints; i++)
-	{
-		double *dbl_ptr = (double*)rt_getPoint_internal(ctx, ptarray, i);
-
-		/* Commas before ever coord but the first */
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-
-		for (j = 0; j < dimensions; j++)
-		{
-			/* Spaces before every ordinate but the first */
-			if ( j > 0 )
-				stringbuffer_append(ctx, sb, " ");
-			stringbuffer_aprintf(ctx, sb, "%.*g", precision, dbl_ptr[j]);
-		}
-	}
-
-	/* Closing paren? */
-	if ( ! (variant & RTWKT_NO_PARENS) )
-		stringbuffer_append(ctx, sb, ")");
+  /* OGC only includes X/Y */
+  int dimensions = 2;
+  int i, j;
+
+  /* ISO and extended formats include all dimensions */
+  if ( variant & ( RTWKT_ISO | RTWKT_EXTENDED ) )
+    dimensions = RTFLAGS_NDIMS(ptarray->flags);
+
+  /* Opening paren? */
+  if ( ! (variant & RTWKT_NO_PARENS) )
+    stringbuffer_append(ctx, sb, "(");
+
+  /* Digits and commas */
+  for (i = 0; i < ptarray->npoints; i++)
+  {
+    double *dbl_ptr = (double*)rt_getPoint_internal(ctx, ptarray, i);
+
+    /* Commas before ever coord but the first */
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+
+    for (j = 0; j < dimensions; j++)
+    {
+      /* Spaces before every ordinate but the first */
+      if ( j > 0 )
+        stringbuffer_append(ctx, sb, " ");
+      stringbuffer_aprintf(ctx, sb, "%.*g", precision, dbl_ptr[j]);
+    }
+  }
+
+  /* Closing paren? */
+  if ( ! (variant & RTWKT_NO_PARENS) )
+    stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -130,19 +130,19 @@ static void ptarray_to_wkt_sb(const RTCTX *ctx, const RTPOINTARRAY *ptarray, str
 */
 static void rtpoint_to_wkt_sb(const RTCTX *ctx, const RTPOINT *pt, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "POINT"); /* "POINT" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)pt, sb, variant);
-	}
-
-	if ( rtpoint_is_empty(ctx, pt) )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	ptarray_to_wkt_sb(ctx, pt->point, sb, precision, variant);
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "POINT"); /* "POINT" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)pt, sb, variant);
+  }
+
+  if ( rtpoint_is_empty(ctx, pt) )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  ptarray_to_wkt_sb(ctx, pt->point, sb, precision, variant);
 }
 
 /*
@@ -150,18 +150,18 @@ static void rtpoint_to_wkt_sb(const RTCTX *ctx, const RTPOINT *pt, stringbuffer_
 */
 static void rtline_to_wkt_sb(const RTCTX *ctx, const RTLINE *line, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "LINESTRING"); /* "LINESTRING" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)line, sb, variant);
-	}
-	if ( rtline_is_empty(ctx, line) )
-	{  
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	ptarray_to_wkt_sb(ctx, line->points, sb, precision, variant);
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "LINESTRING"); /* "LINESTRING" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)line, sb, variant);
+  }
+  if ( rtline_is_empty(ctx, line) )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  ptarray_to_wkt_sb(ctx, line->points, sb, precision, variant);
 }
 
 /*
@@ -169,26 +169,26 @@ static void rtline_to_wkt_sb(const RTCTX *ctx, const RTLINE *line, stringbuffer_
 */
 static void rtpoly_to_wkt_sb(const RTCTX *ctx, const RTPOLY *poly, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "POLYGON"); /* "POLYGON" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)poly, sb, variant);
-	}
-	if ( rtpoly_is_empty(ctx, poly) )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "(");
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		ptarray_to_wkt_sb(ctx, poly->rings[i], sb, precision, variant);
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "POLYGON"); /* "POLYGON" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)poly, sb, variant);
+  }
+  if ( rtpoly_is_empty(ctx, poly) )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "(");
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    ptarray_to_wkt_sb(ctx, poly->rings[i], sb, precision, variant);
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -196,17 +196,17 @@ static void rtpoly_to_wkt_sb(const RTCTX *ctx, const RTPOLY *poly, stringbuffer_
 */
 static void rtcircstring_to_wkt_sb(const RTCTX *ctx, const RTCIRCSTRING *circ, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "CIRCULARSTRING"); /* "CIRCULARSTRING" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)circ, sb, variant);
-	}
-	if ( rtcircstring_is_empty(ctx, circ) )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	ptarray_to_wkt_sb(ctx, circ->points, sb, precision, variant);
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "CIRCULARSTRING"); /* "CIRCULARSTRING" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)circ, sb, variant);
+  }
+  if ( rtcircstring_is_empty(ctx, circ) )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  ptarray_to_wkt_sb(ctx, circ->points, sb, precision, variant);
 }
 
 
@@ -216,27 +216,27 @@ static void rtcircstring_to_wkt_sb(const RTCTX *ctx, const RTCIRCSTRING *circ, s
 */
 static void rtmpoint_to_wkt_sb(const RTCTX *ctx, const RTMPOINT *mpoint, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "MULTIPOINT"); /* "MULTIPOINT" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mpoint, sb, variant);
-	}
-	if ( mpoint->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < mpoint->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* We don't want type strings or parens on our subgeoms */
-		rtpoint_to_wkt_sb(ctx, mpoint->geoms[i], sb, precision, variant | RTWKT_NO_PARENS | RTWKT_NO_TYPE );
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "MULTIPOINT"); /* "MULTIPOINT" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mpoint, sb, variant);
+  }
+  if ( mpoint->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < mpoint->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* We don't want type strings or parens on our subgeoms */
+    rtpoint_to_wkt_sb(ctx, mpoint->geoms[i], sb, precision, variant | RTWKT_NO_PARENS | RTWKT_NO_TYPE );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -244,29 +244,29 @@ static void rtmpoint_to_wkt_sb(const RTCTX *ctx, const RTMPOINT *mpoint, stringb
 */
 static void rtmline_to_wkt_sb(const RTCTX *ctx, const RTMLINE *mline, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "MULTILINESTRING"); /* "MULTILINESTRING" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mline, sb, variant);
-	}
-	if ( mline->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < mline->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* We don't want type strings on our subgeoms */
-		rtline_to_wkt_sb(ctx, mline->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "MULTILINESTRING"); /* "MULTILINESTRING" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mline, sb, variant);
+  }
+  if ( mline->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < mline->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* We don't want type strings on our subgeoms */
+    rtline_to_wkt_sb(ctx, mline->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -274,29 +274,29 @@ static void rtmline_to_wkt_sb(const RTCTX *ctx, const RTMLINE *mline, stringbuff
 */
 static void rtmpoly_to_wkt_sb(const RTCTX *ctx, const RTMPOLY *mpoly, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "MULTIPOLYGON"); /* "MULTIPOLYGON" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mpoly, sb, variant);
-	}
-	if ( mpoly->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < mpoly->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* We don't want type strings on our subgeoms */
-		rtpoly_to_wkt_sb(ctx, mpoly->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "MULTIPOLYGON"); /* "MULTIPOLYGON" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mpoly, sb, variant);
+  }
+  if ( mpoly->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < mpoly->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* We don't want type strings on our subgeoms */
+    rtpoly_to_wkt_sb(ctx, mpoly->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -306,42 +306,42 @@ static void rtmpoly_to_wkt_sb(const RTCTX *ctx, const RTMPOLY *mpoly, stringbuff
 */
 static void rtcompound_to_wkt_sb(const RTCTX *ctx, const RTCOMPOUND *comp, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "COMPOUNDCURVE"); /* "COMPOUNDCURVE" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)comp, sb, variant);
-	}
-	if ( comp->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < comp->ngeoms; i++ )
-	{
-		int type = comp->geoms[i]->type;
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* Linestring subgeoms don't get type identifiers */
-		if ( type == RTLINETYPE )
-		{
-			rtline_to_wkt_sb(ctx, (RTLINE*)comp->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-		}
-		/* But circstring subgeoms *do* get type identifiers */
-		else if ( type == RTCIRCSTRINGTYPE )
-		{
-			rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)comp->geoms[i], sb, precision, variant );
-		}
-		else
-		{
-			rterror(ctx, "rtcompound_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
-		}
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "COMPOUNDCURVE"); /* "COMPOUNDCURVE" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)comp, sb, variant);
+  }
+  if ( comp->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < comp->ngeoms; i++ )
+  {
+    int type = comp->geoms[i]->type;
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* Linestring subgeoms don't get type identifiers */
+    if ( type == RTLINETYPE )
+    {
+      rtline_to_wkt_sb(ctx, (RTLINE*)comp->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+    }
+    /* But circstring subgeoms *do* get type identifiers */
+    else if ( type == RTCIRCSTRINGTYPE )
+    {
+      rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)comp->geoms[i], sb, precision, variant );
+    }
+    else
+    {
+      rterror(ctx, "rtcompound_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
+    }
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -351,44 +351,44 @@ static void rtcompound_to_wkt_sb(const RTCTX *ctx, const RTCOMPOUND *comp, strin
 */
 static void rtcurvepoly_to_wkt_sb(const RTCTX *ctx, const RTCURVEPOLY *cpoly, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "CURVEPOLYGON"); /* "CURVEPOLYGON" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)cpoly, sb, variant);
-	}
-	if ( cpoly->nrings < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < cpoly->nrings; i++ )
-	{
-		int type = cpoly->rings[i]->type;
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		switch (type)
-		{
-		case RTLINETYPE:
-			/* Linestring subgeoms don't get type identifiers */
-			rtline_to_wkt_sb(ctx, (RTLINE*)cpoly->rings[i], sb, precision, variant | RTWKT_NO_TYPE );
-			break;
-		case RTCIRCSTRINGTYPE:
-			/* But circstring subgeoms *do* get type identifiers */
-			rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)cpoly->rings[i], sb, precision, variant );
-			break;
-		case RTCOMPOUNDTYPE:
-			/* And compoundcurve subgeoms *do* get type identifiers */
-			rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)cpoly->rings[i], sb, precision, variant );
-			break;
-		default:
-			rterror(ctx, "rtcurvepoly_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
-		}
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "CURVEPOLYGON"); /* "CURVEPOLYGON" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)cpoly, sb, variant);
+  }
+  if ( cpoly->nrings < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < cpoly->nrings; i++ )
+  {
+    int type = cpoly->rings[i]->type;
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    switch (type)
+    {
+    case RTLINETYPE:
+      /* Linestring subgeoms don't get type identifiers */
+      rtline_to_wkt_sb(ctx, (RTLINE*)cpoly->rings[i], sb, precision, variant | RTWKT_NO_TYPE );
+      break;
+    case RTCIRCSTRINGTYPE:
+      /* But circstring subgeoms *do* get type identifiers */
+      rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)cpoly->rings[i], sb, precision, variant );
+      break;
+    case RTCOMPOUNDTYPE:
+      /* And compoundcurve subgeoms *do* get type identifiers */
+      rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)cpoly->rings[i], sb, precision, variant );
+      break;
+    default:
+      rterror(ctx, "rtcurvepoly_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
+    }
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 
@@ -399,44 +399,44 @@ static void rtcurvepoly_to_wkt_sb(const RTCTX *ctx, const RTCURVEPOLY *cpoly, st
 */
 static void rtmcurve_to_wkt_sb(const RTCTX *ctx, const RTMCURVE *mcurv, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "MULTICURVE"); /* "MULTICURVE" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mcurv, sb, variant);
-	}
-	if ( mcurv->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < mcurv->ngeoms; i++ )
-	{
-		int type = mcurv->geoms[i]->type;
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		switch (type)
-		{
-		case RTLINETYPE:
-			/* Linestring subgeoms don't get type identifiers */
-			rtline_to_wkt_sb(ctx, (RTLINE*)mcurv->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-			break;
-		case RTCIRCSTRINGTYPE:
-			/* But circstring subgeoms *do* get type identifiers */
-			rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)mcurv->geoms[i], sb, precision, variant );
-			break;
-		case RTCOMPOUNDTYPE:
-			/* And compoundcurve subgeoms *do* get type identifiers */
-			rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)mcurv->geoms[i], sb, precision, variant );
-			break;
-		default:
-			rterror(ctx, "rtmcurve_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
-		}
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "MULTICURVE"); /* "MULTICURVE" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)mcurv, sb, variant);
+  }
+  if ( mcurv->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < mcurv->ngeoms; i++ )
+  {
+    int type = mcurv->geoms[i]->type;
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    switch (type)
+    {
+    case RTLINETYPE:
+      /* Linestring subgeoms don't get type identifiers */
+      rtline_to_wkt_sb(ctx, (RTLINE*)mcurv->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+      break;
+    case RTCIRCSTRINGTYPE:
+      /* But circstring subgeoms *do* get type identifiers */
+      rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)mcurv->geoms[i], sb, precision, variant );
+      break;
+    case RTCOMPOUNDTYPE:
+      /* And compoundcurve subgeoms *do* get type identifiers */
+      rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)mcurv->geoms[i], sb, precision, variant );
+      break;
+    default:
+      rterror(ctx, "rtmcurve_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
+    }
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 
@@ -447,40 +447,40 @@ static void rtmcurve_to_wkt_sb(const RTCTX *ctx, const RTMCURVE *mcurv, stringbu
 */
 static void rtmsurface_to_wkt_sb(const RTCTX *ctx, const RTMSURFACE *msurf, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "MULTISURFACE"); /* "MULTISURFACE" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)msurf, sb, variant);
-	}
-	if ( msurf->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-	for ( i = 0; i < msurf->ngeoms; i++ )
-	{
-		int type = msurf->geoms[i]->type;
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		switch (type)
-		{
-		case RTPOLYGONTYPE:
-			/* Linestring subgeoms don't get type identifiers */
-			rtpoly_to_wkt_sb(ctx, (RTPOLY*)msurf->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-			break;
-		case RTCURVEPOLYTYPE:
-			/* But circstring subgeoms *do* get type identifiers */
-			rtcurvepoly_to_wkt_sb(ctx, (RTCURVEPOLY*)msurf->geoms[i], sb, precision, variant);
-			break;
-		default:
-			rterror(ctx, "rtmsurface_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
-		}
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "MULTISURFACE"); /* "MULTISURFACE" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)msurf, sb, variant);
+  }
+  if ( msurf->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+  for ( i = 0; i < msurf->ngeoms; i++ )
+  {
+    int type = msurf->geoms[i]->type;
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    switch (type)
+    {
+    case RTPOLYGONTYPE:
+      /* Linestring subgeoms don't get type identifiers */
+      rtpoly_to_wkt_sb(ctx, (RTPOLY*)msurf->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+      break;
+    case RTCURVEPOLYTYPE:
+      /* But circstring subgeoms *do* get type identifiers */
+      rtcurvepoly_to_wkt_sb(ctx, (RTCURVEPOLY*)msurf->geoms[i], sb, precision, variant);
+      break;
+    default:
+      rterror(ctx, "rtmsurface_to_wkt_sb: Unknown type received %d - %s", type, rttype_name(ctx, type));
+    }
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -490,48 +490,48 @@ static void rtmsurface_to_wkt_sb(const RTCTX *ctx, const RTMSURFACE *msurf, stri
 */
 static void rtcollection_to_wkt_sb(const RTCTX *ctx, const RTCOLLECTION *collection, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "GEOMETRYCOLLECTION"); /* "GEOMETRYCOLLECTION" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)collection, sb, variant);
-	}
-	if ( collection->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-	stringbuffer_append(ctx, sb, "(");
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are children */
-	for ( i = 0; i < collection->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		rtgeom_to_wkt_sb(ctx, (RTGEOM*)collection->geoms[i], sb, precision, variant );
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "GEOMETRYCOLLECTION"); /* "GEOMETRYCOLLECTION" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)collection, sb, variant);
+  }
+  if ( collection->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+  stringbuffer_append(ctx, sb, "(");
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are children */
+  for ( i = 0; i < collection->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    rtgeom_to_wkt_sb(ctx, (RTGEOM*)collection->geoms[i], sb, precision, variant );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
-* TRIANGLE 
+* TRIANGLE
 */
 static void rttriangle_to_wkt_sb(const RTCTX *ctx, const RTTRIANGLE *tri, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "TRIANGLE"); /* "TRIANGLE" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)tri, sb, variant);
-	}
-	if ( rttriangle_is_empty(ctx, tri) )
-	{  
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "("); /* Triangles have extraneous brackets */
-	ptarray_to_wkt_sb(ctx, tri->points, sb, precision, variant);
-	stringbuffer_append(ctx, sb, ")"); 
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "TRIANGLE"); /* "TRIANGLE" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)tri, sb, variant);
+  }
+  if ( rttriangle_is_empty(ctx, tri) )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "("); /* Triangles have extraneous brackets */
+  ptarray_to_wkt_sb(ctx, tri->points, sb, precision, variant);
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -539,28 +539,28 @@ static void rttriangle_to_wkt_sb(const RTCTX *ctx, const RTTRIANGLE *tri, string
 */
 static void rttin_to_wkt_sb(const RTCTX *ctx, const RTTIN *tin, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "TIN"); /* "TIN" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)tin, sb, variant);
-	}
-	if ( tin->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	stringbuffer_append(ctx, sb, "(");
-	for ( i = 0; i < tin->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* We don't want type strings on our subgeoms */
-		rttriangle_to_wkt_sb(ctx, tin->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-	}
-	stringbuffer_append(ctx, sb, ")");
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "TIN"); /* "TIN" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)tin, sb, variant);
+  }
+  if ( tin->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  stringbuffer_append(ctx, sb, "(");
+  for ( i = 0; i < tin->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* We don't want type strings on our subgeoms */
+    rttriangle_to_wkt_sb(ctx, tin->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 /*
@@ -568,30 +568,30 @@ static void rttin_to_wkt_sb(const RTCTX *ctx, const RTTIN *tin, stringbuffer_t *
 */
 static void rtpsurface_to_wkt_sb(const RTCTX *ctx, const RTPSURFACE *psurf, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	int i = 0;
-
-	if ( ! (variant & RTWKT_NO_TYPE) )
-	{
-		stringbuffer_append(ctx, sb, "POLYHEDRALSURFACE"); /* "POLYHEDRALSURFACE" */
-		dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)psurf, sb, variant);
-	}
-	if ( psurf->ngeoms < 1 )
-	{
-		empty_to_wkt_sb(ctx, sb);
-		return;
-	}
-
-	variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
-
-	stringbuffer_append(ctx, sb, "(");
-	for ( i = 0; i < psurf->ngeoms; i++ )
-	{
-		if ( i > 0 )
-			stringbuffer_append(ctx, sb, ",");
-		/* We don't want type strings on our subgeoms */
-		rtpoly_to_wkt_sb(ctx, psurf->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
-	}
-	stringbuffer_append(ctx, sb, ")");	
+  int i = 0;
+
+  if ( ! (variant & RTWKT_NO_TYPE) )
+  {
+    stringbuffer_append(ctx, sb, "POLYHEDRALSURFACE"); /* "POLYHEDRALSURFACE" */
+    dimension_qualifiers_to_wkt_sb(ctx, (RTGEOM*)psurf, sb, variant);
+  }
+  if ( psurf->ngeoms < 1 )
+  {
+    empty_to_wkt_sb(ctx, sb);
+    return;
+  }
+
+  variant = variant | RTWKT_IS_CHILD; /* Inform the sub-geometries they are childre */
+
+  stringbuffer_append(ctx, sb, "(");
+  for ( i = 0; i < psurf->ngeoms; i++ )
+  {
+    if ( i > 0 )
+      stringbuffer_append(ctx, sb, ",");
+    /* We don't want type strings on our subgeoms */
+    rtpoly_to_wkt_sb(ctx, psurf->geoms[i], sb, precision, variant | RTWKT_NO_TYPE );
+  }
+  stringbuffer_append(ctx, sb, ")");
 }
 
 
@@ -600,61 +600,61 @@ static void rtpsurface_to_wkt_sb(const RTCTX *ctx, const RTPSURFACE *psurf, stri
 */
 static void rtgeom_to_wkt_sb(const RTCTX *ctx, const RTGEOM *geom, stringbuffer_t *sb, int precision, uint8_t variant)
 {
-	RTDEBUGF(4, "rtgeom_to_wkt_sb: type %s, hasz %d, hasm %d",
-		rttype_name(ctx, geom->type), (geom->type),
-		RTFLAGS_GET_Z(geom->flags)?1:0, RTFLAGS_GET_M(geom->flags)?1:0);
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-		rtpoint_to_wkt_sb(ctx, (RTPOINT*)geom, sb, precision, variant);
-		break;
-	case RTLINETYPE:
-		rtline_to_wkt_sb(ctx, (RTLINE*)geom, sb, precision, variant);
-		break;
-	case RTPOLYGONTYPE:
-		rtpoly_to_wkt_sb(ctx, (RTPOLY*)geom, sb, precision, variant);
-		break;
-	case RTMULTIPOINTTYPE:
-		rtmpoint_to_wkt_sb(ctx, (RTMPOINT*)geom, sb, precision, variant);
-		break;
-	case RTMULTILINETYPE:
-		rtmline_to_wkt_sb(ctx, (RTMLINE*)geom, sb, precision, variant);
-		break;
-	case RTMULTIPOLYGONTYPE:
-		rtmpoly_to_wkt_sb(ctx, (RTMPOLY*)geom, sb, precision, variant);
-		break;
-	case RTCOLLECTIONTYPE:
-		rtcollection_to_wkt_sb(ctx, (RTCOLLECTION*)geom, sb, precision, variant);
-		break;
-	case RTCIRCSTRINGTYPE:
-		rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)geom, sb, precision, variant);
-		break;
-	case RTCOMPOUNDTYPE:
-		rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)geom, sb, precision, variant);
-		break;
-	case RTCURVEPOLYTYPE:
-		rtcurvepoly_to_wkt_sb(ctx, (RTCURVEPOLY*)geom, sb, precision, variant);
-		break;
-	case RTMULTICURVETYPE:
-		rtmcurve_to_wkt_sb(ctx, (RTMCURVE*)geom, sb, precision, variant);
-		break;
-	case RTMULTISURFACETYPE:
-		rtmsurface_to_wkt_sb(ctx, (RTMSURFACE*)geom, sb, precision, variant);
-		break;
-	case RTTRIANGLETYPE:
-		rttriangle_to_wkt_sb(ctx, (RTTRIANGLE*)geom, sb, precision, variant);
-		break;
-	case RTTINTYPE:
-		rttin_to_wkt_sb(ctx, (RTTIN*)geom, sb, precision, variant);
-		break;
-	case RTPOLYHEDRALSURFACETYPE:
-		rtpsurface_to_wkt_sb(ctx, (RTPSURFACE*)geom, sb, precision, variant);
-		break;
-	default:
-		rterror(ctx, "rtgeom_to_wkt_sb: Type %d - %s unsupported.",
-		        geom->type, rttype_name(ctx, geom->type));
-	}
+  RTDEBUGF(4, "rtgeom_to_wkt_sb: type %s, hasz %d, hasm %d",
+    rttype_name(ctx, geom->type), (geom->type),
+    RTFLAGS_GET_Z(geom->flags)?1:0, RTFLAGS_GET_M(geom->flags)?1:0);
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+    rtpoint_to_wkt_sb(ctx, (RTPOINT*)geom, sb, precision, variant);
+    break;
+  case RTLINETYPE:
+    rtline_to_wkt_sb(ctx, (RTLINE*)geom, sb, precision, variant);
+    break;
+  case RTPOLYGONTYPE:
+    rtpoly_to_wkt_sb(ctx, (RTPOLY*)geom, sb, precision, variant);
+    break;
+  case RTMULTIPOINTTYPE:
+    rtmpoint_to_wkt_sb(ctx, (RTMPOINT*)geom, sb, precision, variant);
+    break;
+  case RTMULTILINETYPE:
+    rtmline_to_wkt_sb(ctx, (RTMLINE*)geom, sb, precision, variant);
+    break;
+  case RTMULTIPOLYGONTYPE:
+    rtmpoly_to_wkt_sb(ctx, (RTMPOLY*)geom, sb, precision, variant);
+    break;
+  case RTCOLLECTIONTYPE:
+    rtcollection_to_wkt_sb(ctx, (RTCOLLECTION*)geom, sb, precision, variant);
+    break;
+  case RTCIRCSTRINGTYPE:
+    rtcircstring_to_wkt_sb(ctx, (RTCIRCSTRING*)geom, sb, precision, variant);
+    break;
+  case RTCOMPOUNDTYPE:
+    rtcompound_to_wkt_sb(ctx, (RTCOMPOUND*)geom, sb, precision, variant);
+    break;
+  case RTCURVEPOLYTYPE:
+    rtcurvepoly_to_wkt_sb(ctx, (RTCURVEPOLY*)geom, sb, precision, variant);
+    break;
+  case RTMULTICURVETYPE:
+    rtmcurve_to_wkt_sb(ctx, (RTMCURVE*)geom, sb, precision, variant);
+    break;
+  case RTMULTISURFACETYPE:
+    rtmsurface_to_wkt_sb(ctx, (RTMSURFACE*)geom, sb, precision, variant);
+    break;
+  case RTTRIANGLETYPE:
+    rttriangle_to_wkt_sb(ctx, (RTTRIANGLE*)geom, sb, precision, variant);
+    break;
+  case RTTINTYPE:
+    rttin_to_wkt_sb(ctx, (RTTIN*)geom, sb, precision, variant);
+    break;
+  case RTPOLYHEDRALSURFACETYPE:
+    rtpsurface_to_wkt_sb(ctx, (RTPSURFACE*)geom, sb, precision, variant);
+    break;
+  default:
+    rterror(ctx, "rtgeom_to_wkt_sb: Type %d - %s unsupported.",
+            geom->type, rttype_name(ctx, geom->type));
+  }
 }
 
 /**
@@ -669,26 +669,26 @@ static void rtgeom_to_wkt_sb(const RTCTX *ctx, const RTGEOM *geom, stringbuffer_
 */
 char* rtgeom_to_wkt(const RTCTX *ctx, const RTGEOM *geom, uint8_t variant, int precision, size_t *size_out)
 {
-	stringbuffer_t *sb;
-	char *str = NULL;
-	if ( geom == NULL )
-		return NULL;
-	sb = stringbuffer_create(ctx);
-	/* Extended mode starts with an "SRID=" section for geoms that have one */
-	if ( (variant & RTWKT_EXTENDED) && rtgeom_has_srid(ctx, geom) )
-	{
-		stringbuffer_aprintf(ctx, sb, "SRID=%d;", geom->srid);
-	}
-	rtgeom_to_wkt_sb(ctx, geom, sb, precision, variant);
-	if ( stringbuffer_getstring(ctx, sb) == NULL )
-	{
-		rterror(ctx, "Uh oh");
-		return NULL;
-	}
-	str = stringbuffer_getstringcopy(ctx, sb);
-	if ( size_out )
-		*size_out = stringbuffer_getlength(ctx, sb) + 1;
-	stringbuffer_destroy(ctx, sb);
-	return str;
+  stringbuffer_t *sb;
+  char *str = NULL;
+  if ( geom == NULL )
+    return NULL;
+  sb = stringbuffer_create(ctx);
+  /* Extended mode starts with an "SRID=" section for geoms that have one */
+  if ( (variant & RTWKT_EXTENDED) && rtgeom_has_srid(ctx, geom) )
+  {
+    stringbuffer_aprintf(ctx, sb, "SRID=%d;", geom->srid);
+  }
+  rtgeom_to_wkt_sb(ctx, geom, sb, precision, variant);
+  if ( stringbuffer_getstring(ctx, sb) == NULL )
+  {
+    rterror(ctx, "Uh oh");
+    return NULL;
+  }
+  str = stringbuffer_getstringcopy(ctx, sb);
+  if ( size_out )
+    *size_out = stringbuffer_getlength(ctx, sb) + 1;
+  stringbuffer_destroy(ctx, sb);
+  return str;
 }
 
diff --git a/src/rtout_x3d.c b/src/rtout_x3d.c
index 68ba06a..e03fbd0 100644
--- a/src/rtout_x3d.c
+++ b/src/rtout_x3d.c
@@ -60,194 +60,194 @@ static size_t pointArray_X3Dsize(const RTCTX *ctx, RTPOINTARRAY *pa, int precisi
 extern char *
 rtgeom_to_x3d3(const RTCTX *ctx, const RTGEOM *geom, char *srs, int precision, int opts, const char *defid)
 {
-	int type = geom->type;
-
-	switch (type)
-	{
-	case RTPOINTTYPE:
-		return asx3d3_point(ctx, (RTPOINT*)geom, srs, precision, opts, defid);
-
-	case RTLINETYPE:
-		return asx3d3_line(ctx, (RTLINE*)geom, srs, precision, opts, defid);
-
-	case RTPOLYGONTYPE:
-	{
-		/** We might change this later, but putting a polygon in an indexed face set
-		* seems like the simplest way to go so treat just like a mulitpolygon
-		*/
-		RTCOLLECTION *tmp = (RTCOLLECTION*)rtgeom_as_multi(ctx, geom);
-		char *ret = asx3d3_multi(ctx, tmp, srs, precision, opts, defid);
-		rtcollection_free(ctx, tmp);
-		return ret;
-	}
-
-	case RTTRIANGLETYPE:
-		return asx3d3_triangle(ctx, (RTTRIANGLE*)geom, srs, precision, opts, defid);
-
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-		return asx3d3_multi(ctx, (RTCOLLECTION*)geom, srs, precision, opts, defid);
-
-	case RTPOLYHEDRALSURFACETYPE:
-		return asx3d3_psurface(ctx, (RTPSURFACE*)geom, srs, precision, opts, defid);
-
-	case RTTINTYPE:
-		return asx3d3_tin(ctx, (RTTIN*)geom, srs, precision, opts, defid);
-
-	case RTCOLLECTIONTYPE:
-		return asx3d3_collection(ctx, (RTCOLLECTION*)geom, srs, precision, opts, defid);
-
-	default:
-		rterror(ctx, "rtgeom_to_x3d3: '%s' geometry type not supported", rttype_name(ctx, type));
-		return NULL;
-	}
+  int type = geom->type;
+
+  switch (type)
+  {
+  case RTPOINTTYPE:
+    return asx3d3_point(ctx, (RTPOINT*)geom, srs, precision, opts, defid);
+
+  case RTLINETYPE:
+    return asx3d3_line(ctx, (RTLINE*)geom, srs, precision, opts, defid);
+
+  case RTPOLYGONTYPE:
+  {
+    /** We might change this later, but putting a polygon in an indexed face set
+    * seems like the simplest way to go so treat just like a mulitpolygon
+    */
+    RTCOLLECTION *tmp = (RTCOLLECTION*)rtgeom_as_multi(ctx, geom);
+    char *ret = asx3d3_multi(ctx, tmp, srs, precision, opts, defid);
+    rtcollection_free(ctx, tmp);
+    return ret;
+  }
+
+  case RTTRIANGLETYPE:
+    return asx3d3_triangle(ctx, (RTTRIANGLE*)geom, srs, precision, opts, defid);
+
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+    return asx3d3_multi(ctx, (RTCOLLECTION*)geom, srs, precision, opts, defid);
+
+  case RTPOLYHEDRALSURFACETYPE:
+    return asx3d3_psurface(ctx, (RTPSURFACE*)geom, srs, precision, opts, defid);
+
+  case RTTINTYPE:
+    return asx3d3_tin(ctx, (RTTIN*)geom, srs, precision, opts, defid);
+
+  case RTCOLLECTIONTYPE:
+    return asx3d3_collection(ctx, (RTCOLLECTION*)geom, srs, precision, opts, defid);
+
+  default:
+    rterror(ctx, "rtgeom_to_x3d3: '%s' geometry type not supported", rttype_name(ctx, type));
+    return NULL;
+  }
 }
 
 static size_t
 asx3d3_point_size(const RTCTX *ctx, const RTPOINT *point, char *srs, int precision, int opts, const char *defid)
 {
-	int size;
-	/* size_t defidlen = strlen(defid); */
+  int size;
+  /* size_t defidlen = strlen(defid); */
 
-	size = pointArray_X3Dsize(ctx, point->point, precision);
-	/* size += ( sizeof("<point><pos>/") + (defidlen*2) ) * 2; */
-	/* if (srs)     size += strlen(srs) + sizeof(" srsName=.."); */
-	return size;
+  size = pointArray_X3Dsize(ctx, point->point, precision);
+  /* size += ( sizeof("<point><pos>/") + (defidlen*2) ) * 2; */
+  /* if (srs)     size += strlen(srs) + sizeof(" srsName=.."); */
+  return size;
 }
 
 static size_t
 asx3d3_point_buf(const RTCTX *ctx, const RTPOINT *point, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr = output;
-	/* int dimension=2; */
-
-	/* if (RTFLAGS_GET_Z(point->flags)) dimension = 3; */
-	/*	if ( srs )
-		{
-			ptr += sprintf(ptr, "<%sPoint srsName=\"%s\">", defid, srs);
-		}
-		else*/
-	/* ptr += sprintf(ptr, "%s", defid); */
-
-	/* ptr += sprintf(ptr, "<%spos>", defid); */
-	ptr += pointArray_toX3D3(ctx, point->point, ptr, precision, opts, 0);
-	/* ptr += sprintf(ptr, "</%spos></%sPoint>", defid, defid); */
-
-	return (ptr-output);
+  char *ptr = output;
+  /* int dimension=2; */
+
+  /* if (RTFLAGS_GET_Z(point->flags)) dimension = 3; */
+  /*  if ( srs )
+    {
+      ptr += sprintf(ptr, "<%sPoint srsName=\"%s\">", defid, srs);
+    }
+    else*/
+  /* ptr += sprintf(ptr, "%s", defid); */
+
+  /* ptr += sprintf(ptr, "<%spos>", defid); */
+  ptr += pointArray_toX3D3(ctx, point->point, ptr, precision, opts, 0);
+  /* ptr += sprintf(ptr, "</%spos></%sPoint>", defid, defid); */
+
+  return (ptr-output);
 }
 
 static char *
 asx3d3_point(const RTCTX *ctx, const RTPOINT *point, char *srs, int precision, int opts, const char *defid)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asx3d3_point_size(ctx, point, srs, precision, opts, defid);
-	output = rtalloc(ctx, size);
-	asx3d3_point_buf(ctx, point, srs, output, precision, opts, defid);
-	return output;
+  size = asx3d3_point_size(ctx, point, srs, precision, opts, defid);
+  output = rtalloc(ctx, size);
+  asx3d3_point_buf(ctx, point, srs, output, precision, opts, defid);
+  return output;
 }
 
 
 static size_t
 asx3d3_line_size(const RTCTX *ctx, const RTLINE *line, char *srs, int precision, int opts, const char *defid)
 {
-	int size;
-	size_t defidlen = strlen(defid);
-
-	size = pointArray_X3Dsize(ctx, line->points, precision)*2;
-	
-	if ( X3D_USE_GEOCOORDS(opts) ) {
-			size += (
-	            sizeof("<LineSet vertexCount=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></LineSet>")  + defidlen
-	        ) * 2;
-	}
-	else {
-		size += (
-		            sizeof("<LineSet vertexCount=''><Coordinate point='' /></LineSet>")  + defidlen
-		        ) * 2;
-	}
-
-	/* if (srs)     size += strlen(srs) + sizeof(" srsName=.."); */
-	return size;
+  int size;
+  size_t defidlen = strlen(defid);
+
+  size = pointArray_X3Dsize(ctx, line->points, precision)*2;
+
+  if ( X3D_USE_GEOCOORDS(opts) ) {
+      size += (
+              sizeof("<LineSet vertexCount=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></LineSet>")  + defidlen
+          ) * 2;
+  }
+  else {
+    size += (
+                sizeof("<LineSet vertexCount=''><Coordinate point='' /></LineSet>")  + defidlen
+            ) * 2;
+  }
+
+  /* if (srs)     size += strlen(srs) + sizeof(" srsName=.."); */
+  return size;
 }
 
 static size_t
 asx3d3_line_buf(const RTCTX *ctx, const RTLINE *line, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr=output;
-	/* int dimension=2; */
-	RTPOINTARRAY *pa;
+  char *ptr=output;
+  /* int dimension=2; */
+  RTPOINTARRAY *pa;
 
 
-	/* if (RTFLAGS_GET_Z(line->flags)) dimension = 3; */
+  /* if (RTFLAGS_GET_Z(line->flags)) dimension = 3; */
 
-	pa = line->points;
-	ptr += sprintf(ptr, "<LineSet %s vertexCount='%d'>", defid, pa->npoints);
+  pa = line->points;
+  ptr += sprintf(ptr, "<LineSet %s vertexCount='%d'>", defid, pa->npoints);
 
-	if ( X3D_USE_GEOCOORDS(opts) ) ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
-	else
-		ptr += sprintf(ptr, "<Coordinate point='");
-	ptr += pointArray_toX3D3(ctx, line->points, ptr, precision, opts, rtline_is_closed(ctx, (RTLINE *) line));
+  if ( X3D_USE_GEOCOORDS(opts) ) ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
+  else
+    ptr += sprintf(ptr, "<Coordinate point='");
+  ptr += pointArray_toX3D3(ctx, line->points, ptr, precision, opts, rtline_is_closed(ctx, (RTLINE *) line));
 
-	ptr += sprintf(ptr, "' />");
+  ptr += sprintf(ptr, "' />");
 
-	ptr += sprintf(ptr, "</LineSet>");
-	return (ptr-output);
+  ptr += sprintf(ptr, "</LineSet>");
+  return (ptr-output);
 }
 
 static size_t
 asx3d3_line_coords(const RTCTX *ctx, const RTLINE *line, char *output, int precision, int opts)
 {
-	char *ptr=output;
-	/* ptr += sprintf(ptr, ""); */
-	ptr += pointArray_toX3D3(ctx, line->points, ptr, precision, opts, rtline_is_closed(ctx, line));
-	return (ptr-output);
+  char *ptr=output;
+  /* ptr += sprintf(ptr, ""); */
+  ptr += pointArray_toX3D3(ctx, line->points, ptr, precision, opts, rtline_is_closed(ctx, line));
+  return (ptr-output);
 }
 
 /* Calculate the coordIndex property of the IndexedLineSet for the multilinestring */
 static size_t
 asx3d3_mline_coordindex(const RTCTX *ctx, const RTMLINE *mgeom, char *output)
 {
-	char *ptr=output;
-	RTLINE *geom;
-	int i, j, k, si;
-	RTPOINTARRAY *pa;
-	int np;
-
-	j = 0;
-	for (i=0; i < mgeom->ngeoms; i++)
-	{
-		geom = (RTLINE *) mgeom->geoms[i];
-		pa = geom->points;
-		np = pa->npoints;
-		si = j;  /* start index of first point of linestring */
-		for (k=0; k < np ; k++)
-		{
-			if (k)
-			{
-				ptr += sprintf(ptr, " ");
-			}
-			/** if the linestring is closed, we put the start point index
-			*   for the last vertex to denote use first point
-			*    and don't increment the index **/
-			if (!rtline_is_closed(ctx, geom) || k < (np -1) )
-			{
-				ptr += sprintf(ptr, "%d", j);
-				j += 1;
-			}
-			else
-			{
-				ptr += sprintf(ptr,"%d", si);
-			}
-		}
-		if (i < (mgeom->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " -1 "); /* separator for each linestring */
-		}
-	}
-	return (ptr-output);
+  char *ptr=output;
+  RTLINE *geom;
+  int i, j, k, si;
+  RTPOINTARRAY *pa;
+  int np;
+
+  j = 0;
+  for (i=0; i < mgeom->ngeoms; i++)
+  {
+    geom = (RTLINE *) mgeom->geoms[i];
+    pa = geom->points;
+    np = pa->npoints;
+    si = j;  /* start index of first point of linestring */
+    for (k=0; k < np ; k++)
+    {
+      if (k)
+      {
+        ptr += sprintf(ptr, " ");
+      }
+      /** if the linestring is closed, we put the start point index
+      *   for the last vertex to denote use first point
+      *    and don't increment the index **/
+      if (!rtline_is_closed(ctx, geom) || k < (np -1) )
+      {
+        ptr += sprintf(ptr, "%d", j);
+        j += 1;
+      }
+      else
+      {
+        ptr += sprintf(ptr,"%d", si);
+      }
+    }
+    if (i < (mgeom->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " -1 "); /* separator for each linestring */
+    }
+  }
+  return (ptr-output);
 }
 
 /* Calculate the coordIndex property of the IndexedLineSet for a multipolygon
@@ -256,124 +256,124 @@ asx3d3_mline_coordindex(const RTCTX *ctx, const RTMLINE *mgeom, char *output)
 static size_t
 asx3d3_mpoly_coordindex(const RTCTX *ctx, const RTMPOLY *psur, char *output)
 {
-	char *ptr=output;
-	RTPOLY *patch;
-	int i, j, k, l;
-	int np;
-	j = 0;
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		patch = (RTPOLY *) psur->geoms[i];
-		for (l=0; l < patch->nrings; l++)
-		{
-			np = patch->rings[l]->npoints - 1;
-			for (k=0; k < np ; k++)
-			{
-				if (k)
-				{
-					ptr += sprintf(ptr, " ");
-				}
-				ptr += sprintf(ptr, "%d", (j + k));
-			}
-			j += k;
-			if (l < (patch->nrings - 1) )
-			{
-				/** @todo TODO: Decide the best way to render holes
-				*  Evidentally according to my X3D expert the X3D consortium doesn't really
-				*  support holes and it's an issue of argument among many that feel it should. He thinks CAD x3d extensions to spec might.
-				*  What he has done and others developing X3D exports to simulate a hole is to cut around it.
-				*  So if you have a donut, you would cut it into half and have 2 solid polygons.  Not really sure the best way to handle this.
-				*  For now will leave it as polygons stacked on top of each other -- which is what we are doing here and perhaps an option
-				*  to color differently.  It's not ideal but the alternative sounds complicated.
-				**/
-				ptr += sprintf(ptr, " -1 "); /* separator for each inner ring. Ideally we should probably triangulate and cut around as others do */
-			}
-		}
-		if (i < (psur->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
-		}
-	}
-	return (ptr-output);
+  char *ptr=output;
+  RTPOLY *patch;
+  int i, j, k, l;
+  int np;
+  j = 0;
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    patch = (RTPOLY *) psur->geoms[i];
+    for (l=0; l < patch->nrings; l++)
+    {
+      np = patch->rings[l]->npoints - 1;
+      for (k=0; k < np ; k++)
+      {
+        if (k)
+        {
+          ptr += sprintf(ptr, " ");
+        }
+        ptr += sprintf(ptr, "%d", (j + k));
+      }
+      j += k;
+      if (l < (patch->nrings - 1) )
+      {
+        /** @todo TODO: Decide the best way to render holes
+        *  Evidentally according to my X3D expert the X3D consortium doesn't really
+        *  support holes and it's an issue of argument among many that feel it should. He thinks CAD x3d extensions to spec might.
+        *  What he has done and others developing X3D exports to simulate a hole is to cut around it.
+        *  So if you have a donut, you would cut it into half and have 2 solid polygons.  Not really sure the best way to handle this.
+        *  For now will leave it as polygons stacked on top of each other -- which is what we are doing here and perhaps an option
+        *  to color differently.  It's not ideal but the alternative sounds complicated.
+        **/
+        ptr += sprintf(ptr, " -1 "); /* separator for each inner ring. Ideally we should probably triangulate and cut around as others do */
+      }
+    }
+    if (i < (psur->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
+    }
+  }
+  return (ptr-output);
 }
 
 /** Return the linestring as an X3D LineSet */
 static char *
 asx3d3_line(const RTCTX *ctx, const RTLINE *line, char *srs, int precision, int opts, const char *defid)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = sizeof("<LineSet><CoordIndex ='' /></LineSet>") + asx3d3_line_size(ctx, line, srs, precision, opts, defid);
-	output = rtalloc(ctx, size);
-	asx3d3_line_buf(ctx, line, srs, output, precision, opts, defid);
-	return output;
+  size = sizeof("<LineSet><CoordIndex ='' /></LineSet>") + asx3d3_line_size(ctx, line, srs, precision, opts, defid);
+  output = rtalloc(ctx, size);
+  asx3d3_line_buf(ctx, line, srs, output, precision, opts, defid);
+  return output;
 }
 
 /** Compute the string space needed for the IndexedFaceSet representation of the polygon **/
 static size_t
 asx3d3_poly_size(const RTCTX *ctx, const RTPOLY *poly,  char *srs, int precision, int opts, const char *defid)
 {
-	size_t size;
-	size_t defidlen = strlen(defid);
-	int i;
+  size_t size;
+  size_t defidlen = strlen(defid);
+  int i;
 
-	size = ( sizeof("<IndexedFaceSet></IndexedFaceSet>") + (defidlen*3) ) * 2 + 6 * (poly->nrings - 1);
+  size = ( sizeof("<IndexedFaceSet></IndexedFaceSet>") + (defidlen*3) ) * 2 + 6 * (poly->nrings - 1);
 
-	for (i=0; i<poly->nrings; i++)
-		size += pointArray_X3Dsize(ctx, poly->rings[i], precision);
+  for (i=0; i<poly->nrings; i++)
+    size += pointArray_X3Dsize(ctx, poly->rings[i], precision);
 
-	return size;
+  return size;
 }
 
 /** Compute the X3D coordinates of the polygon **/
 static size_t
 asx3d3_poly_buf(const RTCTX *ctx, const RTPOLY *poly, char *srs, char *output, int precision, int opts, int is_patch, const char *defid)
 {
-	int i;
-	char *ptr=output;
-
-	ptr += pointArray_toX3D3(ctx, poly->rings[0], ptr, precision, opts, 1);
-	for (i=1; i<poly->nrings; i++)
-	{
-		ptr += sprintf(ptr, " "); /* inner ring points start */
-		ptr += pointArray_toX3D3(ctx, poly->rings[i], ptr, precision, opts,1);
-	}
-	return (ptr-output);
+  int i;
+  char *ptr=output;
+
+  ptr += pointArray_toX3D3(ctx, poly->rings[0], ptr, precision, opts, 1);
+  for (i=1; i<poly->nrings; i++)
+  {
+    ptr += sprintf(ptr, " "); /* inner ring points start */
+    ptr += pointArray_toX3D3(ctx, poly->rings[i], ptr, precision, opts,1);
+  }
+  return (ptr-output);
 }
 
 static size_t
 asx3d3_triangle_size(const RTCTX *ctx, const RTTRIANGLE *triangle, char *srs, int precision, int opts, const char *defid)
 {
-	size_t size;
-	size_t defidlen = strlen(defid);
+  size_t size;
+  size_t defidlen = strlen(defid);
 
-	/** 6 for the 3 sides and space to separate each side **/
-	size = sizeof("<IndexedTriangleSet index=''></IndexedTriangleSet>") + defidlen + 6;
-	size += pointArray_X3Dsize(ctx, triangle->points, precision);
+  /** 6 for the 3 sides and space to separate each side **/
+  size = sizeof("<IndexedTriangleSet index=''></IndexedTriangleSet>") + defidlen + 6;
+  size += pointArray_X3Dsize(ctx, triangle->points, precision);
 
-	return size;
+  return size;
 }
 
 static size_t
 asx3d3_triangle_buf(const RTCTX *ctx, const RTTRIANGLE *triangle, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr=output;
-	ptr += pointArray_toX3D3(ctx, triangle->points, ptr, precision, opts, 1);
+  char *ptr=output;
+  ptr += pointArray_toX3D3(ctx, triangle->points, ptr, precision, opts, 1);
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 static char *
 asx3d3_triangle(const RTCTX *ctx, const RTTRIANGLE *triangle, char *srs, int precision, int opts, const char *defid)
 {
-	char *output;
-	int size;
+  char *output;
+  int size;
 
-	size = asx3d3_triangle_size(ctx, triangle, srs, precision, opts, defid);
-	output = rtalloc(ctx, size);
-	asx3d3_triangle_buf(ctx, triangle, srs, output, precision, opts, defid);
-	return output;
+  size = asx3d3_triangle_size(ctx, triangle, srs, precision, opts, defid);
+  output = rtalloc(ctx, size);
+  asx3d3_triangle_buf(ctx, triangle, srs, output, precision, opts, defid);
+  return output;
 }
 
 
@@ -385,41 +385,41 @@ asx3d3_triangle(const RTCTX *ctx, const RTTRIANGLE *triangle, char *srs, int pre
 static size_t
 asx3d3_multi_size(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
 {
-	int i;
-	size_t size;
-	size_t defidlen = strlen(defid);
-	RTGEOM *subgeom;
-
-	/* the longest possible multi version needs to hold DEF=defid and coordinate breakout */
-	if ( X3D_USE_GEOCOORDS(opts) )
-		size = sizeof("<PointSet><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></PointSet>");
-	else
-		size = sizeof("<PointSet><Coordinate point='' /></PointSet>") + defidlen;
-	
-
-	/* if ( srs ) size += strlen(srs) + sizeof(" srsName=.."); */
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			/* size += ( sizeof("point=''") + defidlen ) * 2; */
-			size += asx3d3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, defid);
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			/* size += ( sizeof("<curveMember>/") + defidlen ) * 2; */
-			size += asx3d3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, defid);
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			/* size += ( sizeof("<surfaceMember>/") + defidlen ) * 2; */
-			size += asx3d3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, defid);
-		}
-	}
-
-	return size;
+  int i;
+  size_t size;
+  size_t defidlen = strlen(defid);
+  RTGEOM *subgeom;
+
+  /* the longest possible multi version needs to hold DEF=defid and coordinate breakout */
+  if ( X3D_USE_GEOCOORDS(opts) )
+    size = sizeof("<PointSet><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' /></PointSet>");
+  else
+    size = sizeof("<PointSet><Coordinate point='' /></PointSet>") + defidlen;
+
+
+  /* if ( srs ) size += strlen(srs) + sizeof(" srsName=.."); */
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      /* size += ( sizeof("point=''") + defidlen ) * 2; */
+      size += asx3d3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, defid);
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      /* size += ( sizeof("<curveMember>/") + defidlen ) * 2; */
+      size += asx3d3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, defid);
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      /* size += ( sizeof("<surfaceMember>/") + defidlen ) * 2; */
+      size += asx3d3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, defid);
+    }
+  }
+
+  return size;
 }
 
 /*
@@ -428,22 +428,22 @@ asx3d3_multi_size(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int prec
 static size_t
 asx3d3_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr, *x3dtype;
-	int i;
-	int dimension=2;
+  char *ptr, *x3dtype;
+  int i;
+  int dimension=2;
 
-	if (RTFLAGS_GET_Z(col->flags)) dimension = 3;
-	RTGEOM *subgeom;
-	ptr = output;
-	x3dtype="";
+  if (RTFLAGS_GET_Z(col->flags)) dimension = 3;
+  RTGEOM *subgeom;
+  ptr = output;
+  x3dtype="";
 
 
-	switch (col->type)
-	{
+  switch (col->type)
+  {
         case RTMULTIPOINTTYPE:
             x3dtype = "PointSet";
             if ( dimension == 2 ){ /** Use Polypoint2D instead **/
-                x3dtype = "Polypoint2D";   
+                x3dtype = "Polypoint2D";
                 ptr += sprintf(ptr, "<%s %s point='", x3dtype, defid);
             }
             else {
@@ -467,38 +467,38 @@ asx3d3_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char *out
             return 0;
     }
     if (dimension == 3){
-		if ( X3D_USE_GEOCOORDS(opts) ) 
-			ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
-		else
-        	ptr += sprintf(ptr, "<Coordinate point='");
-    }
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		if (subgeom->type == RTPOINTTYPE)
-		{
-			ptr += asx3d3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, defid);
-			ptr += sprintf(ptr, " ");
-		}
-		else if (subgeom->type == RTLINETYPE)
-		{
-			ptr += asx3d3_line_coords(ctx, (RTLINE*)subgeom, ptr, precision, opts);
-			ptr += sprintf(ptr, " ");
-		}
-		else if (subgeom->type == RTPOLYGONTYPE)
-		{
-			ptr += asx3d3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
-			ptr += sprintf(ptr, " ");
-		}
-	}
-
-	/* Close outmost tag */
-	if (dimension == 3){
-	    ptr += sprintf(ptr, "' /></%s>", x3dtype);
-	}
-	else { ptr += sprintf(ptr, "' />"); }    
-	return (ptr-output);
+    if ( X3D_USE_GEOCOORDS(opts) )
+      ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
+    else
+          ptr += sprintf(ptr, "<Coordinate point='");
+    }
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    if (subgeom->type == RTPOINTTYPE)
+    {
+      ptr += asx3d3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, defid);
+      ptr += sprintf(ptr, " ");
+    }
+    else if (subgeom->type == RTLINETYPE)
+    {
+      ptr += asx3d3_line_coords(ctx, (RTLINE*)subgeom, ptr, precision, opts);
+      ptr += sprintf(ptr, " ");
+    }
+    else if (subgeom->type == RTPOLYGONTYPE)
+    {
+      ptr += asx3d3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
+      ptr += sprintf(ptr, " ");
+    }
+  }
+
+  /* Close outmost tag */
+  if (dimension == 3){
+      ptr += sprintf(ptr, "' /></%s>", x3dtype);
+  }
+  else { ptr += sprintf(ptr, "' />"); }
+  return (ptr-output);
 }
 
 /*
@@ -507,33 +507,33 @@ asx3d3_multi_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char *out
 static char *
 asx3d3_multi(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
 {
-	char *x3d;
-	size_t size;
+  char *x3d;
+  size_t size;
 
-	size = asx3d3_multi_size(ctx, col, srs, precision, opts, defid);
-	x3d = rtalloc(ctx, size);
-	asx3d3_multi_buf(ctx, col, srs, x3d, precision, opts, defid);
-	return x3d;
+  size = asx3d3_multi_size(ctx, col, srs, precision, opts, defid);
+  x3d = rtalloc(ctx, size);
+  asx3d3_multi_buf(ctx, col, srs, x3d, precision, opts, defid);
+  return x3d;
 }
 
 
 static size_t
 asx3d3_psurface_size(const RTCTX *ctx, const RTPSURFACE *psur, char *srs, int precision, int opts, const char *defid)
 {
-	int i;
-	size_t size;
-	size_t defidlen = strlen(defid);
+  int i;
+  size_t size;
+  size_t defidlen = strlen(defid);
+
+  if ( X3D_USE_GEOCOORDS(opts) ) size = sizeof("<IndexedFaceSet coordIndex=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' />") + defidlen;
+  else size = sizeof("<IndexedFaceSet coordIndex=''><Coordinate point='' />") + defidlen;
 
-	if ( X3D_USE_GEOCOORDS(opts) ) size = sizeof("<IndexedFaceSet coordIndex=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' />") + defidlen;
-	else size = sizeof("<IndexedFaceSet coordIndex=''><Coordinate point='' />") + defidlen;
-	
 
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		size += asx3d3_poly_size(ctx, psur->geoms[i], 0, precision, opts, defid)*5; /** need to make space for coordIndex values too including -1 separating each poly**/
-	}
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    size += asx3d3_poly_size(ctx, psur->geoms[i], 0, precision, opts, defid)*5; /** need to make space for coordIndex values too including -1 separating each poly**/
+  }
 
-	return size;
+  return size;
 }
 
 
@@ -543,55 +543,55 @@ asx3d3_psurface_size(const RTCTX *ctx, const RTPSURFACE *psur, char *srs, int pr
 static size_t
 asx3d3_psurface_buf(const RTCTX *ctx, const RTPSURFACE *psur, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr;
-	int i;
-	int j;
-	int k;
-	int np;
-	RTPOLY *patch;
-
-	ptr = output;
-
-	/* Open outmost tag */
-	ptr += sprintf(ptr, "<IndexedFaceSet %s coordIndex='",defid);
-
-	j = 0;
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		patch = (RTPOLY *) psur->geoms[i];
-		np = patch->rings[0]->npoints - 1;
-		for (k=0; k < np ; k++)
-		{
-			if (k)
-			{
-				ptr += sprintf(ptr, " ");
-			}
-			ptr += sprintf(ptr, "%d", (j + k));
-		}
-		if (i < (psur->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
-		}
-		j += k;
-	}
-
-	if ( X3D_USE_GEOCOORDS(opts) ) 
-		ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
-	else ptr += sprintf(ptr, "'><Coordinate point='");
-
-	for (i=0; i<psur->ngeoms; i++)
-	{
-		ptr += asx3d3_poly_buf(ctx, psur->geoms[i], 0, ptr, precision, opts, 1, defid);
-		if (i < (psur->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " "); /* only add a trailing space if its not the last polygon in the set */
-		}
-	}
-
-	/* Close outmost tag */
-	ptr += sprintf(ptr, "' /></IndexedFaceSet>");
-
-	return (ptr-output);
+  char *ptr;
+  int i;
+  int j;
+  int k;
+  int np;
+  RTPOLY *patch;
+
+  ptr = output;
+
+  /* Open outmost tag */
+  ptr += sprintf(ptr, "<IndexedFaceSet %s coordIndex='",defid);
+
+  j = 0;
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    patch = (RTPOLY *) psur->geoms[i];
+    np = patch->rings[0]->npoints - 1;
+    for (k=0; k < np ; k++)
+    {
+      if (k)
+      {
+        ptr += sprintf(ptr, " ");
+      }
+      ptr += sprintf(ptr, "%d", (j + k));
+    }
+    if (i < (psur->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " -1 "); /* separator for each subgeom */
+    }
+    j += k;
+  }
+
+  if ( X3D_USE_GEOCOORDS(opts) )
+    ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
+  else ptr += sprintf(ptr, "'><Coordinate point='");
+
+  for (i=0; i<psur->ngeoms; i++)
+  {
+    ptr += asx3d3_poly_buf(ctx, psur->geoms[i], 0, ptr, precision, opts, 1, defid);
+    if (i < (psur->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " "); /* only add a trailing space if its not the last polygon in the set */
+    }
+  }
+
+  /* Close outmost tag */
+  ptr += sprintf(ptr, "' /></IndexedFaceSet>");
+
+  return (ptr-output);
 }
 
 /*
@@ -600,34 +600,34 @@ asx3d3_psurface_buf(const RTCTX *ctx, const RTPSURFACE *psur, char *srs, char *o
 static char *
 asx3d3_psurface(const RTCTX *ctx, const RTPSURFACE *psur, char *srs, int precision, int opts, const char *defid)
 {
-	char *x3d;
-	size_t size;
+  char *x3d;
+  size_t size;
 
-	size = asx3d3_psurface_size(ctx, psur, srs, precision, opts, defid);
-	x3d = rtalloc(ctx, size);
-	asx3d3_psurface_buf(ctx, psur, srs, x3d, precision, opts, defid);
-	return x3d;
+  size = asx3d3_psurface_size(ctx, psur, srs, precision, opts, defid);
+  x3d = rtalloc(ctx, size);
+  asx3d3_psurface_buf(ctx, psur, srs, x3d, precision, opts, defid);
+  return x3d;
 }
 
 
 static size_t
 asx3d3_tin_size(const RTCTX *ctx, const RTTIN *tin, char *srs, int precision, int opts, const char *defid)
 {
-	int i;
-	size_t size;
-	size_t defidlen = strlen(defid);
-	/* int dimension=2; */
+  int i;
+  size_t size;
+  size_t defidlen = strlen(defid);
+  /* int dimension=2; */
 
-	/** Need to make space for size of additional attributes,
-	** the coordIndex has a value for each edge for each triangle plus a space to separate so we need at least that much extra room ***/
-	size = sizeof("<IndexedTriangleSet coordIndex=''></IndexedTriangleSet>") + defidlen + tin->ngeoms*12;
+  /** Need to make space for size of additional attributes,
+  ** the coordIndex has a value for each edge for each triangle plus a space to separate so we need at least that much extra room ***/
+  size = sizeof("<IndexedTriangleSet coordIndex=''></IndexedTriangleSet>") + defidlen + tin->ngeoms*12;
 
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		size += (asx3d3_triangle_size(ctx, tin->geoms[i], 0, precision, opts, defid) * 20); /** 3 is to make space for coordIndex **/
-	}
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    size += (asx3d3_triangle_size(ctx, tin->geoms[i], 0, precision, opts, defid) * 20); /** 3 is to make space for coordIndex **/
+  }
 
-	return size;
+  return size;
 }
 
 
@@ -637,44 +637,44 @@ asx3d3_tin_size(const RTCTX *ctx, const RTTIN *tin, char *srs, int precision, in
 static size_t
 asx3d3_tin_buf(const RTCTX *ctx, const RTTIN *tin, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr;
-	int i;
-	int k;
-	/* int dimension=2; */
-
-	ptr = output;
-
-	ptr += sprintf(ptr, "<IndexedTriangleSet %s index='",defid);
-	k = 0;
-	/** Fill in triangle index **/
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		ptr += sprintf(ptr, "%d %d %d", k, (k+1), (k+2));
-		if (i < (tin->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " ");
-		}
-		k += 3;
-	}
-
-	if ( X3D_USE_GEOCOORDS(opts) ) ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
-	else ptr += sprintf(ptr, "'><Coordinate point='");
-	
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		ptr += asx3d3_triangle_buf(ctx, tin->geoms[i], 0, ptr, precision,
-		                           opts, defid);
-		if (i < (tin->ngeoms - 1) )
-		{
-			ptr += sprintf(ptr, " ");
-		}
-	}
-
-	/* Close outmost tag */
-
-	ptr += sprintf(ptr, "'/></IndexedTriangleSet>");
-
-	return (ptr-output);
+  char *ptr;
+  int i;
+  int k;
+  /* int dimension=2; */
+
+  ptr = output;
+
+  ptr += sprintf(ptr, "<IndexedTriangleSet %s index='",defid);
+  k = 0;
+  /** Fill in triangle index **/
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    ptr += sprintf(ptr, "%d %d %d", k, (k+1), (k+2));
+    if (i < (tin->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " ");
+    }
+    k += 3;
+  }
+
+  if ( X3D_USE_GEOCOORDS(opts) ) ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & RT_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
+  else ptr += sprintf(ptr, "'><Coordinate point='");
+
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    ptr += asx3d3_triangle_buf(ctx, tin->geoms[i], 0, ptr, precision,
+                               opts, defid);
+    if (i < (tin->ngeoms - 1) )
+    {
+      ptr += sprintf(ptr, " ");
+    }
+  }
+
+  /* Close outmost tag */
+
+  ptr += sprintf(ptr, "'/></IndexedTriangleSet>");
+
+  return (ptr-output);
 }
 
 /*
@@ -683,131 +683,131 @@ asx3d3_tin_buf(const RTCTX *ctx, const RTTIN *tin, char *srs, char *output, int
 static char *
 asx3d3_tin(const RTCTX *ctx, const RTTIN *tin, char *srs, int precision, int opts, const char *defid)
 {
-	char *x3d;
-	size_t size;
+  char *x3d;
+  size_t size;
 
-	size = asx3d3_tin_size(ctx, tin, srs, precision, opts, defid);
-	x3d = rtalloc(ctx, size);
-	asx3d3_tin_buf(ctx, tin, srs, x3d, precision, opts, defid);
-	return x3d;
+  size = asx3d3_tin_size(ctx, tin, srs, precision, opts, defid);
+  x3d = rtalloc(ctx, size);
+  asx3d3_tin_buf(ctx, tin, srs, x3d, precision, opts, defid);
+  return x3d;
 }
 
 static size_t
 asx3d3_collection_size(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
 {
-	int i;
-	size_t size;
-	size_t defidlen = strlen(defid);
-	RTGEOM *subgeom;
-
-	/* size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; */
-	size = defidlen*2;
-
-	/** if ( srs )
-		size += strlen(srs) + sizeof(" srsName=.."); **/
-
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		size += ( sizeof("<Shape />") + defidlen ) * 2; /** for collections we need to wrap each in a shape tag to make valid **/
-		if ( subgeom->type == RTPOINTTYPE )
-		{
-			size += asx3d3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTLINETYPE )
-		{
-			size += asx3d3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTPOLYGONTYPE )
-		{
-			size += asx3d3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTTINTYPE )
-		{
-			size += asx3d3_tin_size(ctx, (RTTIN*)subgeom, 0, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTPOLYHEDRALSURFACETYPE )
-		{
-			size += asx3d3_psurface_size(ctx, (RTPSURFACE*)subgeom, 0, precision, opts, defid);
-		}
-		else if ( rtgeom_is_collection(ctx, subgeom) )
-		{
-			size += asx3d3_multi_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, opts, defid);
-		}
-		else
-			rterror(ctx, "asx3d3_collection_size: unknown geometry type");
-	}
-
-	return size;
+  int i;
+  size_t size;
+  size_t defidlen = strlen(defid);
+  RTGEOM *subgeom;
+
+  /* size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; */
+  size = defidlen*2;
+
+  /** if ( srs )
+    size += strlen(srs) + sizeof(" srsName=.."); **/
+
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    size += ( sizeof("<Shape />") + defidlen ) * 2; /** for collections we need to wrap each in a shape tag to make valid **/
+    if ( subgeom->type == RTPOINTTYPE )
+    {
+      size += asx3d3_point_size(ctx, (RTPOINT*)subgeom, 0, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTLINETYPE )
+    {
+      size += asx3d3_line_size(ctx, (RTLINE*)subgeom, 0, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTPOLYGONTYPE )
+    {
+      size += asx3d3_poly_size(ctx, (RTPOLY*)subgeom, 0, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTTINTYPE )
+    {
+      size += asx3d3_tin_size(ctx, (RTTIN*)subgeom, 0, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTPOLYHEDRALSURFACETYPE )
+    {
+      size += asx3d3_psurface_size(ctx, (RTPSURFACE*)subgeom, 0, precision, opts, defid);
+    }
+    else if ( rtgeom_is_collection(ctx, subgeom) )
+    {
+      size += asx3d3_multi_size(ctx, (RTCOLLECTION*)subgeom, 0, precision, opts, defid);
+    }
+    else
+      rterror(ctx, "asx3d3_collection_size: unknown geometry type");
+  }
+
+  return size;
 }
 
 static size_t
 asx3d3_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char *output, int precision, int opts, const char *defid)
 {
-	char *ptr;
-	int i;
-	RTGEOM *subgeom;
+  char *ptr;
+  int i;
+  RTGEOM *subgeom;
 
-	ptr = output;
+  ptr = output;
 
-	/* Open outmost tag */
-	/** @TODO: decide if we need outtermost tags, this one was just a copy from gml so is wrong **/
+  /* Open outmost tag */
+  /** @TODO: decide if we need outtermost tags, this one was just a copy from gml so is wrong **/
 #ifdef PGIS_X3D_OUTERMOST_TAGS
-	if ( srs )
-	{
-		ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
-	}
-	else
-	{
-		ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
-	}
+  if ( srs )
+  {
+    ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
+  }
+  else
+  {
+    ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
+  }
 #endif
 
-	for (i=0; i<col->ngeoms; i++)
-	{
-		subgeom = col->geoms[i];
-		ptr += sprintf(ptr, "<Shape%s>", defid);
-		if ( subgeom->type == RTPOINTTYPE )
-		{
-			ptr += asx3d3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTLINETYPE )
-		{
-			ptr += asx3d3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, defid);
-		}
-		else if ( subgeom->type == RTPOLYGONTYPE )
-		{
-			ptr += asx3d3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
-		}
-		else if ( subgeom->type == RTTINTYPE )
-		{
-			ptr += asx3d3_tin_buf(ctx, (RTTIN*)subgeom, srs, ptr, precision, opts,  defid);
-			
-		}
-		else if ( subgeom->type == RTPOLYHEDRALSURFACETYPE )
-		{
-			ptr += asx3d3_psurface_buf(ctx, (RTPSURFACE*)subgeom, srs, ptr, precision, opts,  defid);
-			
-		}
-		else if ( rtgeom_is_collection(ctx, subgeom) )
-		{
-			if ( subgeom->type == RTCOLLECTIONTYPE )
-				ptr += asx3d3_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
-			else
-				ptr += asx3d3_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
-		}
-		else
-			rterror(ctx, "asx3d3_collection_buf: unknown geometry type");
-
-		ptr += printf(ptr, "</Shape>");
-	}
-
-	/* Close outmost tag */
+  for (i=0; i<col->ngeoms; i++)
+  {
+    subgeom = col->geoms[i];
+    ptr += sprintf(ptr, "<Shape%s>", defid);
+    if ( subgeom->type == RTPOINTTYPE )
+    {
+      ptr += asx3d3_point_buf(ctx, (RTPOINT*)subgeom, 0, ptr, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTLINETYPE )
+    {
+      ptr += asx3d3_line_buf(ctx, (RTLINE*)subgeom, 0, ptr, precision, opts, defid);
+    }
+    else if ( subgeom->type == RTPOLYGONTYPE )
+    {
+      ptr += asx3d3_poly_buf(ctx, (RTPOLY*)subgeom, 0, ptr, precision, opts, 0, defid);
+    }
+    else if ( subgeom->type == RTTINTYPE )
+    {
+      ptr += asx3d3_tin_buf(ctx, (RTTIN*)subgeom, srs, ptr, precision, opts,  defid);
+
+    }
+    else if ( subgeom->type == RTPOLYHEDRALSURFACETYPE )
+    {
+      ptr += asx3d3_psurface_buf(ctx, (RTPSURFACE*)subgeom, srs, ptr, precision, opts,  defid);
+
+    }
+    else if ( rtgeom_is_collection(ctx, subgeom) )
+    {
+      if ( subgeom->type == RTCOLLECTIONTYPE )
+        ptr += asx3d3_collection_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
+      else
+        ptr += asx3d3_multi_buf(ctx, (RTCOLLECTION*)subgeom, 0, ptr, precision, opts, defid);
+    }
+    else
+      rterror(ctx, "asx3d3_collection_buf: unknown geometry type");
+
+    ptr += printf(ptr, "</Shape>");
+  }
+
+  /* Close outmost tag */
 #ifdef PGIS_X3D_OUTERMOST_TAGS
-	ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
+  ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
 #endif
 
-	return (ptr-output);
+  return (ptr-output);
 }
 
 /*
@@ -816,13 +816,13 @@ asx3d3_collection_buf(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, char
 static char *
 asx3d3_collection(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int precision, int opts, const char *defid)
 {
-	char *x3d;
-	size_t size;
+  char *x3d;
+  size_t size;
 
-	size = asx3d3_collection_size(ctx, col, srs, precision, opts, defid);
-	x3d = rtalloc(ctx, size);
-	asx3d3_collection_buf(ctx, col, srs, x3d, precision, opts, defid);
-	return x3d;
+  size = asx3d3_collection_size(ctx, col, srs, precision, opts, defid);
+  x3d = rtalloc(ctx, size);
+  asx3d3_collection_buf(ctx, col, srs, x3d, precision, opts, defid);
+  return x3d;
 }
 
 
@@ -831,86 +831,86 @@ asx3d3_collection(const RTCTX *ctx, const RTCOLLECTION *col, char *srs, int prec
 static size_t
 pointArray_toX3D3(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precision, int opts, int is_closed)
 {
-	int i;
-	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-
-	ptr = output;
-
-	if ( ! RTFLAGS_GET_Z(pa->flags) )
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			/** Only output the point if it is not the last point of a closed object or it is a non-closed type **/
-			if ( !is_closed || i < (pa->npoints - 1) )
-			{
-				RTPOINT2D pt;
-				rt_getPoint2d_p(ctx, pa, i, &pt);
-
-				if (fabs(pt.x) < OUT_MAX_DOUBLE)
-					sprintf(x, "%.*f", precision, pt.x);
-				else
-					sprintf(x, "%g", pt.x);
-				trim_trailing_zeros(ctx, x);
-
-				if (fabs(pt.y) < OUT_MAX_DOUBLE)
-					sprintf(y, "%.*f", precision, pt.y);
-				else
-					sprintf(y, "%g", pt.y);
-				trim_trailing_zeros(ctx, y);
-
-				if ( i )
-					ptr += sprintf(ptr, " ");
-					
-				if ( ( opts & RT_X3D_FLIP_XY) )
-					ptr += sprintf(ptr, "%s %s", y, x);
-				else
-					ptr += sprintf(ptr, "%s %s", x, y);
-			}
-		}
-	}
-	else
-	{
-		for (i=0; i<pa->npoints; i++)
-		{
-			/** Only output the point if it is not the last point of a closed object or it is a non-closed type **/
-			if ( !is_closed || i < (pa->npoints - 1) )
-			{
-				RTPOINT4D pt;
-				rt_getPoint4d_p(ctx, pa, i, &pt);
-
-				if (fabs(pt.x) < OUT_MAX_DOUBLE)
-					sprintf(x, "%.*f", precision, pt.x);
-				else
-					sprintf(x, "%g", pt.x);
-				trim_trailing_zeros(ctx, x);
-
-				if (fabs(pt.y) < OUT_MAX_DOUBLE)
-					sprintf(y, "%.*f", precision, pt.y);
-				else
-					sprintf(y, "%g", pt.y);
-				trim_trailing_zeros(ctx, y);
-
-				if (fabs(pt.z) < OUT_MAX_DOUBLE)
-					sprintf(z, "%.*f", precision, pt.z);
-				else
-					sprintf(z, "%g", pt.z);
-				trim_trailing_zeros(ctx, z);
-
-				if ( i )
-					ptr += sprintf(ptr, " ");
-
-				if ( ( opts & RT_X3D_FLIP_XY) )
-					ptr += sprintf(ptr, "%s %s %s", y, x, z);
-				else
-					ptr += sprintf(ptr, "%s %s %s", x, y, z);
-			}
-		}
-	}
-
-	return ptr-output;
+  int i;
+  char *ptr;
+  char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+  char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+
+  ptr = output;
+
+  if ( ! RTFLAGS_GET_Z(pa->flags) )
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      /** Only output the point if it is not the last point of a closed object or it is a non-closed type **/
+      if ( !is_closed || i < (pa->npoints - 1) )
+      {
+        RTPOINT2D pt;
+        rt_getPoint2d_p(ctx, pa, i, &pt);
+
+        if (fabs(pt.x) < OUT_MAX_DOUBLE)
+          sprintf(x, "%.*f", precision, pt.x);
+        else
+          sprintf(x, "%g", pt.x);
+        trim_trailing_zeros(ctx, x);
+
+        if (fabs(pt.y) < OUT_MAX_DOUBLE)
+          sprintf(y, "%.*f", precision, pt.y);
+        else
+          sprintf(y, "%g", pt.y);
+        trim_trailing_zeros(ctx, y);
+
+        if ( i )
+          ptr += sprintf(ptr, " ");
+
+        if ( ( opts & RT_X3D_FLIP_XY) )
+          ptr += sprintf(ptr, "%s %s", y, x);
+        else
+          ptr += sprintf(ptr, "%s %s", x, y);
+      }
+    }
+  }
+  else
+  {
+    for (i=0; i<pa->npoints; i++)
+    {
+      /** Only output the point if it is not the last point of a closed object or it is a non-closed type **/
+      if ( !is_closed || i < (pa->npoints - 1) )
+      {
+        RTPOINT4D pt;
+        rt_getPoint4d_p(ctx, pa, i, &pt);
+
+        if (fabs(pt.x) < OUT_MAX_DOUBLE)
+          sprintf(x, "%.*f", precision, pt.x);
+        else
+          sprintf(x, "%g", pt.x);
+        trim_trailing_zeros(ctx, x);
+
+        if (fabs(pt.y) < OUT_MAX_DOUBLE)
+          sprintf(y, "%.*f", precision, pt.y);
+        else
+          sprintf(y, "%g", pt.y);
+        trim_trailing_zeros(ctx, y);
+
+        if (fabs(pt.z) < OUT_MAX_DOUBLE)
+          sprintf(z, "%.*f", precision, pt.z);
+        else
+          sprintf(z, "%g", pt.z);
+        trim_trailing_zeros(ctx, z);
+
+        if ( i )
+          ptr += sprintf(ptr, " ");
+
+        if ( ( opts & RT_X3D_FLIP_XY) )
+          ptr += sprintf(ptr, "%s %s %s", y, x, z);
+        else
+          ptr += sprintf(ptr, "%s %s %s", x, y, z);
+      }
+    }
+  }
+
+  return ptr-output;
 }
 
 
@@ -921,9 +921,9 @@ pointArray_toX3D3(const RTCTX *ctx, RTPOINTARRAY *pa, char *output, int precisio
 static size_t
 pointArray_X3Dsize(const RTCTX *ctx, RTPOINTARRAY *pa, int precision)
 {
-	if (RTFLAGS_NDIMS(pa->flags) == 2)
-		return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" "))
-		       * 2 * pa->npoints;
+  if (RTFLAGS_NDIMS(pa->flags) == 2)
+    return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" "))
+           * 2 * pa->npoints;
 
-	return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" ")) * 3 * pa->npoints;
+  return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" ")) * 3 * pa->npoints;
 }
diff --git a/src/rtpoint.c b/src/rtpoint.c
index 3e8225f..06e9ff1 100644
--- a/src/rtpoint.c
+++ b/src/rtpoint.c
@@ -40,68 +40,68 @@
 int
 rtpoint_getPoint2d_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT2D *out)
 {
-	return rt_getPoint2d_p(ctx, point->point, 0, out);
+  return rt_getPoint2d_p(ctx, point->point, 0, out);
 }
 
 /* convenience functions to hide the RTPOINTARRAY */
 int
 rtpoint_getPoint3dz_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT3DZ *out)
 {
-	return rt_getPoint3dz_p(ctx, point->point,0,out);
+  return rt_getPoint3dz_p(ctx, point->point,0,out);
 }
 int
 rtpoint_getPoint3dm_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT3DM *out)
 {
-	return rt_getPoint3dm_p(ctx, point->point,0,out);
+  return rt_getPoint3dm_p(ctx, point->point,0,out);
 }
 int
 rtpoint_getPoint4d_p(const RTCTX *ctx, const RTPOINT *point, RTPOINT4D *out)
 {
-	return rt_getPoint4d_p(ctx, point->point,0,out);
+  return rt_getPoint4d_p(ctx, point->point,0,out);
 }
 
 double
 rtpoint_get_x(const RTCTX *ctx, const RTPOINT *point)
 {
-	RTPOINT4D pt;
-	if ( rtpoint_is_empty(ctx, point) )
-		rterror(ctx, "rtpoint_get_x called with empty geometry");
-	rt_getPoint4d_p(ctx, point->point, 0, &pt);
-	return pt.x;
+  RTPOINT4D pt;
+  if ( rtpoint_is_empty(ctx, point) )
+    rterror(ctx, "rtpoint_get_x called with empty geometry");
+  rt_getPoint4d_p(ctx, point->point, 0, &pt);
+  return pt.x;
 }
 
 double
 rtpoint_get_y(const RTCTX *ctx, const RTPOINT *point)
 {
-	RTPOINT4D pt;
-	if ( rtpoint_is_empty(ctx, point) )
-		rterror(ctx, "rtpoint_get_y called with empty geometry");
-	rt_getPoint4d_p(ctx, point->point, 0, &pt);
-	return pt.y;
+  RTPOINT4D pt;
+  if ( rtpoint_is_empty(ctx, point) )
+    rterror(ctx, "rtpoint_get_y called with empty geometry");
+  rt_getPoint4d_p(ctx, point->point, 0, &pt);
+  return pt.y;
 }
 
 double
 rtpoint_get_z(const RTCTX *ctx, const RTPOINT *point)
 {
-	RTPOINT4D pt;
-	if ( rtpoint_is_empty(ctx, point) )
-		rterror(ctx, "rtpoint_get_z called with empty geometry");
-	if ( ! RTFLAGS_GET_Z(point->flags) )
-		rterror(ctx, "rtpoint_get_z called without z dimension");
-	rt_getPoint4d_p(ctx, point->point, 0, &pt);
-	return pt.z;
+  RTPOINT4D pt;
+  if ( rtpoint_is_empty(ctx, point) )
+    rterror(ctx, "rtpoint_get_z called with empty geometry");
+  if ( ! RTFLAGS_GET_Z(point->flags) )
+    rterror(ctx, "rtpoint_get_z called without z dimension");
+  rt_getPoint4d_p(ctx, point->point, 0, &pt);
+  return pt.z;
 }
 
 double
 rtpoint_get_m(const RTCTX *ctx, const RTPOINT *point)
 {
-	RTPOINT4D pt;
-	if ( rtpoint_is_empty(ctx, point) )
-		rterror(ctx, "rtpoint_get_m called with empty geometry");
-	if ( ! RTFLAGS_GET_M(point->flags) )
-		rterror(ctx, "rtpoint_get_m called without m dimension");
-	rt_getPoint4d_p(ctx, point->point, 0, &pt);
-	return pt.m;
+  RTPOINT4D pt;
+  if ( rtpoint_is_empty(ctx, point) )
+    rterror(ctx, "rtpoint_get_m called with empty geometry");
+  if ( ! RTFLAGS_GET_M(point->flags) )
+    rterror(ctx, "rtpoint_get_m called without m dimension");
+  rt_getPoint4d_p(ctx, point->point, 0, &pt);
+  return pt.m;
 }
 
 /*
@@ -111,126 +111,126 @@ rtpoint_get_m(const RTCTX *ctx, const RTPOINT *point)
 RTPOINT *
 rtpoint_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *point)
 {
-	RTPOINT *result;
-	uint8_t flags = 0;
-
-	if (point == NULL)
-		return NULL; /* error */
-
-	result = rtalloc(ctx, sizeof(RTPOINT));
-	result->type = RTPOINTTYPE;
-	RTFLAGS_SET_Z(flags, RTFLAGS_GET_Z(point->flags));
-	RTFLAGS_SET_M(flags, RTFLAGS_GET_M(point->flags));
-	RTFLAGS_SET_BBOX(flags, bbox?1:0);
-	result->flags = flags;
-	result->srid = srid;
-	result->point = point;
-	result->bbox = bbox;
-
-	return result;
+  RTPOINT *result;
+  uint8_t flags = 0;
+
+  if (point == NULL)
+    return NULL; /* error */
+
+  result = rtalloc(ctx, sizeof(RTPOINT));
+  result->type = RTPOINTTYPE;
+  RTFLAGS_SET_Z(flags, RTFLAGS_GET_Z(point->flags));
+  RTFLAGS_SET_M(flags, RTFLAGS_GET_M(point->flags));
+  RTFLAGS_SET_BBOX(flags, bbox?1:0);
+  result->flags = flags;
+  result->srid = srid;
+  result->point = point;
+  result->bbox = bbox;
+
+  return result;
 }
 
 RTPOINT *
 rtpoint_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTPOINT *result = rtalloc(ctx, sizeof(RTPOINT));
-	result->type = RTPOINTTYPE;
-	result->flags = gflags(ctx, hasz, hasm, 0);
-	result->srid = srid;
-	result->point = ptarray_construct(ctx, hasz, hasm, 0);
-	result->bbox = NULL;
-	return result;
+  RTPOINT *result = rtalloc(ctx, sizeof(RTPOINT));
+  result->type = RTPOINTTYPE;
+  result->flags = gflags(ctx, hasz, hasm, 0);
+  result->srid = srid;
+  result->point = ptarray_construct(ctx, hasz, hasm, 0);
+  result->bbox = NULL;
+  return result;
 }
 
 RTPOINT *
 rtpoint_make2d(const RTCTX *ctx, int srid, double x, double y)
 {
-	RTPOINT4D p = {x, y, 0.0, 0.0};
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 0, 0, 1);
+  RTPOINT4D p = {x, y, 0.0, 0.0};
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 0, 0, 1);
 
-	ptarray_append_point(ctx, pa, &p, RT_TRUE);
-	return rtpoint_construct(ctx, srid, NULL, pa);
+  ptarray_append_point(ctx, pa, &p, RT_TRUE);
+  return rtpoint_construct(ctx, srid, NULL, pa);
 }
 
 RTPOINT *
 rtpoint_make3dz(const RTCTX *ctx, int srid, double x, double y, double z)
 {
-	RTPOINT4D p = {x, y, z, 0.0};
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 0, 1);
+  RTPOINT4D p = {x, y, z, 0.0};
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 0, 1);
 
-	ptarray_append_point(ctx, pa, &p, RT_TRUE);
+  ptarray_append_point(ctx, pa, &p, RT_TRUE);
 
-	return rtpoint_construct(ctx, srid, NULL, pa);
+  return rtpoint_construct(ctx, srid, NULL, pa);
 }
 
 RTPOINT *
 rtpoint_make3dm(const RTCTX *ctx, int srid, double x, double y, double m)
 {
-	RTPOINT4D p = {x, y, 0.0, m};
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 0, 1, 1);
+  RTPOINT4D p = {x, y, 0.0, m};
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 0, 1, 1);
 
-	ptarray_append_point(ctx, pa, &p, RT_TRUE);
+  ptarray_append_point(ctx, pa, &p, RT_TRUE);
 
-	return rtpoint_construct(ctx, srid, NULL, pa);
+  return rtpoint_construct(ctx, srid, NULL, pa);
 }
 
 RTPOINT *
 rtpoint_make4d(const RTCTX *ctx, int srid, double x, double y, double z, double m)
 {
-	RTPOINT4D p = {x, y, z, m};
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 1, 1);
+  RTPOINT4D p = {x, y, z, m};
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, 1, 1, 1);
 
-	ptarray_append_point(ctx, pa, &p, RT_TRUE);
+  ptarray_append_point(ctx, pa, &p, RT_TRUE);
 
-	return rtpoint_construct(ctx, srid, NULL, pa);
+  return rtpoint_construct(ctx, srid, NULL, pa);
 }
 
 RTPOINT *
 rtpoint_make(const RTCTX *ctx, int srid, int hasz, int hasm, const RTPOINT4D *p)
 {
-	RTPOINTARRAY *pa = ptarray_construct_empty(ctx, hasz, hasm, 1);
-	ptarray_append_point(ctx, pa, p, RT_TRUE);
-	return rtpoint_construct(ctx, srid, NULL, pa);
+  RTPOINTARRAY *pa = ptarray_construct_empty(ctx, hasz, hasm, 1);
+  ptarray_append_point(ctx, pa, p, RT_TRUE);
+  return rtpoint_construct(ctx, srid, NULL, pa);
 }
 
 void rtpoint_free(const RTCTX *ctx, RTPOINT *pt)
 {
-	if ( ! pt ) return;
-	
-	if ( pt->bbox )
-		rtfree(ctx, pt->bbox);
-	if ( pt->point )
-		ptarray_free(ctx, pt->point);
-	rtfree(ctx, pt);
+  if ( ! pt ) return;
+
+  if ( pt->bbox )
+    rtfree(ctx, pt->bbox);
+  if ( pt->point )
+    ptarray_free(ctx, pt->point);
+  rtfree(ctx, pt);
 }
 
 void printRTPOINT(const RTCTX *ctx, RTPOINT *point)
 {
-	rtnotice(ctx, "RTPOINT {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(point->flags));
-	rtnotice(ctx, "    BBOX = %i", RTFLAGS_GET_BBOX(point->flags) ? 1 : 0 );
-	rtnotice(ctx, "    SRID = %i", (int)point->srid);
-	printPA(ctx, point->point);
-	rtnotice(ctx, "}");
+  rtnotice(ctx, "RTPOINT {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(point->flags));
+  rtnotice(ctx, "    BBOX = %i", RTFLAGS_GET_BBOX(point->flags) ? 1 : 0 );
+  rtnotice(ctx, "    SRID = %i", (int)point->srid);
+  printPA(ctx, point->point);
+  rtnotice(ctx, "}");
 }
 
 /* @brief Clone RTPOINT object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTPOINT *
 rtpoint_clone(const RTCTX *ctx, const RTPOINT *g)
 {
-	RTPOINT *ret = rtalloc(ctx, sizeof(RTPOINT));
+  RTPOINT *ret = rtalloc(ctx, sizeof(RTPOINT));
 
-	RTDEBUG(2, "rtpoint_clone called");
+  RTDEBUG(2, "rtpoint_clone called");
 
-	memcpy(ret, g, sizeof(RTPOINT));
+  memcpy(ret, g, sizeof(RTPOINT));
 
-	ret->point = ptarray_clone(ctx, g->point);
+  ret->point = ptarray_clone(ctx, g->point);
 
-	if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	return ret;
+  if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  return ret;
 }
 
 
@@ -238,7 +238,7 @@ rtpoint_clone(const RTCTX *ctx, const RTPOINT *g)
 void
 rtpoint_release(const RTCTX *ctx, RTPOINT *rtpoint)
 {
-	rtgeom_release(ctx, rtpoint_as_rtgeom(ctx, rtpoint));
+  rtgeom_release(ctx, rtpoint_as_rtgeom(ctx, rtpoint));
 }
 
 
@@ -246,43 +246,43 @@ rtpoint_release(const RTCTX *ctx, RTPOINT *rtpoint)
 char
 rtpoint_same(const RTCTX *ctx, const RTPOINT *p1, const RTPOINT *p2)
 {
-	return ptarray_same(ctx, p1->point, p2->point);
+  return ptarray_same(ctx, p1->point, p2->point);
 }
 
 
 RTPOINT*
 rtpoint_force_dims(const RTCTX *ctx, const RTPOINT *point, int hasz, int hasm)
 {
-	RTPOINTARRAY *pdims = NULL;
-	RTPOINT *pointout;
-	
-	/* Return 2D empty */
-	if( rtpoint_is_empty(ctx, point) )
-	{
-		pointout = rtpoint_construct_empty(ctx, point->srid, hasz, hasm);
-	}
-	else
-	{
-		/* Artays we duplicate the ptarray and return */
-		pdims = ptarray_force_dims(ctx, point->point, hasz, hasm);
-		pointout = rtpoint_construct(ctx, point->srid, NULL, pdims);
-	}
-	pointout->type = point->type;
-	return pointout;
+  RTPOINTARRAY *pdims = NULL;
+  RTPOINT *pointout;
+
+  /* Return 2D empty */
+  if( rtpoint_is_empty(ctx, point) )
+  {
+    pointout = rtpoint_construct_empty(ctx, point->srid, hasz, hasm);
+  }
+  else
+  {
+    /* Artays we duplicate the ptarray and return */
+    pdims = ptarray_force_dims(ctx, point->point, hasz, hasm);
+    pointout = rtpoint_construct(ctx, point->srid, NULL, pdims);
+  }
+  pointout->type = point->type;
+  return pointout;
 }
 
 int rtpoint_is_empty(const RTCTX *ctx, const RTPOINT *point)
 {
-	if ( ! point->point || point->point->npoints < 1 )
-		return RT_TRUE;
-	return RT_FALSE;
+  if ( ! point->point || point->point->npoints < 1 )
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 
 RTPOINT *
 rtpoint_grid(const RTCTX *ctx, const RTPOINT *point, const gridspec *grid)
 {
-	RTPOINTARRAY *opa = ptarray_grid(ctx, point->point, grid);
-	return rtpoint_construct(ctx, point->srid, NULL, opa);
+  RTPOINTARRAY *opa = ptarray_grid(ctx, point->point, grid);
+  return rtpoint_construct(ctx, point->srid, NULL, opa);
 }
 
diff --git a/src/rtpoly.c b/src/rtpoly.c
index 5f038ed..643113f 100644
--- a/src/rtpoly.c
+++ b/src/rtpoly.c
@@ -42,202 +42,202 @@
 RTPOLY*
 rtpoly_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, uint32_t nrings, RTPOINTARRAY **points)
 {
-	RTPOLY *result;
-	int hasz, hasm;
+  RTPOLY *result;
+  int hasz, hasm;
 #ifdef CHECK_POLY_RINGS_ZM
-	char zm;
-	uint32_t i;
+  char zm;
+  uint32_t i;
 #endif
 
-	if ( nrings < 1 ) rterror(ctx, "rtpoly_construct: need at least 1 ring");
+  if ( nrings < 1 ) rterror(ctx, "rtpoly_construct: need at least 1 ring");
 
-	hasz = RTFLAGS_GET_Z(points[0]->flags);
-	hasm = RTFLAGS_GET_M(points[0]->flags);
+  hasz = RTFLAGS_GET_Z(points[0]->flags);
+  hasm = RTFLAGS_GET_M(points[0]->flags);
 
 #ifdef CHECK_POLY_RINGS_ZM
-	zm = RTFLAGS_GET_ZM(points[0]->flags);
-	for (i=1; i<nrings; i++)
-	{
-		if ( zm != RTFLAGS_GET_ZM(points[i]->flags) )
-			rterror(ctx, "rtpoly_construct: mixed dimensioned rings");
-	}
+  zm = RTFLAGS_GET_ZM(points[0]->flags);
+  for (i=1; i<nrings; i++)
+  {
+    if ( zm != RTFLAGS_GET_ZM(points[i]->flags) )
+      rterror(ctx, "rtpoly_construct: mixed dimensioned rings");
+  }
 #endif
 
-	result = (RTPOLY*) rtalloc(ctx, sizeof(RTPOLY));
-	result->type = RTPOLYGONTYPE;
-	result->flags = gflags(ctx, hasz, hasm, 0);
-	RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
-	result->srid = srid;
-	result->nrings = nrings;
-	result->maxrings = nrings;
-	result->rings = points;
-	result->bbox = bbox;
-
-	return result;
+  result = (RTPOLY*) rtalloc(ctx, sizeof(RTPOLY));
+  result->type = RTPOLYGONTYPE;
+  result->flags = gflags(ctx, hasz, hasm, 0);
+  RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
+  result->srid = srid;
+  result->nrings = nrings;
+  result->maxrings = nrings;
+  result->rings = points;
+  result->bbox = bbox;
+
+  return result;
 }
 
 RTPOLY*
 rtpoly_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTPOLY *result = rtalloc(ctx, sizeof(RTPOLY));
-	result->type = RTPOLYGONTYPE;
-	result->flags = gflags(ctx, hasz,hasm,0);
-	result->srid = srid;
-	result->nrings = 0;
-	result->maxrings = 1; /* Allocate room for ring, just in case. */
-	result->rings = rtalloc(ctx, result->maxrings * sizeof(RTPOINTARRAY*));
-	result->bbox = NULL;
-	return result;
+  RTPOLY *result = rtalloc(ctx, sizeof(RTPOLY));
+  result->type = RTPOLYGONTYPE;
+  result->flags = gflags(ctx, hasz,hasm,0);
+  result->srid = srid;
+  result->nrings = 0;
+  result->maxrings = 1; /* Allocate room for ring, just in case. */
+  result->rings = rtalloc(ctx, result->maxrings * sizeof(RTPOINTARRAY*));
+  result->bbox = NULL;
+  return result;
 }
 
 void rtpoly_free(const RTCTX *ctx, RTPOLY  *poly)
 {
-	int t;
+  int t;
 
-	if( ! poly ) return;
+  if( ! poly ) return;
 
-	if ( poly->bbox )
-		rtfree(ctx, poly->bbox);
+  if ( poly->bbox )
+    rtfree(ctx, poly->bbox);
 
-	for (t=0; t<poly->nrings; t++)
-	{
-		if ( poly->rings[t] )
-			ptarray_free(ctx, poly->rings[t]);
-	}
+  for (t=0; t<poly->nrings; t++)
+  {
+    if ( poly->rings[t] )
+      ptarray_free(ctx, poly->rings[t]);
+  }
 
-	if ( poly->rings )
-		rtfree(ctx, poly->rings);
+  if ( poly->rings )
+    rtfree(ctx, poly->rings);
 
-	rtfree(ctx, poly);
+  rtfree(ctx, poly);
 }
 
 void printRTPOLY(const RTCTX *ctx, RTPOLY *poly)
 {
-	int t;
-	rtnotice(ctx, "RTPOLY {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(poly->flags));
-	rtnotice(ctx, "    SRID = %i", (int)poly->srid);
-	rtnotice(ctx, "    nrings = %i", (int)poly->nrings);
-	for (t=0; t<poly->nrings; t++)
-	{
-		rtnotice(ctx, "    RING # %i :",t);
-		printPA(ctx, poly->rings[t]);
-	}
-	rtnotice(ctx, "}");
+  int t;
+  rtnotice(ctx, "RTPOLY {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(poly->flags));
+  rtnotice(ctx, "    SRID = %i", (int)poly->srid);
+  rtnotice(ctx, "    nrings = %i", (int)poly->nrings);
+  for (t=0; t<poly->nrings; t++)
+  {
+    rtnotice(ctx, "    RING # %i :",t);
+    printPA(ctx, poly->rings[t]);
+  }
+  rtnotice(ctx, "}");
 }
 
 /* @brief Clone RTLINE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTPOLY *
 rtpoly_clone(const RTCTX *ctx, const RTPOLY *g)
 {
-	int i;
-	RTPOLY *ret = rtalloc(ctx, sizeof(RTPOLY));
-	memcpy(ret, g, sizeof(RTPOLY));
-	ret->rings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*g->nrings);
-	for ( i = 0; i < g->nrings; i++ ) {
-		ret->rings[i] = ptarray_clone(ctx, g->rings[i]);
-	}
-	if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	return ret;
+  int i;
+  RTPOLY *ret = rtalloc(ctx, sizeof(RTPOLY));
+  memcpy(ret, g, sizeof(RTPOLY));
+  ret->rings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*g->nrings);
+  for ( i = 0; i < g->nrings; i++ ) {
+    ret->rings[i] = ptarray_clone(ctx, g->rings[i]);
+  }
+  if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  return ret;
 }
 
 /* Deep clone RTPOLY object. RTPOINTARRAY are copied, as is ring array */
 RTPOLY *
 rtpoly_clone_deep(const RTCTX *ctx, const RTPOLY *g)
 {
-	int i;
-	RTPOLY *ret = rtalloc(ctx, sizeof(RTPOLY));
-	memcpy(ret, g, sizeof(RTPOLY));
-	if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
-	ret->rings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*g->nrings);
-	for ( i = 0; i < ret->nrings; i++ )
-	{
-		ret->rings[i] = ptarray_clone_deep(ctx, g->rings[i]);
-	}
-	RTFLAGS_SET_READONLY(ret->flags,0);
-	return ret;
+  int i;
+  RTPOLY *ret = rtalloc(ctx, sizeof(RTPOLY));
+  memcpy(ret, g, sizeof(RTPOLY));
+  if ( g->bbox ) ret->bbox = gbox_copy(ctx, g->bbox);
+  ret->rings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*g->nrings);
+  for ( i = 0; i < ret->nrings; i++ )
+  {
+    ret->rings[i] = ptarray_clone_deep(ctx, g->rings[i]);
+  }
+  RTFLAGS_SET_READONLY(ret->flags,0);
+  return ret;
 }
 
 /**
 * Add a ring to a polygon. Point array will be referenced, not copied.
 */
 int
-rtpoly_add_ring(const RTCTX *ctx, RTPOLY *poly, RTPOINTARRAY *pa) 
+rtpoly_add_ring(const RTCTX *ctx, RTPOLY *poly, RTPOINTARRAY *pa)
 {
-	if( ! poly || ! pa ) 
-		return RT_FAILURE;
-		
-	/* We have used up our storage, add some more. */
-	if( poly->nrings >= poly->maxrings ) 
-	{
-		int new_maxrings = 2 * (poly->nrings + 1);
-		poly->rings = rtrealloc(ctx, poly->rings, new_maxrings * sizeof(RTPOINTARRAY*));
-		poly->maxrings = new_maxrings;
-	}
-	
-	/* Add the new ring entry. */
-	poly->rings[poly->nrings] = pa;
-	poly->nrings++;
-	
-	return RT_SUCCESS;
+  if( ! poly || ! pa )
+    return RT_FAILURE;
+
+  /* We have used up our storage, add some more. */
+  if( poly->nrings >= poly->maxrings )
+  {
+    int new_maxrings = 2 * (poly->nrings + 1);
+    poly->rings = rtrealloc(ctx, poly->rings, new_maxrings * sizeof(RTPOINTARRAY*));
+    poly->maxrings = new_maxrings;
+  }
+
+  /* Add the new ring entry. */
+  poly->rings[poly->nrings] = pa;
+  poly->nrings++;
+
+  return RT_SUCCESS;
 }
 
 void
 rtpoly_force_clockwise(const RTCTX *ctx, RTPOLY *poly)
 {
-	int i;
+  int i;
 
-	/* No-op empties */
-	if ( rtpoly_is_empty(ctx, poly) )
-		return;
+  /* No-op empties */
+  if ( rtpoly_is_empty(ctx, poly) )
+    return;
 
-	/* External ring */
-	if ( ptarray_isccw(ctx, poly->rings[0]) )
-		ptarray_reverse(ctx, poly->rings[0]);
+  /* External ring */
+  if ( ptarray_isccw(ctx, poly->rings[0]) )
+    ptarray_reverse(ctx, poly->rings[0]);
 
-	/* Internal rings */
-	for (i=1; i<poly->nrings; i++)
-		if ( ! ptarray_isccw(ctx, poly->rings[i]) )
-			ptarray_reverse(ctx, poly->rings[i]);
+  /* Internal rings */
+  for (i=1; i<poly->nrings; i++)
+    if ( ! ptarray_isccw(ctx, poly->rings[i]) )
+      ptarray_reverse(ctx, poly->rings[i]);
 
 }
 
 void
 rtpoly_release(const RTCTX *ctx, RTPOLY *rtpoly)
 {
-	rtgeom_release(ctx, rtpoly_as_rtgeom(ctx, rtpoly));
+  rtgeom_release(ctx, rtpoly_as_rtgeom(ctx, rtpoly));
 }
 
 void
 rtpoly_reverse(const RTCTX *ctx, RTPOLY *poly)
 {
-	int i;
-	if ( rtpoly_is_empty(ctx, poly) ) return;
-	for (i=0; i<poly->nrings; i++)
-		ptarray_reverse(ctx, poly->rings[i]);
+  int i;
+  if ( rtpoly_is_empty(ctx, poly) ) return;
+  for (i=0; i<poly->nrings; i++)
+    ptarray_reverse(ctx, poly->rings[i]);
 }
 
 RTPOLY *
 rtpoly_segmentize2d(const RTCTX *ctx, RTPOLY *poly, double dist)
 {
-	RTPOINTARRAY **newrings;
-	uint32_t i;
-
-	newrings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
-	for (i=0; i<poly->nrings; i++)
-	{
-		newrings[i] = ptarray_segmentize2d(ctx, poly->rings[i], dist);
-		if ( ! newrings[i] ) {
-			while (i--) ptarray_free(ctx, newrings[i]);
-			rtfree(ctx, newrings);
-			return NULL;
-		}
-	}
-	return rtpoly_construct(ctx, poly->srid, NULL,
-	                        poly->nrings, newrings);
+  RTPOINTARRAY **newrings;
+  uint32_t i;
+
+  newrings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
+  for (i=0; i<poly->nrings; i++)
+  {
+    newrings[i] = ptarray_segmentize2d(ctx, poly->rings[i], dist);
+    if ( ! newrings[i] ) {
+      while (i--) ptarray_free(ctx, newrings[i]);
+      rtfree(ctx, newrings);
+      return NULL;
+    }
+  }
+  return rtpoly_construct(ctx, poly->srid, NULL,
+                          poly->nrings, newrings);
 }
 
 /*
@@ -247,15 +247,15 @@ rtpoly_segmentize2d(const RTCTX *ctx, RTPOLY *poly, double dist)
 char
 rtpoly_same(const RTCTX *ctx, const RTPOLY *p1, const RTPOLY *p2)
 {
-	uint32_t i;
-
-	if ( p1->nrings != p2->nrings ) return 0;
-	for (i=0; i<p1->nrings; i++)
-	{
-		if ( ! ptarray_same(ctx, p1->rings[i], p2->rings[i]) )
-			return 0;
-	}
-	return 1;
+  uint32_t i;
+
+  if ( p1->nrings != p2->nrings ) return 0;
+  for (i=0; i<p1->nrings; i++)
+  {
+    if ( ! ptarray_same(ctx, p1->rings[i], p2->rings[i]) )
+      return 0;
+  }
+  return 1;
 }
 
 /*
@@ -269,51 +269,51 @@ RTPOLY *
 rtpoly_from_rtlines(const RTCTX *ctx, const RTLINE *shell,
                     uint32_t nholes, const RTLINE **holes)
 {
-	uint32_t nrings;
-	RTPOINTARRAY **rings = rtalloc(ctx, (nholes+1)*sizeof(RTPOINTARRAY *));
-	int srid = shell->srid;
-	RTPOLY *ret;
-
-	if ( shell->points->npoints < 4 )
-		rterror(ctx, "rtpoly_from_rtlines: shell must have at least 4 points");
-	if ( ! ptarray_is_closed_2d(ctx, shell->points) )
-		rterror(ctx, "rtpoly_from_rtlines: shell must be closed");
-	rings[0] = ptarray_clone_deep(ctx, shell->points);
-
-	for (nrings=1; nrings<=nholes; nrings++)
-	{
-		const RTLINE *hole = holes[nrings-1];
-
-		if ( hole->srid != srid )
-			rterror(ctx, "rtpoly_from_rtlines: mixed SRIDs in input lines");
-
-		if ( hole->points->npoints < 4 )
-			rterror(ctx, "rtpoly_from_rtlines: holes must have at least 4 points");
-		if ( ! ptarray_is_closed_2d(ctx, hole->points) )
-			rterror(ctx, "rtpoly_from_rtlines: holes must be closed");
-
-		rings[nrings] = ptarray_clone_deep(ctx, hole->points);
-	}
-
-	ret = rtpoly_construct(ctx, srid, NULL, nrings, rings);
-	return ret;
+  uint32_t nrings;
+  RTPOINTARRAY **rings = rtalloc(ctx, (nholes+1)*sizeof(RTPOINTARRAY *));
+  int srid = shell->srid;
+  RTPOLY *ret;
+
+  if ( shell->points->npoints < 4 )
+    rterror(ctx, "rtpoly_from_rtlines: shell must have at least 4 points");
+  if ( ! ptarray_is_closed_2d(ctx, shell->points) )
+    rterror(ctx, "rtpoly_from_rtlines: shell must be closed");
+  rings[0] = ptarray_clone_deep(ctx, shell->points);
+
+  for (nrings=1; nrings<=nholes; nrings++)
+  {
+    const RTLINE *hole = holes[nrings-1];
+
+    if ( hole->srid != srid )
+      rterror(ctx, "rtpoly_from_rtlines: mixed SRIDs in input lines");
+
+    if ( hole->points->npoints < 4 )
+      rterror(ctx, "rtpoly_from_rtlines: holes must have at least 4 points");
+    if ( ! ptarray_is_closed_2d(ctx, hole->points) )
+      rterror(ctx, "rtpoly_from_rtlines: holes must be closed");
+
+    rings[nrings] = ptarray_clone_deep(ctx, hole->points);
+  }
+
+  ret = rtpoly_construct(ctx, srid, NULL, nrings, rings);
+  return ret;
 }
 
 RTGEOM*
 rtpoly_remove_repeated_points(const RTCTX *ctx, const RTPOLY *poly, double tolerance)
 {
-	uint32_t i;
-	RTPOINTARRAY **newrings;
+  uint32_t i;
+  RTPOINTARRAY **newrings;
 
-	newrings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
-	for (i=0; i<poly->nrings; i++)
-	{
-		newrings[i] = ptarray_remove_repeated_points_minpoints(ctx, poly->rings[i], tolerance, 4);
-	}
+  newrings = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
+  for (i=0; i<poly->nrings; i++)
+  {
+    newrings[i] = ptarray_remove_repeated_points_minpoints(ctx, poly->rings[i], tolerance, 4);
+  }
 
-	return (RTGEOM*)rtpoly_construct(ctx, poly->srid,
-	                                 poly->bbox ? gbox_copy(ctx, poly->bbox) : NULL,
-	                                 poly->nrings, newrings);
+  return (RTGEOM*)rtpoly_construct(ctx, poly->srid,
+                                   poly->bbox ? gbox_copy(ctx, poly->bbox) : NULL,
+                                   poly->nrings, newrings);
 
 }
 
@@ -321,101 +321,101 @@ rtpoly_remove_repeated_points(const RTCTX *ctx, const RTPOLY *poly, double toler
 RTPOLY*
 rtpoly_force_dims(const RTCTX *ctx, const RTPOLY *poly, int hasz, int hasm)
 {
-	RTPOLY *polyout;
-	
-	/* Return 2D empty */
-	if( rtpoly_is_empty(ctx, poly) )
-	{
-		polyout = rtpoly_construct_empty(ctx, poly->srid, hasz, hasm);
-	}
-	else
-	{
-		RTPOINTARRAY **rings = NULL;
-		int i;
-		rings = rtalloc(ctx, sizeof(RTPOINTARRAY*) * poly->nrings);
-		for( i = 0; i < poly->nrings; i++ )
-		{
-			rings[i] = ptarray_force_dims(ctx, poly->rings[i], hasz, hasm);
-		}
-		polyout = rtpoly_construct(ctx, poly->srid, NULL, poly->nrings, rings);
-	}
-	polyout->type = poly->type;
-	return polyout;
+  RTPOLY *polyout;
+
+  /* Return 2D empty */
+  if( rtpoly_is_empty(ctx, poly) )
+  {
+    polyout = rtpoly_construct_empty(ctx, poly->srid, hasz, hasm);
+  }
+  else
+  {
+    RTPOINTARRAY **rings = NULL;
+    int i;
+    rings = rtalloc(ctx, sizeof(RTPOINTARRAY*) * poly->nrings);
+    for( i = 0; i < poly->nrings; i++ )
+    {
+      rings[i] = ptarray_force_dims(ctx, poly->rings[i], hasz, hasm);
+    }
+    polyout = rtpoly_construct(ctx, poly->srid, NULL, poly->nrings, rings);
+  }
+  polyout->type = poly->type;
+  return polyout;
 }
 
 int rtpoly_is_empty(const RTCTX *ctx, const RTPOLY *poly)
 {
-	if ( (poly->nrings < 1) || (!poly->rings) || (!poly->rings[0]) || (poly->rings[0]->npoints < 1) )
-		return RT_TRUE;
-	return RT_FALSE;
+  if ( (poly->nrings < 1) || (!poly->rings) || (!poly->rings[0]) || (poly->rings[0]->npoints < 1) )
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 int rtpoly_count_vertices(const RTCTX *ctx, RTPOLY *poly)
 {
-	int i = 0;
-	int v = 0; /* vertices */
-	assert(poly);
-	for ( i = 0; i < poly->nrings; i ++ )
-	{
-		v += poly->rings[i]->npoints;
-	}
-	return v;
+  int i = 0;
+  int v = 0; /* vertices */
+  assert(poly);
+  for ( i = 0; i < poly->nrings; i ++ )
+  {
+    v += poly->rings[i]->npoints;
+  }
+  return v;
 }
 
 RTPOLY* rtpoly_simplify(const RTCTX *ctx, const RTPOLY *ipoly, double dist, int preserve_collapsed)
 {
-	int i;
-	RTPOLY *opoly = rtpoly_construct_empty(ctx, ipoly->srid, RTFLAGS_GET_Z(ipoly->flags), RTFLAGS_GET_M(ipoly->flags));
-
-	RTDEBUGF(2, "%s: simplifying polygon with %d rings", __func__, ipoly->nrings);
-
-	if ( rtpoly_is_empty(ctx, ipoly) )
-	{
-		rtpoly_free(ctx, opoly);
-		return NULL;
-	}
-
-	for ( i = 0; i < ipoly->nrings; i++ )
-	{
-		RTPOINTARRAY *opts;
-		int minvertices = 0;
-
-		/* We'll still let holes collapse, but if we're preserving */
-		/* and this is a shell, we ensure it is kept */
-		if ( preserve_collapsed && i == 0 )
-			minvertices = 4; 
-			
-		opts = ptarray_simplify(ctx, ipoly->rings[i], dist, minvertices);
-
-		RTDEBUGF(3, "ring%d simplified from %d to %d points", i, ipoly->rings[i]->npoints, opts->npoints);
-
-		/* Less points than are needed to form a closed ring, we can't use this */
-		if ( opts->npoints < 4 )
-		{
-			RTDEBUGF(3, "ring%d skipped (% pts)", i, opts->npoints);
-			ptarray_free(ctx, opts);
-			if ( i ) continue;
-			else break; /* Don't scan holes if shell is collapsed */
-		}
-
-		/* Add ring to simplified polygon */
-		if( rtpoly_add_ring(ctx, opoly, opts) == RT_FAILURE )
-		{
-			rtpoly_free(ctx, opoly);
-			return NULL;
-		}
-	}
-
-	RTDEBUGF(3, "simplified polygon with %d rings", ipoly->nrings);
-	opoly->type = ipoly->type;
-
-	if( rtpoly_is_empty(ctx, opoly) )
-	{
-		rtpoly_free(ctx, opoly);
-		return NULL;
-	}
-
-	return opoly;
+  int i;
+  RTPOLY *opoly = rtpoly_construct_empty(ctx, ipoly->srid, RTFLAGS_GET_Z(ipoly->flags), RTFLAGS_GET_M(ipoly->flags));
+
+  RTDEBUGF(2, "%s: simplifying polygon with %d rings", __func__, ipoly->nrings);
+
+  if ( rtpoly_is_empty(ctx, ipoly) )
+  {
+    rtpoly_free(ctx, opoly);
+    return NULL;
+  }
+
+  for ( i = 0; i < ipoly->nrings; i++ )
+  {
+    RTPOINTARRAY *opts;
+    int minvertices = 0;
+
+    /* We'll still let holes collapse, but if we're preserving */
+    /* and this is a shell, we ensure it is kept */
+    if ( preserve_collapsed && i == 0 )
+      minvertices = 4;
+
+    opts = ptarray_simplify(ctx, ipoly->rings[i], dist, minvertices);
+
+    RTDEBUGF(3, "ring%d simplified from %d to %d points", i, ipoly->rings[i]->npoints, opts->npoints);
+
+    /* Less points than are needed to form a closed ring, we can't use this */
+    if ( opts->npoints < 4 )
+    {
+      RTDEBUGF(3, "ring%d skipped (% pts)", i, opts->npoints);
+      ptarray_free(ctx, opts);
+      if ( i ) continue;
+      else break; /* Don't scan holes if shell is collapsed */
+    }
+
+    /* Add ring to simplified polygon */
+    if( rtpoly_add_ring(ctx, opoly, opts) == RT_FAILURE )
+    {
+      rtpoly_free(ctx, opoly);
+      return NULL;
+    }
+  }
+
+  RTDEBUGF(3, "simplified polygon with %d rings", ipoly->nrings);
+  opoly->type = ipoly->type;
+
+  if( rtpoly_is_empty(ctx, opoly) )
+  {
+    rtpoly_free(ctx, opoly);
+    return NULL;
+  }
+
+  return opoly;
 }
 
 /**
@@ -424,29 +424,29 @@ RTPOLY* rtpoly_simplify(const RTCTX *ctx, const RTPOLY *ipoly, double dist, int
 double
 rtpoly_area(const RTCTX *ctx, const RTPOLY *poly)
 {
-	double poly_area = 0.0;
-	int i;
-	
-	if ( ! poly ) 
-		rterror(ctx, "rtpoly_area called with null polygon pointer!");
-
-	for ( i=0; i < poly->nrings; i++ )
-	{
-		RTPOINTARRAY *ring = poly->rings[i];
-		double ringarea = 0.0;
-
-		/* Empty or messed-up ring. */
-		if ( ring->npoints < 3 ) 
-			continue; 
-		
-		ringarea = fabs(ptarray_signed_area(ctx, ring));
-		if ( i == 0 ) /* Outer ring, positive area! */
-			poly_area += ringarea; 
-		else /* Inner ring, negative area! */
-			poly_area -= ringarea; 
-	}
-
-	return poly_area;
+  double poly_area = 0.0;
+  int i;
+
+  if ( ! poly )
+    rterror(ctx, "rtpoly_area called with null polygon pointer!");
+
+  for ( i=0; i < poly->nrings; i++ )
+  {
+    RTPOINTARRAY *ring = poly->rings[i];
+    double ringarea = 0.0;
+
+    /* Empty or messed-up ring. */
+    if ( ring->npoints < 3 )
+      continue;
+
+    ringarea = fabs(ptarray_signed_area(ctx, ring));
+    if ( i == 0 ) /* Outer ring, positive area! */
+      poly_area += ringarea;
+    else /* Inner ring, negative area! */
+      poly_area -= ringarea;
+  }
+
+  return poly_area;
 }
 
 
@@ -457,15 +457,15 @@ rtpoly_area(const RTCTX *ctx, const RTPOLY *poly)
 double
 rtpoly_perimeter(const RTCTX *ctx, const RTPOLY *poly)
 {
-	double result=0.0;
-	int i;
+  double result=0.0;
+  int i;
 
-	RTDEBUGF(2, "in rtgeom_polygon_perimeter (%d rings)", poly->nrings);
+  RTDEBUGF(2, "in rtgeom_polygon_perimeter (%d rings)", poly->nrings);
 
-	for (i=0; i<poly->nrings; i++)
-		result += ptarray_length(ctx, poly->rings[i]);
+  for (i=0; i<poly->nrings; i++)
+    result += ptarray_length(ctx, poly->rings[i]);
 
-	return result;
+  return result;
 }
 
 /**
@@ -475,122 +475,122 @@ rtpoly_perimeter(const RTCTX *ctx, const RTPOLY *poly)
 double
 rtpoly_perimeter_2d(const RTCTX *ctx, const RTPOLY *poly)
 {
-	double result=0.0;
-	int i;
+  double result=0.0;
+  int i;
 
-	RTDEBUGF(2, "in rtgeom_polygon_perimeter (%d rings)", poly->nrings);
+  RTDEBUGF(2, "in rtgeom_polygon_perimeter (%d rings)", poly->nrings);
 
-	for (i=0; i<poly->nrings; i++)
-		result += ptarray_length_2d(ctx, poly->rings[i]);
+  for (i=0; i<poly->nrings; i++)
+    result += ptarray_length_2d(ctx, poly->rings[i]);
 
-	return result;
+  return result;
 }
 
 int
 rtpoly_is_closed(const RTCTX *ctx, const RTPOLY *poly)
 {
-	int i = 0;
-	
-	if ( poly->nrings == 0 ) 
-		return RT_TRUE;
-		
-	for ( i = 0; i < poly->nrings; i++ )
-	{
-		if (RTFLAGS_GET_Z(poly->flags))
-		{
-			if ( ! ptarray_is_closed_3d(ctx, poly->rings[i]) )
-				return RT_FALSE;
-		}
-		else
-		{	
-			if ( ! ptarray_is_closed_2d(ctx, poly->rings[i]) )
-				return RT_FALSE;
-		}
-	}
-	
-	return RT_TRUE;
+  int i = 0;
+
+  if ( poly->nrings == 0 )
+    return RT_TRUE;
+
+  for ( i = 0; i < poly->nrings; i++ )
+  {
+    if (RTFLAGS_GET_Z(poly->flags))
+    {
+      if ( ! ptarray_is_closed_3d(ctx, poly->rings[i]) )
+        return RT_FALSE;
+    }
+    else
+    {
+      if ( ! ptarray_is_closed_2d(ctx, poly->rings[i]) )
+        return RT_FALSE;
+    }
+  }
+
+  return RT_TRUE;
 }
 
-int 
+int
 rtpoly_startpoint(const RTCTX *ctx, const RTPOLY* poly, RTPOINT4D* pt)
 {
-	if ( poly->nrings < 1 )
-		return RT_FAILURE;
-	return ptarray_startpoint(ctx, poly->rings[0], pt);
+  if ( poly->nrings < 1 )
+    return RT_FAILURE;
+  return ptarray_startpoint(ctx, poly->rings[0], pt);
 }
 
 int
 rtpoly_contains_point(const RTCTX *ctx, const RTPOLY *poly, const RTPOINT2D *pt)
 {
-	int i;
-	
-	if ( rtpoly_is_empty(ctx, poly) )
-		return RT_FALSE;
-	
-	if ( ptarray_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
-		return RT_FALSE;
-	
-	for ( i = 1; i < poly->nrings; i++ )
-	{
-		if ( ptarray_contains_point(ctx, poly->rings[i], pt) == RT_INSIDE )
-			return RT_FALSE;
-	}
-	return RT_TRUE;
+  int i;
+
+  if ( rtpoly_is_empty(ctx, poly) )
+    return RT_FALSE;
+
+  if ( ptarray_contains_point(ctx, poly->rings[0], pt) == RT_OUTSIDE )
+    return RT_FALSE;
+
+  for ( i = 1; i < poly->nrings; i++ )
+  {
+    if ( ptarray_contains_point(ctx, poly->rings[i], pt) == RT_INSIDE )
+      return RT_FALSE;
+  }
+  return RT_TRUE;
 }
 
 
 
 RTPOLY* rtpoly_grid(const RTCTX *ctx, const RTPOLY *poly, const gridspec *grid)
 {
-	RTPOLY *opoly;
-	int ri;
+  RTPOLY *opoly;
+  int ri;
 
 #if 0
-	/*
-	 * TODO: control this assertion
-	 * it is assumed that, since the grid size will be a pixel,
-	 * a visible ring should show at least a white pixel inside,
-	 * thus, for a square, that would be grid_xsize*grid_ysize
-	 */
-	double minvisiblearea = grid->xsize * grid->ysize;
+  /*
+   * TODO: control this assertion
+   * it is assumed that, since the grid size will be a pixel,
+   * a visible ring should show at least a white pixel inside,
+   * thus, for a square, that would be grid_xsize*grid_ysize
+   */
+  double minvisiblearea = grid->xsize * grid->ysize;
 #endif
 
-	RTDEBUGF(3, "rtpoly_grid: applying grid to polygon with %d rings", poly->nrings);
+  RTDEBUGF(3, "rtpoly_grid: applying grid to polygon with %d rings", poly->nrings);
+
+  opoly = rtpoly_construct_empty(ctx, poly->srid, rtgeom_has_z(ctx, (RTGEOM*)poly), rtgeom_has_m(ctx, (RTGEOM*)poly));
 
-	opoly = rtpoly_construct_empty(ctx, poly->srid, rtgeom_has_z(ctx, (RTGEOM*)poly), rtgeom_has_m(ctx, (RTGEOM*)poly));
+  for (ri=0; ri<poly->nrings; ri++)
+  {
+    RTPOINTARRAY *ring = poly->rings[ri];
+    RTPOINTARRAY *newring;
 
-	for (ri=0; ri<poly->nrings; ri++)
-	{
-		RTPOINTARRAY *ring = poly->rings[ri];
-		RTPOINTARRAY *newring;
+    newring = ptarray_grid(ctx, ring, grid);
 
-		newring = ptarray_grid(ctx, ring, grid);
+    /* Skip ring if not composed by at least 4 pts (3 segments) */
+    if ( newring->npoints < 4 )
+    {
+      ptarray_free(ctx, newring);
 
-		/* Skip ring if not composed by at least 4 pts (3 segments) */
-		if ( newring->npoints < 4 )
-		{
-			ptarray_free(ctx, newring);
+      RTDEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
 
-			RTDEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
+      if ( ri ) continue;
+      else break; /* this is the external ring, no need to work on holes */
+    }
 
-			if ( ri ) continue;
-			else break; /* this is the external ring, no need to work on holes */
-		}
-		
-		if ( ! rtpoly_add_ring(ctx, opoly, newring) )
-		{
-			rterror(ctx, "rtpoly_grid, memory error");
-			return NULL;
-		}
-	}
+    if ( ! rtpoly_add_ring(ctx, opoly, newring) )
+    {
+      rterror(ctx, "rtpoly_grid, memory error");
+      return NULL;
+    }
+  }
 
-	RTDEBUGF(3, "rtpoly_grid: simplified polygon with %d rings", opoly->nrings);
+  RTDEBUGF(3, "rtpoly_grid: simplified polygon with %d rings", opoly->nrings);
 
-	if ( ! opoly->nrings ) 
-	{
-		rtpoly_free(ctx, opoly);
-		return NULL;
-	}
+  if ( ! opoly->nrings )
+  {
+    rtpoly_free(ctx, opoly);
+    return NULL;
+  }
 
-	return opoly;
+  return opoly;
 }
diff --git a/src/rtprint.c b/src/rtprint.c
index 2874347..ca419f1 100644
--- a/src/rtprint.c
+++ b/src/rtprint.c
@@ -33,39 +33,39 @@
  * -90 to +90 for lat, -180 to +180 for lon. */
 static void rtprint_normalize_latlon(const RTCTX *ctx, double *lat, double *lon)
 {
-	/* First remove all the truly excessive trips around the world via up or down. */
-	while (*lat > 270)
-	{
-		*lat -= 360;
-	}
-	while (*lat < -270)
-	{
-		*lat += 360;
-	}
+  /* First remove all the truly excessive trips around the world via up or down. */
+  while (*lat > 270)
+  {
+    *lat -= 360;
+  }
+  while (*lat < -270)
+  {
+    *lat += 360;
+  }
 
-	/* Now see if latitude is past the top or bottom of the world.
-	 * Past 90  or -90 puts us on the other side of the earth,
-	     * so wrap latitude and add 180 to longitude to reflect that. */
-	if (*lat > 90)
-	{
-		*lat = 180 - *lat;
-		*lon += 180;
-	}
-	if (*lat < -90)
-	{
-		*lat = -180 - *lat;
-		*lon += 180;
-	}
-	/* Now make sure lon is in the normal range.  Wrapping longitude
-	 * has no effect on latitude. */
-	while (*lon > 180)
-	{
-		*lon -= 360;
-	}
-	while (*lon < -180)
-	{
-		*lon += 360;
-	}
+  /* Now see if latitude is past the top or bottom of the world.
+   * Past 90  or -90 puts us on the other side of the earth,
+       * so wrap latitude and add 180 to longitude to reflect that. */
+  if (*lat > 90)
+  {
+    *lat = 180 - *lat;
+    *lon += 180;
+  }
+  if (*lat < -90)
+  {
+    *lat = -180 - *lat;
+    *lon += 180;
+  }
+  /* Now make sure lon is in the normal range.  Wrapping longitude
+   * has no effect on latitude. */
+  while (*lon > 180)
+  {
+    *lon -= 360;
+  }
+  while (*lon < -180)
+  {
+    *lon += 360;
+  }
 }
 
 /* Converts a single double to DMS given the specified DMS format string.
@@ -75,306 +75,306 @@ static void rtprint_normalize_latlon(const RTCTX *ctx, double *lat, double *lon)
  * NOTE: Format string and symbols are required to be in UTF-8. */
 static char * rtdouble_to_dms(const RTCTX *ctx, double val, const char *pos_dir_symbol, const char *neg_dir_symbol, const char * format)
 {
-	/* 3 numbers, 1 sign or compass dir, and 5 possible strings (degree signs, spaces, misc text, etc) between or around them.*/
+  /* 3 numbers, 1 sign or compass dir, and 5 possible strings (degree signs, spaces, misc text, etc) between or around them.*/
 #define NUM_PIECES  9
 #define WORK_SIZE 1024
-	char pieces[NUM_PIECES][WORK_SIZE];
-	int current_piece = 0;
-	int is_negative = 0;
+  char pieces[NUM_PIECES][WORK_SIZE];
+  int current_piece = 0;
+  int is_negative = 0;
 
-	double degrees = 0.0;
-	double minutes = 0.0;
-	double seconds = 0.0;
+  double degrees = 0.0;
+  double minutes = 0.0;
+  double seconds = 0.0;
 
-	int compass_dir_piece = -1;
+  int compass_dir_piece = -1;
 
-	int reading_deg = 0;
-	int deg_digits = 0;
-	int deg_has_decpoint = 0;
-	int deg_dec_digits = 0;
-	int deg_piece = -1;
+  int reading_deg = 0;
+  int deg_digits = 0;
+  int deg_has_decpoint = 0;
+  int deg_dec_digits = 0;
+  int deg_piece = -1;
 
-	int reading_min = 0;
-	int min_digits = 0;
-	int min_has_decpoint = 0;
-	int min_dec_digits = 0;
-	int min_piece = -1;
+  int reading_min = 0;
+  int min_digits = 0;
+  int min_has_decpoint = 0;
+  int min_dec_digits = 0;
+  int min_piece = -1;
 
-	int reading_sec = 0;
-	int sec_digits = 0;
-	int sec_has_decpoint = 0;
-	int sec_dec_digits = 0;
-	int sec_piece = -1;
+  int reading_sec = 0;
+  int sec_digits = 0;
+  int sec_has_decpoint = 0;
+  int sec_dec_digits = 0;
+  int sec_piece = -1;
 
-	int format_length = ((NULL == format) ? 0 : strlen(format));
+  int format_length = ((NULL == format) ? 0 : strlen(format));
 
-	char * result;
+  char * result;
 
-	int index, following_byte_index;
-	int multibyte_char_width = 1;
+  int index, following_byte_index;
+  int multibyte_char_width = 1;
 
-	/* Initialize the working strs to blank.  We may not populate all of them, and
-	 * this allows us to concat them all at the end without worrying about how many
-	 * we actually needed. */
-	for (index = 0; index < NUM_PIECES; index++)
-	{
-		pieces[index][0] = '\0';
-	}
+  /* Initialize the working strs to blank.  We may not populate all of them, and
+   * this allows us to concat them all at the end without worrying about how many
+   * we actually needed. */
+  for (index = 0; index < NUM_PIECES; index++)
+  {
+    pieces[index][0] = '\0';
+  }
 
-	/* If no format is provided, use a default. */
-	if (0 == format_length)
-	{
-		/* C2B0 is UTF-8 for the degree symbol. */
-		format = "D\xC2\xB0""M'S.SSS\"C";
-		format_length = strlen(format);
-	}
-	else if (format_length > WORK_SIZE)
-	{
-		/* Sanity check, we don't want to overwrite an entire piece of work and no one should need a 1K-sized
-		* format string anyway. */
-		rterror(ctx, "Bad format, exceeds maximum length (%d).", WORK_SIZE);
-	}
+  /* If no format is provided, use a default. */
+  if (0 == format_length)
+  {
+    /* C2B0 is UTF-8 for the degree symbol. */
+    format = "D\xC2\xB0""M'S.SSS\"C";
+    format_length = strlen(format);
+  }
+  else if (format_length > WORK_SIZE)
+  {
+    /* Sanity check, we don't want to overwrite an entire piece of work and no one should need a 1K-sized
+    * format string anyway. */
+    rterror(ctx, "Bad format, exceeds maximum length (%d).", WORK_SIZE);
+  }
 
-	for (index = 0; index < format_length; index++)
-	{
-		char next_char = format[index];
-		switch (next_char)
-		{
-		case 'D':
-			if (reading_deg)
-			{
-				/* If we're reading degrees, add another digit. */
-				deg_has_decpoint ? deg_dec_digits++ : deg_digits++;
-			}
-			else
-			{
-				/* If we're not reading degrees, we are now. */
-				current_piece++;
-				deg_piece = current_piece;
-				if (deg_digits > 0)
-				{
-					rterror(ctx, "Bad format, cannot include degrees (DD.DDD) more than once.");
-				}
-				reading_deg = 1;
-				reading_min = 0;
-				reading_sec = 0;
-				deg_digits++;
-			}
-			break;
-		case 'M':
-			if (reading_min)
-			{
-				/* If we're reading minutes, add another digit. */
-				min_has_decpoint ? min_dec_digits++ : min_digits++;
-			}
-			else
-			{
-				/* If we're not reading minutes, we are now. */
-				current_piece++;
-				min_piece = current_piece;
-				if (min_digits > 0)
-				{
-					rterror(ctx, "Bad format, cannot include minutes (MM.MMM) more than once.");
-				}
-				reading_deg = 0;
-				reading_min = 1;
-				reading_sec = 0;
-				min_digits++;
-			}
-			break;
-		case 'S':
-			if (reading_sec)
-			{
-				/* If we're reading seconds, add another digit. */
-				sec_has_decpoint ? sec_dec_digits++ : sec_digits++;
-			}
-			else
-			{
-				/* If we're not reading seconds, we are now. */
-				current_piece++;
-				sec_piece = current_piece;
-				if (sec_digits > 0)
-				{
-					rterror(ctx, "Bad format, cannot include seconds (SS.SSS) more than once.");
-				}
-				reading_deg = 0;
-				reading_min = 0;
-				reading_sec = 1;
-				sec_digits++;
-			}
-			break;
-		case 'C':
-			/* We're done reading anything else we might have been reading. */
-			if (reading_deg || reading_min || reading_sec)
-			{
-				/* We were reading something, that means this is the next piece. */
-				reading_deg = 0;
-				reading_min = 0;
-				reading_sec = 0;
-			}
-			current_piece++;
+  for (index = 0; index < format_length; index++)
+  {
+    char next_char = format[index];
+    switch (next_char)
+    {
+    case 'D':
+      if (reading_deg)
+      {
+        /* If we're reading degrees, add another digit. */
+        deg_has_decpoint ? deg_dec_digits++ : deg_digits++;
+      }
+      else
+      {
+        /* If we're not reading degrees, we are now. */
+        current_piece++;
+        deg_piece = current_piece;
+        if (deg_digits > 0)
+        {
+          rterror(ctx, "Bad format, cannot include degrees (DD.DDD) more than once.");
+        }
+        reading_deg = 1;
+        reading_min = 0;
+        reading_sec = 0;
+        deg_digits++;
+      }
+      break;
+    case 'M':
+      if (reading_min)
+      {
+        /* If we're reading minutes, add another digit. */
+        min_has_decpoint ? min_dec_digits++ : min_digits++;
+      }
+      else
+      {
+        /* If we're not reading minutes, we are now. */
+        current_piece++;
+        min_piece = current_piece;
+        if (min_digits > 0)
+        {
+          rterror(ctx, "Bad format, cannot include minutes (MM.MMM) more than once.");
+        }
+        reading_deg = 0;
+        reading_min = 1;
+        reading_sec = 0;
+        min_digits++;
+      }
+      break;
+    case 'S':
+      if (reading_sec)
+      {
+        /* If we're reading seconds, add another digit. */
+        sec_has_decpoint ? sec_dec_digits++ : sec_digits++;
+      }
+      else
+      {
+        /* If we're not reading seconds, we are now. */
+        current_piece++;
+        sec_piece = current_piece;
+        if (sec_digits > 0)
+        {
+          rterror(ctx, "Bad format, cannot include seconds (SS.SSS) more than once.");
+        }
+        reading_deg = 0;
+        reading_min = 0;
+        reading_sec = 1;
+        sec_digits++;
+      }
+      break;
+    case 'C':
+      /* We're done reading anything else we might have been reading. */
+      if (reading_deg || reading_min || reading_sec)
+      {
+        /* We were reading something, that means this is the next piece. */
+        reading_deg = 0;
+        reading_min = 0;
+        reading_sec = 0;
+      }
+      current_piece++;
 
-			if (compass_dir_piece >= 0)
-			{
-				rterror(ctx, "Bad format, cannot include compass dir (C) more than once.");
-			}
-			/* The compass dir is a piece all by itself.  */
-			compass_dir_piece = current_piece;
-			current_piece++;
-			break;
-		case '.':
-			/* If we're reading deg, min, or sec, we want a decimal point for it. */
-			if (reading_deg)
-			{
-				deg_has_decpoint = 1;
-			}
-			else if (reading_min)
-			{
-				min_has_decpoint = 1;
-			}
-			else if (reading_sec)
-			{
-				sec_has_decpoint = 1;
-			}
-			else
-			{
-				/* Not reading anything, just pass through the '.' */
-				strncat(pieces[current_piece], &next_char, 1);
-			}
-			break;
-		default:
-			/* Any other char is just passed through unchanged.  But it does mean we are done reading D, M, or S.*/
-			if (reading_deg || reading_min || reading_sec)
-			{
-				/* We were reading something, that means this is the next piece. */
-				current_piece++;
-				reading_deg = 0;
-				reading_min = 0;
-				reading_sec = 0;
-			}
+      if (compass_dir_piece >= 0)
+      {
+        rterror(ctx, "Bad format, cannot include compass dir (C) more than once.");
+      }
+      /* The compass dir is a piece all by itself.  */
+      compass_dir_piece = current_piece;
+      current_piece++;
+      break;
+    case '.':
+      /* If we're reading deg, min, or sec, we want a decimal point for it. */
+      if (reading_deg)
+      {
+        deg_has_decpoint = 1;
+      }
+      else if (reading_min)
+      {
+        min_has_decpoint = 1;
+      }
+      else if (reading_sec)
+      {
+        sec_has_decpoint = 1;
+      }
+      else
+      {
+        /* Not reading anything, just pass through the '.' */
+        strncat(pieces[current_piece], &next_char, 1);
+      }
+      break;
+    default:
+      /* Any other char is just passed through unchanged.  But it does mean we are done reading D, M, or S.*/
+      if (reading_deg || reading_min || reading_sec)
+      {
+        /* We were reading something, that means this is the next piece. */
+        current_piece++;
+        reading_deg = 0;
+        reading_min = 0;
+        reading_sec = 0;
+      }
 
-			/* Check if this is a multi-byte UTF-8 character.  If so go ahead and read the rest of the bytes as well. */
-			multibyte_char_width = 1;
-			if (next_char & 0x80)
-			{
-				if ((next_char & 0xF8) == 0xF0)
-				{
-					multibyte_char_width += 3;
-				}
-				else if ((next_char & 0xF0) == 0xE0)
-				{
-					multibyte_char_width += 2;
-				}
-				else if ((next_char & 0xE0) == 0xC0)
-				{
-					multibyte_char_width += 1;
-				}
-				else
-				{
-					rterror(ctx, "Bad format, invalid high-order byte found first, format string may not be UTF-8.");
-				}
-			}
-			if (multibyte_char_width > 1)
-			{
-				if (index + multibyte_char_width >= format_length)
-				{
-					rterror(ctx, "Bad format, UTF-8 character first byte found with insufficient following bytes, format string may not be UTF-8.");
-				}
-				for (following_byte_index = (index + 1); following_byte_index < (index + multibyte_char_width); following_byte_index++)
-				{
-					if ((format[following_byte_index] & 0xC0) != 0x80)
-					{
-						rterror(ctx, "Bad format, invalid byte found following leading byte of multibyte character, format string may not be UTF-8.");
-					}
-				}
-			}
-			/* Copy all the character's bytes into the current piece. */
-			strncat(pieces[current_piece], &(format[index]), multibyte_char_width);
-			/* Now increment index past the rest of those bytes. */
-			index += multibyte_char_width - 1;
-			break;
-		}
-		if (current_piece >= NUM_PIECES)
-		{
-			rterror(ctx, "Internal error, somehow needed more pieces than it should.");
-		}
-	}
-	if (deg_piece < 0)
-	{
-		rterror(ctx, "Bad format, degrees (DD.DDD) must be included.");
-	}
+      /* Check if this is a multi-byte UTF-8 character.  If so go ahead and read the rest of the bytes as well. */
+      multibyte_char_width = 1;
+      if (next_char & 0x80)
+      {
+        if ((next_char & 0xF8) == 0xF0)
+        {
+          multibyte_char_width += 3;
+        }
+        else if ((next_char & 0xF0) == 0xE0)
+        {
+          multibyte_char_width += 2;
+        }
+        else if ((next_char & 0xE0) == 0xC0)
+        {
+          multibyte_char_width += 1;
+        }
+        else
+        {
+          rterror(ctx, "Bad format, invalid high-order byte found first, format string may not be UTF-8.");
+        }
+      }
+      if (multibyte_char_width > 1)
+      {
+        if (index + multibyte_char_width >= format_length)
+        {
+          rterror(ctx, "Bad format, UTF-8 character first byte found with insufficient following bytes, format string may not be UTF-8.");
+        }
+        for (following_byte_index = (index + 1); following_byte_index < (index + multibyte_char_width); following_byte_index++)
+        {
+          if ((format[following_byte_index] & 0xC0) != 0x80)
+          {
+            rterror(ctx, "Bad format, invalid byte found following leading byte of multibyte character, format string may not be UTF-8.");
+          }
+        }
+      }
+      /* Copy all the character's bytes into the current piece. */
+      strncat(pieces[current_piece], &(format[index]), multibyte_char_width);
+      /* Now increment index past the rest of those bytes. */
+      index += multibyte_char_width - 1;
+      break;
+    }
+    if (current_piece >= NUM_PIECES)
+    {
+      rterror(ctx, "Internal error, somehow needed more pieces than it should.");
+    }
+  }
+  if (deg_piece < 0)
+  {
+    rterror(ctx, "Bad format, degrees (DD.DDD) must be included.");
+  }
 
-	/* Divvy the number up into D, DM, or DMS */
-	if (val < 0)
-	{
-		val *= -1;
-		is_negative = 1;
-	}
-	degrees = val;
-	if (min_digits > 0)
-	{
-		degrees = (long)degrees;
-		minutes = (val - degrees) * 60;
-	}
-	if (sec_digits > 0)
-	{
-		if (0 == min_digits)
-		{
-			rterror(ctx, "Bad format, cannot include seconds (SS.SSS) without including minutes (MM.MMM).");
-		}
-		minutes = (long)minutes;
-		seconds = (val - (degrees + (minutes / 60))) * 3600;
-	}
+  /* Divvy the number up into D, DM, or DMS */
+  if (val < 0)
+  {
+    val *= -1;
+    is_negative = 1;
+  }
+  degrees = val;
+  if (min_digits > 0)
+  {
+    degrees = (long)degrees;
+    minutes = (val - degrees) * 60;
+  }
+  if (sec_digits > 0)
+  {
+    if (0 == min_digits)
+    {
+      rterror(ctx, "Bad format, cannot include seconds (SS.SSS) without including minutes (MM.MMM).");
+    }
+    minutes = (long)minutes;
+    seconds = (val - (degrees + (minutes / 60))) * 3600;
+  }
 
-	/* Handle the compass direction.  If not using compass dir, display degrees as a positive/negative number. */
-	if (compass_dir_piece >= 0)
-	{
-		strcpy(pieces[compass_dir_piece], is_negative ? neg_dir_symbol : pos_dir_symbol);
-	}
-	else if (is_negative)
-	{
-		degrees *= -1;
-	}
+  /* Handle the compass direction.  If not using compass dir, display degrees as a positive/negative number. */
+  if (compass_dir_piece >= 0)
+  {
+    strcpy(pieces[compass_dir_piece], is_negative ? neg_dir_symbol : pos_dir_symbol);
+  }
+  else if (is_negative)
+  {
+    degrees *= -1;
+  }
 
-	/* Format the degrees into their string piece. */
-	if (deg_digits + deg_dec_digits + 2 > WORK_SIZE)
-	{
-		rterror(ctx, "Bad format, degrees (DD.DDD) number of digits was greater than our working limit.");
-	}
-	if(deg_piece >= 0)
-	{
-		sprintf(pieces[deg_piece], "%*.*f", deg_digits, deg_dec_digits, degrees);
-	}
+  /* Format the degrees into their string piece. */
+  if (deg_digits + deg_dec_digits + 2 > WORK_SIZE)
+  {
+    rterror(ctx, "Bad format, degrees (DD.DDD) number of digits was greater than our working limit.");
+  }
+  if(deg_piece >= 0)
+  {
+    sprintf(pieces[deg_piece], "%*.*f", deg_digits, deg_dec_digits, degrees);
+  }
 
-	if (min_piece >= 0)
-	{
-		/* Format the minutes into their string piece. */
-		if (min_digits + min_dec_digits + 2 > WORK_SIZE)
-		{
-			rterror(ctx, "Bad format, minutes (MM.MMM) number of digits was greater than our working limit.");
-		}
-		sprintf(pieces[min_piece], "%*.*f", min_digits, min_dec_digits, minutes);
-	}
-	if (sec_piece >= 0)
-	{
-		/* Format the seconds into their string piece. */
-		if (sec_digits + sec_dec_digits + 2 > WORK_SIZE)
-		{
-			rterror(ctx, "Bad format, seconds (SS.SSS) number of digits was greater than our working limit.");
-		}
-		sprintf(pieces[sec_piece], "%*.*f", sec_digits, sec_dec_digits, seconds);
-	}
+  if (min_piece >= 0)
+  {
+    /* Format the minutes into their string piece. */
+    if (min_digits + min_dec_digits + 2 > WORK_SIZE)
+    {
+      rterror(ctx, "Bad format, minutes (MM.MMM) number of digits was greater than our working limit.");
+    }
+    sprintf(pieces[min_piece], "%*.*f", min_digits, min_dec_digits, minutes);
+  }
+  if (sec_piece >= 0)
+  {
+    /* Format the seconds into their string piece. */
+    if (sec_digits + sec_dec_digits + 2 > WORK_SIZE)
+    {
+      rterror(ctx, "Bad format, seconds (SS.SSS) number of digits was greater than our working limit.");
+    }
+    sprintf(pieces[sec_piece], "%*.*f", sec_digits, sec_dec_digits, seconds);
+  }
 
-	/* Allocate space for the result.  Leave plenty of room for excess digits, negative sign, etc.*/
-	result = (char*)rtalloc(ctx, format_length + WORK_SIZE);
-	/* Append all the pieces together. There may be less than 9, but in that case the rest will be blank. */
-	strcpy(result, pieces[0]);
-	for (index = 1; index < NUM_PIECES; index++)
-	{
-		strcat(result, pieces[index]);
-	}
+  /* Allocate space for the result.  Leave plenty of room for excess digits, negative sign, etc.*/
+  result = (char*)rtalloc(ctx, format_length + WORK_SIZE);
+  /* Append all the pieces together. There may be less than 9, but in that case the rest will be blank. */
+  strcpy(result, pieces[0]);
+  for (index = 1; index < NUM_PIECES; index++)
+  {
+    strcat(result, pieces[index]);
+  }
 
-	return result;
+  return result;
 }
 
 /* Print two doubles (lat and lon) in DMS form using the specified format.
@@ -385,22 +385,22 @@ static char * rtdouble_to_dms(const RTCTX *ctx, double val, const char *pos_dir_
  */
 static char * rtdoubles_to_latlon(const RTCTX *ctx, double lat, double lon, const char * format)
 {
-	char * lat_text;
-	char * lon_text;
-	char * result;
+  char * lat_text;
+  char * lon_text;
+  char * result;
 
-	/* Normalize lat/lon to the normal (-90 to 90, -180 to 180) range. */
-	rtprint_normalize_latlon(ctx, &lat, &lon);
-	/* This is somewhat inefficient as the format is parsed twice. */
-	lat_text = rtdouble_to_dms(ctx, lat, "N", "S", format);
-	lon_text = rtdouble_to_dms(ctx, lon, "E", "W", format);
+  /* Normalize lat/lon to the normal (-90 to 90, -180 to 180) range. */
+  rtprint_normalize_latlon(ctx, &lat, &lon);
+  /* This is somewhat inefficient as the format is parsed twice. */
+  lat_text = rtdouble_to_dms(ctx, lat, "N", "S", format);
+  lon_text = rtdouble_to_dms(ctx, lon, "E", "W", format);
 
-	/* lat + lon + a space between + the null terminator. */
-	result = (char*)rtalloc(ctx, strlen(lat_text) + strlen(lon_text) + 2);
-	sprintf(result, "%s %s", lat_text, lon_text);
-	rtfree(ctx, lat_text);
-	rtfree(ctx, lon_text);
-	return result;
+  /* lat + lon + a space between + the null terminator. */
+  result = (char*)rtalloc(ctx, strlen(lat_text) + strlen(lon_text) + 2);
+  sprintf(result, "%s %s", lat_text, lon_text);
+  rtfree(ctx, lat_text);
+  rtfree(ctx, lon_text);
+  return result;
 }
 
 /* Print the X (lon) and Y (lat) of the given point in DMS form using
@@ -412,15 +412,15 @@ static char * rtdoubles_to_latlon(const RTCTX *ctx, double lat, double lon, cons
  */
 char* rtpoint_to_latlon(const RTCTX *ctx, const RTPOINT * pt, const char *format)
 {
-	const RTPOINT2D *p;
-	if (NULL == pt)
-	{
-		rterror(ctx, "Cannot convert a null point into formatted text.");
-	}
-	if (rtgeom_is_empty(ctx, (RTGEOM *)pt))
-	{
-		rterror(ctx, "Cannot convert an empty point into formatted text.");
-	}
-	p = rt_getPoint2d_cp(ctx, pt->point, 0);
-	return rtdoubles_to_latlon(ctx, p->y, p->x, format);
+  const RTPOINT2D *p;
+  if (NULL == pt)
+  {
+    rterror(ctx, "Cannot convert a null point into formatted text.");
+  }
+  if (rtgeom_is_empty(ctx, (RTGEOM *)pt))
+  {
+    rterror(ctx, "Cannot convert an empty point into formatted text.");
+  }
+  p = rt_getPoint2d_cp(ctx, pt->point, 0);
+  return rtdoubles_to_latlon(ctx, p->y, p->x, format);
 }
diff --git a/src/rtpsurface.c b/src/rtpsurface.c
index 268b66c..bd7751b 100644
--- a/src/rtpsurface.c
+++ b/src/rtpsurface.c
@@ -33,51 +33,51 @@
 
 RTPSURFACE* rtpsurface_add_rtpoly(const RTCTX *ctx, RTPSURFACE *mobj, const RTPOLY *obj)
 {
-	return (RTPSURFACE*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
+  return (RTPSURFACE*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
 }
 
 
 void rtpsurface_free(const RTCTX *ctx, RTPSURFACE *psurf)
 {
-	int i;
-	if ( ! psurf ) return;
-	if ( psurf->bbox )
-		rtfree(ctx, psurf->bbox);
+  int i;
+  if ( ! psurf ) return;
+  if ( psurf->bbox )
+    rtfree(ctx, psurf->bbox);
 
-	for ( i = 0; i < psurf->ngeoms; i++ )
-		if ( psurf->geoms && psurf->geoms[i] )
-			rtpoly_free(ctx, psurf->geoms[i]);
+  for ( i = 0; i < psurf->ngeoms; i++ )
+    if ( psurf->geoms && psurf->geoms[i] )
+      rtpoly_free(ctx, psurf->geoms[i]);
 
-	if ( psurf->geoms )
-		rtfree(ctx, psurf->geoms);
+  if ( psurf->geoms )
+    rtfree(ctx, psurf->geoms);
 
-	rtfree(ctx, psurf);
+  rtfree(ctx, psurf);
 }
 
 
 void printRTPSURFACE(const RTCTX *ctx, RTPSURFACE *psurf)
 {
-	int i, j;
-	RTPOLY *patch;
-
-	if (psurf->type != RTPOLYHEDRALSURFACETYPE)
-		rterror(ctx, "printRTPSURFACE called with something else than a POLYHEDRALSURFACE");
-
-	rtnotice(ctx, "RTPSURFACE {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(psurf->flags));
-	rtnotice(ctx, "    SRID = %i", (int)psurf->srid);
-	rtnotice(ctx, "    ngeoms = %i", (int)psurf->ngeoms);
-
-	for (i=0; i<psurf->ngeoms; i++)
-	{
-		patch = (RTPOLY *) psurf->geoms[i];
-		for (j=0; j<patch->nrings; j++)
-		{
-			rtnotice(ctx, "    RING # %i :",j);
-			printPA(ctx, patch->rings[j]);
-		}
-	}
-	rtnotice(ctx, "}");
+  int i, j;
+  RTPOLY *patch;
+
+  if (psurf->type != RTPOLYHEDRALSURFACETYPE)
+    rterror(ctx, "printRTPSURFACE called with something else than a POLYHEDRALSURFACE");
+
+  rtnotice(ctx, "RTPSURFACE {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(psurf->flags));
+  rtnotice(ctx, "    SRID = %i", (int)psurf->srid);
+  rtnotice(ctx, "    ngeoms = %i", (int)psurf->ngeoms);
+
+  for (i=0; i<psurf->ngeoms; i++)
+  {
+    patch = (RTPOLY *) psurf->geoms[i];
+    for (j=0; j<patch->nrings; j++)
+    {
+      rtnotice(ctx, "    RING # %i :",j);
+      printPA(ctx, patch->rings[j]);
+    }
+  }
+  rtnotice(ctx, "}");
 }
 
 
@@ -89,9 +89,9 @@ void printRTPSURFACE(const RTCTX *ctx, RTPSURFACE *psurf)
 
 struct struct_psurface_arcs
 {
-	double ax, ay, az;
-	double bx, by, bz;
-	int cnt, face;
+  double ax, ay, az;
+  double bx, by, bz;
+  int cnt, face;
 };
 typedef struct struct_psurface_arcs *psurface_arcs;
 
@@ -99,107 +99,107 @@ typedef struct struct_psurface_arcs *psurface_arcs;
    we could have wrong result if not */
 int rtpsurface_is_closed(const RTCTX *ctx, const RTPSURFACE *psurface)
 {
-	int i, j, k;
-	int narcs, carc;
-	int found;
-	psurface_arcs arcs;
-	RTPOINT4D pa, pb;
-	RTPOLY *patch;
-
-	/* If surface is not 3D, it's can't be closed */
-	if (!RTFLAGS_GET_Z(psurface->flags)) return 0;
-
-	/* If surface is less than 4 faces hard to be closed too */
-	if (psurface->ngeoms < 4) return 0;
-
-	/* Max theorical arcs number if no one is shared ... */
-	for (i=0, narcs=0 ; i < psurface->ngeoms ; i++)
-	{
-		patch = (RTPOLY *) psurface->geoms[i];
-		narcs += patch->rings[0]->npoints - 1;
-	}
-
-	arcs = rtalloc(ctx, sizeof(struct struct_psurface_arcs) * narcs);
-	for (i=0, carc=0; i < psurface->ngeoms ; i++)
-	{
-
-		patch = (RTPOLY *) psurface->geoms[i];
-		for (j=0; j < patch->rings[0]->npoints - 1; j++)
-		{
-
-			rt_getPoint4d_p(ctx, patch->rings[0], j,   &pa);
-			rt_getPoint4d_p(ctx, patch->rings[0], j+1, &pb);
-
-			/* remove redundant points if any */
-			if (pa.x == pb.x && pa.y == pb.y && pa.z == pb.z) continue;
-
-			/* Make sure to order the 'lower' point first */
-			if ( (pa.x > pb.x) ||
-			        (pa.x == pb.x && pa.y > pb.y) ||
-			        (pa.x == pb.x && pa.y == pb.y && pa.z > pb.z) )
-			{
-				pa = pb;
-				rt_getPoint4d_p(ctx, patch->rings[0], j, &pb);
-			}
-
-			for (found=0, k=0; k < carc ; k++)
-			{
-
-				if (  ( arcs[k].ax == pa.x && arcs[k].ay == pa.y &&
-				        arcs[k].az == pa.z && arcs[k].bx == pb.x &&
-				        arcs[k].by == pb.y && arcs[k].bz == pb.z &&
-				        arcs[k].face != i) )
-				{
-					arcs[k].cnt++;
-					found = 1;
-
-					/* Look like an invalid PolyhedralSurface
-					      anyway not a closed one */
-					if (arcs[k].cnt > 2)
-					{
-						rtfree(ctx, arcs);
-						return 0;
-					}
-				}
-			}
-
-			if (!found)
-			{
-				arcs[carc].cnt=1;
-				arcs[carc].face=i;
-				arcs[carc].ax = pa.x;
-				arcs[carc].ay = pa.y;
-				arcs[carc].az = pa.z;
-				arcs[carc].bx = pb.x;
-				arcs[carc].by = pb.y;
-				arcs[carc].bz = pb.z;
-				carc++;
-
-				/* Look like an invalid PolyhedralSurface
-				      anyway not a closed one */
-				if (carc > narcs)
-				{
-					rtfree(ctx, arcs);
-					return 0;
-				}
-			}
-		}
-	}
-
-	/* A polyhedron is closed if each edge
-	       is shared by exactly 2 faces */
-	for (k=0; k < carc ; k++)
-	{
-		if (arcs[k].cnt != 2)
-		{
-			rtfree(ctx, arcs);
-			return 0;
-		}
-	}
-	rtfree(ctx, arcs);
-
-	/* Invalid Polyhedral case */
-	if (carc < psurface->ngeoms) return 0;
-
-	return 1;
+  int i, j, k;
+  int narcs, carc;
+  int found;
+  psurface_arcs arcs;
+  RTPOINT4D pa, pb;
+  RTPOLY *patch;
+
+  /* If surface is not 3D, it's can't be closed */
+  if (!RTFLAGS_GET_Z(psurface->flags)) return 0;
+
+  /* If surface is less than 4 faces hard to be closed too */
+  if (psurface->ngeoms < 4) return 0;
+
+  /* Max theorical arcs number if no one is shared ... */
+  for (i=0, narcs=0 ; i < psurface->ngeoms ; i++)
+  {
+    patch = (RTPOLY *) psurface->geoms[i];
+    narcs += patch->rings[0]->npoints - 1;
+  }
+
+  arcs = rtalloc(ctx, sizeof(struct struct_psurface_arcs) * narcs);
+  for (i=0, carc=0; i < psurface->ngeoms ; i++)
+  {
+
+    patch = (RTPOLY *) psurface->geoms[i];
+    for (j=0; j < patch->rings[0]->npoints - 1; j++)
+    {
+
+      rt_getPoint4d_p(ctx, patch->rings[0], j,   &pa);
+      rt_getPoint4d_p(ctx, patch->rings[0], j+1, &pb);
+
+      /* remove redundant points if any */
+      if (pa.x == pb.x && pa.y == pb.y && pa.z == pb.z) continue;
+
+      /* Make sure to order the 'lower' point first */
+      if ( (pa.x > pb.x) ||
+              (pa.x == pb.x && pa.y > pb.y) ||
+              (pa.x == pb.x && pa.y == pb.y && pa.z > pb.z) )
+      {
+        pa = pb;
+        rt_getPoint4d_p(ctx, patch->rings[0], j, &pb);
+      }
+
+      for (found=0, k=0; k < carc ; k++)
+      {
+
+        if (  ( arcs[k].ax == pa.x && arcs[k].ay == pa.y &&
+                arcs[k].az == pa.z && arcs[k].bx == pb.x &&
+                arcs[k].by == pb.y && arcs[k].bz == pb.z &&
+                arcs[k].face != i) )
+        {
+          arcs[k].cnt++;
+          found = 1;
+
+          /* Look like an invalid PolyhedralSurface
+                anyway not a closed one */
+          if (arcs[k].cnt > 2)
+          {
+            rtfree(ctx, arcs);
+            return 0;
+          }
+        }
+      }
+
+      if (!found)
+      {
+        arcs[carc].cnt=1;
+        arcs[carc].face=i;
+        arcs[carc].ax = pa.x;
+        arcs[carc].ay = pa.y;
+        arcs[carc].az = pa.z;
+        arcs[carc].bx = pb.x;
+        arcs[carc].by = pb.y;
+        arcs[carc].bz = pb.z;
+        carc++;
+
+        /* Look like an invalid PolyhedralSurface
+              anyway not a closed one */
+        if (carc > narcs)
+        {
+          rtfree(ctx, arcs);
+          return 0;
+        }
+      }
+    }
+  }
+
+  /* A polyhedron is closed if each edge
+         is shared by exactly 2 faces */
+  for (k=0; k < carc ; k++)
+  {
+    if (arcs[k].cnt != 2)
+    {
+      rtfree(ctx, arcs);
+      return 0;
+    }
+  }
+  rtfree(ctx, arcs);
+
+  /* Invalid Polyhedral case */
+  if (carc < psurface->ngeoms) return 0;
+
+  return 1;
 }
diff --git a/src/rtspheroid.c b/src/rtspheroid.c
index e135eac..1f1fd3a 100644
--- a/src/rtspheroid.c
+++ b/src/rtspheroid.c
@@ -39,28 +39,28 @@
 */
 void spheroid_init(const RTCTX *ctx, SPHEROID *s, double a, double b)
 {
-	s->a = a;
-	s->b = b;
-	s->f = (a - b) / a;
-	s->e_sq = (a*a - b*b)/(a*a);
-	s->radius = (2.0 * a + b ) / 3.0;
+  s->a = a;
+  s->b = b;
+  s->f = (a - b) / a;
+  s->e_sq = (a*a - b*b)/(a*a);
+  s->radius = (2.0 * a + b ) / 3.0;
 }
 
 #if ! PROJ_GEODESIC
 static double spheroid_mu2(const RTCTX *ctx, double alpha, const SPHEROID *s)
 {
-	double b2 = POW2(s->b);
-	return POW2(cos(alpha)) * (POW2(s->a) - b2) / b2;
+  double b2 = POW2(s->b);
+  return POW2(cos(alpha)) * (POW2(s->a) - b2) / b2;
 }
 
 static double spheroid_big_a(const RTCTX *ctx, double u2)
 {
-	return 1.0 + (u2 / 16384.0) * (4096.0 + u2 * (-768.0 + u2 * (320.0 - 175.0 * u2)));
+  return 1.0 + (u2 / 16384.0) * (4096.0 + u2 * (-768.0 + u2 * (320.0 - 175.0 * u2)));
 }
 
 static double spheroid_big_b(const RTCTX *ctx, double u2)
 {
-	return (u2 / 1024.0) * (256.0 + u2 * (-128.0 + u2 * (74.0 - 47.0 * u2)));
+  return (u2 / 1024.0) * (256.0 + u2 * (-128.0 + u2 * (74.0 - 47.0 * u2)));
 }
 #endif /* ! PROJ_GEODESIC */
 
@@ -79,15 +79,15 @@ static double spheroid_big_b(const RTCTX *ctx, double u2)
 */
 double spheroid_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const SPHEROID *spheroid)
 {
-	struct geod_geodesic gd;
-	geod_init(&gd, spheroid->a, spheroid->f);
-	double lat1 = a->lat * 180.0 / M_PI;
-	double lon1 = a->lon * 180.0 / M_PI;
-	double lat2 = b->lat * 180.0 / M_PI;
-	double lon2 = b->lon * 180.0 / M_PI;
-	double s12; /* return distance */
-	geod_inverse(&gd, lat1, lon1, lat2, lon2, &s12, 0, 0);
-	return s12;
+  struct geod_geodesic gd;
+  geod_init(&gd, spheroid->a, spheroid->f);
+  double lat1 = a->lat * 180.0 / M_PI;
+  double lon1 = a->lon * 180.0 / M_PI;
+  double lat2 = b->lat * 180.0 / M_PI;
+  double lon2 = b->lon * 180.0 / M_PI;
+  double s12; /* return distance */
+  geod_inverse(&gd, lat1, lon1, lat2, lon2, &s12, 0, 0);
+  return s12;
 }
 
 /**
@@ -100,15 +100,15 @@ double spheroid_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOG
 */
 double spheroid_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const SPHEROID *spheroid)
 {
-	struct geod_geodesic gd;
-	geod_init(&gd, spheroid->a, spheroid->f);
-	double lat1 = a->lat * 180.0 / M_PI;
-	double lon1 = a->lon * 180.0 / M_PI;
-	double lat2 = b->lat * 180.0 / M_PI;
-	double lon2 = b->lon * 180.0 / M_PI;
-	double azi1; /* return azimuth */
-	geod_inverse(&gd, lat1, lon1, lat2, lon2, 0, &azi1, 0);
-	return azi1 * M_PI / 180.0;
+  struct geod_geodesic gd;
+  geod_init(&gd, spheroid->a, spheroid->f);
+  double lat1 = a->lat * 180.0 / M_PI;
+  double lon1 = a->lon * 180.0 / M_PI;
+  double lat2 = b->lat * 180.0 / M_PI;
+  double lon2 = b->lon * 180.0 / M_PI;
+  double azi1; /* return azimuth */
+  geod_inverse(&gd, lat1, lon1, lat2, lon2, 0, &azi1, 0);
+  return azi1 * M_PI / 180.0;
 }
 
 /**
@@ -123,47 +123,47 @@ double spheroid_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEO
 */
 int spheroid_project(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, const SPHEROID *spheroid, double distance, double azimuth, GEOGRAPHIC_POINT *g)
 {
-	struct geod_geodesic gd;
-	geod_init(&gd, spheroid->a, spheroid->f);
-	double lat1 = r->lat * 180.0 / M_PI;
-	double lon1 = r->lon * 180.0 / M_PI;
-	double lat2, lon2; /* return projected position */
-	geod_direct(&gd, lat1, lon1, azimuth * 180.0 / M_PI, distance, &lat2, &lon2, 0);
-	g->lat = lat2 * M_PI / 180.0;
-	g->lon = lon2 * M_PI / 180.0;
-	return RT_SUCCESS;
+  struct geod_geodesic gd;
+  geod_init(&gd, spheroid->a, spheroid->f);
+  double lat1 = r->lat * 180.0 / M_PI;
+  double lon1 = r->lon * 180.0 / M_PI;
+  double lat2, lon2; /* return projected position */
+  geod_direct(&gd, lat1, lon1, azimuth * 180.0 / M_PI, distance, &lat2, &lon2, 0);
+  g->lat = lat2 * M_PI / 180.0;
+  g->lon = lon2 * M_PI / 180.0;
+  return RT_SUCCESS;
 }
 
 
 static double ptarray_area_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa, const SPHEROID *spheroid)
 {
-	/* Return zero on non-sensical inputs */
-	if ( ! pa || pa->npoints < 4 )
-		return 0.0;
-
-	struct geod_geodesic gd;
-	geod_init(&gd, spheroid->a, spheroid->f);
-	struct geod_polygon poly;
-	geod_polygon_init(&poly, 0);
-	int i;
-	double area; /* returned polygon area */
-	RTPOINT2D p; /* long/lat units are degrees */
-
-	/* Pass points from point array; don't close the linearring */
-	for ( i = 0; i < pa->npoints - 1; i++ )
-	{
-		rt_getPoint2d_p(ctx, pa, i, &p);
-		geod_polygon_addpoint(&gd, &poly, p.y, p.x);
-		RTDEBUGF(4, "geod_polygon_addpoint %d: %.12g %.12g", i, p.y, p.x);
-	}
-	i = geod_polygon_compute(&gd, &poly, 0, 1, &area, 0);
-	if ( i != pa->npoints - 1 )
-	{
-		rterror(ctx, "ptarray_area_spheroid: different number of points %d vs %d",
-				i, pa->npoints - 1);
-	}
-	RTDEBUGF(4, "geod_polygon_compute area: %.12g", area);
-	return fabs(area);
+  /* Return zero on non-sensical inputs */
+  if ( ! pa || pa->npoints < 4 )
+    return 0.0;
+
+  struct geod_geodesic gd;
+  geod_init(&gd, spheroid->a, spheroid->f);
+  struct geod_polygon poly;
+  geod_polygon_init(&poly, 0);
+  int i;
+  double area; /* returned polygon area */
+  RTPOINT2D p; /* long/lat units are degrees */
+
+  /* Pass points from point array; don't close the linearring */
+  for ( i = 0; i < pa->npoints - 1; i++ )
+  {
+    rt_getPoint2d_p(ctx, pa, i, &p);
+    geod_polygon_addpoint(&gd, &poly, p.y, p.x);
+    RTDEBUGF(4, "geod_polygon_addpoint %d: %.12g %.12g", i, p.y, p.x);
+  }
+  i = geod_polygon_compute(&gd, &poly, 0, 1, &area, 0);
+  if ( i != pa->npoints - 1 )
+  {
+    rterror(ctx, "ptarray_area_spheroid: different number of points %d vs %d",
+        i, pa->npoints - 1);
+  }
+  RTDEBUGF(4, "geod_polygon_compute area: %.12g", area);
+  return fabs(area);
 }
 
 /* Above use GeographicLib */
@@ -186,85 +186,85 @@ static double ptarray_area_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa, co
 */
 double spheroid_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const SPHEROID *spheroid)
 {
-	double lambda = (b->lon - a->lon);
-	double f = spheroid->f;
-	double omf = 1 - spheroid->f;
-	double u1, u2;
-	double cos_u1, cos_u2;
-	double sin_u1, sin_u2;
-	double big_a, big_b, delta_sigma;
-	double alpha, sin_alpha, cos_alphasq, c;
-	double sigma, sin_sigma, cos_sigma, cos2_sigma_m, sqrsin_sigma, last_lambda, omega;
-	double cos_lambda, sin_lambda;
-	double distance;
-	int i = 0;
-
-	/* Same point => zero distance */
-	if ( geographic_point_equals(ctx, a, b) )
-	{
-		return 0.0;
-	}
-
-	u1 = atan(omf * tan(a->lat));
-	cos_u1 = cos(u1);
-	sin_u1 = sin(u1);
-	u2 = atan(omf * tan(b->lat));
-	cos_u2 = cos(u2);
-	sin_u2 = sin(u2);
-
-	omega = lambda;
-	do
-	{
-		cos_lambda = cos(lambda);
-		sin_lambda = sin(lambda);
-		sqrsin_sigma = POW2(cos_u2 * sin_lambda) +
-		               POW2((cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos_lambda));
-		sin_sigma = sqrt(sqrsin_sigma);
-		cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos_lambda;
-		sigma = atan2(sin_sigma, cos_sigma);
-		sin_alpha = cos_u1 * cos_u2 * sin_lambda / sin(sigma);
-
-		/* Numerical stability issue, ensure asin is not NaN */
-		if ( sin_alpha > 1.0 )
-			alpha = M_PI_2;
-		else if ( sin_alpha < -1.0 )
-			alpha = -1.0 * M_PI_2;
-		else
-			alpha = asin(sin_alpha);
-
-		cos_alphasq = POW2(cos(alpha));
-		cos2_sigma_m = cos(sigma) - (2.0 * sin_u1 * sin_u2 / cos_alphasq);
-
-		/* Numerical stability issue, cos2 is in range */
-		if ( cos2_sigma_m > 1.0 )
-			cos2_sigma_m = 1.0;
-		if ( cos2_sigma_m < -1.0 )
-			cos2_sigma_m = -1.0;
-
-		c = (f / 16.0) * cos_alphasq * (4.0 + f * (4.0 - 3.0 * cos_alphasq));
-		last_lambda = lambda;
-		lambda = omega + (1.0 - c) * f * sin(alpha) * (sigma + c * sin(sigma) *
-		         (cos2_sigma_m + c * cos(sigma) * (-1.0 + 2.0 * POW2(cos2_sigma_m))));
-		i++;
-	}
-	while ( (i < 999) && (lambda != 0.0) && (fabs((last_lambda - lambda)/lambda) > 1.0e-9) );
-
-	u2 = spheroid_mu2(ctx, alpha, spheroid);
-	big_a = spheroid_big_a(ctx, u2);
-	big_b = spheroid_big_b(ctx, u2);
-	delta_sigma = big_b * sin_sigma * (cos2_sigma_m + (big_b / 4.0) * (cos_sigma * (-1.0 + 2.0 * POW2(cos2_sigma_m)) -
-	                                   (big_b / 6.0) * cos2_sigma_m * (-3.0 + 4.0 * sqrsin_sigma) * (-3.0 + 4.0 * POW2(cos2_sigma_m))));
-
-	distance = spheroid->b * big_a * (sigma - delta_sigma);
-
-	/* Algorithm failure, distance == NaN, fallback to sphere */
-	if ( distance != distance )
-	{
-		rterror(ctx, "spheroid_distance returned NaN: (%.20g %.20g) (%.20g %.20g) a = %.20g b = %.20g",a->lat, a->lon, b->lat, b->lon, spheroid->a, spheroid->b);
-		return spheroid->radius * sphere_distance(ctx, a, b);
-	}
-
-	return distance;
+  double lambda = (b->lon - a->lon);
+  double f = spheroid->f;
+  double omf = 1 - spheroid->f;
+  double u1, u2;
+  double cos_u1, cos_u2;
+  double sin_u1, sin_u2;
+  double big_a, big_b, delta_sigma;
+  double alpha, sin_alpha, cos_alphasq, c;
+  double sigma, sin_sigma, cos_sigma, cos2_sigma_m, sqrsin_sigma, last_lambda, omega;
+  double cos_lambda, sin_lambda;
+  double distance;
+  int i = 0;
+
+  /* Same point => zero distance */
+  if ( geographic_point_equals(ctx, a, b) )
+  {
+    return 0.0;
+  }
+
+  u1 = atan(omf * tan(a->lat));
+  cos_u1 = cos(u1);
+  sin_u1 = sin(u1);
+  u2 = atan(omf * tan(b->lat));
+  cos_u2 = cos(u2);
+  sin_u2 = sin(u2);
+
+  omega = lambda;
+  do
+  {
+    cos_lambda = cos(lambda);
+    sin_lambda = sin(lambda);
+    sqrsin_sigma = POW2(cos_u2 * sin_lambda) +
+                   POW2((cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos_lambda));
+    sin_sigma = sqrt(sqrsin_sigma);
+    cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos_lambda;
+    sigma = atan2(sin_sigma, cos_sigma);
+    sin_alpha = cos_u1 * cos_u2 * sin_lambda / sin(sigma);
+
+    /* Numerical stability issue, ensure asin is not NaN */
+    if ( sin_alpha > 1.0 )
+      alpha = M_PI_2;
+    else if ( sin_alpha < -1.0 )
+      alpha = -1.0 * M_PI_2;
+    else
+      alpha = asin(sin_alpha);
+
+    cos_alphasq = POW2(cos(alpha));
+    cos2_sigma_m = cos(sigma) - (2.0 * sin_u1 * sin_u2 / cos_alphasq);
+
+    /* Numerical stability issue, cos2 is in range */
+    if ( cos2_sigma_m > 1.0 )
+      cos2_sigma_m = 1.0;
+    if ( cos2_sigma_m < -1.0 )
+      cos2_sigma_m = -1.0;
+
+    c = (f / 16.0) * cos_alphasq * (4.0 + f * (4.0 - 3.0 * cos_alphasq));
+    last_lambda = lambda;
+    lambda = omega + (1.0 - c) * f * sin(alpha) * (sigma + c * sin(sigma) *
+             (cos2_sigma_m + c * cos(sigma) * (-1.0 + 2.0 * POW2(cos2_sigma_m))));
+    i++;
+  }
+  while ( (i < 999) && (lambda != 0.0) && (fabs((last_lambda - lambda)/lambda) > 1.0e-9) );
+
+  u2 = spheroid_mu2(ctx, alpha, spheroid);
+  big_a = spheroid_big_a(ctx, u2);
+  big_b = spheroid_big_b(ctx, u2);
+  delta_sigma = big_b * sin_sigma * (cos2_sigma_m + (big_b / 4.0) * (cos_sigma * (-1.0 + 2.0 * POW2(cos2_sigma_m)) -
+                                     (big_b / 6.0) * cos2_sigma_m * (-3.0 + 4.0 * sqrsin_sigma) * (-3.0 + 4.0 * POW2(cos2_sigma_m))));
+
+  distance = spheroid->b * big_a * (sigma - delta_sigma);
+
+  /* Algorithm failure, distance == NaN, fallback to sphere */
+  if ( distance != distance )
+  {
+    rterror(ctx, "spheroid_distance returned NaN: (%.20g %.20g) (%.20g %.20g) a = %.20g b = %.20g",a->lat, a->lon, b->lat, b->lon, spheroid->a, spheroid->b);
+    return spheroid->radius * sphere_distance(ctx, a, b);
+  }
+
+  return distance;
 }
 
 /**
@@ -282,64 +282,64 @@ double spheroid_distance(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOG
 */
 double spheroid_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, const GEOGRAPHIC_POINT *s, const SPHEROID *spheroid)
 {
-	int i = 0;
-	double lambda = s->lon - r->lon;
-	double omf = 1 - spheroid->f;
-	double u1 = atan(omf * tan(r->lat));
-	double cos_u1 = cos(u1);
-	double sin_u1 = sin(u1);
-	double u2 = atan(omf * tan(s->lat));
-	double cos_u2 = cos(u2);
-	double sin_u2 = sin(u2);
-
-	double omega = lambda;
-	double alpha, sigma, sin_sigma, cos_sigma, cos2_sigma_m, sqr_sin_sigma, last_lambda;
-	double sin_alpha, cos_alphasq, C, alphaFD;
-	do
-	{
-		sqr_sin_sigma = POW2(cos_u2 * sin(lambda)) +
-		                POW2((cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos(lambda)));
-		sin_sigma = sqrt(sqr_sin_sigma);
-		cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos(lambda);
-		sigma = atan2(sin_sigma, cos_sigma);
-		sin_alpha = cos_u1 * cos_u2 * sin(lambda) / sin(sigma);
-
-		/* Numerical stability issue, ensure asin is not NaN */
-		if ( sin_alpha > 1.0 )
-			alpha = M_PI_2;
-		else if ( sin_alpha < -1.0 )
-			alpha = -1.0 * M_PI_2;
-		else
-			alpha = asin(sin_alpha);
-
-		cos_alphasq = POW2(cos(alpha));
-		cos2_sigma_m = cos(sigma) - (2.0 * sin_u1 * sin_u2 / cos_alphasq);
-
-		/* Numerical stability issue, cos2 is in range */
-		if ( cos2_sigma_m > 1.0 )
-			cos2_sigma_m = 1.0;
-		if ( cos2_sigma_m < -1.0 )
-			cos2_sigma_m = -1.0;
-
-		C = (spheroid->f / 16.0) * cos_alphasq * (4.0 + spheroid->f * (4.0 - 3.0 * cos_alphasq));
-		last_lambda = lambda;
-		lambda = omega + (1.0 - C) * spheroid->f * sin(alpha) * (sigma + C * sin(sigma) *
-		         (cos2_sigma_m + C * cos(sigma) * (-1.0 + 2.0 * POW2(cos2_sigma_m))));
-		i++;
-	}
-	while ( (i < 999) && (lambda != 0) && (fabs((last_lambda - lambda) / lambda) > 1.0e-9) );
-
-	alphaFD = atan2((cos_u2 * sin(lambda)),
-	                (cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos(lambda)));
-	if (alphaFD < 0.0)
-	{
-		alphaFD = alphaFD + 2.0 * M_PI;
-	}
-	if (alphaFD > 2.0 * M_PI)
-	{
-		alphaFD = alphaFD - 2.0 * M_PI;
-	}
-	return alphaFD;
+  int i = 0;
+  double lambda = s->lon - r->lon;
+  double omf = 1 - spheroid->f;
+  double u1 = atan(omf * tan(r->lat));
+  double cos_u1 = cos(u1);
+  double sin_u1 = sin(u1);
+  double u2 = atan(omf * tan(s->lat));
+  double cos_u2 = cos(u2);
+  double sin_u2 = sin(u2);
+
+  double omega = lambda;
+  double alpha, sigma, sin_sigma, cos_sigma, cos2_sigma_m, sqr_sin_sigma, last_lambda;
+  double sin_alpha, cos_alphasq, C, alphaFD;
+  do
+  {
+    sqr_sin_sigma = POW2(cos_u2 * sin(lambda)) +
+                    POW2((cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos(lambda)));
+    sin_sigma = sqrt(sqr_sin_sigma);
+    cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos(lambda);
+    sigma = atan2(sin_sigma, cos_sigma);
+    sin_alpha = cos_u1 * cos_u2 * sin(lambda) / sin(sigma);
+
+    /* Numerical stability issue, ensure asin is not NaN */
+    if ( sin_alpha > 1.0 )
+      alpha = M_PI_2;
+    else if ( sin_alpha < -1.0 )
+      alpha = -1.0 * M_PI_2;
+    else
+      alpha = asin(sin_alpha);
+
+    cos_alphasq = POW2(cos(alpha));
+    cos2_sigma_m = cos(sigma) - (2.0 * sin_u1 * sin_u2 / cos_alphasq);
+
+    /* Numerical stability issue, cos2 is in range */
+    if ( cos2_sigma_m > 1.0 )
+      cos2_sigma_m = 1.0;
+    if ( cos2_sigma_m < -1.0 )
+      cos2_sigma_m = -1.0;
+
+    C = (spheroid->f / 16.0) * cos_alphasq * (4.0 + spheroid->f * (4.0 - 3.0 * cos_alphasq));
+    last_lambda = lambda;
+    lambda = omega + (1.0 - C) * spheroid->f * sin(alpha) * (sigma + C * sin(sigma) *
+             (cos2_sigma_m + C * cos(sigma) * (-1.0 + 2.0 * POW2(cos2_sigma_m))));
+    i++;
+  }
+  while ( (i < 999) && (lambda != 0) && (fabs((last_lambda - lambda) / lambda) > 1.0e-9) );
+
+  alphaFD = atan2((cos_u2 * sin(lambda)),
+                  (cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos(lambda)));
+  if (alphaFD < 0.0)
+  {
+    alphaFD = alphaFD + 2.0 * M_PI;
+  }
+  if (alphaFD > 2.0 * M_PI)
+  {
+    alphaFD = alphaFD - 2.0 * M_PI;
+  }
+  return alphaFD;
 }
 
 
@@ -359,70 +359,70 @@ double spheroid_direction(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, const GEO
 */
 int spheroid_project(const RTCTX *ctx, const GEOGRAPHIC_POINT *r, const SPHEROID *spheroid, double distance, double azimuth, GEOGRAPHIC_POINT *g)
 {
-	double omf = 1 - spheroid->f;
-	double tan_u1 = omf * tan(r->lat);
-	double u1 = atan(tan_u1);
-	double sigma, last_sigma, delta_sigma, two_sigma_m;
-	double sigma1, sin_alpha, alpha, cos_alphasq;
-	double u2, A, B;
-	double lat2, lambda, lambda2, C, omega;
-	int i = 0;
-
-	if (azimuth < 0.0)
-	{
-		azimuth = azimuth + M_PI * 2.0;
-	}
-	if (azimuth > (M_PI * 2.0))
-	{
-		azimuth = azimuth - M_PI * 2.0;
-	}
-
-	sigma1 = atan2(tan_u1, cos(azimuth));
-	sin_alpha = cos(u1) * sin(azimuth);
-	alpha = asin(sin_alpha);
-	cos_alphasq = 1.0 - POW2(sin_alpha);
-
-	u2 = spheroid_mu2(ctx, alpha, spheroid);
-	A = spheroid_big_a(ctx, u2);
-	B = spheroid_big_b(ctx, u2);
-
-	sigma = (distance / (spheroid->b * A));
-	do
-	{
-		two_sigma_m = 2.0 * sigma1 + sigma;
-		delta_sigma = B * sin(sigma) * (cos(two_sigma_m) + (B / 4.0) * (cos(sigma) * (-1.0 + 2.0 * POW2(cos(two_sigma_m)) - (B / 6.0) * cos(two_sigma_m) * (-3.0 + 4.0 * POW2(sin(sigma))) * (-3.0 + 4.0 * POW2(cos(two_sigma_m))))));
-		last_sigma = sigma;
-		sigma = (distance / (spheroid->b * A)) + delta_sigma;
-		i++;
-	}
-	while (i < 999 && fabs((last_sigma - sigma) / sigma) > 1.0e-9);
-
-	lat2 = atan2((sin(u1) * cos(sigma) + cos(u1) * sin(sigma) *
-	              cos(azimuth)), (omf * sqrt(POW2(sin_alpha) +
-	                                         POW2(sin(u1) * sin(sigma) - cos(u1) * cos(sigma) *
-	                                              cos(azimuth)))));
-	lambda = atan2((sin(sigma) * sin(azimuth)), (cos(u1) * cos(sigma) -
-	               sin(u1) * sin(sigma) * cos(azimuth)));
-	C = (spheroid->f / 16.0) * cos_alphasq * (4.0 + spheroid->f * (4.0 - 3.0 * cos_alphasq));
-	omega = lambda - (1.0 - C) * spheroid->f * sin_alpha * (sigma + C * sin(sigma) *
-	        (cos(two_sigma_m) + C * cos(sigma) * (-1.0 + 2.0 * POW2(cos(two_sigma_m)))));
-	lambda2 = r->lon + omega;
-	g->lat = lat2;
-	g->lon = lambda2;
-	return RT_SUCCESS;
+  double omf = 1 - spheroid->f;
+  double tan_u1 = omf * tan(r->lat);
+  double u1 = atan(tan_u1);
+  double sigma, last_sigma, delta_sigma, two_sigma_m;
+  double sigma1, sin_alpha, alpha, cos_alphasq;
+  double u2, A, B;
+  double lat2, lambda, lambda2, C, omega;
+  int i = 0;
+
+  if (azimuth < 0.0)
+  {
+    azimuth = azimuth + M_PI * 2.0;
+  }
+  if (azimuth > (M_PI * 2.0))
+  {
+    azimuth = azimuth - M_PI * 2.0;
+  }
+
+  sigma1 = atan2(tan_u1, cos(azimuth));
+  sin_alpha = cos(u1) * sin(azimuth);
+  alpha = asin(sin_alpha);
+  cos_alphasq = 1.0 - POW2(sin_alpha);
+
+  u2 = spheroid_mu2(ctx, alpha, spheroid);
+  A = spheroid_big_a(ctx, u2);
+  B = spheroid_big_b(ctx, u2);
+
+  sigma = (distance / (spheroid->b * A));
+  do
+  {
+    two_sigma_m = 2.0 * sigma1 + sigma;
+    delta_sigma = B * sin(sigma) * (cos(two_sigma_m) + (B / 4.0) * (cos(sigma) * (-1.0 + 2.0 * POW2(cos(two_sigma_m)) - (B / 6.0) * cos(two_sigma_m) * (-3.0 + 4.0 * POW2(sin(sigma))) * (-3.0 + 4.0 * POW2(cos(two_sigma_m))))));
+    last_sigma = sigma;
+    sigma = (distance / (spheroid->b * A)) + delta_sigma;
+    i++;
+  }
+  while (i < 999 && fabs((last_sigma - sigma) / sigma) > 1.0e-9);
+
+  lat2 = atan2((sin(u1) * cos(sigma) + cos(u1) * sin(sigma) *
+                cos(azimuth)), (omf * sqrt(POW2(sin_alpha) +
+                                           POW2(sin(u1) * sin(sigma) - cos(u1) * cos(sigma) *
+                                                cos(azimuth)))));
+  lambda = atan2((sin(sigma) * sin(azimuth)), (cos(u1) * cos(sigma) -
+                 sin(u1) * sin(sigma) * cos(azimuth)));
+  C = (spheroid->f / 16.0) * cos_alphasq * (4.0 + spheroid->f * (4.0 - 3.0 * cos_alphasq));
+  omega = lambda - (1.0 - C) * spheroid->f * sin_alpha * (sigma + C * sin(sigma) *
+          (cos(two_sigma_m) + C * cos(sigma) * (-1.0 + 2.0 * POW2(cos(two_sigma_m)))));
+  lambda2 = r->lon + omega;
+  g->lat = lat2;
+  g->lon = lambda2;
+  return RT_SUCCESS;
 }
 
 
 static inline double spheroid_prime_vertical_radius_of_curvature(const RTCTX *ctx, double latitude, const SPHEROID *spheroid)
 {
-	return spheroid->a / (sqrt(1.0 - spheroid->e_sq * POW2(sin(latitude))));
+  return spheroid->a / (sqrt(1.0 - spheroid->e_sq * POW2(sin(latitude))));
 }
 
 static inline double spheroid_parallel_arc_length(const RTCTX *ctx, double latitude, double deltaLongitude, const SPHEROID *spheroid)
 {
-	return spheroid_prime_vertical_radius_of_curvature(ctx, latitude, spheroid)
-	       * cos(latitude)
-	       * deltaLongitude;
+  return spheroid_prime_vertical_radius_of_curvature(ctx, latitude, spheroid)
+         * cos(latitude)
+         * deltaLongitude;
 }
 
 
@@ -437,16 +437,16 @@ static inline double spheroid_parallel_arc_length(const RTCTX *ctx, double latit
 */
 static double spheroid_boundingbox_area(const RTCTX *ctx, const GEOGRAPHIC_POINT *southWestCorner, const GEOGRAPHIC_POINT *northEastCorner, const SPHEROID *spheroid)
 {
-	double z0 = (northEastCorner->lon - southWestCorner->lon) * POW2(spheroid->b) / 2.0;
-	double e = sqrt(spheroid->e_sq);
-	double sinPhi1 = sin(southWestCorner->lat);
-	double sinPhi2 = sin(northEastCorner->lat);
-	double t1p1 = sinPhi1 / (1.0 - spheroid->e_sq * sinPhi1 * sinPhi1);
-	double t1p2 = sinPhi2 / (1.0 - spheroid->e_sq * sinPhi2 * sinPhi2);
-	double oneOver2e = 1.0 / (2.0 * e);
-	double t2p1 = oneOver2e * log((1.0 + e * sinPhi1) / (1.0 - e * sinPhi1));
-	double t2p2 = oneOver2e * log((1.0 + e * sinPhi2) / (1.0 - e * sinPhi2));
-	return z0 * (t1p2 + t2p2) - z0 * (t1p1 + t2p1);
+  double z0 = (northEastCorner->lon - southWestCorner->lon) * POW2(spheroid->b) / 2.0;
+  double e = sqrt(spheroid->e_sq);
+  double sinPhi1 = sin(southWestCorner->lat);
+  double sinPhi2 = sin(northEastCorner->lat);
+  double t1p1 = sinPhi1 / (1.0 - spheroid->e_sq * sinPhi1 * sinPhi1);
+  double t1p2 = sinPhi2 / (1.0 - spheroid->e_sq * sinPhi2 * sinPhi2);
+  double oneOver2e = 1.0 / (2.0 * e);
+  double t2p1 = oneOver2e * log((1.0 + e * sinPhi1) / (1.0 - e * sinPhi1));
+  double t2p2 = oneOver2e * log((1.0 + e * sinPhi2) / (1.0 - e * sinPhi2));
+  return z0 * (t1p2 + t2p2) - z0 * (t1p1 + t2p1);
 }
 
 /**
@@ -455,181 +455,181 @@ static double spheroid_boundingbox_area(const RTCTX *ctx, const GEOGRAPHIC_POINT
 */
 static double spheroid_striparea(const RTCTX *ctx, const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, double latitude_min, const SPHEROID *spheroid)
 {
-	GEOGRAPHIC_POINT A, B, mL, nR;
-	double deltaLng, baseArea, topArea;
-	double bE, tE, ratio, sign;
-
-	A = *a;
-	B = *b;
-
-	mL.lat = latitude_min;
-	mL.lon = FP_MIN(A.lon, B.lon);
-	nR.lat = FP_MIN(A.lat, B.lat);
-	nR.lon = FP_MAX(A.lon, B.lon);
-	RTDEBUGF(4, "mL (%.12g %.12g)", mL.lat, mL.lon);
-	RTDEBUGF(4, "nR (%.12g %.12g)", nR.lat, nR.lon);
-	baseArea = spheroid_boundingbox_area(ctx, &mL, &nR, spheroid);
-	RTDEBUGF(4, "baseArea %.12g", baseArea);
-
-	mL.lat = FP_MIN(A.lat, B.lat);
-	mL.lon = FP_MIN(A.lon, B.lon);
-	nR.lat = FP_MAX(A.lat, B.lat);
-	nR.lon = FP_MAX(A.lon, B.lon);
-	RTDEBUGF(4, "mL (%.12g %.12g)", mL.lat, mL.lon);
-	RTDEBUGF(4, "nR (%.12g %.12g)", nR.lat, nR.lon);
-	topArea = spheroid_boundingbox_area(ctx, &mL, &nR, spheroid);
-	RTDEBUGF(4, "topArea %.12g", topArea);
-
-	deltaLng = B.lon - A.lon;
-	RTDEBUGF(4, "deltaLng %.12g", deltaLng);
-	bE = spheroid_parallel_arc_length(ctx, A.lat, deltaLng, spheroid);
-	tE = spheroid_parallel_arc_length(ctx, B.lat, deltaLng, spheroid);
-	RTDEBUGF(4, "bE %.12g", bE);
-	RTDEBUGF(4, "tE %.12g", tE);
-
-	ratio = (bE + tE)/tE;
-	sign = signum(B.lon - A.lon);
-	return (baseArea + topArea / ratio) * sign;
+  GEOGRAPHIC_POINT A, B, mL, nR;
+  double deltaLng, baseArea, topArea;
+  double bE, tE, ratio, sign;
+
+  A = *a;
+  B = *b;
+
+  mL.lat = latitude_min;
+  mL.lon = FP_MIN(A.lon, B.lon);
+  nR.lat = FP_MIN(A.lat, B.lat);
+  nR.lon = FP_MAX(A.lon, B.lon);
+  RTDEBUGF(4, "mL (%.12g %.12g)", mL.lat, mL.lon);
+  RTDEBUGF(4, "nR (%.12g %.12g)", nR.lat, nR.lon);
+  baseArea = spheroid_boundingbox_area(ctx, &mL, &nR, spheroid);
+  RTDEBUGF(4, "baseArea %.12g", baseArea);
+
+  mL.lat = FP_MIN(A.lat, B.lat);
+  mL.lon = FP_MIN(A.lon, B.lon);
+  nR.lat = FP_MAX(A.lat, B.lat);
+  nR.lon = FP_MAX(A.lon, B.lon);
+  RTDEBUGF(4, "mL (%.12g %.12g)", mL.lat, mL.lon);
+  RTDEBUGF(4, "nR (%.12g %.12g)", nR.lat, nR.lon);
+  topArea = spheroid_boundingbox_area(ctx, &mL, &nR, spheroid);
+  RTDEBUGF(4, "topArea %.12g", topArea);
+
+  deltaLng = B.lon - A.lon;
+  RTDEBUGF(4, "deltaLng %.12g", deltaLng);
+  bE = spheroid_parallel_arc_length(ctx, A.lat, deltaLng, spheroid);
+  tE = spheroid_parallel_arc_length(ctx, B.lat, deltaLng, spheroid);
+  RTDEBUGF(4, "bE %.12g", bE);
+  RTDEBUGF(4, "tE %.12g", tE);
+
+  ratio = (bE + tE)/tE;
+  sign = signum(B.lon - A.lon);
+  return (baseArea + topArea / ratio) * sign;
 }
 
 static double ptarray_area_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa, const SPHEROID *spheroid)
 {
-	GEOGRAPHIC_POINT a, b;
-	RTPOINT2D p;
-	int i;
-	double area = 0.0;
-	RTGBOX gbox2d;
-	int in_south = RT_FALSE;
-	double delta_lon_tolerance;
-	double latitude_min;
-
-	gbox2d.flags = gflags(ctx, 0, 0, 0);
-
-	/* Return zero on non-sensical inputs */
-	if ( ! pa || pa->npoints < 4 )
-		return 0.0;
-
-	/* Get the raw min/max values for the latitudes */
-	ptarray_calculate_gbox_cartesian(ctx, pa, &gbox2d);
-
-	if ( signum(gbox2d.ymin) != signum(gbox2d.ymax) )
-		rterror(ctx, "ptarray_area_spheroid: cannot handle ptarray that crosses equator");
-
-	/* Geodetic bbox < 0.0 implies geometry is entirely in southern hemisphere */
-	if ( gbox2d.ymax < 0.0 )
-		in_south = RT_TRUE;
-
-	RTDEBUGF(4, "gbox2d.ymax %.12g", gbox2d.ymax);
-
-	/* Tolerance for strip area calculation */
-	if ( in_south )
-	{
-		delta_lon_tolerance = (90.0 / (fabs(gbox2d.ymin) / 8.0) - 2.0) / 10000.0;
-		latitude_min = deg2rad(fabs(gbox2d.ymax));
-	}
-	else
-	{
-		delta_lon_tolerance = (90.0 / (fabs(gbox2d.ymax) / 8.0) - 2.0) / 10000.0;
-		latitude_min = deg2rad(gbox2d.ymin);
-	}
-
-	/* Initialize first point */
-	rt_getPoint2d_p(ctx, pa, 0, &p);
-	geographic_point_init(ctx, p.x, p.y, &a);
-
-	for ( i = 1; i < pa->npoints; i++ )
-	{
-		GEOGRAPHIC_POINT a1, b1;
-		double strip_area = 0.0;
-		double delta_lon = 0.0;
-		RTDEBUGF(4, "edge #%d", i);
-
-		rt_getPoint2d_p(ctx, pa, i, &p);
-		geographic_point_init(ctx, p.x, p.y, &b);
-
-		a1 = a;
-		b1 = b;
-
-		/* Flip into north if in south */
-		if ( in_south )
-		{
-			a1.lat = -1.0 * a1.lat;
-			b1.lat = -1.0 * b1.lat;
-		}
-
-		RTDEBUGF(4, "in_south %d", in_south);
-
-		RTDEBUGF(4, "crosses_dateline(ctx, a, b) %d", crosses_dateline(ctx, &a, &b) );
-
-		if ( crosses_dateline(ctx, &a, &b) )
-		{
-			double shift;
-
-			if ( a1.lon > 0.0 )
-				shift = (M_PI - a1.lon) + 0.088; /* About 5deg more */
-			else
-				shift = (M_PI - b1.lon) + 0.088; /* About 5deg more */
-
-			RTDEBUGF(4, "shift: %.8g", shift);
-			RTDEBUGF(4, "before shift a1(%.8g %.8g) b1(%.8g %.8g)", a1.lat, a1.lon, b1.lat, b1.lon);
-			point_shift(ctx, &a1, shift);
-			point_shift(ctx, &b1, shift);
-			RTDEBUGF(4, "after shift a1(%.8g %.8g) b1(%.8g %.8g)", a1.lat, a1.lon, b1.lat, b1.lon);
-
-		}
-
-
-		delta_lon = fabs(b1.lon - a1.lon);
-
-		RTDEBUGF(4, "a1(%.18g %.18g) b1(%.18g %.18g)", a1.lat, a1.lon, b1.lat, b1.lon);
-		RTDEBUGF(4, "delta_lon %.18g", delta_lon);
-		RTDEBUGF(4, "delta_lon_tolerance %.18g", delta_lon_tolerance);
-
-		if ( delta_lon > 0.0 )
-		{
-			if ( delta_lon < delta_lon_tolerance )
-			{
-				strip_area = spheroid_striparea(ctx, &a1, &b1, latitude_min, spheroid);
-				RTDEBUGF(4, "strip_area %.12g", strip_area);
-				area += strip_area;
-			}
-			else
-			{
-				GEOGRAPHIC_POINT p, q;
-				double step = floor(delta_lon / delta_lon_tolerance);
-				double distance = spheroid_distance(ctx, &a1, &b1, spheroid);
-				double pDistance = 0.0;
-				int j = 0;
-				RTDEBUGF(4, "step %.18g", step);
-				RTDEBUGF(4, "distance %.18g", distance);
-				step = distance / step;
-				RTDEBUGF(4, "step %.18g", step);
-				p = a1;
-				while (pDistance < (distance - step * 1.01))
-				{
-					double azimuth = spheroid_direction(ctx, &p, &b1, spheroid);
-					j++;
-					RTDEBUGF(4, "  iteration %d", j);
-					RTDEBUGF(4, "  azimuth %.12g", azimuth);
-					pDistance = pDistance + step;
-					RTDEBUGF(4, "  pDistance %.12g", pDistance);
-					spheroid_project(ctx, &p, spheroid, step, azimuth, &q);
-					strip_area = spheroid_striparea(ctx, &p, &q, latitude_min, spheroid);
-					RTDEBUGF(4, "  strip_area %.12g", strip_area);
-					area += strip_area;
-					RTDEBUGF(4, "  area %.12g", area);
-					p.lat = q.lat;
-					p.lon = q.lon;
-				}
-				strip_area = spheroid_striparea(ctx, &p, &b1, latitude_min, spheroid);
-				area += strip_area;
-			}
-		}
-
-		/* B gets incremented in the next loop, so we save the value here */
-		a = b;
-	}
-	return fabs(area);
+  GEOGRAPHIC_POINT a, b;
+  RTPOINT2D p;
+  int i;
+  double area = 0.0;
+  RTGBOX gbox2d;
+  int in_south = RT_FALSE;
+  double delta_lon_tolerance;
+  double latitude_min;
+
+  gbox2d.flags = gflags(ctx, 0, 0, 0);
+
+  /* Return zero on non-sensical inputs */
+  if ( ! pa || pa->npoints < 4 )
+    return 0.0;
+
+  /* Get the raw min/max values for the latitudes */
+  ptarray_calculate_gbox_cartesian(ctx, pa, &gbox2d);
+
+  if ( signum(gbox2d.ymin) != signum(gbox2d.ymax) )
+    rterror(ctx, "ptarray_area_spheroid: cannot handle ptarray that crosses equator");
+
+  /* Geodetic bbox < 0.0 implies geometry is entirely in southern hemisphere */
+  if ( gbox2d.ymax < 0.0 )
+    in_south = RT_TRUE;
+
+  RTDEBUGF(4, "gbox2d.ymax %.12g", gbox2d.ymax);
+
+  /* Tolerance for strip area calculation */
+  if ( in_south )
+  {
+    delta_lon_tolerance = (90.0 / (fabs(gbox2d.ymin) / 8.0) - 2.0) / 10000.0;
+    latitude_min = deg2rad(fabs(gbox2d.ymax));
+  }
+  else
+  {
+    delta_lon_tolerance = (90.0 / (fabs(gbox2d.ymax) / 8.0) - 2.0) / 10000.0;
+    latitude_min = deg2rad(gbox2d.ymin);
+  }
+
+  /* Initialize first point */
+  rt_getPoint2d_p(ctx, pa, 0, &p);
+  geographic_point_init(ctx, p.x, p.y, &a);
+
+  for ( i = 1; i < pa->npoints; i++ )
+  {
+    GEOGRAPHIC_POINT a1, b1;
+    double strip_area = 0.0;
+    double delta_lon = 0.0;
+    RTDEBUGF(4, "edge #%d", i);
+
+    rt_getPoint2d_p(ctx, pa, i, &p);
+    geographic_point_init(ctx, p.x, p.y, &b);
+
+    a1 = a;
+    b1 = b;
+
+    /* Flip into north if in south */
+    if ( in_south )
+    {
+      a1.lat = -1.0 * a1.lat;
+      b1.lat = -1.0 * b1.lat;
+    }
+
+    RTDEBUGF(4, "in_south %d", in_south);
+
+    RTDEBUGF(4, "crosses_dateline(ctx, a, b) %d", crosses_dateline(ctx, &a, &b) );
+
+    if ( crosses_dateline(ctx, &a, &b) )
+    {
+      double shift;
+
+      if ( a1.lon > 0.0 )
+        shift = (M_PI - a1.lon) + 0.088; /* About 5deg more */
+      else
+        shift = (M_PI - b1.lon) + 0.088; /* About 5deg more */
+
+      RTDEBUGF(4, "shift: %.8g", shift);
+      RTDEBUGF(4, "before shift a1(%.8g %.8g) b1(%.8g %.8g)", a1.lat, a1.lon, b1.lat, b1.lon);
+      point_shift(ctx, &a1, shift);
+      point_shift(ctx, &b1, shift);
+      RTDEBUGF(4, "after shift a1(%.8g %.8g) b1(%.8g %.8g)", a1.lat, a1.lon, b1.lat, b1.lon);
+
+    }
+
+
+    delta_lon = fabs(b1.lon - a1.lon);
+
+    RTDEBUGF(4, "a1(%.18g %.18g) b1(%.18g %.18g)", a1.lat, a1.lon, b1.lat, b1.lon);
+    RTDEBUGF(4, "delta_lon %.18g", delta_lon);
+    RTDEBUGF(4, "delta_lon_tolerance %.18g", delta_lon_tolerance);
+
+    if ( delta_lon > 0.0 )
+    {
+      if ( delta_lon < delta_lon_tolerance )
+      {
+        strip_area = spheroid_striparea(ctx, &a1, &b1, latitude_min, spheroid);
+        RTDEBUGF(4, "strip_area %.12g", strip_area);
+        area += strip_area;
+      }
+      else
+      {
+        GEOGRAPHIC_POINT p, q;
+        double step = floor(delta_lon / delta_lon_tolerance);
+        double distance = spheroid_distance(ctx, &a1, &b1, spheroid);
+        double pDistance = 0.0;
+        int j = 0;
+        RTDEBUGF(4, "step %.18g", step);
+        RTDEBUGF(4, "distance %.18g", distance);
+        step = distance / step;
+        RTDEBUGF(4, "step %.18g", step);
+        p = a1;
+        while (pDistance < (distance - step * 1.01))
+        {
+          double azimuth = spheroid_direction(ctx, &p, &b1, spheroid);
+          j++;
+          RTDEBUGF(4, "  iteration %d", j);
+          RTDEBUGF(4, "  azimuth %.12g", azimuth);
+          pDistance = pDistance + step;
+          RTDEBUGF(4, "  pDistance %.12g", pDistance);
+          spheroid_project(ctx, &p, spheroid, step, azimuth, &q);
+          strip_area = spheroid_striparea(ctx, &p, &q, latitude_min, spheroid);
+          RTDEBUGF(4, "  strip_area %.12g", strip_area);
+          area += strip_area;
+          RTDEBUGF(4, "  area %.12g", area);
+          p.lat = q.lat;
+          p.lon = q.lon;
+        }
+        strip_area = spheroid_striparea(ctx, &p, &b1, latitude_min, spheroid);
+        area += strip_area;
+      }
+    }
+
+    /* B gets incremented in the next loop, so we save the value here */
+    a = b;
+  }
+  return fabs(area);
 }
 #endif /* else ! PROJ_GEODESIC */
 
@@ -642,59 +642,59 @@ static double ptarray_area_spheroid(const RTCTX *ctx, const RTPOINTARRAY *pa, co
 */
 double rtgeom_area_spheroid(const RTCTX *ctx, const RTGEOM *rtgeom, const SPHEROID *spheroid)
 {
-	int type;
-
-	assert(rtgeom);
-
-	/* No area in nothing */
-	if ( rtgeom_is_empty(ctx, rtgeom) )
-		return 0.0;
-
-	/* Read the geometry type number */
-	type = rtgeom->type;
-
-	/* Anything but polygons and collections returns zero */
-	if ( ! ( type == RTPOLYGONTYPE || type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE ) )
-		return 0.0;
-
-	/* Actually calculate area */
-	if ( type == RTPOLYGONTYPE )
-	{
-		RTPOLY *poly = (RTPOLY*)rtgeom;
-		int i;
-		double area = 0.0;
-
-		/* Just in case there's no rings */
-		if ( poly->nrings < 1 )
-			return 0.0;
-
-		/* First, the area of the outer ring */
-		area += ptarray_area_spheroid(ctx, poly->rings[0], spheroid);
-
-		/* Subtract areas of inner rings */
-		for ( i = 1; i < poly->nrings; i++ )
-		{
-			area -=  ptarray_area_spheroid(ctx, poly->rings[i], spheroid);
-		}
-		return area;
-	}
-
-	/* Recurse into sub-geometries to get area */
-	if ( type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE )
-	{
-		RTCOLLECTION *col = (RTCOLLECTION*)rtgeom;
-		int i;
-		double area = 0.0;
-
-		for ( i = 0; i < col->ngeoms; i++ )
-		{
-			area += rtgeom_area_spheroid(ctx, col->geoms[i], spheroid);
-		}
-		return area;
-	}
-
-	/* Shouldn't get here. */
-	return 0.0;
+  int type;
+
+  assert(rtgeom);
+
+  /* No area in nothing */
+  if ( rtgeom_is_empty(ctx, rtgeom) )
+    return 0.0;
+
+  /* Read the geometry type number */
+  type = rtgeom->type;
+
+  /* Anything but polygons and collections returns zero */
+  if ( ! ( type == RTPOLYGONTYPE || type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE ) )
+    return 0.0;
+
+  /* Actually calculate area */
+  if ( type == RTPOLYGONTYPE )
+  {
+    RTPOLY *poly = (RTPOLY*)rtgeom;
+    int i;
+    double area = 0.0;
+
+    /* Just in case there's no rings */
+    if ( poly->nrings < 1 )
+      return 0.0;
+
+    /* First, the area of the outer ring */
+    area += ptarray_area_spheroid(ctx, poly->rings[0], spheroid);
+
+    /* Subtract areas of inner rings */
+    for ( i = 1; i < poly->nrings; i++ )
+    {
+      area -=  ptarray_area_spheroid(ctx, poly->rings[i], spheroid);
+    }
+    return area;
+  }
+
+  /* Recurse into sub-geometries to get area */
+  if ( type == RTMULTIPOLYGONTYPE || type == RTCOLLECTIONTYPE )
+  {
+    RTCOLLECTION *col = (RTCOLLECTION*)rtgeom;
+    int i;
+    double area = 0.0;
+
+    for ( i = 0; i < col->ngeoms; i++ )
+    {
+      area += rtgeom_area_spheroid(ctx, col->geoms[i], spheroid);
+    }
+    return area;
+  }
+
+  /* Shouldn't get here. */
+  return 0.0;
 }
 
 
diff --git a/src/rtstroke.c b/src/rtstroke.c
index a67afc7..2ce0826 100644
--- a/src/rtstroke.c
+++ b/src/rtstroke.c
@@ -55,35 +55,35 @@ RTGEOM* rtgeom_unstroke(const RTCTX *ctx, const RTGEOM *geom);
 int
 rtgeom_has_arc(const RTCTX *ctx, const RTGEOM *geom)
 {
-	RTCOLLECTION *col;
-	int i;
-
-	RTDEBUG(2, "rtgeom_has_arc called.");
-
-	switch (geom->type)
-	{
-	case RTPOINTTYPE:
-	case RTLINETYPE:
-	case RTPOLYGONTYPE:
-	case RTTRIANGLETYPE:
-	case RTMULTIPOINTTYPE:
-	case RTMULTILINETYPE:
-	case RTMULTIPOLYGONTYPE:
-	case RTPOLYHEDRALSURFACETYPE:
-	case RTTINTYPE:
-		return RT_FALSE;
-	case RTCIRCSTRINGTYPE:
-		return RT_TRUE;
-	/* It's a collection that MAY contain an arc */
-	default:
-		col = (RTCOLLECTION *)geom;
-		for (i=0; i<col->ngeoms; i++)
-		{
-			if (rtgeom_has_arc(ctx, col->geoms[i]) == RT_TRUE) 
-				return RT_TRUE;
-		}
-		return RT_FALSE;
-	}
+  RTCOLLECTION *col;
+  int i;
+
+  RTDEBUG(2, "rtgeom_has_arc called.");
+
+  switch (geom->type)
+  {
+  case RTPOINTTYPE:
+  case RTLINETYPE:
+  case RTPOLYGONTYPE:
+  case RTTRIANGLETYPE:
+  case RTMULTIPOINTTYPE:
+  case RTMULTILINETYPE:
+  case RTMULTIPOLYGONTYPE:
+  case RTPOLYHEDRALSURFACETYPE:
+  case RTTINTYPE:
+    return RT_FALSE;
+  case RTCIRCSTRINGTYPE:
+    return RT_TRUE;
+  /* It's a collection that MAY contain an arc */
+  default:
+    col = (RTCOLLECTION *)geom;
+    for (i=0; i<col->ngeoms; i++)
+    {
+      if (rtgeom_has_arc(ctx, col->geoms[i]) == RT_TRUE)
+        return RT_TRUE;
+    }
+    return RT_FALSE;
+  }
 }
 
 
@@ -94,395 +94,395 @@ rtgeom_has_arc(const RTCTX *ctx, const RTGEOM *geom)
 
 static double interpolate_arc(const RTCTX *ctx, double angle, double a1, double a2, double a3, double zm1, double zm2, double zm3)
 {
-	RTDEBUGF(4,"angle %.05g a1 %.05g a2 %.05g a3 %.05g zm1 %.05g zm2 %.05g zm3 %.05g",angle,a1,a2,a3,zm1,zm2,zm3);
-	/* Counter-clockwise sweep */
-	if ( a1 < a2 )
-	{
-		if ( angle <= a2 )
-			return zm1 + (zm2-zm1) * (angle-a1) / (a2-a1);
-		else
-			return zm2 + (zm3-zm2) * (angle-a2) / (a3-a2);
-	}
-	/* Clockwise sweep */
-	else
-	{
-		if ( angle >= a2 )
-			return zm1 + (zm2-zm1) * (a1-angle) / (a1-a2);
-		else
-			return zm2 + (zm3-zm2) * (a2-angle) / (a2-a3);
-	}
+  RTDEBUGF(4,"angle %.05g a1 %.05g a2 %.05g a3 %.05g zm1 %.05g zm2 %.05g zm3 %.05g",angle,a1,a2,a3,zm1,zm2,zm3);
+  /* Counter-clockwise sweep */
+  if ( a1 < a2 )
+  {
+    if ( angle <= a2 )
+      return zm1 + (zm2-zm1) * (angle-a1) / (a2-a1);
+    else
+      return zm2 + (zm3-zm2) * (angle-a2) / (a3-a2);
+  }
+  /* Clockwise sweep */
+  else
+  {
+    if ( angle >= a2 )
+      return zm1 + (zm2-zm1) * (a1-angle) / (a1-a2);
+    else
+      return zm2 + (zm3-zm2) * (a2-angle) / (a2-a3);
+  }
 }
 
 static RTPOINTARRAY *
 rtcircle_stroke(const RTCTX *ctx, const RTPOINT4D *p1, const RTPOINT4D *p2, const RTPOINT4D *p3, uint32_t perQuad)
 {
-	RTPOINT2D center;
-	RTPOINT2D *t1 = (RTPOINT2D*)p1;
-	RTPOINT2D *t2 = (RTPOINT2D*)p2;
-	RTPOINT2D *t3 = (RTPOINT2D*)p3;
-	RTPOINT4D pt;
-	int p2_side = 0;
-	int clockwise = RT_TRUE;
-	double radius; /* Arc radius */
-	double increment; /* Angle per segment */
-	double a1, a2, a3, angle;
-	RTPOINTARRAY *pa;
-	int is_circle = RT_FALSE;
-
-	RTDEBUG(2, "rtcircle_calculate_gbox called.");
-
-	radius = rt_arc_center(ctx, t1, t2, t3, &center);
-	p2_side = rt_segment_side(ctx, t1, t3, t2);
-
-	/* Matched start/end points imply circle */
-	if ( p1->x == p3->x && p1->y == p3->y )
-		is_circle = RT_TRUE;
-	
-	/* Negative radius signals straight line, p1/p2/p3 are colinear */
-	if ( (radius < 0.0 || p2_side == 0) && ! is_circle )
-	    return NULL;
-		
-	/* The side of the p1/p3 line that p2 falls on dictates the sweep  
-	   direction from p1 to p3. */
-	if ( p2_side == -1 )
-		clockwise = RT_TRUE;
-	else
-		clockwise = RT_FALSE;
-		
-	increment = fabs(M_PI_2 / perQuad);
-	
-	/* Angles of each point that defines the arc section */
-	a1 = atan2(p1->y - center.y, p1->x - center.x);
-	a2 = atan2(p2->y - center.y, p2->x - center.x);
-	a3 = atan2(p3->y - center.y, p3->x - center.x);
-
-	/* p2 on left side => clockwise sweep */
-	if ( clockwise )
-	{
-		increment *= -1;
-		/* Adjust a3 down so we can decrement from a1 to a3 cleanly */
-		if ( a3 > a1 )
-			a3 -= 2.0 * M_PI;
-		if ( a2 > a1 )
-			a2 -= 2.0 * M_PI;
-	}
-	/* p2 on right side => counter-clockwise sweep */
-	else
-	{
-		/* Adjust a3 up so we can increment from a1 to a3 cleanly */
-		if ( a3 < a1 )
-			a3 += 2.0 * M_PI;
-		if ( a2 < a1 )
-			a2 += 2.0 * M_PI;
-	}
-	
-	/* Override angles for circle case */
-	if( is_circle )
-	{
-		a3 = a1 + 2.0 * M_PI;
-		a2 = a1 + M_PI;
-		increment = fabs(increment);
-		clockwise = RT_FALSE;
-	}
-	
-	/* Initialize point array */
-	pa = ptarray_construct_empty(ctx, 1, 1, 32);
-
-	/* Sweep from a1 to a3 */
-	ptarray_append_point(ctx, pa, p1, RT_FALSE);
-	for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment ) 
-	{
-		pt.x = center.x + radius * cos(angle);
-		pt.y = center.y + radius * sin(angle);
-		pt.z = interpolate_arc(ctx, angle, a1, a2, a3, p1->z, p2->z, p3->z);
-		pt.m = interpolate_arc(ctx, angle, a1, a2, a3, p1->m, p2->m, p3->m);
-		ptarray_append_point(ctx, pa, &pt, RT_FALSE);
-	}	
-	return pa;
+  RTPOINT2D center;
+  RTPOINT2D *t1 = (RTPOINT2D*)p1;
+  RTPOINT2D *t2 = (RTPOINT2D*)p2;
+  RTPOINT2D *t3 = (RTPOINT2D*)p3;
+  RTPOINT4D pt;
+  int p2_side = 0;
+  int clockwise = RT_TRUE;
+  double radius; /* Arc radius */
+  double increment; /* Angle per segment */
+  double a1, a2, a3, angle;
+  RTPOINTARRAY *pa;
+  int is_circle = RT_FALSE;
+
+  RTDEBUG(2, "rtcircle_calculate_gbox called.");
+
+  radius = rt_arc_center(ctx, t1, t2, t3, &center);
+  p2_side = rt_segment_side(ctx, t1, t3, t2);
+
+  /* Matched start/end points imply circle */
+  if ( p1->x == p3->x && p1->y == p3->y )
+    is_circle = RT_TRUE;
+
+  /* Negative radius signals straight line, p1/p2/p3 are colinear */
+  if ( (radius < 0.0 || p2_side == 0) && ! is_circle )
+      return NULL;
+
+  /* The side of the p1/p3 line that p2 falls on dictates the sweep
+     direction from p1 to p3. */
+  if ( p2_side == -1 )
+    clockwise = RT_TRUE;
+  else
+    clockwise = RT_FALSE;
+
+  increment = fabs(M_PI_2 / perQuad);
+
+  /* Angles of each point that defines the arc section */
+  a1 = atan2(p1->y - center.y, p1->x - center.x);
+  a2 = atan2(p2->y - center.y, p2->x - center.x);
+  a3 = atan2(p3->y - center.y, p3->x - center.x);
+
+  /* p2 on left side => clockwise sweep */
+  if ( clockwise )
+  {
+    increment *= -1;
+    /* Adjust a3 down so we can decrement from a1 to a3 cleanly */
+    if ( a3 > a1 )
+      a3 -= 2.0 * M_PI;
+    if ( a2 > a1 )
+      a2 -= 2.0 * M_PI;
+  }
+  /* p2 on right side => counter-clockwise sweep */
+  else
+  {
+    /* Adjust a3 up so we can increment from a1 to a3 cleanly */
+    if ( a3 < a1 )
+      a3 += 2.0 * M_PI;
+    if ( a2 < a1 )
+      a2 += 2.0 * M_PI;
+  }
+
+  /* Override angles for circle case */
+  if( is_circle )
+  {
+    a3 = a1 + 2.0 * M_PI;
+    a2 = a1 + M_PI;
+    increment = fabs(increment);
+    clockwise = RT_FALSE;
+  }
+
+  /* Initialize point array */
+  pa = ptarray_construct_empty(ctx, 1, 1, 32);
+
+  /* Sweep from a1 to a3 */
+  ptarray_append_point(ctx, pa, p1, RT_FALSE);
+  for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment )
+  {
+    pt.x = center.x + radius * cos(angle);
+    pt.y = center.y + radius * sin(angle);
+    pt.z = interpolate_arc(ctx, angle, a1, a2, a3, p1->z, p2->z, p3->z);
+    pt.m = interpolate_arc(ctx, angle, a1, a2, a3, p1->m, p2->m, p3->m);
+    ptarray_append_point(ctx, pa, &pt, RT_FALSE);
+  }
+  return pa;
 }
 
 RTLINE *
 rtcircstring_stroke(const RTCTX *ctx, const RTCIRCSTRING *icurve, uint32_t perQuad)
 {
-	RTLINE *oline;
-	RTPOINTARRAY *ptarray;
-	RTPOINTARRAY *tmp;
-	uint32_t i, j;
-	RTPOINT4D p1, p2, p3, p4;
-
-	RTDEBUGF(2, "rtcircstring_stroke called., dim = %d", icurve->points->flags);
-
-	ptarray = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(icurve->points->flags), RTFLAGS_GET_M(icurve->points->flags), 64);
-
-	for (i = 2; i < icurve->points->npoints; i+=2)
-	{
-		RTDEBUGF(3, "rtcircstring_stroke: arc ending at point %d", i);
-
-		rt_getPoint4d_p(ctx, icurve->points, i - 2, &p1);
-		rt_getPoint4d_p(ctx, icurve->points, i - 1, &p2);
-		rt_getPoint4d_p(ctx, icurve->points, i, &p3);
-		tmp = rtcircle_stroke(ctx, &p1, &p2, &p3, perQuad);
-
-		if (tmp)
-		{
-			RTDEBUGF(3, "rtcircstring_stroke: generated %d points", tmp->npoints);
-
-			for (j = 0; j < tmp->npoints; j++)
-			{
-				rt_getPoint4d_p(ctx, tmp, j, &p4);
-				ptarray_append_point(ctx, ptarray, &p4, RT_TRUE);
-			}
-			ptarray_free(ctx, tmp);
-		}
-		else
-		{
-			RTDEBUG(3, "rtcircstring_stroke: points are colinear, returning curve points as line");
-
-			for (j = i - 2 ; j < i ; j++)
-			{
-				rt_getPoint4d_p(ctx, icurve->points, j, &p4);
-				ptarray_append_point(ctx, ptarray, &p4, RT_TRUE);
-			}
-		}
-
-	}
-	rt_getPoint4d_p(ctx, icurve->points, icurve->points->npoints-1, &p1);
-	ptarray_append_point(ctx, ptarray, &p1, RT_TRUE);
-		
-	oline = rtline_construct(ctx, icurve->srid, NULL, ptarray);
-	return oline;
+  RTLINE *oline;
+  RTPOINTARRAY *ptarray;
+  RTPOINTARRAY *tmp;
+  uint32_t i, j;
+  RTPOINT4D p1, p2, p3, p4;
+
+  RTDEBUGF(2, "rtcircstring_stroke called., dim = %d", icurve->points->flags);
+
+  ptarray = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(icurve->points->flags), RTFLAGS_GET_M(icurve->points->flags), 64);
+
+  for (i = 2; i < icurve->points->npoints; i+=2)
+  {
+    RTDEBUGF(3, "rtcircstring_stroke: arc ending at point %d", i);
+
+    rt_getPoint4d_p(ctx, icurve->points, i - 2, &p1);
+    rt_getPoint4d_p(ctx, icurve->points, i - 1, &p2);
+    rt_getPoint4d_p(ctx, icurve->points, i, &p3);
+    tmp = rtcircle_stroke(ctx, &p1, &p2, &p3, perQuad);
+
+    if (tmp)
+    {
+      RTDEBUGF(3, "rtcircstring_stroke: generated %d points", tmp->npoints);
+
+      for (j = 0; j < tmp->npoints; j++)
+      {
+        rt_getPoint4d_p(ctx, tmp, j, &p4);
+        ptarray_append_point(ctx, ptarray, &p4, RT_TRUE);
+      }
+      ptarray_free(ctx, tmp);
+    }
+    else
+    {
+      RTDEBUG(3, "rtcircstring_stroke: points are colinear, returning curve points as line");
+
+      for (j = i - 2 ; j < i ; j++)
+      {
+        rt_getPoint4d_p(ctx, icurve->points, j, &p4);
+        ptarray_append_point(ctx, ptarray, &p4, RT_TRUE);
+      }
+    }
+
+  }
+  rt_getPoint4d_p(ctx, icurve->points, icurve->points->npoints-1, &p1);
+  ptarray_append_point(ctx, ptarray, &p1, RT_TRUE);
+
+  oline = rtline_construct(ctx, icurve->srid, NULL, ptarray);
+  return oline;
 }
 
 RTLINE *
 rtcompound_stroke(const RTCTX *ctx, const RTCOMPOUND *icompound, uint32_t perQuad)
 {
-	RTGEOM *geom;
-	RTPOINTARRAY *ptarray = NULL, *ptarray_out = NULL;
-	RTLINE *tmp = NULL;
-	uint32_t i, j;
-	RTPOINT4D p;
-
-	RTDEBUG(2, "rtcompound_stroke called.");
-
-	ptarray = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(icompound->flags), RTFLAGS_GET_M(icompound->flags), 64);
-
-	for (i = 0; i < icompound->ngeoms; i++)
-	{
-		geom = icompound->geoms[i];
-		if (geom->type == RTCIRCSTRINGTYPE)
-		{
-			tmp = rtcircstring_stroke(ctx, (RTCIRCSTRING *)geom, perQuad);
-			for (j = 0; j < tmp->points->npoints; j++)
-			{
-				rt_getPoint4d_p(ctx, tmp->points, j, &p);
-				ptarray_append_point(ctx, ptarray, &p, RT_TRUE);
-			}
-			rtline_free(ctx, tmp);
-		}
-		else if (geom->type == RTLINETYPE)
-		{
-			tmp = (RTLINE *)geom;
-			for (j = 0; j < tmp->points->npoints; j++)
-			{
-				rt_getPoint4d_p(ctx, tmp->points, j, &p);
-				ptarray_append_point(ctx, ptarray, &p, RT_TRUE);
-			}
-		}
-		else
-		{
-			rterror(ctx, "Unsupported geometry type %d found.",
-			        geom->type, rttype_name(ctx, geom->type));
-			return NULL;
-		}
-	}
-	ptarray_out = ptarray_remove_repeated_points(ctx, ptarray, 0.0);
-	ptarray_free(ctx, ptarray);
-	return rtline_construct(ctx, icompound->srid, NULL, ptarray_out);
+  RTGEOM *geom;
+  RTPOINTARRAY *ptarray = NULL, *ptarray_out = NULL;
+  RTLINE *tmp = NULL;
+  uint32_t i, j;
+  RTPOINT4D p;
+
+  RTDEBUG(2, "rtcompound_stroke called.");
+
+  ptarray = ptarray_construct_empty(ctx, RTFLAGS_GET_Z(icompound->flags), RTFLAGS_GET_M(icompound->flags), 64);
+
+  for (i = 0; i < icompound->ngeoms; i++)
+  {
+    geom = icompound->geoms[i];
+    if (geom->type == RTCIRCSTRINGTYPE)
+    {
+      tmp = rtcircstring_stroke(ctx, (RTCIRCSTRING *)geom, perQuad);
+      for (j = 0; j < tmp->points->npoints; j++)
+      {
+        rt_getPoint4d_p(ctx, tmp->points, j, &p);
+        ptarray_append_point(ctx, ptarray, &p, RT_TRUE);
+      }
+      rtline_free(ctx, tmp);
+    }
+    else if (geom->type == RTLINETYPE)
+    {
+      tmp = (RTLINE *)geom;
+      for (j = 0; j < tmp->points->npoints; j++)
+      {
+        rt_getPoint4d_p(ctx, tmp->points, j, &p);
+        ptarray_append_point(ctx, ptarray, &p, RT_TRUE);
+      }
+    }
+    else
+    {
+      rterror(ctx, "Unsupported geometry type %d found.",
+              geom->type, rttype_name(ctx, geom->type));
+      return NULL;
+    }
+  }
+  ptarray_out = ptarray_remove_repeated_points(ctx, ptarray, 0.0);
+  ptarray_free(ctx, ptarray);
+  return rtline_construct(ctx, icompound->srid, NULL, ptarray_out);
 }
 
 RTPOLY *
 rtcurvepoly_stroke(const RTCTX *ctx, const RTCURVEPOLY *curvepoly, uint32_t perQuad)
 {
-	RTPOLY *ogeom;
-	RTGEOM *tmp;
-	RTLINE *line;
-	RTPOINTARRAY **ptarray;
-	int i;
-
-	RTDEBUG(2, "rtcurvepoly_stroke called.");
-
-	ptarray = rtalloc(ctx, sizeof(RTPOINTARRAY *)*curvepoly->nrings);
-
-	for (i = 0; i < curvepoly->nrings; i++)
-	{
-		tmp = curvepoly->rings[i];
-		if (tmp->type == RTCIRCSTRINGTYPE)
-		{
-			line = rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
-			ptarray[i] = ptarray_clone_deep(ctx, line->points);
-			rtline_free(ctx, line);
-		}
-		else if (tmp->type == RTLINETYPE)
-		{
-			line = (RTLINE *)tmp;
-			ptarray[i] = ptarray_clone_deep(ctx, line->points);
-		}
-		else if (tmp->type == RTCOMPOUNDTYPE)
-		{
-			line = rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
-			ptarray[i] = ptarray_clone_deep(ctx, line->points);
-			rtline_free(ctx, line);
-		}
-		else
-		{
-			rterror(ctx, "Invalid ring type found in CurvePoly.");
-			return NULL;
-		}
-	}
-
-	ogeom = rtpoly_construct(ctx, curvepoly->srid, NULL, curvepoly->nrings, ptarray);
-	return ogeom;
+  RTPOLY *ogeom;
+  RTGEOM *tmp;
+  RTLINE *line;
+  RTPOINTARRAY **ptarray;
+  int i;
+
+  RTDEBUG(2, "rtcurvepoly_stroke called.");
+
+  ptarray = rtalloc(ctx, sizeof(RTPOINTARRAY *)*curvepoly->nrings);
+
+  for (i = 0; i < curvepoly->nrings; i++)
+  {
+    tmp = curvepoly->rings[i];
+    if (tmp->type == RTCIRCSTRINGTYPE)
+    {
+      line = rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
+      ptarray[i] = ptarray_clone_deep(ctx, line->points);
+      rtline_free(ctx, line);
+    }
+    else if (tmp->type == RTLINETYPE)
+    {
+      line = (RTLINE *)tmp;
+      ptarray[i] = ptarray_clone_deep(ctx, line->points);
+    }
+    else if (tmp->type == RTCOMPOUNDTYPE)
+    {
+      line = rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
+      ptarray[i] = ptarray_clone_deep(ctx, line->points);
+      rtline_free(ctx, line);
+    }
+    else
+    {
+      rterror(ctx, "Invalid ring type found in CurvePoly.");
+      return NULL;
+    }
+  }
+
+  ogeom = rtpoly_construct(ctx, curvepoly->srid, NULL, curvepoly->nrings, ptarray);
+  return ogeom;
 }
 
 RTMLINE *
 rtmcurve_stroke(const RTCTX *ctx, const RTMCURVE *mcurve, uint32_t perQuad)
 {
-	RTMLINE *ogeom;
-	RTGEOM **lines;
-	int i;
-
-	RTDEBUGF(2, "rtmcurve_stroke called, geoms=%d, dim=%d.", mcurve->ngeoms, RTFLAGS_NDIMS(mcurve->flags));
-
-	lines = rtalloc(ctx, sizeof(RTGEOM *)*mcurve->ngeoms);
-
-	for (i = 0; i < mcurve->ngeoms; i++)
-	{
-		const RTGEOM *tmp = mcurve->geoms[i];
-		if (tmp->type == RTCIRCSTRINGTYPE)
-		{
-			lines[i] = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
-		}
-		else if (tmp->type == RTLINETYPE)
-		{
-			lines[i] = (RTGEOM *)rtline_construct(ctx, mcurve->srid, NULL, ptarray_clone_deep(ctx, ((RTLINE *)tmp)->points));
-		}
-		else if (tmp->type == RTCOMPOUNDTYPE)
-		{
-			lines[i] = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
-		}
-		else
-		{
-			rterror(ctx, "Unsupported geometry found in MultiCurve.");
-			return NULL;
-		}
-	}
-
-	ogeom = (RTMLINE *)rtcollection_construct(ctx, RTMULTILINETYPE, mcurve->srid, NULL, mcurve->ngeoms, lines);
-	return ogeom;
+  RTMLINE *ogeom;
+  RTGEOM **lines;
+  int i;
+
+  RTDEBUGF(2, "rtmcurve_stroke called, geoms=%d, dim=%d.", mcurve->ngeoms, RTFLAGS_NDIMS(mcurve->flags));
+
+  lines = rtalloc(ctx, sizeof(RTGEOM *)*mcurve->ngeoms);
+
+  for (i = 0; i < mcurve->ngeoms; i++)
+  {
+    const RTGEOM *tmp = mcurve->geoms[i];
+    if (tmp->type == RTCIRCSTRINGTYPE)
+    {
+      lines[i] = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
+    }
+    else if (tmp->type == RTLINETYPE)
+    {
+      lines[i] = (RTGEOM *)rtline_construct(ctx, mcurve->srid, NULL, ptarray_clone_deep(ctx, ((RTLINE *)tmp)->points));
+    }
+    else if (tmp->type == RTCOMPOUNDTYPE)
+    {
+      lines[i] = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
+    }
+    else
+    {
+      rterror(ctx, "Unsupported geometry found in MultiCurve.");
+      return NULL;
+    }
+  }
+
+  ogeom = (RTMLINE *)rtcollection_construct(ctx, RTMULTILINETYPE, mcurve->srid, NULL, mcurve->ngeoms, lines);
+  return ogeom;
 }
 
 RTMPOLY *
 rtmsurface_stroke(const RTCTX *ctx, const RTMSURFACE *msurface, uint32_t perQuad)
 {
-	RTMPOLY *ogeom;
-	RTGEOM *tmp;
-	RTPOLY *poly;
-	RTGEOM **polys;
-	RTPOINTARRAY **ptarray;
-	int i, j;
-
-	RTDEBUG(2, "rtmsurface_stroke called.");
-
-	polys = rtalloc(ctx, sizeof(RTGEOM *)*msurface->ngeoms);
-
-	for (i = 0; i < msurface->ngeoms; i++)
-	{
-		tmp = msurface->geoms[i];
-		if (tmp->type == RTCURVEPOLYTYPE)
-		{
-			polys[i] = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)tmp, perQuad);
-		}
-		else if (tmp->type == RTPOLYGONTYPE)
-		{
-			poly = (RTPOLY *)tmp;
-			ptarray = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
-			for (j = 0; j < poly->nrings; j++)
-			{
-				ptarray[j] = ptarray_clone_deep(ctx, poly->rings[j]);
-			}
-			polys[i] = (RTGEOM *)rtpoly_construct(ctx, msurface->srid, NULL, poly->nrings, ptarray);
-		}
-	}
-	ogeom = (RTMPOLY *)rtcollection_construct(ctx, RTMULTIPOLYGONTYPE, msurface->srid, NULL, msurface->ngeoms, polys);
-	return ogeom;
+  RTMPOLY *ogeom;
+  RTGEOM *tmp;
+  RTPOLY *poly;
+  RTGEOM **polys;
+  RTPOINTARRAY **ptarray;
+  int i, j;
+
+  RTDEBUG(2, "rtmsurface_stroke called.");
+
+  polys = rtalloc(ctx, sizeof(RTGEOM *)*msurface->ngeoms);
+
+  for (i = 0; i < msurface->ngeoms; i++)
+  {
+    tmp = msurface->geoms[i];
+    if (tmp->type == RTCURVEPOLYTYPE)
+    {
+      polys[i] = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)tmp, perQuad);
+    }
+    else if (tmp->type == RTPOLYGONTYPE)
+    {
+      poly = (RTPOLY *)tmp;
+      ptarray = rtalloc(ctx, sizeof(RTPOINTARRAY *)*poly->nrings);
+      for (j = 0; j < poly->nrings; j++)
+      {
+        ptarray[j] = ptarray_clone_deep(ctx, poly->rings[j]);
+      }
+      polys[i] = (RTGEOM *)rtpoly_construct(ctx, msurface->srid, NULL, poly->nrings, ptarray);
+    }
+  }
+  ogeom = (RTMPOLY *)rtcollection_construct(ctx, RTMULTIPOLYGONTYPE, msurface->srid, NULL, msurface->ngeoms, polys);
+  return ogeom;
 }
 
 RTCOLLECTION *
 rtcollection_stroke(const RTCTX *ctx, const RTCOLLECTION *collection, uint32_t perQuad)
 {
-	RTCOLLECTION *ocol;
-	RTGEOM *tmp;
-	RTGEOM **geoms;
-	int i;
-
-	RTDEBUG(2, "rtcollection_stroke called.");
-
-	geoms = rtalloc(ctx, sizeof(RTGEOM *)*collection->ngeoms);
-
-	for (i=0; i<collection->ngeoms; i++)
-	{
-		tmp = collection->geoms[i];
-		switch (tmp->type)
-		{
-		case RTCIRCSTRINGTYPE:
-			geoms[i] = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
-			break;
-		case RTCOMPOUNDTYPE:
-			geoms[i] = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
-			break;
-		case RTCURVEPOLYTYPE:
-			geoms[i] = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)tmp, perQuad);
-			break;
-		case RTCOLLECTIONTYPE:
-			geoms[i] = (RTGEOM *)rtcollection_stroke(ctx, (RTCOLLECTION *)tmp, perQuad);
-			break;
-		default:
-			geoms[i] = rtgeom_clone(ctx, tmp);
-			break;
-		}
-	}
-	ocol = rtcollection_construct(ctx, RTCOLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
-	return ocol;
+  RTCOLLECTION *ocol;
+  RTGEOM *tmp;
+  RTGEOM **geoms;
+  int i;
+
+  RTDEBUG(2, "rtcollection_stroke called.");
+
+  geoms = rtalloc(ctx, sizeof(RTGEOM *)*collection->ngeoms);
+
+  for (i=0; i<collection->ngeoms; i++)
+  {
+    tmp = collection->geoms[i];
+    switch (tmp->type)
+    {
+    case RTCIRCSTRINGTYPE:
+      geoms[i] = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)tmp, perQuad);
+      break;
+    case RTCOMPOUNDTYPE:
+      geoms[i] = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)tmp, perQuad);
+      break;
+    case RTCURVEPOLYTYPE:
+      geoms[i] = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)tmp, perQuad);
+      break;
+    case RTCOLLECTIONTYPE:
+      geoms[i] = (RTGEOM *)rtcollection_stroke(ctx, (RTCOLLECTION *)tmp, perQuad);
+      break;
+    default:
+      geoms[i] = rtgeom_clone(ctx, tmp);
+      break;
+    }
+  }
+  ocol = rtcollection_construct(ctx, RTCOLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
+  return ocol;
 }
 
 RTGEOM *
 rtgeom_stroke(const RTCTX *ctx, const RTGEOM *geom, uint32_t perQuad)
 {
-	RTGEOM * ogeom = NULL;
-	switch (geom->type)
-	{
-	case RTCIRCSTRINGTYPE:
-		ogeom = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)geom, perQuad);
-		break;
-	case RTCOMPOUNDTYPE:
-		ogeom = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)geom, perQuad);
-		break;
-	case RTCURVEPOLYTYPE:
-		ogeom = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)geom, perQuad);
-		break;
-	case RTMULTICURVETYPE:
-		ogeom = (RTGEOM *)rtmcurve_stroke(ctx, (RTMCURVE *)geom, perQuad);
-		break;
-	case RTMULTISURFACETYPE:
-		ogeom = (RTGEOM *)rtmsurface_stroke(ctx, (RTMSURFACE *)geom, perQuad);
-		break;
-	case RTCOLLECTIONTYPE:
-		ogeom = (RTGEOM *)rtcollection_stroke(ctx, (RTCOLLECTION *)geom, perQuad);
-		break;
-	default:
-		ogeom = rtgeom_clone(ctx, geom);
-	}
-	return ogeom;
+  RTGEOM * ogeom = NULL;
+  switch (geom->type)
+  {
+  case RTCIRCSTRINGTYPE:
+    ogeom = (RTGEOM *)rtcircstring_stroke(ctx, (RTCIRCSTRING *)geom, perQuad);
+    break;
+  case RTCOMPOUNDTYPE:
+    ogeom = (RTGEOM *)rtcompound_stroke(ctx, (RTCOMPOUND *)geom, perQuad);
+    break;
+  case RTCURVEPOLYTYPE:
+    ogeom = (RTGEOM *)rtcurvepoly_stroke(ctx, (RTCURVEPOLY *)geom, perQuad);
+    break;
+  case RTMULTICURVETYPE:
+    ogeom = (RTGEOM *)rtmcurve_stroke(ctx, (RTMCURVE *)geom, perQuad);
+    break;
+  case RTMULTISURFACETYPE:
+    ogeom = (RTGEOM *)rtmsurface_stroke(ctx, (RTMSURFACE *)geom, perQuad);
+    break;
+  case RTCOLLECTIONTYPE:
+    ogeom = (RTGEOM *)rtcollection_stroke(ctx, (RTCOLLECTION *)geom, perQuad);
+    break;
+  default:
+    ogeom = rtgeom_clone(ctx, geom);
+  }
+  return ogeom;
 }
 
 /**
@@ -514,360 +514,360 @@ rt_arc_angle(const RTCTX *ctx, const RTPOINT2D *a, const RTPOINT2D *b, const RTP
 */
 static int pt_continues_arc(const RTCTX *ctx, const RTPOINT4D *a1, const RTPOINT4D *a2, const RTPOINT4D *a3, const RTPOINT4D *b)
 {
-	RTPOINT2D center;
-	RTPOINT2D *t1 = (RTPOINT2D*)a1;
-	RTPOINT2D *t2 = (RTPOINT2D*)a2;
-	RTPOINT2D *t3 = (RTPOINT2D*)a3;
-	RTPOINT2D *tb = (RTPOINT2D*)b;
-	double radius = rt_arc_center(ctx, t1, t2, t3, &center);
-	double b_distance, diff;
-
-	/* Co-linear a1/a2/a3 */
-	if ( radius < 0.0 )
-		return RT_FALSE;
-
-	b_distance = distance2d_pt_pt(ctx, tb, &center);
-	diff = fabs(radius - b_distance);
-	RTDEBUGF(4, "circle_radius=%g, b_distance=%g, diff=%g, percentage=%g", radius, b_distance, diff, diff/radius);
-	
-	/* Is the point b on the circle? */
-	if ( diff < EPSILON_SQLMM ) 
-	{
-		int a2_side = rt_segment_side(ctx, t1, t3, t2);
-		int b_side  = rt_segment_side(ctx, t1, t3, tb);
-		double angle1 = rt_arc_angle(ctx, t1, t2, t3);
-		double angle2 = rt_arc_angle(ctx, t2, t3, tb);
-
-		/* Is the angle similar to the previous one ? */
-		diff = fabs(angle1 - angle2);
-		RTDEBUGF(4, " angle1: %g, angle2: %g, diff:%g", angle1, angle2, diff);
-		if ( diff > EPSILON_SQLMM ) 
-		{
-			return RT_FALSE;
-		}
-
-		/* Is the point b on the same side of a1/a3 as the mid-point a2 is? */
-		/* If not, it's in the unbounded part of the circle, so it continues the arc, return true. */
-		if ( b_side != a2_side )
-			return RT_TRUE;
-	}
-	return RT_FALSE;
+  RTPOINT2D center;
+  RTPOINT2D *t1 = (RTPOINT2D*)a1;
+  RTPOINT2D *t2 = (RTPOINT2D*)a2;
+  RTPOINT2D *t3 = (RTPOINT2D*)a3;
+  RTPOINT2D *tb = (RTPOINT2D*)b;
+  double radius = rt_arc_center(ctx, t1, t2, t3, &center);
+  double b_distance, diff;
+
+  /* Co-linear a1/a2/a3 */
+  if ( radius < 0.0 )
+    return RT_FALSE;
+
+  b_distance = distance2d_pt_pt(ctx, tb, &center);
+  diff = fabs(radius - b_distance);
+  RTDEBUGF(4, "circle_radius=%g, b_distance=%g, diff=%g, percentage=%g", radius, b_distance, diff, diff/radius);
+
+  /* Is the point b on the circle? */
+  if ( diff < EPSILON_SQLMM )
+  {
+    int a2_side = rt_segment_side(ctx, t1, t3, t2);
+    int b_side  = rt_segment_side(ctx, t1, t3, tb);
+    double angle1 = rt_arc_angle(ctx, t1, t2, t3);
+    double angle2 = rt_arc_angle(ctx, t2, t3, tb);
+
+    /* Is the angle similar to the previous one ? */
+    diff = fabs(angle1 - angle2);
+    RTDEBUGF(4, " angle1: %g, angle2: %g, diff:%g", angle1, angle2, diff);
+    if ( diff > EPSILON_SQLMM )
+    {
+      return RT_FALSE;
+    }
+
+    /* Is the point b on the same side of a1/a3 as the mid-point a2 is? */
+    /* If not, it's in the unbounded part of the circle, so it continues the arc, return true. */
+    if ( b_side != a2_side )
+      return RT_TRUE;
+  }
+  return RT_FALSE;
 }
 
 static RTGEOM*
 linestring_from_pa(const RTCTX *ctx, const RTPOINTARRAY *pa, int srid, int start, int end)
 {
-	int i = 0, j = 0;
-	RTPOINT4D p;
-	RTPOINTARRAY *pao = ptarray_construct(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), end-start+2);
-	RTDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end);
-	for( i = start; i < end + 2; i++ )
-	{
-		rt_getPoint4d_p(ctx, pa, i, &p);
-		ptarray_set_point4d(ctx, pao, j++, &p);	
-	}
-	return rtline_as_rtgeom(ctx, rtline_construct(ctx, srid, NULL, pao));
+  int i = 0, j = 0;
+  RTPOINT4D p;
+  RTPOINTARRAY *pao = ptarray_construct(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), end-start+2);
+  RTDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end);
+  for( i = start; i < end + 2; i++ )
+  {
+    rt_getPoint4d_p(ctx, pa, i, &p);
+    ptarray_set_point4d(ctx, pao, j++, &p);
+  }
+  return rtline_as_rtgeom(ctx, rtline_construct(ctx, srid, NULL, pao));
 }
 
 static RTGEOM*
 circstring_from_pa(const RTCTX *ctx, const RTPOINTARRAY *pa, int srid, int start, int end)
 {
-	
-	RTPOINT4D p0, p1, p2;
-	RTPOINTARRAY *pao = ptarray_construct(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), 3);
-	RTDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end);
-	rt_getPoint4d_p(ctx, pa, start, &p0);
-	ptarray_set_point4d(ctx, pao, 0, &p0);	
-	rt_getPoint4d_p(ctx, pa, (start+end+1)/2, &p1);
-	ptarray_set_point4d(ctx, pao, 1, &p1);	
-	rt_getPoint4d_p(ctx, pa, end+1, &p2);
-	ptarray_set_point4d(ctx, pao, 2, &p2);	
-	return rtcircstring_as_rtgeom(ctx, rtcircstring_construct(ctx, srid, NULL, pao));
+
+  RTPOINT4D p0, p1, p2;
+  RTPOINTARRAY *pao = ptarray_construct(ctx, ptarray_has_z(ctx, pa), ptarray_has_m(ctx, pa), 3);
+  RTDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end);
+  rt_getPoint4d_p(ctx, pa, start, &p0);
+  ptarray_set_point4d(ctx, pao, 0, &p0);
+  rt_getPoint4d_p(ctx, pa, (start+end+1)/2, &p1);
+  ptarray_set_point4d(ctx, pao, 1, &p1);
+  rt_getPoint4d_p(ctx, pa, end+1, &p2);
+  ptarray_set_point4d(ctx, pao, 2, &p2);
+  return rtcircstring_as_rtgeom(ctx, rtcircstring_construct(ctx, srid, NULL, pao));
 }
 
 static RTGEOM*
 geom_from_pa(const RTCTX *ctx, const RTPOINTARRAY *pa, int srid, int is_arc, int start, int end)
 {
-	RTDEBUGF(4, "srid=%d, is_arc=%d, start=%d, end=%d", srid, is_arc, start, end);
-	if ( is_arc )
-		return circstring_from_pa(ctx, pa, srid, start, end);
-	else
-		return linestring_from_pa(ctx, pa, srid, start, end);
+  RTDEBUGF(4, "srid=%d, is_arc=%d, start=%d, end=%d", srid, is_arc, start, end);
+  if ( is_arc )
+    return circstring_from_pa(ctx, pa, srid, start, end);
+  else
+    return linestring_from_pa(ctx, pa, srid, start, end);
 }
 
 RTGEOM*
 pta_unstroke(const RTCTX *ctx, const RTPOINTARRAY *points, int type, int srid)
 {
-	int i = 0, j, k;
-	RTPOINT4D a1, a2, a3, b;
-	RTPOINT4D first, center;
-	char *edges_in_arcs;
-	int found_arc = RT_FALSE;
-	int current_arc = 1;
-	int num_edges;
-	int edge_type; /* non-zero if edge is part of an arc */
-	int start, end;
-	RTCOLLECTION *outcol;
-	/* Minimum number of edges, per quadrant, required to define an arc */
-	const unsigned int min_quad_edges = 2;
-
-	/* Die on null input */
-	if ( ! points )
-		rterror(ctx, "pta_unstroke called with null pointarray");
-
-	/* Null on empty input? */
-	if ( points->npoints == 0 )
-		return NULL;
-	
-	/* We can't desegmentize anything shorter than four points */
-	if ( points->npoints < 4 )
-	{
-		/* Return a linestring here*/
-		rterror(ctx, "pta_unstroke needs implementation for npoints < 4");
-	}
-	
-	/* Allocate our result array of vertices that are part of arcs */
-	num_edges = points->npoints - 1;
-	edges_in_arcs = rtalloc(ctx, num_edges + 1);
-	memset(edges_in_arcs, 0, num_edges + 1);
-	
-	/* We make a candidate arc of the first two edges, */
-	/* And then see if the next edge follows it */
-	while( i < num_edges-2 )
-	{
-		unsigned int arc_edges;
-		double num_quadrants;
-		double angle;
-
-		found_arc = RT_FALSE;
-		/* Make candidate arc */
-		rt_getPoint4d_p(ctx, points, i  , &a1);
-		rt_getPoint4d_p(ctx, points, i+1, &a2);
-		rt_getPoint4d_p(ctx, points, i+2, &a3);
-		memcpy(&first, &a1, sizeof(RTPOINT4D));
-
-		for( j = i+3; j < num_edges+1; j++ )
-		{
-			RTDEBUGF(4, "i=%d, j=%d", i, j);
-			rt_getPoint4d_p(ctx, points, j, &b);
-			/* Does this point fall on our candidate arc? */
-			if ( pt_continues_arc(ctx, &a1, &a2, &a3, &b) )
-			{
-				/* Yes. Mark this edge and the two preceding it as arc components */
-				RTDEBUGF(4, "pt_continues_arc #%d", current_arc);
-				found_arc = RT_TRUE;
-				for ( k = j-1; k > j-4; k-- )
-					edges_in_arcs[k] = current_arc;
-			}
-			else
-			{
-				/* No. So we're done with this candidate arc */
-				RTDEBUG(4, "pt_continues_arc = false");
-				current_arc++;
-				break;
-			}
-
-			memcpy(&a1, &a2, sizeof(RTPOINT4D));
-			memcpy(&a2, &a3, sizeof(RTPOINT4D));
-			memcpy(&a3,  &b, sizeof(RTPOINT4D));
-		}
-		/* Jump past all the edges that were added to the arc */
-		if ( found_arc )
-		{
-			/* Check if an arc was composed by enough edges to be
-			 * really considered an arc
-			 * See http://trac.osgeo.org/postgis/ticket/2420
-			 */
-			arc_edges = j - 1 - i;
-			RTDEBUGF(4, "arc defined by %d edges found", arc_edges);
-			if ( first.x == b.x && first.y == b.y ) {
-				RTDEBUG(4, "arc is a circle");
-				num_quadrants = 4;
-			}
-			else {
-				rt_arc_center(ctx, (RTPOINT2D*)&first, (RTPOINT2D*)&b, (RTPOINT2D*)&a1, (RTPOINT2D*)&center);
-				angle = rt_arc_angle(ctx, (RTPOINT2D*)&first, (RTPOINT2D*)&center, (RTPOINT2D*)&b);
+  int i = 0, j, k;
+  RTPOINT4D a1, a2, a3, b;
+  RTPOINT4D first, center;
+  char *edges_in_arcs;
+  int found_arc = RT_FALSE;
+  int current_arc = 1;
+  int num_edges;
+  int edge_type; /* non-zero if edge is part of an arc */
+  int start, end;
+  RTCOLLECTION *outcol;
+  /* Minimum number of edges, per quadrant, required to define an arc */
+  const unsigned int min_quad_edges = 2;
+
+  /* Die on null input */
+  if ( ! points )
+    rterror(ctx, "pta_unstroke called with null pointarray");
+
+  /* Null on empty input? */
+  if ( points->npoints == 0 )
+    return NULL;
+
+  /* We can't desegmentize anything shorter than four points */
+  if ( points->npoints < 4 )
+  {
+    /* Return a linestring here*/
+    rterror(ctx, "pta_unstroke needs implementation for npoints < 4");
+  }
+
+  /* Allocate our result array of vertices that are part of arcs */
+  num_edges = points->npoints - 1;
+  edges_in_arcs = rtalloc(ctx, num_edges + 1);
+  memset(edges_in_arcs, 0, num_edges + 1);
+
+  /* We make a candidate arc of the first two edges, */
+  /* And then see if the next edge follows it */
+  while( i < num_edges-2 )
+  {
+    unsigned int arc_edges;
+    double num_quadrants;
+    double angle;
+
+    found_arc = RT_FALSE;
+    /* Make candidate arc */
+    rt_getPoint4d_p(ctx, points, i  , &a1);
+    rt_getPoint4d_p(ctx, points, i+1, &a2);
+    rt_getPoint4d_p(ctx, points, i+2, &a3);
+    memcpy(&first, &a1, sizeof(RTPOINT4D));
+
+    for( j = i+3; j < num_edges+1; j++ )
+    {
+      RTDEBUGF(4, "i=%d, j=%d", i, j);
+      rt_getPoint4d_p(ctx, points, j, &b);
+      /* Does this point fall on our candidate arc? */
+      if ( pt_continues_arc(ctx, &a1, &a2, &a3, &b) )
+      {
+        /* Yes. Mark this edge and the two preceding it as arc components */
+        RTDEBUGF(4, "pt_continues_arc #%d", current_arc);
+        found_arc = RT_TRUE;
+        for ( k = j-1; k > j-4; k-- )
+          edges_in_arcs[k] = current_arc;
+      }
+      else
+      {
+        /* No. So we're done with this candidate arc */
+        RTDEBUG(4, "pt_continues_arc = false");
+        current_arc++;
+        break;
+      }
+
+      memcpy(&a1, &a2, sizeof(RTPOINT4D));
+      memcpy(&a2, &a3, sizeof(RTPOINT4D));
+      memcpy(&a3,  &b, sizeof(RTPOINT4D));
+    }
+    /* Jump past all the edges that were added to the arc */
+    if ( found_arc )
+    {
+      /* Check if an arc was composed by enough edges to be
+       * really considered an arc
+       * See http://trac.osgeo.org/postgis/ticket/2420
+       */
+      arc_edges = j - 1 - i;
+      RTDEBUGF(4, "arc defined by %d edges found", arc_edges);
+      if ( first.x == b.x && first.y == b.y ) {
+        RTDEBUG(4, "arc is a circle");
+        num_quadrants = 4;
+      }
+      else {
+        rt_arc_center(ctx, (RTPOINT2D*)&first, (RTPOINT2D*)&b, (RTPOINT2D*)&a1, (RTPOINT2D*)&center);
+        angle = rt_arc_angle(ctx, (RTPOINT2D*)&first, (RTPOINT2D*)&center, (RTPOINT2D*)&b);
         int p2_side = rt_segment_side(ctx, (RTPOINT2D*)&first, (RTPOINT2D*)&a1, (RTPOINT2D*)&b);
-        if ( p2_side >= 0 ) angle = -angle; 
-
-				if ( angle < 0 ) angle = 2 * M_PI + angle;
-				num_quadrants = ( 4 * angle ) / ( 2 * M_PI );
-				RTDEBUGF(4, "arc angle (%g %g, %g %g, %g %g) is %g (side is %d), quandrants:%g", first.x, first.y, center.x, center.y, b.x, b.y, angle, p2_side, num_quadrants);
-			}
-			/* a1 is first point, b is last point */
-			if ( arc_edges < min_quad_edges * num_quadrants ) {
-				RTDEBUGF(4, "Not enough edges for a %g quadrants arc, %g needed", num_quadrants, min_quad_edges * num_quadrants);
-				for ( k = j-1; k >= i; k-- )
-					edges_in_arcs[k] = 0;
-			}
-
-			i = j-1;
-		}
-		else
-		{
-			/* Mark this edge as a linear edge */
-			edges_in_arcs[i] = 0;
-			i = i+1;
-		}
-	}
-	
+        if ( p2_side >= 0 ) angle = -angle;
+
+        if ( angle < 0 ) angle = 2 * M_PI + angle;
+        num_quadrants = ( 4 * angle ) / ( 2 * M_PI );
+        RTDEBUGF(4, "arc angle (%g %g, %g %g, %g %g) is %g (side is %d), quandrants:%g", first.x, first.y, center.x, center.y, b.x, b.y, angle, p2_side, num_quadrants);
+      }
+      /* a1 is first point, b is last point */
+      if ( arc_edges < min_quad_edges * num_quadrants ) {
+        RTDEBUGF(4, "Not enough edges for a %g quadrants arc, %g needed", num_quadrants, min_quad_edges * num_quadrants);
+        for ( k = j-1; k >= i; k-- )
+          edges_in_arcs[k] = 0;
+      }
+
+      i = j-1;
+    }
+    else
+    {
+      /* Mark this edge as a linear edge */
+      edges_in_arcs[i] = 0;
+      i = i+1;
+    }
+  }
+
 #if RTGEOM_DEBUG_LEVEL > 3
-	{
-		char *edgestr = rtalloc(ctx, num_edges+1);
-		for ( i = 0; i < num_edges; i++ )
-		{
-			if ( edges_in_arcs[i] )
-				edgestr[i] = 48 + edges_in_arcs[i];
-			else
-				edgestr[i] = '.';
-		}
-		edgestr[num_edges] = 0;
-		RTDEBUGF(3, "edge pattern %s", edgestr);
-		rtfree(ctx, edgestr);
-	}
+  {
+    char *edgestr = rtalloc(ctx, num_edges+1);
+    for ( i = 0; i < num_edges; i++ )
+    {
+      if ( edges_in_arcs[i] )
+        edgestr[i] = 48 + edges_in_arcs[i];
+      else
+        edgestr[i] = '.';
+    }
+    edgestr[num_edges] = 0;
+    RTDEBUGF(3, "edge pattern %s", edgestr);
+    rtfree(ctx, edgestr);
+  }
 #endif
 
-	start = 0;
-	edge_type = edges_in_arcs[0];
-	outcol = rtcollection_construct_empty(ctx, RTCOMPOUNDTYPE, srid, ptarray_has_z(ctx, points), ptarray_has_m(ctx, points));
-	for( i = 1; i < num_edges; i++ )
-	{
-		if( edge_type != edges_in_arcs[i] )
-		{
-			end = i - 1;
-			rtcollection_add_rtgeom(ctx, outcol, geom_from_pa(ctx, points, srid, edge_type, start, end));
-			start = i;
-			edge_type = edges_in_arcs[i];
-		}
-	}
-	rtfree(ctx, edges_in_arcs); /* not needed anymore */
-
-	/* Roll out last item */
-	end = num_edges - 1;
-	rtcollection_add_rtgeom(ctx, outcol, geom_from_pa(ctx, points, srid, edge_type, start, end));
-	
-	/* Strip down to singleton if only one entry */
-	if ( outcol->ngeoms == 1 )
-	{
-		RTGEOM *outgeom = outcol->geoms[0];
-		outcol->ngeoms = 0; rtcollection_free(ctx, outcol);
-		return outgeom;
-	}
-	return rtcollection_as_rtgeom(ctx, outcol);
+  start = 0;
+  edge_type = edges_in_arcs[0];
+  outcol = rtcollection_construct_empty(ctx, RTCOMPOUNDTYPE, srid, ptarray_has_z(ctx, points), ptarray_has_m(ctx, points));
+  for( i = 1; i < num_edges; i++ )
+  {
+    if( edge_type != edges_in_arcs[i] )
+    {
+      end = i - 1;
+      rtcollection_add_rtgeom(ctx, outcol, geom_from_pa(ctx, points, srid, edge_type, start, end));
+      start = i;
+      edge_type = edges_in_arcs[i];
+    }
+  }
+  rtfree(ctx, edges_in_arcs); /* not needed anymore */
+
+  /* Roll out last item */
+  end = num_edges - 1;
+  rtcollection_add_rtgeom(ctx, outcol, geom_from_pa(ctx, points, srid, edge_type, start, end));
+
+  /* Strip down to singleton if only one entry */
+  if ( outcol->ngeoms == 1 )
+  {
+    RTGEOM *outgeom = outcol->geoms[0];
+    outcol->ngeoms = 0; rtcollection_free(ctx, outcol);
+    return outgeom;
+  }
+  return rtcollection_as_rtgeom(ctx, outcol);
 }
 
 
 RTGEOM *
 rtline_unstroke(const RTCTX *ctx, const RTLINE *line)
 {
-	RTDEBUG(2, "rtline_unstroke called.");
+  RTDEBUG(2, "rtline_unstroke called.");
 
-	if ( line->points->npoints < 4 ) return rtline_as_rtgeom(ctx, rtline_clone(ctx, line));
-	else return pta_unstroke(ctx, line->points, line->flags, line->srid);
+  if ( line->points->npoints < 4 ) return rtline_as_rtgeom(ctx, rtline_clone(ctx, line));
+  else return pta_unstroke(ctx, line->points, line->flags, line->srid);
 }
 
 RTGEOM *
 rtpolygon_unstroke(const RTCTX *ctx, const RTPOLY *poly)
 {
-	RTGEOM **geoms;
-	int i, hascurve = 0;
-
-	RTDEBUG(2, "rtpolygon_unstroke called.");
-
-	geoms = rtalloc(ctx, sizeof(RTGEOM *)*poly->nrings);
-	for (i=0; i<poly->nrings; i++)
-	{
-		geoms[i] = pta_unstroke(ctx, poly->rings[i], poly->flags, poly->srid);
-		if (geoms[i]->type == RTCIRCSTRINGTYPE || geoms[i]->type == RTCOMPOUNDTYPE)
-		{
-			hascurve = 1;
-		}
-	}
-	if (hascurve == 0)
-	{
-		for (i=0; i<poly->nrings; i++)
-		{
-			rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
-		}
-		return rtgeom_clone(ctx, (RTGEOM *)poly);
-	}
-
-	return (RTGEOM *)rtcollection_construct(ctx, RTCURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
+  RTGEOM **geoms;
+  int i, hascurve = 0;
+
+  RTDEBUG(2, "rtpolygon_unstroke called.");
+
+  geoms = rtalloc(ctx, sizeof(RTGEOM *)*poly->nrings);
+  for (i=0; i<poly->nrings; i++)
+  {
+    geoms[i] = pta_unstroke(ctx, poly->rings[i], poly->flags, poly->srid);
+    if (geoms[i]->type == RTCIRCSTRINGTYPE || geoms[i]->type == RTCOMPOUNDTYPE)
+    {
+      hascurve = 1;
+    }
+  }
+  if (hascurve == 0)
+  {
+    for (i=0; i<poly->nrings; i++)
+    {
+      rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
+    }
+    return rtgeom_clone(ctx, (RTGEOM *)poly);
+  }
+
+  return (RTGEOM *)rtcollection_construct(ctx, RTCURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
 }
 
 RTGEOM *
 rtmline_unstroke(const RTCTX *ctx, const RTMLINE *mline)
 {
-	RTGEOM **geoms;
-	int i, hascurve = 0;
-
-	RTDEBUG(2, "rtmline_unstroke called.");
-
-	geoms = rtalloc(ctx, sizeof(RTGEOM *)*mline->ngeoms);
-	for (i=0; i<mline->ngeoms; i++)
-	{
-		geoms[i] = rtline_unstroke(ctx, (RTLINE *)mline->geoms[i]);
-		if (geoms[i]->type == RTCIRCSTRINGTYPE || geoms[i]->type == RTCOMPOUNDTYPE)
-		{
-			hascurve = 1;
-		}
-	}
-	if (hascurve == 0)
-	{
-		for (i=0; i<mline->ngeoms; i++)
-		{
-			rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
-		}
-		return rtgeom_clone(ctx, (RTGEOM *)mline);
-	}
-	return (RTGEOM *)rtcollection_construct(ctx, RTMULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
+  RTGEOM **geoms;
+  int i, hascurve = 0;
+
+  RTDEBUG(2, "rtmline_unstroke called.");
+
+  geoms = rtalloc(ctx, sizeof(RTGEOM *)*mline->ngeoms);
+  for (i=0; i<mline->ngeoms; i++)
+  {
+    geoms[i] = rtline_unstroke(ctx, (RTLINE *)mline->geoms[i]);
+    if (geoms[i]->type == RTCIRCSTRINGTYPE || geoms[i]->type == RTCOMPOUNDTYPE)
+    {
+      hascurve = 1;
+    }
+  }
+  if (hascurve == 0)
+  {
+    for (i=0; i<mline->ngeoms; i++)
+    {
+      rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
+    }
+    return rtgeom_clone(ctx, (RTGEOM *)mline);
+  }
+  return (RTGEOM *)rtcollection_construct(ctx, RTMULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
 }
 
-RTGEOM * 
+RTGEOM *
 rtmpolygon_unstroke(const RTCTX *ctx, const RTMPOLY *mpoly)
 {
-	RTGEOM **geoms;
-	int i, hascurve = 0;
-
-	RTDEBUG(2, "rtmpoly_unstroke called.");
-
-	geoms = rtalloc(ctx, sizeof(RTGEOM *)*mpoly->ngeoms);
-	for (i=0; i<mpoly->ngeoms; i++)
-	{
-		geoms[i] = rtpolygon_unstroke(ctx, (RTPOLY *)mpoly->geoms[i]);
-		if (geoms[i]->type == RTCURVEPOLYTYPE)
-		{
-			hascurve = 1;
-		}
-	}
-	if (hascurve == 0)
-	{
-		for (i=0; i<mpoly->ngeoms; i++)
-		{
-			rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
-		}
-		return rtgeom_clone(ctx, (RTGEOM *)mpoly);
-	}
-	return (RTGEOM *)rtcollection_construct(ctx, RTMULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
+  RTGEOM **geoms;
+  int i, hascurve = 0;
+
+  RTDEBUG(2, "rtmpoly_unstroke called.");
+
+  geoms = rtalloc(ctx, sizeof(RTGEOM *)*mpoly->ngeoms);
+  for (i=0; i<mpoly->ngeoms; i++)
+  {
+    geoms[i] = rtpolygon_unstroke(ctx, (RTPOLY *)mpoly->geoms[i]);
+    if (geoms[i]->type == RTCURVEPOLYTYPE)
+    {
+      hascurve = 1;
+    }
+  }
+  if (hascurve == 0)
+  {
+    for (i=0; i<mpoly->ngeoms; i++)
+    {
+      rtfree(ctx, geoms[i]); /* TODO: should this be rtgeom_free instead ? */
+    }
+    return rtgeom_clone(ctx, (RTGEOM *)mpoly);
+  }
+  return (RTGEOM *)rtcollection_construct(ctx, RTMULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
 }
 
 RTGEOM *
 rtgeom_unstroke(const RTCTX *ctx, const RTGEOM *geom)
 {
-	RTDEBUG(2, "rtgeom_unstroke called.");
-
-	switch (geom->type)
-	{
-	case RTLINETYPE:
-		return rtline_unstroke(ctx, (RTLINE *)geom);
-	case RTPOLYGONTYPE:
-		return rtpolygon_unstroke(ctx, (RTPOLY *)geom);
-	case RTMULTILINETYPE:
-		return rtmline_unstroke(ctx, (RTMLINE *)geom);
-	case RTMULTIPOLYGONTYPE:
-		return rtmpolygon_unstroke(ctx, (RTMPOLY *)geom);
-	default:
-		return rtgeom_clone(ctx, geom);
-	}
+  RTDEBUG(2, "rtgeom_unstroke called.");
+
+  switch (geom->type)
+  {
+  case RTLINETYPE:
+    return rtline_unstroke(ctx, (RTLINE *)geom);
+  case RTPOLYGONTYPE:
+    return rtpolygon_unstroke(ctx, (RTPOLY *)geom);
+  case RTMULTILINETYPE:
+    return rtmline_unstroke(ctx, (RTMLINE *)geom);
+  case RTMULTIPOLYGONTYPE:
+    return rtmpolygon_unstroke(ctx, (RTMPOLY *)geom);
+  default:
+    return rtgeom_clone(ctx, geom);
+  }
 }
 
diff --git a/src/rttin.c b/src/rttin.c
index 52796e0..961e4e0 100644
--- a/src/rttin.c
+++ b/src/rttin.c
@@ -34,46 +34,46 @@
 
 RTTIN* rttin_add_rttriangle(const RTCTX *ctx, RTTIN *mobj, const RTTRIANGLE *obj)
 {
-	return (RTTIN*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
+  return (RTTIN*)rtcollection_add_rtgeom(ctx, (RTCOLLECTION*)mobj, (RTGEOM*)obj);
 }
 
 void rttin_free(const RTCTX *ctx, RTTIN *tin)
 {
-	int i;
-	if ( ! tin ) return;
-	if ( tin->bbox )
-		rtfree(ctx, tin->bbox);
+  int i;
+  if ( ! tin ) return;
+  if ( tin->bbox )
+    rtfree(ctx, tin->bbox);
 
-	for ( i = 0; i < tin->ngeoms; i++ )
-		if ( tin->geoms && tin->geoms[i] )
-			rttriangle_free(ctx, tin->geoms[i]);
+  for ( i = 0; i < tin->ngeoms; i++ )
+    if ( tin->geoms && tin->geoms[i] )
+      rttriangle_free(ctx, tin->geoms[i]);
 
-	if ( tin->geoms )
-		rtfree(ctx, tin->geoms);
+  if ( tin->geoms )
+    rtfree(ctx, tin->geoms);
 
-	rtfree(ctx, tin);
+  rtfree(ctx, tin);
 }
 
 
 void printRTTIN(const RTCTX *ctx, RTTIN *tin)
 {
-	int i;
-	RTTRIANGLE *triangle;
-
-	if (tin->type != RTTINTYPE)
-		rterror(ctx, "printRTTIN called with something else than a TIN");
-
-	rtnotice(ctx, "RTTIN {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(tin->flags));
-	rtnotice(ctx, "    SRID = %i", (int)tin->srid);
-	rtnotice(ctx, "    ngeoms = %i", (int)tin->ngeoms);
-
-	for (i=0; i<tin->ngeoms; i++)
-	{
-		triangle = (RTTRIANGLE *) tin->geoms[i];
-		printPA(ctx, triangle->points);
-	}
-	rtnotice(ctx, "}");
+  int i;
+  RTTRIANGLE *triangle;
+
+  if (tin->type != RTTINTYPE)
+    rterror(ctx, "printRTTIN called with something else than a TIN");
+
+  rtnotice(ctx, "RTTIN {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(tin->flags));
+  rtnotice(ctx, "    SRID = %i", (int)tin->srid);
+  rtnotice(ctx, "    ngeoms = %i", (int)tin->ngeoms);
+
+  for (i=0; i<tin->ngeoms; i++)
+  {
+    triangle = (RTTRIANGLE *) tin->geoms[i];
+    printPA(ctx, triangle->points);
+  }
+  rtnotice(ctx, "}");
 }
 
 
@@ -83,9 +83,9 @@ void printRTTIN(const RTCTX *ctx, RTTIN *tin)
 
 struct struct_tin_arcs
 {
-	double ax, ay, az;
-	double bx, by, bz;
-	int cnt, face;
+  double ax, ay, az;
+  double bx, by, bz;
+  int cnt, face;
 };
 typedef struct struct_tin_arcs *tin_arcs;
 
@@ -93,97 +93,97 @@ typedef struct struct_tin_arcs *tin_arcs;
    we could have wrong result if not */
 int rttin_is_closed(const RTCTX *ctx, const RTTIN *tin)
 {
-	int i, j, k;
-	int narcs, carc;
-	int found;
-	tin_arcs arcs;
-	RTPOINT4D pa, pb;
-	RTTRIANGLE *patch;
-
-	/* If surface is not 3D, it's can't be closed */
-	if (!RTFLAGS_GET_Z(tin->flags)) return 0;
-
-	/* Max theorical arcs number if no one is shared ... */
-	narcs = 3 * tin->ngeoms;
-
-	arcs = rtalloc(ctx, sizeof(struct struct_tin_arcs) * narcs);
-	for (i=0, carc=0; i < tin->ngeoms ; i++)
-	{
-
-		patch = (RTTRIANGLE *) tin->geoms[i];
-		for (j=0; j < 3 ; j++)
-		{
-
-			rt_getPoint4d_p(ctx, patch->points, j,   &pa);
-			rt_getPoint4d_p(ctx, patch->points, j+1, &pb);
-
-			/* Make sure to order the 'lower' point first */
-			if ( (pa.x > pb.x) ||
-			        (pa.x == pb.x && pa.y > pb.y) ||
-			        (pa.x == pb.x && pa.y == pb.y && pa.z > pb.z) )
-			{
-				pa = pb;
-				rt_getPoint4d_p(ctx, patch->points, j, &pb);
-			}
-
-			for (found=0, k=0; k < carc ; k++)
-			{
-
-				if (  ( arcs[k].ax == pa.x && arcs[k].ay == pa.y &&
-				        arcs[k].az == pa.z && arcs[k].bx == pb.x &&
-				        arcs[k].by == pb.y && arcs[k].bz == pb.z &&
-				        arcs[k].face != i) )
-				{
-					arcs[k].cnt++;
-					found = 1;
-
-					/* Look like an invalid TIN
-					      anyway not a closed one */
-					if (arcs[k].cnt > 2)
-					{
-						rtfree(ctx, arcs);
-						return 0;
-					}
-				}
-			}
-
-			if (!found)
-			{
-				arcs[carc].cnt=1;
-				arcs[carc].face=i;
-				arcs[carc].ax = pa.x;
-				arcs[carc].ay = pa.y;
-				arcs[carc].az = pa.z;
-				arcs[carc].bx = pb.x;
-				arcs[carc].by = pb.y;
-				arcs[carc].bz = pb.z;
-				carc++;
-
-				/* Look like an invalid TIN
-				      anyway not a closed one */
-				if (carc > narcs)
-				{
-					rtfree(ctx, arcs);
-					return 0;
-				}
-			}
-		}
-	}
-
-	/* A TIN is closed if each edge
-	       is shared by exactly 2 faces */
-	for (k=0; k < carc ; k++)
-	{
-		if (arcs[k].cnt != 2)
-		{
-			rtfree(ctx, arcs);
-			return 0;
-		}
-	}
-	rtfree(ctx, arcs);
-
-	/* Invalid TIN case */
-	if (carc < tin->ngeoms) return 0;
-
-	return 1;
+  int i, j, k;
+  int narcs, carc;
+  int found;
+  tin_arcs arcs;
+  RTPOINT4D pa, pb;
+  RTTRIANGLE *patch;
+
+  /* If surface is not 3D, it's can't be closed */
+  if (!RTFLAGS_GET_Z(tin->flags)) return 0;
+
+  /* Max theorical arcs number if no one is shared ... */
+  narcs = 3 * tin->ngeoms;
+
+  arcs = rtalloc(ctx, sizeof(struct struct_tin_arcs) * narcs);
+  for (i=0, carc=0; i < tin->ngeoms ; i++)
+  {
+
+    patch = (RTTRIANGLE *) tin->geoms[i];
+    for (j=0; j < 3 ; j++)
+    {
+
+      rt_getPoint4d_p(ctx, patch->points, j,   &pa);
+      rt_getPoint4d_p(ctx, patch->points, j+1, &pb);
+
+      /* Make sure to order the 'lower' point first */
+      if ( (pa.x > pb.x) ||
+              (pa.x == pb.x && pa.y > pb.y) ||
+              (pa.x == pb.x && pa.y == pb.y && pa.z > pb.z) )
+      {
+        pa = pb;
+        rt_getPoint4d_p(ctx, patch->points, j, &pb);
+      }
+
+      for (found=0, k=0; k < carc ; k++)
+      {
+
+        if (  ( arcs[k].ax == pa.x && arcs[k].ay == pa.y &&
+                arcs[k].az == pa.z && arcs[k].bx == pb.x &&
+                arcs[k].by == pb.y && arcs[k].bz == pb.z &&
+                arcs[k].face != i) )
+        {
+          arcs[k].cnt++;
+          found = 1;
+
+          /* Look like an invalid TIN
+                anyway not a closed one */
+          if (arcs[k].cnt > 2)
+          {
+            rtfree(ctx, arcs);
+            return 0;
+          }
+        }
+      }
+
+      if (!found)
+      {
+        arcs[carc].cnt=1;
+        arcs[carc].face=i;
+        arcs[carc].ax = pa.x;
+        arcs[carc].ay = pa.y;
+        arcs[carc].az = pa.z;
+        arcs[carc].bx = pb.x;
+        arcs[carc].by = pb.y;
+        arcs[carc].bz = pb.z;
+        carc++;
+
+        /* Look like an invalid TIN
+              anyway not a closed one */
+        if (carc > narcs)
+        {
+          rtfree(ctx, arcs);
+          return 0;
+        }
+      }
+    }
+  }
+
+  /* A TIN is closed if each edge
+         is shared by exactly 2 faces */
+  for (k=0; k < carc ; k++)
+  {
+    if (arcs[k].cnt != 2)
+    {
+      rtfree(ctx, arcs);
+      return 0;
+    }
+  }
+  rtfree(ctx, arcs);
+
+  /* Invalid TIN case */
+  if (carc < tin->ngeoms) return 0;
+
+  return 1;
 }
diff --git a/src/rttopo_config.h b/src/rttopo_config.h
deleted file mode 100644
index eebba80..0000000
--- a/src/rttopo_config.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* src/rttopo_config.h.  Generated from rttopo_config.h.in by configure.  */
-/* src/rttopo_config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <assert.h> header file. */
-#define HAVE_ASSERT_H 1
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#define HAVE_CTYPE_H 1
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 1
-
-/* Define to 1 if you have the `fdatasync' function. */
-#define HAVE_FDATASYNC 1
-
-/* Define to 1 if you have the <float.h> header file. */
-#define HAVE_FLOAT_H 1
-
-/* Define to 1 if you have the `ftruncate' function. */
-#define HAVE_FTRUNCATE 1
-
-/* Define to 1 if you have the <geos_c.h> header file. */
-#define HAVE_GEOS_C_H 1
-
-/* Define to 1 if you have the `getcwd' function. */
-#define HAVE_GETCWD 1
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `localtime_r' function. */
-#define HAVE_LOCALTIME_R 1
-
-/* Define to 1 if `lstat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */
-
-/* Define to 1 if you have the <math.h> header file. */
-#define HAVE_MATH_H 1
-
-/* Define to 1 if you have the `memmove' function. */
-#define HAVE_MEMMOVE 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `memset' function. */
-#define HAVE_MEMSET 1
-
-/* Define to 1 if you have the `sqrt' function. */
-/* #undef HAVE_SQRT */
-
-/* Define to 1 if `stat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-/* #undef HAVE_STAT_EMPTY_STRING_BUG */
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strcasecmp' function. */
-#define HAVE_STRCASECMP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the `strftime' function. */
-#define HAVE_STRFTIME 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strncasecmp' function. */
-#define HAVE_STRNCASECMP 1
-
-/* Define to 1 if you have the `strstr' function. */
-#define HAVE_STRSTR 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* rtgeom version */
-#define LIBRTGEOM_VERSION "1.0.0-RC2"
-
-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
-   slash. */
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#define LT_OBJDIR ".libs/"
-
-/* Must be defined in order to disable debug mode. */
-#define NDEBUG 1
-
-/* Name of package */
-#define PACKAGE "librttopo"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "strk at keybit.net"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "librttopo"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "librttopo 1.0.0-RC2"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "librttopo"
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.0.0-RC2"
-
-/* debug level */
-#define RTGEOM_DEBUG_LEVEL 0
-
-/* GEOS library version */
-#define RTGEOM_GEOS_VERSION 36
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-/* #undef TM_IN_SYS_TIME */
-
-/* Version number of package */
-#define VERSION "1.0.0-RC2"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `long int' if <sys/types.h> does not define. */
-/* #undef off_t */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to empty if the keyword `volatile' does not work. Warning: valid
-   code using `volatile' can become incorrect without. Disable with care. */
-/* #undef volatile */
diff --git a/src/rttopo_config.h.in b/src/rttopo_config.h.in
deleted file mode 100644
index 046039c..0000000
--- a/src/rttopo_config.h.in
+++ /dev/null
@@ -1,168 +0,0 @@
-/* src/rttopo_config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <assert.h> header file. */
-#undef HAVE_ASSERT_H
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <errno.h> header file. */
-#undef HAVE_ERRNO_H
-
-/* Define to 1 if you have the `fdatasync' function. */
-#undef HAVE_FDATASYNC
-
-/* Define to 1 if you have the <float.h> header file. */
-#undef HAVE_FLOAT_H
-
-/* Define to 1 if you have the `ftruncate' function. */
-#undef HAVE_FTRUNCATE
-
-/* Define to 1 if you have the <geos_c.h> header file. */
-#undef HAVE_GEOS_C_H
-
-/* Define to 1 if you have the `getcwd' function. */
-#undef HAVE_GETCWD
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `localtime_r' function. */
-#undef HAVE_LOCALTIME_R
-
-/* Define to 1 if `lstat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-#undef HAVE_LSTAT_EMPTY_STRING_BUG
-
-/* Define to 1 if you have the <math.h> header file. */
-#undef HAVE_MATH_H
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
-/* Define to 1 if you have the `sqrt' function. */
-#undef HAVE_SQRT
-
-/* Define to 1 if `stat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-#undef HAVE_STAT_EMPTY_STRING_BUG
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#undef HAVE_STDIO_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strncasecmp' function. */
-#undef HAVE_STRNCASECMP
-
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* rtgeom version */
-#undef LIBRTGEOM_VERSION
-
-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
-   slash. */
-#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#undef LT_OBJDIR
-
-/* Must be defined in order to disable debug mode. */
-#undef NDEBUG
-
-/* 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 home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* debug level */
-#undef RTGEOM_DEBUG_LEVEL
-
-/* GEOS library version */
-#undef RTGEOM_GEOS_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
-
-/* Define to empty if the keyword `volatile' does not work. Warning: valid
-   code using `volatile' can become incorrect without. Disable with care. */
-#undef volatile
diff --git a/src/rttree.c b/src/rttree.c
index ea649fc..370f58f 100644
--- a/src/rttree.c
+++ b/src/rttree.c
@@ -33,7 +33,7 @@
 */
 static int rect_node_is_leaf(const RTCTX *ctx, const RECT_NODE *node)
 {
-	return (node->p1 != NULL);
+  return (node->p1 != NULL);
 }
 
 /**
@@ -42,83 +42,83 @@ static int rect_node_is_leaf(const RTCTX *ctx, const RECT_NODE *node)
 */
 void rect_tree_free(const RTCTX *ctx, RECT_NODE *node)
 {
-	if ( node->left_node )
-	{
-		rect_tree_free(ctx, node->left_node);
-		node->left_node = 0;
-	}
-	if ( node->right_node )
-	{
-		rect_tree_free(ctx, node->right_node);
-		node->right_node = 0;
-	}
-	rtfree(ctx, node);
+  if ( node->left_node )
+  {
+    rect_tree_free(ctx, node->left_node);
+    node->left_node = 0;
+  }
+  if ( node->right_node )
+  {
+    rect_tree_free(ctx, node->right_node);
+    node->right_node = 0;
+  }
+  rtfree(ctx, node);
 }
 
 /* 0 => no containment */
 int rect_tree_contains_point(const RTCTX *ctx, const RECT_NODE *node, const RTPOINT2D *pt, int *on_boundary)
 {
-	if ( FP_CONTAINS_INCL(node->ymin, pt->y, node->ymax) )
-	{
-		if ( rect_node_is_leaf(ctx, node) )
-		{
-			double side = rt_segment_side(ctx, node->p1, node->p2, pt);
-			if ( side == 0 )
-				*on_boundary = RT_TRUE;
-			return (side < 0 ? -1 : 1 );
-		}
-		else
-		{
-			return rect_tree_contains_point(ctx, node->left_node, pt, on_boundary) +
-			       rect_tree_contains_point(ctx, node->right_node, pt, on_boundary);
-		}
-	}
-	/* printf("NOT in measure range\n"); */
-	return 0;
+  if ( FP_CONTAINS_INCL(node->ymin, pt->y, node->ymax) )
+  {
+    if ( rect_node_is_leaf(ctx, node) )
+    {
+      double side = rt_segment_side(ctx, node->p1, node->p2, pt);
+      if ( side == 0 )
+        *on_boundary = RT_TRUE;
+      return (side < 0 ? -1 : 1 );
+    }
+    else
+    {
+      return rect_tree_contains_point(ctx, node->left_node, pt, on_boundary) +
+             rect_tree_contains_point(ctx, node->right_node, pt, on_boundary);
+    }
+  }
+  /* printf("NOT in measure range\n"); */
+  return 0;
 }
 
 int rect_tree_intersects_tree(const RTCTX *ctx, const RECT_NODE *n1, const RECT_NODE *n2)
 {
-	RTDEBUGF(4,"n1 (%.9g %.9g,%.9g %.9g) vs n2 (%.9g %.9g,%.9g %.9g)",n1->xmin,n1->ymin,n1->xmax,n1->ymax,n2->xmin,n2->ymin,n2->xmax,n2->ymax);
-	/* There can only be an edge intersection if the rectangles overlap */
-	if ( ! ( FP_GT(n1->xmin, n2->xmax) || FP_GT(n2->xmin, n1->xmax) || FP_GT(n1->ymin, n2->ymax) || FP_GT(n2->ymin, n1->ymax) ) )
-	{
-		RTDEBUG(4," interaction found");
-		/* We can only test for a true intersection if the nodes are both leaf nodes */
-		if ( rect_node_is_leaf(ctx, n1) && rect_node_is_leaf(ctx, n2) )
-		{
-			RTDEBUG(4,"  leaf node test");
-			/* Check for true intersection */
-			if ( rt_segment_intersects(ctx, n1->p1, n1->p2, n2->p1, n2->p2) )
-				return RT_TRUE;
-			else
-				return RT_FALSE;
-		}
-		else
-		{
-			RTDEBUG(4,"  internal node found, recursing");
-			/* Recurse to children */
-			if ( rect_node_is_leaf(ctx, n1) )
-			{
-				if ( rect_tree_intersects_tree(ctx, n2->left_node, n1) || rect_tree_intersects_tree(ctx, n2->right_node, n1) )
-					return RT_TRUE;
-				else
-					return RT_FALSE;
-			}
-			else
-			{
-				if ( rect_tree_intersects_tree(ctx, n1->left_node, n2) || rect_tree_intersects_tree(ctx, n1->right_node, n2) )
-					return RT_TRUE;
-				else
-					return RT_FALSE;
-			}
-		}
-	}
-	else
-	{
-		RTDEBUG(4," no interaction found");
-		return RT_FALSE;
-	}
+  RTDEBUGF(4,"n1 (%.9g %.9g,%.9g %.9g) vs n2 (%.9g %.9g,%.9g %.9g)",n1->xmin,n1->ymin,n1->xmax,n1->ymax,n2->xmin,n2->ymin,n2->xmax,n2->ymax);
+  /* There can only be an edge intersection if the rectangles overlap */
+  if ( ! ( FP_GT(n1->xmin, n2->xmax) || FP_GT(n2->xmin, n1->xmax) || FP_GT(n1->ymin, n2->ymax) || FP_GT(n2->ymin, n1->ymax) ) )
+  {
+    RTDEBUG(4," interaction found");
+    /* We can only test for a true intersection if the nodes are both leaf nodes */
+    if ( rect_node_is_leaf(ctx, n1) && rect_node_is_leaf(ctx, n2) )
+    {
+      RTDEBUG(4,"  leaf node test");
+      /* Check for true intersection */
+      if ( rt_segment_intersects(ctx, n1->p1, n1->p2, n2->p1, n2->p2) )
+        return RT_TRUE;
+      else
+        return RT_FALSE;
+    }
+    else
+    {
+      RTDEBUG(4,"  internal node found, recursing");
+      /* Recurse to children */
+      if ( rect_node_is_leaf(ctx, n1) )
+      {
+        if ( rect_tree_intersects_tree(ctx, n2->left_node, n1) || rect_tree_intersects_tree(ctx, n2->right_node, n1) )
+          return RT_TRUE;
+        else
+          return RT_FALSE;
+      }
+      else
+      {
+        if ( rect_tree_intersects_tree(ctx, n1->left_node, n2) || rect_tree_intersects_tree(ctx, n1->right_node, n2) )
+          return RT_TRUE;
+        else
+          return RT_FALSE;
+      }
+    }
+  }
+  else
+  {
+    RTDEBUG(4," no interaction found");
+    return RT_FALSE;
+  }
 }
 
 
@@ -128,26 +128,26 @@ int rect_tree_intersects_tree(const RTCTX *ctx, const RECT_NODE *n1, const RECT_
 */
 RECT_NODE* rect_node_leaf_new(const RTCTX *ctx, const RTPOINTARRAY *pa, int i)
 {
-	RTPOINT2D *p1, *p2;
-	RECT_NODE *node;
-
-	p1 = (RTPOINT2D*)rt_getPoint_internal(ctx, pa, i);
-	p2 = (RTPOINT2D*)rt_getPoint_internal(ctx, pa, i+1);
-
-	/* Zero length edge, doesn't get a node */
-	if ( FP_EQUALS(p1->x, p2->x) && FP_EQUALS(p1->y, p2->y) )
-		return NULL;
-
-	node = rtalloc(ctx, sizeof(RECT_NODE));
-	node->p1 = p1;
-	node->p2 = p2;
-	node->xmin = FP_MIN(p1->x,p2->x);
-	node->xmax = FP_MAX(p1->x,p2->x);
-	node->ymin = FP_MIN(p1->y,p2->y);
-	node->ymax = FP_MAX(p1->y,p2->y);
-	node->left_node = NULL;
-	node->right_node = NULL;
-	return node;
+  RTPOINT2D *p1, *p2;
+  RECT_NODE *node;
+
+  p1 = (RTPOINT2D*)rt_getPoint_internal(ctx, pa, i);
+  p2 = (RTPOINT2D*)rt_getPoint_internal(ctx, pa, i+1);
+
+  /* Zero length edge, doesn't get a node */
+  if ( FP_EQUALS(p1->x, p2->x) && FP_EQUALS(p1->y, p2->y) )
+    return NULL;
+
+  node = rtalloc(ctx, sizeof(RECT_NODE));
+  node->p1 = p1;
+  node->p2 = p2;
+  node->xmin = FP_MIN(p1->x,p2->x);
+  node->xmax = FP_MAX(p1->x,p2->x);
+  node->ymin = FP_MIN(p1->y,p2->y);
+  node->ymax = FP_MAX(p1->y,p2->y);
+  node->left_node = NULL;
+  node->right_node = NULL;
+  return node;
 }
 
 /**
@@ -156,16 +156,16 @@ RECT_NODE* rect_node_leaf_new(const RTCTX *ctx, const RTPOINTARRAY *pa, int i)
 */
 RECT_NODE* rect_node_internal_new(const RTCTX *ctx, RECT_NODE *left_node, RECT_NODE *right_node)
 {
-	RECT_NODE *node = rtalloc(ctx, sizeof(RECT_NODE));
-	node->p1 = NULL;
-	node->p2 = NULL;
-	node->xmin = FP_MIN(left_node->xmin, right_node->xmin);
-	node->xmax = FP_MAX(left_node->xmax, right_node->xmax);
-	node->ymin = FP_MIN(left_node->ymin, right_node->ymin);
-	node->ymax = FP_MAX(left_node->ymax, right_node->ymax);
-	node->left_node = left_node;
-	node->right_node = right_node;
-	return node;
+  RECT_NODE *node = rtalloc(ctx, sizeof(RECT_NODE));
+  node->p1 = NULL;
+  node->p2 = NULL;
+  node->xmin = FP_MIN(left_node->xmin, right_node->xmin);
+  node->xmax = FP_MAX(left_node->xmax, right_node->xmax);
+  node->ymin = FP_MIN(left_node->ymin, right_node->ymin);
+  node->ymax = FP_MAX(left_node->ymax, right_node->ymax);
+  node->left_node = left_node;
+  node->right_node = right_node;
+  return node;
 }
 
 /**
@@ -175,75 +175,75 @@ RECT_NODE* rect_node_internal_new(const RTCTX *ctx, RECT_NODE *left_node, RECT_N
 */
 RECT_NODE* rect_tree_new(const RTCTX *ctx, const RTPOINTARRAY *pa)
 {
-	int num_edges, num_children, num_parents;
-	int i, j;
-	RECT_NODE **nodes;
-	RECT_NODE *node;
-	RECT_NODE *tree;
-
-	if ( pa->npoints < 2 )
-	{
-		return NULL;
-	}
-
-	/*
-	** First create a flat list of nodes, one per edge.
-	** For each vertex, transform into our one-dimensional measure.
-	** Hopefully, when projected, the points turn into a fairly
-	** uniformly distributed collection of measures.
-	*/
-	num_edges = pa->npoints - 1;
-	nodes = rtalloc(ctx, sizeof(RECT_NODE*) * pa->npoints);
-	j = 0;
-	for ( i = 0; i < num_edges; i++ )
-	{
-		node = rect_node_leaf_new(ctx, pa, i);
-		if ( node ) /* Not zero length? */
-		{
-			nodes[j] = node;
-			j++;
-		}
-	}
-
-	/*
-	** If we sort the nodelist first, we'll get a more balanced tree
-	** in the end, but at the cost of sorting. For now, we just
-	** build the tree knowing that point arrays tend to have a
-	** reasonable amount of sorting already.
-	*/
-
-	num_children = j;
-	num_parents = num_children / 2;
-	while ( num_parents > 0 )
-	{
-		j = 0;
-		while ( j < num_parents )
-		{
-			/*
-			** Each new parent includes pointers to the children, so even though
-			** we are over-writing their place in the list, we still have references
-			** to them via the tree.
-			*/
-			nodes[j] = rect_node_internal_new(ctx, nodes[2*j], nodes[(2*j)+1]);
-			j++;
-		}
-		/* Odd number of children, just copy the last node up a level */
-		if ( num_children % 2 )
-		{
-			nodes[j] = nodes[num_children - 1];
-			num_parents++;
-		}
-		num_children = num_parents;
-		num_parents = num_children / 2;
-	}
-
-	/* Take a reference to the head of the tree*/
-	tree = nodes[0];
-
-	/* Free the old list structure, leaving the tree in place */
-	rtfree(ctx, nodes);
-
-	return tree;
+  int num_edges, num_children, num_parents;
+  int i, j;
+  RECT_NODE **nodes;
+  RECT_NODE *node;
+  RECT_NODE *tree;
+
+  if ( pa->npoints < 2 )
+  {
+    return NULL;
+  }
+
+  /*
+  ** First create a flat list of nodes, one per edge.
+  ** For each vertex, transform into our one-dimensional measure.
+  ** Hopefully, when projected, the points turn into a fairly
+  ** uniformly distributed collection of measures.
+  */
+  num_edges = pa->npoints - 1;
+  nodes = rtalloc(ctx, sizeof(RECT_NODE*) * pa->npoints);
+  j = 0;
+  for ( i = 0; i < num_edges; i++ )
+  {
+    node = rect_node_leaf_new(ctx, pa, i);
+    if ( node ) /* Not zero length? */
+    {
+      nodes[j] = node;
+      j++;
+    }
+  }
+
+  /*
+  ** If we sort the nodelist first, we'll get a more balanced tree
+  ** in the end, but at the cost of sorting. For now, we just
+  ** build the tree knowing that point arrays tend to have a
+  ** reasonable amount of sorting already.
+  */
+
+  num_children = j;
+  num_parents = num_children / 2;
+  while ( num_parents > 0 )
+  {
+    j = 0;
+    while ( j < num_parents )
+    {
+      /*
+      ** Each new parent includes pointers to the children, so even though
+      ** we are over-writing their place in the list, we still have references
+      ** to them via the tree.
+      */
+      nodes[j] = rect_node_internal_new(ctx, nodes[2*j], nodes[(2*j)+1]);
+      j++;
+    }
+    /* Odd number of children, just copy the last node up a level */
+    if ( num_children % 2 )
+    {
+      nodes[j] = nodes[num_children - 1];
+      num_parents++;
+    }
+    num_children = num_parents;
+    num_parents = num_children / 2;
+  }
+
+  /* Take a reference to the head of the tree*/
+  tree = nodes[0];
+
+  /* Free the old list structure, leaving the tree in place */
+  rtfree(ctx, nodes);
+
+  return tree;
 
 }
 
diff --git a/src/rttree.h b/src/rttree.h
index 8601236..1b7dc31 100644
--- a/src/rttree.h
+++ b/src/rttree.h
@@ -25,15 +25,15 @@
 
 typedef struct rect_node
 {
-	double xmin;
-	double xmax;
-	double ymin;
-	double ymax;
-	struct rect_node *left_node;
-	struct rect_node *right_node;
-	RTPOINT2D *p1;
-	RTPOINT2D *p2;
-} RECT_NODE;	
+  double xmin;
+  double xmax;
+  double ymin;
+  double ymax;
+  struct rect_node *left_node;
+  struct rect_node *right_node;
+  RTPOINT2D *p1;
+  RTPOINT2D *p2;
+} RECT_NODE;
 
 int rect_tree_contains_point(const RTCTX *ctx, const RECT_NODE *tree, const RTPOINT2D *pt, int *on_boundary);
 int rect_tree_intersects_tree(const RTCTX *ctx, const RECT_NODE *tree1, const RECT_NODE *tree2);
diff --git a/src/rttriangle.c b/src/rttriangle.c
index 6062d74..f7ff313 100644
--- a/src/rttriangle.c
+++ b/src/rttriangle.c
@@ -40,96 +40,96 @@
 RTTRIANGLE*
 rttriangle_construct(const RTCTX *ctx, int srid, RTGBOX *bbox, RTPOINTARRAY *points)
 {
-	RTTRIANGLE *result;
+  RTTRIANGLE *result;
 
-	result = (RTTRIANGLE*) rtalloc(ctx, sizeof(RTTRIANGLE));
-	result->type = RTTRIANGLETYPE;
+  result = (RTTRIANGLE*) rtalloc(ctx, sizeof(RTTRIANGLE));
+  result->type = RTTRIANGLETYPE;
 
-	result->flags = points->flags;
-	RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
-	
-	result->srid = srid;
-	result->points = points;
-	result->bbox = bbox;
+  result->flags = points->flags;
+  RTFLAGS_SET_BBOX(result->flags, bbox?1:0);
 
-	return result;
+  result->srid = srid;
+  result->points = points;
+  result->bbox = bbox;
+
+  return result;
 }
 
 RTTRIANGLE*
 rttriangle_construct_empty(const RTCTX *ctx, int srid, char hasz, char hasm)
 {
-	RTTRIANGLE *result = rtalloc(ctx, sizeof(RTTRIANGLE));
-	result->type = RTTRIANGLETYPE;
-	result->flags = gflags(ctx, hasz,hasm,0);
-	result->srid = srid;
-	result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
-	result->bbox = NULL;
-	return result;
+  RTTRIANGLE *result = rtalloc(ctx, sizeof(RTTRIANGLE));
+  result->type = RTTRIANGLETYPE;
+  result->flags = gflags(ctx, hasz,hasm,0);
+  result->srid = srid;
+  result->points = ptarray_construct_empty(ctx, hasz, hasm, 1);
+  result->bbox = NULL;
+  return result;
 }
 
 void rttriangle_free(const RTCTX *ctx, RTTRIANGLE  *triangle)
 {
-	if ( ! triangle ) return;
-	
-	if (triangle->bbox)
-		rtfree(ctx, triangle->bbox);
-		
-	if (triangle->points)
-		ptarray_free(ctx, triangle->points);
-		
-	rtfree(ctx, triangle);
+  if ( ! triangle ) return;
+
+  if (triangle->bbox)
+    rtfree(ctx, triangle->bbox);
+
+  if (triangle->points)
+    ptarray_free(ctx, triangle->points);
+
+  rtfree(ctx, triangle);
 }
 
 void printRTTRIANGLE(const RTCTX *ctx, RTTRIANGLE *triangle)
 {
-	if (triangle->type != RTTRIANGLETYPE)
+  if (triangle->type != RTTRIANGLETYPE)
                 rterror(ctx, "printRTTRIANGLE called with something else than a Triangle");
 
-	rtnotice(ctx, "RTTRIANGLE {");
-	rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(triangle->flags));
-	rtnotice(ctx, "    SRID = %i", (int)triangle->srid);
-	printPA(ctx, triangle->points);
-	rtnotice(ctx, "}");
+  rtnotice(ctx, "RTTRIANGLE {");
+  rtnotice(ctx, "    ndims = %i", (int)RTFLAGS_NDIMS(triangle->flags));
+  rtnotice(ctx, "    SRID = %i", (int)triangle->srid);
+  printPA(ctx, triangle->points);
+  rtnotice(ctx, "}");
 }
 
 /* @brief Clone RTTRIANGLE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 RTTRIANGLE *
 rttriangle_clone(const RTCTX *ctx, const RTTRIANGLE *g)
 {
-	RTDEBUGF(2, "rttriangle_clone called with %p", g);
-	return (RTTRIANGLE *)rtline_clone(ctx, (const RTLINE *)g);
+  RTDEBUGF(2, "rttriangle_clone called with %p", g);
+  return (RTTRIANGLE *)rtline_clone(ctx, (const RTLINE *)g);
 }
 
 void
 rttriangle_force_clockwise(const RTCTX *ctx, RTTRIANGLE *triangle)
 {
-	if ( ptarray_isccw(ctx, triangle->points) )
-		ptarray_reverse(ctx, triangle->points);
+  if ( ptarray_isccw(ctx, triangle->points) )
+    ptarray_reverse(ctx, triangle->points);
 }
 
 void
 rttriangle_reverse(const RTCTX *ctx, RTTRIANGLE *triangle)
 {
-	if( rttriangle_is_empty(ctx, triangle) ) return;
-	ptarray_reverse(ctx, triangle->points);
+  if( rttriangle_is_empty(ctx, triangle) ) return;
+  ptarray_reverse(ctx, triangle->points);
 }
 
 void
 rttriangle_release(const RTCTX *ctx, RTTRIANGLE *rttriangle)
 {
-	rtgeom_release(ctx, rttriangle_as_rtgeom(ctx, rttriangle));
+  rtgeom_release(ctx, rttriangle_as_rtgeom(ctx, rttriangle));
 }
 
 /* check coordinate equality  */
 char
 rttriangle_same(const RTCTX *ctx, const RTTRIANGLE *t1, const RTTRIANGLE *t2)
 {
-	char r = ptarray_same(ctx, t1->points, t2->points);
-	RTDEBUGF(5, "returning %d", r);
-	return r;
+  char r = ptarray_same(ctx, t1->points, t2->points);
+  RTDEBUGF(5, "returning %d", r);
+  return r;
 }
 
 /*
@@ -141,85 +141,85 @@ rttriangle_same(const RTCTX *ctx, const RTTRIANGLE *t1, const RTTRIANGLE *t2)
 RTTRIANGLE *
 rttriangle_from_rtline(const RTCTX *ctx, const RTLINE *shell)
 {
-	RTTRIANGLE *ret;
-	RTPOINTARRAY *pa;
+  RTTRIANGLE *ret;
+  RTPOINTARRAY *pa;
 
-	if ( shell->points->npoints != 4 )
-		rterror(ctx, "rttriangle_from_rtline: shell must have exactly 4 points");
+  if ( shell->points->npoints != 4 )
+    rterror(ctx, "rttriangle_from_rtline: shell must have exactly 4 points");
 
-	if (   (!RTFLAGS_GET_Z(shell->flags) && !ptarray_is_closed_2d(ctx, shell->points)) ||
-	        (RTFLAGS_GET_Z(shell->flags) && !ptarray_is_closed_3d(ctx, shell->points)) )
-		rterror(ctx, "rttriangle_from_rtline: shell must be closed");
+  if (   (!RTFLAGS_GET_Z(shell->flags) && !ptarray_is_closed_2d(ctx, shell->points)) ||
+          (RTFLAGS_GET_Z(shell->flags) && !ptarray_is_closed_3d(ctx, shell->points)) )
+    rterror(ctx, "rttriangle_from_rtline: shell must be closed");
 
-	pa = ptarray_clone_deep(ctx, shell->points);
-	ret = rttriangle_construct(ctx, shell->srid, NULL, pa);
+  pa = ptarray_clone_deep(ctx, shell->points);
+  ret = rttriangle_construct(ctx, shell->srid, NULL, pa);
 
-	if (rttriangle_is_repeated_points(ctx, ret))
-		rterror(ctx, "rttriangle_from_rtline: some points are repeated in triangle");
+  if (rttriangle_is_repeated_points(ctx, ret))
+    rterror(ctx, "rttriangle_from_rtline: some points are repeated in triangle");
 
-	return ret;
+  return ret;
 }
 
 char
 rttriangle_is_repeated_points(const RTCTX *ctx, RTTRIANGLE *triangle)
 {
-	char ret;
-	RTPOINTARRAY *pa;
+  char ret;
+  RTPOINTARRAY *pa;
 
-	pa = ptarray_remove_repeated_points(ctx, triangle->points, 0.0);
-	ret = ptarray_same(ctx, pa, triangle->points);
-	ptarray_free(ctx, pa);
+  pa = ptarray_remove_repeated_points(ctx, triangle->points, 0.0);
+  ret = ptarray_same(ctx, pa, triangle->points);
+  ptarray_free(ctx, pa);
 
-	return ret;
+  return ret;
 }
 
 int rttriangle_is_empty(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	if ( !triangle->points || triangle->points->npoints < 1 )
-		return RT_TRUE;
-	return RT_FALSE;
+  if ( !triangle->points || triangle->points->npoints < 1 )
+    return RT_TRUE;
+  return RT_FALSE;
 }
 
 /**
- * Find the area of the outer ring 
+ * Find the area of the outer ring
  */
 double
 rttriangle_area(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	double area=0.0;
-	int i;
-	RTPOINT2D p1;
-	RTPOINT2D p2;
+  double area=0.0;
+  int i;
+  RTPOINT2D p1;
+  RTPOINT2D p2;
 
-	if (! triangle->points->npoints) return area; /* empty triangle */
+  if (! triangle->points->npoints) return area; /* empty triangle */
 
-	for (i=0; i < triangle->points->npoints-1; i++)
-	{
-		rt_getPoint2d_p(ctx, triangle->points, i, &p1);
-		rt_getPoint2d_p(ctx, triangle->points, i+1, &p2);
-		area += ( p1.x * p2.y ) - ( p1.y * p2.x );
-	}
+  for (i=0; i < triangle->points->npoints-1; i++)
+  {
+    rt_getPoint2d_p(ctx, triangle->points, i, &p1);
+    rt_getPoint2d_p(ctx, triangle->points, i+1, &p2);
+    area += ( p1.x * p2.y ) - ( p1.y * p2.x );
+  }
 
-	area  /= 2.0;
+  area  /= 2.0;
 
-	return fabs(area);
+  return fabs(area);
 }
 
 
 double
 rttriangle_perimeter(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	if( triangle->points ) 
-		return ptarray_length(ctx, triangle->points);
-	else 
-		return 0.0;
+  if( triangle->points )
+    return ptarray_length(ctx, triangle->points);
+  else
+    return 0.0;
 }
 
 double
 rttriangle_perimeter_2d(const RTCTX *ctx, const RTTRIANGLE *triangle)
 {
-	if( triangle->points ) 
-		return ptarray_length_2d(ctx, triangle->points);
-	else 
-		return 0.0;
+  if( triangle->points )
+    return ptarray_length_2d(ctx, triangle->points);
+  else
+    return 0.0;
 }
diff --git a/src/rtutil.c b/src/rtutil.c
index b2ae93e..6ecd29d 100644
--- a/src/rtutil.c
+++ b/src/rtutil.c
@@ -47,22 +47,22 @@ static void * default_reallocator(void *mem, size_t size);
 
 static char *rtgeomTypeName[] =
 {
-	"Unknown",
-	"Point",
-	"LineString",
-	"Polygon",
-	"MultiPoint",
-	"MultiLineString",
-	"MultiPolygon",
-	"GeometryCollection",
-	"CircularString",
-	"CompoundCurve",
-	"CurvePolygon",
-	"MultiCurve",
-	"MultiSurface",
-	"PolyhedralSurface",
-	"Triangle",
-	"Tin"
+  "Unknown",
+  "Point",
+  "LineString",
+  "Polygon",
+  "MultiPoint",
+  "MultiLineString",
+  "MultiPolygon",
+  "GeometryCollection",
+  "CircularString",
+  "CompoundCurve",
+  "CurvePolygon",
+  "MultiCurve",
+  "MultiSurface",
+  "PolyhedralSurface",
+  "Triangle",
+  "Tin"
 };
 
 /*
@@ -76,40 +76,40 @@ static char *rtgeomTypeName[] =
 void
 rtnotice(const RTCTX *ctx, const char *fmt, ...)
 {
-	va_list ap;
+  va_list ap;
 
-	va_start(ap, fmt);
+  va_start(ap, fmt);
 
-	/* Call the supplied function */
-	(*ctx->notice_logger)(fmt, ap, ctx->notice_logger_arg);
+  /* Call the supplied function */
+  (*ctx->notice_logger)(fmt, ap, ctx->notice_logger_arg);
 
-	va_end(ap);
+  va_end(ap);
 }
 
 void
 rterror(const RTCTX *ctx, const char *fmt, ...)
 {
-	va_list ap;
+  va_list ap;
 
-	va_start(ap, fmt);
+  va_start(ap, fmt);
 
-	/* Call the supplied function */
-	(*ctx->error_logger)(fmt, ap, ctx->error_logger_arg);
+  /* Call the supplied function */
+  (*ctx->error_logger)(fmt, ap, ctx->error_logger_arg);
 
-	va_end(ap);
+  va_end(ap);
 }
 
 void
 rtdebug(const RTCTX *ctx, int level, const char *fmt, ...)
 {
-	va_list ap;
+  va_list ap;
 
-	va_start(ap, fmt);
+  va_start(ap, fmt);
 
-	/* Call the supplied function */
-	(*ctx->debug_logger)(level, fmt, ap, ctx->debug_logger_arg);
+  /* Call the supplied function */
+  (*ctx->debug_logger)(level, fmt, ap, ctx->debug_logger_arg);
 
-	va_end(ap);
+  va_end(ap);
 }
 
 /*
@@ -123,56 +123,56 @@ rtdebug(const RTCTX *ctx, int level, const char *fmt, ...)
 static void *
 default_allocator(size_t size)
 {
-	void *mem = malloc(size);
-	return mem;
+  void *mem = malloc(size);
+  return mem;
 }
 
 static void
 default_freeor(void *mem)
 {
-	free(mem);
+  free(mem);
 }
 
 static void *
 default_reallocator(void *mem, size_t size)
 {
-	void *ret = realloc(mem, size);
-	return ret;
+  void *ret = realloc(mem, size);
+  return ret;
 }
 
 static void
 default_noticereporter(const char *fmt, va_list ap, void *arg)
 {
-	char msg[RT_MSG_MAXLEN+1];
-	vsnprintf (msg, RT_MSG_MAXLEN, fmt, ap);
-	msg[RT_MSG_MAXLEN]='\0';
-	printf("%s\n", msg);
+  char msg[RT_MSG_MAXLEN+1];
+  vsnprintf (msg, RT_MSG_MAXLEN, fmt, ap);
+  msg[RT_MSG_MAXLEN]='\0';
+  printf("%s\n", msg);
 }
 
 static void
 default_debuglogger(int level, const char *fmt, va_list ap, void *arg)
 {
-	char msg[RT_MSG_MAXLEN+1];
-	if ( RTGEOM_DEBUG_LEVEL >= level )
-	{
-		/* Space pad the debug output */
-		int i;
-		for ( i = 0; i < level; i++ )
-			msg[i] = ' ';
-		vsnprintf(msg+i, RT_MSG_MAXLEN-i, fmt, ap);
-		msg[RT_MSG_MAXLEN]='\0';
-		printf("%s\n", msg);
-	}
+  char msg[RT_MSG_MAXLEN+1];
+  if ( RTGEOM_DEBUG_LEVEL >= level )
+  {
+    /* Space pad the debug output */
+    int i;
+    for ( i = 0; i < level; i++ )
+      msg[i] = ' ';
+    vsnprintf(msg+i, RT_MSG_MAXLEN-i, fmt, ap);
+    msg[RT_MSG_MAXLEN]='\0';
+    printf("%s\n", msg);
+  }
 }
 
 static void
 default_errorreporter(const char *fmt, va_list ap, void *arg)
 {
-	char msg[RT_MSG_MAXLEN+1];
-	vsnprintf (msg, RT_MSG_MAXLEN, fmt, ap);
-	msg[RT_MSG_MAXLEN]='\0';
-	fprintf(stderr, "%s\n", msg);
-	exit(1);
+  char msg[RT_MSG_MAXLEN+1];
+  vsnprintf (msg, RT_MSG_MAXLEN, fmt, ap);
+  msg[RT_MSG_MAXLEN]='\0';
+  fprintf(stderr, "%s\n", msg);
+  exit(1);
 }
 
 RTCTX *
@@ -189,9 +189,9 @@ rtgeom_init(rtallocator allocator,
   ctx->rtrealloc_var = default_reallocator;
   ctx->rtfree_var = default_freeor;
 
-	if ( allocator ) ctx->rtalloc_var = allocator;
-	if ( reallocator ) ctx->rtrealloc_var = reallocator;
-	if ( freeor ) ctx->rtfree_var = freeor;
+  if ( allocator ) ctx->rtalloc_var = allocator;
+  if ( reallocator ) ctx->rtrealloc_var = reallocator;
+  if ( freeor ) ctx->rtfree_var = freeor;
 
   ctx->notice_logger = default_noticereporter;
   ctx->error_logger = default_errorreporter;
@@ -203,6 +203,8 @@ rtgeom_init(rtallocator allocator,
 void
 rtgeom_finish(RTCTX *ctx)
 {
+  if (ctx->gctx != NULL)
+    GEOS_finish_r(ctx->gctx);
   ctx->rtfree_var(ctx);
 }
 
@@ -227,36 +229,36 @@ rtgeom_set_debug_logger(RTCTX *ctx, rtdebuglogger logger, void *arg)
   ctx->debug_logger_arg = arg;
 }
 
-const char* 
+const char*
 rttype_name(const RTCTX *ctx, uint8_t type)
 {
-	if ( type > 15 )
-	{
-		/* assert(0); */
-		return "Invalid type";
-	}
-	return rtgeomTypeName[(int ) type];
+  if ( type > 15 )
+  {
+    /* assert(0); */
+    return "Invalid type";
+  }
+  return rtgeomTypeName[(int ) type];
 }
 
 void *
 rtalloc(const RTCTX *ctx, size_t size)
 {
-	void *mem = ctx->rtalloc_var(size);
-	RTDEBUGF(5, "rtalloc: %d@%p", size, mem);
-	return mem;
+  void *mem = ctx->rtalloc_var(size);
+  RTDEBUGF(5, "rtalloc: %d@%p", size, mem);
+  return mem;
 }
 
 void *
 rtrealloc(const RTCTX *ctx, void *mem, size_t size)
 {
-	RTDEBUGF(5, "rtrealloc: %d@%p", size, mem);
-	return ctx->rtrealloc_var(mem, size);
+  RTDEBUGF(5, "rtrealloc: %d@%p", size, mem);
+  return ctx->rtrealloc_var(mem, size);
 }
 
 void
 rtfree(const RTCTX *ctx, void *mem)
 {
-	ctx->rtfree_var(mem);
+  ctx->rtfree_var(mem);
 }
 
 /*
@@ -266,30 +268,30 @@ rtfree(const RTCTX *ctx, void *mem)
 void
 trim_trailing_zeros(const RTCTX *ctx, char *str)
 {
-	char *ptr, *totrim=NULL;
-	int len;
-	int i;
-
-	RTDEBUGF(3, "input: %s", str);
-
-	ptr = strchr(str, '.');
-	if ( ! ptr ) return; /* no dot, no decimal digits */
-
-	RTDEBUGF(3, "ptr: %s", ptr);
-
-	len = strlen(ptr);
-	for (i=len-1; i; i--)
-	{
-		if ( ptr[i] != '0' ) break;
-		totrim=&ptr[i];
-	}
-	if ( totrim )
-	{
-		if ( ptr == totrim-1 ) *ptr = '\0';
-		else *totrim = '\0';
-	}
-
-	RTDEBUGF(3, "output: %s", str);
+  char *ptr, *totrim=NULL;
+  int len;
+  int i;
+
+  RTDEBUGF(3, "input: %s", str);
+
+  ptr = strchr(str, '.');
+  if ( ! ptr ) return; /* no dot, no decimal digits */
+
+  RTDEBUGF(3, "ptr: %s", ptr);
+
+  len = strlen(ptr);
+  for (i=len-1; i; i--)
+  {
+    if ( ptr[i] != '0' ) break;
+    totrim=&ptr[i];
+  }
+  if ( totrim )
+  {
+    if ( ptr == totrim-1 ) *ptr = '\0';
+    else *totrim = '\0';
+  }
+
+  RTDEBUGF(3, "output: %s", str);
 }
 
 /*
@@ -306,107 +308,107 @@ trim_trailing_zeros(const RTCTX *ctx, char *str)
 
 char * rtmessage_truncate(const RTCTX *ctx, char *str, int startpos, int endpos, int maxlength, int truncdirection)
 {
-	char *output;
-	char *outstart;
-
-	/* Allocate space for new string */
-	output = rtalloc(ctx, maxlength + 4);
-	output[0] = '\0';
-
-	/* Start truncation */
-	if (truncdirection == 0)
-	{
-		/* Calculate the start position */
-		if (endpos - startpos < maxlength)
-		{
-			outstart = str + startpos;
-			strncat(output, outstart, endpos - startpos + 1);
-		}
-		else
-		{
-			if (maxlength >= 3)
-			{
-				/* Add "..." prefix */
-				outstart = str + endpos + 1 - maxlength + 3;
-				strncat(output, "...", 3);
-				strncat(output, outstart, maxlength - 3);
-			}
-			else
-			{
-				/* maxlength is too small; just output "..." */
-				strncat(output, "...", 3);
-			}
-		}
-	}
-
-	/* End truncation */
-	if (truncdirection == 1)
-	{
-		/* Calculate the end position */
-		if (endpos - startpos < maxlength)
-		{
-			outstart = str + startpos;
-			strncat(output, outstart, endpos - startpos + 1);
-		}
-		else
-		{
-			if (maxlength >= 3)
-			{
-				/* Add "..." suffix */
-				outstart = str + startpos;
-				strncat(output, outstart, maxlength - 3);
-				strncat(output, "...", 3);
-			}
-			else
-			{
-				/* maxlength is too small; just output "..." */
-				strncat(output, "...", 3);
-			}
-		}
-	}
-
-	return output;
+  char *output;
+  char *outstart;
+
+  /* Allocate space for new string */
+  output = rtalloc(ctx, maxlength + 4);
+  output[0] = '\0';
+
+  /* Start truncation */
+  if (truncdirection == 0)
+  {
+    /* Calculate the start position */
+    if (endpos - startpos < maxlength)
+    {
+      outstart = str + startpos;
+      strncat(output, outstart, endpos - startpos + 1);
+    }
+    else
+    {
+      if (maxlength >= 3)
+      {
+        /* Add "..." prefix */
+        outstart = str + endpos + 1 - maxlength + 3;
+        strncat(output, "...", 3);
+        strncat(output, outstart, maxlength - 3);
+      }
+      else
+      {
+        /* maxlength is too small; just output "..." */
+        strncat(output, "...", 3);
+      }
+    }
+  }
+
+  /* End truncation */
+  if (truncdirection == 1)
+  {
+    /* Calculate the end position */
+    if (endpos - startpos < maxlength)
+    {
+      outstart = str + startpos;
+      strncat(output, outstart, endpos - startpos + 1);
+    }
+    else
+    {
+      if (maxlength >= 3)
+      {
+        /* Add "..." suffix */
+        outstart = str + startpos;
+        strncat(output, outstart, maxlength - 3);
+        strncat(output, "...", 3);
+      }
+      else
+      {
+        /* maxlength is too small; just output "..." */
+        strncat(output, "...", 3);
+      }
+    }
+  }
+
+  return output;
 }
 
 
 char
 getMachineEndian(const RTCTX *ctx)
 {
-	static int endian_check_int = 1; /* dont modify this!!! */
+  static int endian_check_int = 1; /* dont modify this!!! */
 
-	return *((char *) &endian_check_int); /* 0 = big endian | xdr,
-	                                       * 1 = little endian | ndr
-	                                       */
+  return *((char *) &endian_check_int); /* 0 = big endian | xdr,
+                                         * 1 = little endian | ndr
+                                         */
 }
 
 
 void
 error_if_srid_mismatch(const RTCTX *ctx, int srid1, int srid2)
 {
-	if ( srid1 != srid2 )
-	{
-		rterror(ctx, "Operation on mixed SRID geometries");
-	}
+  if ( srid1 != srid2 )
+  {
+    rterror(ctx, "Operation on mixed SRID geometries");
+  }
 }
 
 int
 clamp_srid(const RTCTX *ctx, int srid)
 {
-	int newsrid = srid;
-
-	if ( newsrid <= 0 ) {
-		if ( newsrid != SRID_UNKNOWN ) {
-			newsrid = SRID_UNKNOWN;
-			rtnotice(ctx, "SRID value %d converted to the officially unknown SRID value %d", srid, newsrid);
-		}
-	} else if ( srid > SRID_MAXIMUM ) {
+  int newsrid = srid;
+
+  if ( newsrid <= 0 ) {
+    if ( newsrid != SRID_UNKNOWN ) {
+      newsrid = SRID_UNKNOWN;
+      rtnotice(ctx, "SRID value %d converted to the officially unknown SRID value %d", srid, newsrid);
+    }
+  } else if ( srid > SRID_MAXIMUM ) {
     newsrid = SRID_USER_MAXIMUM + 1 +
       /* -1 is to reduce likelyhood of clashes */
       /* NOTE: must match implementation in postgis_restore.pl */
       ( srid % ( SRID_MAXIMUM - SRID_USER_MAXIMUM - 1 ) );
-		rtnotice(ctx, "SRID value %d > SRID_MAXIMUM converted to %d", srid, newsrid);
-	}
-	
-	return newsrid;
+    rtnotice(ctx, "SRID value %d > SRID_MAXIMUM converted to %d", srid, newsrid);
+  }
+
+  return newsrid;
 }
 
diff --git a/src/stringbuffer.c b/src/stringbuffer.c
index f44738a..2571815 100644
--- a/src/stringbuffer.c
+++ b/src/stringbuffer.c
@@ -32,36 +32,36 @@
 /**
 * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
 */
-stringbuffer_t* 
+stringbuffer_t*
 stringbuffer_create(const RTCTX *ctx)
 {
-	return stringbuffer_create_with_size(ctx, STRINGBUFFER_STARTSIZE);
+  return stringbuffer_create_with_size(ctx, STRINGBUFFER_STARTSIZE);
 }
 
 /**
 * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
 */
-stringbuffer_t* 
+stringbuffer_t*
 stringbuffer_create_with_size(const RTCTX *ctx, size_t size)
 {
-	stringbuffer_t *s;
-
-	s = rtalloc(ctx, sizeof(stringbuffer_t));
-	s->str_start = rtalloc(ctx, size);
-	s->str_end = s->str_start;
-	s->capacity = size;
-	memset(s->str_start,0,size);
-	return s;
+  stringbuffer_t *s;
+
+  s = rtalloc(ctx, sizeof(stringbuffer_t));
+  s->str_start = rtalloc(ctx, size);
+  s->str_end = s->str_start;
+  s->capacity = size;
+  memset(s->str_start,0,size);
+  return s;
 }
 
 /**
 * Free the stringbuffer_t and all memory managed within it.
 */
-void 
+void
 stringbuffer_destroy(const RTCTX *ctx, stringbuffer_t *s)
 {
-	if ( s->str_start ) rtfree(ctx, s->str_start);
-	if ( s ) rtfree(ctx, s);
+  if ( s->str_start ) rtfree(ctx, s->str_start);
+  if ( s ) rtfree(ctx, s);
 }
 
 /**
@@ -69,58 +69,58 @@ stringbuffer_destroy(const RTCTX *ctx, stringbuffer_t *s)
 * without the expense of freeing and re-allocating a new
 * stringbuffer_t.
 */
-void 
+void
 stringbuffer_clear(const RTCTX *ctx, stringbuffer_t *s)
 {
-	s->str_start[0] = '\0';
-	s->str_end = s->str_start;
+  s->str_start[0] = '\0';
+  s->str_end = s->str_start;
 }
 
 /**
 * If necessary, expand the stringbuffer_t internal buffer to accomodate the
 * specified additional size.
 */
-static inline void 
+static inline void
 stringbuffer_makeroom(const RTCTX *ctx, stringbuffer_t *s, size_t size_to_add)
 {
-	size_t current_size = (s->str_end - s->str_start);
-	size_t capacity = s->capacity;
-	size_t required_size = current_size + size_to_add;
-
-	while (capacity < required_size)
-		capacity *= 2;
-
-	if ( capacity > s->capacity )
-	{
-		s->str_start = rtrealloc(ctx, s->str_start, capacity);
-		s->capacity = capacity;
-		s->str_end = s->str_start + current_size;
-	}
+  size_t current_size = (s->str_end - s->str_start);
+  size_t capacity = s->capacity;
+  size_t required_size = current_size + size_to_add;
+
+  while (capacity < required_size)
+    capacity *= 2;
+
+  if ( capacity > s->capacity )
+  {
+    s->str_start = rtrealloc(ctx, s->str_start, capacity);
+    s->capacity = capacity;
+    s->str_end = s->str_start + current_size;
+  }
 }
 
 /**
 * Return the last character in the buffer.
 */
-char 
+char
 stringbuffer_lastchar(const RTCTX *ctx, stringbuffer_t *s)
 {
-	if( s->str_end == s->str_start ) 
-		return 0;
-	
-	return *(s->str_end - 1);
+  if( s->str_end == s->str_start )
+    return 0;
+
+  return *(s->str_end - 1);
 }
 
 /**
 * Append the specified string to the stringbuffer_t.
 */
-void 
+void
 stringbuffer_append(const RTCTX *ctx, stringbuffer_t *s, const char *a)
 {
-	int alen = strlen(a); /* Length of string to append */
-	int alen0 = alen + 1; /* Length including null terminator */
-	stringbuffer_makeroom(ctx, s, alen0);
-	memcpy(s->str_end, a, alen0);
-	s->str_end += alen;
+  int alen = strlen(a); /* Length of string to append */
+  int alen0 = alen + 1; /* Length including null terminator */
+  stringbuffer_makeroom(ctx, s, alen0);
+  memcpy(s->str_end, a, alen0);
+  s->str_end += alen;
 }
 
 /**
@@ -128,10 +128,10 @@ stringbuffer_append(const RTCTX *ctx, stringbuffer_t *s, const char *a)
 * the stringbuffer. The current string will be null-terminated
 * within the internal string.
 */
-const char* 
+const char*
 stringbuffer_getstring(const RTCTX *ctx, stringbuffer_t *s)
 {
-	return s->str_start;
+  return s->str_start;
 }
 
 /**
@@ -139,43 +139,43 @@ stringbuffer_getstring(const RTCTX *ctx, stringbuffer_t *s)
 * current state of the string. Caller is responsible for
 * freeing the return value.
 */
-char* 
+char*
 stringbuffer_getstringcopy(const RTCTX *ctx, stringbuffer_t *s)
 {
-	size_t size = (s->str_end - s->str_start) + 1;
-	char *str = rtalloc(ctx, size);
-	memcpy(str, s->str_start, size);
-	str[size - 1] = '\0';
-	return str;
+  size_t size = (s->str_end - s->str_start) + 1;
+  char *str = rtalloc(ctx, size);
+  memcpy(str, s->str_start, size);
+  str[size - 1] = '\0';
+  return str;
 }
 
 /**
 * Returns the length of the current string, not including the
 * null terminator (same behavior as strlen()).
 */
-int 
+int
 stringbuffer_getlength(const RTCTX *ctx, stringbuffer_t *s)
 {
-	return (s->str_end - s->str_start);
+  return (s->str_end - s->str_start);
 }
 
 /**
 * Clear the stringbuffer_t and re-start it with the specified string.
 */
-void 
+void
 stringbuffer_set(const RTCTX *ctx, stringbuffer_t *s, const char *str)
 {
-	stringbuffer_clear(ctx, s);
-	stringbuffer_append(ctx, s, str);
+  stringbuffer_clear(ctx, s);
+  stringbuffer_append(ctx, s, str);
 }
 
 /**
 * Copy the contents of src into dst.
 */
-void 
+void
 stringbuffer_copy(const RTCTX *ctx, stringbuffer_t *dst, stringbuffer_t *src)
 {
-	stringbuffer_set(ctx, dst, stringbuffer_getstring(ctx, src));
+  stringbuffer_set(ctx, dst, stringbuffer_getstring(ctx, src));
 }
 
 /**
@@ -183,47 +183,47 @@ stringbuffer_copy(const RTCTX *ctx, stringbuffer_t *dst, stringbuffer_t *src)
 * using the format and argument list provided. Returns -1 on error,
 * check errno for reasons, documented in the printf man page.
 */
-static int 
+static int
 stringbuffer_avprintf(const RTCTX *ctx, stringbuffer_t *s, const char *fmt, va_list ap)
 {
-	int maxlen = (s->capacity - (s->str_end - s->str_start));
-	int len = 0; /* Length of the output */
-	va_list ap2;
-
-	/* Make a copy of the variadic arguments, in case we need to print twice */
-	/* Print to our buffer */
-	va_copy(ap2, ap);
-	len = vsnprintf(s->str_end, maxlen, fmt, ap2);
-	va_end(ap2);
-
-	/* Propogate errors up */
-	if ( len < 0 ) 
-		#if defined(__MINGW64_VERSION_MAJOR)
-		len = _vscprintf(fmt, ap2);/**Assume windows flaky vsnprintf that returns -1 if initial buffer to small and add more space **/
-		#else
-		return len;
-		#endif
-
-	/* We didn't have enough space! */
-	/* Either Unix vsnprint returned write length larger than our buffer */
-	/*     or Windows vsnprintf returned an error code. */
-	if ( len >= maxlen )
-	{
-		stringbuffer_makeroom(ctx, s, len + 1);
-		maxlen = (s->capacity - (s->str_end - s->str_start));
-
-		/* Try to print a second time */
-		len = vsnprintf(s->str_end, maxlen, fmt, ap);
-
-		/* Printing error? Error! */
-		if ( len < 0 ) return len;
-		/* Too long still? Error! */
-		if ( len >= maxlen ) return -1;
-	}
-
-	/* Move end pointer forward and return. */
-	s->str_end += len;
-	return len;
+  int maxlen = (s->capacity - (s->str_end - s->str_start));
+  int len = 0; /* Length of the output */
+  va_list ap2;
+
+  /* Make a copy of the variadic arguments, in case we need to print twice */
+  /* Print to our buffer */
+  va_copy(ap2, ap);
+  len = vsnprintf(s->str_end, maxlen, fmt, ap2);
+  va_end(ap2);
+
+  /* Propogate errors up */
+  if ( len < 0 )
+    #if defined(__MINGW64_VERSION_MAJOR)
+    len = _vscprintf(fmt, ap2);/**Assume windows flaky vsnprintf that returns -1 if initial buffer to small and add more space **/
+    #else
+    return len;
+    #endif
+
+  /* We didn't have enough space! */
+  /* Either Unix vsnprint returned write length larger than our buffer */
+  /*     or Windows vsnprintf returned an error code. */
+  if ( len >= maxlen )
+  {
+    stringbuffer_makeroom(ctx, s, len + 1);
+    maxlen = (s->capacity - (s->str_end - s->str_start));
+
+    /* Try to print a second time */
+    len = vsnprintf(s->str_end, maxlen, fmt, ap);
+
+    /* Printing error? Error! */
+    if ( len < 0 ) return len;
+    /* Too long still? Error! */
+    if ( len >= maxlen ) return -1;
+  }
+
+  /* Move end pointer forward and return. */
+  s->str_end += len;
+  return len;
 }
 
 /**
@@ -232,45 +232,45 @@ stringbuffer_avprintf(const RTCTX *ctx, stringbuffer_t *s, const char *fmt, va_l
 * Returns -1 on error, check errno for reasons,
 * as documented in the printf man page.
 */
-int 
+int
 stringbuffer_aprintf(const RTCTX *ctx, stringbuffer_t *s, const char *fmt, ...)
 {
-	int r;
-	va_list ap;
-	va_start(ap, fmt);
-	r = stringbuffer_avprintf(ctx, s, fmt, ap);
-	va_end(ap);
-	return r;
+  int r;
+  va_list ap;
+  va_start(ap, fmt);
+  r = stringbuffer_avprintf(ctx, s, fmt, ap);
+  va_end(ap);
+  return r;
 }
 
 /**
 * Trims whitespace off the end of the stringbuffer. Returns
 * the number of characters trimmed.
 */
-int 
+int
 stringbuffer_trim_trailing_white(const RTCTX *ctx, stringbuffer_t *s)
 {
-	char *ptr = s->str_end;
-	int dist = 0;
-	
-	/* Roll backwards until we hit a non-space. */
-	while( ptr > s->str_start )
-	{	
-		ptr--;
-		if( (*ptr == ' ') || (*ptr == '\t') )
-		{
-			continue;
-		}
-		else
-		{
-			ptr++;
-			dist = s->str_end - ptr;
-			*ptr = '\0';
-			s->str_end = ptr;
-			return dist;
-		}
-	}
-	return dist;	
+  char *ptr = s->str_end;
+  int dist = 0;
+
+  /* Roll backwards until we hit a non-space. */
+  while( ptr > s->str_start )
+  {
+    ptr--;
+    if( (*ptr == ' ') || (*ptr == '\t') )
+    {
+      continue;
+    }
+    else
+    {
+      ptr++;
+      dist = s->str_end - ptr;
+      *ptr = '\0';
+      s->str_end = ptr;
+      return dist;
+    }
+  }
+  return dist;
 }
 
 /**
@@ -278,66 +278,66 @@ stringbuffer_trim_trailing_white(const RTCTX *ctx, stringbuffer_t *s)
 * The number has to be the very last thing in the buffer. Only the
 * last number will be trimmed. Returns the number of characters
 * trimmed.
-* 
+*
 * eg: 1.22000 -> 1.22
 *     1.0 -> 1
 *     0.0 -> 0
 */
-int 
+int
 stringbuffer_trim_trailing_zeroes(const RTCTX *ctx, stringbuffer_t *s)
 {
-	char *ptr = s->str_end;
-	char *decimal_ptr = NULL;
-	int dist;
-	
-	if ( s->str_end - s->str_start < 2) 
-		return 0;
-
-	/* Roll backwards to find the decimal for this number */
-	while( ptr > s->str_start )
-	{	
-		ptr--;
-		if ( *ptr == '.' )
-		{
-			decimal_ptr = ptr;
-			break;
-		}
-		if ( (*ptr >= '0') && (*ptr <= '9' ) )
-			continue;
-		else
-			break;
-	}
-
-	/* No decimal? Nothing to trim! */
-	if ( ! decimal_ptr )
-		return 0;
-	
-	ptr = s->str_end;
-	
-	/* Roll backwards again, with the decimal as stop point, trimming contiguous zeroes */
-	while( ptr >= decimal_ptr )
-	{
-		ptr--;
-		if ( *ptr == '0' )
-			continue;
-		else
-			break;
-	}
-	
-	/* Huh, we get anywhere. Must not have trimmed anything. */
-	if ( ptr == s->str_end )
-		return 0;
-
-	/* If we stopped at the decimal, we want to null that out. 
-	   It we stopped on a numeral, we want to preserve that, so push the 
-	   pointer forward one space. */
-	if ( *ptr != '.' )
-		ptr++;
-
-	/* Add null terminator re-set the end of the stringbuffer. */
-	*ptr = '\0';
-	dist = s->str_end - ptr;
-	s->str_end = ptr;
-	return dist;
+  char *ptr = s->str_end;
+  char *decimal_ptr = NULL;
+  int dist;
+
+  if ( s->str_end - s->str_start < 2)
+    return 0;
+
+  /* Roll backwards to find the decimal for this number */
+  while( ptr > s->str_start )
+  {
+    ptr--;
+    if ( *ptr == '.' )
+    {
+      decimal_ptr = ptr;
+      break;
+    }
+    if ( (*ptr >= '0') && (*ptr <= '9' ) )
+      continue;
+    else
+      break;
+  }
+
+  /* No decimal? Nothing to trim! */
+  if ( ! decimal_ptr )
+    return 0;
+
+  ptr = s->str_end;
+
+  /* Roll backwards again, with the decimal as stop point, trimming contiguous zeroes */
+  while( ptr >= decimal_ptr )
+  {
+    ptr--;
+    if ( *ptr == '0' )
+      continue;
+    else
+      break;
+  }
+
+  /* Huh, we get anywhere. Must not have trimmed anything. */
+  if ( ptr == s->str_end )
+    return 0;
+
+  /* If we stopped at the decimal, we want to null that out.
+     It we stopped on a numeral, we want to preserve that, so push the
+     pointer forward one space. */
+  if ( *ptr != '.' )
+    ptr++;
+
+  /* Add null terminator re-set the end of the stringbuffer. */
+  *ptr = '\0';
+  dist = s->str_end - ptr;
+  s->str_end = ptr;
+  return dist;
 }
 
diff --git a/src/stringbuffer.h b/src/stringbuffer.h
index 6d01c70..1c1fa8f 100644
--- a/src/stringbuffer.h
+++ b/src/stringbuffer.h
@@ -38,9 +38,9 @@
 
 typedef struct
 {
-	size_t capacity;
-	char *str_end;
-	char *str_start;
+  size_t capacity;
+  char *str_end;
+  char *str_start;
 }
 stringbuffer_t;
 
diff --git a/src/varint.c b/src/varint.c
index a2b2612..a1b48c9 100644
--- a/src/varint.c
+++ b/src/varint.c
@@ -31,178 +31,178 @@
 
 /* -------------------------------------------------------------------------------- */
 
-static size_t 
+static size_t
 _varint_u64_encode_buf(const RTCTX *ctx, uint64_t val, uint8_t *buf)
 {
-	uint8_t grp;	
-	uint64_t q = val;
-	uint8_t *ptr = buf;
-	while (1) 
-	{
-		/* We put the 7 least significant bits in grp */
-		grp = 0x7f & q; 
-		/* We rightshift our input value 7 bits */
-		/* which means that the 7 next least significant bits */
-		/* becomes the 7 least significant */
-		q = q >> 7;	
-		/* Check if, after our rightshifting, we still have */
-		/* anything to read in our input value. */
-		if ( q > 0 )
-		{
-			/* In the next line quite a lot is happening. */
-			/* Since there is more to read in our input value */
-			/* we signal that by setting the most siginicant bit */
-			/* in our byte to 1. */
-			/* Then we put that byte in our buffer and move the pointer */
-			/* forward one step */
-			*ptr = 0x80 | grp;
-			ptr++;
-		}
-		else
-		{
-			/* The same as above, but since there is nothing more */
-			/* to read in our input value we leave the most significant bit unset */
-			*ptr = grp;
-			ptr++;
-			return ptr - buf;
-		}
-	}
-	/* This cannot happen */
-	rterror(ctx, "%s: Got out of infinite loop. Consciousness achieved.", __func__);
-	return (size_t)0;
+  uint8_t grp;
+  uint64_t q = val;
+  uint8_t *ptr = buf;
+  while (1)
+  {
+    /* We put the 7 least significant bits in grp */
+    grp = 0x7f & q;
+    /* We rightshift our input value 7 bits */
+    /* which means that the 7 next least significant bits */
+    /* becomes the 7 least significant */
+    q = q >> 7;
+    /* Check if, after our rightshifting, we still have */
+    /* anything to read in our input value. */
+    if ( q > 0 )
+    {
+      /* In the next line quite a lot is happening. */
+      /* Since there is more to read in our input value */
+      /* we signal that by setting the most siginicant bit */
+      /* in our byte to 1. */
+      /* Then we put that byte in our buffer and move the pointer */
+      /* forward one step */
+      *ptr = 0x80 | grp;
+      ptr++;
+    }
+    else
+    {
+      /* The same as above, but since there is nothing more */
+      /* to read in our input value we leave the most significant bit unset */
+      *ptr = grp;
+      ptr++;
+      return ptr - buf;
+    }
+  }
+  /* This cannot happen */
+  rterror(ctx, "%s: Got out of infinite loop. Consciousness achieved.", __func__);
+  return (size_t)0;
 }
 
 
 size_t
 varint_u64_encode_buf(const RTCTX *ctx, uint64_t val, uint8_t *buf)
 {
-	return _varint_u64_encode_buf(ctx, val, buf);
+  return _varint_u64_encode_buf(ctx, val, buf);
 }
 
 
 size_t
 varint_u32_encode_buf(const RTCTX *ctx, uint32_t val, uint8_t *buf)
 {
-	return _varint_u64_encode_buf(ctx, (uint64_t)val, buf);
+  return _varint_u64_encode_buf(ctx, (uint64_t)val, buf);
 }
 
 size_t
 varint_s64_encode_buf(const RTCTX *ctx, int64_t val, uint8_t *buf)
 {
-	return _varint_u64_encode_buf(ctx, zigzag64(ctx, val), buf);
+  return _varint_u64_encode_buf(ctx, zigzag64(ctx, val), buf);
 }
 
 size_t
 varint_s32_encode_buf(const RTCTX *ctx, int32_t val, uint8_t *buf)
 {
-	return _varint_u64_encode_buf(ctx, (uint64_t)zigzag32(ctx, val), buf);
+  return _varint_u64_encode_buf(ctx, (uint64_t)zigzag32(ctx, val), buf);
 }
 
 /* Read from signed 64bit varint */
-int64_t 
+int64_t
 varint_s64_decode(const RTCTX *ctx, const uint8_t *the_start, const uint8_t *the_end, size_t *size)
-{	
-	return unzigzag64(ctx, varint_u64_decode(ctx, the_start, the_end, size));
+{
+  return unzigzag64(ctx, varint_u64_decode(ctx, the_start, the_end, size));
 }
 
 /* Read from unsigned 64bit varint */
-uint64_t 
+uint64_t
 varint_u64_decode(const RTCTX *ctx, const uint8_t *the_start, const uint8_t *the_end, size_t *size)
 {
-	uint64_t nVal = 0;
-	int nShift = 0;
-	uint8_t nByte;
-	const uint8_t *ptr = the_start;
-
-	/* Check so we don't read beyond the twkb */
-	while( ptr < the_end )
-	{
-		nByte = *ptr;
-		/* Hibit is set, so this isn't the last byte */
-		if (nByte & 0x80)
-		{
-			/* We get here when there is more to read in the input varInt */
-			/* Here we take the least significant 7 bits of the read */
-			/* byte and put it in the most significant place in the result variable. */
-			nVal |= ((uint64_t)(nByte & 0x7f)) << nShift; 
-			/* move the "cursor" of the input buffer step (8 bits) */
-			ptr++; 
-			/* move the cursor in the resulting variable (7 bits) */
-			nShift += 7;
-		}
-		else
-		{
-			/* move the "cursor" one step */
-			ptr++; 
-			/* Move the last read byte to the most significant */
-			/* place in the result and return the whole result */
-			*size = ptr - the_start;
-			return nVal | ((uint64_t)nByte << nShift);
-		}
-	}
-	rterror(ctx, "%s: varint extends past end of buffer", __func__);
-	return 0;
+  uint64_t nVal = 0;
+  int nShift = 0;
+  uint8_t nByte;
+  const uint8_t *ptr = the_start;
+
+  /* Check so we don't read beyond the twkb */
+  while( ptr < the_end )
+  {
+    nByte = *ptr;
+    /* Hibit is set, so this isn't the last byte */
+    if (nByte & 0x80)
+    {
+      /* We get here when there is more to read in the input varInt */
+      /* Here we take the least significant 7 bits of the read */
+      /* byte and put it in the most significant place in the result variable. */
+      nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;
+      /* move the "cursor" of the input buffer step (8 bits) */
+      ptr++;
+      /* move the cursor in the resulting variable (7 bits) */
+      nShift += 7;
+    }
+    else
+    {
+      /* move the "cursor" one step */
+      ptr++;
+      /* Move the last read byte to the most significant */
+      /* place in the result and return the whole result */
+      *size = ptr - the_start;
+      return nVal | ((uint64_t)nByte << nShift);
+    }
+  }
+  rterror(ctx, "%s: varint extends past end of buffer", __func__);
+  return 0;
 }
 
-size_t 
+size_t
 varint_size(const RTCTX *ctx, const uint8_t *the_start, const uint8_t *the_end)
 {
-	const uint8_t *ptr = the_start;
-
-	/* Check so we don't read beyond the twkb */
-	while( ptr < the_end )
-	{
-		/* Hibit is set, this isn't the last byte */
-		if (*ptr & 0x80)
-		{
-			ptr++;
-		}
-		else
-		{
-			ptr++;
-			return ptr - the_start;
-		}
-	}
-	return 0;
+  const uint8_t *ptr = the_start;
+
+  /* Check so we don't read beyond the twkb */
+  while( ptr < the_end )
+  {
+    /* Hibit is set, this isn't the last byte */
+    if (*ptr & 0x80)
+    {
+      ptr++;
+    }
+    else
+    {
+      ptr++;
+      return ptr - the_start;
+    }
+  }
+  return 0;
 }
 
 uint64_t zigzag64(const RTCTX *ctx, int64_t val)
 {
-	return (val << 1) ^ (val >> 63);
+  return (val << 1) ^ (val >> 63);
 }
 
 uint32_t zigzag32(const RTCTX *ctx, int32_t val)
 {
-	return (val << 1) ^ (val >> 31);
+  return (val << 1) ^ (val >> 31);
 }
-	
+
 uint8_t zigzag8(const RTCTX *ctx, int8_t val)
 {
-	return (val << 1) ^ (val >> 7);
+  return (val << 1) ^ (val >> 7);
 }
-	
+
 int64_t unzigzag64(const RTCTX *ctx, uint64_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int64_t)((val+1) >> 1);
         else
             return (int64_t)(val >> 1);
 }
-	
+
 int32_t unzigzag32(const RTCTX *ctx, uint32_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int32_t)((val+1) >> 1);
         else
             return (int32_t)(val >> 1);
 }
-	
+
 int8_t unzigzag8(const RTCTX *ctx, uint8_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int8_t)((val+1) >> 1);
         else
             return (int8_t)(val >> 1);
 }
-	
+
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/librttopo.git



More information about the Pkg-grass-devel mailing list