Description: Dynamically link to liblwgeom
 Instead of statically pulling liblwgeom into the postgis.so, dynamically
 link to it.
Author: Stephen Frost <sfrost@snowman.net>, Markus Wanner <markus@bluegap.ch>
Last-Update: 2013-04-23

--- a/postgis/Makefile.in
+++ b/postgis/Makefile.in
@@ -83,14 +83,8 @@ PG_OBJS= \
 OBJS=$(PG_OBJS)
 
 # Libraries to link into the module (proj, geos)
-#
-# Note: we specify liblwgeom.a directly in SHLIB_LINK rather than using
-# -L... -l options to prevent issues with some platforms trying to link
-# to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an
-# older version of PostGIS, rather than with the static liblwgeom.a 
-# supplied with newer versions of PostGIS
 PG_CPPFLAGS += -I../liblwgeom -I../libpgcommon @CPPFLAGS@ -fPIC
-SHLIB_LINK_F = ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a @SHLIB_LINK@
+SHLIB_LINK_F = -L../liblwgeom/.libs -llwgeom ../libpgcommon/libpgcommon.a @SHLIB_LINK@
 
 # Add SFCGAL Flags if defined
 ifeq (@SFCGAL@,sfcgal)
--- a/raster/rt_pg/Makefile.in
+++ b/raster/rt_pg/Makefile.in
@@ -38,14 +38,7 @@ SQL_OBJS=rtpostgis.sql rtpostgis_drop.sq
 OBJS=rt_pg.o
 
 # Libraries to link into the module (proj, geos)
-#
-# Note: we specify liblwgeom.a directly in SHLIB_LINK rather than using
-# -L... -l options to prevent issues with some platforms trying to link
-# to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an
-# older version of PostGIS, rather than with the static liblwgeom.a 
-# supplied with newer versions of PostGIS
-#
-LIBLWGEOM_LDFLAGS=../../liblwgeom/.libs/liblwgeom.a
+LIBLWGEOM_LDFLAGS=-L../../liblwgeom/.libs -llwgeom
 LIBLWGEOM_CFLAGS="-I../../liblwgeom"
 LIBPGCOMMON_CFLAGS="-I../../libpgcommon"
 LIBPGCOMMON_LDFLAGS=../../libpgcommon/libpgcommon.a
--- a/raster/loader/Makefile.in
+++ b/raster/loader/Makefile.in
@@ -37,7 +37,7 @@ PGSQL_BINDIR=@PGSQL_BINDIR@
 
 RT_CORE=../rt_core
 
-LIBLWGEOM_LDFLAGS=../../liblwgeom/liblwgeom.la
+LIBLWGEOM_LDFLAGS=-L../../liblwgeom/.libs -llwgeom
 LIBLWGEOM_CFLAGS=-I../../liblwgeom
 LIBGDAL_CFLAGS=@LIBGDAL_CFLAGS@
 LIBGDAL_LDFLAGS=@LIBGDAL_LDFLAGS@
