[postgis-devel] Re-organising the PostGIS codebase - to liblwgeom or not liblwgeom?

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed May 14 08:41:47 PDT 2008

Hi everyone,

I'm now finally at the point where I can commit a rough-ish first revision
of the new build system to SVN HEAD, so I wanted to give an update of
current progress before I go ahead and commit. The changes in my local
copy include the following:

- Autoconf build re-worked to generate a postgis_config.h header file
which can be included within the relevant files. By moving this logic out
of make and into the code itself, it means that we should be much closer
to using other build systems, e.g. MSVC.

- postgis_config.h variables have been renamed so that they are within a
PostGIS namespace


Additionally I have also added detected for PROJ.4 versions with a new

- The main .so file (as well as shp2pgsql/pgsql2shp) are now built with
PGXS which means we can remove the horribly hacked version of the
PostgreSQL build system current included with PostGIS. The resulting files
are much, much simpler to maintain and understand.

- configure options have been renamed to better reflect their values

	--with-pgsql -> --with-pgconfig
	--with-geos  -> --with-geosconfig
	--with-proj  -> --with-projdir

Autoconf tests have also been extended to make sure that header files
exist and library files can be linked during configure.

- Version testing

PostGIS will refuse to build with PostgreSQL < 8.1 (new restriction), or
GEOS < 2.2 (same as 1.3 branch)

I haven't really done much with the regression tests (as these are due to
be re-written in perl) but current status is that regression tests pass,
except for a minor failure in the new geoJSON code. It looks like a change
in ERROR message wording between versions, so there are no big concerns
from my point of view.

The other thing to point out is that my current SVN copy doesn't have any
JTS support included. Is this still being actively maintained, or has it
been deprecated due to reliability issues when compiling JTS with gcj?

The remaining items for the TODO list are:

- Sort out warnings

PostgreSQL PGXS makefiles set the -Wall parameter by default which show up
lots of compile warnings in the existing code. We should work through this
list so that they no longer appear.

- Testing (different OSs, platforms etc.)

- Decide whether to keep liblwgeom separation

- Sort out the documentation build system

I haven't reworked this with the new autoconf code yet, since there seem
to be two systems in place: jade and xsltproc. Can we pick just one and
use that? I'm leaning towards xsltproc since that seems to work well on
Win32, so please let me know if that won't work for you.

BTW if I commit with a broken documentation build Makefile, will this
break the auto-generated docs on postgis.refractions.net?

- Remove massive chunks of legacy code for PostgreSQL < 8.1

- Remove non-ST_ prefix functions from the code base

- Rewrite the regression test harness in Perl rather than bash

- Re-work the index code based on newer versions of PostgreSQL (the newer
code seems a lot more compact and less error-prone)

- Add an --enable-debug=X parameter to autoconf

Looking at the code, there seems to be good scope for unifying the debug
#ifdefs so that the overall verbosity level could be controlled at
./configure time. Currently I have to go through each file by hand and
uncomment the various debugging levels I need which can be a bit of a

Comments, questions, etc.? Anyone who is not happy for me to branch 1.3
and commit this to SVN HEAD, please speak up now...



Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
T: +44 870 608 0063

More information about the postgis-devel mailing list