PR #26394 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26394
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26394.patch

Fixes #26348.

A static dav1d package can supply `libdav1d.a` while pkg-config returns 
`-ldav1d`. On MSVC-style linkers, try the conventional `dav1d.lib` first. If 
that check fails, retry with `libdav1d.a` and use the successful filename for 
the final link. Both attempts use the package’s search paths, version 
requirement, headers, and symbol check.

Verified with the reporter’s Conan dav1d 1.5.5 archive, `clang-cl` and 
`lld-link` 18.1.3, and the Windows SDK. With only the pkg-config `-L` path, 
configure enabled the decoder, and a Windows x64 program linked against the 
resulting `avcodec.lib` and `avutil.lib`. With both filenames installed, 
configure selected `dav1d.lib`. The missing-archive and below-minimum-version 
cases failed as expected. A native Linux configuration retained `-ldav1d`.

#23048 proposes a general filename resolver. This change handles dav1d by 
asking the linker to test each name and also covers package-local search paths.


From cc2e47cc70bf4249fa37da27188576488ba95a56 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Fri, 27 Nov 2026 10:44:43 +0000
Subject: [PATCH] configure: try Meson's static dav1d archive name with MSVC

The pkg-config file can advertise -ldav1d when the installed archive is 
libdav1d.a. Try the usual dav1d.lib first, then retry the same header and 
symbol check with libdav1d.a. Keep the successful name for the final link.

Fixes #26348

Assisted-by: Fairy
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index eed7a76aa92..56e9153339c 100755
--- a/configure
+++ b/configure
@@ -1675,6 +1675,15 @@ check_pkg_config(){
         eval add_cflags \$${name}_cflags
 }
 
+require_libdav1d(){
+    if msvc_style_linker; then
+        check_pkg_config "$@" && return 0
+        # Meson can name the static archive libdav1d.a even with MSVC.
+        dav1d_msvc_lib=libdav1d.a
+    fi
+    require_pkg_config "$@"
+}
+
 probe_msvc_zlib_libname(){
     log probe_msvc_zlib_libname
     zlib_msvc_lib=zlib.lib
@@ -5203,6 +5212,7 @@ msvc_common_flags(){
             -mthumb)              ;;
             -march=*)             ;;
             -mfp16-format=*)      ;;
+            -ldav1d)              echo ${dav1d_msvc_lib:-dav1d.lib} ;;
             -lz)                  echo ${zlib_msvc_lib:-zlib.lib} ;;
             -lx264)               echo libx264.lib ;;
             -lstdc++)             ;;
@@ -7306,7 +7316,7 @@ enabled libbs2b           && require_pkg_config libbs2b 
libbs2b bs2b.h bs2b_open
 enabled libcaca           && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libcurl           && check_pkg_config libcurl "libcurl >= 7.88.0" 
curl/curl.h curl_easy_init
-enabled libdav1d          && require_pkg_config libdav1d "dav1d >= 1.0.0" 
"dav1d/dav1d.h" dav1d_version
+enabled libdav1d          && require_libdav1d libdav1d "dav1d >= 1.0.0" 
"dav1d/dav1d.h" dav1d_version
 enabled libdavs2          && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm            && check_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to