source: spike/wktraster/configure.ac@ 5232

Last change on this file since 5232 was 5232, checked in by jorgearevalo, 15 years ago

Added '—enable-development' option in configure script. If you provide this option, configure will try to find GDAL library and compile the version of wkt_r
aster_aswktpolygon function that uses GDAL.

  • Property svn:keywords set to
    Id
    Revision
File size: 24.4 KB
Line 
1dnl **********************************************************************
2dnl * $Id: configure.ac 5232 2010-02-12 10:19:28Z jorgearevalo $
3dnl *
4dnl * PostGIS - Spatial Types for PostgreSQL
5dnl * WKTRaster - RASTER type support for PostGIS
6dnl *
7dnl * http://postgis.refractions.net
8dnl * Copyright 2008 Mark Cave-Ayland
9dnl *
10dnl * This is free software; you can redistribute and/or modify it under
11dnl * the terms of the GNU General Public Licence. See the COPYING file.
12dnl *
13dnl **********************************************************************
14
15AC_INIT()
16AC_CONFIG_HEADERS([wktraster_config.h])
17AC_CONFIG_MACRO_DIR([macros])
18
19dnl Invoke libtool: we do this as it is the easiest way to find the PIC
20dnl flags required to build the libs
21AC_PROG_LIBTOOL
22
23dnl
24dnl Compilers
25dnl
26AC_PROG_CC
27AC_PROG_CPP
28AC_PROG_CXX
29
30dnl
31dnl Define PIC flags in PICFLAGS
32dnl (note: this variable is set as part of libtool initialisation above)
33dnl
34PICFLAGS="$lt_prog_compiler_pic"
35AC_SUBST([PICFLAGS])
36
37dnl
38dnl For GCC enable additional warning flags
39dnl -Wall and -Wmissing-prototypes (using macro included with libtool)
40dnl
41WARNFLAGS=""
42AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall],
43 [dummy_cv_Wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
44AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wmissing-prototypes],
45 [dummy_cv_Wmissing_prototypes], [-Wmissing-prototypes], [],
46 [WARNFLAGS="$WARNFLAGS -Wmissing-prototypes"], [])
47AC_SUBST([WARNFLAGS])
48
49dnl
50dnl Define executable suffix for use with the loader Makefiles
51dnl
52EXESUFFIX="$ac_cv_exeext"
53AC_SUBST([EXESUFFIX])
54
55dnl
56dnl Version Information imported from Version.config
57dnl
58RT_MAJOR_VERSION=`cat Version.config | grep RT_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
59RT_MINOR_VERSION=`cat Version.config | grep RT_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
60RT_MICRO_VERSION=`cat Version.config | grep RT_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
61
62AC_DEFINE_UNQUOTED([RT_MAJOR_VERSION], ["$RT_MAJOR_VERSION"], [WKTRaster major version])
63AC_DEFINE_UNQUOTED([RT_MINOR_VERSION], ["$RT_MINOR_VERSION"], [WKTRaster minor version])
64AC_DEFINE_UNQUOTED([RT_MICRO_VERSION], ["$RT_MICRO_VERSION"], [WKTRaster micro version])
65
66AC_SUBST([RT_MAJOR_VERSION])
67AC_SUBST([RT_MINOR_VERSION])
68AC_SUBST([RT_MICRO_VERSION])
69
70dnl
71dnl Search for flex/bison to build the parser
72dnl
73AC_PROG_LEX
74AC_PROG_YACC
75AC_SUBST([LEX])
76AC_SUBST([YACC])
77
78
79dnl ===========================================================================
80dnl Find components needed to build documentation
81dnl ===========================================================================
82dnl
83dnl Search for xsltproc which is required for building documentation
84dnl
85
86AC_PATH_PROG([XSLTPROC], [xsltproc], [])
87if test "x$XSLTPROC" = "x"; then
88 AC_MSG_WARN([xsltproc is not installed so documentation cannot be built])
89fi
90
91dnl
92dnl Search for db2pdf which is required for building PDF documentation
93dnl
94
95AC_PATH_PROG([DB2PDF], [db2pdf], [])
96if test "x$DB2PDF" = "x"; then
97 AC_MSG_WARN([db2pdf is not installed so PDF documentation cannot be built])
98fi
99
100dnl
101dnl Search for dblatex which is required for building PDF documentation
102dnl
103
104AC_PATH_PROG([DBLATEX], [dblatex], [])
105if test "x$DBLATEX" = "x"; then
106 AC_MSG_WARN([dblatex is not installed so PDF documentation cannot be built])
107fi
108
109dnl
110dnl Allow the user to specify the location of the html/docbook.xsl stylesheet
111dnl
112
113AC_ARG_WITH([xsldir],
114 [AS_HELP_STRING([--with-xsldir=PATH], [specify the directory containing the docbook.xsl stylesheet])],
115 [XSLBASE="$withval"], [XSLBASE=""])
116
117XSLBASE_AUTO=""
118if 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
139else
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
149fi
150
151dnl
152dnl If XSLBASE has been set then at this point we know it must be
153dnl valid and so we can just use it. If XSLBASE_AUTO has been set, and XSLBASE
154dnl is empty then a valid stylesheet was found in XSLBASE_AUTO so we
155dnl should use that. Otherwise just continue silently with a blank XSLBASE
156dnl variable which will trigger the error message in the documentation Makefile
157dnl
158
159if test "x$XSLBASE" = "x"; then
160 if test ! "x$XSLBASE_AUTO" = "x"; then
161 XSLBASE="$XSLBASE_AUTO"
162 fi
163fi
164
165AC_SUBST([XSLBASE])
166
167dnl ===========================================================================
168dnl Detect if various RT DEBUG modes requested
169dnl ===========================================================================
170
171RT_API_DEBUG_CFLAGS=""
172RT_PG_DEBUG_CFLAGS=""
173rt_debug_msg=""
174
175AC_MSG_CHECKING([for low-level RASTER API debug mode])
176AC_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)
192AC_MSG_RESULT([$rt_debug_msg])
193
194AC_MSG_CHECKING([for PostGIS RASTER activity debug mode])
195AC_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)
211AC_MSG_RESULT([$rt_debug_msg])
212
213AC_MSG_CHECKING([for PostGIS RASTER memory activity debug mode])
214AC_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)
230AC_MSG_RESULT([$rt_debug_msg])
231
232AC_SUBST([RT_API_DEBUG_CFLAGS])
233AC_SUBST([RT_PG_DEBUG_CFLAGS])
234
235dnl ===========================================================================
236dnl Detect CUnit if it is installed (used for unit testing)
237dnl
238dnl Note that we pass any specified CPPFLAGS and LDFLAGS into the Makefile
239dnl as CUnit is the only compile-time dependency that cannot obtain any
240dnl specialised flags using a --with-X parameter, and so we allow this
241dnl information to be passed in if required.
242dnl ===========================================================================
243
244CUNIT_LDFLAGS=""
245AC_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
253AC_SUBST([CUNIT_CPPFLAGS])
254AC_SUBST([CUNIT_LDFLAGS])
255
256
257dnl ===========================================================================
258dnl Detect iconv if it is installed (used for shp2pgsql encoding conversion
259dnl if available)
260dnl ===========================================================================
261
262HAVE_ICONV_H=0
263AC_CHECK_HEADER([iconv.h], [HAVE_ICONV_H=1], [])
264
265dnl If we find the header file, try and link against the library
266if 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
281else
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])
284fi
285
286
287dnl Only define HAVE_ICONV in postgis_config.h if we detect iconv sucessfully
288if test "x$HAVE_ICONV" != "x"; then
289 AC_DEFINE_UNQUOTED([HAVE_ICONV], [$HAVE_ICONV], [Defined if libiconv headers and library are present])
290fi
291
292AC_SUBST([ICONV_LDFLAGS])
293
294
295dnl ===========================================================================
296dnl Detect the version of PostgreSQL installed on the system
297dnl ===========================================================================
298
299AC_ARG_WITH([pgconfig],
300 [AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file])],
301 [PGCONFIG="$withval"], [PGCONFIG=""])
302
303if 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
311else
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
322fi
323
324
325dnl ===========================================================================
326dnl Ensure that $PG_CONFIG --pgxs points to a valid file. This is because some
327dnl distributions such as Debian also include pg_config as part of libpq-dev
328dnl packages, but don't install the Makefile it points to unless
329dnl the postgresql-server-dev packages are installed :)
330dnl ===========================================================================
331
332PGXS=`$PGCONFIG --pgxs`
333if 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.])
335fi
336
337AC_SUBST([PGXS])
338
339
340dnl Extract the version information from pg_config
341dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
342dnl the final version. This is to guard against user error...
343PGSQL_MAJOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
344PGSQL_MINOR_VERSION=`$PGCONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
345RT_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
346
347dnl Ensure that we are using PostgreSQL >= 8.3
348if test ! "$PGSQL_MAJOR_VERSION" -ge 8; then
349 AC_MSG_ERROR([WKTRaster requires PostgreSQL >= 8.3])
350else
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
356fi
357
358dnl Note: We don't need the server-side LDFLAGS or CPPFLAGS because we get these from PGXS
359
360dnl Extract the linker and include flags for the frontend (for programs that use libpq)
361PGSQL_FE_LDFLAGS=-L`$PGCONFIG --libdir`" -lpq"
362PGSQL_FE_CPPFLAGS=-I`$PGCONFIG --includedir`
363
364AC_SUBST([PGSQL_FE_LDFLAGS])
365AC_SUBST([PGSQL_FE_CPPFLAGS])
366
367dnl Extract the documentation and man page directories
368PGSQL_DOCDIR=`$PGCONFIG --docdir`
369PGSQL_MANDIR=`$PGCONFIG --mandir`
370
371AC_SUBST([PGSQL_DOCDIR])
372AC_SUBST([PGSQL_MANDIR])
373
374dnl Extract the executable directory
375PGSQL_BINDIR=`$PGCONFIG --bindir`
376
377AC_SUBST([PGSQL_BINDIR])
378
379
380dnl Ensure that we can parse libpq-fe.h
381CPPFLAGS_SAVE="$CPPFLAGS"
382CPPFLAGS="$PGSQL_FE_CPPFLAGS"
383AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([could not find libpq-fe.h])])
384CPPFLAGS="$CPPFLAGS_SAVE"
385
386dnl Ensure we can link against libpq
387LIBS_SAVE="$LIBS"
388LIBS="$PGSQL_FE_LDFLAGS"
389AC_CHECK_LIB([pq], [PQserverVersion],
390 [],
391 [AC_MSG_ERROR([could not find libpq])],
392 [])
393LIBS="$LIBS_SAVE"
394
395AC_DEFINE_UNQUOTED([RT_PGSQL_VERSION], [$RT_PGSQL_VERSION], [PostgreSQL server version])
396AC_SUBST([RT_PGSQL_VERSION])
397
398dnl =========================================================================
399dnl DEVELOPMENT OPTION: Determine GDAL Support
400dnl
401dnl If "--enable-development" option is provided, set the "DEVELOPMENT" var
402dnl to true, and try to find GDAL (necessary for development options)
403dnl
404dnl TODO: Now, --with-gdal can have only 1 value: path to gdal-config. It
405dnl could be useful to allow path to GDAL tree, because the cflags and the
406dnl libs can be obtained from GDAL tree too, apart from gdal-config
407dnl How to get cflags and libs from GDAL tree?
408dnl
409dnl LIBGDAL_CFLAGS="-I$with_gdal/port -I$with_gdal/ogr -I$with_gdal/alg -I$with_gdal/gcore -I$with_gdal/frmts "
410dnl LIBGDAL_LDFLAGS="-L${with_gdal}/.libs -lgdal -L${with_gdal}/ -lgdal"
411dnl =========================================================================
412ENABLE_DEVELOPMENT_CFLAGS=""
413enable_development_msg=""
414LIBGDAL_CFLAGS=""
415LIBGDAL_LDFLAGS=""
416
417AC_MSG_CHECKING([for development mode])
418AC_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)
434AC_MSG_RESULT([$enable_development_msg])
435
436dnl ADD GDAL CHECKING INSIDE DEVELOPMENT
437
438if 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`
465fi
466
467AC_SUBST([LIBGDAL_CFLAGS])
468AC_SUBST([LIBGDAL_LDFLAGS])
469AC_SUBST([ENABLE_DEVELOPMENT_CFLAGS])
470
471
472dnl ===========================================================================
473dnl Find postgis sources, as we rely on liblwgeom
474dnl ===========================================================================
475
476POSTGIS_SRCDIR=""
477LIBLWGEOM_CFLAGS=""
478LIBLWGEOM_LDFLAGS=""
479AC_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
484if test -f "$POSTGIS_SRCDIR/liblwgeom/liblwgeom.h"; then
485 LIBLWGEOM_CFLAGS="-I${POSTGIS_SRCDIR}/liblwgeom"
486 LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/liblwgeom.a"
487else
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)])
489fi
490
491AC_SUBST([LIBLWGEOM_CFLAGS])
492AC_SUBST([LIBLWGEOM_LDFLAGS])
493AC_SUBST([POSTGIS_SRCDIR])
494
495
496dnl ===========================================================================
497dnl Detect the version of GEOS installed on the system
498dnl ===========================================================================
499
500AC_ARG_WITH([geosconfig],
501 [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
502 [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
503
504if 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
512else
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
523fi
524
525dnl-GEOS-dnl dnl ===========================================================================
526dnl-GEOS-dnl dnl Extract the version information from geos_config
527dnl-GEOS-dnl dnl and then combine to give the final version.
528dnl-GEOS-dnl dnl This is to guard against user error...
529dnl-GEOS-dnl dnl ===========================================================================
530dnl-GEOS-dnl
531dnl-GEOS-dnl GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
532dnl-GEOS-dnl GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
533dnl-GEOS-dnl RT_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
534dnl-GEOS-dnl
535dnl-GEOS-dnl dnl Ensure that we are using GEOS >= 2.2.0 (requires CAPI)
536dnl-GEOS-dnl if test ! "$GEOS_MAJOR_VERSION" -ge 2; then
537dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
538dnl-GEOS-dnl else
539dnl-GEOS-dnl if test "$GEOS_MAJOR_VERSION" -eq 2; then
540dnl-GEOS-dnl if test ! "$GEOS_MINOR_VERSION" -ge 2; then
541dnl-GEOS-dnl AC_MSG_ERROR([PostGIS requires GEOS >= 2.2])
542dnl-GEOS-dnl fi
543dnl-GEOS-dnl fi
544dnl-GEOS-dnl fi
545dnl-GEOS-dnl
546dnl-GEOS-dnl dnl Extract the linker and include flags
547dnl-GEOS-dnl GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
548dnl-GEOS-dnl GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
549dnl-GEOS-dnl
550dnl-GEOS-dnl dnl Ensure that we can parse geos_c.h
551dnl-GEOS-dnl CPPFLAGS_SAVE="$CPPFLAGS"
552dnl-GEOS-dnl CPPFLAGS="$GEOS_CPPFLAGS"
553dnl-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])])
554dnl-GEOS-dnl CPPFLAGS="$CPPFLAGS_SAVE"
555dnl-GEOS-dnl
556dnl-GEOS-dnl dnl Ensure we can link against libgeos_c
557dnl-GEOS-dnl LIBS_SAVE="$LIBS"
558dnl-GEOS-dnl LIBS="$GEOS_LDFLAGS"
559dnl-GEOS-dnl AC_CHECK_LIB([geos_c], [initGEOS],
560dnl-GEOS-dnl [],
561dnl-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])],
562dnl-GEOS-dnl [])
563dnl-GEOS-dnl LIBS="$LIBS_SAVE"
564dnl-GEOS-dnl
565dnl-GEOS-dnl AC_DEFINE_UNQUOTED([RT_GEOS_VERSION], [$RT_GEOS_VERSION], [GEOS library version])
566dnl-GEOS-dnl AC_SUBST([RT_GEOS_VERSION])
567
568
569dnl-PROJ4-dnl dnl ===========================================================================
570dnl-PROJ4-dnl dnl Detect the version of PROJ.4 installed
571dnl-PROJ4-dnl dnl ===========================================================================
572dnl-PROJ4-dnl
573dnl-PROJ4-dnl AC_ARG_WITH([projdir],
574dnl-PROJ4-dnl [AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
575dnl-PROJ4-dnl [PROJDIR="$withval"], [PROJDIR=""])
576dnl-PROJ4-dnl
577dnl-PROJ4-dnl if test ! "x$PROJDIR" = "x"; then
578dnl-PROJ4-dnl dnl Make sure that the directory exists
579dnl-PROJ4-dnl if test "x$PROJDIR" = "xyes"; then
580dnl-PROJ4-dnl AC_MSG_ERROR([you must specifiy a parameter to --with-projdir, e.g. --with-projdir=/path/to])
581dnl-PROJ4-dnl else
582dnl-PROJ4-dnl if test -d "$PROJDIR"; then
583dnl-PROJ4-dnl AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
584dnl-PROJ4-dnl
585dnl-PROJ4-dnl dnl Add the include directory to PROJ_CPPFLAGS
586dnl-PROJ4-dnl PROJ_CPPFLAGS="-I$PROJDIR/include"
587dnl-PROJ4-dnl PROJ_LDFLAGS="-L$PROJDIR/lib"
588dnl-PROJ4-dnl else
589dnl-PROJ4-dnl AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
590dnl-PROJ4-dnl fi
591dnl-PROJ4-dnl fi
592dnl-PROJ4-dnl fi
593dnl-PROJ4-dnl
594dnl-PROJ4-dnl
595dnl-PROJ4-dnl dnl Check that we can find the proj_api.h header file
596dnl-PROJ4-dnl CPPFLAGS_SAVE="$CPPFLAGS"
597dnl-PROJ4-dnl CPPFLAGS="$PROJ_CPPFLAGS"
598dnl-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])])
599dnl-PROJ4-dnl
600dnl-PROJ4-dnl dnl Return the PROJ.4 version number
601dnl-PROJ4-dnl AC_PROJ_VERSION([RT_PROJ_VERSION])
602dnl-PROJ4-dnl AC_DEFINE_UNQUOTED([RT_PROJ_VERSION], [$RT_PROJ_VERSION], [PROJ library version])
603dnl-PROJ4-dnl AC_SUBST([RT_PROJ_VERSION])
604dnl-PROJ4-dnl CPPFLAGS="$CPPFLAGS_SAVE"
605dnl-PROJ4-dnl
606dnl-PROJ4-dnl dnl Ensure that we are using PROJ >= 4.5.0 (requires pj_set_searchpath)
607dnl-PROJ4-dnl if test ! "$RT_PROJ_VERSION" -ge 45; then
608dnl-PROJ4-dnl AC_MSG_ERROR([PostGIS requires PROJ >= 4.5.0])
609dnl-PROJ4-dnl fi
610dnl-PROJ4-dnl
611dnl-PROJ4-dnl dnl Ensure we can link against libproj
612dnl-PROJ4-dnl LIBS_SAVE="$LIBS"
613dnl-PROJ4-dnl LIBS="$PROJ_LDFLAGS"
614dnl-PROJ4-dnl AC_CHECK_LIB([proj], [pj_get_release],
615dnl-PROJ4-dnl [],
616dnl-PROJ4-dnl [AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
617dnl-PROJ4-dnl [])
618dnl-PROJ4-dnl LIBS="$LIBS_SAVE"
619
620
621dnl ===========================================================================
622dnl Define version macros
623dnl
624
625RT_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION"
626RT_LIB_VERSION="$RT_MAJOR_VERSION.$RT_MINOR_VERSION.$RT_MICRO_VERSION"
627RT_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
628RT_SCRIPTS_VERSION="$RT_LIB_VERSION"
629
630AC_DEFINE_UNQUOTED([RT_VERSION], ["$RT_VERSION"], [WKTRaster version])
631AC_DEFINE_UNQUOTED([RT_LIB_VERSION], ["$RT_LIB_VERSION"], [WKTRaster library version])
632AC_DEFINE_UNQUOTED([RT_BUILD_DATE], ["$RT_BUILD_DATE"], [WKTRaster build date])
633AC_DEFINE_UNQUOTED([RT_SCRIPTS_VERSION], ["$RT_SCRIPTS_VERSION"], [WKTRaster scripts version])
634
635AC_SUBST([RT_VERSION])
636AC_SUBST([RT_LIB_VERSION])
637AC_SUBST([RT_BUILD_DATE])
638AC_SUBST([RT_SCRIPTS_VERSION])
639
640
641dnl ===========================================================================
642dnl Other parameters
643dnl
644
645CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS"
646dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
647
648SHLIB_LINK="$PGSQL_LDFLAGS"
649AC_SUBST([SHLIB_LINK])
650dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
651
652dnl Output the relevant files
653AC_OUTPUT([
654rt_core/Makefile
655rt_pg/Makefile
656test/Makefile
657test/core/Makefile
658test/regress/Makefile
659scripts/Makefile
660])
661
662dnl ===========================================================================
663echo
664echo "Version: ${RT_LIB_VERSION}"
665echo "Build date: ${RT_BUILD_DATE}"
666echo
667echo "Run make to build WKT Raster extension"
Note: See TracBrowser for help on using the repository browser.