1dnl **********************************************************************
2dnl *
3dnl * PostGIS - Spatial Types for PostgreSQL
4dnl * http://postgis.net
5dnl * Copyright 2008 Mark Cave-Ayland
6dnl *
7dnl * This is free software; you can redistribute and/or modify it under
8dnl * the terms of the GNU General Public Licence. See the COPYING file.
9dnl *
10dnl **********************************************************************
11
12AC_INIT()
13AC_CONFIG_HEADERS([postgis_config.h])
14AC_CONFIG_MACRO_DIR([macros])
15AC_CONFIG_AUX_DIR([build-aux])
16AC_PROG_INSTALL
17
18
19dnl Invoke libtool: we do this as it is the easiest way to find the PIC
20dnl flags required to build liblwgeom
21AC_PROG_LIBTOOL
22
23dnl
24dnl Compilers
25dnl
26AC_PROG_CC
27AC_PROG_CPP
28AC_PROG_GREP
29
30dnl
31dnl SQL Preprocessor
32dnl
33AC_PATH_PROG([CPPBIN], [cpp], [])
34if test "x$CPPBIN" != "x"; then
35  SQLPP="${CPPBIN} -traditional-cpp -w -P"
36else
37  AC_PATH_PROG([GPP], [gpp_], [])
38  if test "x$GPP" != "x"; then
39    SQLPP="${GPP} -C -s \'" dnl Use better string support
40  else
41    if test "x${CPP}" != "x"; then
42      SQLPP="${CPP} -traditional-cpp"
43    else
44		  AC_MSG_ERROR([Required "cpp" command not found])
45    fi
46  fi
47fi
48AC_SUBST([SQLPP])
49
50dnl
51dnl Silence warning: ar: 'u' modifier ignored since 'D' is the default
52dnl
53AC_SUBST(AR_FLAGS, [cr])
54
55dnl
56dnl Define PIC flags in PICFLAGS (note: this variable is set as part of libtool initialisation above)
57dnl
58PICFLAGS="$lt_prog_compiler_pic"
59AC_SUBST([PICFLAGS])
60
61dnl
62dnl For GCC enable additional warning flags -Wall and -Wmissing-prototypes (using macro included with libtool)
63dnl
64WARNFLAGS=""
65AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
66AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wmissing-prototypes], [_cv_misprot], [-Wmissing-prototypes], [], [WARNFLAGS="$WARNFLAGS -Wmissing-prototypes"], [])
67AC_SUBST([WARNFLAGS])
68
69dnl
70dnl For some GCC versions and platforms, floating point issues need to be
71dnl ironed out.
72NUMERICFLAGS=""
73AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
74AC_SUBST([NUMERICFLAGS])
75
76dnl
77dnl Exporting used library symbols in the module is a source of issues,
78dnl see https://trac.osgeo.org/postgis/ticket/3281
79dnl
80EXCLUDELIBS_LDFLAGS=""
81AC_LIBTOOL_LINKER_OPTION([if $compiler supports --exclude-libs], [_cv_exclude_libs], [[-Wl,--exclude-libs,ALL]], [EXCLUDELIBS_LDFLAGS="-Wl,--exclude-libs,ALL"])
82AC_SUBST([EXCLUDELIBS_LDFLAGS])
83
84dnl
85dnl Define executable suffix for use with the loader Makefiles
86dnl
87EXESUFFIX="$ac_cv_exeext"
88AC_SUBST([EXESUFFIX])
89
90dnl
91dnl Version Information imported from Version.config
92dnl
93POSTGIS_MAJOR_VERSION=`cat Version.config | grep ^POSTGIS_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
94POSTGIS_MINOR_VERSION=`cat Version.config | grep ^POSTGIS_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
95POSTGIS_MICRO_VERSION=`cat Version.config | grep ^POSTGIS_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
96
97AC_DEFINE_UNQUOTED([POSTGIS_MAJOR_VERSION], ["$POSTGIS_MAJOR_VERSION"], [PostGIS major version])
98AC_DEFINE_UNQUOTED([POSTGIS_MINOR_VERSION], ["$POSTGIS_MINOR_VERSION"], [PostGIS minor version])
99AC_DEFINE_UNQUOTED([POSTGIS_MICRO_VERSION], ["$POSTGIS_MICRO_VERSION"], [PostGIS micro version])
100
101AC_SUBST([POSTGIS_MAJOR_VERSION])
102AC_SUBST([POSTGIS_MINOR_VERSION])
103AC_SUBST([POSTGIS_MICRO_VERSION])
104
105dnl
106dnl Liblwgeom version information imported from Version.config
107dnl
108LIBLWGEOM_CURRENT=`cat Version.config | grep ^LIBLWGEOM_IFACE_CUR | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
109LIBLWGEOM_AGE=`cat Version.config | grep ^LIBLWGEOM_IFACE_AGE | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
110LIBLWGEOM_REV=`cat Version.config | grep ^LIBLWGEOM_IFACE_REV | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
111AC_SUBST([LIBLWGEOM_CURRENT])
112AC_SUBST([LIBLWGEOM_AGE])
113AC_SUBST([LIBLWGEOM_REV])
114
115
116dnl
117dnl Search for flex/bison to build the parser
118dnl
119
120AC_PROG_LEX
121AC_PROG_YACC
122AC_SUBST([LEX])
123AC_SUBST([YACC])
124
125dnl
126dnl Search for OS-specific headers
127dnl
128AC_CHECK_HEADER([ieeefp.h], [HAVE_IEEEFP_H=1], [HAVE_IEEEFP_H=0])
129AC_DEFINE_UNQUOTED([HAVE_IEEEFP_H], [$HAVE_IEEEFP_H], [ieeefp.h header])
130AC_CHECK_HEADER([termios.h], [HAVE_TERMIOS_H=1], [HAVE_TERMIOS_H=0])
131AC_DEFINE_UNQUOTED([HAVE_TERMIOS_H], [$HAVE_TERMIOS_H], [termios.h header])
132
133
134dnl
135dnl Check for platform-specific functions
136dnl
137AC_CHECK_FUNC(vasprintf, AC_DEFINE([HAVE_VASPRINTF]))
138AC_CHECK_FUNC(asprintf, AC_DEFINE([HAVE_ASPRINTF]))
139AC_FUNC_FSEEKO()
140
141dnl
142dnl First see if we have isfinite in basic header
143dnl then check to see if it's a GNU extension
144dnl
145AC_CHECK_DECL(isfinite,
146  [AC_DEFINE([HAVE_ISFINITE])],
147  [],
148  [#include <math.h>])
149
150dnl Clear the cache
151unset ac_cv_have_decl_isfinite
152
153AC_CHECK_DECL(isfinite,
154  AC_DEFINE([HAVE_GNU_ISFINITE]),
155  [],
156  [[
157    #define _GNU_SOURCE
158    #include <math.h>
159  ]])
160
161dnl
162dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
163dnl for in-place regression tests
164dnl
165case $host_os in
166         *mingw*)
167                 MINGWBUILD=1
168                 ;;
169         *)
170                 MINGWBUILD=0
171                 ;;
172esac
173AC_SUBST([MINGWBUILD])
174
175AC_PATH_PROG([PERL], [perl], [])
176if test "x$PERL" = "x"; then
177        AC_MSG_ERROR([Perl was not found. Building PostGIS requires Perl.])
178fi
179AC_SUBST([PERL])
180
181dnl ===========================================================================
182dnl Find components needed to build documentation
183dnl ===========================================================================
184dnl
185dnl Search for xsltproc which is required for building documentation
186dnl
187
188CAN_BUILD_COMMENTS=yes
189
190AC_PATH_PROG([XSLTPROC], [xsltproc], [])
191if test "x$XSLTPROC" = "x"; then
192	AC_MSG_WARN([xsltproc is not installed so documentation cannot be built])
193  CAN_BUILD_COMMENTS=no
194fi
195
196CAN_BUILD_PDF=${CAN_BUILD_COMMENTS}
197
198AC_PATH_PROG([IMAGEMAGICK], [convert], [])
199if test "x$IMAGEMAGICK" = "x"; then
200	AC_MSG_WARN([ImageMagick does not seem to be installed. Documentation cannot be built])
201  CAN_BUILD_PDF=no
202fi
203
204AC_PATH_PROG([DBLATEX], [dblatex], [])
205if test "x$DBLATEX" = "x"; then
206	AC_MSG_WARN([dblatex is not installed so PDF documentation cannot be built])
207  CAN_BUILD_PDF=no
208fi
209
210AC_SUBST(CAN_BUILD_COMMENTS)
211AC_SUBST(CAN_BUILD_PDF)
212
213AC_PATH_PROG([XMLLINT], [xmllint], [])
214if test "x$XMLLINT" = "x"; then
215	AC_MSG_WARN([xmllint is not installed so documentation cannot be checked])
216fi
217
218
219dnl
220dnl Allow the user to specify the location of the html/docbook.xsl stylesheet
221dnl
222
223AC_ARG_WITH([xsldir],
224	[AS_HELP_STRING([--with-xsldir=PATH], [specify the directory containing the docbook.xsl stylesheet])],
225	[XSLBASE="$withval"], [XSLBASE=""])
226
227XSLBASE_AUTO=""
228if test "x$XSLBASE" = "x"; then
229	dnl If the user did not specify a directory for the docbook
230	dnl stylesheet, choose the first directory
231	dnl that matches from the following list
232	SEARCHPATH="
233		/usr/share/sgml/docbook/xsl-stylesheets
234		/usr/share/xml/docbook/stylesheet/docbook-xsl
235		/usr/share/xml/docbook/stylesheet/nwalsh
236		/usr/share/sgml/docbook/stylesheet/xsl/nwalsh
237		/opt/local/share/xsl/docbook-xsl
238		/usr/local/share/xsl/docbook-xsl
239		/usr/share/xsl/docbook-xsl
240		"
241	for p in ${SEARCHPATH}; do
242		if test -r "${p}"/html/docbook.xsl; then
243			XSLBASE_AUTO="${p}"
244			break
245		fi
246	done
247
248	dnl Check to see if the automatically searched paths above located a
249	dnl valid Docbook stylesheet
250	if test "x$XSLBASE_AUTO" = "x"; then
251		AC_MSG_WARN([could not locate Docbook stylesheets required to build the documentation])
252	fi
253else
254	dnl The user specified an alternate directory so make sure everything
255	dnl looks sensible
256	if test ! -d "$XSLBASE"; then
257		AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not exist])
258	fi
259
260	if test ! -f "$XSLBASE/html/docbook.xsl"; then
261		AC_MSG_ERROR([the docbook stylesheet directory specified using --with-xsldir does not contain the html/docbook.xsl file])
262	fi
263fi
264
265dnl
266dnl If XSLBASE has been set then at this point we know it must be
267dnl valid and so we can just use it. If XSLBASE_AUTO has been set, and XSLBASE
268dnl is empty then a valid stylesheet was found in XSLBASE_AUTO so we
269dnl should use that. Otherwise just continue silently with a blank XSLBASE
270dnl variable which will trigger the error message in the documentation Makefile
271dnl
272
273if test "x$XSLBASE" = "x"; then
274	if test ! "x$XSLBASE_AUTO" = "x"; then
275		XSLBASE="$XSLBASE_AUTO"
276	fi
277fi
278
279AC_SUBST([XSLBASE])
280
281dnl
282dnl Let's see if we can find mathml2.dtd
283dnl
284AC_ARG_WITH([mathmldtd],
285	[AS_HELP_STRING([--with-mathmldtd=PATH], [specify the dtd path for mathml2.dtd])],
286	[MATHML2_DTD="$withval"], [MATHML2_DTD=""])
287dnl TODO: get more paths to add here...
288if test "x$MATHML2_DTD" = "x"; then
289	MATHML2_DTD="http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"
290	SEARCHPATH="
291			/usr/share/xml/schema/w3c/mathml/dtd
292			"
293	for p in ${SEARCHPATH}; do
294		if test -r "${p}"/mathml2.dtd; then
295			MATHML2_DTD="${p}/mathml2.dtd"
296			break
297		fi
298	done
299fi
300AC_SUBST([MATHML2_DTD])
301
302dnl ===========================================================================
303dnl Detect if pkg-config installed
304dnl ===========================================================================
305# check for pkg-config
306PKG_PROG_PKG_CONFIG
307if test -z "$PKG_CONFIG"; then
308   AC_MSG_WARN([Cannot find pkg-config, make sure it is installed in your PATH])
309fi
310
311
312dnl ===========================================================================
313dnl Detect CUnit if it is installed (used for unit testing)
314dnl
315dnl Note that we pass any specified CPPFLAGS and LDFLAGS into the Makefile
316dnl as CUnit is the only compile-time dependency that cannot obtain any
317dnl specialised flags using a --with-X parameter, and so we allow this
318dnl information to be passed in if required.
319dnl ===========================================================================
320
321CUNIT_LDFLAGS=""
322AC_CHECK_HEADER([CUnit/CUnit.h], [
323	CUNIT_CPPFLAGS="$CPPFLAGS"
324	AC_CHECK_LIB([cunit], [CU_initialize_registry], [CUNIT_LDFLAGS="$LDFLAGS -lcunit"], [AC_MSG_WARN([could not locate CUnit required for unit tests])])
325	],
326	[
327	AC_MSG_WARN([could not locate CUnit required for unit tests])
328	])
329
330AC_SUBST([CUNIT_CPPFLAGS])
331AC_SUBST([CUNIT_LDFLAGS])
332
333
334dnl ===========================================================================
335dnl Detect iconv if it is installed (used for shp2pgsql encoding conversion
336dnl if available)
337dnl ===========================================================================
338
339ICONV_CFLAGS=""
340ICONV_LDFLAGS=""
341
342AC_ARG_WITH([libiconv],
343	[AS_HELP_STRING([--with-libiconv=PATH], [specify a path to non-default libiconv installation])],
344	[LIBICONV_PATH="$withval"], [LIBICONV_PATH=""])
345
346LDFLAGS_SAVE="$LDFLAGS"
347CFLAGS_SAVE="$CFLAGS"
348
349if test "x$LIBICONV_PATH" != "x"; then
350	AC_MSG_RESULT([checking user-specified libiconv location: $LIBICONV_PATH])
351	ICONV_CFLAGS="-I$LIBICONV_PATH/include"
352	ICONV_LDFLAGS="-L$LIBICONV_PATH/lib"
353	LDFLAGS="$ICONV_LDFLAGS $LDFLAGS"
354	CFLAGS="$ICONV_CFLAGS $CFLAGS"
355fi
356
357HAVE_ICONV_H=0
358AC_CHECK_HEADER([iconv.h], [HAVE_ICONV_H=1], [])
359
360dnl If we find the header file, try and link against the library
361if test "x$HAVE_ICONV_H" = "x1"; then
362	dnl libconv defines iconv_open to libiconv_open, so we'll check that directly
363	AC_CHECK_LIB([iconv], [libiconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
364	if test "x$HAVE_ICONV" = "x"; then
365	        dnl Check for iconv included as part of libc, using iconv_open
366	        AC_CHECK_LIB([c], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -lc" HAVE_ICONV=1], [])
367		if test "x$HAVE_ICONV" = "x"; then
368			dnl But it's possible this implementation of libiconv doesn't have a libiconv_* define
369			AC_CHECK_LIB([iconv], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
370			if test "x$HAVE_ICONV" = "x"; then
371				dnl No iconv library was found; issue a warning to the console
372				AC_MSG_ERROR([Could not find libiconv. Please install libiconv and libiconv-devel.])
373			fi
374		fi
375	fi
376else
377	dnl No iconv header was found; issue a warning to the console
378	AC_MSG_ERROR([Could not find iconv.h header. Please install libiconv and libiconv-devel.])
379fi
380
381AC_CHECK_FUNCS([iconvctl libiconvctl],[],[])
382
383LDFLAGS="$LDFLAGS_SAVE"
384CFLAGS="$CFLAGS_SAVE"
385
386dnl Only define HAVE_ICONV in postgis_config.h if we detect iconv sucessfully
387if test "x$HAVE_ICONV" != "x"; then
388	AC_DEFINE_UNQUOTED([HAVE_ICONV], [$HAVE_ICONV], [Defined if libiconv headers and library are present])
389fi
390
391AC_SUBST([ICONV_LDFLAGS])
392AC_SUBST([ICONV_CFLAGS])
393
394LIBLWGEOM_ONLY="no"
395AC_SUBST([LIBLWGEOM_ONLY])
396
397dnl ===========================================================================
398dnl Detect the version of PostgreSQL installed on the system, if needed
399dnl ===========================================================================
400
401AC_ARG_VAR(PG_CONFIG, [PostgreSQL configure command to determine Postgres version to build against.])
402AC_ARG_WITH([pgconfig],
403	[AS_HELP_STRING([--with-pgconfig=FILE], [specify an alternative pg_config file or disable postgresql (--without-pgconfig)])],
404	[PG_CONFIG="$withval"], [])
405
406if test "x$PG_CONFIG" = "xno"; then
407	LIBLWGEOM_ONLY="yes"
408	AC_MSG_RESULT([PostgreSQL support disabled])
409
410elif test "x$PG_CONFIG" = "x"; then
411	dnl PG_CONFIG was not specified, so search within the current path
412	AC_PATH_PROG([PG_CONFIG], [pg_config])
413
414	dnl If we couldn't find pg_config, display an error
415	if test "x$PG_CONFIG" = "x"; then
416		AC_MSG_ERROR([could not find pg_config within the current path. You may need to re-run configure with a --with-pgconfig parameter.])
417	fi
418else
419	dnl PG_CONFIG was specified; display a message to the user
420	if test "x$PG_CONFIG" = "xyes"; then
421		AC_MSG_ERROR([you must specify a parameter to --with-pgconfig, e.g. --with-pgconfig=/path/to/pg_config])
422	else
423		if test -f "$PG_CONFIG"; then
424			AC_MSG_RESULT([Using user-specified pg_config file: $PG_CONFIG])
425		else
426			AC_MSG_ERROR([the user-specified pg_config file $PG_CONFIG does not exist])
427		fi
428	fi
429fi
430
431if test "x$LIBLWGEOM_ONLY" = "xno"; then
432
433  dnl ===========================================================================
434  dnl Ensure that $PG_CONFIG --pgxs points to a valid file. This is because some
435  dnl distributions such as Debian also include pg_config as part of libpq-dev
436  dnl packages, but don't install the Makefile it points to unless
437  dnl the postgresql-server-dev packages are installed :)
438  dnl ===========================================================================
439
440  PGXS=`"$PG_CONFIG" --pgxs`
441  if test "x$PGXS" = "x" -o ! -f "$PGXS"; then
442    AC_MSG_ERROR([the PGXS Makefile $PGXS cannot be found. Please install the PostgreSQL server development packages and re-run configure.])
443  fi
444
445  AC_SUBST([PGXS])
446
447  dnl Extract the version information from pg_config
448  dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
449  dnl the final version. This is to guard against user error...
450  PGSQL_FULL_VERSION=`"$PG_CONFIG" --version`
451
452  PGSQL_MAJOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^0-9]]*\([[0-9]]*\).*/\1/'`
453  PGSQL_MINOR_VERSION=`$PG_CONFIG --version | sed 's/[[^0-9]]*\([[0-9]]\)\.\([[0-9]]\).*/\2/'`
454
455  if test $PGSQL_MAJOR_VERSION -gt 9; then
456  	dnl ==================================================================
457  	dnl Starting with PostgreSQL 10, major is the new minor
458  	dnl This is to prevent things like 10.31 ranking higher than 11.0
459  	dnl===================================================================
460  	PGSQL_MINOR_VERSION=0
461  fi
462
463  POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
464
465  PGSQL_PKGLIBDIR=`"$PG_CONFIG" --pkglibdir`
466  PGSQL_LIBDIR=`"$PG_CONFIG" --libdir`
467  PGSQL_SHAREDIR=`"$PG_CONFIG" --sharedir`
468
469  AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
470  dnl Ensure that we are using PostgreSQL >= 9.4
471  if test $POSTGIS_PGSQL_VERSION -lt 94; then
472    AC_MSG_ERROR([PostGIS requires PostgreSQL >= 9.4])
473  fi
474
475  HAVE_BRIN=no
476  if test $POSTGIS_PGSQL_VERSION -gt 94; then
477    HAVE_BRIN=yes
478  fi
479
480  HAVE_SPGIST=no
481  if test $POSTGIS_PGSQL_VERSION -gt 100; then
482    HAVE_SPGIST=yes
483  fi
484
485  dnl Note: We don't need the server-side LDFLAGS or CPPFLAGS because we get these from PGXS
486
487  dnl Extract the linker and include flags for the frontend (for programs that use libpq)
488  PGSQL_FE_LDFLAGS=-L`"$PG_CONFIG" --libdir`" -lpq"
489  PGSQL_FE_CPPFLAGS=-I`"$PG_CONFIG" --includedir`
490
491  AC_SUBST([PGSQL_FE_LDFLAGS])
492  AC_SUBST([PGSQL_FE_CPPFLAGS])
493
494  dnl Extract the include flags for the backend (libpgcommon)
495  PGSRV_INC=`"$PG_CONFIG" --includedir-server`
496  PGSQL_BE_CPPFLAGS="-I${PGSRV_INC}"
497  dnl Add $PGSRV_INC/port/win32 to MinGW build to pick up netdb.h
498  case $host in
499    *mingw32*)
500      PGSQL_BE_CPPFLAGS="${PGSQL_BE_CPPFLAGS} -I${PGSRV_INC}/port/win32"
501      ;;
502  esac
503
504  AC_SUBST([PGSQL_BE_CPPFLAGS])
505
506  dnl Extract the documentation and man page directories
507  PGSQL_DOCDIR=`"$PG_CONFIG" --docdir`
508  PGSQL_MANDIR=`"$PG_CONFIG" --mandir`
509
510  AC_SUBST([PGSQL_DOCDIR])
511  AC_SUBST([PGSQL_MANDIR])
512
513  dnl Extract the locale directory
514  PGSQL_LOCALEDIR=`"$PG_CONFIG" --localedir`
515  AC_DEFINE_UNQUOTED([PGSQL_LOCALEDIR], ["$PGSQL_LOCALEDIR"], [Location of PostgreSQL locale directory])
516
517  dnl Extract the executable directory
518  PGSQL_BINDIR=`"$PG_CONFIG" --bindir`
519
520  AC_SUBST([PGSQL_BINDIR])
521
522  dnl Extract the share directory
523  PGSQL_SHAREDIR=`"$PG_CONFIG" --sharedir`
524
525  AC_SUBST([PGSQL_SHAREDIR])
526
527  dnl Ensure that we can parse libpq-fe.h
528  CPPFLAGS_SAVE="$CPPFLAGS"
529  CPPFLAGS="$PGSQL_FE_CPPFLAGS"
530  AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([could not find libpq-fe.h])])
531  CPPFLAGS="$CPPFLAGS_SAVE"
532
533  dnl Ensure we can link against libpq
534  LIBS_SAVE="$LIBS"
535  LIBS="$PGSQL_FE_LDFLAGS"
536
537  CC_SAVE="$CC"
538  CC=`"$PG_CONFIG" --cc`
539
540  CFLAGS_SAVE="$CFLAGS"
541  CFLAGS=`"$PG_CONFIG" --cflags`
542
543  AC_CHECK_LIB([pq], [PQserverVersion],
544    [],
545    [AC_MSG_ERROR([could not find libpq])],
546    [])
547  LIBS="$LIBS_SAVE"
548  CC="$CC_SAVE"
549  CFLAGS="$CFLAGS_SAVE"
550
551  AC_DEFINE_UNQUOTED([POSTGIS_PGSQL_VERSION], [$POSTGIS_PGSQL_VERSION], [PostgreSQL server version])
552  AC_SUBST([POSTGIS_PGSQL_VERSION])
553  AC_SUBST([HAVE_BRIN])
554  AC_SUBST([HAVE_SPGIST])
555
556fi dnl LIBLWGEOM_ONLY != no
557
558
559dnl ===========================================================================
560dnl Explain our prefix policy if necessary.
561dnl ===========================================================================
562
563if test "$prefix" != "NONE"; then
564  AC_MSG_RESULT([------------------------------------------------------------------------])
565  AC_MSG_RESULT([  WARNING: You have set the --prefix to '$prefix'. But we mostly    ])
566  AC_MSG_RESULT([  ignore the --prefix. For your info, using the values determined from ])
567  AC_MSG_RESULT([  $PG_CONFIG we will be installing:   ])
568  AC_MSG_RESULT([    * postgis shared library in $PGSQL_LIBDIR ])
569  AC_MSG_RESULT([    * postgis SQL files in $PGSQL_SHAREDIR/contrib/postgis-$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION ])
570  AC_MSG_RESULT([    * postgis executables in $PGSQL_BINDIR ])
571  AC_MSG_RESULT([------------------------------------------------------------------------])
572fi
573
574dnl ===========================================================================
575dnl Detect libxml2 if it is installed
576dnl (needed to GeomFromGML and GeomFromKML functions)
577dnl ===========================================================================
578
579AC_ARG_WITH([xml2config],
580	[AS_HELP_STRING([--with-xml2config=FILE], [specify an alternative xml2-config file])],
581	[XML2CONFIG="$withval"], [XML2CONFIG=""])
582
583XML2_LDFLAGS=""
584XML2_CPPFLAGS=""
585
586if test "x$XML2CONFIG" = "x"; then
587	dnl XML2CONFIG was not specified, so search within the current path
588	AC_PATH_PROG([XML2CONFIG], [xml2-config])
589
590	dnl If we couldn't find xml2-config, display a warning if pkg-config fails too
591	if test "x$XML2CONFIG" = "x"; then
592		if test ! -z "$PKG_CONFIG"; then
593			PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [
594				XML2_CPPFLAGS="$LIBXML2_CFLAGS"
595				XML2_LDFLAGS="$LIBXML2_LIBS"
596				POSTGIS_LIBXML2_VERSION=`$PKG_CONFIG libxml-2.0 --modversion`
597			], [])
598		else
599			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.])
600		fi
601	else
602		dnl Extract the linker and include flags
603		XML2_LDFLAGS=`$XML2CONFIG --libs`
604		XML2_CPPFLAGS=`$XML2CONFIG --cflags`
605
606		dnl Extract the version
607		POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version`
608	fi
609else
610	dnl XML2CONFIG was specified; display a message to the user
611	if test "x$XML2CONFIG" = "xyes"; then
612		AC_MSG_ERROR([you must specify a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
613	else
614		if test -f $XML2CONFIG; then
615			AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
616
617			dnl Extract the linker and include flags
618			XML2_LDFLAGS=`$XML2CONFIG --libs`
619			XML2_CPPFLAGS=`$XML2CONFIG --cflags`
620
621			dnl Extract the version
622			POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version`
623		else
624			AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
625		fi
626	fi
627fi
628
629
630dnl
631dnl XCode in 10.12 supplies bad flags in xml2config resulting
632dnl in compile errors. For that one version, we force the prefix
633dnl to match where we know the libraries reside
634dnl
635case $host_os in
636    darwin*)
637        AC_PATH_PROG([XCRUN], [xcrun])
638        if test "x$XCRUN" = "x"; then
639        	AC_MSG_RESULT([using OSX XCode... no])
640        else
641            XCODE_VER=`$XCRUN --show-sdk-version`
642            if test $XCODE_VER = "10.12"; then
643                AC_MSG_RESULT([applying OSX XCode 10.12 libxml special case... yes])
644                XML2_LDFLAGS=`$XML2CONFIG --exec-prefix=/usr --libs`
645            else
646                AC_MSG_RESULT([using OSX XCode $XCODE_VER... yes])
647            fi
648        fi
649        ;;
650esac
651
652dnl Check headers file
653CPPFLAGS_SAVE="$CPPFLAGS"
654CPPFLAGS="$XML2_CPPFLAGS"
655AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
656		 [], [AC_MSG_ERROR([could not find headers include related to libxml2])])
657CPPFLAGS="$CPPFLAGS_SAVE"
658
659dnl Ensure we can link against libxml2
660LIBS_SAVE="$LIBS"
661LIBS="$XML2_LDFLAGS"
662AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
663LIBS="$LIBS_SAVE"
664
665AC_DEFINE_UNQUOTED([POSTGIS_LIBXML2_VERSION], ["$POSTGIS_LIBXML2_VERSION"], [PostGIS libxml2 version])
666AC_SUBST([POSTGIS_LIBXML2_VERSION])
667
668
669
670dnl ===========================================================================
671dnl Detect the version of GEOS installed on the system
672dnl ===========================================================================
673
674AC_ARG_WITH([geosconfig],
675	[AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
676	[GEOSCONFIG="$withval"], [GEOSCONFIG=""])
677
678if test "x$GEOSCONFIG" = "x"; then
679	dnl GEOSCONFIG was not specified, so search within the current path
680	AC_PATH_PROG([GEOSCONFIG], [geos-config])
681
682	dnl If we couldn't find geos-config, display an error
683	if test "x$GEOSCONFIG" = "x"; then
684		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.])
685	fi
686else
687	dnl GEOSCONFIG was specified; display a message to the user
688	if test "x$GEOSCONFIG" = "xyes"; then
689		AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
690	else
691		if test -f $GEOSCONFIG; then
692			AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
693		else
694			AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
695		fi
696	fi
697fi
698
699dnl Extract the version information from geos_config
700dnl Note: we extract the major & minor separately, ensure they are numeric,
701dnl and then combine to give the final version.
702dnl This is to guard against user error...
703GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
704GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
705GEOS_PATCH_VERSION=`$GEOSCONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'`
706if test "x$GEOS_PATCH_VERSION" = "x"; then
707	GEOS_PATCH_VERSION="0";
708fi
709GEOS_FULL_VERSION=`$GEOSCONFIG --version`
710POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
711GEOS_NUMERIC_PATCH_VERSION=`printf "%02d" $GEOS_PATCH_VERSION`
712GEOS_NUMERIC_MINOR_VERSION=`printf "%02d" $GEOS_MINOR_VERSION`
713GEOS_NUMERIC_VERSION="$GEOS_MAJOR_VERSION$GEOS_NUMERIC_MINOR_VERSION$GEOS_NUMERIC_PATCH_VERSION"
714
715dnl Ensure that we are using GEOS >= 3.5.0
716AC_MSG_RESULT([checking GEOS version... $GEOS_FULL_VERSION])
717if test ! "$GEOS_NUMERIC_VERSION" -ge 30500; then
718	AC_MSG_ERROR([PostGIS requires GEOS >= 3.5.0])
719fi
720
721dnl Extract the linker and include flags
722GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
723GEOS_CPPFLAGS=-I`$GEOSCONFIG --includes`
724AC_SUBST([GEOS_LDFLAGS])
725AC_SUBST([GEOS_CPPFLAGS])
726
727dnl Ensure that we can parse geos_c.h
728CPPFLAGS_SAVE="$CPPFLAGS"
729CPPFLAGS="$GEOS_CPPFLAGS"
730AC_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])])
731CPPFLAGS="$CPPFLAGS_SAVE"
732
733dnl Ensure we can link against libgeos_c
734LIBS_SAVE="$LIBS"
735LIBS="$GEOS_LDFLAGS"
736AC_CHECK_LIB([geos_c], [initGEOS],
737	[],
738	[AC_MSG_ERROR([could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig])],
739	[])
740LIBS="$LIBS_SAVE"
741
742AC_DEFINE_UNQUOTED([POSTGIS_GEOS_VERSION], [$POSTGIS_GEOS_VERSION], [GEOS library version])
743AC_SUBST([POSTGIS_GEOS_VERSION])
744AC_SUBST([GEOS_NUMERIC_VERSION])
745
746
747dnl ===========================================================================
748dnl SFCGAL library support
749dnl ===========================================================================
750
751AC_ARG_WITH([sfcgal],
752	[AS_HELP_STRING([--with-sfcgal=PATH], [Add SFCGAL support. ARG allows to specify an alternate PATH to sfcgal-config])],
753	[SFCGAL_CONFIG="$withval"],
754	[with_sfcgal=auto])
755
756HAVE_SFCGAL="no"
757
758if test "x$with_sfcgal" != "xno"; then
759  if test "x$with_sfcgal" = "xyes" -o "x$with_sfcgal" = "xauto"; then
760	  AC_PATH_PROG([SFCGAL_CONFIG], [sfcgal-config], [])
761  fi
762	if test -x "$SFCGAL_CONFIG"; then
763		SFCGAL_VERSION=`$SFCGAL_CONFIG --version` || AC_MSG_ERROR([cannot determine sfcgal version (tried with $SFCGAL_CONFIG --version)])
764		SFCGAL_LDFLAGS=`$SFCGAL_CONFIG --libs`
765		SFCGAL_CPPFLAGS=`$SFCGAL_CONFIG --cflags`" -DHAVE_SFCGAL"
766
767		SFCGAL_MAJOR_VERSION=`echo $SFCGAL_VERSION | cut -d. -f1 | sed 's/[[^0-9]]//g'`
768		SFCGAL_MINOR_VERSION=`echo $SFCGAL_VERSION | cut -d. -f2 | sed 's/[[^0-9]]//g'`
769		POSTGIS_SFCGAL_VERSION="$SFCGAL_MAJOR_VERSION$SFCGAL_MINOR_VERSION"
770		AC_DEFINE_UNQUOTED([POSTGIS_SFCGAL_VERSION], [$POSTGIS_SFCGAL_VERSION], [SFCGAL library version at build time])
771		AC_SUBST([POSTGIS_SFCGAL_VERSION])
772
773		SFCGAL_STATIC=`$SFCGAL_CONFIG --static`
774		if test "x$SFCGAL_STATIC" = "xON"; then
775			AC_MSG_WARN([The SFCGAL version found is not installed as a dynamic library.])
776		else
777        		SFCGAL="sfcgal"
778			HAVE_SFCGAL="yes"
779		fi
780		if test ! "$POSTGIS_SFCGAL_VERSION" -ge 11; then
781			AC_MSG_ERROR([PostGIS requires SFCGAL >= 1.1.0 (found $SFCGAL_VERSION)])
782		fi
783
784	else
785		if test "x$with_sfcgal" != "xauto"; then
786			AC_MSG_ERROR([sfcgal-config cannot be found. Please install sfcgal])
787		fi
788	fi
789fi
790
791AC_SUBST([SFCGAL_VERSION])
792AC_SUBST([SFCGAL_CPPFLAGS])
793AC_SUBST([SFCGAL_LDFLAGS])
794AC_SUBST([SFCGAL_OBJS])
795AC_SUBST([SFCGAL])
796AC_SUBST([HAVE_SFCGAL])
797
798
799
800dnl ===========================================================================
801dnl Detect gettext
802dnl ===========================================================================
803
804GETTEXT_CFLAGS=""
805GETTEXT_LDFLAGS=""
806
807AC_ARG_WITH([gettext],
808	[AS_HELP_STRING([--with-gettext=PATH], [specify a path to non-default gettext installation])],
809	[GETTEXT_PATH="$withval"], [GETTEXT_PATH="yes"])
810
811LDFLAGS_SAVE="$LDFLAGS"
812CFLAGS_SAVE="$CFLAGS"
813
814if test "x$GETTEXT_PATH" != "xno"; then
815	dnl If user has specified a custom gettext installation path, use it.
816	if test "x$GETTEXT_PATH" != "xyes"; then
817		AC_MSG_RESULT([checking user-specified gettext location: $GETTEXT_PATH])
818		GETTEXT_CFLAGS="-I$GETTEXT_PATH/include"
819		GETTEXT_LDFLAGS="-L$GETTEXT_PATH/lib"
820		LDFLAGS="$GETTEXT_LDFLAGS $LDFLAGS"
821		CFLAGS="$GETTEXT_CFLAGS $CFLAGS"
822	fi
823
824	AM_GNU_GETTEXT([external], [], [])
825
826	if test "x$LIBINTL" = "x"; then
827		USE_NLS=no
828	fi
829fi
830
831AC_SUBST([GETTEXT_CFLAGS])
832AC_SUBST([GETTEXT_LDFLAGS])
833
834LDFLAGS="$LDFLAGS_SAVE"
835CFLAGS="$CFLAGS_SAVE"
836
837dnl ===========================================================================
838dnl Detect the version of PROJ.4 installed
839dnl ===========================================================================
840
841AC_ARG_WITH([projdir],
842	[AS_HELP_STRING([--with-projdir=PATH], [specify the PROJ.4 installation directory])],
843	[PROJDIR="$withval"], [PROJDIR=""])
844
845if test ! "x$PROJDIR" = "x"; then
846	dnl Make sure that the directory exists
847	if test "x$PROJDIR" = "xyes"; then
848		AC_MSG_ERROR([you must specify a parameter to --with-projdir, e.g. --with-projdir=/path/to])
849	else
850		if test -d "$PROJDIR"; then
851			AC_MSG_RESULT([Using user-specified proj directory: $PROJDIR])
852
853			dnl Add the include directory to PROJ_CPPFLAGS
854			PROJ_CPPFLAGS="-I$PROJDIR/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"
855			PROJ_LDFLAGS="-L$PROJDIR/lib"
856		else
857			AC_MSG_ERROR([the --with-projdir directory "$PROJDIR" cannot be found])
858		fi
859	fi
860fi
861
862dnl Check that we can find the proj_api.h header file
863CPPFLAGS_SAVE="$CPPFLAGS"
864CPPFLAGS="$PROJ_CPPFLAGS"
865AC_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])],
866[
867#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
868])
869
870dnl Return the PROJ.4 version number
871AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
872AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
873AC_SUBST([POSTGIS_PROJ_VERSION])
874CPPFLAGS="$CPPFLAGS_SAVE"
875
876AC_SUBST([PROJ_CPPFLAGS])
877AC_SUBST([PROJ_LDFLAGS])
878
879dnl Ensure that we are using PROJ >= 4.6.0 (requires pj_set_searchpath)
880if test ! "$POSTGIS_PROJ_VERSION" -ge 46; then
881	AC_MSG_ERROR([PostGIS requires PROJ >= 4.6.0])
882fi
883
884dnl Ensure we can link against libproj
885LIBS_SAVE="$LIBS"
886LIBS="$PROJ_LDFLAGS"
887AC_CHECK_LIB([proj], [pj_get_release],
888	[],
889	[AC_MSG_ERROR([could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir])],
890	[])
891LIBS="$LIBS_SAVE"
892
893dnl ===========================================================================
894dnl Detect if json-c installed
895dnl ===========================================================================
896
897CHECK_JSON=yes
898HAVE_JSON=no
899HAVE_JSON_C=no
900
901AC_ARG_WITH([json],
902	[AS_HELP_STRING([--without-json], [build without json-c support])],
903	[CHECK_JSON="$withval"], [])
904
905if test "$CHECK_JSON" != "no"; then
906
907AC_ARG_WITH([jsondir],
908	[AS_HELP_STRING([--with-jsondir=PATH], [specify the json-c installation directory])],
909	[JSONDIR="$withval"], [JSONDIR=])
910
911if test ! "x$JSONDIR" = "x"; then
912	dnl Make sure that the directory exists
913	if test "x$JSONDIR" = "xyes"; then
914		AC_MSG_ERROR([you must specify a parameter to --with-jsondir, e.g. --with-jsondir=/path/to])
915	else
916		AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
917
918		dnl Add the include directory to JSON_CPPFLAGS
919		JSON_CPPFLAGS="-I$JSONDIR/include"
920		JSON_LDFLAGS="-L$JSONDIR/lib"
921	fi
922fi
923
924dnl Check that we can find the json/json.h header file
925CPPFLAGS_SAVE="$CPPFLAGS"
926CPPFLAGS="$JSON_CPPFLAGS"
927AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [
928  AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON=yes; HAVE_JSON_C=yes], [])
929])
930CPPFLAGS="$CPPFLAGS_SAVE"
931
932dnl Ensure we can link against libjson
933LIBS_SAVE="$LIBS"
934LIBS="$JSON_LDFLAGS"
935AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"], [
936  AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson"], [], [])
937], [])
938LIBS="$LIBS_SAVE"
939
940if test "$HAVE_JSON" = "yes"; then
941	AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
942fi
943if test "$HAVE_JSON_C" = "yes"; then
944	AC_DEFINE([HAVE_LIBJSON_C], 1, [Define to 1 if libjson resides in a json-c subdir])
945fi
946
947AC_SUBST([JSON_CPPFLAGS])
948AC_SUBST([JSON_LDFLAGS])
949AC_SUBST([HAVE_JSON])
950
951fi
952
953
954dnl ===========================================================================
955dnl Detect if protobuf-c installed
956dnl ===========================================================================
957
958CHECK_PROTOBUF=yes
959HAVE_PROTOBUF=yes
960HAVE_GEOBUF=no
961
962AC_ARG_WITH([protobuf],
963	[AS_HELP_STRING([--without-protobuf], [build without protobuf-c support])],
964	[CHECK_PROTOBUF="$withval"], [])
965
966dnl User didn't turn off protobuf support so...
967if test "$CHECK_PROTOBUF" != "no"; then
968
969	dnl Need to find libdir, incdir and protoc-c compiler
970
971	CPPFLAGS_SAVE="$CPPFLAGS"
972	LDFLAGS_SAVE="$LDFLAGS"
973
974	dnl Try pkgconfig first
975	if test -n "$PKG_CONFIG"; then
976		dnl Ensure libprotobuf-c is of minimum required version
977		PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c >= 1.0.0], [
978				PROTOBUF_CPPFLAGS="$PROTOBUFC_CFLAGS";
979				PROTOBUF_LDFLAGS="$PROTOBUFC_LIBS";
980			], [
981				AC_MSG_RESULT([libprotobuf-c not found in pkg-config])
982			])
983	fi
984
985	AC_ARG_WITH([protobufdir],
986		[AS_HELP_STRING([--with-protobufdir=PATH], [specify the protobuf-c installation directory])],[
987			if test "x$withval" = "xyes"; then
988				AC_MSG_ERROR([you must specify a parameter to --with-protobufdir, e.g. --with-protobufdir=/usr/local])
989			else
990				PROTOBUF_LDFLAGS="-L$withval/lib -lprotobuf-c";
991				PROTOBUF_CPPFLAGS="-I$withval/include"
992			fi
993		], [])
994
995	if test -n "$PROTOBUF_CPPFLAGS"; then
996		CPPFLAGS="$PROTOBUF_CPPFLAGS"
997	fi
998
999	if test -n "$PROTOBUF_LDFLAGS"; then
1000		LDFLAGS="$PROTOBUF_LDFLAGS"
1001	fi
1002
1003	dnl confirm that discovered/configured include path works
1004	AC_CHECK_HEADER([protobuf-c/protobuf-c.h], [],
1005		AC_MSG_RESULT([unable to find protobuf-c/protobuf-c.h using $CPPFLAGS])
1006		HAVE_PROTOBUF=no
1007	)
1008
1009	dnl confirm that discovered/configured library path works
1010	AC_CHECK_LIB([protobuf-c], [protobuf_c_message_init], [],
1011		AC_MSG_RESULT([unable to link protobuf-c using $LDFLAGS])
1012		HAVE_PROTOBUF=no
1013	)
1014
1015	AC_CHECK_LIB([protobuf-c], [protobuf_c_version],
1016		AC_DEFINE([HAVE_PROTOBUF_C_VERSION], [1], [Define to 1 if protobuf_c_version() is present]),
1017		[])
1018
1019	AC_MSG_CHECKING([protobuf-c version])
1020	AC_PROTOBUFC_VERSION([PROTOC_VERSION])
1021	AC_MSG_RESULT([$PROTOC_VERSION])
1022
1023	CPPFLAGS="$CPPFLAGS_SAVE"
1024	LDFLAGS="$LDFLAGS_SAVE"
1025
1026	dnl confirm that protobuf compiler is available
1027	AC_PATH_PROG(PROTOCC, protoc-c)
1028	if test -z "$PROTOCC"; then
1029		AC_MSG_RESULT([Cannot find protoc-c protobuf compiler on the PATH: $PATH])
1030		HAVE_PROTOBUF=no
1031	fi
1032
1033	dnl all tests passed! turn on compile-time defines
1034	if test "$HAVE_PROTOBUF" = "yes"; then
1035		AC_DEFINE([HAVE_LIBPROTOBUF], [1], [Define to 1 if libprotobuf-c is present])
1036		AC_DEFINE_UNQUOTED([LIBPROTOBUF_VERSION], [$PROTOC_VERSION], [Numeric version number for libprotobuf-c])
1037		if test $PROTOC_VERSION -ge 1001000; then
1038			AC_DEFINE([HAVE_GEOBUF], [1], [Define to 1 if libprotobuf is >= 1.1])
1039			HAVE_GEOBUF=yes
1040		fi
1041	fi
1042
1043    AC_SUBST([HAVE_PROTOBUF])
1044    AC_SUBST([HAVE_GEOBUF])
1045    AC_SUBST([PROTOC_VERSION])
1046    AC_SUBST([PROTOBUF_CPPFLAGS])
1047    AC_SUBST([PROTOBUF_LDFLAGS])
1048
1049fi
1050
1051
1052dnl ===========================================================================
1053dnl Detect GTK+2.0 for GUI
1054dnl ===========================================================================
1055
1056AC_ARG_WITH([gui],
1057	[AS_HELP_STRING([--with-gui], [compile the data import GUI (requires GTK+2.0)])],
1058	[GUI="yes"], [GUI="no"])
1059
1060if test "x$GUI" = "xyes"; then
1061	AC_MSG_RESULT([GUI: Build requested, checking for dependencies (GKT+2.0)])
1062	dnl Try to find the GTK libs with pkgconfig
1063	AM_PATH_GTK_2_0([2.8.0], [GTK_BUILD="gui"], [GTK_BUILD=""])
1064
1065	dnl Add -mwindows to MinGW GUI build
1066	case $host in
1067		*mingw32*)
1068			GTK_WIN32_FLAGS=-mwindows
1069			GTK_WIN32_RES=shp2pgsql-gui.res
1070                        GTK_WIN32_BUILD=gui-win32
1071			;;
1072	esac
1073fi
1074
1075
1076
1077AC_SUBST([GTK_CFLAGS])
1078AC_SUBST([GTK_LIBS])
1079AC_SUBST([GTK_WIN32_FLAGS])
1080AC_SUBST([GTK_WIN32_RES])
1081AC_SUBST([GTK_BUILD])
1082AC_SUBST([IGE_MAC_CFLAGS])
1083AC_SUBST([IGE_MAC_LIBS])
1084
1085
1086dnl ===========================================================================
1087dnl Allow the developer to turn on expensive checks and debugging flags
1088dnl with --enable-debug
1089dnl
1090
1091AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debugging code and flags]),
1092	[ENABLE_DEBUG=1], [ENABLE_DEBUG=0])
1093
1094if test $ENABLE_DEBUG -eq 1; then
1095    AC_DEFINE([PARANOIA_LEVEL], [10], [Enable use of memory checks])
1096    CFLAGS="$CFLAGS -g"
1097else
1098    AC_DEFINE([PARANOIA_LEVEL], [0], [Disable use of memory checks])
1099    AC_DEFINE([NDEBUG], [0], [Disable C asserts])
1100fi
1101
1102
1103dnl ===========================================================================
1104dnl Define version macros
1105dnl
1106
1107POSTGIS_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION USE_GEOS=1 USE_PROJ=1 USE_STATS=1"
1108if test "$HAVE_LIBXML2" = "1"; then
1109	POSTGIS_VERSION="$POSTGIS_VERSION USE_LIBXML2=1"
1110fi
1111
1112POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION"
1113POSTGIS_BUILD_DATE=`date ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH} -u "+%Y-%m-%d %H:%M:%S"`
1114POSTGIS_SCRIPTS_VERSION="$POSTGIS_LIB_VERSION"
1115
1116AC_DEFINE_UNQUOTED([POSTGIS_VERSION], ["$POSTGIS_VERSION"], [PostGIS version])
1117AC_DEFINE_UNQUOTED([POSTGIS_LIB_VERSION], ["$POSTGIS_LIB_VERSION"], [PostGIS library version])
1118AC_DEFINE_UNQUOTED([POSTGIS_BUILD_DATE], ["$POSTGIS_BUILD_DATE"], [PostGIS build date])
1119AC_DEFINE_UNQUOTED([POSTGIS_SCRIPTS_VERSION], ["$POSTGIS_SCRIPTS_VERSION"], [PostGIS scripts version])
1120
1121AC_SUBST([POSTGIS_VERSION])
1122AC_SUBST([POSTGIS_LIB_VERSION])
1123AC_SUBST([POSTGIS_BUILD_DATE])
1124AC_SUBST([POSTGIS_SCRIPTS_VERSION])
1125
1126
1127dnl ===========================================================================
1128dnl Other parameters
1129dnl
1130
1131dnl Always enable BBOX caching by default
1132AC_DEFINE_UNQUOTED([POSTGIS_AUTOCACHE_BBOX], [1], [Enable caching of bounding box within geometries])
1133
1134dnl Always enable use of ANALYZE statistics by default
1135AC_DEFINE_UNQUOTED([POSTGIS_USE_STATS], [1], [Enable use of ANALYZE statistics])
1136
1137dnl ====================================
1138dnl address standardizer stuff
1139dnl ====================================
1140AC_ARG_WITH([address-standardizer],
1141    [AS_HELP_STRING([--without-address-standardizer],
1142                    [Disable the address_standardizer extension])],
1143    [], [])
1144
1145if test "x$with_address_standardizer" != "xno"; then
1146    dnl ===========================================================================
1147    dnl Detect the version of PCRE installed
1148    dnl ===========================================================================
1149    LDFLAGS="$LDFLAGS_SAVE"
1150    CFLAGS="$CFLAGS_SAVE"
1151
1152    CHECK_PCRE=yes
1153    HAVE_PCRE=no
1154    ADDRESS_STANDARDIZER="address_standardizer"
1155    AC_ARG_WITH([pcredir],
1156        [AS_HELP_STRING([--with-pcredir=PATH], [specify the PCRE installation directory])],
1157        [PCREDIR="$withval"], [PCREDIR=""])
1158
1159    if test ! "x$PCREDIR" = "x"; then
1160        dnl Make sure that the directory exists
1161        if test "x$PCREDIR" = "xyes"; then
1162            AC_MSG_ERROR([you must specify a parameter to --with-pcredir, e.g. --with-pcredir=/path/to])
1163        else
1164            if test -d "$PCREDIR"; then
1165                AC_MSG_RESULT([Using user-specified PCRE directory: $PCREDIR])
1166
1167                dnl Add the include directory to PCRE_CPPFLAGS
1168                PCRE_CPPFLAGS="-I$PCREDIR/include"
1169                PCRE_LDFLAGS="-L$PCREDIR/lib"
1170            else
1171                AC_MSG_ERROR([the --with-pcredir directory "$PCREDIR" cannot be found])
1172            fi
1173        fi
1174    fi
1175
1176
1177    dnl Check that we can find the pcre.h header file
1178    CPPFLAGS_SAVE="$CPPFLAGS"
1179    CPPFLAGS="$PCRE_CPPFLAGS"
1180
1181    AC_CHECK_HEADER([pcre.h], [HAVE_PCRE=yes], [ADDRESS_STANDARDIZER=""])
1182    AC_SUBST([PCRE])
1183    AC_SUBST([HAVE_PCRE])
1184    AC_SUBST([ADDRESS_STANDARDIZER])
1185
1186    dnl Return the PCRE version number
1187    AC_DEFINE_UNQUOTED([PCRE_VERSION], [$PCRE_VERSION], [PCRE library version])
1188    AC_SUBST([PCRE_VERSION])
1189    CPPFLAGS="$CPPFLAGS_SAVE"
1190
1191    AC_SUBST([PCRE_CPPFLAGS])
1192    AC_SUBST([PCRE_LDFLAGS])
1193
1194else
1195    ADDRESS_STANDARDIZER=""
1196    AC_SUBST([ADDRESS_STANDARDIZER])
1197    AC_MSG_RESULT([ADDRESS_STANDARDIZER support: disabled])
1198fi
1199
1200CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $PROTOBUF_CPPFLAGS $XML2_CPPFLAGS $SFCGAL_CPPFLAGS $JSON_CPPFLAGS $PCRE_CPPFLAGS $CPPFLAGS"
1201dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
1202
1203SHLIB_LINK="$PGSQL_LDFLAGS $GEOS_LDFLAGS $PROJ_LDFLAGS -lgeos_c -lproj $JSON_LDFLAGS $PROTOBUF_LDFLAGS $XML2_LDFLAGS $SFCGAL_LDFLAGS $PCRE_LDFLAGS $EXCLUDELIBS_LDFLAGS $LDFLAGS"
1204AC_SUBST([SHLIB_LINK])
1205dnl AC_MSG_RESULT([SHLIB_LINK: $SHLIB_LINK])
1206
1207dnl ====================================
1208dnl topology stuff
1209dnl ====================================
1210AC_ARG_WITH([topology],
1211    [AS_HELP_STRING([--without-topology],
1212                    [Disable the topology extension])],
1213    [], [])
1214
1215if test "x$with_topology" != "xno"; then
1216
1217    TOPOLOGY="topology"
1218    AC_MSG_RESULT([TOPOLOGY: Topology support requested])
1219else
1220    AC_MSG_RESULT([TOPOLOGY: Topology support disabled])
1221fi
1222
1223AC_SUBST([TOPOLOGY])
1224
1225dnl ====================================
1226dnl interrupt tests
1227dnl ====================================
1228INTERRUPTTESTS="no"
1229AC_ARG_WITH([interrupt-tests],
1230    [AS_HELP_STRING([--without-interrupt-tests],
1231                    [Disable the interrupt tests (for CI servers)])],
1232    [], [])
1233
1234AC_ARG_WITH([interrupt-tests],
1235    [AS_HELP_STRING([--with-interrupt-tests],
1236                    [Enable interrupt tests])],
1237    [INTERRUPTTESTS="yes"], [])
1238
1239if test "x$with_interrupt_tests" = "xno"; then
1240    INTERRUPTTESTS="no"
1241fi
1242
1243AC_SUBST([INTERRUPTTESTS])
1244
1245
1246
1247dnl ===========================================================================
1248dnl SRID stuff
1249dnl ===========================================================================
1250
1251SRID_MAX=999999
1252SRID_USR_MAX=998999
1253AC_SUBST([SRID_MAX])
1254AC_SUBST([SRID_USR_MAX])
1255
1256
1257dnl ====================================
1258dnl raster stuff
1259dnl ====================================
1260AC_ARG_WITH(
1261	[raster],
1262	AC_HELP_STRING([--without-raster], [Disable the raster extension]),
1263	[], [])
1264
1265if test "x$with_raster" != "xno"; then
1266	RASTER="raster"
1267	AC_MSG_RESULT([RASTER: Raster support requested])
1268
1269	AC_CONFIG_HEADERS([raster/raster_config.h])
1270
1271	dnl
1272	dnl Raster Version Information imported from raster/Version.config
1273	dnl
1274	POSTGIS_RASTER_MAJOR_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MAJOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
1275	POSTGIS_RASTER_MINOR_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MINOR_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
1276	POSTGIS_RASTER_MICRO_VERSION=`cat raster/Version.config | grep POSTGIS_RASTER_MICRO_VERSION | sed 's/[[^=]]*=\([[0-9]]\)/\1/g'`
1277
1278	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MAJOR_VERSION], ["$POSTGIS_RASTER_MAJOR_VERSION"], [PostGIS Raster major version])
1279	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MINOR_VERSION], ["$POSTGIS_RASTER_MINOR_VERSION"], [PostGIS Raster minor version])
1280	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_MICRO_VERSION], ["$POSTGIS_RASTER_MICRO_VERSION"], [PostGIS Raster micro version])
1281
1282	AC_SUBST([POSTGIS_RASTER_MAJOR_VERSION])
1283	AC_SUBST([POSTGIS_RASTER_MINOR_VERSION])
1284	AC_SUBST([POSTGIS_RASTER_MICRO_VERSION])
1285
1286	dnl ==============================
1287	dnl Define raster version macros
1288	dnl ==============================
1289	POSTGIS_RASTER_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION"
1290	POSTGIS_RASTER_LIB_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION.$POSTGIS_RASTER_MICRO_VERSION"
1291	POSTGIS_RASTER_BUILD_DATE=`date ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH} -u "+%Y-%m-%d %H:%M:%S"`
1292	POSTGIS_RASTER_SCRIPTS_VERSION="$POSTGIS_RASTER_LIB_VERSION"
1293
1294	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_VERSION], ["$POSTGIS_RASTER_VERSION"], [PostGIS Raster version])
1295	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_LIB_VERSION], ["$POSTGIS_RASTER_LIB_VERSION"], [PostGIS Raster library version])
1296	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_BUILD_DATE], ["$POSTGIS_RASTER_BUILD_DATE"], [PostGIS Raster build date])
1297	AC_DEFINE_UNQUOTED([POSTGIS_RASTER_SCRIPTS_VERSION], ["$POSTGIS_RASTER_SCRIPTS_VERSION"], [PostGIS Raster scripts version])
1298
1299	AC_SUBST([POSTGIS_RASTER_VERSION])
1300	AC_SUBST([POSTGIS_RASTER_LIB_VERSION])
1301	AC_SUBST([POSTGIS_RASTER_BUILD_DATE])
1302	AC_SUBST([POSTGIS_RASTER_SCRIPTS_VERSION])
1303
1304	dnl ===========================================================================
1305	dnl Allow output of double truncation warnings with --with-raster-dblwarning
1306	dnl ===========================================================================
1307	AC_ARG_WITH(
1308		[raster-dblwarning],
1309		AC_HELP_STRING([--with-raster-dblwarning], [output double truncation warnings.  Only used with --with-raster]),
1310		[POSTGIS_RASTER_WARN_ON_TRUNCATION=1],
1311		[POSTGIS_RASTER_WARN_ON_TRUNCATION=0])
1312
1313	AC_DEFINE_UNQUOTED(
1314		[POSTGIS_RASTER_WARN_ON_TRUNCATION],
1315		[$POSTGIS_RASTER_WARN_ON_TRUNCATION],
1316		[Define to 1 if a warning is outputted every time a double is truncated])
1317
1318	dnl ========================================================================
1319	dnl Determine GDAL Support
1320	dnl
1321	dnl TODO: Now, --with-gdalconfig can have only 1 value: path to gdal-config. It
1322	dnl could be useful to allow path to GDAL tree, because the cflags and the
1323	dnl libs can be obtained from GDAL tree too, apart from gdal-config
1324	dnl How to get cflags and libs from GDAL tree?
1325	dnl
1326	dnl LIBGDAL_CFLAGS="-I$with_gdal/port -I$with_gdal/ogr -I$with_gdal/alg -I$with_gdal/gcore -I$with_gdal/frmts "
1327	dnl LIBGDAL_LDFLAGS="-L${with_gdal}/.libs -lgdal -L${with_gdal}/ -lgdal"
1328	dnl ========================================================================
1329	dnl not used right now
1330	USE_GDAL_SOURCE_TREE="no"
1331	LIBGDAL_CFLAGS=""
1332	LIBGDAL_LDFLAGS=""
1333	LIBGDAL_DEPLIBS_LDFLAGS=""
1334
1335	dnl GDAL version constants, update here
1336	GDAL_MIN_VERSION=1.8.0
1337	GDAL_MIN_VERSION_NUMBER=180 dnl TODO: Use GDAL version calculation MAJOR*1000+MINOR*100+REV*10+BUILD
1338
1339	AC_ARG_WITH(
1340		[gdalconfig],
1341		AC_HELP_STRING([--with-gdalconfig=@<:@ARG@:>@],[specify location of gdal-config (ARG=path).  Only used with --with-raster]),
1342		[GDAL_CONFIG="$withval"],
1343		[AC_PATH_PROG([GDAL_CONFIG], [gdal-config], [])]
1344  )
1345
1346	AC_MSG_CHECKING([GDAL version])
1347
1348	if test -x "$GDAL_CONFIG"; then
1349		dnl Extract the version information from gdal-config
1350		dnl Note: we extract the major & minor separately, ensure they are numeric,
1351		dnl and then combine to give the final version.
1352		dnl This is to guard against user error...
1353		GDAL_MAJOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
1354		GDAL_MINOR_VERSION=`$GDAL_CONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
1355		GDAL_PATCH_VERSION=`$GDAL_CONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'`
1356		GDAL_FULL_VERSION=`$GDAL_CONFIG --version`
1357		POSTGIS_GDAL_VERSION="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION"
1358		GDAL_VERSION_NUMBER="$GDAL_MAJOR_VERSION$GDAL_MINOR_VERSION$GDAL_PATCH_VERSION"
1359
1360		AC_MSG_RESULT([$GDAL_FULL_VERSION])
1361
1362		dnl Ensure we are using minimum required version of GDAL
1363		if test ! "$GDAL_VERSION_NUMBER" -ge "$GDAL_MIN_VERSION_NUMBER" ; then
1364			AC_MSG_ERROR([PostGIS raster requires GDAL >= $GDAL_MIN_VERSION. Use --without-raster to build without raster support.])
1365		fi
1366
1367		AC_DEFINE_UNQUOTED([POSTGIS_GDAL_VERSION], [$POSTGIS_GDAL_VERSION], [GDAL library version])
1368		AC_SUBST([POSTGIS_GDAL_VERSION])
1369
1370		dnl Check that OGR is enabled
1371		AC_MSG_CHECKING([for OGR enabled])
1372		OGR_ENABLED=`$GDAL_CONFIG --ogr-enabled`
1373		if test "x$OGR_ENABLED" != "xyes"; then
1374			AC_MSG_RESULT([$OGR_ENABLED])
1375			AC_MSG_ERROR([PostGIS raster requires OGR to be enabled in GDAL. Use --without-raster to build without raster support.])
1376		fi
1377		AC_MSG_RESULT([$OGR_ENABLED])
1378
1379		dnl Extract the linker and include flags
1380		LIBGDAL_LDFLAGS=`$GDAL_CONFIG --libs`
1381		dnl LIBGDAL_DEPLIBS_LDFLAGS=`$GDAL_CONFIG --dep-libs`
1382		LIBGDAL_CFLAGS=`$GDAL_CONFIG --cflags`
1383
1384		CPPFLAGS_SAVE="$CPPFLAGS"
1385		CPPFLAGS="$LIBGDAL_CFLAGS"
1386		CFLAGS_SAVE="$CFLAGS"
1387		CFLAGS=`"$PG_CONFIG" --cflags`
1388		CC_SAVE="$CC"
1389		CC=`"$PG_CONFIG" --cc`
1390
1391		LIBS_SAVE="$LIBS"
1392		LIBS="$LIBGDAL_LDFLAGS"
1393
1394		dnl Check headers file
1395		AC_CHECK_HEADERS(
1396			[gdal.h ogr_api.h cpl_conv.h],
1397			[],
1398			[AC_MSG_ERROR([could not find GDAL headers])])
1399
1400		dnl Ensure we can link against gdal
1401		AC_SEARCH_LIBS([GDALAllRegister], [gdal], [], [AC_MSG_ERROR([could not find GDAL])], [])
1402
1403		LIBS="$LIBGDAL_LDFLAGS"
1404
1405		dnl Ensure we can link against ogr
1406		AC_SEARCH_LIBS([OGRRegisterAll], [gdal], [], [AC_MSG_ERROR([could not find OGR])], [])
1407
1408		LIBS="$LIBGDAL_LDFLAGS"
1409		CPPFLAGS="$CPPFLAGS_SAVE"
1410		CFLAGS="$CFLAGS_SAVE"
1411		CC="$CC_SAVE"
1412		LIBS="$LIBS_SAVE"
1413
1414		AC_SUBST([LIBGDAL_CFLAGS])
1415		AC_SUBST([LIBGDAL_LDFLAGS])
1416		AC_SUBST([LIBGDAL_DEPLIBS_LDFLAGS])
1417
1418	else
1419		AC_MSG_RESULT([not found])
1420		AC_MSG_ERROR([gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>])
1421	fi
1422
1423	dnl Define raster objects, for makefiles
1424	RT_CORE_LIB=corelib
1425	RT_PG_LIB=pglib
1426	RT_LOADER=rtloader
1427	RT_POSTGIS_SQL=rtpostgis.sql
1428
1429	AC_SUBST([RASTER])
1430	AC_SUBST([RT_CORE_LIB])
1431	AC_SUBST([RT_PG_LIB])
1432	AC_SUBST([RT_LOADER])
1433	AC_SUBST([RT_POSTGIS_SQL])
1434
1435	RT_MAKEFILE_LIST="
1436		raster/Makefile \
1437		raster/rt_core/Makefile \
1438		raster/rt_pg/Makefile \
1439		raster/loader/Makefile \
1440		raster/test/Makefile \
1441		raster/test/cunit/Makefile \
1442		raster/test/regress/Makefile \
1443		raster/scripts/Makefile \
1444		raster/scripts/python/Makefile"
1445
1446else
1447	AC_MSG_RESULT([RASTER: Raster support disabled])
1448	RT_MAKEFILE_LIST="raster/Makefile"
1449fi
1450
1451
1452
1453
1454
1455dnl ===========================================================================
1456dnl See if we have the requirements for building the extensions, namely
1457dnl the xlstproc tool for generating the comments SQL file.
1458dnl ===========================================================================
1459
1460EXTENSIONS=""
1461if test \
1462        "x$XSLTPROC" != "x" -o \
1463        -e doc/postgis_comments.sql -a \
1464        -e doc/raster_comments.sql;
1465then
1466  if test "x$RASTER" = "xraster"; then
1467      AC_MSG_RESULT([enabling PostgreSQL extension support...])
1468      EXTENSIONS=extensions
1469      AC_SUBST([EXTENSIONS])
1470  fi
1471fi
1472
1473
1474dnl ===========================================================================
1475dnl Output the relevant files
1476dnl ===========================================================================
1477
1478AC_OUTPUT([GNUmakefile
1479   extensions/Makefile
1480   extensions/postgis/Makefile
1481   extensions/postgis_sfcgal/Makefile
1482   extensions/postgis_topology/Makefile
1483   extensions/postgis_tiger_geocoder/Makefile
1484   extensions/address_standardizer/Makefile
1485   liblwgeom/Makefile
1486   liblwgeom/cunit/Makefile
1487   liblwgeom/liblwgeom.h
1488   libpgcommon/Makefile
1489   libpgcommon/cunit/Makefile
1490   postgis/Makefile
1491   postgis/sqldefines.h
1492   loader/Makefile
1493   loader/cunit/Makefile
1494   topology/Makefile
1495   topology/test/Makefile
1496   regress/Makefile
1497   doc/Makefile
1498   doc/Makefile.comments
1499   doc/html/image_src/Makefile
1500   utils/Makefile
1501   $RT_MAKEFILE_LIST])
1502
1503dnl ===========================================================================
1504dnl Display the configuration status information
1505dnl ===========================================================================
1506
1507AC_MSG_RESULT()
1508AC_MSG_RESULT([  PostGIS is now configured for ${host}])
1509AC_MSG_RESULT()
1510AC_MSG_RESULT([ -------------- Compiler Info ------------- ])
1511AC_MSG_RESULT([  C compiler:           ${CC} ${CFLAGS}])
1512AC_MSG_RESULT([  SQL preprocessor:     ${SQLPP}])
1513AC_MSG_RESULT()
1514AC_MSG_RESULT([ -------------- Additional Info ------------- ])
1515if test "x$INTERRUPTTESTS" = "xyes"; then
1516  AC_MSG_RESULT([  Interrupt Tests:   ENABLED])
1517else
1518  AC_MSG_RESULT([  Interrupt Tests:   DISABLED use: --with-interrupt-tests to enable])
1519fi
1520AC_MSG_RESULT()
1521AC_MSG_RESULT([ -------------- Dependencies -------------- ])
1522AC_MSG_RESULT([  GEOS config:          ${GEOSCONFIG}])
1523AC_MSG_RESULT([  GEOS version:         ${GEOS_FULL_VERSION}])
1524if test "x$RASTER" = "xraster"; then
1525    AC_MSG_RESULT([  GDAL config:          ${GDAL_CONFIG}])
1526    AC_MSG_RESULT([  GDAL version:         ${GDAL_FULL_VERSION}])
1527fi
1528if test "x$SFCGAL" = "xsfcgal"; then
1529    AC_MSG_RESULT([  SFCGAL config:        ${SFCGAL_CONFIG}])
1530    AC_MSG_RESULT([  SFCGAL version:       ${SFCGAL_VERSION}])
1531fi
1532if test "x$LIBLWGEOM_ONLY" = "xno"; then
1533  AC_MSG_RESULT([  PostgreSQL config:    ${PG_CONFIG}])
1534  AC_MSG_RESULT([  PostgreSQL version:   ${PGSQL_FULL_VERSION}])
1535else
1536  AC_MSG_RESULT([  PostgreSQL support:   DISABLED])
1537fi
1538AC_MSG_RESULT([  PROJ4 version:        ${POSTGIS_PROJ_VERSION}])
1539AC_MSG_RESULT([  Libxml2 config:       ${XML2CONFIG}])
1540AC_MSG_RESULT([  Libxml2 version:      ${POSTGIS_LIBXML2_VERSION}])
1541AC_MSG_RESULT([  JSON-C support:       ${HAVE_JSON}])
1542
1543AC_MSG_RESULT([  protobuf-c support:   ${HAVE_PROTOBUF}])
1544if test "x$HAVE_PROTOBUF" = "xyes"; then
1545  AC_MSG_RESULT([  protobuf-c version:   ${PROTOC_VERSION}])
1546fi
1547
1548AC_MSG_RESULT([  PCRE support:         ${HAVE_PCRE}])
1549AC_MSG_RESULT([  Perl:                 ${PERL}])
1550AC_MSG_RESULT()
1551AC_MSG_RESULT([ --------------- Extensions --------------- ])
1552if test "x$RASTER" = "xraster"; then
1553    AC_MSG_RESULT([  PostGIS Raster:       enabled])
1554else
1555    AC_MSG_RESULT([  PostGIS Raster:       disabled])
1556
1557fi
1558if test "x$TOPOLOGY" = "xtopology"; then
1559    AC_MSG_RESULT([  PostGIS Topology:     enabled])
1560else
1561    AC_MSG_RESULT([  PostGIS Topology:     disabled])
1562fi
1563if test "x$SFCGAL" = "xsfcgal"; then
1564    AC_MSG_RESULT([  SFCGAL support:       enabled])
1565else
1566    AC_MSG_RESULT([  SFCGAL support:       disabled])
1567fi
1568
1569if test "x$ADDRESS_STANDARDIZER" = "xaddress_standardizer"; then
1570    AC_MSG_RESULT([  Address Standardizer support:       enabled])
1571else
1572    AC_MSG_RESULT([  Address Standardizer support:       disabled])
1573fi
1574AC_MSG_RESULT()
1575AC_MSG_RESULT([ -------- Documentation Generation -------- ])
1576AC_MSG_RESULT([  xsltproc:             ${XSLTPROC}])
1577AC_MSG_RESULT([  xsl style sheets:     ${XSLBASE}])
1578AC_MSG_RESULT([  dblatex:              ${DBLATEX}])
1579AC_MSG_RESULT([  convert:              ${IMAGEMAGICK}])
1580AC_MSG_RESULT([  mathml2.dtd:          ${MATHML2_DTD}])
1581AC_MSG_RESULT()
1582
1583if test "$GEOS_NUMERIC_VERSION" -lt 30700; then
1584AC_MSG_WARN([ --------- GEOS VERSION WARNING ------------ ])
1585AC_MSG_WARN([  You are building against GEOS ${GEOS_FULL_VERSION} ])
1586AC_MSG_WARN([  To take advantage of all the features of ])
1587AC_MSG_WARN([  this PostGIS version requires GEOS 3.7.0 or higher.])
1588AC_MSG_WARN([  To take advantage of most of the features of this PostGIS])
1589AC_MSG_WARN([  we recommend GEOS 3.6 or higher])
1590AC_MSG_WARN([  You can download the latest versions from ])
1591AC_MSG_WARN([  http://trac.osgeo.org/geos ])
1592AC_MSG_WARN()
1593fi
1594
1595