[postgis] 01/02: Imported Upstream version 2.1.8+dfsg

Markus Wanner markus_wanner-guest at moszumanska.debian.org
Fri Jul 10 06:19:45 UTC 2015


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

markus_wanner-guest pushed a commit to branch master
in repository postgis.

commit d414313638a8e8026bb6dc8951223054b35434b7
Author: Markus Wanner <markus at bluegap.ch>
Date:   Fri Jul 10 07:28:07 2015 +0200

    Imported Upstream version 2.1.8+dfsg
---
 ._config.guess                                     | Bin 0 -> 239 bytes
 ._config.sub                                       | Bin 0 -> 239 bytes
 ._install-sh                                       | Bin 0 -> 239 bytes
 ChangeLog                                          | 147 ++++++++++++
 NEWS                                               |  15 ++
 README.postgis                                     |   4 +-
 Version.config                                     |   2 +-
 config.guess                                       |   6 +-
 config.sub                                         |  10 +-
 configure                                          | 255 +++++++++++++++------
 configure.ac                                       |   2 +-
 doc/faq_raster.xml                                 |   3 +-
 doc/introduction.xml                               |   2 +-
 doc/reference_sfcgal.xml                           |   7 +
 doc/release_notes.xml                              |  59 +++--
 extensions/postgis/postgis.control                 |   2 +-
 .../postgis_tiger_geocoder.control                 |   2 +-
 .../postgis_topology/postgis_topology.control      |   2 +-
 extensions/upgradeable_versions.mk                 |  11 +-
 liblwgeom/Makefile.in                              |   1 +
 liblwgeom/cunit/cu_algorithm.c                     |  11 +-
 liblwgeom/cunit/cu_libgeom.c                       |  46 +++-
 liblwgeom/cunit/cu_ptarray.c                       |   2 +-
 liblwgeom/g_serialized.c                           |  47 ++--
 liblwgeom/lwgeodetic.h                             |   4 +-
 liblwgeom/lwgeodetic_tree.h                        |   2 +-
 liblwgeom/lwgeom.c                                 |   7 +-
 liblwgeom/lwgeom_geos.c                            |   4 +-
 liblwgeom/lwin_geojson.c                           |  71 +++---
 liblwgeom/lwline.c                                 |   7 +-
 liblwgeom/lwlinearreferencing.c                    |  28 ++-
 liblwgeom/ptarray.c                                |  10 +-
 libtool                                            | 159 +++++++++++--
 loader/shp2pgsql-core.c                            |   5 +
 loader/shp2pgsql-core.h                            |   5 +-
 ltmain.sh                                          |  81 ++++++-
 macros/._libtool.m4                                | Bin 0 -> 239 bytes
 macros/._ltoptions.m4                              | Bin 0 -> 239 bytes
 macros/._ltsugar.m4                                | Bin 0 -> 239 bytes
 macros/._lt~obsolete.m4                            | Bin 0 -> 239 bytes
 macros/libtool.m4                                  | 171 +++++++++-----
 macros/ltoptions.m4                                |   2 +-
 macros/ltsugar.m4                                  |   2 +-
 macros/ltversion.m4                                |  12 +-
 macros/lt~obsolete.m4                              |   2 +-
 postgis/geography_btree.c                          |  32 ++-
 postgis/geography_inout.c                          |   4 +-
 postgis/lwgeom_accum.c                             |  11 +-
 postgis/lwgeom_export.c                            |  42 ++--
 postgis/lwgeom_functions_basic.c                   |   9 +-
 postgis/postgis.sql.in                             |  95 ++++----
 postgis/sqldefines.h                               |  10 +-
 postgis_svn_revision.h                             |   2 +-
 raster/test/regress/tickets.sql                    |  84 +++++++
 raster/test/regress/tickets_expected               |   9 +
 regress/affine.sql                                 |   3 +
 regress/affine_expected                            |   1 +
 regress/in_geojson.sql                             |  16 ++
 regress/in_geojson_expected                        |  10 +
 regress/regress_lrs.sql                            |   1 +
 regress/regress_lrs_expected                       |   1 +
 61 files changed, 1154 insertions(+), 384 deletions(-)

diff --git a/._config.guess b/._config.guess
new file mode 100755
index 0000000..92de026
Binary files /dev/null and b/._config.guess differ
diff --git a/._config.sub b/._config.sub
new file mode 100755
index 0000000..3309887
Binary files /dev/null and b/._config.sub differ
diff --git a/._install-sh b/._install-sh
new file mode 100755
index 0000000..8199457
Binary files /dev/null and b/._install-sh differ
diff --git a/ChangeLog b/ChangeLog
index 8044365..4946e37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,150 @@
+2015-07-04 05:48  robe
+
+	* doc/reference_sfcgal.xml: #3116: SFCGAL add documentation for
+	  geometry backend switch. Patch from Vincent Mora
+
+2015-06-30 18:02  pramsey
+
+	* liblwgeom/lwin_geojson.c, postgis/lwgeom_export.c: Improve
+	  geojson import for srs objects
+
+2015-06-24 20:23  pramsey
+
+	* NEWS: Add #3177
+
+2015-06-24 20:21  pramsey
+
+	* liblwgeom/cunit/cu_libgeom.c, liblwgeom/g_serialized.c: #3177,
+	  gserialized_is_empty cannot handle nested empty cases
+
+2015-06-24 19:07  pramsey
+
+	* liblwgeom/lwgeodetic.h, liblwgeom/lwgeodetic_tree.h: Newlines on
+	  fileends
+
+2015-06-24 19:06  pramsey
+
+	* liblwgeom/cunit/cu_algorithm.c: Remove memory leak
+
+2015-06-24 19:05  pramsey
+
+	* liblwgeom/cunit/cu_ptarray.c: Remote printf
+
+2015-06-11 20:06  strk
+
+	* liblwgeom/lwgeom.c: Fix backport of bbox cache fix
+
+2015-06-11 19:47  strk
+
+	* NEWS, liblwgeom/lwgeom.c, liblwgeom/lwline.c,
+	  liblwgeom/lwlinearreferencing.c, postgis/geography_inout.c,
+	  postgis/lwgeom_functions_basic.c, regress/affine.sql,
+	  regress/affine_expected: Only add boxes to geometries that are
+	  input with them (#3159)
+	  
+	  Includes testcase
+
+2015-06-10 09:26  strk
+
+	* NEWS, liblwgeom/Makefile.in: Remove liblwgeom.h on make uninstall
+	  (#3155)
+
+2015-05-26 08:26  strk
+
+	* NEWS, liblwgeom/ptarray.c, regress/regress_lrs.sql,
+	  regress/regress_lrs_expected: Fix crasher found in garden tests
+	  
+	  Includes testcase.
+	  This is a backport of r13556 and r13555 from trunk.
+
+2015-05-19 17:38  pramsey
+
+	* postgis/lwgeom_accum.c: Build on 9.5
+
+2015-05-18 07:01  strk
+
+	* configure.ac: Fix confusing help message for --with-pgconfig
+	  
+	  Patch by Volf Tomáš
+
+2015-05-02 23:51  dustymugs
+
+	* raster/test/regress/tickets.sql: pg9.0 doesn't have format
+	  function
+
+2015-05-02 20:45  dustymugs
+
+	* raster/test/regress/tickets.sql,
+	  raster/test/regress/tickets_expected: unit tests of numeric
+	  overflow. ticket #3100
+
+2015-05-02 07:01  robe
+
+	* doc/faq_raster.xml: add other error you might see to the security
+	  raster faq
+
+2015-04-29 20:03  robe
+
+	* postgis/postgis.sql.in: #2365: Significantly improve performance
+	  of find_srid when lots of geometry columns
+
+2015-04-29 15:55  pramsey
+
+	* postgis/lwgeom_export.c, regress/in_geojson.sql,
+	  regress/in_geojson_expected: C90 madness
+
+2015-04-29 12:48  pramsey
+
+	* NEWS, postgis/lwgeom_export.c: #3104, st_asgml introduces random
+	  characters in ID field
+
+2015-04-27 12:22  pramsey
+
+	* doc/introduction.xml: Update corporate info
+
+2015-04-26 05:16  robe
+
+	* extensions/upgradeable_versions.mk, postgis/postgis.sql.in: #3092
+	  refinement to geometry_columns view. Also add missing 2.0/2.1
+	  extension upgrade targets
+
+2015-04-26 04:33  robe
+
+	* loader/shp2pgsql-core.h: #3102 - add include <locale.h> to fix
+	  mingw-64 compile issue
+
+2015-04-23 20:00  pramsey
+
+	* liblwgeom/lwgeom_geos.c: #3091, segfault in unit tests in debug
+
+2015-04-23 19:36  pramsey
+
+	* NEWS, loader/shp2pgsql-core.c: #3048, shp2pgsql - illegal number
+	  format when specific system locale set
+
+2015-04-23 18:19  pramsey
+
+	* NEWS, postgis/geography_btree.c: #3018, GROUP BY geography
+	  sometimes returns duplicate rows
+
+2015-04-15 15:42  pramsey
+
+	* NEWS, liblwgeom/lwin_geojson.c: #3094, fixed another one
+
+2015-03-30 12:54  pramsey
+
+	* doc/release_notes.xml: Unbalanced <simplesect>
+
+2015-03-30 12:51  pramsey
+
+	* NEWS, Version.config: Move versions forward for development
+
+2015-03-30 12:50  pramsey
+
+	* ChangeLog, NEWS, README.postgis, Version.config,
+	  doc/release_notes.xml, extensions/upgradeable_versions.mk:
+	  Prepare for 2.1.7
+
 2015-03-27 17:21  pramsey
 
 	* liblwgeom/lwin_geojson.c: Formatting
diff --git a/NEWS b/NEWS
index a88b42f..1ffe3d1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,18 @@
+PostGIS 2.1.8
+2015/07/07
+
+ * Bug Fixes *
+
+  - #3159, do not force a bbox cache on ST_Affine
+  - #3018, GROUP BY geography sometimes returns duplicate rows
+  - #3048, shp2pgsql - illegal number format when specific system locale set
+  - #3094, Malformed GeoJSON inputs crash backend
+  - #3104, st_asgml introduces random characters in ID field
+  - #3155, Remove liblwgeom.h on make uninstall
+  - #3177, gserialized_is_empty cannot handle nested empty cases
+  - Fix crash in ST_LineLocatePoint
+
+
 PostGIS 2.1.7
 2015/03/30
 
diff --git a/README.postgis b/README.postgis
index 08501dd..d8964ee 100644
--- a/README.postgis
+++ b/README.postgis
@@ -1,8 +1,8 @@
 PostGIS - Geographic Information Systems Extensions to PostgreSQL
 =================================================================
 
-:Version: 2.1.7
-:Date: 2015-03-30
+:Version: 2.1.8
+:Date: 2015-07-07
 :Website: http://postgis.net
 
 This distribution contains a module which implements GIS simple features, ties
diff --git a/Version.config b/Version.config
index 4beb12b..6324f3f 100644
--- a/Version.config
+++ b/Version.config
@@ -5,5 +5,5 @@
 
 POSTGIS_MAJOR_VERSION=2
 POSTGIS_MINOR_VERSION=1
-POSTGIS_MICRO_VERSION=7
+POSTGIS_MICRO_VERSION=8
 
diff --git a/config.guess b/config.guess
index 6c32c86..dbfb978 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-11-04'
+timestamp='2015-01-01'
 
 # 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
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 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."
diff --git a/config.sub b/config.sub
index 7cc68ba..6d2e94c 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-09-26'
+timestamp='2015-01-01'
 
 # 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
@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 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."
@@ -260,7 +260,7 @@ case $basic_machine in
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| epiphany \
-	| fido | fr30 | frv \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
@@ -313,6 +313,7 @@ case $basic_machine in
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -440,6 +441,7 @@ case $basic_machine in
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
+	| visium-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
diff --git a/configure b/configure
index 120a9d0..858037a 100755
--- a/configure
+++ b/configure
@@ -757,6 +757,7 @@ ac_ct_CXX
 CXXFLAGS
 CXX
 CPP
+LT_SYS_LIBRARY_PATH
 OTOOL64
 OTOOL
 LIPO
@@ -876,6 +877,7 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+LT_SYS_LIBRARY_PATH
 CPP
 CXX
 CXXFLAGS
@@ -1552,6 +1554,8 @@ Some influential environment variables:
   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>
+  LT_SYS_LIBRARY_PATH
+              User-defined run-time library search path.
   CPP         C preprocessor
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
@@ -2554,8 +2558,8 @@ esac
 
 
 
-macro_version='2.4.4'
-macro_revision='2.4.4'
+macro_version='2.4.6'
+macro_revision='2.4.6'
 
 
 
@@ -5809,6 +5813,21 @@ $as_echo "$lt_cv_truncate_bin" >&6; }
 
 
 
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -6816,6 +6835,41 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
     ;;
   esac
 
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7403,15 +7457,8 @@ 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-%%"`
+func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
 
 
 # Only perform the check for file, if the check method requires it
@@ -9870,6 +9917,8 @@ hardcode_into_libs=no
 # 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
@@ -10158,6 +10207,7 @@ freebsd* | dragonfly*)
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
@@ -10217,10 +10267,11 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='$libname$release$shared_ext$major'
     if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -10372,7 +10423,12 @@ fi
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) 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"
@@ -10597,10 +10653,25 @@ fi
 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
   sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
+
 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
   sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
+
+
+
+
 
 
 
@@ -12565,15 +12636,8 @@ $RM -r conftest*
   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-%%"`
+  func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
 
 
   if test -n "$compiler"; then
@@ -13960,51 +14024,6 @@ interix[3-9]*)
   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 yes != "$solaris_use_stlport4"; 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 yes != "$solaris_use_stlport4"; then
-      postdeps_CXX='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
 esac
 
 
@@ -14828,6 +14847,8 @@ hardcode_into_libs=no
 # 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
@@ -15114,6 +15135,7 @@ freebsd* | dragonfly*)
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
@@ -15173,10 +15195,11 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='$libname$release$shared_ext$major'
     if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -15328,7 +15351,12 @@ fi
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) 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"
@@ -15553,10 +15581,22 @@ fi
 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
   sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
+
 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
   sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
+
 
 
 
@@ -16998,7 +17038,7 @@ fi
 
 
 		if test "x$PG_CONFIG" = "x"; then
-		as_fn_error $? "could not find pg_config within the current path. You may need to try re-running configure with a --with-pg_config parameter." "$LINENO" 5
+		as_fn_error $? "could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter." "$LINENO" 5
 	fi
 else
 		if test "x$PG_CONFIG" = "xyes"; then
@@ -21706,7 +21746,8 @@ 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"`'
+configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`'
+configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $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"`'
@@ -21909,7 +21950,8 @@ postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec \
+configure_time_dlsearch_path \
+configure_time_lt_sys_library_path \
 reload_cmds_CXX \
 old_archive_cmds_CXX \
 old_archive_from_new_cmds_CXX \
@@ -22603,6 +22645,9 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 # The names of the tagged configurations supported by this script.
 available_tags='CXX '
 
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
 # ### BEGIN LIBTOOL CONFIG
 
 # Which release of libtool.m4 was used?
@@ -22852,8 +22897,11 @@ 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
+# Detected run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path
+
+# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
+configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path
 
 # Whether dlopen is supported.
 dlopen_support=$enable_dlopen
@@ -23018,6 +23066,65 @@ compiler_lib_search_path=$lt_compiler_lib_search_path
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
diff --git a/configure.ac b/configure.ac
index 88c7658..b15d237 100644
--- a/configure.ac
+++ b/configure.ac
@@ -380,7 +380,7 @@ elif test "x$PG_CONFIG" = "x"; then
 
 	dnl If we couldn't find pg_config, display an error
 	if test "x$PG_CONFIG" = "x"; then
-		AC_MSG_ERROR([could not find pg_config within the current path. You may need to try re-running configure with a --with-pg_config parameter.])
+		AC_MSG_ERROR([could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.])
 	fi
 else
 	dnl PG_CONFIG was specified; display a message to the user
diff --git a/doc/faq_raster.xml b/doc/faq_raster.xml
index 8b6e768..98d65f8 100644
--- a/doc/faq_raster.xml
+++ b/doc/faq_raster.xml
@@ -6,7 +6,8 @@
   
      <qandaentry id="faq_security_change_1">
       <question>
-        <para>I'm getting error <code>ERROR: RASTER_fromGDALRaster: Could not open bytea with GDAL. Check that the bytea is of a GDAL supported format.</code></para>
+        <para>I'm getting error <code>ERROR: RASTER_fromGDALRaster: Could not open bytea with GDAL. Check that the bytea is of a GDAL supported format.</code>  when using ST_FromGDALRaster
+        or <code>ERROR: rt_raster_to_gdal: Could not load the output GDAL driver</code> when trying to use ST_AsPNG or other raster input functions.</para>
       </question>
 
       <answer>
diff --git a/doc/introduction.xml b/doc/introduction.xml
index d8e550e..fa65056 100644
--- a/doc/introduction.xml
+++ b/doc/introduction.xml
@@ -267,7 +267,7 @@ Stadt Uster,
 UC Davis Center for Vectorborne Diseases,
 University of Laval,
 U.S Department of State (HIU),
-Vizzuality,
+CartoDB,
 Zonar Systems</para>
 		</listitem>
 	  </varlistentry>
diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index 47b808f..783e46f 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -10,6 +10,13 @@
             Installation instructions of the library can be found on SFCGAL home page <ulink url="http://www.sfcgal.org">http://www.sfcgal.org</ulink>. 
             To load the functions execute postgis/sfcgal.sql
         </para>
+        <para>
+          Some SFCGAL functions replace standard ones (ST_Intersects, ST_Intersection, ST_Difference, ST_Union, ST_Area and ST_Distance), to switch between standard functions and SFCGAL function use:
+	<programlisting>SET postgis.backend = sfcgal;</programlisting>
+	and
+	<programlisting>SET postgis.backend = geos;</programlisting>
+        
+        </para>
 		</abstract>
 	</sect1info>
 	<title>SFCGAL Functions</title>
diff --git a/doc/release_notes.xml b/doc/release_notes.xml
index 63e19c7..bcfe509 100644
--- a/doc/release_notes.xml
+++ b/doc/release_notes.xml
@@ -4,15 +4,32 @@
     <subtitle>Release Notes</subtitle>
 	
     <sect1>
+      <title>Release 2.1.8</title>
+      <para>Release date: 2015-07-07</para>
+      <para>This is a critical bug fix release.</para>
+      <simplesect>
+        <title>Bug Fixes</title>
+        <para>#3159, do not force a bbox cache on ST_Affine</para>
+        <para>#3018, GROUP BY geography sometimes returns duplicate rows</para>
+        <para>#3048, shp2pgsql - illegal number format when specific system locale set</para>
+        <para>#3094, Malformed GeoJSON inputs crash backend</para>
+        <para>#3104, st_asgml introduces random characters in ID field</para>
+        <para>#3155, Remove liblwgeom.h on make uninstall</para>
+        <para>#3177, gserialized_is_empty cannot handle nested empty cases</para>
+        <para>Fix crash in ST_LineLocatePoint</para>
+      </simplesect>
+    </sect1>
+    
+    <sect1>
       <title>Release 2.1.7</title>
       <para>Release date: 2015-03-30</para>
       <para>This is a critical bug fix release.</para>
-       <simplesect>
-         <title>Bug Fixes</title>
-         <para>#3086, ST_DumpValues() crashes backend on cleanup with invalid band indexes</para>
-         <para>#3088, Do not (re)define strcasestr in a liblwgeom.h</para>
-         <para>#3094, Malformed GeoJSON inputs crash backend</para>
-       </simplesect>
+      <simplesect>
+        <title>Bug Fixes</title>
+        <para>#3086, ST_DumpValues() crashes backend on cleanup with invalid band indexes</para>
+        <para>#3088, Do not (re)define strcasestr in a liblwgeom.h</para>
+        <para>#3094, Malformed GeoJSON inputs crash backend</para>
+      </simplesect>
     </sect1>
   
     <sect1>
@@ -24,21 +41,21 @@
         <para>#3000, Ensure edge splitting and healing algorithms use indexes</para>
         <para>#3048, Speed up geometry simplification (J.Santana @ CartoDB)</para>
         <para>#3050, Speep up geometry type reading (J.Santana @ CartoDB)</para>
-       </simplesect>
-       <simplesect>
-         <title>Bug Fixes</title>
-         <para>#2941, allow geography columns with SRID other than 4326</para>
-         <para>#3069, small objects getting inappropriately fluffed up w/ boxes</para>
-         <para>#3068, Have postgis_typmod_dims return NULL for unconstrained dims</para>
-         <para>#3061, Allow duplicate points in JSON, GML, GML ST_GeomFrom* functions</para>
-         <para>#3058, Fix ND-GiST picksplit method to split on the best plane</para>
-         <para>#3052, Make operators <-> and <#> available for PostgreSQL < 9.1</para>
-         <para>#3045, Fix dimensionality confusion in &&& operator</para>
-         <para>#3016, Allow unregistering layers of corrupted topologies</para>
-         <para>#3015, Avoid exceptions from TopologySummary</para>
-         <para>#3020, ST_AddBand out-db bug where height using width value</para>
-         <para>#3031, Allow restore of Geometry(Point) tables dumped with empties in them</para>
-       </simplesect>
+      </simplesect>
+      <simplesect>
+        <title>Bug Fixes</title>
+        <para>#2941, allow geography columns with SRID other than 4326</para>
+        <para>#3069, small objects getting inappropriately fluffed up w/ boxes</para>
+        <para>#3068, Have postgis_typmod_dims return NULL for unconstrained dims</para>
+        <para>#3061, Allow duplicate points in JSON, GML, GML ST_GeomFrom* functions</para>
+        <para>#3058, Fix ND-GiST picksplit method to split on the best plane</para>
+        <para>#3052, Make operators <-> and <#> available for PostgreSQL < 9.1</para>
+        <para>#3045, Fix dimensionality confusion in &&& operator</para>
+        <para>#3016, Allow unregistering layers of corrupted topologies</para>
+        <para>#3015, Avoid exceptions from TopologySummary</para>
+        <para>#3020, ST_AddBand out-db bug where height using width value</para>
+        <para>#3031, Allow restore of Geometry(Point) tables dumped with empties in them</para>
+      </simplesect>
     </sect1>
   
     <sect1>
diff --git a/extensions/postgis/postgis.control b/extensions/postgis/postgis.control
index a25e0d5..5a5d104 100644
--- a/extensions/postgis/postgis.control
+++ b/extensions/postgis/postgis.control
@@ -1,5 +1,5 @@
 # postgis extension
 comment = 'PostGIS geometry, geography, and raster spatial types and functions'
-default_version = '2.1.7'
+default_version = '2.1.8'
 module_pathname = '$libdir/postgis-2.1'
 relocatable = true
diff --git a/extensions/postgis_tiger_geocoder/postgis_tiger_geocoder.control b/extensions/postgis_tiger_geocoder/postgis_tiger_geocoder.control
index 7b4efac..28434c6 100644
--- a/extensions/postgis_tiger_geocoder/postgis_tiger_geocoder.control
+++ b/extensions/postgis_tiger_geocoder/postgis_tiger_geocoder.control
@@ -1,6 +1,6 @@
 # postgis tiger geocoder extension
 comment = 'PostGIS tiger geocoder and reverse geocoder'
-default_version = '2.1.7'
+default_version = '2.1.8'
 relocatable = false
 schema = tiger
 requires = 'postgis,fuzzystrmatch'
diff --git a/extensions/postgis_topology/postgis_topology.control b/extensions/postgis_topology/postgis_topology.control
index 02107f5..1817162 100644
--- a/extensions/postgis_topology/postgis_topology.control
+++ b/extensions/postgis_topology/postgis_topology.control
@@ -1,6 +1,6 @@
 # postgis topology extension
 comment = 'PostGIS topology spatial types and functions'
-default_version = '2.1.7'
+default_version = '2.1.8'
 relocatable = false
 schema = topology
 requires = postgis
diff --git a/extensions/upgradeable_versions.mk b/extensions/upgradeable_versions.mk
index a7d1929..a91f8f1 100644
--- a/extensions/upgradeable_versions.mk
+++ b/extensions/upgradeable_versions.mk
@@ -15,7 +15,9 @@ UPGRADEABLE_VERSIONS = \
 	2.1.3 \
 	2.1.4 \
 	2.1.5 \
-	2.1.6
+	2.1.6 \
+	2.1.7 \
+	2.1.8
 	
 UPGRADEABLE_VERSIONS_MINOR = \
 	2.0.0 \
@@ -24,7 +26,8 @@ UPGRADEABLE_VERSIONS_MINOR = \
 	2.0.3 \
 	2.0.4 \
 	2.0.5 \
-	2.0.6
+	2.0.6 \
+	2.0.7
 
 UPGRADEABLE_VERSIONS_PATCH = \
 	2.1.0rc1 \
@@ -36,4 +39,6 @@ UPGRADEABLE_VERSIONS_PATCH = \
 	2.1.3 \
 	2.1.4 \
 	2.1.5 \
-	2.1.6
+	2.1.6 \
+	2.1.7 \
+	2.1.8
diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in
index 5773a7d..7e7d4a0 100644
--- a/liblwgeom/Makefile.in
+++ b/liblwgeom/Makefile.in
@@ -119,6 +119,7 @@ install-liblwgeom: liblwgeom.la
 
 uninstall-liblwgeom: 
 	$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/liblwgeom.la"
+	$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(includedir)/liblwgeom.h"
 
 # Make all objects depend upon postgis_config.h and postgis_svn_revision.h
 $(LT_OBJS): ../postgis_config.h ../postgis_svn_revision.h
diff --git a/liblwgeom/cunit/cu_algorithm.c b/liblwgeom/cunit/cu_algorithm.c
index 85acb5e..704a58f 100644
--- a/liblwgeom/cunit/cu_algorithm.c
+++ b/liblwgeom/cunit/cu_algorithm.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cu_algorithm.c 13247 2015-02-20 15:10:29Z pramsey $
+ * $Id: cu_algorithm.c 13696 2015-06-24 19:06:01Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
@@ -898,20 +898,25 @@ static void test_geohash_point_as_int(void)
 static void test_lwgeom_simplify(void)
 {
 		LWGEOM *l;
+		LWGEOM *i;
 		char *ewkt;
 
 		/* Not simplifiable */
-		l = lwgeom_simplify(lwgeom_from_wkt("LINESTRING(0 0, 50 1.00001, 100 0)", LW_PARSER_CHECK_NONE), 1.0);
+		i = lwgeom_from_wkt("LINESTRING(0 0, 50 1.00001, 100 0)", LW_PARSER_CHECK_NONE);
+		l = lwgeom_simplify(i, 1.0);
 		ewkt = lwgeom_to_ewkt(l);
 		CU_ASSERT_STRING_EQUAL(ewkt, "LINESTRING(0 0,50 1.00001,100 0)");
 		lwgeom_free(l);
+		lwgeom_free(i);
 		lwfree(ewkt);
 
 		/* Simplifiable */
-		l = lwgeom_simplify(lwgeom_from_wkt("LINESTRING(0 0,50 0.99999,100 0)", LW_PARSER_CHECK_NONE), 1.0);
+		i = lwgeom_from_wkt("LINESTRING(0 0,50 0.99999,100 0)", LW_PARSER_CHECK_NONE);
+		l = lwgeom_simplify(i, 1.0);
 		ewkt = lwgeom_to_ewkt(l);
 		CU_ASSERT_STRING_EQUAL(ewkt, "LINESTRING(0 0,100 0)");
 		lwgeom_free(l);
+		lwgeom_free(i);
 		lwfree(ewkt);
 }
 
diff --git a/liblwgeom/cunit/cu_libgeom.c b/liblwgeom/cunit/cu_libgeom.c
index 4146ce6..3dc0080 100644
--- a/liblwgeom/cunit/cu_libgeom.c
+++ b/liblwgeom/cunit/cu_libgeom.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cu_libgeom.c 13242 2015-02-19 00:22:22Z pramsey $
+ * $Id: cu_libgeom.c 13698 2015-06-24 20:21:57Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
@@ -307,6 +307,49 @@ static void test_lwgeom_from_gserialized(void)
 
 }
 
+
+static void test_gserialized_is_empty(void)
+{
+	int i = 0;
+	struct gserialized_empty_cases {
+		const char* wkt;
+		int isempty;
+	};
+	
+	struct gserialized_empty_cases cases[] = {
+		{ "POINT EMPTY", 1 },
+		{ "POINT(1 1)", 0 },
+		{ "LINESTRING EMPTY", 1 },
+		{ "MULTILINESTRING EMPTY", 1 },
+		{ "MULTILINESTRING(EMPTY)", 1 },
+		{ "MULTILINESTRING(EMPTY,EMPTY)", 1 },
+		{ "MULTILINESTRING(EMPTY,(0 0,1 1))", 0 },
+		{ "MULTILINESTRING((0 0,1 1),EMPTY)", 0 },
+		{ "MULTILINESTRING(EMPTY,(0 0,1 1),EMPTY)", 0 },
+		{ "MULTILINESTRING(EMPTY,EMPTY,EMPTY)", 1 },
+		{ "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY,EMPTY))", 1 },
+		{ "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY),POINT(1 1))", 0 },
+		{ "GEOMETRYCOLLECTION(POINT EMPTY,MULTILINESTRING(EMPTY, (0 0)),POINT EMPTY)", 0 },
+		{ "GEOMETRYCOLLECTION(POLYGON EMPTY,POINT EMPTY,MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
+		{ "GEOMETRYCOLLECTION(POLYGON EMPTY,GEOMETRYCOLLECTION(POINT EMPTY),MULTILINESTRING(EMPTY,EMPTY),POINT EMPTY)", 1 },
+		{ NULL, 0 }
+	};
+	
+	while( cases[i].wkt )
+	{
+		// i = 11;
+		LWGEOM *lw = lwgeom_from_wkt(cases[i].wkt, LW_PARSER_CHECK_NONE);
+		GSERIALIZED *g = gserialized_from_lwgeom(lw, 0, 0);
+		int ie = gserialized_is_empty(g);
+		// printf("%s: we say %d, they say %d\n", cases[i].wkt, cases[i].isempty, ie);
+		CU_ASSERT_EQUAL(ie, cases[i].isempty);
+		lwgeom_free(lw);
+		lwfree(g);
+		i++;
+	}
+}
+	
+
 static void test_geometry_type_from_string(void)
 {
 	int rv;
@@ -934,4 +977,5 @@ void libgeom_suite_setup(void)
 	PG_ADD_TEST(suite, test_lwgeom_is_empty);
 	PG_ADD_TEST(suite, test_lwgeom_same);
 	PG_ADD_TEST(suite, test_lwline_from_lwmpoint);
+	PG_ADD_TEST(suite, test_gserialized_is_empty);
 }
diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c
index 8eb2f22..27f35f8 100644
--- a/liblwgeom/cunit/cu_ptarray.c
+++ b/liblwgeom/cunit/cu_ptarray.c
@@ -444,7 +444,7 @@ static void test_ptarray_desegmentize()
 	out = lwgeom_desegmentize(in);
 	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
 	CU_ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10)");
-	printf("%s\n", str);
+	// printf("%s\n", str);
 	lwgeom_free(in);
 	lwgeom_free(out);
 	lwfree(str);
diff --git a/liblwgeom/g_serialized.c b/liblwgeom/g_serialized.c
index 916f8e3..5065c7f 100644
--- a/liblwgeom/g_serialized.c
+++ b/liblwgeom/g_serialized.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: g_serialized.c 13367 2015-03-20 13:53:44Z pramsey $
+ * $Id: g_serialized.c 13698 2015-06-24 20:21:57Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  *
@@ -109,27 +109,46 @@ GSERIALIZED* gserialized_copy(const GSERIALIZED *g)
 	return g_out;
 }
 
+static size_t gserialized_is_empty_recurse(const uint8_t *p, int *isempty);
+static size_t gserialized_is_empty_recurse(const uint8_t *p, int *isempty)
+{
+	int i;
+	int32_t type, num;
+
+	memcpy(&type, p, 4);
+	memcpy(&num, p+4, 4);
+	
+	if ( lwtype_is_collection(type) )
+	{
+		size_t lz = 8;
+		for ( i = 0; i < num; i++ )
+		{
+			lz += gserialized_is_empty_recurse(p+lz, isempty);
+			if ( ! *isempty )
+				return lz;
+		}
+		*isempty = LW_TRUE;
+		return lz;
+	}
+	else
+	{
+		*isempty = (num == 0 ? LW_TRUE : LW_FALSE);
+		return 8;
+	}
+}
+
 int gserialized_is_empty(const GSERIALIZED *g)
 {
 	uint8_t *p = (uint8_t*)g;
-	int i;
+	int isempty = 0;
 	assert(g);
 
 	p += 8; /* Skip varhdr and srid/flags */
 	if( FLAGS_GET_BBOX(g->flags) )
 		p += gbox_serialized_size(g->flags); /* Skip the box */
-	p += 4; /* Skip type number */
-	
-	/* For point/line/circstring this is npoints */
-	/* For polygons this is nrings */
-	/* For collections this is ngeoms */
-	memcpy(&i, p, sizeof(int));
-	
-	/* If it is non-zero, it's not empty */
-	if ( i > 0 )
-		return LW_FALSE;
-	else
-		return LW_TRUE;	
+
+	gserialized_is_empty_recurse(p, &isempty);
+	return isempty;
 }
 
 char* gserialized_to_string(const GSERIALIZED *g)
diff --git a/liblwgeom/lwgeodetic.h b/liblwgeom/lwgeodetic.h
index 302213c..75420e4 100644
--- a/liblwgeom/lwgeodetic.h
+++ b/liblwgeom/lwgeodetic.h
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: lwgeodetic.h 12343 2014-03-25 08:17:56Z pramsey $
+ * $Id: lwgeodetic.h 13697 2015-06-24 19:07:17Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * Copyright 2009 Paul Ramsey <pramsey at cleverelephant.ca>
@@ -143,4 +143,4 @@ int spheroid_project(const GEOGRAPHIC_POINT *r, const SPHEROID *spheroid, double
 * Maintain consistent units (radians?) throughout all calculations
 * Put an index pointer onto LWGEOM itself, and cache the indexed LWGEOM instead of a bare tree
 * only primitive objects should get a tree
-*/
\ No newline at end of file
+*/
diff --git a/liblwgeom/lwgeodetic_tree.h b/liblwgeom/lwgeodetic_tree.h
index c80c412..806a0e4 100644
--- a/liblwgeom/lwgeodetic_tree.h
+++ b/liblwgeom/lwgeodetic_tree.h
@@ -30,4 +30,4 @@ double circ_tree_distance_tree(const CIRC_NODE* n1, const CIRC_NODE* n2, const S
 CIRC_NODE* lwgeom_calculate_circ_tree(const LWGEOM* lwgeom);
 int circ_tree_get_point(const CIRC_NODE* node, POINT2D* pt);
 
-#endif /* _LWGEODETIC_TREE_H */
\ No newline at end of file
+#endif /* _LWGEODETIC_TREE_H */
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index efa4bb0..cde9183 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -1443,8 +1443,11 @@ LWGEOM* lwgeom_flip_coordinates(LWGEOM *in)
 		return NULL;
 	}
 
-	lwgeom_drop_bbox(in);
-	lwgeom_add_bbox(in);
+  /* only refresh bbox if X or Y changed */
+	if ( in->bbox ) {
+		lwgeom_drop_bbox(in);
+		lwgeom_add_bbox(in);
+	}
 	return in;
 }
 
diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c
index d24b188..459b626 100644
--- a/liblwgeom/lwgeom_geos.c
+++ b/liblwgeom/lwgeom_geos.c
@@ -219,14 +219,14 @@ ptarray_to_GEOSCoordSeq(const POINTARRAY *pa)
 		{
 			p3d = getPoint3dz_cp(pa, i);
 			p2d = (const POINT2D *)p3d;
+			LWDEBUGF(4, "Point: %g,%g,%g", p3d->x, p3d->y, p3d->z);
 		}
 		else
 		{
 			p2d = getPoint2d_cp(pa, i);
+			LWDEBUGF(4, "Point: %g,%g", p2d->x, p2d->y);
 		}
 
-		LWDEBUGF(4, "Point: %g,%g,%g", p2d->x, p2d->y, p3d->z);
-
 #if POSTGIS_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 */
diff --git a/liblwgeom/lwin_geojson.c b/liblwgeom/lwin_geojson.c
index bf3d8ea..be706f8 100644
--- a/liblwgeom/lwin_geojson.c
+++ b/liblwgeom/lwin_geojson.c
@@ -385,48 +385,34 @@ parse_geojson_multipolygon(json_object *geojson, int *hasz,  int root_srid)
 		const int nPolys = json_object_array_length( poObjPolys );
 
 		for(i = 0; i < nPolys; ++i)
-		{
-			POINTARRAY **ppa;
-			json_object* poObjPoly = NULL;
-			poObjPoly = json_object_array_get_idx( poObjPolys, i );
-
-			ppa = (POINTARRAY**) lwalloc(sizeof(POINTARRAY*));
+		{			
+			json_object* poObjPoly = json_object_array_get_idx( poObjPolys, i );
 
 			if( json_type_array == json_object_get_type( poObjPoly ) )
 			{
-				int nPoints;
-				json_object* points = NULL;
-				int ring = json_object_array_length( poObjPoly );
-				ppa[0] = ptarray_construct_empty(1, 0, 1);
-
-				points = json_object_array_get_idx( poObjPoly, 0 );
-				nPoints = json_object_array_length( points );
-
-				for (j=0; j < nPoints; j++ )
+				LWPOLY *lwpoly = lwpoly_construct_empty(geom->srid, lwgeom_has_z(geom), lwgeom_has_m(geom));
+				int nRings = json_object_array_length( poObjPoly );
+				
+				for(j = 0; j < nRings; ++j)
 				{
-					json_object* coords = NULL;
-					coords = json_object_array_get_idx( points, j );
-					parse_geojson_coord(coords, hasz, ppa[0]);
-				}
+					json_object* points = json_object_array_get_idx( poObjPoly, j );
+					
+					if( json_type_array == json_object_get_type( poObjPoly ) )
+					{
 
-				for(j = 1; j < ring; ++j)
-				{
-					int nPoints;
-					ppa = (POINTARRAY**) lwrealloc((POINTARRAY *) ppa, sizeof(POINTARRAY*) * (j + 1));
-					ppa[j] = ptarray_construct_empty(1, 0, 1);
-					points = json_object_array_get_idx( poObjPoly, j );
+						POINTARRAY *pa = ptarray_construct_empty(1, 0, 1);
 
-					nPoints = json_object_array_length( points );
-					for (k=0; k < nPoints; k++ )
-					{
-						json_object* coords = NULL;
-						coords = json_object_array_get_idx( points, k );
-						parse_geojson_coord(coords, hasz, ppa[j]);
+						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);
+						}
+						
+						lwpoly_add_ring(lwpoly, pa);
 					}
 				}
-
-				geom = (LWGEOM*)lwmpoly_add_lwpoly((LWMPOLY*)geom,
-				                                   (LWPOLY*)lwpoly_construct(root_srid, NULL, ring, ppa));
+				geom = (LWGEOM*)lwmpoly_add_lwpoly((LWMPOLY*)geom, lwpoly);
 			}
 		}
 	}
@@ -559,10 +545,19 @@ lwgeom_from_geojson(const char *geojson, char **srs)
 		if (poObjSrsType != NULL)
 		{
 			json_object* poObjSrsProps = findMemberByName( poObjSrs, "properties" );
-			json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
-			const char* pszName = json_object_get_string( poNameURL );
-			*srs = lwalloc(strlen(pszName) + 1);
-			strcpy(*srs, pszName);
+			if ( poObjSrsProps )
+			{
+				json_object* poNameURL = findMemberByName( poObjSrsProps, "name" );
+				if ( poNameURL )
+				{
+					const char* pszName = json_object_get_string( poNameURL );
+					if ( pszName )
+					{
+						*srs = lwalloc(strlen(pszName) + 1);
+						strcpy(*srs, pszName);
+					}
+				}
+			}
 		}
 	}
 
diff --git a/liblwgeom/lwline.c b/liblwgeom/lwline.c
index c698a3a..0dddaa3 100644
--- a/liblwgeom/lwline.c
+++ b/liblwgeom/lwline.c
@@ -318,8 +318,11 @@ lwline_add_lwpoint(LWLINE *line, LWPOINT *point, int where)
 		return LW_FAILURE;
 
 	/* Update the bounding box */
-	lwgeom_drop_bbox(lwline_as_lwgeom(line));
-	lwgeom_add_bbox(lwline_as_lwgeom(line));
+	if ( line->bbox )
+	{
+		lwgeom_drop_bbox(lwline_as_lwgeom(line));
+		lwgeom_add_bbox(lwline_as_lwgeom(line));
+	}
 	
 	return LW_SUCCESS;
 }
diff --git a/liblwgeom/lwlinearreferencing.c b/liblwgeom/lwlinearreferencing.c
index 267aeea..73f95ac 100644
--- a/liblwgeom/lwlinearreferencing.c
+++ b/liblwgeom/lwlinearreferencing.c
@@ -374,9 +374,12 @@ lwpoint_clip_to_ordinate_range(const LWPOINT *point, char ordinate, double from,
 		lwcollection_add_lwgeom(lwgeom_out, lwpoint_as_lwgeom(lwp));
 	}
 	
-	/* Set the bbox */
-	lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
-	lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+	/* Set the bbox, if necessary */
+	if ( lwgeom_out->bbox )
+	{
+		lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
+		lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+	}
 
 	return lwgeom_out;
 }
@@ -428,9 +431,12 @@ lwmpoint_clip_to_ordinate_range(const LWMPOINT *mpoint, char ordinate, double fr
 		}
 	}
 	
-	/* Set the bbox */
-	lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
-	lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+	/* Set the bbox, if necessary */
+	if ( lwgeom_out->bbox )
+	{
+		lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
+		lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+	}
 
 	return lwgeom_out;
 }
@@ -497,8 +503,12 @@ lwmline_clip_to_ordinate_range(const LWMLINE *mline, char ordinate, double from,
 				lwfree(col);
 			}
 		}
-		lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
-		lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+		if ( lwgeom_out->bbox )
+		{
+			lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
+			lwgeom_add_bbox((LWGEOM*)lwgeom_out);
+		}
+		
 		if ( ! homogeneous )
 		{
 			lwgeom_out->type = COLLECTIONTYPE;
@@ -732,7 +742,7 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
 	lwfree(q);
 	lwfree(r);
 
-	if ( lwgeom_out->ngeoms > 0 )
+	if ( lwgeom_out->bbox && lwgeom_out->ngeoms > 0 )
 	{
 		lwgeom_drop_bbox((LWGEOM*)lwgeom_out);
 		lwgeom_add_bbox((LWGEOM*)lwgeom_out);
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 6329794..99a9410 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -1279,17 +1279,19 @@ ptarray_locate_point(const POINTARRAY *pa, const POINT4D *p4d, double *mindistou
 	
 	if ( ! proj4d ) proj4d = &projtmp;
 
+	start = getPoint2d_cp(pa, 0);
+
 	/* If the pointarray has only one point, the nearest point is */
 	/* just that point */
 	if ( pa->npoints == 1 )
 	{
 		getPoint4d_p(pa, 0, proj4d);
-		*mindistout = distance2d_pt_pt(&p, start);
+		if ( mindistout )
+			*mindistout = distance2d_pt_pt(&p, start);
 		return 0.0;
 	}
 
-	/* Loop through pointarray looking for nearest segment */ 
-	start = getPoint2d_cp(pa, 0);
+	/* Loop through pointarray looking for nearest segment */
 	for (t=1; t<pa->npoints; t++)
 	{
 		double dist;
@@ -1738,4 +1740,4 @@ int
 ptarray_startpoint(const POINTARRAY* pa, POINT4D* pt)
 {
 	return getPoint4d_p(pa, 0, pt);
-}
\ No newline at end of file
+}
diff --git a/libtool b/libtool
index 1e69385..3346985 100755
--- a/libtool
+++ b/libtool
@@ -32,11 +32,14 @@
 # The names of the tagged configurations supported by this script.
 available_tags='CXX '
 
+# Configured defaults for sys_lib_dlsearch_path munging.
+: ${LT_SYS_LIBRARY_PATH=""}
+
 # ### BEGIN LIBTOOL CONFIG
 
 # Which release of libtool.m4 was used?
-macro_version=2.4.4
-macro_revision=2.4.4
+macro_version=2.4.6
+macro_revision=2.4.6
 
 # Whether or not to build shared libraries.
 build_libtool_libs=yes
@@ -64,13 +67,13 @@ PATH_SEPARATOR=":"
 
 # The host system.
 host_alias=
-host=x86_64-apple-darwin13.4.0
-host_os=darwin13.4.0
+host=x86_64-apple-darwin14.4.0
+host_os=darwin14.4.0
 
 # The build system.
 build_alias=
-build=x86_64-apple-darwin13.4.0
-build_os=darwin13.4.0
+build=x86_64-apple-darwin14.4.0
+build_os=darwin14.4.0
 
 # A sed program that does not truncate output.
 SED="/usr/bin/sed"
@@ -279,11 +282,14 @@ finish_eval=""
 hardcode_into_libs=no
 
 # Compile-time system search path for libraries.
-sys_lib_search_path_spec="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0  /usr/local/lib"
+sys_lib_search_path_spec="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0  /usr/local/lib"
 
-# Run-time system search path for libraries.
+# Detected run-time system search path for libraries.
 sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
 
+# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
+configure_time_lt_sys_library_path=""
+
 # Whether dlopen is supported.
 dlopen_support=unknown
 
@@ -445,15 +451,71 @@ compiler_lib_search_path=""
 
 # ### END LIBTOOL CONFIG
 
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
 #! /bin/sh
 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
 ##               by inline-source v2014-01-03.01
 
-# libtool (GNU libtool) 2.4.4
+# libtool (GNU libtool) 2.4.6
 # Provide generalized library-building support services.
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2015 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.
 
@@ -478,8 +540,8 @@ compiler_lib_search_path=""
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION=2.4.4
-package_revision=2.4.4
+VERSION=2.4.6
+package_revision=2.4.6
 
 
 ## ------ ##
@@ -511,12 +573,12 @@ package_revision=2.4.4
 # libraries, which are installed to $pkgauxdir.
 
 # Set a version string for this script.
-scriptversion=2014-01-03.01; # UTC
+scriptversion=2015-01-20.17; # UTC
 
 # General shell script boiler plate, and helper functions.
 # Written by Gary V. Vaughan, 2004
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2015 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.
 
@@ -639,7 +701,7 @@ func_path_progs ()
 
     _G_path_prog_max=0
     _G_path_prog_found=false
-    _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
     for _G_dir in $_G_PATH; do
       IFS=$_G_save_IFS
       test -z "$_G_dir" && _G_dir=.
@@ -1822,7 +1884,7 @@ scriptversion=2014-01-07.03; # UTC
 # A portable, pluggable option parser for Bourne shell.
 # Written by Gary V. Vaughan, 2010
 
-# Copyright (C) 2010-2014 Free Software Foundation, Inc.
+# Copyright (C) 2010-2015 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.
 
@@ -2424,7 +2486,7 @@ func_version ()
 # End:
 
 # Set a version string.
-scriptversion='(GNU libtool) 2.4.4'
+scriptversion='(GNU libtool) 2.4.6'
 
 
 # func_echo ARG...
@@ -2486,7 +2548,12 @@ usage_message="Options:
 "
 
 # Additional text appended to 'usage_message' in response to '--help'.
-long_help_message=$long_help_message"
+func_help ()
+{
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message
 
 MODE must be one of the following:
 
@@ -2510,13 +2577,15 @@ include the following information:
        compiler:       $LTCC
        compiler flags: $LTCFLAGS
        linker:         $LD (gnu? $with_gnu_ld)
-       version:        $progname (GNU libtool) 2.4.4
+       version:        $progname (GNU libtool) 2.4.6
        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 
 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/>."
+    exit 0
+}
 
 
 # func_lo2o OBJECT-NAME
@@ -6908,6 +6977,24 @@ func_win32_import_lib_p ()
     esac
 }
 
+# func_suncc_cstd_abi
+# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
+# Several compiler flags select an ABI that is incompatible with the
+# Cstd library. Avoid specifying it if any are in CXXFLAGS.
+func_suncc_cstd_abi ()
+{
+    $debug_cmd
+
+    case " $compile_command " in
+    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
+      suncc_use_cstd_abi=no
+      ;;
+    *)
+      suncc_use_cstd_abi=yes
+      ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -7884,6 +7971,9 @@ func_mode_link ()
     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
+    # Definition is injected by LT_CONFIG during libtool generation.
+    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
+
     func_dirname "$output" "/" ""
     output_objdir=$func_dirname_result$objdir
     func_to_tool_file "$output_objdir/"
@@ -9046,6 +9136,37 @@ func_mode_link ()
 	  eval $var=\"$tmp_libs\"
 	done # for var
       fi
+
+      # Add Sun CC postdeps if required:
+      test CXX = "$tagname" && {
+        case $host_os in
+        linux*)
+          case `$CC -V 2>&1 | sed 5q` in
+          *Sun\ C*) # Sun C++ 5.9
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+
+        solaris*)
+          func_cc_basename "$CC"
+          case $func_cc_basename_result in
+          CC* | sunCC*)
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+        esac
+      }
+
       # Last step: remove runtime libs from dependency_libs
       # (they stay in deplibs)
       tmp_libs=
diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c
index d5bd841..8e7c20e 100644
--- a/loader/shp2pgsql-core.c
+++ b/loader/shp2pgsql-core.c
@@ -1648,6 +1648,9 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
 	/* Add the shape attribute if we are reading it */
 	if (state->config->readshape == 1)
 	{
+		/* Force the locale to C */
+		char *oldlocale = setlocale(LC_NUMERIC, "C");
+		
 		/* Handle the case of a NULL shape */
 		if (obj->nVertices == 0)
 		{
@@ -1740,6 +1743,8 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
 
 		/* Tidy up everything */
 		SHPDestroyObject(obj);
+		
+		setlocale(LC_NUMERIC, oldlocale);
 	}
 
 	/* Close the line correctly for dump/insert format */
diff --git a/loader/shp2pgsql-core.h b/loader/shp2pgsql-core.h
index 5ada47c..27b8070 100644
--- a/loader/shp2pgsql-core.h
+++ b/loader/shp2pgsql-core.h
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: shp2pgsql-core.h 13134 2014-12-01 08:47:21Z strk $
+ * $Id: shp2pgsql-core.h 13447 2015-04-26 04:33:54Z robe $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <locale.h> 
 #include <ctype.h>
 #include <unistd.h>
 #include <errno.h>
@@ -29,7 +30,7 @@
 
 #include "../liblwgeom/stringbuffer.h"
 
-#define S2P_RCSID "$Id: shp2pgsql-core.h 13134 2014-12-01 08:47:21Z strk $"
+#define S2P_RCSID "$Id: shp2pgsql-core.h 13447 2015-04-26 04:33:54Z robe $"
 
 
 /* Number of digits of precision in WKT produced. */
diff --git a/ltmain.sh b/ltmain.sh
index 5eca4ae..0f0a2da 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -2,11 +2,11 @@
 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
 ##               by inline-source v2014-01-03.01
 
-# libtool (GNU libtool) 2.4.4
+# libtool (GNU libtool) 2.4.6
 # Provide generalized library-building support services.
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2015 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.
 
@@ -31,8 +31,8 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION=2.4.4
-package_revision=2.4.4
+VERSION=2.4.6
+package_revision=2.4.6
 
 
 ## ------ ##
@@ -64,12 +64,12 @@ package_revision=2.4.4
 # libraries, which are installed to $pkgauxdir.
 
 # Set a version string for this script.
-scriptversion=2014-01-03.01; # UTC
+scriptversion=2015-01-20.17; # UTC
 
 # General shell script boiler plate, and helper functions.
 # Written by Gary V. Vaughan, 2004
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2015 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.
 
@@ -192,7 +192,7 @@ func_path_progs ()
 
     _G_path_prog_max=0
     _G_path_prog_found=false
-    _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
     for _G_dir in $_G_PATH; do
       IFS=$_G_save_IFS
       test -z "$_G_dir" && _G_dir=.
@@ -1375,7 +1375,7 @@ scriptversion=2014-01-07.03; # UTC
 # A portable, pluggable option parser for Bourne shell.
 # Written by Gary V. Vaughan, 2010
 
-# Copyright (C) 2010-2014 Free Software Foundation, Inc.
+# Copyright (C) 2010-2015 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.
 
@@ -1977,7 +1977,7 @@ func_version ()
 # End:
 
 # Set a version string.
-scriptversion='(GNU libtool) 2.4.4'
+scriptversion='(GNU libtool) 2.4.6'
 
 
 # func_echo ARG...
@@ -2039,7 +2039,12 @@ usage_message="Options:
 "
 
 # Additional text appended to 'usage_message' in response to '--help'.
-long_help_message=$long_help_message"
+func_help ()
+{
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message
 
 MODE must be one of the following:
 
@@ -2063,13 +2068,15 @@ include the following information:
        compiler:       $LTCC
        compiler flags: $LTCFLAGS
        linker:         $LD (gnu? $with_gnu_ld)
-       version:        $progname (GNU libtool) 2.4.4
+       version:        $progname (GNU libtool) 2.4.6
        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 
 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/>."
+    exit 0
+}
 
 
 # func_lo2o OBJECT-NAME
@@ -6461,6 +6468,24 @@ func_win32_import_lib_p ()
     esac
 }
 
+# func_suncc_cstd_abi
+# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
+# Several compiler flags select an ABI that is incompatible with the
+# Cstd library. Avoid specifying it if any are in CXXFLAGS.
+func_suncc_cstd_abi ()
+{
+    $debug_cmd
+
+    case " $compile_command " in
+    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
+      suncc_use_cstd_abi=no
+      ;;
+    *)
+      suncc_use_cstd_abi=yes
+      ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -7437,6 +7462,9 @@ func_mode_link ()
     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
+    # Definition is injected by LT_CONFIG during libtool generation.
+    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
+
     func_dirname "$output" "/" ""
     output_objdir=$func_dirname_result$objdir
     func_to_tool_file "$output_objdir/"
@@ -8599,6 +8627,37 @@ func_mode_link ()
 	  eval $var=\"$tmp_libs\"
 	done # for var
       fi
+
+      # Add Sun CC postdeps if required:
+      test CXX = "$tagname" && {
+        case $host_os in
+        linux*)
+          case `$CC -V 2>&1 | sed 5q` in
+          *Sun\ C*) # Sun C++ 5.9
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+
+        solaris*)
+          func_cc_basename "$CC"
+          case $func_cc_basename_result in
+          CC* | sunCC*)
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+        esac
+      }
+
       # Last step: remove runtime libs from dependency_libs
       # (they stay in deplibs)
       tmp_libs=
diff --git a/macros/._libtool.m4 b/macros/._libtool.m4
new file mode 100644
index 0000000..4b8deb2
Binary files /dev/null and b/macros/._libtool.m4 differ
diff --git a/macros/._ltoptions.m4 b/macros/._ltoptions.m4
new file mode 100644
index 0000000..3d07a38
Binary files /dev/null and b/macros/._ltoptions.m4 differ
diff --git a/macros/._ltsugar.m4 b/macros/._ltsugar.m4
new file mode 100644
index 0000000..bc3a289
Binary files /dev/null and b/macros/._ltsugar.m4 differ
diff --git a/macros/._lt~obsolete.m4 b/macros/._lt~obsolete.m4
new file mode 100644
index 0000000..a5ff095
Binary files /dev/null and b/macros/._lt~obsolete.m4 differ
diff --git a/macros/libtool.m4 b/macros/libtool.m4
index 9c089e0..a3bc337 100644
--- a/macros/libtool.m4
+++ b/macros/libtool.m4
@@ -1,6 +1,6 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
-#   Copyright (C) 1996-2001, 2003-2014 Free Software Foundation, Inc.
+#   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -103,19 +103,36 @@ dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
 
 
+# _LT_PREPARE_CC_BASENAME
+# -----------------------
+m4_defun([_LT_PREPARE_CC_BASENAME], [
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in @S|@*""; do
+      case $cc_temp in
+        compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+        distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+])# _LT_PREPARE_CC_BASENAME
+
+
 # _LT_CC_BASENAME(CC)
 # -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
+# but that macro is also expanded into generated libtool script, which
+# arranges for $SED and $ECHO to be set by different means.
 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-%%"`
+[m4_require([_LT_PREPARE_CC_BASENAME])dnl
+AC_REQUIRE([_LT_DECL_SED])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+func_cc_basename $1
+cc_basename=$func_cc_basename_result
 ])
 
 
@@ -720,6 +737,9 @@ _LT_CONFIG_SAVE_COMMANDS([
 _LT_COPYING
 _LT_LIBTOOL_TAGS
 
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
 # ### BEGIN LIBTOOL CONFIG
 _LT_LIBTOOL_CONFIG_VARS
 _LT_LIBTOOL_TAG_VARS
@@ -727,6 +747,17 @@ _LT_LIBTOOL_TAG_VARS
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_PREPARE_MUNGE_PATH_LIST
+_LT_PREPARE_CC_BASENAME
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
@@ -2202,6 +2233,47 @@ _LT_DECL([], [striplib], [1])
 ])# _LT_CMD_STRIPLIB
 
 
+# _LT_PREPARE_MUNGE_PATH_LIST
+# ---------------------------
+# Make sure func_munge_path_list() is defined correctly.
+m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
+[[# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x at S|@2 in
+    x)
+        ;;
+    *:)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
+        ;;
+    x:*)
+        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
+        ;;
+    *)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+]])# _LT_PREPARE_PATH_LIST
+
+
 # _LT_SYS_DYNAMIC_LINKER([TAG])
 # -----------------------------
 # PORTME Fill in your ld.so characteristics
@@ -2212,6 +2284,7 @@ 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
+m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
@@ -2306,6 +2379,9 @@ hardcode_into_libs=no
 # flags to be left without arguments
 need_version=unknown
 
+AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
+[User-defined run-time library search path.])
+
 case $host_os in
 aix3*)
   version_type=linux # correct to gnu/linux during the next big refactor
@@ -2594,6 +2670,7 @@ freebsd* | dragonfly*)
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
@@ -2653,10 +2730,11 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='$libname$release$shared_ext$major'
     if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -2789,7 +2867,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) 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"
@@ -3013,10 +3096,20 @@ fi
 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
   sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
+
 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
   sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
 _LT_DECL([], [variables_saved_for_relink], [1],
     [Variables whose values should be saved in libtool wrapper scripts and
     restored at link time])
@@ -3049,8 +3142,10 @@ _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_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
+    [Detected run-time system search path for libraries])
+_LT_DECL([], [configure_time_lt_sys_library_path], [2],
+    [Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
 ])# _LT_SYS_DYNAMIC_LINKER
 
 
@@ -7350,6 +7445,7 @@ func_stripname_cnf ()
 } # func_stripname_cnf
 ])# _LT_FUNC_STRIPNAME_CNF
 
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -7528,51 +7624,6 @@ interix[[3-9]]*)
   _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 yes != "$solaris_use_stlport4"; 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 yes != "$solaris_use_stlport4"; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
 esac
 ])
 
diff --git a/macros/ltoptions.m4 b/macros/ltoptions.m4
index f51ec8c..94b0829 100644
--- a/macros/ltoptions.m4
+++ b/macros/ltoptions.m4
@@ -1,6 +1,6 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004-2005, 2007-2009, 2011-2014 Free Software
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
 #   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
diff --git a/macros/ltsugar.m4 b/macros/ltsugar.m4
index da4ac6b..48bc934 100644
--- a/macros/ltsugar.m4
+++ b/macros/ltsugar.m4
@@ -1,6 +1,6 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004-2005, 2007-2008, 2011-2014 Free Software
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
 # Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
diff --git a/macros/ltversion.m4 b/macros/ltversion.m4
index cb6da68..fa04b52 100644
--- a/macros/ltversion.m4
+++ b/macros/ltversion.m4
@@ -1,6 +1,6 @@
 # ltversion.m4 -- version numbers			-*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2011-2014 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 4151 ltversion.m4
+# serial 4179 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4.4])
-m4_define([LT_PACKAGE_REVISION], [2.4.4])
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.4'
-macro_revision='2.4.4'
+[macro_version='2.4.6'
+macro_revision='2.4.6'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/macros/lt~obsolete.m4 b/macros/lt~obsolete.m4
index 6975098..c6b26f8 100644
--- a/macros/lt~obsolete.m4
+++ b/macros/lt~obsolete.m4
@@ -1,6 +1,6 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004-2005, 2007, 2009, 2011-2014 Free Software
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
 #   Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
diff --git a/postgis/geography_btree.c b/postgis/geography_btree.c
index 357398a..b42e1b5 100644
--- a/postgis/geography_btree.c
+++ b/postgis/geography_btree.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: geography_btree.c 9324 2012-02-27 22:08:12Z pramsey $
+ * $Id: geography_btree.c 13436 2015-04-23 18:19:47Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * Copyright 2009 Paul Ramsey <pramsey at cleverelephant.ca>
@@ -241,7 +241,7 @@ Datum geography_cmp(PG_FUNCTION_ARGS)
 
 	/* Must be able to build box for each argument (ie, not empty geometry) */
 	if ( ! gserialized_datum_get_gidx_p(PG_GETARG_DATUM(0), gbox1) ||
-	        ! gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), gbox2) )
+	     ! gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), gbox2) )
 	{
 		PG_RETURN_BOOL(FALSE);
 	}
@@ -249,13 +249,33 @@ Datum geography_cmp(PG_FUNCTION_ARGS)
 	geography_gidx_center(gbox1, &p1);
 	geography_gidx_center(gbox2, &p2);
 
-	if ( p1.x > p2.x && p1.y > p2.y && p1.z > p2.z )
+	if  ( ! FP_EQUALS(p1.x, p2.x) )
+	{
+		if  (p1.x < p2.x)
+		{
+			PG_RETURN_INT32(-1);
+		}
 		PG_RETURN_INT32(1);
+	}
 
-	if ( FP_EQUALS(p1.x, p2.x) && FP_EQUALS(p1.y, p2.y) && FP_EQUALS(p1.z, p2.z) )
-		PG_RETURN_INT32(0);
+	if  ( ! FP_EQUALS(p1.y, p2.y) )
+	{
+		if  (p1.y < p2.y)
+		{
+			PG_RETURN_INT32(-1);
+		}
+		PG_RETURN_INT32(1);
+	}
 
-	PG_RETURN_INT32(-1);
+	if  ( ! FP_EQUALS(p1.z, p2.z) )
+	{
+		if  (p1.z < p2.z)
+		{
+			PG_RETURN_INT32(-1);
+		}
+		PG_RETURN_INT32(1);
+	}
 
+	PG_RETURN_INT32(0);
 }
 
diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c
index 3315dfe..c6a8c1e 100644
--- a/postgis/geography_inout.c
+++ b/postgis/geography_inout.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: geography_inout.c 13368 2015-03-20 14:06:44Z pramsey $
+ * $Id: geography_inout.c 13659 2015-06-11 19:47:14Z strk $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * Copyright 2009-2011 Paul Ramsey <pramsey at cleverelephant.ca>
@@ -598,9 +598,11 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS)
 	** functions do the right thing.
 	*/
 	lwgeom_set_geodetic(lwgeom, true);
+	
 	/* Recalculate the boxes after re-setting the geodetic bit */
 	lwgeom_drop_bbox(lwgeom);
 	lwgeom_add_bbox(lwgeom);
+	
 	g_ser = geography_serialize(lwgeom);
 
 	/*
diff --git a/postgis/lwgeom_accum.c b/postgis/lwgeom_accum.c
index 0aecda7..1beb0b0 100644
--- a/postgis/lwgeom_accum.c
+++ b/postgis/lwgeom_accum.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: lwgeom_accum.c 13134 2014-12-01 08:47:21Z strk $
+ * $Id: lwgeom_accum.c 13525 2015-05-19 17:38:43Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
@@ -105,15 +105,10 @@ pgis_geometry_accum_transfn(PG_FUNCTION_ARGS)
 		        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 		         errmsg("could not determine input data type")));
 
-	if (fcinfo->context && IsA(fcinfo->context, AggState))
-		aggcontext = ((AggState *) fcinfo->context)->aggcontext;
-	else if (fcinfo->context && IsA(fcinfo->context, WindowAggState))
-		aggcontext = ((WindowAggState *) fcinfo->context)->aggcontext;
-
-	else
+	if ( ! AggCheckCallContext(fcinfo, &aggcontext) )
 	{
 		/* cannot be called directly because of dummy-type argument */
-		elog(ERROR, "array_agg_transfn called in non-aggregate context");
+		elog(ERROR, "%s called in non-aggregate context", __func__);
 		aggcontext = NULL;  /* keep compiler quiet */
 	}
 
diff --git a/postgis/lwgeom_export.c b/postgis/lwgeom_export.c
index 72abf7a..ab4d8e5 100644
--- a/postgis/lwgeom_export.c
+++ b/postgis/lwgeom_export.c
@@ -112,8 +112,12 @@ int getSRIDbySRS(const char* srs)
 		SPI_finish();
 		return 0;
 	}
-	sprintf(query, "SELECT srid \
-	        FROM spatial_ref_sys WHERE auth_name||':'||auth_srid = '%s'", srs);
+
+	sprintf(query, 
+		"SELECT srid "
+		"FROM spatial_ref_sys, "
+		"regexp_matches('%s', E'([a-z]+):([0-9]+)', 'gi') AS re "
+		"WHERE re[1] ILIKE auth_name AND int4(re[2]) = auth_srid", srs);
 
 	err = SPI_exec(query, 1);
 	if ( err < 0 )
@@ -126,9 +130,11 @@ int getSRIDbySRS(const char* srs)
 	/* no entry in spatial_ref_sys */
 	if (SPI_processed <= 0)
 	{
-		sprintf(query, "SELECT srid \
-		        FROM spatial_ref_sys WHERE \
-		        'urn:ogc:def:crs:'||auth_name||'::'||auth_srid = '%s'", srs);
+		sprintf(query, 
+			"SELECT srid "
+			"FROM spatial_ref_sys, "
+			"regexp_matches('%s', E'urn:ogc:def:crs:([a-z]+):.*:([0-9]+)', 'gi') AS re "
+			"WHERE re[1] ILIKE auth_name AND int4(re[2]) = auth_srid", srs);
 
 		err = SPI_exec(query, 1);
 		if ( err < 0 )
@@ -176,8 +182,10 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS)
 	static const char* default_prefix = "gml:"; /* default prefix */
 	const char* prefix = default_prefix;
 	const char* gml_id = NULL;
-	char *prefix_buf, *gml_id_buf;
+	size_t len;
+	char *gml_id_buf, *prefix_buf;
 	text *prefix_text, *gml_id_text;
+	
 
 	/* Get the version */
 	version = PG_GETARG_INT32(0);
@@ -209,19 +217,18 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS)
 	if (PG_NARGS() >4 && !PG_ARGISNULL(4))
 	{
 		prefix_text = PG_GETARG_TEXT_P(4);
-		if ( VARSIZE(prefix_text)-VARHDRSZ == 0 )
+		if ( VARSIZE(prefix_text) == VARHDRSZ )
 		{
 			prefix = "";
 		}
 		else
 		{
-			/* +2 is one for the ':' and one for term null */
-			prefix_buf = palloc(VARSIZE(prefix_text)-VARHDRSZ+2);
-			memcpy(prefix_buf, VARDATA(prefix_text),
-			       VARSIZE(prefix_text)-VARHDRSZ);
+			len = VARSIZE(prefix_text)-VARHDRSZ;
+			prefix_buf = palloc(len + 2); /* +2 is one for the ':' and one for term null */
+			memcpy(prefix_buf, VARDATA(prefix_text), len);
 			/* add colon and null terminate */
-			prefix_buf[VARSIZE(prefix_text)-VARHDRSZ] = ':';
-			prefix_buf[VARSIZE(prefix_text)-VARHDRSZ+1] = '\0';
+			prefix_buf[len] = ':';
+			prefix_buf[len+1] = '\0';
 			prefix = prefix_buf;
 		}
 	}
@@ -229,15 +236,16 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS)
 	if (PG_NARGS() >5 && !PG_ARGISNULL(5))
 	{
 		gml_id_text = PG_GETARG_TEXT_P(5);
-		if ( VARSIZE(gml_id_text)-VARHDRSZ == 0 )
+		if ( VARSIZE(gml_id_text) == VARHDRSZ )
 		{
 			gml_id = "";
 		}
 		else
 		{
-			gml_id_buf = palloc(VARSIZE(gml_id_text)-VARHDRSZ+1);
-			memcpy(gml_id_buf, VARDATA(gml_id_text), VARSIZE(gml_id_text)-VARHDRSZ);
-			gml_id_buf[VARSIZE(gml_id_text)-VARHDRSZ+1] = '\0';
+			len = VARSIZE(gml_id_text)-VARHDRSZ;
+			gml_id_buf = palloc(len+1);
+			memcpy(gml_id_buf, VARDATA(gml_id_text), len);
+			gml_id_buf[len] = '\0';
 			gml_id = gml_id_buf;
 		}
 	}
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 55f47b6..7debad8 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: lwgeom_functions_basic.c 13371 2015-03-20 15:32:06Z pramsey $
+ * $Id: lwgeom_functions_basic.c 13659 2015-06-11 19:47:14Z strk $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
@@ -2540,8 +2540,11 @@ Datum LWGEOM_affine(PG_FUNCTION_ARGS)
 	lwgeom_affine(lwgeom, &affine);
 
 	/* COMPUTE_BBOX TAINTING */
-	lwgeom_drop_bbox(lwgeom);
-	lwgeom_add_bbox(lwgeom);
+	if ( lwgeom->bbox )
+	{
+		lwgeom_drop_bbox(lwgeom);
+		lwgeom_add_bbox(lwgeom);
+	}
 	ret = geometry_serialize(lwgeom);
 
 	/* Release memory */
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index e27340d..0590591 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -1,6 +1,6 @@
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 --
--- $Id: postgis.sql.in 13299 2015-03-03 13:04:21Z strk $
+-- $Id: postgis.sql.in 13462 2015-04-29 20:03:05Z robe $
 --
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
@@ -2434,35 +2434,23 @@ LANGUAGE 'plpgsql' VOLATILE STRICT;
 -----------------------------------------------------------------------
 -- FIND_SRID( <schema>, <table>, <geom col> )
 -----------------------------------------------------------------------
+-- Changed: 2.1.8 improve performance
 CREATE OR REPLACE FUNCTION find_srid(varchar,varchar,varchar) RETURNS int4 AS
 $$
 DECLARE
-	schem text;
-	tabl text;
+	schem varchar =  $1;
+	tabl varchar = $2;
 	sr int4;
 BEGIN
-	IF $1 IS NULL THEN
-	  RAISE EXCEPTION 'find_srid() - schema is NULL!';
-	END IF;
-	IF $2 IS NULL THEN
-	  RAISE EXCEPTION 'find_srid() - table name is NULL!';
-	END IF;
-	IF $3 IS NULL THEN
-	  RAISE EXCEPTION 'find_srid() - column name is NULL!';
-	END IF;
-	schem = $1;
-	tabl = $2;
 -- if the table contains a . and the schema is empty
 -- split the table into a schema and a table
 -- otherwise drop through to default behavior
-	IF ( schem = '' and tabl LIKE '%.%' ) THEN
+	IF ( schem = '' and strpos(tabl,'.') > 0 ) THEN
 	 schem = substr(tabl,1,strpos(tabl,'.')-1);
 	 tabl = substr(tabl,length(schem)+2);
-	ELSE
-	 schem = schem || '%';
 	END IF;
 
-	select SRID into sr from geometry_columns where f_table_schema like schem and f_table_name = tabl and f_geometry_column = $3;
+	select SRID into sr from geometry_columns where (f_table_schema = schem or schem = '') and f_table_name = tabl and f_geometry_column = $3;
 	IF NOT FOUND THEN
 	   RAISE EXCEPTION 'find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table?  Is there an uppercase/lowercase missmatch?';
 	END IF;
@@ -2472,6 +2460,7 @@ $$
 LANGUAGE 'plpgsql' IMMUTABLE STRICT;
 
 
+
 ---------------------------------------------------------------
 -- PROJ support
 ---------------------------------------------------------------
@@ -4696,38 +4685,46 @@ SELECT  replace(split_part(s.consrc, '''', 2), ')', '')::varchar
 $$
 LANGUAGE 'sql' STABLE STRICT;
 
+-- Availability: 2.0.0
+-- Changed: 2.1.8 significant performance improvement for constraint based columns
 CREATE OR REPLACE VIEW geometry_columns AS 
-  SELECT current_database()::varchar(256) AS f_table_catalog, 
-    n.nspname::varchar(256) AS f_table_schema, 
-    c.relname::varchar(256) AS f_table_name, 
-    a.attname::varchar(256) AS f_geometry_column, 
-    COALESCE(postgis_typmod_dims(a.atttypmod),
-             postgis_constraint_dims(n.nspname, c.relname, a.attname),
-             2) AS coord_dimension, -- should it be 0 instead ?
-    COALESCE(NULLIF(postgis_typmod_srid(a.atttypmod),0),
-             postgis_constraint_srid(n.nspname, c.relname, a.attname),
-             0) AS srid, 
-    -- force to be uppercase with no ZM so is backwards compatible
-    -- with old geometry_columns
-    replace(
-      replace(
-        COALESCE(
-          NULLIF(upper(postgis_typmod_type(a.atttypmod)::text), 'GEOMETRY'),
-          postgis_constraint_type(n.nspname, c.relname, a.attname),
-          'GEOMETRY'
-        ), 'ZM', ''
-      ), 'Z', ''
-    )::varchar(30) AS type
-  FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n
-  WHERE t.typname = 'geometry'::name 
-    AND a.attisdropped = false 
-    AND a.atttypid = t.oid 
-    AND a.attrelid = c.oid 
-    AND c.relnamespace = n.oid 
-    AND (c.relkind = 'r'::"char" OR c.relkind = 'v'::"char" OR c.relkind = 'm'::"char" OR c.relkind = 'f'::"char")
-    AND NOT pg_is_other_temp_schema(c.relnamespace)
-    AND NOT ( n.nspname = 'public' AND c.relname = 'raster_columns' )
-    AND has_table_privilege( c.oid, 'SELECT'::text );
+ SELECT current_database()::character varying(256) AS f_table_catalog,
+-- TODO: consider getting rid of CASTING it slows things down by 2 to 6 fold for table/column exact matches.  
+--      Geography doesn't have casting by the way
+    n.nspname::varchar(256) AS f_table_schema,
+    c.relname::varchar(256) AS f_table_name,
+    a.attname::varchar(256) AS f_geometry_column,
+    COALESCE(postgis_typmod_dims(a.atttypmod), sn.ndims, 2) AS coord_dimension,
+    COALESCE(NULLIF(postgis_typmod_srid(a.atttypmod), 0), sr.srid, 0) AS srid,
+    replace(replace(COALESCE(NULLIF(upper(postgis_typmod_type(a.atttypmod)), 'GEOMETRY'::text), st.type, 'GEOMETRY'::text), 'ZM'::text, ''::text), 'Z'::text, ''::text)::character varying(30) AS type
+   FROM pg_class c
+     JOIN pg_attribute a ON a.attrelid = c.oid AND NOT a.attisdropped
+     JOIN pg_namespace n ON c.relnamespace = n.oid
+     JOIN pg_type t ON a.atttypid = t.oid
+     LEFT JOIN ( SELECT s.connamespace,
+            s.conrelid,
+            s.conkey, replace(split_part(s.consrc, ''''::text, 2), ')'::text, ''::text) As type
+           FROM pg_constraint AS s
+          WHERE s.consrc ~~* '%geometrytype(% = %'::text 
+          
+) st ON st.connamespace = n.oid AND st.conrelid = c.oid AND (a.attnum = ANY (st.conkey))
+     LEFT JOIN ( SELECT s.connamespace,
+            s.conrelid,
+            s.conkey, replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text)::integer As ndims
+           FROM pg_constraint AS s
+          WHERE s.consrc ~~* '%ndims(% = %'::text
+          
+) sn ON sn.connamespace = n.oid AND sn.conrelid = c.oid AND (a.attnum = ANY (sn.conkey))
+     LEFT JOIN ( SELECT s.connamespace,
+            s.conrelid,
+            s.conkey, replace(replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text), '('::text, ''::text)::integer As srid
+           FROM pg_constraint AS s
+          WHERE s.consrc ~~* '%srid(% = %'::text
+          
+) sr ON sr.connamespace = n.oid AND sr.conrelid = c.oid AND (a.attnum = ANY (sr.conkey))
+  WHERE (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'm'::"char", 'f'::"char"])) 
+  AND NOT c.relname = 'raster_columns'::name AND t.typname = 'geometry'::name 
+  AND NOT pg_is_other_temp_schema(c.relnamespace) AND has_table_privilege(c.oid, 'SELECT'::text);
 
 -- TODO: support RETURNING and raise a WARNING
 CREATE OR REPLACE RULE geometry_columns_insert AS
diff --git a/postgis/sqldefines.h b/postgis/sqldefines.h
index 1902b06..7848165 100644
--- a/postgis/sqldefines.h
+++ b/postgis/sqldefines.h
@@ -8,8 +8,8 @@
  */
 #define POSTGIS_PGSQL_VERSION 93
 #define POSTGIS_GEOS_VERSION 35
-#define POSTGIS_PROJ_VERSION 48
-#define POSTGIS_LIB_VERSION '2.1.7'
+#define POSTGIS_PROJ_VERSION 49
+#define POSTGIS_LIB_VERSION '2.1.8'
 #define POSTGIS_LIBXML2_VERSION 2.9.2
 
 /*
@@ -18,12 +18,12 @@
  * won't substitute within apostrophes)
  */
 #define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1''::text AS version'
-#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2015-03-30 12:54:40''::text AS version'
+#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2015-07-07 13:50:01''::text AS version'
 
 #if POSTGIS_SVN_REVISION
-#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.1.7'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
+#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.1.8'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
 #else
-#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.1.7'::text AS version $$
+#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.1.8'::text AS version $$
 #endif
 
 #define SRID_USR_MAX 998999
diff --git a/postgis_svn_revision.h b/postgis_svn_revision.h
index 1564b5a..a1fedf4 100644
--- a/postgis_svn_revision.h
+++ b/postgis_svn_revision.h
@@ -1 +1 @@
-#define POSTGIS_SVN_REVISION 13414
+#define POSTGIS_SVN_REVISION 13780
diff --git a/raster/test/regress/tickets.sql b/raster/test/regress/tickets.sql
index 398c61c..33ef7c9 100644
--- a/raster/test/regress/tickets.sql
+++ b/raster/test/regress/tickets.sql
@@ -16,3 +16,87 @@ WITH data AS ( SELECT '#2911' l, ST_Metadata(ST_Rescale(
  -2.0
  )) m
 ) SELECT l, (m).* FROM data;
+
+-- #3006
+SET client_min_messages TO ERROR;
+
+DROP TABLE IF EXISTS test_raster_scale_regular;
+CREATE TABLE test_raster_scale_regular (
+	rid integer,
+	rast raster
+);
+
+DROP TABLE IF EXISTS test_raster_scale_big;
+CREATE TABLE test_raster_scale_big (
+	rid integer,
+	rast raster
+);
+
+DROP TABLE IF EXISTS test_raster_scale_small;
+CREATE TABLE test_raster_scale_small (
+	rid integer,
+	rast raster
+);
+
+
+CREATE OR REPLACE FUNCTION make_test_raster(
+	table_suffix text,
+	rid integer,
+  scale_x double precision,
+  scale_y double precision DEFAULT 1.0
+)
+RETURNS void
+AS $$
+DECLARE
+	rast raster;
+	width integer := 2;
+	height integer := 2;
+	ul_x double precision := 0;
+	ul_y double precision := 0;
+	skew_x double precision := 0;
+	skew_y double precision := 0;
+	initvalue double precision := 1;
+	nodataval double precision := 0;
+BEGIN
+	rast := ST_MakeEmptyRaster(width, height, ul_x, ul_y, scale_x, scale_y, skew_x, skew_y, 0);
+	rast := ST_AddBand(rast, 1, '8BUI', initvalue, nodataval);
+
+	EXECUTE 'INSERT INTO test_raster_scale_' || table_suffix || ' VALUES ($1, $2)' USING rid, rast;
+	RETURN;
+END;
+$$ LANGUAGE 'plpgsql';
+
+SELECT make_test_raster('regular', 0, 1);
+SELECT make_test_raster('regular', 1, 1.0000001);
+SELECT make_test_raster('regular', 2, 0.9999999);
+SELECT AddRasterConstraints('test_raster_scale_regular'::name, 'rast'::name, 'scale_x', 'scale_y');
+SELECT r_table_name, r_raster_column, scale_x, scale_y FROM raster_columns
+	WHERE  r_raster_column = 'rast' AND r_table_name = 'test_raster_scale_regular';
+
+-- Issues enforce_scalex_rast constraint violation
+SELECT make_test_raster('regular', 3, 1.001, 0.9999999);
+
+SELECT make_test_raster('big', 0, -12345678901234.0);
+SELECT AddRasterConstraints('test_raster_scale_big'::name, 'rast'::name, 'scale_x', 'scale_y');
+SELECT r_table_name, r_raster_column, scale_x, scale_y FROM raster_columns
+  WHERE  r_raster_column = 'rast' AND r_table_name = 'test_raster_scale_big';
+
+-- Issues enforce_scalex_rast constraint violation
+SELECT make_test_raster('big', 1, -123456789012345.0);
+
+SELECT make_test_raster('small', 0, 0.00001);
+SELECT make_test_raster('small', 1, 0.000011);
+SELECT make_test_raster('small', 2, 0.00000999);
+SELECT AddRasterConstraints('test_raster_scale_small'::name, 'rast'::name, 'scale_x', 'scale_y');
+SELECT r_table_name, r_raster_column, scale_x, scale_y FROM raster_columns
+  WHERE  r_raster_column = 'rast' AND r_table_name = 'test_raster_scale_small';
+
+-- Issues enforce_scaley_rast constraint violation
+SELECT make_test_raster('small', 3, 0.00001, 1.00001);
+
+DROP FUNCTION make_test_raster(text, integer, double precision, double precision);
+DROP TABLE IF EXISTS test_raster_scale_regular;
+DROP TABLE IF EXISTS test_raster_scale_big;
+DROP TABLE IF EXISTS test_raster_scale_small;
+
+SET client_min_messages TO DEFAULT;
diff --git a/raster/test/regress/tickets_expected b/raster/test/regress/tickets_expected
index e00841e..4596f2a 100644
--- a/raster/test/regress/tickets_expected
+++ b/raster/test/regress/tickets_expected
@@ -3,3 +3,12 @@
 #2532.2|
 NOTICE:  Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
 #2911|0|0|5|5|2|-2|0|0|0|1
+t
+test_raster_scale_regular|rast||1
+ERROR:  new row for relation "test_raster_scale_regular" violates check constraint "enforce_scaley_rast"
+t
+test_raster_scale_big|rast|-12345678901234|1
+ERROR:  new row for relation "test_raster_scale_big" violates check constraint "enforce_scalex_rast"
+t
+test_raster_scale_small|rast||1
+ERROR:  new row for relation "test_raster_scale_small" violates check constraint "enforce_scaley_rast"
diff --git a/regress/affine.sql b/regress/affine.sql
index 1d5ef09..3006389 100644
--- a/regress/affine.sql
+++ b/regress/affine.sql
@@ -48,6 +48,9 @@ select 'ST_TransScale', ST_asewkt(ST_snapToGrid(ST_TransScale('POINT(1 1)'::geom
 select 'ST_TransScale', ST_asewkt(ST_snapToGrid(ST_TransScale('POINT(1 1)'::geometry,2, 3, 5, 7), 0.1));
 select 'ST_TransScale', ST_asewkt(ST_snapToGrid(ST_TransScale('POINT(1 1 1)'::geometry,2, 3, 5, 7), 0.1));
 
+-- https://trac.osgeo.org/postgis/ticket/3159
+select '#3159', st_summary(st_affine(st_makepoint(1,1),1,0,0,1,0,0));
+
 -- postgis-users/2006-May/012119.html
 select 'transl_bbox', box2d(ST_Translate('LINESTRING(0 0, 1 1)'::geometry, 1, 0, 0));
 select 'ST_Scale_bbox', box2d(ST_Scale('LINESTRING(1 0, 2 1)'::geometry, 2, 0));
diff --git a/regress/affine_expected b/regress/affine_expected
index 639d069..a185112 100644
--- a/regress/affine_expected
+++ b/regress/affine_expected
@@ -32,6 +32,7 @@ ST_TransScale|POINT(4 2)
 ST_TransScale|POINT(2 4)
 ST_TransScale|POINT(15 28)
 ST_TransScale|POINT(15 28 1)
+#3159|Point[]
 transl_bbox|BOX(1 0,2 1)
 ST_Scale_bbox|BOX(2 0,4 0)
 ST_Scale_bbox|BOX(3 1,4 2)
diff --git a/regress/in_geojson.sql b/regress/in_geojson.sql
index 23325e8..05c4a11 100644
--- a/regress/in_geojson.sql
+++ b/regress/in_geojson.sql
@@ -10,6 +10,12 @@ select 'geomfromgeojson_06',st_astext(st_geomfromgeojson(st_asgeojson('MULTIPOLY
 select '#1434: Next two errors';
 select '#1434.1',ST_GeomFromGeoJSON('{ "type": "Point", "crashme": [100.0, 0.0] }');
 select '#1434.2',ST_GeomFromGeoJSON('crashme');;
+select '#1434.3',ST_GeomFromGeoJSON('');
+select '#1434.4',ST_GeomFromGeoJSON('{}');
+select '#1434.5',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[]}'); 
+select '#1434.6',ST_GeomFromGeoJSON('{"type":"MultiPoint","coordinates":[[]]}'); 
+select '#1434.7',ST_GeomFromGeoJSON('{"type":"MultiPoint"}'); 
+select '#1434.8',ST_GeomFromGeoJSON('{"type":"Point"}'); 
 
 -- #2130 --
 SELECT '#2130', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[[[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,32],[-117,32],[-117,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-117,32],[-117 [...]
@@ -23,3 +29,13 @@ SELECT '#2619', ST_AsText(ST_GeomFromGeoJSON('{"type":"Polygon","bbox":[1,5,2,6]
 -- #2697 --
 SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1]}');
 SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1,1]}');
+
+-- FromGeoJSON 3D
+
+SELECT 'geomfromgeojson_z_01', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2,3]}'));
+SELECT 'geomfromgeojson_z_02', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3],[2,3,4]]}'));
+
+-- FromGeoJSON 4D
+
+SELECT 'geomfromgeojson_zm_01', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2,3,4]}'));
+SELECT 'geomfromgeojson_zm_02', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3,4],[2,3,4,5]]}'));
diff --git a/regress/in_geojson_expected b/regress/in_geojson_expected
index 3320f1e..dd64494 100644
--- a/regress/in_geojson_expected
+++ b/regress/in_geojson_expected
@@ -7,8 +7,18 @@ geomfromgeojson_06|MULTIPOLYGON(((0 0,1 1,1 0,0 0)))
 #1434: Next two errors
 ERROR:  Unable to find 'coordinates' in GeoJSON string
 ERROR:  unexpected character (at offset 0)
+ERROR:  unexpected end of data (at offset 0)
+ERROR:  invalid GeoJSON representation
+ERROR:  Too few ordinates in GeoJSON
+ERROR:  Too few ordinates in GeoJSON
+ERROR:  Unable to find 'coordinates' in GeoJSON string
+ERROR:  Unable to find 'coordinates' in GeoJSON string
 #2130|50
 #2216|30
 #2619|POLYGON EMPTY
 ERROR:  The 'coordinates' in GeoJSON ring are not an array
 ERROR:  The 'coordinates' in GeoJSON ring are not an array
+geomfromgeojson_z_01|POINT(1 2 3)
+geomfromgeojson_z_02|LINESTRING(1 2 3,2 3 4)
+geomfromgeojson_zm_01|POINT(1 2 3)
+geomfromgeojson_zm_02|LINESTRING(1 2 3,2 3 4)
diff --git a/regress/regress_lrs.sql b/regress/regress_lrs.sql
index 761af96..7663058 100644
--- a/regress/regress_lrs.sql
+++ b/regress/regress_lrs.sql
@@ -33,6 +33,7 @@ select 'line_locate_point_2', ST_LineLocatePoint(ST_geomfromtext('LINESTRING(-19
 select 'line_locate_point_3', ST_LineLocatePoint(ST_geomfromtext('LINESTRING(-1953743.873 471070.784,-1953735.105 471075.419,-1953720.034 471081.649)', 6269), ST_geomfromtext('POINT(-1953743.873 471070.784)', 6269));
 --- http://trac.osgeo.org/postgis/ticket/1772#comment:2
 select 'line_locate_point_4', ST_LineLocatePoint('LINESTRING(0 1, 0 1, 0 1)', 'POINT(0 1)');
+SELECT 'line_locate_point_5', ST_LineLocatePoint(ST_MakeLine('POINT(1 2)'::geometry, 'POINT EMPTY'::geometry), ST_Point(-11,40));
 
 --- line_substring / line_interpolate_point
 
diff --git a/regress/regress_lrs_expected b/regress/regress_lrs_expected
index 83affb0..a20d29c 100644
--- a/regress/regress_lrs_expected
+++ b/regress/regress_lrs_expected
@@ -19,6 +19,7 @@ line_locate_point_1|0.528602749909894
 line_locate_point_2|1
 line_locate_point_3|0
 line_locate_point_4|0
+line_locate_point_5|0
 line_substring_1|4326|LINESTRING ZM (2 2 2 2,3 3 3 3,3.2 3.2 3.2 3.2)
 line_substring_2|LINESTRING ZM (2 2 2 2,3 3 3 3)
 line_substring_3|LINESTRING(0 0,1 1)

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



More information about the Pkg-grass-devel mailing list