| 1 | dnl **********************************************************************
|
|---|
| 2 | dnl * $Id: configure.ac 5232 2010-02-12 10:19:28Z jorgearevalo $
|
|---|
| 3 | dnl *
|
|---|
| 4 | dnl * PostGIS - Spatial Types for PostgreSQL
|
|---|
| 5 | dnl * WKTRaster - RASTER type support for PostGIS
|
|---|
| 6 | dnl *
|
|---|
| 7 | dnl * http://postgis.refractions.net
|
|---|
| 8 | dnl * Copyright 2008 Mark Cave-Ayland
|
|---|
| 9 | dnl *
|
|---|
| 10 | dnl * This is free software; you can redistribute and/or modify it under
|
|---|
| 11 | dnl * the terms of the GNU General Public Licence. See the COPYING file.
|
|---|
| 12 | dnl *
|
|---|
| 13 | dnl **********************************************************************
|
|---|
| 14 |
|
|---|
| 15 | AC_INIT()
|
|---|
| 16 | AC_CONFIG_HEADERS([wktraster_config.h])
|
|---|
| 17 | AC_CONFIG_MACRO_DIR([macros])
|
|---|
| 18 |
|
|---|
| 19 | dnl Invoke libtool: we do this as it is the easiest way to find the PIC
|
|---|
| 20 | dnl flags required to build the libs
|
|---|
| 21 | AC_PROG_LIBTOOL
|
|---|
| 22 |
|
|---|
| 23 | dnl
|
|---|
| 24 | dnl Compilers
|
|---|
| 25 | dnl
|
|---|
| 26 | AC_PROG_CC
|
|---|
| 27 | AC_PROG_CPP
|
|---|
| 28 | AC_PROG_CXX
|
|---|
| 29 |
|
|---|
| 30 | dnl
|
|---|
| 31 | dnl Define PIC flags in PICFLAGS
|
|---|
| 32 | dnl (note: this variable is set as part of libtool initialisation above)
|
|---|
| 33 | dnl
|
|---|
| 34 | PICFLAGS="$lt_prog_compiler_pic"
|
|---|
| 35 | AC_SUBST([PICFLAGS])
|
|---|
| 36 |
|
|---|
| 37 | dnl
|
|---|
| 38 | dnl For GCC enable additional warning flags
|
|---|
| 39 | dnl -Wall and -Wmissing-prototypes (using macro included with libtool)
|
|---|
| 40 | dnl
|
|---|
| 41 | WARNFLAGS=""
|
|---|
| 42 | AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall],
|
|---|
| 43 | [dummy_cv_Wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
|
|---|
| 44 | AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wmissing-prototypes],
|
|---|
| 45 | [dummy_cv_Wmissing_prototypes], [-Wmissing-prototypes], [],
|
|---|
| 46 | [WARNFLAGS="$WARNFLAGS -Wmissing-prototypes"], [])
|
|---|
| 47 | AC_SUBST([WARNFLAGS])
|
|---|
| 48 |
|
|---|
| 49 | dnl
|
|---|
| 50 | dnl Define executable suffix for use with the loader Makefiles
|
|---|
| 51 | dnl
|
|---|
| 52 | EXESUFFIX="$ac_cv_exeext"
|
|---|
| 53 | AC_SUBST([EXESUFFIX])
|
|---|
| 54 |
|
|---|
| 55 | dnl
|
|---|
| 56 | dnl Version Information imported from Version.config
|
|---|
| 57 | dnl
|
|---|
| 58 | RT_MAJOR_VERSION=`cat Version.config | grep RT_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
|
|---|
| 59 | RT_MINOR_VERSION=`cat Version.config | grep RT_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
|
|---|
| 60 | RT_MICRO_VERSION=`cat Version.config | grep RT_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
|
|---|
| 61 |
|
|---|
| 62 | AC_DEFINE_UNQUOTED([RT_MAJOR_VERSION], ["$RT_MAJOR_VERSION"], [WKTRaster major version])
|
|---|
| 63 | AC_DEFINE_UNQUOTED([RT_MINOR_VERSION], ["$RT_MINOR_VERSION"], [WKTRaster minor version])
|
|---|
| 64 | AC_DEFINE_UNQUOTED([RT_MICRO_VERSION], ["$RT_MICRO_VERSION"], [WKTRaster micro version])
|
|---|
| 65 |
|
|---|
| 66 | AC_SUBST([RT_MAJOR_VERSION])
|
|---|
| 67 | AC_SUBST([RT_MINOR_VERSION])
|
|---|
| 68 | AC_SUBST([RT_MICRO_VERSION])
|
|---|
| 69 |
|
|---|
| 70 | dnl
|
|---|
| 71 | dnl Search for flex/bison to build the parser
|
|---|
| 72 | dnl
|
|---|
| 73 | AC_PROG_LEX
|
|---|
| 74 | AC_PROG_YACC
|
|---|
| 75 | AC_SUBST([LEX])
|
|---|
| 76 | AC_SUBST([YACC])
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | dnl ===========================================================================
|
|---|
| 80 | dnl Find components needed to build documentation
|
|---|
| 81 | dnl ===========================================================================
|
|---|
| 82 | dnl
|
|---|
| 83 | dnl Search for xsltproc which is required for building documentation
|
|---|
| 84 | dnl
|
|---|
| 85 |
|
|---|
| 86 | AC_PATH_PROG([XSLTPROC], [xsltproc], [])
|
|---|
| 87 | if test "x$XSLTPROC" = "x"; then
|
|---|
| 88 | AC_MSG_WARN([xsltproc is not installed so documentation cannot be built])
|
|---|
| 89 | fi
|
|---|
| 90 |
|
|---|
| 91 | dnl
|
|---|
| 92 | dnl Search for db2pdf which is required for building PDF documentation
|
|---|
| 93 | dnl
|
|---|
| 94 |
|
|---|
| 95 | AC_PATH_PROG([DB2PDF], [db2pdf], [])
|
|---|
| 96 | if test "x$DB2PDF" = "x"; then
|
|---|
| 97 | AC_MSG_WARN([db2pdf is not installed so PDF documentation cannot be built])
|
|---|
| 98 | fi
|
|---|
| 99 |
|
|---|
| 100 | dnl
|
|---|
| 101 | dnl Search for dblatex which is required for building PDF documentation
|
|---|
| 102 | dnl
|
|---|
| 103 |
|
|---|
| 104 | AC_PATH_PROG([DBLATEX], [dblatex], [])
|
|---|
| 105 | if test "x$DBLATEX" = "x"; then
|
|---|
| 106 | AC_MSG_WARN([dblatex is not installed so PDF documentation cannot be built])
|
|---|
| 107 | fi
|
|---|
| 108 |
|
|---|
| 109 | dnl
|
|---|
| 110 | dnl Allow the user to specify the location of the html/docbook.xsl stylesheet
|
|---|
| 111 | dnl
|
|---|
| 112 |
|
|---|
| 113 | AC_ARG_WITH([xsldir],
|
|---|
| 114 | [AS_HELP_STRING([--with-xsldir=PATH], [specify the directory containing the docbook.xsl stylesheet])],
|
|---|
| 115 | [XSLBASE="$withval"], [XSLBASE=""])
|
|---|
| 116 |
|
|---|
| 117 | XSLBASE_AUTO=""
|
|---|
| 118 | if test "x$XSLBASE" = "x"; then
|
|---|
| 119 | dnl If the user did not specify a directory for the docbook
|
|---|
| 120 | dnl stylesheet, choose the first directory
|
|---|
| 121 | dnl that matches from the following list
|
|---|
| 122 | SEARCHPATH="
|
|---|
| 123 | /usr/share/sgml/docbook/xsl-stylesheets
|
|---|
| 124 | /usr/share/xml/docbook/stylesheet/nwalsh
|
|---|
| 125 | /usr/share/sgml/docbook/stylesheet/xsl/nwalsh
|
|---|
| 126 | "
|
|---|
| 127 | for p in ${SEARCHPATH}; do
|
|---|
| 128 | if test -r "${p}"/html/docbook.xsl; then
|
|---|
| 129 | XSLBASE_AUTO="${p}"
|
|---|
| 130 | break
|
|---|
| 131 | fi
|
|---|
| 132 | done
|
|---|
| 133 |
|
|---|
| 134 | dnl Check to see if the automatically searched paths above located a
|
|---|
| 135 | dnl valid Docbook stylesheet
|
|---|
| 136 | if test "x$XSLBASE_AUTO" = "x"; then
|
|---|
| 137 | AC_MSG_WARN([could not locate Docbook stylesheets required to build the documentation])
|
|---|
| 138 | fi
|
|---|
| 139 | else
|
|---|
| 140 | dnl The user specified an alternate directory so make sure everything
|
|---|
| 141 | dnl looks sensible
|
|---|
| 142 | if test ! -d "$XSLBASE"; then
|
|---|
| 143 | AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not exist])
|
|---|
| 144 | fi
|
|---|
| 145 |
|
|---|
| 146 | if test ! -f "$XSLBASE/html/docbook.xsl"; then
|
|---|
| 147 | AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not contain the html/docbook.xsl file])
|
|---|
| 148 | fi
|
|---|
| 149 | fi
|
|---|
| 150 |
|
|---|
| 151 | dnl
|
|---|
| 152 | dnl If XSLBASE has been set then at this point we know it must be
|
|---|
| 153 | dnl valid and so we can just use it. If XSLBASE_AUTO has been set, and XSLBASE
|
|---|
| 154 | dnl is empty then a valid stylesheet was found in XSLBASE_AUTO so we
|
|---|
| 155 | dnl should use that. Otherwise just continue silently with a blank XSLBASE
|
|---|
| 156 | dnl variable which will trigger the error message in the documentation Makefile
|
|---|
| 157 | dnl
|
|---|
| 158 |
|
|---|
| 159 | if test "x$XSLBASE" = "x"; then
|
|---|
| 160 | if test ! "x$XSLBASE_AUTO" = "x"; then
|
|---|
| 161 | XSLBASE="$XSLBASE_AUTO"
|
|---|
| 162 | fi
|
|---|
| 163 | fi
|
|---|
| 164 |
|
|---|
| 165 | AC_SUBST([XSLBASE])
|
|---|
| 166 |
|
|---|
| 167 | dnl ===========================================================================
|
|---|
| 168 | dnl Detect if various RT DEBUG modes requested
|
|---|
| 169 | dnl ===========================================================================
|
|---|
| 170 |
|
|---|
| 171 | RT_API_DEBUG_CFLAGS=""
|
|---|
| 172 | RT_PG_DEBUG_CFLAGS=""
|
|---|
| 173 | rt_debug_msg=""
|
|---|
| 174 |
|
|---|
| 175 | AC_MSG_CHECKING([for low-level RASTER API debug mode])
|
|---|
| 176 | AC_ARG_ENABLE([rtapi-debug],
|
|---|
| 177 | AC_HELP_STRING([--enable-rtapi-debug=@<:@yes|no@:>@],
|
|---|
| 178 | [enable to debug low-level RASTER API @<:@default=no@:>@]
|
|---|
| 179 | ),
|
|---|
| 180 | [
|
|---|
| 181 | if test "x$enableval" = "xyes"; then
|
|---|
| 182 | rt_api_debug=1
|
|---|
| 183 | AC_DEFINE_UNQUOTED([RT_API_DEBUG], [$rt_api_debug], [debug low-level RASTER API])
|
|---|
| 184 | RT_API_DEBUG_CFLAGS="-DRT_API_DEBUG=$rt_api_debug"
|
|---|
| 185 | rt_debug_msg="enabled"
|
|---|
| 186 | else
|
|---|
| 187 | rt_debug_msg="disabled"
|
|---|
| 188 | fi
|
|---|
| 189 | ],
|
|---|
| 190 | [rt_debug_msg="disabled"]
|
|---|
| 191 | )
|
|---|
| 192 | AC_MSG_RESULT([$rt_debug_msg])
|
|---|
| 193 |
|
|---|
| 194 | AC_MSG_CHECKING([for PostGIS RASTER activity debug mode])
|
|---|
| 195 | AC_ARG_ENABLE([rtpg-debug],
|
|---|
| 196 | AC_HELP_STRING([--enable-rtpg-debug=@<:@yes|no@:>@],
|
|---|
| 197 | [enable to debug PostGIS RASTER activity @<:@default=no@:>@]
|
|---|
| 198 | ),
|
|---|
| 199 | [
|
|---|
| 200 | if test "x$enableval" = "xyes"; then
|
|---|
| 201 | rt_pg_debug=1
|
|---|
| 202 | AC_DEFINE_UNQUOTED([RT_PG_DEBUG], [$rt_pg_debug], [debug PostGIS RASTER activity])
|
|---|
| 203 | RT_PG_DEBUG_CFLAGS="$RT_PG_DEBUG_CFLAGS -DRT_PG_DEBUG=$rt_pg_debug"
|
|---|
| 204 | rt_debug_msg="enabled"
|
|---|
| 205 | else
|
|---|
| 206 | rt_debug_msg="disabled"
|
|---|
| 207 | fi
|
|---|
| 208 | ],
|
|---|
| 209 | [rt_debug_msg="disabled"]
|
|---|
| 210 | )
|
|---|
| 211 | AC_MSG_RESULT([$rt_debug_msg])
|
|---|
| 212 |
|
|---|
| 213 | AC_MSG_CHECKING([for PostGIS RASTER memory activity debug mode])
|
|---|
| 214 | AC_ARG_ENABLE([rtpgmem-debug],
|
|---|
| 215 | AC_HELP_STRING([--enable-rtpgmem-debug=@<:@yes|no@:>@],
|
|---|
| 216 | [enable to debug PostGIS RASTER memory activity @<:@default=no@:>@]
|
|---|
| 217 | ),
|
|---|
| 218 | [
|
|---|
| 219 | if test "x$enableval" = "xyes"; then
|
|---|
| 220 | rt_pgmem_debug=1
|
|---|
| 221 | AC_DEFINE_UNQUOTED([RT_PG_DEBUG_MEM], [$RT_PG_DEBUG_MEM], [debug PostGIS RASTER memory activity])
|
|---|
| 222 | RT_PG_DEBUG_CFLAGS="$RT_PG_DEBUG_CFLAGS -DRT_PG_DEBUG_MEM=$rt_pgmem_debug"
|
|---|
| 223 | rt_debug_msg="enabled"
|
|---|
| 224 | else
|
|---|
| 225 | rt_debug_msg="disabled"
|
|---|
| 226 | fi
|
|---|
| 227 | ],
|
|---|
| 228 | [rt_debug_msg="disabled"]
|
|---|
| 229 | )
|
|---|
| 230 | AC_MSG_RESULT([$rt_debug_msg])
|
|---|
| 231 |
|
|---|
| 232 | AC_SUBST([RT_API_DEBUG_CFLAGS])
|
|---|
| 233 | AC_SUBST([RT_PG_DEBUG_CFLAGS])
|
|---|
| 234 |
|
|---|
| 235 | dnl ===========================================================================
|
|---|
| 236 | dnl Detect CUnit if it is installed (used for unit testing)
|
|---|
| 237 | dnl
|
|---|
| 238 | dnl Note that we pass any specified CPPFLAGS and LDFLAGS into the Makefile
|
|---|
| 239 | dnl as CUnit is the only compile-time dependency that cannot obtain any
|
|---|
| 240 | dnl specialised flags using a --with-X parameter, and so we allow this
|
|---|
| 241 | dnl information to be passed in if required.
|
|---|
| 242 | dnl ===========================================================================
|
|---|
| 243 |
|
|---|
| 244 | CUNIT_LDFLAGS=""
|
|---|
| 245 | AC_CHECK_HEADER([CUnit/CUnit.h], [
|
|---|
| 246 | CUNIT_CPPFLAGS="$CPPFLAGS"
|
|---|
| 247 | AC_CHECK_LIB([cunit], [CU_initialize_registry], [CUNIT_LDFLAGS="$LDFLAGS -lcunit"], [AC_MSG_WARN([could not locate CUnit required for liblwgeom unit tests])])
|
|---|
| 248 | ],
|
|---|
| 249 | [
|
|---|
| 250 | AC_MSG_WARN([could not locate CUnit required for liblwgeom unit tests])
|
|---|
| 251 | ])
|
|---|
| 252 |
|
|---|
| 253 | AC_SUBST([CUNIT_CPPFLAGS])
|
|---|
| 254 | AC_SUBST([CUNIT_LDFLAGS])
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 | dnl ===========================================================================
|
|---|
| 258 | dnl Detect iconv if it is installed (used for shp2pgsql encoding conversion
|
|---|
| 259 | dnl if available)
|
|---|
| 260 | dnl ===========================================================================
|
|---|
| 261 |
|
|---|
| 262 | HAVE_ICONV_H=0
|
|---|
| 263 | AC_CHECK_HEADER([iconv.h], [HAVE_ICONV_H=1], [])
|
|---|
| 264 |
|
|---|
| 265 | dnl If we find the header file, try and link against the library
|
|---|
| 266 | if test "x$HAVE_ICONV_H" != "x0"; then
|
|---|
| 267 | dnl Check for iconv includes as part of libc
|
|---|
| 268 | AC_CHECK_LIB([c], [iconv_open], [ICONV_LDFLAGS=-lc HAVE_ICONV=1], [])
|
|---|
| 269 | if test "x$HAVE_ICONV" = "x"; then
|
|---|
| 270 | dnl If not found, check for iconv included as part of libiconv
|
|---|
| 271 | AC_CHECK_LIB([iconv], [iconv_open], [ICONV_LDFLAGS=-liconv HAVE_ICONV=1], [])
|
|---|
| 272 | if test "x$HAVE_ICONV" = "x"; then
|
|---|
| 273 | dnl If not found, check for Win32 iconv (some of them use a lib prefix for functions within the iconv DLLs)
|
|---|
| 274 | AC_CHECK_LIB([iconv], [libiconv_open], [ICONV_LDFLAGS=-liconv HAVE_ICONV=1], [])
|
|---|
| 275 | if test "x$HAVE_ICONV" = "x"; then
|
|---|
| 276 | dnl No iconv library was found; issue a warning to the console
|
|---|
| 277 | AC_MSG_WARN([could not find iconv library: no support for encoding conversion will be included])
|
|---|
| 278 | fi
|
|---|
| 279 | fi
|
|---|
| 280 | fi
|
|---|
| 281 | else
|
|---|
| 282 | dnl No iconv header was found; issue a warning to the console
|
|---|
| 283 | AC_MSG_WARN([could not find iconv.h header: no support for encoding conversion will be included])
|
|---|
| 284 | fi
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 | dnl Only define HAVE_ICONV in postgis_config.h if we detect iconv sucessfully
|
|---|
| 288 | if test "x$HAVE_ICONV" != "x"; then
|
|---|
| 289 | AC_DEFINE_UNQUOTED([HAVE_ICONV], [$HAVE_ICONV], [Defined if libiconv headers and library are present])
|
|---|
| 290 | fi
|
|---|
| 291 |
|
|---|
| 292 | AC_SUBST([ICONV_LDFLAGS])
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 | dnl ===========================================================================
|
|---|
| 296 | dnl Detect the version of PostgreSQL installed on the system
|
|---|
| 297 | dnl ===========================================================================
|
|---|
| 298 |
|
|---|
| 299 | AC_ARG_WITH([pgconfig],
|
|---|
| 300 | [AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file])],
|
|---|
| 301 | [PGCONFIG="$withval"], [PGCONFIG=""])
|
|---|
| 302 |
|
|---|
| 303 | if test "x$PGCONFIG" = "x"; then
|
|---|
| 304 | dnl PGCONFIG was not specified, so search within the current path
|
|---|
| 305 | AC_PATH_PROG([PGCONFIG], [pg_config])
|
|---|
| 306 |
|
|---|
| 307 | dnl If we couldn't find pg_config, display an error
|
|---|
| 308 | if test "x$PGCONFIG" = "x"; then
|
|---|
| 309 | 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.])
|
|---|
| 310 | fi
|
|---|
| 311 | else
|
|---|
| 312 | dnl PGCONFIG was specified; display a message to the user
|
|---|
| 313 | if test "x$PGCONFIG" = "xyes"; then
|
|---|
| 314 | AC_MSG_ERROR([you must specify a parameter to --with-pgconfig, e.g. --with-pgconfig=/path/to/pg_config])
|
|---|
| 315 | else
|
|---|
| 316 | if test -f $PGCONFIG; then
|
|---|
| 317 | AC_MSG_RESULT([Using user-specified pg_config file: $PGCONFIG])
|
|---|
| 318 | else
|
|---|
| 319 | AC_MSG_ERROR([the user-specified pg_config file $PGCONFIG does not exist])
|
|---|
| 320 | fi
|
|---|
| 321 | fi
|
|---|
| 322 | fi
|
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 | dnl ===========================================================================
|
|---|
| 326 | dnl Ensure that $PG_CONFIG --pgxs points to a valid file. This is because some
|
|---|
| 327 | dnl distributions such as Debian also include pg_config as part of libpq-dev
|
|---|
| 328 | dnl packages, but don't install the Makefile it points to unless
|
|---|
| 329 | dnl the postgresql-server-dev packages are installed :)
|
|---|
| 330 | dnl ===========================================================================
|
|---|
| 331 |
|
|---|
| 332 | PGXS=`$PGCONFIG --pgxs`
|
|---|
| 333 | if test ! -f $PGXS; then
|
|---|
| 334 | AC_MSG_ERROR([the PGXS Makefile $PGXS cannot be found. Please install the PostgreSQL server development packages and re-run configure.])
|
|---|
| 335 | fi
|
|---|
| 336 |
|
|---|
| 337 | AC_SUBST([PGXS])
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 | dnl Extract the version information from pg_config
|
|---|
| 341 | dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
|
|---|
| 342 | dnl the final version. This is to guard against user error...
|
|---|
| 343 | PGSQL_MAJOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
|
|---|
| 344 | PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
|
|---|
| 345 | RT_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
|
|---|
| 346 |
|
|---|
| 347 | dnl Ensure that we are using PostgreSQL >= 8.3
|
|---|
| 348 | if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then
|
|---|
| 349 | AC_MSG_ERROR([WKTRaster requires PostgreSQL >= 8.3])
|
|---|
| 350 | else
|
|---|
| 351 | if test "$PGSQL_MAJOR_VERSION" -eq 8; then
|
|---|
| 352 | if test ! "$PGSQL_MINOR_VERSION" -ge 3; then
|
|---|
| 353 | AC_MSG_ERROR([WKTRaster requires PostgreSQL >= 8.3])
|
|---|
| 354 | fi
|
|---|
| 355 | fi
|
|---|
| 356 | fi
|
|---|
| 357 |
|
|---|
| 358 | dnl Note: We don't need the server-side LDFLAGS or CPPFLAGS because we get these from PGXS
|
|---|
| 359 |
|
|---|
| 360 | dnl Extract the linker and include flags for the frontend (for programs that use libpq)
|
|---|
| 361 | PGSQL_FE_LDFLAGS=-L`$PGCONFIG --libdir`" -lpq"
|
|---|
| 362 | PGSQL_FE_CPPFLAGS=-I`$PGCONFIG --includedir`
|
|---|
| 363 |
|
|---|
| 364 | AC_SUBST([PGSQL_FE_LDFLAGS])
|
|---|
| 365 | AC_SUBST([PGSQL_FE_CPPFLAGS])
|
|---|
| 366 |
|
|---|
| 367 | dnl Extract the documentation and man page directories
|
|---|
| 368 | PGSQL_DOCDIR=`$PGCONFIG --docdir`
|
|---|
| 369 | PGSQL_MANDIR=`$PGCONFIG --mandir`
|
|---|
| 370 |
|
|---|
| 371 | AC_SUBST([PGSQL_DOCDIR])
|
|---|
| 372 | AC_SUBST([PGSQL_MANDIR])
|
|---|
| 373 |
|
|---|
| 374 | dnl Extract the executable directory
|
|---|
| 375 | PGSQL_BINDIR=`$PGCONFIG --bindir`
|
|---|
| 376 |
|
|---|
| 377 | AC_SUBST([PGSQL_BINDIR])
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 | dnl Ensure that we can parse libpq-fe.h
|
|---|
| 381 | CPPFLAGS_SAVE="$CPPFLAGS"
|
|---|
| 382 | CPPFLAGS="$PGSQL_FE_CPPFLAGS"
|
|---|
| 383 | AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([could not find libpq-fe.h])])
|
|---|
| 384 | CPPFLAGS="$CPPFLAGS_SAVE"
|
|---|
| 385 |
|
|---|
| 386 | dnl Ensure we can link against libpq
|
|---|
| 387 | LIBS_SAVE="$LIBS"
|
|---|
| 388 | LIBS="$PGSQL_FE_LDFLAGS"
|
|---|
| 389 | AC_CHECK_LIB([pq], [PQserverVersion],
|
|---|
| 390 | [],
|
|---|
| 391 | [AC_MSG_ERROR([could not find libpq])],
|
|---|
| 392 | [])
|
|---|
| 393 | LIBS="$LIBS_SAVE"
|
|---|
| 394 |
|
|---|
| 395 | AC_DEFINE_UNQUOTED([RT_PGSQL_VERSION], [$RT_PGSQL_VERSION], [PostgreSQL server version])
|
|---|
| 396 | AC_SUBST([RT_PGSQL_VERSION])
|
|---|
| 397 |
|
|---|
| 398 | dnl =========================================================================
|
|---|
| 399 | dnl DEVELOPMENT OPTION: Determine GDAL Support
|
|---|
| 400 | dnl
|
|---|
| 401 | dnl If "--enable-development" option is provided, set the "DEVELOPMENT" var
|
|---|
| 402 | dnl to true, and try to find GDAL (necessary for development options)
|
|---|
| 403 | dnl
|
|---|
| 404 | dnl TODO: Now, --with-gdal can have only 1 value: path to gdal-config. It
|
|---|
| 405 | dnl could be useful to allow path to GDAL tree, because the cflags and the
|
|---|
| 406 | dnl libs can be obtained from GDAL tree too, apart from gdal-config
|
|---|
| 407 | dnl How to get cflags and libs from GDAL tree?
|
|---|
| 408 | dnl
|
|---|
| 409 | dnl LIBGDAL_CFLAGS="-I$with_gdal/port -I$with_gdal/ogr -I$with_gdal/alg -I$with_gdal/gcore -I$with_gdal/frmts "
|
|---|
| 410 | dnl LIBGDAL_LDFLAGS="-L${with_gdal}/.libs -lgdal -L${with_gdal}/ -lgdal"
|
|---|
| 411 | dnl =========================================================================
|
|---|
| 412 | ENABLE_DEVELOPMENT_CFLAGS=""
|
|---|
| 413 | enable_development_msg=""
|
|---|
| 414 | LIBGDAL_CFLAGS=""
|
|---|
| 415 | LIBGDAL_LDFLAGS=""
|
|---|
| 416 |
|
|---|
| 417 | AC_MSG_CHECKING([for development mode])
|
|---|
| 418 | AC_ARG_ENABLE([development],
|
|---|
| 419 | AC_HELP_STRING([--enable-development=@<:@yes|no@:>@],
|
|---|
| 420 | [enable to allow development options (GDAL needed) @<:@default=no@:>@]
|
|---|
| 421 | ),
|
|---|
| 422 | [
|
|---|
| 423 | if test "x$enableval" = "xyes"; then
|
|---|
| 424 | enable_development=1
|
|---|
| 425 | AC_DEFINE_UNQUOTED([ENABLE_DEVELOPMENT], [$enable_development], [Enable development variable])
|
|---|
| 426 | ENABLE_DEVELOPMENT_CFLAGS="-DENABLE_DEVELOPMENT=$enable_development"
|
|---|
| 427 | enable_development_msg="enabled"
|
|---|
| 428 | else
|
|---|
| 429 | enable_development_msg="disabled"
|
|---|
| 430 | fi
|
|---|
| 431 | ],
|
|---|
| 432 | [enable_development_msg="disabled"]
|
|---|
| 433 | )
|
|---|
| 434 | AC_MSG_RESULT([$enable_development_msg])
|
|---|
| 435 |
|
|---|
| 436 | dnl ADD GDAL CHECKING INSIDE DEVELOPMENT
|
|---|
| 437 |
|
|---|
| 438 | if test "$enable_development" = "1"; then
|
|---|
| 439 | dnl not used right now
|
|---|
| 440 | USE_GDAL_SOURCE_TREE="no"
|
|---|
| 441 | AC_MSG_CHECKING([for GDAL])
|
|---|
| 442 | AC_ARG_WITH([gdal],
|
|---|
| 443 | AC_HELP_STRING([--with-gdal=@<:@ARG@:],[specify location of gdal-config (ARG=path)]),
|
|---|
| 444 | [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""])
|
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 | dnl If GDAL_CONFIG path not provided, try to find it
|
|---|
| 448 | if test "$GDAL_CONFIG" = ""; then
|
|---|
| 449 | GDAL_CONFIG_TMP=`which gdal-config`
|
|---|
| 450 | if test "`basename xx/${GDAL_CONFIG_TMP}`" = "gdal-config" ; then
|
|---|
| 451 | AC_MSG_RESULT([yes])
|
|---|
| 452 | GDAL_CONFIG=${GDAL_CONFIG_TMP}
|
|---|
| 453 | else
|
|---|
| 454 | AC_MSG_ERROR([gdal-config not found. Try --with-gdal=<path to gdal-config>])
|
|---|
| 455 | fi
|
|---|
| 456 | fi
|
|---|
| 457 |
|
|---|
| 458 | dnl Check for GDAL options
|
|---|
| 459 |
|
|---|
| 460 | AC_MSG_CHECKING([for GDAL version])
|
|---|
| 461 | GDAL_VERSION=`$GDAL_CONFIG --version`
|
|---|
| 462 | AC_MSG_RESULT([$GDAL_VERSION])
|
|---|
| 463 | LIBGDAL_CFLAGS=`$GDAL_CONFIG --cflags`
|
|---|
| 464 | LIBGDAL_LDFLAGS=`$GDAL_CONFIG --libs`
|
|---|
| 465 | fi
|
|---|
| 466 |
|
|---|
| 467 | AC_SUBST([LIBGDAL_CFLAGS])
|
|---|
| 468 | AC_SUBST([LIBGDAL_LDFLAGS])
|
|---|
| 469 | AC_SUBST([ENABLE_DEVELOPMENT_CFLAGS])
|
|---|
| 470 |
|
|---|
| 471 |
|
|---|
| 472 | dnl ===========================================================================
|
|---|
| 473 | dnl Find postgis sources, as we rely on liblwgeom
|
|---|
| 474 | dnl ===========================================================================
|
|---|
| 475 |
|
|---|
| 476 | POSTGIS_SRCDIR=""
|
|---|
| 477 | LIBLWGEOM_CFLAGS=""
|
|---|
| 478 | LIBLWGEOM_LDFLAGS=""
|
|---|
| 479 | AC_ARG_WITH([postgis-sources],
|
|---|
| 480 | [AC_HELP_STRING([--with-postgis-sources=DIR],
|
|---|
| 481 | [specify location of postgis sources])],
|
|---|
| 482 | [POSTGIS_SRCDIR="$withval"], [POSTGIS_SRCDIR=""])
|
|---|
| 483 |
|
|---|
| 484 | if test -f "$POSTGIS_SRCDIR/liblwgeom/liblwgeom.h"; then
|
|---|
| 485 | LIBLWGEOM_CFLAGS="-I${POSTGIS_SRCDIR}/liblwgeom"
|
|---|
| 486 | LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/liblwgeom.a"
|
|---|
| 487 | else
|
|---|
| 488 | AC_MSG_ERROR([${POSTGIS_SRCDIR} doesn't contain liblwgeom/liblwgeom.h or lwgeom/liblwgeom.h, try --with-postgis-sources=DIR (requires postgis svn version)])
|
|---|
| 489 | fi
|
|---|
| 490 |
|
|---|
| 491 | AC_SUBST([LIBLWGEOM_CFLAGS])
|
|---|
| 492 | AC_SUBST([LIBLWGEOM_LDFLAGS])
|
|---|
| 493 | AC_SUBST([POSTGIS_SRCDIR])
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 | dnl ===========================================================================
|
|---|
| 497 | dnl Detect the version of GEOS installed on the system
|
|---|
| 498 | dnl ===========================================================================
|
|---|
| 499 |
|
|---|
| 500 | AC_ARG_WITH([geosconfig],
|
|---|
| 501 | [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
|
|---|
| 502 | [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
|
|---|
| 503 |
|
|---|
| 504 | if test "x$GEOSCONFIG" = "x"; then
|
|---|
| 505 | dnl GEOSCONFIG was not specified, so search within the current path
|
|---|
| 506 | AC_PATH_PROG([GEOSCONFIG], [geos-config])
|
|---|
| 507 |
|
|---|
| 508 | dnl If we couldn't find geos-config, display an error
|
|---|
| 509 | if test "x$GEOSCONFIG" = "x"; then
|
|---|
| 510 | 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.])
|
|---|
| 511 | fi
|
|---|
| 512 | else
|
|---|
| 513 | dnl GEOSCONFIG was specified; display a message to the user
|
|---|
| 514 | if test "x$GEOSCONFIG" = "xyes"; then
|
|---|
| 515 | AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
|
|---|
| 516 | else
|
|---|
| 517 | if test -f $GEOSCONFIG; then
|
|---|
| 518 | AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
|
|---|
| 519 | else
|
|---|
| 520 | AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
|
|---|
| 521 | fi
|
|---|
| 522 | fi
|
|---|
| 523 | fi
|
|---|
| 524 |
|
|---|
| 525 | dnl-GEOS-dnl dnl ===========================================================================
|
|---|
| 526 | dnl-GEOS-dnl dnl Extract the version information from geos_config
|
|---|
| 527 | dnl-GEOS-dnl dnl and then combine to give the final version.
|
|---|
| 528 | dnl-GEOS-dnl dnl This is to guard against user error...
|
|---|
| 529 | dnl-GEOS-dnl dnl ===========================================================================
|
|---|
| 530 | dnl-GEOS-dnl
|
|---|
| 531 | dnl-GEOS-dnl GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
|
|---|
| 532 | dnl-GEOS-dnl GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
|
|---|
| 533 | dnl-GEOS-dnl RT_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
|
|---|
| 534 | dnl-GEOS-dnl
|
|---|
| 535 | dnl-GEOS-dnl dnl Ensure that we are using GEOS >= 2.2.0 (requires CAPI)
|
|---|
| 536 | dnl-GEOS-dnl if test ! "$GEOS_MAJOR_VERSION" -ge 2; then
|
|---|
| 537 | dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
|
|---|
| 538 | dnl-GEOS-dnl else
|
|---|
| 539 | dnl-GEOS-dnl if test "$GEOS_MAJOR_VERSION" -eq 2; then
|
|---|
| 540 | dnl-GEOS-dnl if test ! "$GEOS_MINOR_VERSION" -ge 2; then
|
|---|
| 541 | dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
|
|---|
| 542 | dnl-GEOS-dnl fi
|
|---|
| 543 | dnl-GEOS-dnl fi
|
|---|
| 544 | dnl-GEOS-dnl fi
|
|---|
| 545 | dnl-GEOS-dnl
|
|---|
| 546 | dnl-GEOS-dnl dnl Extract the linker and include flags
|
|---|
| 547 | dnl-GEOS-dnl GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
|
|---|
| 548 | dnl-GEOS-dnl GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
|
|---|
| 549 | dnl-GEOS-dnl
|
|---|
| 550 | dnl-GEOS-dnl dnl Ensure that we can parse geos_c.h
|
|---|
| 551 | dnl-GEOS-dnl CPPFLAGS_SAVE="$CPPFLAGS"
|
|---|
| 552 | dnl-GEOS-dnl CPPFLAGS="$GEOS_CPPFLAGS"
|
|---|
| 553 | dnl-GEOS-dnl 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])])
|
|---|
| 554 | dnl-GEOS-dnl CPPFLAGS="$CPPFLAGS_SAVE"
|
|---|
| 555 | dnl-GEOS-dnl
|
|---|
| 556 | dnl-GEOS-dnl dnl Ensure we can link against libgeos_c
|
|---|
| 557 | dnl-GEOS-dnl LIBS_SAVE="$LIBS"
|
|---|
| 558 | dnl-GEOS-dnl LIBS="$GEOS_LDFLAGS"
|
|---|
| 559 | dnl-GEOS-dnl AC_CHECK_LIB([geos_c], [initGEOS],
|
|---|
| 560 | dnl-GEOS-dnl [],
|
|---|
| 561 | dnl-GEOS-dnl [AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig])],
|
|---|
| 562 | dnl-GEOS-dnl [])
|
|---|
| 563 | dnl-GEOS-dnl LIBS="$LIBS_SAVE"
|
|---|
| 564 | dnl-GEOS-dnl
|
|---|
| 565 | dnl-GEOS-dnl AC_DEFINE_UNQUOTED([RT_GEOS_VERSION], [$RT_GEOS_VERSION], [GEOS library version])
|
|---|
| 566 | dnl-GEOS-dnl AC_SUBST([RT_GEOS_VERSION])
|
|---|
| 567 |
|
|---|
| 568 |
|
|---|
| 569 | dnl-PROJ4-dnl dnl ===========================================================================
|
|---|
| 570 | dnl-PROJ4-dnl dnl Detect the version of PROJ.4 installed
|
|---|
| 571 | dnl-PROJ4-dnl dnl ===========================================================================
|
|---|
| 572 | dnl-PROJ4-dnl
|
|---|
| 573 | dnl-PROJ4-dnl AC_ARG_WITH([projdir],
|
|---|
| 574 | dnl-PROJ4-dnl [AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
|
|---|
| 575 | dnl-PROJ4-dnl [PROJDIR="$withval"], [PROJDIR=""])
|
|---|
| 576 | dnl-PROJ4-dnl
|
|---|
| 577 | dnl-PROJ4-dnl if test ! "x$PROJDIR" = "x"; then
|
|---|
| 578 | dnl-PROJ4-dnl dnl Make sure that the directory exists
|
|---|
| 579 | dnl-PROJ4-dnl if test "x$PROJDIR" = "xyes"; then
|
|---|
| 580 | dnl-PROJ4-dnl AC_MSG_ERROR([you must specifiy a parameter to --with-projdir, e.g. --with-projdir=/path/to])
|
|---|
| 581 | dnl-PROJ4-dnl else
|
|---|
| 582 | dnl-PROJ4-dnl if test -d "$PROJDIR"; then
|
|---|
| 583 | dnl-PROJ4-dnl AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
|
|---|
| 584 | dnl-PROJ4-dnl
|
|---|
| 585 | dnl-PROJ4-dnl dnl Add the include directory to PROJ_CPPFLAGS
|
|---|
| 586 | dnl-PROJ4-dnl PROJ_CPPFLAGS="-I$PROJDIR/include"
|
|---|
| 587 | dnl-PROJ4-dnl PROJ_LDFLAGS="-L$PROJDIR/lib"
|
|---|
| 588 | dnl-PROJ4-dnl else
|
|---|
| 589 | dnl-PROJ4-dnl AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
|
|---|
| 590 | dnl-PROJ4-dnl fi
|
|---|
| 591 | dnl-PROJ4-dnl fi
|
|---|
| 592 | dnl-PROJ4-dnl fi
|
|---|
| 593 | dnl-PROJ4-dnl
|
|---|
| 594 | dnl-PROJ4-dnl
|
|---|
| 595 | dnl-PROJ4-dnl dnl Check that we can find the proj_api.h header file
|
|---|
| 596 | dnl-PROJ4-dnl CPPFLAGS_SAVE="$CPPFLAGS"
|
|---|
| 597 | dnl-PROJ4-dnl CPPFLAGS="$PROJ_CPPFLAGS"
|
|---|
| 598 | dnl-PROJ4-dnl 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])])
|
|---|
| 599 | dnl-PROJ4-dnl
|
|---|
| 600 | dnl-PROJ4-dnl dnl Return the PROJ.4 version number
|
|---|
| 601 | dnl-PROJ4-dnl AC_PROJ_VERSION([RT_PROJ_VERSION])
|
|---|
| 602 | dnl-PROJ4-dnl AC_DEFINE_UNQUOTED([RT_PROJ_VERSION], [$RT_PROJ_VERSION], [PROJ library version])
|
|---|
| 603 | dnl-PROJ4-dnl AC_SUBST([RT_PROJ_VERSION])
|
|---|
| 604 | dnl-PROJ4-dnl CPPFLAGS="$CPPFLAGS_SAVE"
|
|---|
| 605 | dnl-PROJ4-dnl
|
|---|
| 606 | dnl-PROJ4-dnl dnl Ensure that we are using PROJ >= 4.5.0 (requires pj_set_searchpath)
|
|---|
| 607 | dnl-PROJ4-dnl if test ! "$RT_PROJ_VERSION" -ge 45; then
|
|---|
| 608 | dnl-PROJ4-dnl AC_MSG_ERROR([PostGIS requires PROJ >= 4.5.0])
|
|---|
| 609 | dnl-PROJ4-dnl fi
|
|---|
| 610 | dnl-PROJ4-dnl
|
|---|
| 611 | dnl-PROJ4-dnl dnl Ensure we can link against libproj
|
|---|
| 612 | dnl-PROJ4-dnl LIBS_SAVE="$LIBS"
|
|---|
| 613 | dnl-PROJ4-dnl LIBS="$PROJ_LDFLAGS"
|
|---|
| 614 | dnl-PROJ4-dnl AC_CHECK_LIB([proj], [pj_get_release],
|
|---|
| 615 | dnl-PROJ4-dnl [],
|
|---|
| 616 | dnl-PROJ4-dnl [AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
|
|---|
| 617 | dnl-PROJ4-dnl [])
|
|---|
| 618 | dnl-PROJ4-dnl LIBS="$LIBS_SAVE"
|
|---|
| 619 |
|
|---|
| 620 |
|
|---|
| 621 | dnl ===========================================================================
|
|---|
| 622 | dnl Define version macros
|
|---|
| 623 | dnl
|
|---|
| 624 |
|
|---|
| 625 | RT_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION"
|
|---|
| 626 | RT_LIB_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION.$RT_MICRO_VERSION"
|
|---|
| 627 | RT_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
|
|---|
| 628 | RT_SCRIPTS_VERSION="$RT_LIB_VERSION"
|
|---|
| 629 |
|
|---|
| 630 | AC_DEFINE_UNQUOTED([RT_VERSION], ["$RT_VERSION"], [WKTRaster version])
|
|---|
| 631 | AC_DEFINE_UNQUOTED([RT_LIB_VERSION], ["$RT_LIB_VERSION"], [WKTRaster library version])
|
|---|
| 632 | AC_DEFINE_UNQUOTED([RT_BUILD_DATE], ["$RT_BUILD_DATE"], [WKTRaster build date])
|
|---|
| 633 | AC_DEFINE_UNQUOTED([RT_SCRIPTS_VERSION], ["$RT_SCRIPTS_VERSION"], [WKTRaster scripts version])
|
|---|
| 634 |
|
|---|
| 635 | AC_SUBST([RT_VERSION])
|
|---|
| 636 | AC_SUBST([RT_LIB_VERSION])
|
|---|
| 637 | AC_SUBST([RT_BUILD_DATE])
|
|---|
| 638 | AC_SUBST([RT_SCRIPTS_VERSION])
|
|---|
| 639 |
|
|---|
| 640 |
|
|---|
| 641 | dnl ===========================================================================
|
|---|
| 642 | dnl Other parameters
|
|---|
| 643 | dnl
|
|---|
| 644 |
|
|---|
| 645 | CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS"
|
|---|
| 646 | dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
|
|---|
| 647 |
|
|---|
| 648 | SHLIB_LINK="$PGSQL_LDFLAGS"
|
|---|
| 649 | AC_SUBST([SHLIB_LINK])
|
|---|
| 650 | dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
|
|---|
| 651 |
|
|---|
| 652 | dnl Output the relevant files
|
|---|
| 653 | AC_OUTPUT([
|
|---|
| 654 | rt_core/Makefile
|
|---|
| 655 | rt_pg/Makefile
|
|---|
| 656 | test/Makefile
|
|---|
| 657 | test/core/Makefile
|
|---|
| 658 | test/regress/Makefile
|
|---|
| 659 | scripts/Makefile
|
|---|
| 660 | ])
|
|---|
| 661 |
|
|---|
| 662 | dnl ===========================================================================
|
|---|
| 663 | echo
|
|---|
| 664 | echo "Version: ${RT_LIB_VERSION}"
|
|---|
| 665 | echo "Build date: ${RT_BUILD_DATE}"
|
|---|
| 666 | echo
|
|---|
| 667 | echo "Run make to build WKT Raster extension"
|
|---|