summaryrefslogtreecommitdiff
path: root/ext/pgsql
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-01-09 18:44:33 +0000
committerMarcus Boerger <helly@php.net>2004-01-09 18:44:33 +0000
commitb460ae868eb43e03692e2e6dc14c491a32d0dc88 (patch)
tree26e6ab4bb4ce9996781286c4ad73c213194120a2 /ext/pgsql
parent9a3cdc6491872bd1fe7eba2005df06748bc12a32 (diff)
downloadphp-git-b460ae868eb43e03692e2e6dc14c491a32d0dc88.tar.gz
Use pg_config if it can be found.
Diffstat (limited to 'ext/pgsql')
-rw-r--r--ext/pgsql/config.m454
1 files changed, 35 insertions, 19 deletions
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
index 8cb85b67b8..b6ebfb1a57 100644
--- a/ext/pgsql/config.m4
+++ b/ext/pgsql/config.m4
@@ -7,34 +7,50 @@ AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[
PHP_ARG_WITH(pgsql,for PostgreSQL support,
[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
- base install directory, defaults to /usr/local/pgsql.])
+ base install directory or the path to pg_config.])
if test "$PHP_PGSQL" != "no"; then
PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
- if test "$PHP_PGSQL" = "yes"; then
- PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
+ 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])
else
- PGSQL_SEARCH_PATHS=$PHP_PGSQL
- fi
+ 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
- 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])
+ 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
- fi
- done
+ done
- for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
- if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
- PGSQL_LIBDIR=$i/$j
- fi
+ for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
+ if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
+ PGSQL_LIBDIR=$i/$j
+ fi
+ done
done
- done
+ fi
if test -z "$PGSQL_INCLUDE"; then
AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)