2001-12-01 03:00:13 +08:00
|
|
|
dnl
|
1999-04-22 10:48:28 +08:00
|
|
|
dnl $Id$
|
2001-12-01 03:00:13 +08:00
|
|
|
dnl
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[
|
2001-12-16 23:36:33 +08:00
|
|
|
])
|
2000-05-02 05:32:26 +08:00
|
|
|
|
2000-07-11 20:38:06 +08:00
|
|
|
PHP_ARG_WITH(pgsql,for PostgreSQL support,
|
|
|
|
[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
|
2004-01-10 02:44:33 +08:00
|
|
|
base install directory or the path to pg_config.])
|
2000-05-02 05:32:26 +08:00
|
|
|
|
|
|
|
if test "$PHP_PGSQL" != "no"; then
|
2001-12-16 23:36:33 +08:00
|
|
|
PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
|
|
|
|
|
2004-01-10 02:44:33 +08:00
|
|
|
AC_MSG_CHECKING(for pg_config)
|
|
|
|
for i in $PHP_PGSQL $PHP_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do
|
|
|
|
if test -x $i/pg_config; then
|
|
|
|
PG_CONFIG="$i/pg_config"
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -n "$PG_CONFIG"; then
|
|
|
|
AC_MSG_RESULT([$PG_CONFIG])
|
|
|
|
PGSQL_INCLUDE=`$PG_CONFIG --includedir`
|
|
|
|
PGSQL_LIBDIR=`$PG_CONFIG --libdir`
|
|
|
|
AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
|
2001-12-16 23:36:33 +08:00
|
|
|
else
|
2004-01-10 02:44:33 +08:00
|
|
|
AC_MSG_RESULT(not found)
|
|
|
|
if test "$PHP_PGSQL" = "yes"; then
|
|
|
|
PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
|
|
|
|
else
|
|
|
|
PGSQL_SEARCH_PATHS=$PHP_PGSQL
|
|
|
|
fi
|
2000-05-02 05:32:26 +08:00
|
|
|
|
2004-01-10 02:44:33 +08:00
|
|
|
for i in $PGSQL_SEARCH_PATHS; do
|
|
|
|
for j in include include/pgsql include/postgres include/postgresql ""; do
|
|
|
|
if test -r "$i/$j/libpq-fe.h"; then
|
|
|
|
PGSQL_INC_BASE=$i
|
|
|
|
PGSQL_INCLUDE=$i/$j
|
|
|
|
if test -r "$i/$j/pg_config.h"; then
|
|
|
|
AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
|
|
|
|
fi
|
2002-03-31 09:18:32 +08:00
|
|
|
fi
|
2004-01-10 02:44:33 +08:00
|
|
|
done
|
2001-12-16 23:36:33 +08:00
|
|
|
|
2004-11-03 22:32:52 +08:00
|
|
|
for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ""; do
|
2004-01-10 02:44:33 +08:00
|
|
|
if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
|
|
|
|
PGSQL_LIBDIR=$i/$j
|
|
|
|
fi
|
|
|
|
done
|
2001-12-16 23:36:33 +08:00
|
|
|
done
|
2004-01-10 02:44:33 +08:00
|
|
|
fi
|
2001-12-16 23:36:33 +08:00
|
|
|
|
|
|
|
if test -z "$PGSQL_INCLUDE"; then
|
|
|
|
AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$PGSQL_LIBDIR"; then
|
|
|
|
AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path)
|
2000-05-02 05:32:26 +08:00
|
|
|
fi
|
|
|
|
|
2001-12-16 23:36:33 +08:00
|
|
|
if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
|
|
|
|
AC_MSG_ERROR([Unable to find libpq anywhere under $withval])
|
|
|
|
fi
|
2000-05-02 05:32:26 +08:00
|
|
|
|
2002-04-08 09:37:38 +08:00
|
|
|
AC_DEFINE(HAVE_PGSQL,1,[Whether to build PostgreSQL support or not])
|
2001-05-12 19:09:05 +08:00
|
|
|
old_LIBS=$LIBS
|
|
|
|
old_LDFLAGS=$LDFLAGS
|
2000-05-02 05:32:26 +08:00
|
|
|
LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
|
2002-04-08 09:37:38 +08:00
|
|
|
AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later]))
|
2002-06-26 21:07:40 +08:00
|
|
|
AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
|
2002-04-08 09:37:38 +08:00
|
|
|
AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows]))
|
|
|
|
AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
|
2002-04-25 10:40:58 +08:00
|
|
|
AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later]))
|
2003-07-23 07:05:17 +08:00
|
|
|
AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]))
|
|
|
|
AC_CHECK_LIB(pq, PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
|
2003-07-28 00:46:40 +08:00
|
|
|
AC_CHECK_LIB(pq, PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or later]))
|
2002-04-08 09:37:38 +08:00
|
|
|
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye]))
|
2001-05-12 19:09:05 +08:00
|
|
|
LIBS=$old_LIBS
|
|
|
|
LDFLAGS=$old_LDFLAGS
|
2000-05-02 05:32:26 +08:00
|
|
|
|
2001-03-28 04:35:04 +08:00
|
|
|
PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PGSQL_SHARED_LIBADD)
|
2001-12-01 03:00:13 +08:00
|
|
|
PHP_SUBST(PGSQL_SHARED_LIBADD)
|
2001-12-16 23:36:33 +08:00
|
|
|
|
2002-02-15 11:30:15 +08:00
|
|
|
PHP_ADD_INCLUDE($PGSQL_INCLUDE)
|
2001-12-16 23:36:33 +08:00
|
|
|
|
2002-03-13 00:44:00 +08:00
|
|
|
PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared)
|
2000-05-02 05:32:26 +08:00
|
|
|
fi
|
|
|
|
|
2001-12-16 23:36:33 +08:00
|
|
|
|