From 96840072fc2f2214fefa73583f28e02c5d300ddc Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 20 Aug 2024 16:00:00 +0200 Subject: [PATCH] Cater to raised requirement of fbclient 3.0+ for pdo_firebird (GH-15498) We * Document the fbclient 3.0+ version requirement * Windows: check existence of Interface.h Since we now require fbclient (3.0), we can drop support for the Interbase gds32_ms.lib right away. * POSIX: check for minimum required libfbclient version with fb_config * POSIX: check for `fb_get_master_interface()` The existence of `isc_detach_database` is implied by this. * POSIX: remove detection of unsupported or even wrong libraries libgds is for old Interbase which is incompatible with pdo_firebird for may years, and libib_util is a utitity library, not a replacement for libfbclient. Co-authored-by: Peter Kokot --- UPGRADING | 3 ++- ext/pdo_firebird/config.m4 | 16 ++++++---------- ext/pdo_firebird/config.w32 | 11 ++++++----- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/UPGRADING b/UPGRADING index 6e20a824b08..d9bc98f9b55 100644 --- a/UPGRADING +++ b/UPGRADING @@ -148,7 +148,8 @@ PHP 8.4 UPGRADE NOTES - PDO_FIREBIRD: . Since some Firebird C++ APIs are used now, this extension requires a C++ - compiler to be built. + compiler to be built. This also implies that the extension has to be built + against fbclient 3.0 or higher. . getAttribute, ATTR_AUTOCOMMIT has been changed to get the value as a bool. - PDO_MYSQL: diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 index 18db4eda208..f328dbd03b1 100644 --- a/ext/pdo_firebird/config.m4 +++ b/ext/pdo_firebird/config.m4 @@ -13,6 +13,8 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then FB_LIBDIR=$($FB_CONFIG --libs) FB_VERSION=$($FB_CONFIG --version) AC_MSG_RESULT([version $FB_VERSION]) + AS_VERSION_COMPARE([$FB_VERSION], [3.0], + [AC_MSG_ERROR([Firebird required version is at least 3.0])]) PHP_EVAL_LIBLINE([$FB_LIBDIR], [PDO_FIREBIRD_SHARED_LIBADD]) PHP_EVAL_INCLINE([$FB_CFLAGS]) else @@ -26,17 +28,11 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR ]) - PHP_CHECK_LIBRARY([fbclient], [isc_detach_database], - [FIREBIRD_LIBNAME=fbclient], - [PHP_CHECK_LIBRARY([gds], [isc_detach_database], - [FIREBIRD_LIBNAME=gds], - [PHP_CHECK_LIBRARY([ib_util], [isc_detach_database], - [FIREBIRD_LIBNAME=ib_util], - [AC_MSG_FAILURE([libfbclient, libgds or libib_util not found.])], - [$FIREBIRD_LIBDIR_FLAG])], - [$FIREBIRD_LIBDIR_FLAG])], + PHP_CHECK_LIBRARY([fbclient], [fb_get_master_interface], + [], + [AC_MSG_FAILURE([libfbclient not found.])], [$FIREBIRD_LIBDIR_FLAG]) - PHP_ADD_LIBRARY_WITH_PATH([$FIREBIRD_LIBNAME], + PHP_ADD_LIBRARY_WITH_PATH([fbclient], [$FIREBIRD_LIBDIR], [PDO_FIREBIRD_SHARED_LIBADD]) PHP_ADD_INCLUDE([$FIREBIRD_INCDIR]) diff --git a/ext/pdo_firebird/config.w32 b/ext/pdo_firebird/config.w32 index f7cd342120f..003a1a67708 100644 --- a/ext/pdo_firebird/config.w32 +++ b/ext/pdo_firebird/config.w32 @@ -4,11 +4,12 @@ ARG_WITH("pdo-firebird", "Firebird support for PDO", "no"); if (PHP_PDO_FIREBIRD != "no") { - if ((CHECK_LIB("fbclient_ms.lib", "pdo_firebird", PHP_PHP_BUILD + "\\interbase\\lib_ms;" + PHP_PDO_FIREBIRD) - || CHECK_LIB("gds32_ms.lib", "pdo_firebird", PHP_PHP_BUILD + "\\interbase\\lib_ms;" + PHP_PDO_FIREBIRD) - ) && CHECK_HEADER_ADD_INCLUDE("ibase.h", "CFLAGS_PDO_FIREBIRD", - PHP_PHP_BUILD + "\\include\\interbase;" + PHP_PHP_BUILD + "\\interbase\\include;" + PHP_PDO_FIREBIRD) - ) { + if (CHECK_LIB("fbclient_ms.lib", "pdo_firebird", PHP_PHP_BUILD + "\\interbase\\lib_ms;" + PHP_PDO_FIREBIRD) + && CHECK_HEADER_ADD_INCLUDE("ibase.h", "CFLAGS_PDO_FIREBIRD", + PHP_PHP_BUILD + "\\include\\interbase;" + PHP_PHP_BUILD + "\\interbase\\include;" + PHP_PDO_FIREBIRD) + && CHECK_HEADER_ADD_INCLUDE("firebird\\Interface.h", "CFLAGS_PDO_FIREBIRD", + PHP_PHP_BUILD + "\\include\\interbase;" + PHP_PHP_BUILD + "\\interbase\\include;" + PHP_PDO_FIREBIRD) + ) { EXTENSION("pdo_firebird", "pdo_firebird.c firebird_driver.c firebird_statement.c pdo_firebird_utils.cpp"); ADD_FLAG("CFLAGS_PDO_FIREBIRD", "/EHsc");