2008-06-05 14:30:54 +00:00
dnl **********************************************************************
dnl * $Id: configure.ac 2797 2008-05-31 09:56:44Z mcayland $
dnl *
dnl * PostGIS - Spatial Types for PostgreSQL
dnl * http://postgis.refractions.net
dnl * Copyright 2008 Mark Cave-Ayland
dnl *
dnl * This is free software; you can redistribute and/or modify it under
dnl * the terms of the GNU General Public Licence. See the COPYING file.
dnl *
dnl **********************************************************************
2008-05-14 17:10:19 +00:00
AC_INIT()
AC_CONFIG_HEADERS([postgis_config.h])
2009-01-19 21:33:14 +00:00
AC_CONFIG_MACRO_DIR([macros])
2005-04-18 14:46:48 +00:00
2012-03-13 16:23:38 +00:00
2008-07-01 14:15:33 +00:00
dnl Invoke libtool: we do this as it is the easiest way to find the PIC
dnl flags required to build liblwgeom
AC_PROG_LIBTOOL
2005-04-18 14:46:48 +00:00
dnl
dnl Compilers
dnl
AC_PROG_CC
2008-05-14 17:10:19 +00:00
AC_PROG_CPP
2005-04-18 14:46:48 +00:00
AC_PROG_CXX
2012-02-20 12:52:58 +00:00
AC_PATH_PROG([ANT], [ant], [])
AC_SUBST([ANT])
2005-04-18 14:46:48 +00:00
2012-04-12 14:09:22 +00:00
dnl
dnl SQL Preprocessor
dnl
AC_PATH_PROG([CPPBIN], [cpp], [])
if test "x$CPPBIN" != "x"; then
SQLPP="${CPPBIN} -traditional-cpp -P"
else
AC_PATH_PROG([GPP], [gpp_], [])
if test "x$GPP" != "x"; then
SQLPP="${GPP} -C -s \'" dnl Use better string support
else
SQLPP="${CPP} -traditional-cpp"
fi
fi
AC_SUBST([SQLPP])
2008-07-01 14:15:33 +00:00
dnl
dnl Define PIC flags in PICFLAGS (note: this variable is set as part of libtool initialisation above)
dnl
PICFLAGS="$lt_prog_compiler_pic"
AC_SUBST([PICFLAGS])
dnl
dnl For GCC enable additional warning flags -Wall and -Wmissing-prototypes (using macro included with libtool)
dnl
WARNFLAGS=""
2009-06-03 22:46:42 +00:00
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wmissing-prototypes], [_cv_misprot], [-Wmissing-prototypes], [], [WARNFLAGS="$WARNFLAGS -Wmissing-prototypes"], [])
2008-07-01 14:15:33 +00:00
AC_SUBST([WARNFLAGS])
2005-06-06 18:42:21 +00:00
2010-01-29 21:24:24 +00:00
dnl
dnl For some GCC versions and platforms, floating point issues need to be
dnl ironed out.
NUMERICFLAGS=""
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
AC_SUBST([NUMERICFLAGS])
2008-10-19 14:52:29 +00:00
dnl
dnl Define executable suffix for use with the loader Makefiles
dnl
EXESUFFIX="$ac_cv_exeext"
AC_SUBST([EXESUFFIX])
2005-06-06 18:42:21 +00:00
dnl
2008-05-14 17:10:19 +00:00
dnl Version Information imported from Version.config
2005-06-06 18:42:21 +00:00
dnl
2008-05-14 17:10:19 +00:00
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'`
2005-07-04 09:47:03 +00:00
2008-10-16 18:12:34 +00:00
AC_DEFINE_UNQUOTED([POSTGIS_MAJOR_VERSION], ["$POSTGIS_MAJOR_VERSION"], [PostGIS major version])
AC_DEFINE_UNQUOTED([POSTGIS_MINOR_VERSION], ["$POSTGIS_MINOR_VERSION"], [PostGIS minor version])
AC_DEFINE_UNQUOTED([POSTGIS_MICRO_VERSION], ["$POSTGIS_MICRO_VERSION"], [PostGIS micro version])
AC_SUBST([POSTGIS_MAJOR_VERSION])
AC_SUBST([POSTGIS_MINOR_VERSION])
AC_SUBST([POSTGIS_MICRO_VERSION])
2005-06-06 18:42:21 +00:00
2008-07-03 09:28:38 +00:00
dnl
dnl Search for flex/bison to build the parser
dnl
2012-03-13 16:23:38 +00:00
2008-07-03 09:28:38 +00:00
AC_PROG_LEX
AC_PROG_YACC
AC_SUBST([LEX])
AC_SUBST([YACC])
2009-03-19 05:53:05 +00:00
dnl
dnl Search for OS-specific headers
dnl
AC_CHECK_HEADER([ieeefp.h], [HAVE_IEEEFP_H=1], [HAVE_IEEEFP_H=0])
AC_DEFINE_UNQUOTED([HAVE_IEEEFP_H], [$HAVE_IEEEFP_H], [ieeefp.h header])
2012-02-08 21:08:27 +00:00
AC_CHECK_HEADER([termios.h], [HAVE_TERMIOS_H=1], [HAVE_TERMIOS_H=0])
AC_DEFINE_UNQUOTED([HAVE_TERMIOS_H], [$HAVE_TERMIOS_H], [termios.h header])
2012-03-13 16:23:38 +00:00
dnl
dnl Check for platform-specific functions
dnl
AC_CHECK_FUNC(vasprintf, [HAVE_VASPRINTF=1], [HAVE_VASPRINTF=0])
AC_DEFINE([HAVE_VASPRINTF])
AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0])
AC_DEFINE([HAVE_ASPRINTF])
AC_FUNC_FSEEKO()
2010-01-21 13:08:34 +00:00
dnl
dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
dnl for in-place regression tests
dnl
2010-01-21 07:19:31 +00:00
case $host_os in
*mingw*)
2012-03-07 20:47:38 +00:00
MINGWBUILD=1
2010-01-21 07:19:31 +00:00
;;
*)
2012-03-07 20:47:38 +00:00
MINGWBUILD=0
2010-01-21 07:19:31 +00:00
;;
esac
2012-03-07 20:47:38 +00:00
AC_SUBST([MINGWBUILD])
2008-07-03 09:28:38 +00:00
2012-01-16 13:56:11 +00:00
AC_PATH_PROG([PERL], [perl], [])
2012-01-19 23:58:24 +00:00
if test "x$PERL" = "x"; then
AC_MSG_ERROR([Perl was not found. Building PostGIS requires Perl.])
fi
2012-01-16 13:56:11 +00:00
AC_SUBST([PERL])
2010-01-21 13:08:34 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
dnl Find components needed to build documentation
dnl ===========================================================================
2008-05-20 22:10:54 +00:00
dnl
dnl Search for xsltproc which is required for building documentation
dnl
2009-05-14 23:42:02 +00:00
AC_PATH_PROG([IMAGEMAGICK], [convert], [])
if test "x$IMAGEMAGICK" = "x"; then
AC_MSG_WARN([ImageMagick does not seem to be installed. Documentation cannot be built])
fi
2008-05-20 22:10:54 +00:00
AC_PATH_PROG([XSLTPROC], [xsltproc], [])
if test "x$XSLTPROC" = "x"; then
AC_MSG_WARN([xsltproc is not installed so documentation cannot be built])
fi
2012-02-13 10:58:28 +00:00
AC_PATH_PROG([XMLLINT], [xmllint], [])
if test "x$XMLLINT" = "x"; then
AC_MSG_WARN([xmllint is not installed so documentation cannot be checked])
fi
2008-10-16 18:12:34 +00:00
AC_PATH_PROG([DBLATEX], [dblatex], [])
if test "x$DBLATEX" = "x"; then
AC_MSG_WARN([dblatex is not installed so PDF documentation cannot be built])
fi
2008-05-20 22:10:54 +00:00
dnl
dnl Allow the user to specify the location of the html/docbook.xsl stylesheet
dnl
2008-07-14 10:05:14 +00:00
AC_ARG_WITH([xsldir],
[AS_HELP_STRING([--with-xsldir=PATH], [specify the directory containing the docbook.xsl stylesheet])],
[XSLBASE="$withval"], [XSLBASE=""])
2008-07-14 11:40:41 +00:00
XSLBASE_AUTO=""
2008-05-20 22:10:54 +00:00
if test "x$XSLBASE" = "x"; then
2009-01-19 21:33:14 +00:00
dnl If the user did not specify a directory for the docbook
dnl stylesheet, choose the first directory
2008-05-20 22:10:54 +00:00
dnl that matches from the following list
SEARCHPATH="
/usr/share/sgml/docbook/xsl-stylesheets
/usr/share/xml/docbook/stylesheet/nwalsh
/usr/share/sgml/docbook/stylesheet/xsl/nwalsh
2009-04-21 17:45:34 +00:00
/opt/local/share/xsl/docbook-xsl
/usr/local/share/xsl/docbook-xsl
/usr/share/xsl/docbook-xsl
2008-05-20 22:10:54 +00:00
"
for p in ${SEARCHPATH}; do
if test -r "${p}"/html/docbook.xsl; then
2008-07-14 11:40:41 +00:00
XSLBASE_AUTO="${p}"
2008-05-20 22:10:54 +00:00
break
fi
done
2009-01-19 21:33:14 +00:00
dnl Check to see if the automatically searched paths above located a
dnl valid Docbook stylesheet
2008-07-14 11:40:41 +00:00
if test "x$XSLBASE_AUTO" = "x"; then
AC_MSG_WARN([could not locate Docbook stylesheets required to build the documentation])
fi
else
2009-01-19 21:33:14 +00:00
dnl The user specified an alternate directory so make sure everything
dnl looks sensible
2008-07-14 10:05:14 +00:00
if test ! -d "$XSLBASE"; then
AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not exist])
fi
2008-05-27 14:47:06 +00:00
2008-07-14 10:05:14 +00:00
if test ! -f "$XSLBASE/html/docbook.xsl"; then
AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not contain the html/docbook.xsl file])
fi
2008-05-20 22:10:54 +00:00
fi
2008-07-14 11:40:41 +00:00
dnl
2009-01-19 21:33:14 +00:00
dnl If XSLBASE has been set then at this point we know it must be
dnl valid and so we can just use it. If XSLBASE_AUTO has been set, and XSLBASE
dnl is empty then a valid stylesheet was found in XSLBASE_AUTO so we
dnl should use that. Otherwise just continue silently with a blank XSLBASE
2008-07-14 11:40:41 +00:00
dnl variable which will trigger the error message in the documentation Makefile
dnl
if test "x$XSLBASE" = "x"; then
if test ! "x$XSLBASE_AUTO" = "x"; then
XSLBASE="$XSLBASE_AUTO"
fi
fi
2008-05-20 22:10:54 +00:00
AC_SUBST([XSLBASE])
2012-02-28 10:28:20 +00:00
dnl
dnl Let's see if we can find mathml2.dtd
dnl
MATHML2_DTD="http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"
dnl TODO: get more paths to add here...
SEARCHPATH="
/usr/share/xml/schema/w3c/mathml/dtd
"
for p in ${SEARCHPATH}; do
if test -r "${p}"/mathml2.dtd; then
MATHML2_DTD="${p}/mathml2.dtd"
break
fi
done
AC_SUBST([MATHML2_DTD])
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-12-22 23:37:58 +00:00
dnl Detect CUnit if it is installed (used for unit testing)
dnl
2009-01-19 21:33:14 +00:00
dnl Note that we pass any specified CPPFLAGS and LDFLAGS into the Makefile
dnl as CUnit is the only compile-time dependency that cannot obtain any
dnl specialised flags using a --with-X parameter, and so we allow this
dnl information to be passed in if required.
dnl ===========================================================================
2008-12-22 23:37:58 +00:00
2009-01-05 00:08:26 +00:00
CUNIT_LDFLAGS=""
AC_CHECK_HEADER([CUnit/CUnit.h], [
2009-01-05 20:54:12 +00:00
CUNIT_CPPFLAGS="$CPPFLAGS"
AC_CHECK_LIB([cunit], [CU_initialize_registry], [CUNIT_LDFLAGS="$LDFLAGS -lcunit"], [AC_MSG_WARN([could not locate CUnit required for liblwgeom unit tests])])
2009-01-05 00:08:26 +00:00
],
[
AC_MSG_WARN([could not locate CUnit required for liblwgeom unit tests])
])
2009-01-05 20:54:12 +00:00
AC_SUBST([CUNIT_CPPFLAGS])
2009-01-05 00:08:26 +00:00
AC_SUBST([CUNIT_LDFLAGS])
2008-12-22 23:37:58 +00:00
2008-05-20 22:10:54 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
dnl Detect iconv if it is installed (used for shp2pgsql encoding conversion
dnl if available)
dnl ===========================================================================
2008-05-27 14:47:06 +00:00
2009-12-15 18:44:09 +00:00
ICONV_CFLAGS=""
ICONV_LDFLAGS=""
AC_ARG_WITH([libiconv],
[AS_HELP_STRING([--with-libiconv=PATH], [specify a path to non-default libiconv installation])],
[LIBICONV_PATH="$withval"], [LIBICONV_PATH=""])
LDFLAGS_SAVE="$LDFLAGS"
CFLAGS_SAVE="$CFLAGS"
if test "x$LIBICONV_PATH" != "x"; then
AC_MSG_RESULT([checking user-specified libiconv location: $LIBICONV_PATH])
ICONV_CFLAGS="-I$LIBICONV_PATH/include"
ICONV_LDFLAGS="-L$LIBICONV_PATH/lib"
LDFLAGS="$ICONV_LDFLAGS $LDFLAGS"
CFLAGS="$ICONV_CFLAGS $CFLAGS"
fi
2008-05-27 14:47:06 +00:00
HAVE_ICONV_H=0
AC_CHECK_HEADER([iconv.h], [HAVE_ICONV_H=1], [])
dnl If we find the header file, try and link against the library
2009-12-15 18:44:09 +00:00
if test "x$HAVE_ICONV_H" = "x1"; then
2009-02-10 21:20:17 +00:00
dnl libconv defines iconv_open to libiconv_open, so we'll check that directly
2009-12-15 18:44:09 +00:00
AC_CHECK_LIB([iconv], [libiconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
2008-05-27 14:47:06 +00:00
if test "x$HAVE_ICONV" = "x"; then
2009-02-10 21:20:17 +00:00
dnl Check for iconv included as part of libc, using iconv_open
2009-12-15 18:44:09 +00:00
AC_CHECK_LIB([c], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -lc" HAVE_ICONV=1], [])
2008-05-27 14:47:06 +00:00
if test "x$HAVE_ICONV" = "x"; then
2009-02-10 21:20:17 +00:00
dnl But it's possible this implementation of libiconv doesn't have a libiconv_* define
2009-12-15 18:44:09 +00:00
AC_CHECK_LIB([iconv], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
2008-05-27 14:47:06 +00:00
if test "x$HAVE_ICONV" = "x"; then
dnl No iconv library was found; issue a warning to the console
2010-01-04 05:42:06 +00:00
AC_MSG_ERROR([Could not find libiconv. Please install libiconv and libiconv-devel.])
2008-05-27 14:47:06 +00:00
fi
fi
fi
else
dnl No iconv header was found; issue a warning to the console
2010-01-04 05:42:06 +00:00
AC_MSG_ERROR([Could not find iconv.h header. Please install libiconv and libiconv-devel.])
2008-05-27 14:47:06 +00:00
fi
2010-05-27 14:02:07 +00:00
AC_CHECK_FUNCS([iconvctl libiconvctl],[],[])
2009-12-15 18:44:09 +00:00
LDFLAGS="$LDFLAGS_SAVE"
CFLAGS="$CFLAGS_SAVE"
2008-05-27 14:47:06 +00:00
dnl Only define HAVE_ICONV in postgis_config.h if we detect iconv sucessfully
if test "x$HAVE_ICONV" != "x"; then
AC_DEFINE_UNQUOTED([HAVE_ICONV], [$HAVE_ICONV], [Defined if libiconv headers and library are present])
fi
AC_SUBST([ICONV_LDFLAGS])
2009-12-15 18:44:09 +00:00
AC_SUBST([ICONV_CFLAGS])
2008-05-27 14:47:06 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Detect the version of PostgreSQL installed on the system
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2005-05-10 09:35:34 +00:00
2008-07-14 10:05:14 +00:00
AC_ARG_WITH([pgconfig],
[AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file])],
[PGCONFIG="$withval"], [PGCONFIG=""])
2008-05-14 17:10:19 +00:00
if test "x$PGCONFIG" = "x"; then
dnl PGCONFIG was not specified, so search within the current path
2005-04-18 14:46:48 +00:00
AC_PATH_PROG([PGCONFIG], [pg_config])
2006-04-18 09:10:36 +00:00
2008-05-14 17:10:19 +00:00
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
else
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])
2005-05-10 08:31:14 +00:00
else
2008-05-14 17:10:19 +00:00
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])
2005-04-14 11:23:30 +00:00
fi
fi
2008-05-14 17:10:19 +00:00
fi
2006-11-10 15:17:10 +00:00
2008-11-06 15:15:06 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
dnl Ensure that $PG_CONFIG --pgxs points to a valid file. This is because some
dnl distributions such as Debian also include pg_config as part of libpq-dev
dnl packages, but don't install the Makefile it points to unless
2008-11-06 15:15:06 +00:00
dnl the postgresql-server-dev packages are installed :)
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-11-06 15:15:06 +00:00
PGXS=`$PGCONFIG --pgxs`
if test ! -f $PGXS; then
AC_MSG_ERROR([the PGXS Makefile $PGXS cannot be found. Please install the PostgreSQL server development packages and re-run configure.])
fi
AC_SUBST([PGXS])
2008-05-14 17:10:19 +00:00
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'`
2010-01-15 17:54:52 +00:00
PGSQL_FULL_VERSION=`$PGCONFIG --version`
2008-05-14 17:10:19 +00:00
POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
2008-03-28 19:25:16 +00:00
2012-02-28 18:50:18 +00:00
PGSQL_PKGLIBDIR=`$PGCONFIG --pkglibdir`
PGSQL_LIBDIR=`$PGCONFIG --libdir`
PGSQL_SHAREDIR=`$PGCONFIG --sharedir`
2010-01-15 17:54:52 +00:00
AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
2009-11-07 16:17:58 +00:00
dnl Ensure that we are using PostgreSQL >= 8.3
2008-05-14 17:10:19 +00:00
if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then
2009-11-07 16:17:58 +00:00
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.3])
2008-05-14 17:10:19 +00:00
else
if test "$PGSQL_MAJOR_VERSION" -eq 8; then
2009-11-07 16:17:58 +00:00
if test ! "$PGSQL_MINOR_VERSION" -ge 3; then
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 8.3])
2008-05-14 17:10:19 +00:00
fi
2006-11-10 15:17:10 +00:00
fi
2008-05-14 17:10:19 +00:00
fi
2006-11-10 15:17:10 +00:00
2010-03-12 13:29:28 +00:00
dnl Temporary hack until minimum PostgreSQL version is 9.0:
dnl If PostgreSQL < 9.0 is detected, trigger the inclusion of the new versioned PGXS targets
2010-01-08 22:48:29 +00:00
PGXSOVERRIDE=0
2010-03-12 13:29:28 +00:00
if test ! "$PGSQL_MAJOR_VERSION" -ge 9; then
2010-01-08 22:48:29 +00:00
PGXSOVERRIDE=1
fi
AC_SUBST([PGXSOVERRIDE])
2008-05-14 17:10:19 +00:00
dnl Note: We don't need the server-side LDFLAGS or CPPFLAGS because we get these from PGXS
2008-03-28 19:25:16 +00:00
2008-05-14 17:10:19 +00:00
dnl Extract the linker and include flags for the frontend (for programs that use libpq)
2008-12-22 21:49:00 +00:00
PGSQL_FE_LDFLAGS=-L`$PGCONFIG --libdir`" -lpq"
PGSQL_FE_CPPFLAGS=-I`$PGCONFIG --includedir`
2007-05-14 17:51:32 +00:00
2008-05-14 17:10:19 +00:00
AC_SUBST([PGSQL_FE_LDFLAGS])
AC_SUBST([PGSQL_FE_CPPFLAGS])
2005-01-24 11:00:04 +00:00
2011-08-12 17:25:01 +00:00
dnl Extract the include flags for the backend (libpgcommon)
2011-08-14 19:47:04 +00:00
PGSRV_INC=`$PGCONFIG --includedir-server`
PGSQL_BE_CPPFLAGS="-I${PGSRV_INC}"
dnl Add $PGSRV_INC/port/win32 to MinGW build to pick up netdb.h
case $host in
*mingw32*)
PGSQL_BE_CPPFLAGS="${PGSQL_BE_CPPFLAGS} -I${PGSRV_INC}/port/win32"
;;
esac
2011-08-12 17:25:01 +00:00
AC_SUBST([PGSQL_BE_CPPFLAGS])
2008-05-22 14:34:32 +00:00
dnl Extract the documentation and man page directories
PGSQL_DOCDIR=`$PGCONFIG --docdir`
PGSQL_MANDIR=`$PGCONFIG --mandir`
AC_SUBST([PGSQL_DOCDIR])
AC_SUBST([PGSQL_MANDIR])
2012-01-14 00:49:14 +00:00
dnl Extract the locale directory
PGSQL_LOCALEDIR=`$PGCONFIG --localedir`
AC_DEFINE_UNQUOTED([PGSQL_LOCALEDIR], ["$PGSQL_LOCALEDIR"], [Location of PostgreSQL locale directory])
2008-10-19 14:52:29 +00:00
dnl Extract the executable directory
PGSQL_BINDIR=`$PGCONFIG --bindir`
AC_SUBST([PGSQL_BINDIR])
2009-05-26 18:00:55 +00:00
dnl Extract the share directory
PGSQL_SHAREDIR=`$PGCONFIG --sharedir`
AC_SUBST([PGSQL_SHAREDIR])
2008-05-14 17:10:19 +00:00
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"
2005-01-24 11:00:04 +00:00
2008-05-14 17:10:19 +00:00
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"
2005-01-24 15:22:56 +00:00
2008-05-14 17:10:19 +00:00
AC_DEFINE_UNQUOTED([POSTGIS_PGSQL_VERSION], [$POSTGIS_PGSQL_VERSION], [PostgreSQL server version])
AC_SUBST([POSTGIS_PGSQL_VERSION])
2005-07-05 15:13:39 +00:00
2005-01-24 15:22:56 +00:00
2012-02-28 18:50:18 +00:00
dnl ===========================================================================
dnl Explain our prefix policy if necessary.
dnl ===========================================================================
if test "$prefix" != "NONE"; then
2012-03-01 19:46:45 +00:00
AC_MSG_RESULT([------------------------------------------------------------------------])
AC_MSG_RESULT([ WARNING: You have set the --prefix to '$prefix'. But we mostly ])
AC_MSG_RESULT([ ignore the --prefix. For your info, using the values determined from ])
AC_MSG_RESULT([ $PGCONFIG we will be installing: ])
2012-02-28 18:50:18 +00:00
AC_MSG_RESULT([ * postgis shared library in $PGSQL_LIBDIR ])
AC_MSG_RESULT([ * postgis SQL files in $PGSQL_SHAREDIR/contrib/postgis-$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION ])
AC_MSG_RESULT([ * postgis executables in $PGSQL_BINDIR ])
2012-03-01 19:46:45 +00:00
AC_MSG_RESULT([------------------------------------------------------------------------])
2012-02-28 18:50:18 +00:00
fi
2009-10-20 12:51:40 +00:00
dnl ===========================================================================
dnl Detect libxml2 if it is installed
2009-12-18 19:08:20 +00:00
dnl (needed to GeomFromGML and GeomFromKML functions)
2009-10-20 12:51:40 +00:00
dnl ===========================================================================
AC_ARG_WITH([xml2config],
[AS_HELP_STRING([--with-xml2config=FILE], [specify an alternative xml2-config file])],
[XML2CONFIG="$withval"], [XML2CONFIG=""])
if test "x$XML2CONFIG" = "x"; then
dnl XML2CONFIG was not specified, so search within the current path
AC_PATH_PROG([XML2CONFIG], [xml2-config])
dnl If we couldn't find xml2-config, display a warning
if test "x$XML2CONFIG" = "x"; then
2009-12-18 19:08:20 +00:00
AC_MSG_ERROR([could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.])
2009-10-20 12:51:40 +00:00
fi
else
dnl XML2CONFIG was specified; display a message to the user
if test "x$XML2CONFIG" = "xyes"; then
AC_MSG_ERROR([you must specify a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
else
if test -f $XML2CONFIG; then
AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
else
AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
fi
fi
fi
2009-12-18 19:08:20 +00:00
dnl Extract the linker and include flags
XML2_LDFLAGS=`$XML2CONFIG --libs`
XML2_CPPFLAGS=`$XML2CONFIG --cflags`
2009-10-20 12:51:40 +00:00
2009-12-18 19:08:20 +00:00
dnl Extract the version
POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version`
2009-10-20 12:51:40 +00:00
2009-12-18 19:08:20 +00:00
dnl Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$XML2_CPPFLAGS"
AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
[], [AC_MSG_ERROR([could not find headers include related to libxml2])])
2012-03-09 23:57:50 +00:00
CPPFLAGS="$CPPFLAGS_SAVE"
2009-10-20 12:51:40 +00:00
2009-12-18 19:08:20 +00:00
dnl Ensure we can link against libxml2
LIBS_SAVE="$LIBS"
LIBS="$XML2_LDFLAGS"
AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
2012-03-09 23:57:50 +00:00
LIBS="$LIBS_SAVE"
2009-11-23 14:26:45 +00:00
2009-12-18 19:08:20 +00:00
AC_DEFINE_UNQUOTED([POSTGIS_LIBXML2_VERSION], ["$POSTGIS_LIBXML2_VERSION"], [PostGIS libxml2 version])
AC_SUBST([POSTGIS_LIBXML2_VERSION])
2009-10-20 12:51:40 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Detect the version of GEOS installed on the system
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2005-04-18 14:46:48 +00:00
2008-07-14 10:05:14 +00:00
AC_ARG_WITH([geosconfig],
[AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
[GEOSCONFIG="$withval"], [GEOSCONFIG=""])
2008-05-14 17:10:19 +00:00
if test "x$GEOSCONFIG" = "x"; then
dnl GEOSCONFIG was not specified, so search within the current path
AC_PATH_PROG([GEOSCONFIG], [geos-config])
2005-12-15 23:57:24 +00:00
2008-05-14 17:10:19 +00:00
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.])
2005-04-18 14:46:48 +00:00
fi
2008-05-14 17:10:19 +00:00
else
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
2005-04-18 14:46:48 +00:00
fi
2008-05-14 17:10:19 +00:00
fi
2005-04-18 14:46:48 +00:00
2009-01-19 21:33:14 +00:00
dnl Extract the version information from geos_config
dnl Note: we extract the major & minor separately, ensure they are numeric,
dnl and then combine to give the final version.
dnl This is to guard against user error...
2008-05-14 17:10:19 +00:00
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'`
2010-01-26 21:10:56 +00:00
GEOS_PATCH_VERSION=`$GEOSCONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'`
2012-01-24 19:42:45 +00:00
if test "x$GEOS_PATCH_VERSION" = "x"; then
GEOS_PATCH_VERSION="0";
fi
2010-01-15 17:54:52 +00:00
GEOS_FULL_VERSION=`$GEOSCONFIG --version`
2008-05-14 17:10:19 +00:00
POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
2010-01-26 21:10:56 +00:00
GEOS_NUMERIC_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION$GEOS_PATCH_VERSION"
2005-04-18 14:46:48 +00:00
2010-01-15 17:54:52 +00:00
dnl Ensure that we are using GEOS >= 3.1.0
AC_MSG_RESULT([checking GEOS version... $GEOS_FULL_VERSION])
2010-01-26 21:10:56 +00:00
if test ! "$GEOS_NUMERIC_VERSION" -ge 311; then
AC_MSG_ERROR([PostGIS requires GEOS >= 3.1.1])
2009-03-10 19:29:55 +00:00
fi
2005-12-14 12:24:26 +00:00
2008-05-14 17:10:19 +00:00
dnl Extract the linker and include flags
GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
2011-08-06 09:47:01 +00:00
AC_SUBST([GEOS_LDFLAGS])
AC_SUBST([GEOS_CPPFLAGS])
2005-04-14 11:23:30 +00:00
2008-05-14 17:10:19 +00:00
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"
2007-06-15 19:06:11 +00:00
2008-05-14 17:10:19 +00:00
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"
2005-04-19 10:41:22 +00:00
2008-05-14 17:10:19 +00:00
AC_DEFINE_UNQUOTED([POSTGIS_GEOS_VERSION], [$POSTGIS_GEOS_VERSION], [GEOS library version])
AC_SUBST([POSTGIS_GEOS_VERSION])
2005-12-19 15:07:24 +00:00
2010-12-02 00:44:24 +00:00
dnl ===========================================================================
dnl Detect gettext
dnl ===========================================================================
GETTEXT_CFLAGS=""
GETTEXT_LDFLAGS=""
AC_ARG_WITH([gettext],
[AS_HELP_STRING([--with-gettext=PATH], [specify a path to non-default gettext installation])],
2012-01-14 00:49:05 +00:00
[GETTEXT_PATH="$withval"], [GETTEXT_PATH="yes"])
2010-12-02 00:44:24 +00:00
LDFLAGS_SAVE="$LDFLAGS"
CFLAGS_SAVE="$CFLAGS"
2012-01-14 00:49:05 +00:00
if test "x$GETTEXT_PATH" != "xno"; then
dnl If user has specified a custom gettext installation path, use it.
if test "x$GETTEXT_PATH" != "xyes"; then
AC_MSG_RESULT([checking user-specified gettext location: $GETTEXT_PATH])
GETTEXT_CFLAGS="-I$GETTEXT_PATH/include"
GETTEXT_LDFLAGS="-L$GETTEXT_PATH/lib"
LDFLAGS="$GETTEXT_LDFLAGS $LDFLAGS"
CFLAGS="$GETTEXT_CFLAGS $CFLAGS"
fi
2010-12-02 00:44:24 +00:00
2012-01-14 00:49:05 +00:00
AM_GNU_GETTEXT([external], [], [])
2010-12-02 00:44:24 +00:00
2012-01-14 00:49:05 +00:00
if test "x$LIBINTL" = "x"; then
USE_NLS=no
fi
2010-12-02 00:44:24 +00:00
fi
AC_SUBST([GETTEXT_CFLAGS])
AC_SUBST([GETTEXT_LDFLAGS])
LDFLAGS="$LDFLAGS_SAVE"
CFLAGS="$CFLAGS_SAVE"
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Detect the version of PROJ.4 installed
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2005-12-19 15:07:24 +00:00
2008-07-14 10:05:14 +00:00
AC_ARG_WITH([projdir],
[AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
[PROJDIR="$withval"], [PROJDIR=""])
2008-05-14 17:10:19 +00:00
if test ! "x$PROJDIR" = "x"; then
dnl Make sure that the directory exists
if test "x$PROJDIR" = "xyes"; then
2011-11-18 00:17:56 +00:00
AC_MSG_ERROR([you must specify a parameter to --with-projdir, e.g. --with-projdir=/path/to])
2008-05-14 17:10:19 +00:00
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])
2006-01-17 14:53:34 +00:00
fi
2005-12-19 15:07:24 +00:00
fi
2008-05-14 17:10:19 +00:00
fi
2005-12-19 15:07:24 +00:00
2009-01-19 21:33:14 +00:00
2008-05-14 17:10:19 +00:00
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])])
2005-12-19 15:07:24 +00:00
2008-05-14 17:10:19 +00:00
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"
2005-12-19 15:07:24 +00:00
2011-08-12 17:25:01 +00:00
AC_SUBST([PROJ_CPPFLAGS])
AC_SUBST([PROJ_LDFLAGS])
2008-07-24 10:22:16 +00:00
dnl Ensure that we are using PROJ >= 4.5.0 (requires pj_set_searchpath)
if test ! "$POSTGIS_PROJ_VERSION" -ge 45; then
AC_MSG_ERROR([PostGIS requires PROJ >= 4.5.0])
fi
2008-05-14 17:10:19 +00:00
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"
2005-12-19 15:07:24 +00:00
2011-11-18 00:17:56 +00:00
dnl ===========================================================================
dnl Detect if json-c installed
dnl ===========================================================================
2012-01-14 00:48:54 +00:00
HAVE_JSON=no
2012-03-07 11:39:46 +00:00
AC_SUBST([HAVE_JSON])
2011-11-18 00:17:56 +00:00
AC_ARG_WITH([jsondir],
[AS_HELP_STRING([--with-jsondir=PATH], [specify the json-c installation directory])],
[JSONDIR="$withval"], [JSONDIR=])
if test ! "x$JSONDIR" = "x"; then
dnl Make sure that the directory exists
if test "x$JSONDIR" = "xyes"; then
AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
else
2012-04-24 17:58:15 +00:00
dnl We need (libjson.so OR libjson.a OR libjson.dll) AND json/json.h
if test ! -e "${JSONDIR}/include/json/json.h" -o \
! \( -e "${JSONDIR}/lib/libjson.so" -o \
-e "${JSONDIR}/lib/libjson.dll" -o \
-e "${JSONDIR}/lib/libjson.dylib" -o \
-e "${JSONDIR}/bin/libjson.dll" -o \
-e "${JSONDIR}/lib/libjson.a" \)
2012-03-15 09:54:29 +00:00
then
AC_MSG_ERROR([Cannot find json dev files in "$JSONDIR"])
2011-11-18 00:17:56 +00:00
fi
2012-03-15 09:54:29 +00:00
AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
dnl Add the include directory to JSON_CPPFLAGS
JSON_CPPFLAGS="-I$JSONDIR/include"
JSON_LDFLAGS="-L$JSONDIR/lib -ljson"
2011-11-18 00:17:56 +00:00
fi
fi
2012-01-04 02:07:12 +00:00
dnl Check that we can find the json/json.h header file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$JSON_CPPFLAGS"
2012-01-14 00:48:54 +00:00
AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [])
2012-01-04 02:07:12 +00:00
CPPFLAGS="$CPPFLAGS_SAVE"
dnl Ensure we can link against libjson
LIBS_SAVE="$LIBS"
LIBS="$JSON_LDFLAGS"
2012-01-14 00:48:54 +00:00
AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes], [], [])
2012-01-04 02:07:12 +00:00
LIBS="$LIBS_SAVE"
2012-01-14 00:48:54 +00:00
if test "$HAVE_JSON" = "yes"; then
2012-01-14 00:48:48 +00:00
AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
2012-02-08 06:42:26 +00:00
if test "x$JSON_LDFLAGS" = "x"; then
JSON_LDFLAGS="-ljson"
fi
2012-01-04 02:07:12 +00:00
fi
2011-11-18 00:17:56 +00:00
AC_SUBST([JSON_CPPFLAGS])
AC_SUBST([JSON_LDFLAGS])
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2009-01-21 23:19:50 +00:00
dnl Detect GTK+2.0 for GUI
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
AC_ARG_WITH([gui],
[AS_HELP_STRING([--with-gui], [compile the data import GUI (requires GTK+2.0)])],
[GUI="yes"], [GUI="no"])
if test "x$GUI" = "xyes"; then
AC_MSG_RESULT([GUI: Build requested, checking for dependencies (GKT+2.0)])
2010-04-06 23:37:07 +00:00
dnl Try to find the GTK libs with pkgconfig
AM_PATH_GTK_2_0([2.8.0], [GTK_BUILD="gui"], [GTK_BUILD=""])
2009-12-18 05:55:45 +00:00
dnl Add -mwindows to MinGW GUI build
case $host in
*mingw32*)
2009-12-18 06:39:48 +00:00
GTK_WIN32_FLAGS=-mwindows
GTK_WIN32_RES=shp2pgsql-gui.res
GTK_WIN32_BUILD=gui-win32
2009-12-18 05:55:45 +00:00
;;
esac
2009-01-19 21:33:14 +00:00
fi
2009-12-18 05:55:45 +00:00
2009-01-20 17:48:44 +00:00
AC_SUBST([GTK_CFLAGS])
2009-01-19 21:33:14 +00:00
AC_SUBST([GTK_LIBS])
2009-12-18 06:39:48 +00:00
AC_SUBST([GTK_WIN32_FLAGS])
AC_SUBST([GTK_WIN32_RES])
2009-01-19 21:33:14 +00:00
AC_SUBST([GTK_BUILD])
2010-04-06 23:37:07 +00:00
AC_SUBST([IGE_MAC_CFLAGS])
AC_SUBST([IGE_MAC_LIBS])
2009-01-19 21:33:14 +00:00
2005-04-14 11:23:30 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-31 09:56:44 +00:00
dnl Allow the user to enable debugging with --enable-debug
dnl
2008-05-31 10:35:04 +00:00
dnl Currently we default to debug level 4. See DEBUG for more information.
2008-05-31 09:56:44 +00:00
dnl
AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable verbose debugging messages]),
[POSTGIS_DEBUG_LEVEL=4], [POSTGIS_DEBUG_LEVEL=0])
AC_DEFINE_UNQUOTED([POSTGIS_DEBUG_LEVEL], [$POSTGIS_DEBUG_LEVEL], [PostGIS library debug level (0=disabled)])
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-11-20 15:00:57 +00:00
dnl Allow the user to enable GEOS profiling with --enable-profile
dnl
AC_ARG_ENABLE([profile], AC_HELP_STRING([--enable-profile], [Enable GEOS profiling messages]),
[POSTGIS_PROFILE=1], [POSTGIS_PROFILE=0])
AC_DEFINE_UNQUOTED([POSTGIS_PROFILE], [$POSTGIS_PROFILE], [Enable GEOS profiling (0=disabled)])
2008-05-31 09:56:44 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Define version macros
dnl
2005-11-01 17:11:20 +00:00
2008-05-14 17:10:19 +00:00
POSTGIS_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION USE_GEOS=1 USE_PROJ=1 USE_STATS=1"
2009-11-23 14:26:45 +00:00
if test "$HAVE_LIBXML2" = "1"; then
POSTGIS_VERSION="$POSTGIS_VERSION USE_LIBXML2=1"
fi
2008-05-14 17:10:19 +00:00
POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION"
POSTGIS_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
2012-02-27 11:22:12 +00:00
POSTGIS_SCRIPTS_VERSION="$POSTGIS_LIB_VERSION"
2005-05-10 09:35:34 +00:00
2008-05-14 17:10:19 +00:00
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])
2005-05-10 09:35:34 +00:00
2008-05-14 17:10:19 +00:00
AC_SUBST([POSTGIS_VERSION])
AC_SUBST([POSTGIS_LIB_VERSION])
AC_SUBST([POSTGIS_BUILD_DATE])
AC_SUBST([POSTGIS_SCRIPTS_VERSION])
2005-04-18 14:46:48 +00:00
2005-04-14 11:23:30 +00:00
2009-01-19 21:33:14 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Other parameters
dnl
2007-05-14 17:51:32 +00:00
2008-05-14 17:10:19 +00:00
dnl Always enable BBOX caching by default
AC_DEFINE_UNQUOTED([POSTGIS_AUTOCACHE_BBOX], [1], [Enable caching of bounding box within geometries])
2007-05-14 17:51:32 +00:00
2008-05-14 17:10:19 +00:00
dnl Always enable use of ANALYZE statistics by default
AC_DEFINE_UNQUOTED([POSTGIS_USE_STATS], [1], [Enable use of ANALYZE statistics])
2007-05-14 17:51:32 +00:00
2005-04-18 14:46:48 +00:00
2011-11-18 00:17:56 +00:00
CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $JSON_CPPFLAGS $XML2_CPPFLAGS"
2008-05-14 17:10:19 +00:00
dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
2011-11-18 00:29:19 +00:00
SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LDFLAGS $XML2_LDFLAGS"
2008-05-14 17:10:19 +00:00
AC_SUBST([SHLIB_LINK])
dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
2010-12-15 18:03:52 +00:00
dnl ====================================
dnl topology stuff
dnl ====================================
AC_ARG_WITH([topology],
2012-01-23 23:27:24 +00:00
[AS_HELP_STRING([--without-topology],
[Disable the topology extension])],
[], [])
2010-12-15 18:03:52 +00:00
2012-01-23 23:27:24 +00:00
if test "x$with_topology" != "xno"; then
TOPOLOGY="topology"
2010-12-15 18:03:52 +00:00
AC_MSG_RESULT([TOPOLOGY: Topology support requested])
2012-02-08 00:29:21 +00:00
if test "$GEOS_NUMERIC_VERSION" -lt 332; then
2012-01-23 23:27:24 +00:00
AC_MSG_ERROR([Topology requires GEOS version >= 3.3.2. Use --without-topology or install a newer GEOS.])
2012-01-04 17:58:11 +00:00
fi
2012-01-23 23:27:24 +00:00
else
AC_MSG_RESULT([TOPOLOGY: Topology support disabled])
2010-12-15 18:03:52 +00:00
fi
AC_SUBST([TOPOLOGY])
2012-02-13 14:48:17 +00:00
dnl ===========================================================================
dnl SRID stuff
dnl ===========================================================================
SRID_MAX=999999
SRID_USR_MAX=998999
AC_SUBST([SRID_MAX])
AC_SUBST([SRID_USR_MAX])
2010-12-15 18:03:52 +00:00
2010-09-26 21:21:03 +00:00
dnl ====================================
dnl raster stuff
dnl ====================================
2012-03-09 23:57:50 +00:00
AC_ARG_WITH(
2012-03-10 00:19:00 +00:00
[raster],
AC_HELP_STRING([--without-raster], [Disable the raster extension]),
2012-03-10 00:24:53 +00:00
[], [])
2010-09-26 21:21:03 +00:00
2012-03-10 00:05:08 +00:00
if test "x$with_raster" != "xno"; then
2012-03-09 23:57:50 +00:00
RASTER="raster"
AC_MSG_RESULT([RASTER: Raster support requested])
AC_CONFIG_HEADERS([raster/raster_config.h])
dnl
dnl Raster Version Information imported from raster/Version.config
dnl
POSTGIS_RASTER_MAJOR_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
POSTGIS_RASTER_MINOR_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
POSTGIS_RASTER_MICRO_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MAJOR_VERSION], ["$POSTGIS_RASTER_MAJOR_VERSION"], [PostGIS Raster major version])
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MINOR_VERSION], ["$POSTGIS_RASTER_MINOR_VERSION"], [PostGIS Raster minor version])
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MICRO_VERSION], ["$POSTGIS_RASTER_MICRO_VERSION"], [PostGIS Raster micro version])
AC_SUBST([POSTGIS_RASTER_MAJOR_VERSION])
AC_SUBST([POSTGIS_RASTER_MINOR_VERSION])
AC_SUBST([POSTGIS_RASTER_MICRO_VERSION])
dnl ==============================
dnl Define raster version macros
dnl ==============================
POSTGIS_RASTER_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION"
POSTGIS_RASTER_LIB_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION.$POSTGIS_RASTER_MICRO_VERSION"
POSTGIS_RASTER_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
POSTGIS_RASTER_SCRIPTS_VERSION="$POSTGIS_RASTER_LIB_VERSION"
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_VERSION], ["$POSTGIS_RASTER_VERSION"], [PostGIS Raster version])
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_LIB_VERSION], ["$POSTGIS_RASTER_LIB_VERSION"], [PostGIS Raster library version])
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_BUILD_DATE], ["$POSTGIS_RASTER_BUILD_DATE"], [PostGIS Raster build date])
AC_DEFINE_UNQUOTED([POSTGIS_RASTER_SCRIPTS_VERSION], ["$POSTGIS_RASTER_SCRIPTS_VERSION"], [PostGIS Raster scripts version])
AC_SUBST([POSTGIS_RASTER_VERSION])
AC_SUBST([POSTGIS_RASTER_LIB_VERSION])
AC_SUBST([POSTGIS_RASTER_BUILD_DATE])
AC_SUBST([POSTGIS_RASTER_SCRIPTS_VERSION])
dnl ===========================================================================
dnl Allow output of double truncation warnings with --with-raster-dblwarning
dnl ===========================================================================
AC_ARG_WITH(
[raster-dblwarning],
AC_HELP_STRING([--with-raster-dblwarning], [output double truncation warnings. Only used with --with-raster]),
[POSTGIS_RASTER_WARN_ON_TRUNCATION=1],
2012-03-10 00:24:53 +00:00
[POSTGIS_RASTER_WARN_ON_TRUNCATION=0])
2012-03-09 23:57:50 +00:00
AC_DEFINE_UNQUOTED(
[POSTGIS_RASTER_WARN_ON_TRUNCATION],
[$POSTGIS_RASTER_WARN_ON_TRUNCATION],
2012-03-10 00:30:32 +00:00
[Define to 1 if a warning is outputted every time a double is truncated])
2012-03-09 23:57:50 +00:00
dnl ========================================================================
dnl Determine GDAL Support
dnl
dnl TODO: Now, --with-gdalconfig can have only 1 value: path to gdal-config. It
dnl could be useful to allow path to GDAL tree, because the cflags and the
dnl libs can be obtained from GDAL tree too, apart from gdal-config
dnl How to get cflags and libs from GDAL tree?
dnl
dnl LIBGDAL_CFLAGS="-I$with_gdal/port -I$with_gdal/ogr -I$with_gdal/alg -I$with_gdal/gcore -I$with_gdal/frmts "
dnl LIBGDAL_LDFLAGS="-L${with_gdal}/.libs -lgdal -L${with_gdal}/ -lgdal"
dnl ========================================================================
dnl not used right now
USE_GDAL_SOURCE_TREE="no"
LIBGDAL_CFLAGS=""
LIBGDAL_LDFLAGS=""
2010-09-26 21:21:03 +00:00
2011-02-19 01:05:30 +00:00
dnl GDAL version constants, update here
GDAL_MIN_VERSION=1.6.0
GDAL_MIN_VERSION_NUMBER=160 dnl TODO: Use GDAL version calculation MAJOR*1000+MINOR*100+REV*10+BUILD
2012-03-09 23:57:50 +00:00
AC_ARG_WITH(
[gdalconfig],
2011-11-18 18:30:00 +00:00
AC_HELP_STRING([--with-gdalconfig=@<:@ARG@:>@],[specify location of gdal-config (ARG=path). Only used with --with-raster]),
2012-03-09 23:57:50 +00:00
[GDAL_CONFIG="$withval"],
2012-03-14 16:35:02 +00:00
[AC_PATH_PROG([GDAL_CONFIG], [gdal-config], [])]
)
2012-03-09 23:57:50 +00:00
AC_MSG_CHECKING([for GDAL >= $GDAL_MIN_VERSION])
2010-09-26 21:21:03 +00:00
2012-03-10 00:05:08 +00:00
if test -x "$GDAL_CONFIG"; then
2012-03-09 23:57:50 +00:00
dnl Extract the version information from gdal-config
dnl Note: we extract the major & minor separately, ensure they are numeric,
dnl and then combine to give the final version.
dnl This is to guard against user error...
GDAL_MAJOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
GDAL_MINOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
GDAL_PATCH_VERSION=`$GDAL_CONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'`
GDAL_FULL_VERSION=`$GDAL_CONFIG --version`
POSTGIS_GDAL_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION"
GDAL_VERSION_NUMBER="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION$GDAL_PATCH_VERSION"
dnl Ensure we are using minimum required version of GDAL
if test ! "$GDAL_VERSION_NUMBER" -ge "$GDAL_MIN_VERSION_NUMBER" ; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([PostGIS raster requires GDAL >= $GDAL_MIN_VERSION. Use --without-raster to build without raster support.])
fi
AC_MSG_RESULT([found])
AC_DEFINE_UNQUOTED([POSTGIS_GDAL_VERSION], [$POSTGIS_GDAL_VERSION], [GDAL library version])
AC_SUBST([POSTGIS_GDAL_VERSION])
dnl Extract the linker and include flags
LIBGDAL_LDFLAGS=`$GDAL_CONFIG --libs`
LIBGDAL_CFLAGS=`$GDAL_CONFIG --cflags`
CPPFLAGS_SAVE="$CPPFLAGS"
2012-03-10 00:40:10 +00:00
CPPFLAGS="$LIBGDAL_CFLAGS"
2012-03-09 23:57:50 +00:00
CFLAGS_SAVE="$CFLAGS"
2012-03-10 00:40:10 +00:00
CFLAGS=""
2012-03-09 23:57:50 +00:00
LIBS_SAVE="$LIBS"
LIBS="$LIBGDAL_LDFLAGS"
dnl Check headers file
AC_CHECK_HEADERS(
[gdal.h ogr_api.h cpl_conv.h],
[],
2012-03-10 00:30:32 +00:00
[AC_MSG_ERROR([could not find headers include related to gdal])])
2012-03-09 23:57:50 +00:00
dnl Ensure we can link against gdal
2012-03-14 19:05:02 +00:00
AC_SEARCH_LIBS([GDALAllRegister], [gdal], [], [AC_MSG_ERROR([could not find gdal])], [])
2012-03-09 23:57:50 +00:00
LIBS="$LIBGDAL_LDFLAGS"
dnl Check if the new polygonize function is present
2012-03-14 19:05:02 +00:00
AC_SEARCH_LIBS(
2012-03-09 23:57:50 +00:00
[GDALFPolygonize],
2012-03-14 19:05:02 +00:00
[gdal],
2012-03-09 23:57:50 +00:00
[AC_DEFINE_UNQUOTED([GDALFPOLYGONIZE], [1], [Define to 1 if GDALFPolygonize function is available])],
2012-03-10 00:30:32 +00:00
[])
2012-03-09 23:57:50 +00:00
CPPFLAGS="$CPPFLAGS_SAVE"
CFLAGS="$CFLAGS_SAVE"
LIBS="$LIBS_SAVE"
AC_SUBST([LIBGDAL_CFLAGS])
AC_SUBST([LIBGDAL_LDFLAGS])
AC_SUBST([GDALFPOLYGONIZE])
2012-03-10 00:05:08 +00:00
else
2011-02-19 01:05:30 +00:00
AC_MSG_RESULT([not found])
2012-01-20 23:41:32 +00:00
AC_MSG_ERROR([gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>])
2012-03-10 00:05:08 +00:00
fi
2012-03-09 23:57:50 +00:00
dnl Define raster objects, for makefiles
RT_CORE_LIB=corelib
RT_PG_LIB=pglib
RT_LOADER=rtloader
RT_POSTGIS_SQL=rtpostgis.sql
AC_SUBST([RASTER])
AC_SUBST([RT_CORE_LIB])
AC_SUBST([RT_PG_LIB])
AC_SUBST([RT_LOADER])
AC_SUBST([RT_POSTGIS_SQL])
RT_MAKEFILE_LIST="
raster/Makefile \
raster/rt_core/Makefile \
raster/rt_pg/Makefile \
raster/loader/Makefile \
raster/test/Makefile \
raster/test/core/Makefile \
raster/test/regress/Makefile \
raster/scripts/Makefile \
raster/scripts/python/Makefile"
2012-03-10 00:05:08 +00:00
else
2012-03-09 23:57:50 +00:00
AC_MSG_RESULT([RASTER: Raster support disabled])
RT_MAKEFILE_LIST="raster/Makefile"
2012-03-10 00:05:08 +00:00
fi
2010-09-26 21:21:03 +00:00
2012-02-13 22:02:55 +00:00
dnl ===========================================================================
dnl See if we have the requirements for building the extensions, namely
dnl PostgreSQL 9.1 or better and the xlstproc tool for generating the commends
dnl SQL file.
dnl ===========================================================================
EXTENSIONS=""
if test $POSTGIS_PGSQL_VERSION -ge 91; then
2012-03-28 12:40:15 +00:00
if test \
"x$XSLTPROC" != "x" -o \
-e doc/postgis_comments.sql -a \
-e doc/raster_comments.sql;
then
2012-02-13 22:02:55 +00:00
if test "x$RASTER" = "xraster"; then
2012-05-17 12:10:04 +00:00
AC_MSG_RESULT([enabling PostgreSQL extension support...])
2012-02-13 22:02:55 +00:00
EXTENSIONS=extensions
AC_SUBST([EXTENSIONS])
fi
fi
fi
2010-09-26 21:21:03 +00:00
2012-02-13 22:02:55 +00:00
dnl ===========================================================================
2008-05-14 17:10:19 +00:00
dnl Output the relevant files
2012-02-13 22:02:55 +00:00
dnl ===========================================================================
2010-12-15 18:03:52 +00:00
AC_OUTPUT([GNUmakefile
2012-02-10 09:16:47 +00:00
extensions/Makefile
2012-01-10 23:04:10 +00:00
extensions/postgis/Makefile
extensions/postgis/postgis.control
extensions/postgis_topology/Makefile
extensions/postgis_topology/postgis_topology.control
2012-01-10 21:51:21 +00:00
liblwgeom/Makefile
liblwgeom/cunit/Makefile
2012-01-10 23:04:10 +00:00
liblwgeom/liblwgeom.h
2012-01-10 21:51:21 +00:00
libpgcommon/Makefile
libpgcommon/cunit/Makefile
2012-01-10 23:04:10 +00:00
postgis/Makefile
2012-01-10 21:51:21 +00:00
postgis/sqldefines.h
2012-01-10 23:04:10 +00:00
loader/Makefile
loader/cunit/Makefile
2012-01-10 21:51:21 +00:00
topology/Makefile
regress/Makefile
doc/Makefile
2012-01-10 23:04:10 +00:00
doc/Makefile.comments
2012-01-10 21:51:21 +00:00
doc/html/image_src/Makefile
2012-02-13 14:48:17 +00:00
utils/Makefile
2012-02-20 12:52:58 +00:00
java/jdbc/Makefile
2012-01-10 21:51:21 +00:00
$RT_MAKEFILE_LIST])
2010-09-26 21:21:03 +00:00
2009-03-22 07:08:20 +00:00
dnl ===========================================================================
dnl Display the configuration status information
dnl ===========================================================================
AC_MSG_RESULT()
AC_MSG_RESULT([ PostGIS is now configured for ${host}])
AC_MSG_RESULT()
AC_MSG_RESULT([ -------------- Compiler Info ------------- ])
AC_MSG_RESULT([ C compiler: ${CC} ${CFLAGS}])
AC_MSG_RESULT([ C++ compiler: ${CXX} ${CXXFLAGS}])
2012-04-12 14:09:22 +00:00
AC_MSG_RESULT([ SQL preprocessor: ${SQLPP}])
2009-03-22 07:08:20 +00:00
AC_MSG_RESULT()
AC_MSG_RESULT([ -------------- Dependencies -------------- ])
AC_MSG_RESULT([ GEOS config: ${GEOSCONFIG}])
2010-01-15 17:54:52 +00:00
AC_MSG_RESULT([ GEOS version: ${GEOS_FULL_VERSION}])
2011-04-14 13:50:39 +00:00
if test "x$RASTER" = "xraster"; then
2010-09-26 21:21:03 +00:00
AC_MSG_RESULT([ GDAL config: ${GDAL_CONFIG}])
AC_MSG_RESULT([ GDAL version: ${GDAL_FULL_VERSION}])
fi
2009-03-22 07:08:20 +00:00
AC_MSG_RESULT([ PostgreSQL config: ${PGCONFIG}])
2010-01-15 17:54:52 +00:00
AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_FULL_VERSION}])
2009-03-22 07:08:20 +00:00
AC_MSG_RESULT([ PROJ4 version: ${POSTGIS_PROJ_VERSION}])
2009-10-20 12:51:40 +00:00
AC_MSG_RESULT([ Libxml2 config: ${XML2CONFIG}])
2009-11-23 14:26:45 +00:00
AC_MSG_RESULT([ Libxml2 version: ${POSTGIS_LIBXML2_VERSION}])
2011-11-18 00:17:56 +00:00
AC_MSG_RESULT([ JSON-C support: ${HAVE_JSON}])
2009-03-22 07:08:20 +00:00
AC_MSG_RESULT([ PostGIS debug level: ${POSTGIS_DEBUG_LEVEL}])
2012-01-23 22:20:48 +00:00
AC_MSG_RESULT([ Perl: ${PERL}])
2012-01-23 23:27:24 +00:00
AC_MSG_RESULT()
AC_MSG_RESULT([ --------------- Extensions --------------- ])
2011-04-14 13:50:39 +00:00
if test "x$RASTER" = "xraster"; then
2012-02-08 21:29:29 +00:00
AC_MSG_RESULT([ PostGIS Raster: enabled])
2012-01-23 22:20:48 +00:00
else
AC_MSG_RESULT([ PostGIS Raster: disabled])
2010-09-26 21:21:03 +00:00
fi
2010-12-15 18:03:52 +00:00
if test "x$TOPOLOGY" = "xtopology"; then
2012-01-23 22:20:48 +00:00
AC_MSG_RESULT([ PostGIS Topology: enabled])
else
AC_MSG_RESULT([ PostGIS Topology: disabled])
2010-12-15 18:03:52 +00:00
fi
2009-03-22 07:08:20 +00:00
AC_MSG_RESULT()
2009-04-21 17:45:34 +00:00
AC_MSG_RESULT([ -------- Documentation Generation -------- ])
AC_MSG_RESULT([ xsltproc: ${XSLTPROC}])
AC_MSG_RESULT([ xsl style sheets: ${XSLBASE}])
2009-05-26 18:27:26 +00:00
AC_MSG_RESULT([ dblatex: ${DBLATEX}])
AC_MSG_RESULT([ convert: ${IMAGEMAGICK}])
2012-02-28 10:28:20 +00:00
AC_MSG_RESULT([ mathml2.dtd: ${MATHML2_DTD}])
2009-04-21 17:45:34 +00:00
AC_MSG_RESULT()
2012-02-07 23:42:30 +00:00
2012-02-08 00:29:21 +00:00
if test "$GEOS_NUMERIC_VERSION" -lt 332; then
2012-02-07 23:42:30 +00:00
AC_MSG_RESULT([ --------- GEOS VERSION NOTICE ------------ ])
AC_MSG_RESULT([ You are building against GEOS ${GEOS_FULL_VERSION} ])
AC_MSG_RESULT([ To take advantage of all the features of ])
AC_MSG_RESULT([ PostGIS we recommend you build using ])
AC_MSG_RESULT([ GEOS 3.3.2 or higher. You can download ])
2012-02-08 00:29:21 +00:00
AC_MSG_RESULT([ the latest versions from ])
AC_MSG_RESULT([ http://trac.osgeo.org/geos ])
2012-02-07 23:42:30 +00:00
AC_MSG_RESULT()
fi