]> granicus.if.org Git - php/commitdiff
Fix incompatibility with PostgreSQL CVS.
authorSascha Schumann <sas@php.net>
Mon, 19 Feb 2001 08:14:45 +0000 (08:14 +0000)
committerSascha Schumann <sas@php.net>
Mon, 19 Feb 2001 08:14:45 +0000 (08:14 +0000)
We now perform a check whether we need to include <postgres.h> to
succesfully compile.

PR: #9328

ext/pgsql/config.m4
ext/pgsql/php_pgsql.h

index bedf744837ab964d05b8b978bb4fa7cdd9a58e16..fee81e8e0fc6b21e166f6dfd0bace1d7ed638807 100644 (file)
@@ -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
 
index e53670a1af4496f32bbf93140c7f9f969655b1c6..22ccfe2c75b0dc9783498ba1e673127485c76c28 100644 (file)
@@ -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