|
1 | 1 | PHP_ARG_WITH([pgsql],
|
2 |
| - [for PostgreSQL support], |
3 |
| - [AS_HELP_STRING([[--with-pgsql[=DIR]]], |
4 |
| - [Include PostgreSQL support. DIR is the PostgreSQL base install directory or |
5 |
| - the path to pg_config])]) |
| 2 | + [whether to build with PostgreSQL support], |
| 3 | + [AS_HELP_STRING([--with-pgsql], |
| 4 | + [Build with PostgreSQL support.])]) |
6 | 5 |
|
7 | 6 | if test "$PHP_PGSQL" != "no"; then
|
8 |
| - PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE) |
| 7 | + PKG_CHECK_MODULES([PGSQL], [libpq]) |
9 | 8 |
|
10 |
| - AC_MSG_CHECKING(for pg_config) |
11 |
| - for i in $PHP_PGSQL $PHP_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do |
12 |
| - if test -x $i/pg_config; then |
13 |
| - PG_CONFIG="$i/pg_config" |
14 |
| - break; |
15 |
| - fi |
16 |
| - done |
| 9 | + PHP_EVAL_INCLINE($PGSQL_CFLAGS) |
| 10 | + PHP_EVAL_LIBLINE($PGSQL_LIBS, PGSQL_SHARED_LIBADD) |
17 | 11 |
|
18 |
| - if test -n "$PG_CONFIG"; then |
19 |
| - AC_MSG_RESULT([$PG_CONFIG]) |
20 |
| - PGSQL_INCLUDE=`$PG_CONFIG --includedir` |
21 |
| - PGSQL_LIBDIR=`$PG_CONFIG --libdir` |
22 |
| - if test -r "$PGSQL_INCLUDE/pg_config.h"; then |
23 |
| - AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) |
24 |
| - fi |
25 |
| - else |
26 |
| - AC_MSG_RESULT(not found) |
27 |
| - if test "$PHP_PGSQL" = "yes"; then |
28 |
| - PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql" |
29 |
| - else |
30 |
| - PGSQL_SEARCH_PATHS=$PHP_PGSQL |
31 |
| - fi |
| 12 | + AC_DEFINE(HAVE_PG_CONFIG_H, 1, [Have pg_config.h]) |
| 13 | + AC_DEFINE(HAVE_PGSQL, 1, [Build with PostgreSQL support]) |
32 | 14 |
|
33 |
| - for i in $PGSQL_SEARCH_PATHS; do |
34 |
| - for j in include include/pgsql include/postgres include/postgresql ""; do |
35 |
| - if test -r "$i/$j/libpq-fe.h"; then |
36 |
| - PGSQL_INC_BASE=$i |
37 |
| - PGSQL_INCLUDE=$i/$j |
38 |
| - if test -r "$i/$j/pg_config.h"; then |
39 |
| - AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) |
40 |
| - fi |
41 |
| - fi |
42 |
| - done |
43 |
| - |
44 |
| - for j in lib $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ""; do |
45 |
| - if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then |
46 |
| - PGSQL_LIBDIR=$i/$j |
47 |
| - fi |
48 |
| - done |
49 |
| - done |
50 |
| - fi |
51 |
| - |
52 |
| - if test -z "$PGSQL_INCLUDE"; then |
53 |
| - AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path) |
54 |
| - fi |
55 |
| - |
56 |
| - if test -z "$PGSQL_LIBDIR"; then |
57 |
| - AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path) |
58 |
| - fi |
59 |
| - |
60 |
| - if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then |
61 |
| - AC_MSG_ERROR([Unable to find libpq anywhere under $PGSQL_SEARCH_PATHS]) |
62 |
| - fi |
63 |
| - |
64 |
| - AC_DEFINE(HAVE_PGSQL,1,[Whether to build PostgreSQL support or not]) |
65 | 15 | old_LIBS=$LIBS
|
66 | 16 | old_LDFLAGS=$LDFLAGS
|
67 |
| - LDFLAGS="-L$PGSQL_LIBDIR $LDFLAGS" |
| 17 | + LDFLAGS="$PGSQL_LIBS $LDFLAGS" |
68 | 18 | AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later]))
|
69 | 19 | AC_CHECK_LIB(pq, PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.3.0 or later]))
|
70 | 20 | AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
|
@@ -98,10 +48,7 @@ if test "$PHP_PGSQL" != "no"; then
|
98 | 48 | LIBS=$old_LIBS
|
99 | 49 | LDFLAGS=$old_LDFLAGS
|
100 | 50 |
|
101 |
| - PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PGSQL_SHARED_LIBADD) |
102 | 51 | PHP_SUBST(PGSQL_SHARED_LIBADD)
|
103 | 52 |
|
104 |
| - PHP_ADD_INCLUDE($PGSQL_INCLUDE) |
105 |
| - |
106 | 53 | PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
107 | 54 | fi
|
0 commit comments