postgis/configure.in
Sandro Santilli f9eed2c542 Added support for macosx build
git-svn-id: http://svn.osgeo.org/postgis/trunk@1699 b70326c6-7e19-0410-871a-916f4a2858ee
2005-05-13 08:03:36 +00:00

298 lines
6.4 KiB
Plaintext

AC_INIT(README.postgis)
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
dnl
dnl host operating system
dnl
AC_CANONICAL_HOST
host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
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 -x "$with_pgsql"; then
AC_MSG_ERROR([$with_pgsql is not an executable file]);
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(MODULE_INSTALLDIR)
AC_SUBST(LPATH)
PGFEINCLUDES="-I`${PGCONFIG} --includedir`"
PGFELIBS="-L`${PGCONFIG} --libdir` -lpq"
PGBELIBS="-L$( echo $(${PGCONFIG} --libdir)) -lpostgres"
PGBEINCLUDES="-I`${PGCONFIG} --includedir-server`"
PGBIN="$(${PGCONFIG} --bindir)"
dnl
dnl Test for GEOS
dnl
AC_SUBST(USE_GEOS)
AC_SUBST(GEOS_DIR)
USE_GEOS=0
GEOS_DIR=
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 -e "$with_geos"; then
AC_MSG_ERROR([ARG of --with-geos is not an (executable) file]);
else
GEOSCONFIG="$with_geos"
fi
fi
fi
)
if test $USE_GEOS -gt 0; then
GEOS_DIR=`$GEOSCONFIG --prefix`
fi
AC_SUBST(USE_PROJ)
AC_SUBST(PROJ_DIR)
USE_PROJ=0
PROJ_DIR=
AC_PATH_PROG([PROJ], [proj])
if test -n "$PROJ"; then
USE_PROJ=1
PROJ_DIR=`dirname $PROJ`/..
fi
AC_ARG_WITH(proj,
[ --with-proj[[=DIR]] enable reprojection support],
if test "$with_proj" = "no"; then
USE_PROJ=0
else
if test "$with_proj" != "yes"; then
PROJ_DIR=$with_proj
fi
fi
)
if test $USE_PROJ -gt 0; then
if ! test -e $PROJ_DIR/include/projects.h; then
AC_MSG_ERROR([Can't find proj dir.]);
fi
fi
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 -e "$with_jts"; then
AC_MSG_ERROR([ARG of --with-jts is not an (executable) file]);
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(YACC)
AC_PATH_PROG([YACC], [yacc])
if test -z "$YACC"; then
AC_MSG_ERROR(Can't find 'yacc');
fi
dnl
dnl Find 'install'
dnl
AC_PATH_PROG([INSTALL], [install])
if test -z "$INSTALL"; then
AC_MSG_ERROR(Can't find 'install');
fi
AC_SUBST(docdir)
docdir='${prefix}/doc'
AC_ARG_WITH(docdir,
[ --with-docdir=DIR install the documentation in DIR [[PREFIX/doc]]],
if test "$with_docdir" = "yes"; then
AC_MSG_ERROR([option --with-docdir requires an argument])
fi
if test "$with_docdir" = "no"; then
docdir=""
else
docdir="$with_docdir"
fi
)
dnl
dnl Find 'html/docbook.xsl'
dnl
AC_SUBST(XSLBASE)
XSLBASE=
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
XSLBASE=${p}
break
fi
done
if test $USE_JTS -gt 0; then
dnl AC_MSG_RESULT([ GEOS disabled, using JTS.])
USE_GEOS=0
fi
if test "${prefix}" = "NONE"; then
prefix=/usr/local
for v in `${PGCONFIG} --configure`; do
strip=`echo $v | sed "s/'//g"`
var=`echo "$strip" | cut -d= -f1`
if test "$var" = "--prefix"; then
prefix=`echo "$strip" | cut -d= -f2`
fi
done
exec_prefix='${prefix}'
docdir='${prefix}/doc/postgresql/contrib'
datadir='${prefix}/share/postgresql/contrib'
mandir='${prefix}/man'
bindir='${exec_prefix}/bin'
MODULE_INSTALLDIR="`${PGCONFIG} --pkglibdir`"
LPATH='\$$libdir'
else
docdir=$docdir/postgis
datadir=$datadir/postgis
MODULE_INSTALLDIR=$libexecdir
LPATH=$libexecdir
fi
#
# OS-specific settings
#
AC_SUBST(DLSUFFIX)
AC_SUBST(DLFLAGS)
AC_SUBST(EXE)
AC_SUBST(HOST_OS)
HOST_OS=$host_os
DLSUFFIX=.so
DLFLAGS=-shared
EXE=
case $host_os in
*mingw*)
PGBEINCLUDES="$PGBEINCLUDES $PGBEINCLUDES/port/win32"
PGFELIBS="$(echo $(${PGCONFIG} --libdir))/libpq.dll"
DLSUFFIX=.dll
DLFLAGS=
EXE=.exe
;;
*darwin*)
DLFLAGS="-no-cpp-precomp -flat_namespace -undefined suppress -multiply_defined suppress"
;;
esac
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
if test $USE_GEOS -gt 0; then
AC_MSG_RESULT([ GEOS: $GEOSCONFIG])
fi
if test $USE_PROJ -gt 0; then
AC_MSG_RESULT([ PROJ: dir=$PROJ_DIR])
fi
dnl AC_MSG_RESULT([ FLEX: path=$FLEX])
dnl AC_MSG_RESULT([ YACC: path=$YACC])
AC_MSG_RESULT([ ])
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: $MODULE_INSTALLDIR])
else
AC_MSG_RESULT([ EXT: $MODULE_INSTALLDIR ($LPATH)])
fi
AC_MSG_RESULT([ -------------------------------------------------------])
AC_MSG_RESULT([ ])