1PHP_ARG_WITH([pdo-pgsql], 2 [for PostgreSQL support for PDO], 3 [AS_HELP_STRING([[--with-pdo-pgsql[=DIR]]], 4 [PDO: PostgreSQL support. DIR is the PostgreSQL base install directory or 5 the path to pg_config])]) 6 7if test "$PHP_PDO_PGSQL" != "no"; then 8 9 if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then 10 AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.]) 11 fi 12 13 PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE) 14 15 AC_MSG_CHECKING(for pg_config) 16 for i in $PHP_PDO_PGSQL $PHP_PDO_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do 17 if test -x $i/pg_config; then 18 PG_CONFIG="$i/pg_config" 19 break; 20 fi 21 done 22 23 if test -n "$PG_CONFIG"; then 24 AC_MSG_RESULT([$PG_CONFIG]) 25 PGSQL_INCLUDE=`$PG_CONFIG --includedir` 26 PGSQL_LIBDIR=`$PG_CONFIG --libdir` 27 AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) 28 else 29 AC_MSG_RESULT(not found) 30 if test "$PHP_PDO_PGSQL" = "yes"; then 31 PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql" 32 else 33 PGSQL_SEARCH_PATHS=$PHP_PDO_PGSQL 34 fi 35 36 for i in $PGSQL_SEARCH_PATHS; do 37 for j in include include/pgsql include/postgres include/postgresql ""; do 38 if test -r "$i/$j/libpq-fe.h"; then 39 PGSQL_INC_BASE=$i 40 PGSQL_INCLUDE=$i/$j 41 if test -r "$i/$j/pg_config.h"; then 42 AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) 43 fi 44 fi 45 done 46 47 for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ""; do 48 if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then 49 PGSQL_LIBDIR=$i/$j 50 fi 51 done 52 done 53 fi 54 55 if test -z "$PGSQL_INCLUDE"; then 56 AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path) 57 fi 58 59 if test -z "$PGSQL_LIBDIR"; then 60 AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path) 61 fi 62 63 if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then 64 AC_MSG_ERROR([Unable to find libpq anywhere under $PGSQL_SEARCH_PATHS]) 65 fi 66 67 AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not]) 68 69 old_LIBS=$LIBS 70 old_LDFLAGS=$LDFLAGS 71 LDFLAGS="-L$PGSQL_LIBDIR $LDFLAGS" 72 73 AC_CHECK_LIB(pq, PQprepare,, AC_MSG_ERROR([Unable to build the PDO PostgreSQL driver: a newer libpq is required])) 74 AC_CHECK_LIB(pq, PQexecParams,, AC_MSG_ERROR([Unable to build the PDO PostgreSQL driver: a newer libpq is required])) 75 AC_CHECK_LIB(pq, PQescapeStringConn,, AC_MSG_ERROR([Unable to build the PDO PostgreSQL driver: a newer libpq is required])) 76 AC_CHECK_LIB(pq, PQescapeByteaConn,, AC_MSG_ERROR([Unable to build the PDO PostgreSQL driver: a newer libpq is required])) 77 78 LIBS=$old_LIBS 79 LDFLAGS=$old_LDFLAGS 80 81 PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PDO_PGSQL_SHARED_LIBADD) 82 PHP_SUBST(PDO_PGSQL_SHARED_LIBADD) 83 84 PHP_ADD_INCLUDE($PGSQL_INCLUDE) 85 86 PHP_CHECK_PDO_INCLUDES 87 88 PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_cv_inc_path) 89 PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) 90fi 91