1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
|
AC_INIT(README.postgis)
AC_CONFIG_HEADER(config.h)
dnl AC_ARG_ENABLE(autoconf, [ --enable-autoconf really use autoconf],
dnl AC_MSG_RESULT(Using autoconf),
dnl AC_MSG_ERROR([
dnl
dnl Autoconf-based configuration is not widely tested.
dnl If you want to use it anyway specify --enable-autoconf.
dnl ])
dnl )
dnl
dnl Compilers
dnl
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LN_S
dnl
dnl iconv support (might fail in case of non-default iconv installation)
dnl
AC_SUBST(USE_ICONV)
AC_SUBST(ICONV_LDFLAGS)
ICONV_LDFLAGS=
USE_ICONV=1
AC_ARG_WITH(iconv,
[ --without-iconv disable unicode support],
if test "$with_iconv" = "no"; then
USE_ICONV=0
fi
)
if test "$USE_ICONV" = 1; then
AC_CHECK_LIB(iconv, iconv_open,
USE_ICONV=1
ICONV_LDFLAGS=-liconv
,
AC_CHECK_LIB(iconv, libiconv_open,
USE_ICONV=1
ICONV_LDFLAGS=-liconv
,
AC_CHECK_LIB(c, iconv_open,
USE_ICONV=1
,
USE_ICONV=0
)
)
)
fi
AC_CHECK_HEADERS(iconv.h)
dnl
dnl host operating system
dnl
AC_CANONICAL_HOST
dnl
dnl Search for pg_config and setup pgsql stuff
dnl
AC_SUBST(PGCONFIG)
PGCONFIG=
AC_ARG_WITH(pgsql,
[ --with-pgsql[[=ARG]] build for a specific pgsql version
[[ARG=path to pg_config]]],
if test "$with_pgsql" != "no" -a "$with_pgsql" != "yes"; then
if test ! -f "$with_pgsql"; then
AC_MSG_ERROR([Invalid argument to --with-pgsql]);
fi
PGCONFIG="$with_pgsql"
fi
)
if test -z "$PGCONFIG"; then
AC_PATH_PROG([PGCONFIG], [pg_config])
fi
if test -z "$PGCONFIG"; then
AC_MSG_ERROR([PostgreSQL is required by PostGIS]);
fi
AC_SUBST(PGFEINCLUDES)
AC_SUBST(PGBEINCLUDES)
AC_SUBST(PGFELIBS)
AC_SUBST(PGBELIBS)
AC_SUBST(PGBIN)
AC_SUBST(PGTEMPLATE)
AC_SUBST(LPATH)
PGFEINCLUDES="-I"`${PGCONFIG} --includedir`
PGFELIBS="-L"`${PGCONFIG} --libdir`" -lpq " #(1)# `${PGCONFIG} --libs 2> /dev/null`
#(1)#
# We don't really want to link to more libs then required, see:
# http://postgis.refractions.net/pipermail/postgis-devel/2006-May/002124.html
PGBELIBS="-L"`${PGCONFIG} --libdir`" -lpostgres"
PGBEINCLUDES="-I"`${PGCONFIG} --includedir-server`
PGBIN=`${PGCONFIG} --bindir`
dnl
dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
dnl for in-place regression tests
dnl
case $host_os in
*mingw*)
PWDREGRESS="pwd -W"
;;
*)
PWDREGRESS="pwd"
;;
esac
AC_SUBST(PWDREGRESS)
dnl
dnl Test for GEOS
dnl
AC_SUBST(USE_GEOS)
AC_SUBST(GEOS_DIR)
AC_SUBST(GEOS_LDFLAGS)
AC_SUBST(GEOS_VERNUM)
USE_GEOS=0
GEOS_DIR=
GEOS_LDFLAGS=
GEOS_VERNUM=10
AC_PATH_PROG([GEOSCONFIG], [geos-config])
if test -n "$GEOSCONFIG"; then
USE_GEOS=1
fi
AC_ARG_WITH(geos,
[ --with-geos[[=ARG]] enable spatial predicates and operators using GEOS
[[ARG=path to geos-config]]],
if test "$with_geos" = "no"; then
USE_GEOS=0
else
if test "$with_geos" != "yes"; then
if test ! -f "$with_geos"; then
AC_MSG_ERROR([Invalid argument to --with-geos]);
else
GEOSCONFIG="$with_geos"
USE_GEOS=1
AC_MSG_RESULT([Using specified geos-config file: $GEOSCONFIG])
fi
fi
fi
)
if test $USE_GEOS -gt 0; then
GEOS_DIR=`$GEOSCONFIG --prefix`
GEOS_LDFLAGS=`$GEOSCONFIG --ldflags 2> /dev/null`
if test x"$GEOS_LDFLAGS" = "x"; then
# older geos-config versions did not
# support the --ldflags switch, we'll
# default to GEOS_DIR/lib in this case.
#
GEOS_LDFLAGS="-L${GEOS_DIR}/lib"
fi
GEOS_MAJOR=`$GEOSCONFIG --version | cut -d. -f1`
GEOS_MINOR=`$GEOSCONFIG --version | cut -d. -f2`
GEOS_VERNUM=`expr $GEOS_MAJOR "*" 10`
GEOS_VERNUM=`expr $GEOS_VERNUM "+" $GEOS_MINOR`
# GEOS >= 3.0.0 always has CAPI, however only GEOS >= 2.2.0 has CAPI support
# so abort if CAPI support is not available.
if test $GEOS_VERNUM -lt 22; then
AC_MSG_ERROR([PostGIS version >= 1.2.0 requires GEOS version >= 2.2.0])
fi
fi
AC_SUBST(USE_PROJ)
AC_SUBST(PROJ_DIR)
AC_SUBST(PROJ_LIBDIR)
USE_PROJ=0
PROJ_DIR=
PROJ_LIBDIR=
AC_PATH_PROG([PROJ], [proj])
if test -n "$PROJ"; then
USE_PROJ=1
PROJ_DIR=`dirname ${PROJ}`/..
owd=`pwd`; cd ${PROJ_DIR}; PROJ_DIR=`pwd`; cd $owd;
fi
AC_ARG_WITH(proj,
[ --with-proj[[=DIR]] enable reprojection support],
if test "$with_proj" = "no"; then
USE_PROJ=0
else
USE_PROJ=1
if test "$with_proj" != "yes"; then
PROJ_DIR=$with_proj
fi
fi
)
if test $USE_PROJ -gt 0; then
if test ! -f $PROJ_DIR/include/projects.h; then
AC_MSG_ERROR([Can't find proj dir.]);
fi
PROJ_LIBDIR=${PROJ_DIR}/lib
fi
AC_ARG_WITH(proj-libdir,
[ --with-proj-libdir=PATH path to PROJ4 libdir],
[
case "$with_proj_libdir" in
no|yes)
AC_MSG_ERROR([Invalid argument to --with-proj-libdir])
;;
*)
PROJ_LIBDIR=${with_proj_libdir}
;;
esac
], with_proj_libdir=no)
AC_SUBST(USE_JTS)
AC_SUBST(JTS_INCLUDES)
AC_SUBST(JTS_LIBDIR)
USE_JTS=0
JTS_INCLUDES=
JTS_INCLUDES=
AC_ARG_WITH(jts,
[ --with-jts[[=ARG]] use JTS for spatial predicates and operators
[[ARG=path to jts-config]]],
if test "$with_jts" != "no"; then
USE_JTS=1
if test "$with_jts" != "yes"; then
if test ! -f "$with_jts"; then
AC_MSG_ERROR([Invalid argument to --with-jts]);
else
JTSCONFIG=$with_jts
fi
fi
fi
)
if test $USE_JTS -gt 0; then
if test -z "$JTSCONFIG"; then
AC_PATH_PROG([JTSCONFIG], [jts-config])
if test -z "$JTSCONFIG"; then
AC_MSG_ERROR([Can't find jts-config]);
fi
fi
JTS_INCLUDES=`$JTSCONFIG --includedir`
JTS_LIBDIR=`$JTSCONFIG --libdir`
fi
dnl
dnl Search flex and yacc
dnl
AC_SUBST(FLEX)
AC_PATH_PROG([FLEX], [flex])
if test -z "$FLEX"; then
AC_MSG_ERROR(Can't find 'flex');
fi
AC_SUBST(DLLWRAP)
AC_PATH_PROG([DLLWRAP], [dllwrap])
AC_SUBST(DLLTOOL)
AC_PATH_PROG([DLLTOOL], [dlltool])
dnl AC_SUBST(YACC)
dnl AC_PATH_PROG([YACC], [yacc])
AC_PROG_YACC
if test -z "$YACC"; then
AC_MSG_ERROR(Can't find 'yacc');
fi
dnl
dnl Find 'install'
dnl
dnl AC_PATH_PROG([INSTALL], [install])
dnl if test -z "$INSTALL"; then
dnl AC_MSG_ERROR(Can't find 'install');
dnl fi
AC_SUBST(INSTALL)
INSTALL=`pwd`"/install-sh"
dnl
dnl Search perl
dnl
AC_SUBST(PERL)
AC_PATH_PROG([PERL], [perl])
if test -z "$PERL"; then
AC_MSG_ERROR(Can't find 'perl');
fi
AC_SUBST(docdir)
docdir='${prefix}/share/doc'
AC_ARG_WITH(docdir,
[ --with-docdir=DIR install the documentation in DIR [[PREFIX/share/doc]]],
if test "$with_docdir" = "yes"; then
AC_MSG_ERROR([option --with-docdir requires an argument])
fi
if test "$with_docdir" != "no"; then
docdir="$with_docdir"
fi
)
dnl
dnl Find 'html/docbook.xsl'
dnl
AC_SUBST(XSLBASE)
XSLBASE=
AC_ARG_WITH(xsl,
[ --with-xsl=DIR Specify the DIR containing html/docbook.xsl stylesheet],
if test "$with_xsl" = yes; then
AC_MSG_ERROR([option --with-xsl requires an argument])
fi
if test "$with_xsl" != "no"; then
xsl="$with_xsl"
fi
,
SEARCHPATH="
/usr/share/sgml/docbook/xsl-stylesheets
/usr/share/xml/docbook/stylesheet/nwalsh
/usr/share/sgml/docbook/stylesheet/xsl/nwalsh
"
for p in ${SEARCHPATH}; do
if test -r "${p}"/html/docbook.xsl; then
xsl="${p}"
break
fi
done
)
XSLBASE="${xsl}"
dnl
dnl Search for other binaries needed to build docs
dnl
AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_PATH_PROG([PDFXMLTEX], [pdfxmltex])
AC_PATH_PROG([DB2PDF], [db2pdf])
AC_PATH_PROG([JW], [jw])
AC_SUBST(XSLTPROC)
AC_SUBST(PDFXMLTEX)
AC_SUBST(JW)
DOC_RULE=requirements_not_met
if test -n "${XSLBASE}"; then
if test -n "${XSLTPROC}"; then
DOC_RULE=html/postgis.html
else
if test -n "${JW}"; then
DOC_RULE=jw
fi
fi
fi
AC_SUBST(DOC_RULE)
if test $USE_JTS -gt 0; then
dnl AC_MSG_RESULT([ GEOS disabled, using JTS.])
USE_GEOS=0
AC_DEFINE(USE_JTS)
fi
if test $USE_GEOS -gt 0; then
AC_DEFINE(USE_GEOS)
fi
#
# Extract PostgreSQL paths from pg_config
##
#
# Prefix (pg_prefix)
#
pg_prefix=/usr/local/pgsql
pg_eprefix=
pg_docdir=
pg_datadir=
pg_mandir=
pg_bindir="`${PGCONFIG} --bindir`"
pg_pkglibdir="`${PGCONFIG} --pkglibdir`"
for v in `${PGCONFIG} --configure`; do
strip=`echo $v | sed "s/'//g"`
var=`echo "$strip" | cut -d= -f1`
if test "$var" = "--prefix"; then
pg_prefix=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--exec-prefix"; then
pg_eprefix=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--docdir"; then
pg_docdir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--with-docdir"; then
pg_docdir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--datadir"; then
pg_datadir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--mandir"; then
pg_mandir=`echo "$strip" | cut -d= -f2`
elif test "$var" = "--with-template"; then
PGTEMPLATE=`echo "$strip" | cut -d= -f2`
fi
done
#
# We set these defaults after scan of
# pg_config --configure to safely expand pg_prefix
# We need expansion for the 'postgresq' path component
# addition below (default paths take from pg_config)
#
if test -z "$pg_eprefix"; then pg_eprefix=${pg_prefix}; fi
if test -z "$pg_docdir"; then pg_docdir=${pg_prefix}'/doc'; fi
if test -z "$pg_datadir"; then pg_datadir=${pg_prefix}'/share'; fi
if test -z "$pg_mandir"; then pg_mandir=${pg_prefix}'/man'; fi
# Use old layout by default
use_new_layout=0
if test "$prefix" != 'NONE'; then
use_new_layout=1
fi
if test "${use_new_layout}" = "1"; then
LPATH=$libdir
else
#
# Use old layout: everything under PGSQL paths
# Note: still allow override by user, this is
# done checking each variable against its
# default value, if it has a different
# value do not use PGSQL versions
#
if test "$prefix" = 'NONE'; then
prefix=${pg_prefix}
fi
if test "$docdir" = '${prefix}/share/doc'; then
docdir=${pg_docdir}
#
# If docdir contains no 'pgsql' or 'postgres'
# add the suffix. This is derived from
# PGSQL_SRC/src/Makefile.global
#
if expr "${docdir}" : ".*/pgsql" > /dev/null ; then :; else
if expr "${docdir}" : ".*/postgres" > /dev/null ; then :; else
docdir=${docdir}"/postgresql"
fi
fi
# Add the "contrib" part
docdir=${docdir}"/contrib"
fi
if test "$datadir" = '${prefix}/share'; then
datadir=${pg_datadir}
#
# If datadir contains no 'pgsql' or 'postgres'
# add the suffix. This is derived from
# PGSQL_SRC/src/Makefile.global
#
if expr "${datadir}" : ".*/pgsql" > /dev/null ; then :; else
if expr "${datadir}" : ".*/postgres" > /dev/null ; then :; else
datadir=${datadir}"/postgresql"
fi
fi
# Add the "contrib" part
datadir=${datadir}"/contrib"
fi
if test "$mandir" = '${prefix}/man'; then
mandir=${pg_mandir}
fi
if test "$bindir" = '${exec_prefix}/bin'; then
bindir=${pg_bindir}
fi
if test "$libdir" = '${exec_prefix}/lib'; then
libdir=${pg_pkglibdir}
LPATH='\$$libdir'
else
LPATH=$libdir
fi
fi
# --with-template parsing is done in the single
# pg_config --configure scan above
AC_MSG_CHECKING([which template to use])
template=$PGTEMPLATE
case $host_os in
aix*) template=aix ;;
beos*) template=beos ;;
bsdi*) template=bsdi ;;
cygwin*) template=cygwin ;;
darwin*) template=darwin ;;
dgux*) template=dgux ;;
freebsd*) template=freebsd ;;
hpux*) template=hpux ;;
irix*) template=irix ;;
linux*|gnu*|k*bsd*-gnu)
template=linux ;;
mingw*) template=win32 ;;
netbsd*) template=netbsd ;;
nextstep*) template=nextstep ;;
openbsd*) template=openbsd ;;
osf*) template=osf ;;
qnx*) template=qnx4 ;;
sco*) template=sco ;;
solaris*) template=solaris ;;
sunos*) template=sunos4 ;;
sysv4.2*)
case $host_vendor in
univel) template=univel ;;
esac ;;
sysv4*) template=svr4 ;;
sysv5*) template=unixware ;;
ultrix*) template=ultrix4 ;;
esac
if test x"$template" = x"" ; then
AC_MSG_ERROR([[
*******************************************************************
PostgreSQL has apparently not been ported to your platform yet.
To try a manual configuration, look into the src/template directory
for a similar platform and use the '--with-template=' option.
Please also contact <pgsql-ports@postgresql.org> to see about
rectifying this. Include the above 'checking host system type...'
line.
*******************************************************************
]])
fi
AC_MSG_RESULT([$template])
PORTNAME=$template
AC_SUBST(PORTNAME)
#
# OS-specific settings
#
AC_SUBST(DLSUFFIX)
AC_SUBST(DLFLAGS)
AC_SUBST(EXE)
AC_SUBST(HOST_OS)
# host_os is defined by AC_CANONICAL_HOST
HOST_OS=$host_os
DLSUFFIX=.so
DLFLAGS=-shared
EXE=
case $host_os in
*mingw*)
PGBEINCLUDES="$PGBEINCLUDES $PGBEINCLUDES/port/win32"
DLSUFFIX=.dll
DLFLAGS='${PGBELIBS}'
EXE=.exe
;;
*darwin*)
DLFLAGS="-no-cpp-precomp -flat_namespace -undefined suppress -multiply_defined suppress"
;;
esac
# Assume system is ELF if it predefines __ELF__ as 1,
# otherwise believe host_os based default.
case $host_os in
freebsd1*|freebsd2*) elf=no;;
freebsd3*|freebsd4*) elf=yes;;
esac
AC_EGREP_CPP(yes,
[#if __ELF__
yes
#endif
],
[ELF_SYS=true],
[if test "X$elf" = "Xyes" ; then
ELF_SYS=true
else
ELF_SYS=
fi])
AC_SUBST(ELF_SYS)
AC_OUTPUT(Makefile.config)
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ SUMMARY])
AC_MSG_RESULT([ -------------------------------------------------------])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ HOST_OS: $host_os])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ PGSQL: $PGCONFIG])
if test $USE_JTS -gt 0; then
AC_MSG_RESULT([ JTS: includedir=$JTS_INCLUDES libdir=$JTS_LIBDIR])
fi
# GEOS CAPI information
if test $USE_GEOS -gt 0; then
AC_MSG_RESULT([ GEOS: $GEOSCONFIG (with C-API)])
AC_MSG_RESULT([ (ldflags: $GEOS_LDFLAGS)])
fi
# PROJ.4 information
if test $USE_PROJ -gt 0; then
AC_MSG_RESULT([ PROJ: prefix=$PROJ_DIR libdir=$PROJ_LIBDIR])
fi
AC_MSG_RESULT([ ICONV: $USE_ICONV $ICONV_LDFLAGS])
dnl AC_MSG_RESULT([ FLEX: path=$FLEX])
dnl AC_MSG_RESULT([ YACC: path=$YACC])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([ PORTNAME: $PORTNAME])
AC_MSG_RESULT([ PREFIX: $prefix])
AC_MSG_RESULT([ EPREFIX: $exec_prefix])
AC_MSG_RESULT([ DOC: $docdir])
AC_MSG_RESULT([ DATA: $datadir])
AC_MSG_RESULT([ MAN: $mandir])
AC_MSG_RESULT([ BIN: $bindir])
if test "$MODULE_INSTALLDIR" = "$LPATH"; then
AC_MSG_RESULT([ EXT: $libdir])
else
AC_MSG_RESULT([ EXT: $libdir ($LPATH)])
fi
AC_MSG_RESULT([ -------------------------------------------------------])
AC_MSG_RESULT([ ])
|