From fa21fce84f758faa5558adcd1d957bb9a9f7039e Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 21 Jan 2025 18:11:49 +0100 Subject: [PATCH] ext/pgsql: Add check for constant PGRES_TUPLES_CHUNK to fix compilation failures close GH-17540 --- NEWS | 4 ++++ ext/pgsql/config.m4 | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 7d73004ed7015..25bdde9676a18 100644 --- a/NEWS +++ b/NEWS @@ -65,6 +65,10 @@ PHP NEWS the cpu mask argument with entries type different than int/string. (David Carlier) +- PgSql: + . Fixed build failure when the constant PGRES_TUPLES_CHUNK is not present + in the system. (chschneider) + - Phar: . Fixed bug GH-17518 (offset overflow phar extractTo()). (nielsdos) diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index 8718208e85061..e4d63b98bc72c 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -28,15 +28,19 @@ if test "$PHP_PGSQL" != "no"; then [Define to 1 if libpq has the 'PQsocketPoll' function (PostgreSQL 17 or later).])],, [$PGSQL_LIBS]) - PHP_CHECK_LIBRARY([pq], [PQsetChunkedRowsMode], - [AC_DEFINE([HAVE_PG_SET_CHUNKED_ROWS_SIZE], [1], - [Define to 1 if libpq has the 'PQsetChunkedRowsMode' function (PostgreSQL - 17 or later).])],, - [$PGSQL_LIBS]) old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $PGSQL_CFLAGS" + AC_CHECK_DECLS([PGRES_TUPLES_CHUNK], + PHP_CHECK_LIBRARY([pq], [PQsetChunkedRowsMode], + [AC_DEFINE([HAVE_PG_SET_CHUNKED_ROWS_SIZE], [1], + [Define to 1 if libpq has the 'PQsetChunkedRowsMode' function (PostgreSQL + 17 or later).])],, + [$PGSQL_LIBS]),, + [#include ] + ) + dnl Available since PostgreSQL 12. AC_CACHE_CHECK([if PGVerbosity enum has PQERRORS_SQLSTATE], [php_cv_enum_pgverbosity_pqerrors_sqlstate],