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