From 64b52fccc63e1f2557b6ecd75f952ae531f31819 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Fri, 1 May 2026 14:29:27 +0530 Subject: [PATCH] Make curl brotli and zstd optional on Windows This allows builds with older curl versions to continue without these dependencies, while also supporting static library names when they are present. Co-authored-by: Jan Ehrhardt <1757825+Jan-E@users.noreply.github.com> --- ext/curl/config.w32 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ext/curl/config.w32 b/ext/curl/config.w32 index eda7604bc118..14ae1a28ab12 100644 --- a/ext/curl/config.w32 +++ b/ext/curl/config.w32 @@ -24,11 +24,18 @@ if (PHP_CURL != "no") { (ver_num <= parseInt("0x073b00") || ver_num > parseInt("0x073b00") && CHECK_LIB("normaliz.lib", "curl", PHP_CURL) && CHECK_LIB("libssh2.lib", "curl", PHP_CURL) && - CHECK_LIB("nghttp2.lib", "curl", PHP_CURL) && - CHECK_LIB("brotlidec.lib", "curl", PHP_CURL) && - CHECK_LIB("brotlicommon.lib", "curl", PHP_CURL) && - CHECK_LIB("libzstd.lib", "curl", PHP_CURL)) + CHECK_LIB("nghttp2.lib", "curl", PHP_CURL)) ) { + if (!(CHECK_HEADER_ADD_INCLUDE("brotli/decode.h", "CFLAGS_CURL") && + CHECK_LIB("brotlidec.lib;brotlidec-static.lib", "curl", PHP_CURL) && + CHECK_LIB("brotlicommon.lib;brotlicommon-static.lib", "curl", PHP_CURL) + )) { + WARNING("brotli in curl not enabled; libraries or headers not found"); + } + if (!(CHECK_LIB("libzstd.lib;libzstd_a.lib", "curl", PHP_CURL) + )) { + WARNING("zstd in curl not enabled; library not found"); + } EXTENSION("curl", "interface.c multi.c share.c curl_file.c"); AC_DEFINE('HAVE_CURL', 1, 'Have cURL library'); ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB /D PHP_CURL_EXPORTS=1");