From: Remi Collet Date: Fri, 17 Oct 2014 09:01:43 +0000 (+0200) Subject: fix check for PG constant X-Git-Tag: v0.5.3~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a9d3f4be3cc720bef035e43ada532aa1467651d0;p=m6w6%2Fext-pq fix check for PG constant --- diff --git a/config.m4 b/config.m4 index 63dfd22..4e08f67 100644 --- a/config.m4 +++ b/config.m4 @@ -27,15 +27,21 @@ if test "$PHP_PQ" != "no"; then AC_CHECK_PROG(EGREP, egrep, egrep) ]) - for PQ_DEF in PGRES_SINGLE_TUPLE PGRES_COPY_BOTH; do - AC_MSG_CHECKING(for $PQ_DEF) - if $EGREP -q $PQ_DEF $PQ_DIR/include/libpq-fe.h; then - AC_DEFINE([$PQ_DEF], [1], [Have $PQ_DEF]) + dnl + dnl PQ_CHECK_CONST(name) + dnl + AC_DEFUN([PQ_CHECK_CONST], [ + AC_MSG_CHECKING(for $1) + if $EGREP -q $1 $PQ_DIR/include/libpq-fe.h; then + AC_DEFINE(HAVE_$1, 1, [Have $1]) AC_MSG_RESULT(yep) else AC_MSG_RESULT(nope) fi - done + ]) + + PQ_CHECK_CONST(PGRES_SINGLE_TUPLE) + PQ_CHECK_CONST(PGRES_COPY_BOTH) dnl diff --git a/src/php_pqres.c b/src/php_pqres.c index ae8774d..9dda107 100644 --- a/src/php_pqres.c +++ b/src/php_pqres.c @@ -82,7 +82,7 @@ static STATUS php_pqres_iterator_valid(zend_object_iterator *i TSRMLS_DC) switch (PQresultStatus(obj->intern->res)) { case PGRES_TUPLES_OK: -#if HAVE_PGRES_SINGLE_TUPLE +#ifdef HAVE_PGRES_SINGLE_TUPLE case PGRES_SINGLE_TUPLE: #endif if (PQntuples(obj->intern->res) <= iter->index) { @@ -1211,7 +1211,7 @@ PHP_MINIT_FUNCTION(pqres) #ifdef HAVE_PGRES_COPY_BOTH zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("COPY_BOTH"), PGRES_COPY_BOTH TSRMLS_CC); #endif -#if HAVE_PGRES_SINGLE_TUPLE +#ifdef HAVE_PGRES_SINGLE_TUPLE zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("SINGLE_TUPLE"), PGRES_SINGLE_TUPLE TSRMLS_CC); #endif