diff options
author | Sascha Schumann <sas@php.net> | 2001-02-19 08:14:45 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2001-02-19 08:14:45 +0000 |
commit | 1e6be5aaf5675e43c622ce0860a2b9688bb3bee3 (patch) | |
tree | 8dc7a57cb3e988b19cba7e73911ad794b5e558f5 | |
parent | b91b1779a5d0e637540dd4779935230476e83c37 (diff) | |
download | php-git-1e6be5aaf5675e43c622ce0860a2b9688bb3bee3.tar.gz |
Fix incompatibility with PostgreSQL CVS.
We now perform a check whether we need to include <postgres.h> to
succesfully compile.
PR: #9328
-rw-r--r-- | ext/pgsql/config.m4 | 19 | ||||
-rw-r--r-- | ext/pgsql/php_pgsql.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index bedf744837..fee81e8e0f 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -23,6 +23,25 @@ if test "$PHP_PGSQL" != "no"; then PGSQL_INCLUDE="-I$PGSQL_INCDIR" + AC_CACHE_CHECK([whether PostgreSQL needs postgres.h], ac_cv_php_pgsql_postgres_h,[ + old_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $PGSQL_INCLUDE" + AC_TRY_COMPILE([ +#include <libpq-fe.h> +],[ + Oid x = InvalidOid; +],[ + ac_cv_php_pgsql_postgres_h=no +],[ + ac_cv_php_pgsql_postgres_h=yes +]) + CPPFLAGS=$old_CPPFLAGS +]) + + if test "$ac_cv_php_pgsql_postgres_h" = "yes"; then + AC_DEFINE(PHP_PGSQL_NEEDS_POSTGRES_H, 1, [whether pgsql needs postgres.h]) + fi + PGSQL_LIBDIR=$PGSQL_DIR/lib test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index e53670a1af..22ccfe2c75 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -29,7 +29,9 @@ extern zend_module_entry pgsql_module_entry; #ifdef PHP_PGSQL_PRIVATE #undef SOCKET_SIZE_TYPE +#ifdef PHP_PGSQL_NEEDS_POSTGRES_H #include <postgres.h> +#endif #include <libpq-fe.h> #ifdef PHP_WIN32 |