2004-05-20 10:27:49 +08:00
|
|
|
dnl $Id$
|
2008-07-25 21:46:24 +08:00
|
|
|
dnl config.m4 for extension pdo_pgsql
|
|
|
|
dnl vim:et:sw=2:ts=2:
|
2005-02-28 16:18:47 +08:00
|
|
|
|
2004-05-20 10:27:49 +08:00
|
|
|
PHP_ARG_WITH(pdo-pgsql,for PostgreSQL support for PDO,
|
2005-05-30 07:17:16 +08:00
|
|
|
[ --with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL base
|
|
|
|
install directory or the path to pg_config])
|
2004-05-20 10:27:49 +08:00
|
|
|
|
|
|
|
if test "$PHP_PDO_PGSQL" != "no"; then
|
2008-07-25 21:46:24 +08:00
|
|
|
|
|
|
|
if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
|
|
|
|
AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
|
|
|
|
fi
|
|
|
|
|
2004-05-20 10:27:49 +08:00
|
|
|
PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for pg_config)
|
|
|
|
for i in $PHP_PDO_PGSQL $PHP_PDO_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do
|
2007-07-09 20:38:02 +08:00
|
|
|
if test -x $i/pg_config; then
|
2004-05-20 10:27:49 +08:00
|
|
|
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])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(not found)
|
|
|
|
if test "$PHP_PDO_PGSQL" = "yes"; then
|
|
|
|
PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
|
|
|
|
else
|
|
|
|
PGSQL_SEARCH_PATHS=$PHP_PDO_PGSQL
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2007-07-31 21:02:00 +08:00
|
|
|
for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ""; do
|
2004-05-20 10:27:49 +08:00
|
|
|
if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
|
|
|
|
PGSQL_LIBDIR=$i/$j
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
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)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
|
2007-07-12 05:51:55 +08:00
|
|
|
AC_MSG_ERROR([Unable to find libpq anywhere under $PGSQL_SEARCH_PATHS])
|
2004-05-20 10:27:49 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not])
|
2005-01-13 09:12:34 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for openssl dependencies])
|
2011-03-22 17:12:01 +08:00
|
|
|
grep openssl $PGSQL_INCLUDE/libpq-fe.h >/dev/null 2>&1
|
|
|
|
if test $? -eq 0 ; then
|
2007-07-09 20:38:02 +08:00
|
|
|
AC_MSG_RESULT([yes])
|
2007-07-09 20:54:11 +08:00
|
|
|
dnl First try to find pkg-config
|
|
|
|
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
|
|
|
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
|
|
|
|
PDO_PGSQL_CFLAGS=`$PKG_CONFIG openssl --cflags`
|
2005-01-13 09:12:34 +08:00
|
|
|
fi
|
|
|
|
else
|
2007-07-09 20:38:02 +08:00
|
|
|
AC_MSG_RESULT([no])
|
2005-01-13 09:12:34 +08:00
|
|
|
fi
|
|
|
|
|
2004-05-20 10:27:49 +08:00
|
|
|
old_LIBS=$LIBS
|
|
|
|
old_LDFLAGS=$LDFLAGS
|
2009-04-30 20:38:43 +08:00
|
|
|
LDFLAGS="-L$PGSQL_LIBDIR $LDFLAGS"
|
|
|
|
AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]), [
|
|
|
|
echo "Unable to build the PDO PostgreSQL driver: libpq 7.4+ is required"
|
|
|
|
exit 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[PostgreSQL 8.0 or later]))
|
2006-10-05 07:53:36 +08:00
|
|
|
AC_CHECK_LIB(pq, PQescapeStringConn, AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later]))
|
2006-10-07 06:34:16 +08:00
|
|
|
AC_CHECK_LIB(pq, PQescapeByteaConn, AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 or later]))
|
2009-04-30 20:38:43 +08:00
|
|
|
|
2005-01-13 09:12:34 +08:00
|
|
|
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte]))
|
2005-07-08 23:27:34 +08:00
|
|
|
|
|
|
|
|
2004-05-20 10:27:49 +08:00
|
|
|
LIBS=$old_LIBS
|
|
|
|
LDFLAGS=$old_LDFLAGS
|
|
|
|
|
|
|
|
PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PDO_PGSQL_SHARED_LIBADD)
|
|
|
|
PHP_SUBST(PDO_PGSQL_SHARED_LIBADD)
|
|
|
|
|
|
|
|
PHP_ADD_INCLUDE($PGSQL_INCLUDE)
|
|
|
|
|
2005-07-27 10:51:01 +08:00
|
|
|
ifdef([PHP_CHECK_PDO_INCLUDES],
|
|
|
|
[
|
2007-07-09 20:38:02 +08:00
|
|
|
PHP_CHECK_PDO_INCLUDES
|
2005-07-27 10:51:01 +08:00
|
|
|
],[
|
|
|
|
AC_MSG_CHECKING([for PDO includes])
|
|
|
|
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2005-07-27 10:51:01 +08:00
|
|
|
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$abs_srcdir/ext
|
2005-07-27 10:51:01 +08:00
|
|
|
elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
|
2011-05-15 13:03:29 +08:00
|
|
|
pdo_cv_inc_path=$prefix/include/php/ext
|
2005-07-27 10:51:01 +08:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
|
|
|
|
fi
|
2011-05-15 13:03:29 +08:00
|
|
|
AC_MSG_RESULT($pdo_cv_inc_path)
|
2005-07-27 10:51:01 +08:00
|
|
|
])
|
2004-05-20 10:27:49 +08:00
|
|
|
|
2011-05-15 13:03:29 +08:00
|
|
|
PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_PGSQL_CFLAGS)
|
2005-07-27 10:51:01 +08:00
|
|
|
ifdef([PHP_ADD_EXTENSION_DEP],
|
|
|
|
[
|
|
|
|
PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo)
|
|
|
|
])
|
2004-05-20 10:27:49 +08:00
|
|
|
fi
|