Commit new build system based upon PGXS. Due to the large number of changes, please refer to http://postgis.refractions.net/pipermail/postgis-devel/2008-May/003010.html.

git-svn-id: http://svn.osgeo.org/postgis/trunk@2774 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Mark Cave-Ayland 2008-05-14 17:10:19 +00:00
parent db69c6e6cd
commit cee1f271e5
41 changed files with 1234 additions and 2021 deletions

View file

@ -5,16 +5,16 @@ How to release
Versioning Scheme
-----------------
Release version is composed by REL_MAJOR_VERSION, REL_MINOR_VERSION
and REL_MICRO_VERSION components.
Release version is composed by POSTGIS_MAJOR_VERSION, POSTGIS_MINOR_VERSION
and POSTGIS_MICRO_VERSION components.
By default only [REL_MICRO_VERSION] increments between releases.
By default only [POSTGIS_MICRO_VERSION] increments between releases.
[REL_MINOR_VERSION] is incremented (and MICRO set to 0) when minor
[POSTGIS_MINOR_VERSION] is incremented (and MICRO set to 0) when minor
additions have been introduced (one or two functions can be considered
*micro* additions)
[REL_MAJOR_VERSION] is incremented (and MICRO and MINOR set to 0) when
[POSTGIS_MAJOR_VERSION] is incremented (and MICRO and MINOR set to 0) when
a dump/reload of existing spatial databases is *REQUIRED* for things
to work or rather *HIGHLY RECOMMENDED* to get new functionalities.

View file

@ -1,167 +0,0 @@
#---------------------------------------------------------------
# Configuration Directives
#---------------------------------------------------------------
#
# We recommend that you install the Proj4 and GEOS libraries
# referenced below to get the most use out of your PostGIS
# database.
#
# Set USE_PROJ to 1 for Proj4 reprojection support (recommended)
#
# Reprojection allows you to transform coordinate systems
# in the database with the Transform() function.
#
# Download from: http://www.remotesensing.org/proj
#
USE_PROJ=@USE_PROJ@
PROJ_DIR=@PROJ_DIR@
PROJ_LIBDIR=@PROJ_LIBDIR@
#
# Set USE_GEOS to 1 for GEOS spatial predicate and operator
# support (recommended).
# GEOS installation directory defaults to /usr/local,
# set GEOS_DIR environment variable to change it.
#
# GEOS allows you to do exact topological tests, such as
# Intersects() and Touches(), as well as geometry operations,
# such as Buffer(), GeomUnion() and Difference().
#
# Download from: http://geos.refractions.net
#
# PostGIS >= 1.2.0 requires a CAPI GEOS (GEOS >= 2.2.0)
#
USE_GEOS=@USE_GEOS@
GEOS_DIR=@GEOS_DIR@
GEOS_LDFLAGS=@GEOS_LDFLAGS@
GEOS_VERNUM=@GEOS_VERNUM@
#
# Set USE_JTS to 1 if you have libjts installed.
#
USE_JTS=@USE_JTS@
JTS_INCLUDES=@JTS_INCLUDES@
JTS_LIBDIR=@JTS_LIBDIR@
#
# Set USE_STATS to 1 for new GiST statistics collection support
# Note that this support requires additional columns in
# GEOMETRY_COLUMNS, so see the list archives for info or
# install a fresh database using postgis.sql.
# This option is useless for builds against PGSQL>=80 (stats
# are always gathered in that case, and you don't need additional
# columns in geometry_columns).
#
USE_STATS=1
#
# Set AUTOCACHE_BBOX to 0 if you want finer control over
# bounding box computation and caching for your geometries.
# If you do, bbox computattion strategies are listed in
# the file lwgeom/BBOXCACHE_BEHAVIOURS, but don't expect
# them to be easy nor consistent.
#
AUTOCACHE_BBOX=1
#
# Set USE_ICONV to 1 if you want the loader (shp2pgsql)
# to support UTF-8 output.
#
USE_ICONV=@USE_ICONV@
ICONV_LDFLAGS=@ICONV_LDFLAGS@
#
# PGSQL
#
PGCONFIG=@PGCONFIG@
PGFEINCLUDES=@PGFEINCLUDES@
PGBEINCLUDES=@PGBEINCLUDES@
PGFELIBS=@PGFELIBS@
PGBELIBS=@PGBELIBS@
PORTNAME=@PORTNAME@
#
# Docbook
#
XSLBASE=@XSLBASE@
XSLTPROC=@XSLTPROC@
PDFXMLTEX=@PDFXMLTEX@
DB2PDF=@DB2PDF@
JW=@JW@
DOC_RULE=@DOC_RULE@
#
# Compilers
#
CC=@CC@
CXX=@CXX@
ELF_SYSTEM=@ELF_SYS@
#
# Other programs
#
PERL=@PERL@
FLEX=@FLEX@
YACC=@YACC@
LN_S=@LN_S@
INSTALL=@INSTALL@ -c
PWDREGRESS=@PWDREGRESS@
INSTALL_DATA=$(INSTALL) -m 644
INSTALL_BIN=$(INSTALL) -m 755
INSTALL_LIB=$(INSTALL) -m 755
INSTALL_SHLIB=$(INSTALL_LIB)
#
# PATHS
#
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
datadir=@datadir@
mandir=@mandir@
docdir=@docdir@
libexecdir=@libexecdir@
libdir=@libdir@
LPATH=@LPATH@
#
# DLL
#
DLSUFFIX=@DLSUFFIX@
DLFLAGS=@DLFLAGS@
# these are for win32 and cygwin platforms
DLLTOOL=@DLLTOOL@
DLLWRAP=@DLLWRAP@
#
# EXE
#
EXE=@EXE@
#
# HOST OS
#
HOST_OS=@HOST_OS@
#---------------------------------------------------------------
# END OF CONFIGURATION
#---------------------------------------------------------------
# Use JTS instead of GEOS if available
ifeq ($(USE_JTS),1)
USE_GEOS=0
endif
#---------------------------------------------------------------
# Test the version string and set the USE_VERSION macro
# appropriately. eg:
#
# pg_config --version => PostgreSQL 8.3.1
#
PG_VERSION_MAJOR=$(shell $(PGCONFIG) --version | cut -f2 -d' ' | cut -f1 -d.)
PG_VERSION_MINOR=$(shell $(PGCONFIG) --version | cut -f2 -d' ' | cut -f2 -d.)
USE_VERSION=$(PG_VERSION_MAJOR)$(PG_VERSION_MINOR)

View file

@ -3,7 +3,7 @@
# See HOWTO_RELEASE file in SVN for definitions of those three.
REL_MAJOR_VERSION=1
REL_MINOR_VERSION=3
REL_MICRO_VERSION=4SVN
POSTGIS_MAJOR_VERSION=1
POSTGIS_MINOR_VERSION=4
POSTGIS_MICRO_VERSION=0

View file

@ -1,2 +1,3 @@
#!/bin/sh
aclocal -I macros
autoconf

View file

@ -1,3 +0,0 @@
#undef HAVE_ICONV_H
#undef USE_GEOS
#undef USE_JTS

View file

@ -1,625 +1,249 @@
AC_INIT(README.postgis)
AC_CONFIG_HEADER(config.h)
dnl
dnl PostGIS build system
dnl
dnl Written by Mark Cave-Ayland
dnl
dnl AC_ARG_ENABLE(autoconf, [ --enable-autoconf really use autoconf],
dnl AC_MSG_RESULT(Using autoconf),
dnl AC_MSG_ERROR([
dnl
dnl Autoconf-based configuration is not widely tested.
dnl If you want to use it anyway specify --enable-autoconf.
dnl ])
dnl )
AC_INIT()
AC_CONFIG_HEADERS([postgis_config.h])
dnl
dnl Compilers
dnl
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_LN_S
dnl
dnl iconv support (might fail in case of non-default iconv installation)
dnl Version Information imported from Version.config
dnl
AC_SUBST(USE_ICONV)
AC_SUBST(ICONV_LDFLAGS)
ICONV_LDFLAGS=
USE_ICONV=1
AC_ARG_WITH(iconv,
[ --without-iconv disable unicode support],
if test "$with_iconv" = "no"; then
USE_ICONV=0
fi
)
if test "$USE_ICONV" = 1; then
AC_CHECK_LIB(iconv, iconv_open,
USE_ICONV=1
ICONV_LDFLAGS=-liconv
,
AC_CHECK_LIB(iconv, libiconv_open,
USE_ICONV=1
ICONV_LDFLAGS=-liconv
,
AC_CHECK_LIB(c, iconv_open,
USE_ICONV=1
,
USE_ICONV=0
)
)
)
fi
AC_CHECK_HEADERS(iconv.h)
POSTGIS_MAJOR_VERSION=`cat Version.config | grep POSTGIS_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
POSTGIS_MINOR_VERSION=`cat Version.config | grep POSTGIS_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
POSTGIS_MICRO_VERSION=`cat Version.config | grep POSTGIS_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
dnl
dnl host operating system
dnl Detect the version of PostgreSQL installed on the system
dnl
AC_CANONICAL_HOST
dnl
dnl Search for pg_config and setup pgsql stuff
dnl
AC_SUBST(PGCONFIG)
PGCONFIG=
AC_ARG_WITH(pgsql,
[ --with-pgsql[[=ARG]] build for a specific pgsql version
[[ARG=path to pg_config]]],
if test "$with_pgsql" != "no" -a "$with_pgsql" != "yes"; then
if test ! -f "$with_pgsql"; then
AC_MSG_ERROR([Invalid argument to --with-pgsql]);
fi
PGCONFIG="$with_pgsql"
fi
)
if test -z "$PGCONFIG"; then
AC_ARG_WITH([pgconfig], [Specify the path to an alternative pg_config], [PGCONFIG="$withval"], [PGCONFIG=""])
if test "x$PGCONFIG" = "x"; then
dnl PGCONFIG was not specified, so search within the current path
AC_PATH_PROG([PGCONFIG], [pg_config])
fi
if test -z "$PGCONFIG"; then
AC_MSG_ERROR([PostgreSQL is required by PostGIS]);
fi
AC_SUBST(PGFEINCLUDES)
AC_SUBST(PGBEINCLUDES)
AC_SUBST(PGFELIBS)
AC_SUBST(PGBELIBS)
AC_SUBST(PGBIN)
AC_SUBST(PGTEMPLATE)
AC_SUBST(LPATH)
PGFEINCLUDES="-I"`${PGCONFIG} --includedir`
PGFELIBS="-L"`${PGCONFIG} --libdir`" -lpq " #(1)# `${PGCONFIG} --libs 2> /dev/null`
#(1)#
# We don't really want to link to more libs then required, see:
# http://postgis.refractions.net/pipermail/postgis-devel/2006-May/002124.html
PGBELIBS="-L"`${PGCONFIG} --libdir`" -lpostgres"
PGBEINCLUDES="-I"`${PGCONFIG} --includedir-server`
PGBIN=`${PGCONFIG} --bindir`
dnl
dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
dnl for in-place regression tests
dnl
case $host_os in
*mingw*)
PWDREGRESS="pwd -W"
;;
*)
PWDREGRESS="pwd"
;;
esac
AC_SUBST(PWDREGRESS)
dnl
dnl Test for GEOS
dnl
AC_SUBST(USE_GEOS)
AC_SUBST(GEOS_DIR)
AC_SUBST(GEOS_LDFLAGS)
AC_SUBST(GEOS_VERNUM)
USE_GEOS=0
GEOS_DIR=
GEOS_LDFLAGS=
GEOS_VERNUM=10
AC_PATH_PROG([GEOSCONFIG], [geos-config])
if test -n "$GEOSCONFIG"; then
USE_GEOS=1
fi
AC_ARG_WITH(geos,
[ --with-geos[[=ARG]] enable spatial predicates and operators using GEOS
[[ARG=path to geos-config]]],
if test "$with_geos" = "no"; then
USE_GEOS=0
else
if test "$with_geos" != "yes"; then
if test ! -f "$with_geos"; then
AC_MSG_ERROR([Invalid argument to --with-geos]);
else
GEOSCONFIG="$with_geos"
USE_GEOS=1
AC_MSG_RESULT([Using specified geos-config file: $GEOSCONFIG])
fi
fi
dnl If we couldn't find pg_config, display an error
if test "x$PGCONFIG" = "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-pgconfig parameter.])
fi
)
if test $USE_GEOS -gt 0; then
GEOS_DIR=`$GEOSCONFIG --prefix`
GEOS_LDFLAGS=`$GEOSCONFIG --ldflags 2> /dev/null`
if test x"$GEOS_LDFLAGS" = "x"; then
# older geos-config versions did not
# support the --ldflags switch, we'll
# default to GEOS_DIR/lib in this case.
#
GEOS_LDFLAGS="-L${GEOS_DIR}/lib"
fi
GEOS_MAJOR=`$GEOSCONFIG --version | cut -d. -f1`
GEOS_MINOR=`$GEOSCONFIG --version | cut -d. -f2`
GEOS_VERNUM=`expr $GEOS_MAJOR "*" 10`
GEOS_VERNUM=`expr $GEOS_VERNUM "+" $GEOS_MINOR`
# GEOS >= 3.0.0 always has CAPI, however only GEOS >= 2.2.0 has CAPI support
# so abort if CAPI support is not available.
if test $GEOS_VERNUM -lt 22; then
AC_MSG_ERROR([PostGIS version >= 1.2.0 requires GEOS version >= 2.2.0])
fi
fi
AC_SUBST(USE_PROJ)
AC_SUBST(PROJ_DIR)
AC_SUBST(PROJ_LIBDIR)
USE_PROJ=0
PROJ_DIR=
PROJ_LIBDIR=
AC_PATH_PROG([PROJ], [proj])
if test -n "$PROJ"; then
USE_PROJ=1
PROJ_DIR=`dirname ${PROJ}`/..
owd=`pwd`; cd ${PROJ_DIR}; PROJ_DIR=`pwd`; cd $owd;
fi
AC_ARG_WITH(proj,
[ --with-proj[[=DIR]] enable reprojection support],
if test "$with_proj" = "no"; then
USE_PROJ=0
else
USE_PROJ=1
if test "$with_proj" != "yes"; then
PROJ_DIR=$with_proj
fi
fi
)
if test $USE_PROJ -gt 0; then
if test ! -f $PROJ_DIR/include/projects.h; then
AC_MSG_ERROR([Can't find proj dir.]);
fi
PROJ_LIBDIR=${PROJ_DIR}/lib
fi
AC_ARG_WITH(proj-libdir,
[ --with-proj-libdir=PATH path to PROJ4 libdir],
[
case "$with_proj_libdir" in
no|yes)
AC_MSG_ERROR([Invalid argument to --with-proj-libdir])
;;
*)
PROJ_LIBDIR=${with_proj_libdir}
;;
esac
], with_proj_libdir=no)
AC_SUBST(USE_JTS)
AC_SUBST(JTS_INCLUDES)
AC_SUBST(JTS_LIBDIR)
USE_JTS=0
JTS_INCLUDES=
JTS_INCLUDES=
AC_ARG_WITH(jts,
[ --with-jts[[=ARG]] use JTS for spatial predicates and operators
[[ARG=path to jts-config]]],
if test "$with_jts" != "no"; then
USE_JTS=1
if test "$with_jts" != "yes"; then
if test ! -f "$with_jts"; then
AC_MSG_ERROR([Invalid argument to --with-jts]);
else
JTSCONFIG=$with_jts
fi
fi
fi
)
if test $USE_JTS -gt 0; then
if test -z "$JTSCONFIG"; then
AC_PATH_PROG([JTSCONFIG], [jts-config])
if test -z "$JTSCONFIG"; then
AC_MSG_ERROR([Can't find jts-config]);
fi
fi
JTS_INCLUDES=`$JTSCONFIG --includedir`
JTS_LIBDIR=`$JTSCONFIG --libdir`
fi
dnl
dnl Search flex and yacc
dnl
AC_SUBST(FLEX)
AC_PATH_PROG([FLEX], [flex])
if test -z "$FLEX"; then
AC_MSG_ERROR(Can't find 'flex');
fi
AC_SUBST(DLLWRAP)
AC_PATH_PROG([DLLWRAP], [dllwrap])
AC_SUBST(DLLTOOL)
AC_PATH_PROG([DLLTOOL], [dlltool])
dnl AC_SUBST(YACC)
dnl AC_PATH_PROG([YACC], [yacc])
AC_PROG_YACC
if test -z "$YACC"; then
AC_MSG_ERROR(Can't find 'yacc');
fi
dnl
dnl Find 'install'
dnl
dnl AC_PATH_PROG([INSTALL], [install])
dnl if test -z "$INSTALL"; then
dnl AC_MSG_ERROR(Can't find 'install');
dnl fi
AC_SUBST(INSTALL)
INSTALL=`pwd`"/install-sh"
dnl
dnl Search perl
dnl
AC_SUBST(PERL)
AC_PATH_PROG([PERL], [perl])
if test -z "$PERL"; then
AC_MSG_ERROR(Can't find 'perl');
fi
AC_SUBST(docdir)
docdir='${prefix}/share/doc'
AC_ARG_WITH(docdir,
[ --with-docdir=DIR install the documentation in DIR [[PREFIX/share/doc]]],
if test "$with_docdir" = "yes"; then
AC_MSG_ERROR([option --with-docdir requires an argument])
fi
if test "$with_docdir" != "no"; then
docdir="$with_docdir"
fi
)
dnl
dnl Find 'html/docbook.xsl'
dnl
AC_SUBST(XSLBASE)
XSLBASE=
AC_ARG_WITH(xsl,
[ --with-xsl=DIR Specify the DIR containing html/docbook.xsl stylesheet],
if test "$with_xsl" = yes; then
AC_MSG_ERROR([option --with-xsl requires an argument])
fi
if test "$with_xsl" != "no"; then
xsl="$with_xsl"
fi
,
SEARCHPATH="
/usr/share/sgml/docbook/xsl-stylesheets
/usr/share/xml/docbook/stylesheet/nwalsh
/usr/share/sgml/docbook/stylesheet/xsl/nwalsh
"
for p in ${SEARCHPATH}; do
if test -r "${p}"/html/docbook.xsl; then
xsl="${p}"
break
fi
done
)
XSLBASE="${xsl}"
dnl
dnl Search for other binaries needed to build docs
dnl
AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_PATH_PROG([PDFXMLTEX], [pdfxmltex])
AC_PATH_PROG([DB2PDF], [db2pdf])
AC_PATH_PROG([JW], [jw])
AC_SUBST(XSLTPROC)
AC_SUBST(PDFXMLTEX)
AC_SUBST(JW)
DOC_RULE=requirements_not_met
if test -n "${XSLBASE}"; then
if test -n "${XSLTPROC}"; then
DOC_RULE=html/postgis.html
else
if test -n "${JW}"; then
DOC_RULE=jw
fi
fi
fi
AC_SUBST(DOC_RULE)
if test $USE_JTS -gt 0; then
dnl AC_MSG_RESULT([ GEOS disabled, using JTS.])
USE_GEOS=0
AC_DEFINE(USE_JTS)
fi
if test $USE_GEOS -gt 0; then
AC_DEFINE(USE_GEOS)
fi
#
# Extract PostgreSQL paths from pg_config
##
#
# Prefix (pg_prefix)
#
pg_prefix=/usr/local/pgsql
pg_eprefix=
pg_docdir=
pg_datadir=
pg_mandir=
pg_bindir="`${PGCONFIG} --bindir`"
pg_pkglibdir="`${PGCONFIG} --pkglibdir`"
for v in `${PGCONFIG} --configure`; do
strip=`echo $v | sed "s/'//g"`
var=`echo "$strip" | cut -d= -f1`
if test "$var" = "--prefix"; then
pg_prefix=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--exec-prefix"; then
pg_eprefix=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--docdir"; then
pg_docdir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--with-docdir"; then
pg_docdir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--datadir"; then
pg_datadir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--mandir"; then
pg_mandir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--with-template"; then
PGTEMPLATE=`echo "$strip" | cut -d= -f2`
fi
done
#
# We set these defaults after scan of
# pg_config --configure to safely expand pg_prefix
# We need expansion for the 'postgresq' path component
# addition below (default paths take from pg_config)
#
if test -z "$pg_eprefix"; then pg_eprefix=${pg_prefix}; fi
if test -z "$pg_docdir"; then pg_docdir=${pg_prefix}'/doc'; fi
if test -z "$pg_datadir"; then pg_datadir=${pg_prefix}'/share'; fi
if test -z "$pg_mandir"; then pg_mandir=${pg_prefix}'/man'; fi
# Use old layout by default
use_new_layout=0
if test "$prefix" != 'NONE'; then
use_new_layout=1
fi
if test "${use_new_layout}" = "1"; then
LPATH=$libdir
else
#
# Use old layout: everything under PGSQL paths
# Note: still allow override by user, this is
# done checking each variable against its
# default value, if it has a different
# value do not use PGSQL versions
#
if test "$prefix" = 'NONE'; then
prefix=${pg_prefix}
fi
if test "$docdir" = '${prefix}/share/doc'; then
docdir=${pg_docdir}
#
# If docdir contains no 'pgsql' or 'postgres'
# add the suffix. This is derived from
# PGSQL_SRC/src/Makefile.global
#
if expr "${docdir}" : ".*/pgsql" > /dev/null ; then :; else
if expr "${docdir}" : ".*/postgres" > /dev/null ; then :; else
docdir=${docdir}"/postgresql"
fi
fi
# Add the "contrib" part
docdir=${docdir}"/contrib"
fi
if test "$datadir" = '${prefix}/share'; then
datadir=${pg_datadir}
#
# If datadir contains no 'pgsql' or 'postgres'
# add the suffix. This is derived from
# PGSQL_SRC/src/Makefile.global
#
if expr "${datadir}" : ".*/pgsql" > /dev/null ; then :; else
if expr "${datadir}" : ".*/postgres" > /dev/null ; then :; else
datadir=${datadir}"/postgresql"
fi
fi
# Add the "contrib" part
datadir=${datadir}"/contrib"
fi
if test "$mandir" = '${prefix}/man'; then
mandir=${pg_mandir}
fi
if test "$bindir" = '${exec_prefix}/bin'; then
bindir=${pg_bindir}
fi
if test "$libdir" = '${exec_prefix}/lib'; then
libdir=${pg_pkglibdir}
LPATH='\$$libdir'
dnl PGCONFIG was specified; display a message to the user
if test "x$PGCONFIG" = "xyes"; then
AC_MSG_ERROR([you must specify a parameter to --with-pgconfig, e.g. --with-pgconfig=/path/to/pg_config])
else
LPATH=$libdir
if test -f $PGCONFIG; then
AC_MSG_RESULT([Using user-specified pg_config file: $PGCONFIG])
else
AC_MSG_ERROR([the user-specified pg_config file $PGCONFIG does not exist])
fi
fi
fi
# --with-template parsing is done in the single
# pg_config --configure scan above
AC_MSG_CHECKING([which template to use])
template=$PGTEMPLATE
dnl Extract the version information from pg_config
dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
dnl the final version. This is to guard against user error...
PGSQL_MAJOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
case $host_os in
aix*) template=aix ;;
beos*) template=beos ;;
bsdi*) template=bsdi ;;
cygwin*) template=cygwin ;;
darwin*) template=darwin ;;
dgux*) template=dgux ;;
freebsd*) template=freebsd ;;
hpux*) template=hpux ;;
irix*) template=irix ;;
linux*|gnu*|k*bsd*-gnu)
template=linux ;;
mingw*) template=win32 ;;
netbsd*) template=netbsd ;;
nextstep*) template=nextstep ;;
openbsd*) template=openbsd ;;
osf*) template=osf ;;
qnx*) template=qnx4 ;;
sco*) template=sco ;;
solaris*) template=solaris ;;
sunos*) template=sunos4 ;;
sysv4.2*)
case $host_vendor in
univel) template=univel ;;
esac ;;
sysv4*) template=svr4 ;;
sysv5*) template=unixware ;;
ultrix*) template=ultrix4 ;;
esac
if test x"$template" = x"" ; then
AC_MSG_ERROR([[
*******************************************************************
PostgreSQL has apparently not been ported to your platform yet.
To try a manual configuration, look into the src/template directory
for a similar platform and use the '--with-template=' option.
Please also contact <pgsql-ports@postgresql.org> to see about
rectifying this. Include the above 'checking host system type...'
line.
*******************************************************************
]])
fi
AC_MSG_RESULT([$template])
PORTNAME=$template
AC_SUBST(PORTNAME)
#
# OS-specific settings
#
AC_SUBST(DLSUFFIX)
AC_SUBST(DLFLAGS)
AC_SUBST(EXE)
AC_SUBST(HOST_OS)
# host_os is defined by AC_CANONICAL_HOST
HOST_OS=$host_os
DLSUFFIX=.so
DLFLAGS=-shared
EXE=
case $host_os in
*mingw*)
PGBEINCLUDES="$PGBEINCLUDES $PGBEINCLUDES/port/win32"
DLSUFFIX=.dll
DLFLAGS='${PGBELIBS}'
EXE=.exe
;;
*darwin*)
DLFLAGS="-no-cpp-precomp -flat_namespace -undefined suppress -multiply_defined suppress"
;;
esac
# Assume system is ELF if it predefines __ELF__ as 1,
# otherwise believe host_os based default.
case $host_os in
freebsd1*|freebsd2*) elf=no;;
freebsd3*|freebsd4*) elf=yes;;
esac
AC_EGREP_CPP(yes,
[#if __ELF__
yes
#endif
],
[ELF_SYS=true],
[if test "X$elf" = "Xyes" ; then
ELF_SYS=true
dnl Ensure that we are using PostgreSQL >= 8.1
if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.1])
else
ELF_SYS=
fi])
AC_SUBST(ELF_SYS)
if test "$PGSQL_MAJOR_VERSION" -eq 8; then
if test ! "$PGSQL_MINOR_VERSION" -ge 1; then
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.1])
fi
fi
fi
dnl Note: We don't need the server-side LDFLAGS or CPPFLAGS because we get these from PGXS
dnl Extract the linker and include flags for the frontend (for programs that use libpq)
PGSQL_FE_LDFLAGS=-L`$PGCONFIG --libdir`
PGSQL_FE_CPPFLAGS=-I`$PGCONFIG --includedir`
AC_SUBST([PGSQL_FE_LDFLAGS])
AC_SUBST([PGSQL_FE_CPPFLAGS])
dnl Ensure that we can parse libpq-fe.h
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$PGSQL_FE_CPPFLAGS"
AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([could not find libpq-fe.h])])
CPPFLAGS="$CPPFLAGS_SAVE"
AC_OUTPUT(Makefile.config)
dnl Ensure we can link against libpq
LIBS_SAVE="$LIBS"
LIBS="$PGSQL_FE_LDFLAGS"
AC_CHECK_LIB([pq], [PQserverVersion],
[],
[AC_MSG_ERROR([could not find libpq])],
[])
LIBS="$LIBS_SAVE"
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ SUMMARY])
AC_MSG_RESULT([ -------------------------------------------------------])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ HOST_OS: $host_os])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ PGSQL: $PGCONFIG])
AC_DEFINE_UNQUOTED([POSTGIS_PGSQL_VERSION], [$POSTGIS_PGSQL_VERSION], [PostgreSQL server version])
AC_SUBST([POSTGIS_PGSQL_VERSION])
if test $USE_JTS -gt 0; then
AC_MSG_RESULT([ JTS: includedir=$JTS_INCLUDES libdir=$JTS_LIBDIR])
fi
# GEOS CAPI information
if test $USE_GEOS -gt 0; then
AC_MSG_RESULT([ GEOS: $GEOSCONFIG (with C-API)])
AC_MSG_RESULT([ (ldflags: $GEOS_LDFLAGS)])
fi
dnl
dnl Detect the version of GEOS installed on the system
dnl
# PROJ.4 information
if test $USE_PROJ -gt 0; then
AC_MSG_RESULT([ PROJ: prefix=$PROJ_DIR libdir=$PROJ_LIBDIR])
fi
AC_ARG_WITH([geosconfig], [Specify the path to an alternative geos-config], [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
if test "x$GEOSCONFIG" = "x"; then
dnl GEOSCONFIG was not specified, so search within the current path
AC_PATH_PROG([GEOSCONFIG], [geos-config])
AC_MSG_RESULT([ ICONV: $USE_ICONV $ICONV_LDFLAGS])
dnl AC_MSG_RESULT([ FLEX: path=$FLEX])
dnl AC_MSG_RESULT([ YACC: path=$YACC])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ PORTNAME: $PORTNAME])
AC_MSG_RESULT([ PREFIX: $prefix])
AC_MSG_RESULT([ EPREFIX: $exec_prefix])
AC_MSG_RESULT([ DOC: $docdir])
AC_MSG_RESULT([ DATA: $datadir])
AC_MSG_RESULT([ MAN: $mandir])
AC_MSG_RESULT([ BIN: $bindir])
if test "$MODULE_INSTALLDIR" = "$LPATH"; then
AC_MSG_RESULT([ EXT: $libdir])
dnl If we couldn't find geos-config, display an error
if test "x$GEOSCONFIG" = "x"; then
AC_MSG_ERROR([could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.])
fi
else
AC_MSG_RESULT([ EXT: $libdir ($LPATH)])
dnl GEOSCONFIG was specified; display a message to the user
if test "x$GEOSCONFIG" = "xyes"; then
AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
else
if test -f $GEOSCONFIG; then
AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
else
AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
fi
fi
fi
AC_MSG_RESULT([ -------------------------------------------------------])
AC_MSG_RESULT([ ])
dnl Extract the version information from pg_config
dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
dnl the final version. This is to guard against user error...
GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
dnl Ensure that we are using GEOS >= 2.2.0 (requires CAPI)
if test ! "$GEOS_MAJOR_VERSION" -ge 2; then
AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
else
if test "$GEOS_MAJOR_VERSION" -eq 2; then
if test ! "$GEOS_MINOR_VERSION" -ge 2; then
AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
fi
fi
fi
dnl Extract the linker and include flags
GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
dnl Ensure that we can parse geos_c.h
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$GEOS_CPPFLAGS"
AC_CHECK_HEADER([geos_c.h], [], [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])])
CPPFLAGS="$CPPFLAGS_SAVE"
dnl Ensure we can link against libgeos_c
LIBS_SAVE="$LIBS"
LIBS="$GEOS_LDFLAGS"
AC_CHECK_LIB([geos_c], [initGEOS],
[],
[AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig])],
[])
LIBS="$LIBS_SAVE"
AC_DEFINE_UNQUOTED([POSTGIS_GEOS_VERSION], [$POSTGIS_GEOS_VERSION], [GEOS library version])
AC_SUBST([POSTGIS_GEOS_VERSION])
dnl
dnl Detect the version of PROJ.4 installed
dnl
AC_ARG_WITH([projdir], [Specify the directory to an alternative PROJ installation], [PROJDIR="$withval"], [PROJDIR=""])
if test ! "x$PROJDIR" = "x"; then
dnl Make sure that the directory exists
if test "x$PROJDIR" = "xyes"; then
AC_MSG_ERROR([you must specifiy a parameter to --with-projdir, e.g. --with-projdir=/path/to])
else
if test -d "$PROJDIR"; then
AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
dnl Add the include directory to PROJ_CPPFLAGS
PROJ_CPPFLAGS="-I$PROJDIR/include"
PROJ_LDFLAGS="-L$PROJDIR/lib"
else
AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
fi
fi
fi
dnl Check that we can find the proj_api.h header file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$PROJ_CPPFLAGS"
AC_CHECK_HEADER([proj_api.h], [], [AC_MSG_ERROR([could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir])])
dnl Return the PROJ.4 version number
AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
AC_SUBST([POSTGIS_PROJ_VERSION])
CPPFLAGS="$CPPFLAGS_SAVE"
dnl Ensure we can link against libproj
LIBS_SAVE="$LIBS"
LIBS="$PROJ_LDFLAGS"
AC_CHECK_LIB([proj], [pj_get_release],
[],
[AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
[])
LIBS="$LIBS_SAVE"
dnl
dnl Define version macros
dnl
POSTGIS_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION USE_GEOS=1 USE_PROJ=1 USE_STATS=1"
POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION"
POSTGIS_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
POSTGIS_SCRIPTS_VERSION="$POSTGIS_LIB_VERSION"
AC_DEFINE_UNQUOTED([POSTGIS_VERSION], ["$POSTGIS_VERSION"], [PostGIS version])
AC_DEFINE_UNQUOTED([POSTGIS_LIB_VERSION], ["$POSTGIS_LIB_VERSION"], [PostGIS library version])
AC_DEFINE_UNQUOTED([POSTGIS_BUILD_DATE], ["$POSTGIS_BUILD_DATE"], [PostGIS build date])
AC_DEFINE_UNQUOTED([POSTGIS_SCRIPTS_VERSION], ["$POSTGIS_SCRIPTS_VERSION"], [PostGIS scripts version])
AC_SUBST([POSTGIS_VERSION])
AC_SUBST([POSTGIS_LIB_VERSION])
AC_SUBST([POSTGIS_BUILD_DATE])
AC_SUBST([POSTGIS_SCRIPTS_VERSION])
dnl
dnl Other parameters
dnl
dnl Always enable BBOX caching by default
AC_DEFINE_UNQUOTED([POSTGIS_AUTOCACHE_BBOX], [1], [Enable caching of bounding box within geometries])
dnl Always enable use of ANALYZE statistics by default
AC_DEFINE_UNQUOTED([POSTGIS_USE_STATS], [1], [Enable use of ANALYZE statistics])
CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS"
dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj"
AC_SUBST([SHLIB_LINK])
dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
dnl Output the relevant files
AC_OUTPUT([lwgeom/Makefile lwgeom/sqldefines.h loader/Makefile.pgsql2shp regress/Makefile])

View file

@ -1,44 +1,9 @@
include ../Makefile.config
# Version handling:
include ../Version.config
POSTGIS_VERSION = $(REL_MAJOR_VERSION).$(REL_MINOR_VERSION).$(REL_MICRO_VERSION)
#
# PostGIS Loader Makefile
# PostGIS PGXS build system
#
OBJS = shpopen.o dbfopen.o getopt.o
#---------------------------------------------------------------
ifeq ($(USE_ICONV),1)
override CFLAGS += -DUSE_ICONV
override LDFLAGS += $(ICONV_LDFLAGS)
endif
override CFLAGS := -g -Wall -I.. $(CFLAGS) -DUSE_VERSION=$(USE_VERSION) -DPOSTGIS_VERSION='"$(POSTGIS_VERSION)"'
all: shp2pgsql$(EXE) pgsql2shp$(EXE)
pgsql2shp.o: pgsql2shp.c
$(CC) $(CFLAGS) $(PGFEINCLUDES) -c $<
pgsql2shp$(EXE): $(OBJS) pgsql2shp.o PQunescapeBytea.o
$(CC) $(CFLAGS) $(OBJS) PQunescapeBytea.o pgsql2shp.o $(LDFLAGS) $(PGFELIBS) -o $@
shp2pgsql$(EXE): $(OBJS) shp2pgsql.o
$(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@
install: all
@mkdir -p $(DESTDIR)$(bindir)
$(INSTALL_BIN) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
$(INSTALL_BIN) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
uninstall:
rm -f $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
rm -f $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
clean:
rm -f $(OBJS) shp2pgsql.o pgsql2shp.o PQunescapeBytea.o shp2pgsql$(EXE) pgsql2shp$(EXE)
all:
%:
make -f Makefile.shp2pgsql $@
make -f Makefile.pgsql2shp $@

View file

@ -0,0 +1,22 @@
#
# PostGIS PGXS build system
#
PROGRAM=pgsql2shp
# List of objects to build
OBJS= shpopen.o \
dbfopen.o \
getopt.o \
pgsql2shp.o \
PQunescapeBytea.o
# Link against libpq
PG_CPPFLAGS=@PGSQL_FE_CPPFLAGS@
PG_LIBS=@PGSQL_FE_LDFLAGS@ -lpq
# PGXS information
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

16
loader/Makefile.shp2pgsql Normal file
View file

@ -0,0 +1,16 @@
#
# PostGIS PGXS build system
#
PROGRAM=shp2pgsql
# List of objects to build
OBJS= shpopen.o \
dbfopen.o \
getopt.o \
shp2pgsql.o
# PGXS information
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

View file

@ -21,6 +21,8 @@
static char rcsid[] =
"$Id$";
#include "../postgis_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -22,7 +22,7 @@
*
**********************************************************************/
#include "../config.h"
#include "../postgis_config.h"
#include "shapefil.h"
#include <stdio.h>
#include <string.h>

View file

@ -1,172 +1,87 @@
# Configuration Directives
include ../Makefile.config
include ../Version.config
#---------------------------------------------------------------
# Default missing CXX variable to c++
#
ifndef $(CXX)
CXX = c++
endif
#---------------------------------------------------------------
# Shared library parameters.
#
NAME=lwgeom
SHLIB_LINK = $(DLFLAGS)
#---------------------------------------------------------------
# Postgis version and build date
#---------------------------------------------------------------
POSTGIS_VERSION = $(REL_MAJOR_VERSION).$(REL_MINOR_VERSION) USE_GEOS=$(USE_GEOS) USE_PROJ=$(USE_PROJ) USE_STATS=$(USE_STATS)
POSTGIS_LIB_VERSION = $(REL_MAJOR_VERSION).$(REL_MINOR_VERSION).$(REL_MICRO_VERSION)
POSTGIS_BUILD_DATE := $(shell date -u "+%Y-%m-%d %H:%M:%S")
SCRIPTS_VERSION=$(POSTGIS_LIB_VERSION)
SQL_FLAGS = -DUSE_VERSION=$(USE_VERSION)
#---------------------------------------------------------------
CSTAR_FLAGS = -Wall -g -O2 -fPIC -fexceptions
override CFLAGS += -DUSE_VERSION=$(USE_VERSION)
override CFLAGS += -DPOSTGIS_LIB_VERSION='"$(POSTGIS_LIB_VERSION)"'
override CFLAGS += -DPOSTGIS_VERSION='"$(POSTGIS_VERSION)"'
override CFLAGS += -DPOSTGIS_SCRIPTS_VERSION='"$(SCRIPTS_VERSION)"'
override CFLAGS += -DPOSTGIS_BUILD_DATE='"$(POSTGIS_BUILD_DATE)"'
JTS_OBJ=lwgeom_nojts.o
ifeq ($(USE_GEOS),1)
CSTAR_FLAGS += -DUSE_GEOS
CSTAR_FLAGS += -DGEOS_VERNUM=$(GEOS_VERNUM)
SQL_FLAGS += -DUSE_GEOS -DGEOS_VERNUM=$(GEOS_VERNUM)
GEOS_RULES=
CSTAR_FLAGS += -I$(GEOS_DIR)/include
GEOS_WRAPPER=
JTS_OBJ=lwgeom_geos_c.o
SHLIB_LINK += $(GEOS_LDFLAGS) -lgeos_c
endif
ifeq ($(USE_JTS),1)
CXXFLAGS += -I$(JTS_INCLUDES)
CSTAR_FLAGS += -DUSE_JTS
SQL_FLAGS += -DUSE_JTS
JTS_WRAPPER=lwgeom_jts_wrapper.o
JTS_OBJ=lwgeom_jts.o
SHLIB_LINK += -lgcj -ljts -lstdc++ -L$(JTS_LIBDIR)
endif
ifeq ($(USE_PROJ),1)
override CFLAGS += -I$(PROJ_DIR)/include -DUSE_PROJ
SHLIB_LINK += -L$(PROJ_LIBDIR) -lproj
SQL_FLAGS += -DUSE_PROJ
endif
override CFLAGS += $(PGBEINCLUDES) -DAUTOCACHE_BBOX=$(AUTOCACHE_BBOX)
# memory debug for gcc 2.91, 2.95, 3.0 and 3.1
# for gcc >= 3.2.2 set GLIBCPP_FORCE_NEW at runtime instead
#override CXXFLAGS += -D__USE_MALLOC
#---------------------------------------------------------------
# Add index selectivity to C flags
# PostGIS PGXS build system
#
ifeq ($(USE_STATS),1)
override CFLAGS += -DUSE_STATS
endif
override CFLAGS += $(CSTAR_FLAGS)
override CXXFLAGS += $(CSTAR_FLAGS)
SA_OBJS=measures.o box2d.o ptarray.o lwgeom_api.o lwgeom.o lwpoint.o lwline.o lwpoly.o lwmpoint.o lwmline.o lwmpoly.o lwcollection.o $(GEOS_WRAPPER) $(JTS_WRAPPER) wktunparse.o lwgparse.o wktparse.tab.o lex.yy.o vsprintf.o
OBJS=$(SA_OBJS) liblwgeom.o lwgeom_pg.o lwgeom_debug.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o $(JTS_OBJ) lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o stringBuffer.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_svg.o lwgeom_gml.o lwgeom_kml.o lwgeom_geojson.o lwgeom_triggers.o lwgeom_dump.o lwgeom_functions_lrs.o long_xact.o lwcurve.o lwcompound.o lwcurvepoly.o lwmcurve.o lwmsurface.o lwgeom_sqlmm.o lwgeom_rtree.o
#OTHERS=y.output lex.yy.c wktparse.tab.c wktparse.tab.h lwpostgis.sql
OTHERS=y.output postgis_geos_version.h
all: $(GEOS_RULES) ../lwpostgis.sql ../regress/lwpostgis.sql ../lwpostgis_upgrade.sql all-shared-lib
enable_shared=yes
include Makefile.shlib
MODULE_FILENAME = $(LPATH)/lib$(NAME)
REGRESS_MODULE_FILENAME = $(shell $(PWDREGRESS))/$(shlib)
#---------------------------------------------------------------
# Makefile targets
wktparse.tab.c: wktparse.y
$(YACC) -vd -p lwg_parse_yy wktparse.y
mv -f y.tab.c wktparse.tab.c
mv -f y.tab.h wktparse.tab.h
MODULE_big=lwpostgis
lex.yy.c: wktparse.lex wktparse.tab.c
$(FLEX) -Plwg_parse_yy -i -f -o'lex.yy.c' wktparse.lex
# Files to be copied to the contrib/ directory
DATA_built=lwpostgis.sql
DATA=../spatial_ref_sys.sql
lwgeom_jts_wrapper.o: lwgeom_jts_wrapper.cpp
# SQL objects (files requiring C pre-processing)
SQL_OBJS=lwpostgis.sql.in
lwgeom_geos_c.o: lwgeom_geos_c.c profile.h
# Standalone LWGEOM objects
SA_OBJS=measures.o \
box2d.o \
ptarray.o \
lwgeom_api.o \
lwgeom.o \
lwpoint.o \
lwline.o \
lwpoly.o \
lwmpoint.o \
lwmline.o \
lwmpoly.o \
lwcollection.o \
lwgeom_geos_c.o \
wktunparse.o \
lwgparse.o \
wktparse.tab.o \
lex.yy.o \
vsprintf.o
lwgeom_jts.o: lwgeom_jts.c profile.h
# PostgreSQL objects
PG_OBJS=liblwgeom.o \
lwgeom_pg.o \
lwgeom_debug.o \
lwgeom_spheroid.o \
lwgeom_ogc.o \
lwgeom_functions_analytic.o \
$(JTS_OBJ) \
lwgeom_inout.o \
lwgeom_estimate.o \
lwgeom_functions_basic.o \
lwgeom_gist.o \
lwgeom_btree.o \
lwgeom_transform.o \
stringBuffer.o \
lwgeom_box.o \
lwgeom_box3d.o \
lwgeom_box2dfloat4.o \
lwgeom_chip.o \
lwgeom_svg.o \
lwgeom_gml.o \
lwgeom_kml.o \
lwgeom_geojson.o \
lwgeom_triggers.o \
lwgeom_dump.o \
lwgeom_functions_lrs.o \
long_xact.o \
lwcurve.o \
lwcompound.o \
lwcurvepoly.o \
lwmcurve.o \
lwmsurface.o \
lwgeom_sqlmm.o \
lwgeom_rtree.o
lwgeom_nojts.o: lwgeom_nojts.c
# Objects to build using PGXS
OBJS=$(SA_OBJS) $(PG_OBJS)
lwgeom_functions_basic.o: lwgeom_functions_basic.c profile.h
# Libraries to link into the module (proj, geos)
SHLIB_LINK= -L/usr/lib -lgeos_c -lproj
# Shared library stuff
# Extra files to remove during 'make clean'
EXTRA_CLEAN=$(SQL_OBJS)
../lwpostgis_upgrade.sql: ../lwpostgis.sql ../utils/postgis_proc_upgrade.pl
$(PERL) ../utils/postgis_proc_upgrade.pl ../lwpostgis.sql > ../lwpostgis_upgrade.sql
../lwpostgis.sql: lwpostgis.sql.in long_xact.sql.in sqlmm.sql.in sqldefines.h
cpp -P -traditional-cpp $(SQL_FLAGS) $< | sed -e 's:@MODULE_FILENAME@:$(MODULE_FILENAME):g;s:@POSTGIS_VERSION@:$(POSTGIS_VERSION):g;s:@POSTGIS_SCRIPTS_VERSION@:$(SCRIPTS_VERSION):g;s/@POSTGIS_BUILD_DATE@/$(POSTGIS_BUILD_DATE)/g' | grep -v '^#' > $@
../regress/lwpostgis.sql: lwpostgis.sql.in long_xact.sql.in sqlmm.sql.in sqldefines.h
cpp -P -traditional-cpp $(SQL_FLAGS) $< | sed -e 's#@MODULE_FILENAME@#$(MODULE_FILENAME)#g;s#@POSTGIS_VERSION@#$(POSTGIS_VERSION)#g;s#@POSTGIS_SCRIPTS_VERSION@#$(SCRIPTS_VERSION)#g;s/@POSTGIS_BUILD_DATE@/$(POSTGIS_BUILD_DATE)/g' | grep -v '^#' > $@
install: all install-lib-shared install-lwgeom-scripts
install-lwgeom-scripts:
@mkdir -p $(DESTDIR)$(datadir)
$(INSTALL_DATA) ../lwpostgis.sql $(DESTDIR)$(datadir)/lwpostgis.sql
$(INSTALL_DATA) ../lwpostgis_upgrade.sql $(DESTDIR)$(datadir)/lwpostgis_upgrade.sql
$(INSTALL_DATA) ../spatial_ref_sys.sql $(DESTDIR)$(datadir)/spatial_ref_sys.sql
#----------------------------------------------------------
detect_geos_version:
sh ../geos_version.sh $(GEOS_DIR) > postgis_geos_version.h
uninstall-lwgeom-scripts:
rm -f $(DESTDIR)$(datadir)/lwpostgis.sql
rm -f $(DESTDIR)$(datadir)/lwpostgis_upgrade.sql
rm -f $(DESTDIR)$(datadir)/spatial_ref_sys.sql
uninstall: uninstall-lib uninstall-lwgeom-scripts
clean-lwgeom-lib: clean-lib
clean distclean: clean-lwgeom-lib
rm -f *.o *.so *.a ../lwpostgis.sql ../lwpostgis_upgrade.sql test $(OTHERS)
maintainer-clean: clean
rm -f lex.yy.c wktparse.tab.c wktparse.tab.h
liblwgeom_sa.o: liblwgeom.c
$(CC) -DSTANDALONE -o $@ -c $<
liblwgeom_sa.so: $(SA_OBJS) liblwgeom_sa.o
$(CC) -shared -o $@ $^
liblwgeom_sa.a: $(SA_OBJS) liblwgeom_sa.o
$(AR) -rc $@ $^
# PGXS information
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
test: liblwgeom_sa.so liblwgeom_sa.a test.c
$(CC) -Wall -lm -g -o test test.c liblwgeom_sa.a
# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor
$(SQL_OBJS): %.in: %.in.c
$(CPP) -traditional-cpp $< | grep -v '^#' > $@
tsort:
lorder $(SA_OBJS) | tsort

87
lwgeom/Makefile.in Normal file
View file

@ -0,0 +1,87 @@
#
# PostGIS PGXS build system
#
MODULE_big=lwpostgis
# Files to be copied to the contrib/ directory
DATA_built=lwpostgis.sql
DATA=../spatial_ref_sys.sql
# SQL objects (files requiring C pre-processing)
SQL_OBJS=lwpostgis.sql.in
# Standalone LWGEOM objects
SA_OBJS=measures.o \
box2d.o \
ptarray.o \
lwgeom_api.o \
lwgeom.o \
lwpoint.o \
lwline.o \
lwpoly.o \
lwmpoint.o \
lwmline.o \
lwmpoly.o \
lwcollection.o \
lwgeom_geos_c.o \
wktunparse.o \
lwgparse.o \
wktparse.tab.o \
lex.yy.o \
vsprintf.o
# PostgreSQL objects
PG_OBJS=liblwgeom.o \
lwgeom_pg.o \
lwgeom_debug.o \
lwgeom_spheroid.o \
lwgeom_ogc.o \
lwgeom_functions_analytic.o \
$(JTS_OBJ) \
lwgeom_inout.o \
lwgeom_estimate.o \
lwgeom_functions_basic.o \
lwgeom_gist.o \
lwgeom_btree.o \
lwgeom_transform.o \
stringBuffer.o \
lwgeom_box.o \
lwgeom_box3d.o \
lwgeom_box2dfloat4.o \
lwgeom_chip.o \
lwgeom_svg.o \
lwgeom_gml.o \
lwgeom_kml.o \
lwgeom_geojson.o \
lwgeom_triggers.o \
lwgeom_dump.o \
lwgeom_functions_lrs.o \
long_xact.o \
lwcurve.o \
lwcompound.o \
lwcurvepoly.o \
lwmcurve.o \
lwmsurface.o \
lwgeom_sqlmm.o \
lwgeom_rtree.o
# Objects to build using PGXS
OBJS=$(SA_OBJS) $(PG_OBJS)
# Libraries to link into the module (proj, geos)
SHLIB_LINK=@SHLIB_LINK@
# Extra files to remove during 'make clean'
EXTRA_CLEAN=$(SQL_OBJS)
# PGXS information
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor
$(SQL_OBJS): %.in: %.in.c
$(CPP) -traditional-cpp $< | grep -v '^#' > $@

View file

@ -1,417 +0,0 @@
#-------------------------------------------------------------------------
#
# Makefile.shlib
# Common rules for building shared libraries
#
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.90 2004/11/20 21:13:04 tgl Exp $
#
#-------------------------------------------------------------------------
# This file should be included by any Postgres module Makefile that
# wants to build a shared library (if possible for the current
# platform). A static library is also built from the same object
# files. Only one library can be built per makefile.
#
# Before including this file, the module Makefile must define these
# variables:
#
# NAME Name of library to build (no suffix nor "lib" prefix)
# REL_MAJOR_VERSION Major version number to use for shared library
# REL_MINOR_VERSION Minor version number to use for shared library
# OBJS List of object files to include in library
# SHLIB_LINK If shared library relies on other libraries,
# additional stuff to put in its link command
# (If you want a patchlevel, include it in REL_MINOR_VERSION, e.g., "6.2".)
#
# Optional flags when building DLL's (only applicable to win32 and cygwin
# platforms).
# DLLTOOL_DEFFLAGS Additional flags when creating the dll .def file
# DLLTOOL_LIBFLAGS Additional flags when creating the lib<module>.a file
# DLLWRAP_FLAGS Additional flags to dllwrap
# DLL_DEFFILE Use pre-existing .def file instead of auto-generating
# one with all exports in it (win32 only).
#
# The module Makefile must also include
# $(top_builddir)/src/Makefile.global before including this file.
# (Makefile.global sets PORTNAME and other needed symbols.)
#
# This makefile provides the following (phony) targets:
#
# all-lib build the static and shared (if applicable) libraries
# install-lib install the libraries into $(libdir)
# uninstall-lib remove the libraries from $(libdir)
# clean-lib delete the static and shared libraries from the build dir
#
# Since `all-lib' is the first rule in this file you probably want to
# have the `all' target before including this file. In the most simple
# case it would look like this:
#
# all: all-lib
#
# Similarly, the install rule might look like
#
# install: install-lib
#
# plus any additional things you want to install. Et cetera.
#
# Got that? Look at src/interfaces/libpq/Makefile for an example.
#
# While the linker allows creation of most shared libraries,
# -Bsymbolic requires resolution of all symbols, making the
# compiler a better choice for shared library creation on ELF platforms.
# With the linker, -Bsymbolic requires the crt1.o startup object file.
# bjm 2001-02-10
COMPILER = $(CC) $(CFLAGS)
LINK.static = $(AR) $(AROPT)
ifeq ($(enable_shared), yes)
# Default shlib naming convention used by the majority of platforms
shlib = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION).$(REL_MINOR_VERSION)
shlib_major = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION)
shlib_bare = lib$(NAME)$(DLSUFFIX)
# For each platform we support shared libraries on, set shlib to the
# name of the library (if default above is not right), set
# LINK.shared to the command to link the library,
# and adjust SHLIB_LINK if necessary.
# Try to keep the sections in some kind of order, folks...
override CFLAGS += $(CFLAGS_SL)
soname = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION)
ifeq ($(PORTNAME), aix)
shlib = lib$(NAME)$(DLSUFFIX)
# SHLIB_LINK += -lc
endif
ifeq ($(PORTNAME), darwin)
ifneq ($(REL_MAJOR_VERSION), 0)
version_link := -compatibility_version $(REL_MAJOR_VERSION) -current_version $(REL_MAJOR_VERSION).$(REL_MINOR_VERSION)
endif
ifeq ($(DLTYPE), library)
# linkable library
DLSUFFIX := .dylib
LINK.shared = $(COMPILER) -dynamiclib -install_name $(libdir)/lib$(NAME).$(REL_MAJOR_VERSION)$(DLSUFFIX) $(version_link) -multiply_defined suppress
else
# loadable module (default case)
DLSUFFIX := .so
LINK.shared = $(COMPILER) -bundle
endif
shlib = lib$(NAME).$(REL_MAJOR_VERSION).$(REL_MINOR_VERSION)$(DLSUFFIX)
shlib_major = lib$(NAME).$(REL_MAJOR_VERSION)$(DLSUFFIX)
endif
ifeq ($(PORTNAME), openbsd)
ifdef ELF_SYSTEM
LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
SHLIB_LINK += -lc
else
LINK.shared = $(LD) -x -Bshareable -Bforcearchive
endif
endif
ifeq ($(PORTNAME), bsdi)
ifeq ($(DLSUFFIX), .so)
LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
SHLIB_LINK += -lc
endif
ifeq ($(DLSUFFIX), .o)
LINK.shared = shlicc -O $(LDREL)
endif
endif
ifeq ($(PORTNAME), freebsd)
ifdef ELF_SYSTEM
shlib = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION)
LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
else
shlib = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION).$(REL_MINOR_VERSION)
LINK.shared = $(LD) -x -Bshareable -Bforcearchive
endif
endif
ifeq ($(PORTNAME), netbsd)
ifdef ELF_SYSTEM
LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
else
LINK.shared = $(LD) -x -Bshareable -Bforcearchive
endif
endif
ifeq ($(PORTNAME), hpux)
shlib = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION)
ifeq ($(GCC), yes)
SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
else
# can't use the CC-syntax rpath pattern here
rpath =
ifeq ($(enable_rpath), yes)
LINK.shared = $(LD) +h $(soname) -b +b $(rpathdir)
else
LINK.shared = $(LD) +h $(soname) -b
endif
endif
endif
ifeq ($(PORTNAME), irix)
shlib = lib$(NAME)$(DLSUFFIX).$(REL_MAJOR_VERSION)
LINK.shared = $(COMPILER) -shared -Wl,-set_version,sgi$(REL_MAJOR_VERSION).$(REL_MINOR_VERSION)
endif
ifeq ($(PORTNAME), linux)
LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname)
endif
ifeq ($(PORTNAME), solaris)
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
LINK.shared = $(CC) -G
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared += -Wl,-soname,$(soname)
else
LINK.shared += -h $(soname)
endif
endif
ifeq ($(PORTNAME), sunos4)
LINK.shared = $(LD) -assert pure-text -Bdynamic
endif
ifeq ($(PORTNAME), osf)
LINK.shared = $(LD) -shared -expect_unresolved '*'
endif
ifeq ($(PORTNAME), sco)
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
LINK.shared = $(CC) -G
endif
LINK.shared += -Wl,-z,text -Wl,-h,$(soname)
endif
ifeq ($(PORTNAME), svr4)
LINK.shared = $(LD) -G
endif
ifeq ($(PORTNAME), univel)
LINK.shared = $(LD) -G -z text
endif
ifeq ($(PORTNAME), unixware)
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
LINK.shared = $(CC) -G
endif
LINK.shared += -Wl,-z,text -Wl,-h,$(soname)
endif
ifeq ($(PORTNAME), cygwin)
shlib = $(NAME)$(DLSUFFIX)
# needed for /contrib modules, not sure why
SHLIB_LINK += $(LIBS)
haslibarule = yes
endif
ifeq ($(PORTNAME), win32)
shlib = lib$(NAME)$(DLSUFFIX)
haslibarule = yes
endif
ifeq ($(PORTNAME), beos)
shlib = lib$(NAME)$(DLSUFFIX)
LINK.shared = $(LD) -nostart
SHLIB_LINK += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
endif
SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
ifeq ($(enable_rpath), yes)
SHLIB_LINK += $(rpath)
endif
endif # enable_shared
##
## BUILD
##
.PHONY: all-lib all-static-lib all-shared-lib
all-lib: all-static-lib all-shared-lib
all-static-lib: lib$(NAME).a
all-shared-lib: $(shlib)
ifndef LORDER
MK_NO_LORDER := true
endif
ifndef haslibarule
lib$(NAME).a: $(OBJS)
ifdef MK_NO_LORDER
$(LINK.static) $@ $^
else
$(LINK.static) $@ `$(LORDER) $^ | tsort`
endif
$(RANLIB) $@
endif #haslibarule
ifeq ($(enable_shared), yes)
ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), beos)
ifneq ($(PORTNAME), aix)
# Normal case
$(shlib): $(OBJS)
$(LINK.shared) $(LDFLAGS_SL) $(OBJS) $(SHLIB_LINK) -o $@
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), $(shlib_major))
rm -f $(shlib_major)
$(LN_S) $(shlib) $(shlib_major)
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
endif
else # PORTNAME == aix
# AIX case
$(shlib): lib$(NAME).a
$(MKLDEXPORT) lib$(NAME).a > lib$(NAME)$(EXPSUFF)
$(COMPILER) $(LDFLAGS_SL) -o $@ $< $(LDFLAGS) $(SHLIB_LINK) -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl,-bE:lib$(NAME)$(EXPSUFF)
endif # PORTNAME == aix
else # PORTNAME == beos
# BEOS case
$(shlib): $(OBJS)
ln -fs $(top_srcdir)/src/backend/postgres _APP_
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
endif # PORTNAME == beos
else # PORTNAME == cygwin
# Cygwin case
$(shlib) lib$(NAME).a: $(OBJS)
ifndef DLL_DEFFILE
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
else
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
endif
endif # PORTNAME == cygwin
else # PORTNAME == win32
# win32 case
$(shlib) lib$(NAME).a: $(OBJS)
ifndef DLL_DEFFILE
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
else
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
endif
endif # PORTNAME == win32
endif # enable_shared
##
## INSTALL
##
.PHONY: install-lib install-lib-static install-lib-shared
install-lib: install-lib-static install-lib-shared
install-lib-static: lib$(NAME).a
$(INSTALL_STLIB) $< $(DESTDIR)$(libdir)/lib$(NAME).a
ifeq ($(PORTNAME), darwin)
cd $(DESTDIR)$(libdir) && \
ranlib lib$(NAME).a
endif
ifeq ($(enable_shared), yes)
install-lib-shared: $(shlib)
$(INSTALL_SHLIB) $< $(DESTDIR)$(libdir)/$(shlib)
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
ifneq ($(shlib), $(shlib_major))
cd $(DESTDIR)$(libdir) && \
rm -f $(shlib_major) && \
$(LN_S) $(shlib) $(shlib_major)
endif
ifneq ($(shlib), $(shlib_bare))
cd $(DESTDIR)$(libdir) && \
rm -f $(shlib_bare) && \
$(LN_S) $(shlib) $(shlib_bare)
endif
endif # not win32
endif # not cygwin
endif # enable_shared
##
## UNINSTALL
##
.PHONY: uninstall-lib
uninstall-lib:
rm -f $(DESTDIR)$(libdir)/lib$(NAME).a
ifeq ($(enable_shared), yes)
rm -f $(DESTDIR)$(libdir)/$(shlib_bare) \
$(DESTDIR)$(libdir)/$(shlib_major) \
$(DESTDIR)$(libdir)/$(shlib)
endif # enable_shared
##
## CLEAN
##
.PHONY: clean-lib
clean-lib:
rm -f lib$(NAME).a
ifeq ($(enable_shared), yes)
rm -f $(shlib_bare) $(shlib_major) $(shlib)
ifdef EXPSUFF
rm -f lib$(NAME)$(EXPSUFF)
endif
endif
ifeq ($(PORTNAME), cygwin)
rm -f $(NAME).dll $(NAME).def
endif
ifeq ($(PORTNAME), win32)
rm -f $(NAME).dll $(NAME).def
endif

View file

@ -15,6 +15,8 @@
#endif
/* Global variables */
#include "../postgis_config.h"
#if DEFAULT_CONTEXT == CONTEXT_SA
#include "liblwgeom.h"
lwallocator lwalloc_var = default_allocator;

View file

@ -34,8 +34,10 @@ typedef void (*lwfreeor)(void* mem);
typedef void (*lwreporter)(const char* fmt, ...);
#ifndef C_H
typedef unsigned int uint32;
typedef int int32;
#endif
/*

View file

@ -211,12 +211,12 @@ CREATEFUNCTION CheckAuth(text, text)
CREATEFUNCTION CheckAuthTrigger()
RETURNS trigger AS
'@MODULE_FILENAME@', 'check_authorization'
'MODULE_PATHNAME', 'check_authorization'
LANGUAGE C;
CREATEFUNCTION GetTransactionID()
RETURNS xid AS
'@MODULE_FILENAME@', 'getTransactionID'
'MODULE_PATHNAME', 'getTransactionID'
LANGUAGE C;

View file

@ -29,10 +29,10 @@ Datum lwgeom_cmp(PG_FUNCTION_ARGS);
/* #define PGIS_DEBUG */
#if USE_VERSION == 72
#if POSTGIS_PGSQL_VERSION == 72
#define BTREE_SRID_MISMATCH_SEVERITY NOTICE
#else
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
#define BTREE_SRID_MISMATCH_SEVERITY WARNING
#else
#define BTREE_SRID_MISMATCH_SEVERITY ERROR

View file

@ -1,7 +1,9 @@
#include "../postgis_config.h"
/*
* This only works for PGSQL > 72
*/
#if USE_VERSION > 72
#if POSTGIS_PGSQL_VERSION > 72
#include <math.h>
#include <float.h>
@ -307,4 +309,4 @@ Datum LWGEOM_dump_rings(PG_FUNCTION_ARGS)
}
#endif /* USE_VERSION > 72 */
#endif /* POSTGIS_PGSQL_VERSION > 72 */

View file

@ -29,7 +29,7 @@
/*#define DEBUG_GEOMETRY_STATS 1*/
#if USE_VERSION >= 80
#if POSTGIS_PGSQL_VERSION >= 80
#include "commands/vacuum.h"
#include "utils/lsyscache.h"
@ -82,7 +82,7 @@ typedef struct GEOM_STATS_T
static float8 estimate_selectivity(BOX2DFLOAT4 *box, GEOM_STATS *geomstats);
#endif /* USE_VERSION >= 80 */
#endif /* POSTGIS_PGSQL_VERSION >= 80 */
#define SHOW_DIGS_DOUBLE 15
#define MAX_DIGS_DOUBLE (SHOW_DIGS_DOUBLE + 6 + 1 + 3 +1)
@ -136,7 +136,7 @@ Datum estimate_lwhistogram2d(PG_FUNCTION_ARGS);
Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS);
Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS);
Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS);
#if USE_VERSION >= 80
#if POSTGIS_PGSQL_VERSION >= 80
Datum LWGEOM_analyze(PG_FUNCTION_ARGS);
#endif
@ -405,7 +405,7 @@ Datum build_lwhistogram2d(PG_FUNCTION_ARGS)
PG_RETURN_NULL() ;
}
#if USE_VERSION >= 80
#if POSTGIS_PGSQL_VERSION >= 80
SPIportal = SPI_cursor_open(NULL, SPIplan, NULL, NULL, 1);
#else
SPIportal = SPI_cursor_open(NULL, SPIplan, NULL, NULL);
@ -765,7 +765,7 @@ elog(NOTICE," search is in x: %i to %i y: %i to %i",x_idx_min, x_idx_max, y_id
}
#if ! REALLY_DO_JOINSEL || USE_VERSION < 80
#if ! REALLY_DO_JOINSEL || POSTGIS_PGSQL_VERSION < 80
/*
* JOIN selectivity in the GiST && operator
* for all PG versions
@ -780,7 +780,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL);
}
#else /* REALLY_DO_JOINSEL && USE_VERSION >= 80 */
#else /* REALLY_DO_JOINSEL && POSTGIS_PGSQL_VERSION >= 80 */
int calculate_column_intersection(BOX2DFLOAT4 *search_box, GEOM_STATS *geomstats1, GEOM_STATS *geomstats2);
@ -817,7 +817,7 @@ calculate_column_intersection(BOX2DFLOAT4 *search_box, GEOM_STATS *geomstats1, G
PG_FUNCTION_INFO_V1(LWGEOM_gist_joinsel);
Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
{
#if USE_VERSION < 81
#if POSTGIS_PGSQL_VERSION < 81
Query *root = (Query *) PG_GETARG_POINTER(0);
#else
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
@ -881,7 +881,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
var1 = (Var *)arg1;
var2 = (Var *)arg2;
#if USE_VERSION < 81
#if POSTGIS_PGSQL_VERSION < 81
relid1 = getrelid(var1->varno, root->rtable);
relid2 = getrelid(var2->varno, root->rtable);
#else
@ -1052,7 +1052,7 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
/**************************** FROM POSTGIS ****************/
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
/*
* get_restriction_var
* Examine the args of a restriction clause to see if it's of the
@ -1139,7 +1139,7 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
double myest;
#ifndef USE_STATS
#ifndef POSTGIS_USE_STATS
PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_SEL);
#endif
@ -1432,7 +1432,7 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(box);
}
#else /* USE_VERSION >= 80 */
#else /* POSTGIS_PGSQL_VERSION >= 80 */
/*
* This function returns an estimate of the selectivity
@ -1693,7 +1693,7 @@ elog(NOTICE, " avg feat overlaps %f cells", avg_feat_cells);
PG_FUNCTION_INFO_V1(LWGEOM_gist_sel);
Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
{
#if USE_VERSION < 81
#if POSTGIS_PGSQL_VERSION < 81
Query *root = (Query *) PG_GETARG_POINTER(0);
#else
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
@ -1788,7 +1788,7 @@ Datum LWGEOM_gist_sel(PG_FUNCTION_ARGS)
* Get pg_statistic row
*/
#if USE_VERSION < 81
#if POSTGIS_PGSQL_VERSION < 81
/* relid = getrelid(varRelid, root->rtable); */
relid = getrelid(self->varno, root->rtable);
#else
@ -2626,7 +2626,7 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS)
}
#endif /* USE_VERSION >= 80 */
#endif /* POSTGIS_PGSQL_VERSION >= 80 */
/**********************************************************************

View file

@ -180,7 +180,7 @@ Datum postgis_uses_stats(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(postgis_autocache_bbox);
Datum postgis_autocache_bbox(PG_FUNCTION_ARGS)
{
#ifdef AUTOCACHE_BBOX
#ifdef POSTGIS_AUTOCACHE_BBOX
PG_RETURN_BOOL(TRUE);
#else
PG_RETURN_BOOL(FALSE);
@ -1858,13 +1858,13 @@ Datum LWGEOM_accum(PG_FUNCTION_ARGS)
Datum datum;
PG_LWGEOM *geom;
ArrayType *result;
#if USE_VERSION > 72
# if USE_VERSION == 73
#if POSTGIS_PGSQL_VERSION > 72
# if POSTGIS_PGSQL_VERSION == 73
Oid oid = getGeometryOID();
# else /* USE_VERSION > 73 */
# else /* POSTGIS_PGSQL_VERSION > 73 */
Oid oid = get_fn_expr_argtype(fcinfo->flinfo, 1);
# endif /* USE_VERSION > 73 */
#endif /* USE_VERSION > 72 */
# endif /* POSTGIS_PGSQL_VERSION > 73 */
#endif /* POSTGIS_PGSQL_VERSION > 72 */
#ifdef PGIS_DEBUG
@ -1926,10 +1926,10 @@ Datum LWGEOM_accum(PG_FUNCTION_ARGS)
SET_VARSIZE(result, nbytes);
result->ndim = 1;
#if USE_VERSION > 72
#if POSTGIS_PGSQL_VERSION > 72
result->elemtype = oid;
#endif
#if USE_VERSION > 81
#if POSTGIS_PGSQL_VERSION > 81
result->dataoffset = 0;
#endif
memcpy(ARR_DIMS(result), &nelems, sizeof(int));

View file

@ -1,9 +1,10 @@
#include "../postgis_config.h"
#include "postgres.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "fmgr.h"
#include "lwgeom_pg.h"
#include "liblwgeom.h"
#include "profile.h"
@ -752,7 +753,7 @@ Datum convexhull(PG_FUNCTION_ARGS)
}
#if GEOS_VERNUM >= 30
#if POSTGIS_GEOS_VERSION >= 30
PG_FUNCTION_INFO_V1(topologypreservesimplify);
Datum topologypreservesimplify(PG_FUNCTION_ARGS)

View file

@ -4,16 +4,19 @@
#include <stdio.h>
#include <errno.h>
#include "../postgis_config.h"
#include "postgres.h"
#include "access/gist.h"
#include "access/itup.h"
#if USE_VERSION > 80
#if POSTGIS_PGSQL_VERSION > 80
#include "access/skey.h"
#endif
#include "fmgr.h"
#include "utils/elog.h"
#include "liblwgeom.h"
#include "lwgeom_pg.h"
#include "stringBuffer.h"
@ -542,7 +545,7 @@ Datum LWGEOM_gist_compress(PG_FUNCTION_ARGS)
if (in != (PG_LWGEOM*)DatumGetPointer(entry->key))
pfree(in); /* PG_FREE_IF_COPY */
#if USE_VERSION >= 82
#if POSTGIS_PGSQL_VERSION >= 82
gistentryinit(*retval, PointerGetDatum(rr),
entry->rel, entry->page,
entry->offset,
@ -562,7 +565,7 @@ Datum LWGEOM_gist_compress(PG_FUNCTION_ARGS)
elog(NOTICE,"GIST: LWGEOM_gist_compress got a NULL key");
#endif
#if USE_VERSION >= 82
#if POSTGIS_PGSQL_VERSION >= 82
gistentryinit(*retval, (Datum) 0, entry->rel,
entry->page, entry->offset, FALSE);
#else
@ -807,7 +810,7 @@ Datum LWGEOM_gist_decompress(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(LWGEOM_gist_union);
Datum LWGEOM_gist_union(PG_FUNCTION_ARGS)
{
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
#else
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
@ -822,7 +825,7 @@ Datum LWGEOM_gist_union(PG_FUNCTION_ARGS)
elog(NOTICE,"GIST: LWGEOM_gist_union called\n");
#endif
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
numranges = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
cur = (BOX2DFLOAT4 *) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[0].key);
#else
@ -837,7 +840,7 @@ Datum LWGEOM_gist_union(PG_FUNCTION_ARGS)
for (i = 1; i < numranges; i++)
{
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
cur = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key);
#else
cur = (BOX2DFLOAT4*) DatumGetPointer(entryvec->vector[i].key);
@ -1030,7 +1033,7 @@ Datum LWGEOM_gist_same(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(LWGEOM_gist_picksplit);
Datum LWGEOM_gist_picksplit(PG_FUNCTION_ARGS)
{
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
#else
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
@ -1053,7 +1056,7 @@ Datum LWGEOM_gist_picksplit(PG_FUNCTION_ARGS)
posL = posR = posB = posT = 0;
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 1;
cur = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[FirstOffsetNumber].key);
#else
@ -1071,7 +1074,7 @@ elog(NOTICE," cur is: <%.16g %.16g,%.16g %.16g>", cur->xmin, cur->ymin, cur->x
/* find MBR */
for (i = OffsetNumberNext(FirstOffsetNumber); i <= maxoff; i = OffsetNumberNext(i))
{
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
cur = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key);
#else
cur = (BOX2DFLOAT4 *) DatumGetPointer(entryvec->vector[i].key);
@ -1111,7 +1114,7 @@ elog(NOTICE," pageunion is: <%.16g %.16g,%.16g %.16g>", pageunion.xmin, pageun
#ifdef PGIS_DEBUG_GIST6
elog(NOTICE," AllIsEqual!");
#endif
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
cur = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[OffsetNumberNext(FirstOffsetNumber)].key);
#else
cur = (BOX2DFLOAT4*) DatumGetPointer(entryvec->vector[OffsetNumberNext(FirstOffsetNumber)].key);
@ -1167,7 +1170,7 @@ elog(NOTICE," AllIsEqual!");
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
{
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
cur = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key);
#else
cur = (BOX2DFLOAT4*) DatumGetPointer(entryvec->vector[i].key);
@ -1196,7 +1199,7 @@ elog(NOTICE," unionB is: <%.16g %.16g,%.16g %.16g>", unionB->xmin, unionB->ymi
KBsort *arr = (KBsort*)palloc( sizeof(KBsort) * maxoff );
posL = posR = posB = posT = 0;
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
#if USE_VERSION < 80
#if POSTGIS_PGSQL_VERSION < 80
arr[i-1].key = (BOX2DFLOAT4*) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key);
#else
arr[i-1].key = (BOX2DFLOAT4*) DatumGetPointer(entryvec->vector[i].key);

View file

@ -1,3 +1,5 @@
#include "../postgis_config.h"
#include "postgres.h"
#include <math.h>
@ -13,7 +15,7 @@
#include "fmgr.h"
#include "utils/elog.h"
#if USE_VERSION > 73
#if POSTGIS_PGSQL_VERSION > 73
# include "lib/stringinfo.h" /* for binary input */
#endif
@ -37,7 +39,7 @@ Datum LWGEOM_to_text(PG_FUNCTION_ARGS);
Datum LWGEOM_to_bytea(PG_FUNCTION_ARGS);
Datum LWGEOM_from_bytea(PG_FUNCTION_ARGS);
Datum parse_WKT_lwgeom(PG_FUNCTION_ARGS);
#if USE_VERSION > 73
#if POSTGIS_PGSQL_VERSION > 73
Datum LWGEOM_recv(PG_FUNCTION_ARGS);
Datum LWGEOM_send(PG_FUNCTION_ARGS);
#endif
@ -404,7 +406,7 @@ Datum LWGEOM_addBBOX(PG_FUNCTION_ARGS)
char
is_worth_caching_pglwgeom_bbox(const PG_LWGEOM *in)
{
#if ! AUTOCACHE_BBOX
#if ! POSTGIS_AUTOCACHE_BBOX
return false;
#endif
if ( TYPE_GETTYPE(in->type) == POINTTYPE ) return false;
@ -414,7 +416,7 @@ is_worth_caching_pglwgeom_bbox(const PG_LWGEOM *in)
char
is_worth_caching_serialized_bbox(const uchar *in)
{
#if ! AUTOCACHE_BBOX
#if ! POSTGIS_AUTOCACHE_BBOX
return false;
#endif
if ( TYPE_GETTYPE((uchar)in[0]) == POINTTYPE ) return false;
@ -424,7 +426,7 @@ is_worth_caching_serialized_bbox(const uchar *in)
char
is_worth_caching_lwgeom_bbox(const LWGEOM *in)
{
#if ! AUTOCACHE_BBOX
#if ! POSTGIS_AUTOCACHE_BBOX
return false;
#endif
if ( TYPE_GETTYPE(in->type) == POINTTYPE ) return false;
@ -537,7 +539,7 @@ Datum parse_WKT_lwgeom(PG_FUNCTION_ARGS)
}
#if USE_VERSION > 73
#if POSTGIS_PGSQL_VERSION > 73
/*
* This function must advance the StringInfo.cursor pointer
* and leave it at the end of StringInfo.buf. If it fails
@ -604,7 +606,7 @@ Datum LWGEOM_send(PG_FUNCTION_ARGS)
}
#endif /* USE_VERSION > 73 */
#endif /* POSTGIS_PGSQL_VERSION > 73 */
PG_FUNCTION_INFO_V1(LWGEOM_to_bytea);
Datum LWGEOM_to_bytea(PG_FUNCTION_ARGS)

View file

@ -1,3 +1,5 @@
#include "../postgis_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -114,7 +116,7 @@ pglwgeom_serialize(LWGEOM *in)
size_t size;
PG_LWGEOM *result;
#if AUTOCACHE_BBOX
#if POSTGIS_AUTOCACHE_BBOX
if ( ! in->bbox && is_worth_caching_lwgeom_bbox(in) )
{
lwgeom_addBBOX(in);

View file

@ -1,6 +1,7 @@
#ifndef _LWGEOM_PG_H
#define _LWGEOM_PG_H 1
#include "../postgis_config.h"
#include "postgres.h"
#include "utils/geo_decls.h"
#include "fmgr.h"
@ -11,7 +12,7 @@
#define PG_NARGS() (fcinfo->nargs)
#endif
#if USE_VERSION < 82
#if POSTGIS_PGSQL_VERSION < 82
#define ARR_OVERHEAD_NONULLS(x) ARR_OVERHEAD((x))
#endif

View file

@ -28,8 +28,8 @@ Datum transform(PG_FUNCTION_ARGS);
Datum transform_geom(PG_FUNCTION_ARGS);
Datum postgis_proj_version(PG_FUNCTION_ARGS);
/* if USE_PROJECTION undefined, we get a do-nothing transform() function */
#ifndef USE_PROJ
/* if POSTGIS_PROJ_VERSION undefined, we get a do-nothing transform() function */
#ifndef POSTGIS_PROJ_VERSION
PG_FUNCTION_INFO_V1(transform);
Datum transform(PG_FUNCTION_ARGS)
@ -53,7 +53,7 @@ Datum postgis_proj_version(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
#else /* defined USE_PROJ */
#else /* defined POSTGIS_PROJ_VERSION */
#include "projects.h"
#include "utils/memutils.h"
@ -122,13 +122,13 @@ typedef struct struct_PJHashEntry
/* PJ Hash API */
#if USE_VERSION == 72
#if POSTGIS_PGSQL_VERSION == 72
long mcxt_ptr_hash(void *key, int keysize);
#endif
#if USE_VERSION == 73
#if POSTGIS_PGSQL_VERSION == 73
uint32 mcxt_ptr_hash(void *key, int keysize);
#endif
#if USE_VERSION > 73
#if POSTGIS_PGSQL_VERSION > 73
uint32 mcxt_ptr_hash(const void *key, Size keysize);
#endif
@ -159,7 +159,7 @@ static void PROJ4SRSCacheCheck(MemoryContext context);
/* Memory context definition must match the current version of PostgreSQL */
#if USE_VERSION == 72
#if POSTGIS_PGSQL_VERSION == 72
static MemoryContextMethods PROJ4SRSCacheContextMethods = {
NULL,
NULL,
@ -174,7 +174,7 @@ static MemoryContextMethods PROJ4SRSCacheContextMethods = {
};
#endif
#if USE_VERSION == 73 || USE_VERSION == 74
#if POSTGIS_PGSQL_VERSION == 73 || POSTGIS_PGSQL_VERSION == 74
static MemoryContextMethods PROJ4SRSCacheContextMethods = {
NULL,
NULL,
@ -190,7 +190,7 @@ static MemoryContextMethods PROJ4SRSCacheContextMethods = {
};
#endif
#if USE_VERSION >= 80
#if POSTGIS_PGSQL_VERSION >= 80
static MemoryContextMethods PROJ4SRSCacheContextMethods = {
NULL,
NULL,
@ -291,13 +291,13 @@ PROJ4SRSCacheCheck(MemoryContext context)
* has changed over the years....
*/
#if USE_VERSION == 72
#if POSTGIS_PGSQL_VERSION == 72
long mcxt_ptr_hash(void *key, int keysize)
#endif
#if USE_VERSION == 73
#if POSTGIS_PGSQL_VERSION == 73
uint32 mcxt_ptr_hash(void *key, int keysize)
#endif
#if USE_VERSION > 73
#if POSTGIS_PGSQL_VERSION > 73
uint32 mcxt_ptr_hash(const void *key, Size keysize)
#endif
{
@ -582,7 +582,7 @@ void DeleteFromPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid)
*/
void SetPROJ4LibPath()
{
#if USE_VERSION >= 80
#if POSTGIS_PGSQL_VERSION >= 80
char *path;
const char **proj_lib_path;

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
#ifndef _PGSQL_COMPAT_H
#if USE_VERSION < 73
#if POSTGIS_PGSQL_VERSION < 73
#define WARNING NOTICE
#endif
/* PostgreSQL < 8.3 uses VARATT_SIZEP rather than SET_VARSIZE for varlena types */
#if USE_VERSION < 83
#if POSTGIS_PGSQL_VERSION < 83
#define SET_VARSIZE(var, size) VARATT_SIZEP(var) = size
#endif

View file

@ -1,9 +1,25 @@
#ifndef _LWPGIS_DEFINES
#define _LWPGIS_DEFINES
/*
* Define just the version numbers; otherwise we get some strange substitutions in lwpostgis.sql.in
*/
#define POSTGIS_PGSQL_VERSION 83
#define POSTGIS_GEOS_VERSION 30
#define POSTGIS_PROJ_VERSION 46
/*
* Define the build date and the version number
* (these substitiutions are done with extra quotes sinces CPP
* won't substitute within apostrophes)
*/
#define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''1.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2008-05-14 08:59:43''::text AS version'
#define CREATEFUNCTION CREATE OR REPLACE FUNCTION
#if USE_VERSION > 72
#if POSTGIS_PGSQL_VERSION > 72
# define _IMMUTABLE_STRICT IMMUTABLE STRICT
# define _IMMUTABLE IMMUTABLE
# define _STABLE_STRICT STABLE STRICT
@ -23,7 +39,7 @@
# define _SECURITY_DEFINER
#endif
#if USE_VERSION >= 73
#if POSTGIS_PGSQL_VERSION >= 73
# define HAS_SCHEMAS 1
#endif

46
lwgeom/sqldefines.h.in Normal file
View file

@ -0,0 +1,46 @@
#ifndef _LWPGIS_DEFINES
#define _LWPGIS_DEFINES
/*
* Define just the version numbers; otherwise we get some strange substitutions in lwpostgis.sql.in
*/
#define POSTGIS_PGSQL_VERSION @POSTGIS_PGSQL_VERSION@
#define POSTGIS_GEOS_VERSION @POSTGIS_GEOS_VERSION@
#define POSTGIS_PROJ_VERSION @POSTGIS_PROJ_VERSION@
/*
* Define the build date and the version number
* (these substitiutions are done with extra quotes sinces CPP
* won't substitute within apostrophes)
*/
#define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''@POSTGIS_VERSION@''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''@POSTGIS_BUILD_DATE@''::text AS version'
#define CREATEFUNCTION CREATE OR REPLACE FUNCTION
#if POSTGIS_PGSQL_VERSION > 72
# define _IMMUTABLE_STRICT IMMUTABLE STRICT
# define _IMMUTABLE IMMUTABLE
# define _STABLE_STRICT STABLE STRICT
# define _STABLE STABLE
# define _VOLATILE_STRICT VOLATILE STRICT
# define _VOLATILE VOLATILE
# define _STRICT STRICT
# define _SECURITY_DEFINER SECURITY DEFINER
#else
# define _IMMUTABLE_STRICT with(iscachable,isstrict)
# define _IMMUTABLE with(iscachable)
# define _STABLE_STRICT with(isstrict)
# define _STABLE
# define _VOLATILE_STRICT with(isstrict)
# define _VOLATILE
# define _STRICT with(isstrict)
# define _SECURITY_DEFINER
#endif
#if POSTGIS_PGSQL_VERSION >= 73
# define HAS_SCHEMAS 1
#endif
#endif /* _LWPGIS_DEFINES */

View file

@ -118,7 +118,7 @@ CREATEFUNCTION ST_WKBToSQL(bytea)
-- TODO: SE_AsShape(geometry)
--CREATEFUNCTION SE_AsShape(geometry)
-- RETURNS bytea
-- AS '@MODULE_FILENAME@','LWGEOM_AsShape'
-- AS 'MODULE_PATHNAME','LWGEOM_AsShape'
-- LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
-------------------------------------------------------------------------------
@ -128,7 +128,7 @@ CREATEFUNCTION ST_WKBToSQL(bytea)
-- PostGIS equivalent function: ndims(geometry)
CREATEFUNCTION ST_CoordDim(geometry)
RETURNS smallint
AS '@MODULE_FILENAME@', 'LWGEOM_ndims'
AS 'MODULE_PATHNAME', 'LWGEOM_ndims'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (iscachable,isstrict);
-- ST_Dimension(geometry) - already defined.
@ -193,19 +193,19 @@ CREATEFUNCTION SE_IsMeasured(geometry)
-- PostGIS equivalent function: makePoint(float8,float8)
CREATEFUNCTION ST_Point(float8, float8)
RETURNS geometry
AS '@MODULE_FILENAME@', 'LWGEOM_makepoint'
AS 'MODULE_PATHNAME', 'LWGEOM_makepoint'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (iscachable,isstrict);
-- PostGIS equivalent function: Z(geometry)
CREATEFUNCTION SE_Z(geometry)
RETURNS float8
AS '@MODULE_FILENAME@','LWGEOM_z_point'
AS 'MODULE_PATHNAME','LWGEOM_z_point'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict);
-- PostGIS equivalent function: M(geometry)
CREATEFUNCTION SE_M(geometry)
RETURNS float8
AS '@MODULE_FILENAME@','LWGEOM_m_point'
AS 'MODULE_PATHNAME','LWGEOM_m_point'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict);
-------------------------------------------------------------------------------
@ -321,7 +321,7 @@ CREATEFUNCTION SE_LocateAlong(geometry, float8)
-- PostGIS equivalent function: locate_between_measures(geometry, float8, float8)
CREATEFUNCTION SE_LocateBetween(geometry, float8, float8)
RETURNS geometry
AS '@MODULE_FILENAME@', 'LWGEOM_locate_between_m'
AS 'MODULE_PATHNAME', 'LWGEOM_locate_between_m'
LANGUAGE 'C' _IMMUTABLE_STRICT;

View file

@ -0,0 +1,32 @@
dnl
dnl Return the PROJ.4 version number
dnl
dnl Written by Mark Cave-Ayland
dnl
AC_DEFUN([AC_PROJ_VERSION], [
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#ifdef HAVE_STDINT_H
#include <stdio.h>
#endif
#include "proj_api.h"
],
[
FILE *fp;
fp = fopen("conftest.out", "w");
fprintf(fp, "%d\n", PJ_VERSION);
fclose(fp)])
],
[
dnl The program ran successfully, so return the version number in the form MAJORMINOR
$1=`cat conftest.out | sed 's/\([[0-9]]\)\([[0-9]]\)\([[0-9]]\)/\1\2/'`
],
[
dnl The program failed so return an empty variable
$1=""
]
)
])

67
postgis_config.h.in Normal file
View file

@ -0,0 +1,67 @@
/* postgis_config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `geos_c' library (-lgeos_c). */
#undef HAVE_LIBGEOS_C
/* Define to 1 if you have the `pq' library (-lpq). */
#undef HAVE_LIBPQ
/* Define to 1 if you have the `proj' library (-lproj). */
#undef HAVE_LIBPROJ
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Enable caching of bounding box within geometries */
#undef POSTGIS_AUTOCACHE_BBOX
/* PostGIS build date */
#undef POSTGIS_BUILD_DATE
/* GEOS library version */
#undef POSTGIS_GEOS_VERSION
/* PostGIS library version */
#undef POSTGIS_LIB_VERSION
/* PostgreSQL server version */
#undef POSTGIS_PGSQL_VERSION
/* PROJ library version */
#undef POSTGIS_PROJ_VERSION
/* PostGIS scripts version */
#undef POSTGIS_SCRIPTS_VERSION
/* Enable use of ANALYZE statistics */
#undef POSTGIS_USE_STATS
/* PostGIS version */
#undef POSTGIS_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

View file

@ -1,6 +1,8 @@
TMPDIR?=/tmp
include ../Makefile.config
POSTGIS_PGSQL_VERSION=@POSTGIS_PGSQL_VERSION@
POSTGIS_GEOS_VERSION=@POSTGIS_GEOS_VERSION@
POSTGIS_PROJ_VERSION=@POSTGIS_PROJ_VERSION@
TESTS = \
loader/Point \
@ -36,7 +38,12 @@ TESTS = \
sql-mm-general \
sql-mm-multicurve \
sql-mm-multisurface \
geojson
geojson \
regress_ogc \
regress_bdpoly \
regress_proj \
kml
PREPROC = \
sql-mm-circularstring_expected \
@ -46,42 +53,29 @@ PREPROC = \
sql-mm-multisurface_expected
# GEOS tests only if GEOS is available
ifeq ($(USE_GEOS),1)
TESTS += regress_ogc regress_bdpoly
# Covers/CoveredBy only if GEOS >= 3.0
ifeq ($(shell expr $(GEOS_VERNUM) ">=" 30),1)
ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 30),1)
TESTS += regress_ogc_cover
# PreparedGeometry only if GEOS >= 3.1
ifeq ($(shell expr $(GEOS_VERNUM) ">=" 31),1)
ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 31),1)
TESTS += regress_ogc_prep
endif
endif
endif
ifeq ($(USE_PROJ),1)
TESTS += regress_proj kml
endif
all: test
test check: lwpostgis.sql ../lwgeom/liblwgeom.so ../loader/pgsql2shp ../loader/shp2pgsql $(PREPROC)
@USE_VERSION="$(USE_VERSION)" ./run_test $(TESTS)
lwpostgis.sql: ../lwgeom/lwpostgis.sql.in
$(MAKE) -C ../lwgeom ../regress/lwpostgis.sql
test check: ../lwgeom/liblwgeom.so ../loader/pgsql2shp ../loader/shp2pgsql $(PREPROC)
cp ../lwgeom/lwpostgis.sql .
@USE_VERSION="$(POSTGIS_PGSQL_VERSION)" ./run_test $(TESTS)
../lwgeom/liblwgeom.so:
$(MAKE) -C ../lwgeom all-shared-lib
$(MAKE) -C ../lwgeom
../loader/pgsql2shp:
$(MAKE) -C ../loader pgsql2shp
../loader/shp2pgsql:
$(MAKE) -C ../loader shp2pgsql
../loader/pgsql2shp ../loader/shp2pgsql:
$(MAKE) -C ../loader
$(PREPROC):
cpp -P -traditional-cpp $@.in | grep -v "^$$" > $@

View file

@ -130,7 +130,7 @@ run_simple_test ()
> "${OUTFILE}"
rm ${TMPFILE}
if diff "${_expected}" "${OUTFILE}" > ${DIFFILE}; then
if diff -c "${_expected}" "${OUTFILE}" > ${DIFFILE}; then
#SUCCESS=`expr $SUCCESS + 1`
rm "${OUTFILE}" "${DIFFILE}" # we don't need these anymore
return 0

View file

@ -1,4 +1,4 @@
#include "../config.h"
#include "../postgis_config.h"
ndims01|4
geometrytype01|CIRCULARSTRING
ndims02|3

View file

@ -1,4 +1,4 @@
#include "../config.h"
#include "../postgis_config.h"
ndims01|4
geometrytype01|COMPOUNDCURVE
ndims02|3

View file

@ -1,4 +1,4 @@
#include "../config.h"
#include "../postgis_config.h"
ndims01|4
geometrytype01|CURVEPOLYGON
ndims02|3

View file

@ -1,4 +1,4 @@
#include "../config.h"
#include "../postgis_config.h"
ndims01|4
geometrytype01|MULTICURVE
ndims02|3

View file

@ -1,4 +1,4 @@
#include "../config.h"
#include "../postgis_config.h"
ndims01|4
geometrytype01|MULTISURFACE
ndims02|3