PR #24604 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24604
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24604.patch


From dac4e4b6b4340556b2a16f2376d44d120edfb82a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 21 Sep 2026 13:08:54 +0200
Subject: [PATCH 1/2] configure: let the C compiler decide check_allcflags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

b4bd8d1f64 made the status the AND of both compilers and 50e64f97d9 put
it in charge of the arm, mips and darwin decisions. That couples C to
C++ both ways. A C rejection stops C++ from being probed at all, and a
C++ rejection is reported as if C had rejected too. That is not
expacted. Separate the probe, C++ sets flags that it understand now and
the return status of check_allcflags() is C only.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 6901344317..ccedde9397 100755
--- a/configure
+++ b/configure
@@ -1391,7 +1391,8 @@ check_objcflags(){
 }
 
 check_allcflags(){
-    check_cflags "$@" && check_cxxflags "$@"
+    check_cxxflags "$@"
+    check_cflags "$@"
 }
 
 test_ldflags(){
-- 
2.52.0


From 44e29e282eddcb3aa8f05436478517d9a346e09a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 21 Sep 2026 13:08:55 +0200
Subject: [PATCH 2/2] configure: derive cxx from cc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

configure never looks at the C++ compiler on its own. There is no
probe_cc for it, and CXXFLAGS take the C compiler's flag filter and
object conventions, so one toolchain for both is already assumed. Make
it so by deriving cxx from cc the way as, objcc and ld are.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 configure | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index ccedde9397..8dfdb7f283 100755
--- a/configure
+++ b/configure
@@ -400,7 +400,7 @@ Toolchain options:
   --x86asmexe=EXE          use nasm-compatible assembler EXE 
[$x86asmexe_default]
   --cc=CC                  use C compiler CC [$cc_default]
   --stdc=STDC              use C standard STDC [$stdc_default]
-  --cxx=CXX                use C compiler CXX [$cxx_default]
+  --cxx=CXX                use C++ compiler CXX [C++ driver of CC]
   --stdcxx=STDCXX          use C standard STDCXX [$stdcxx_default]
   --objcc=OCC              use ObjC compiler OCC [$cc_default]
   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
@@ -4398,7 +4398,6 @@ ar_default="ar"
 cc_default="gcc"
 stdc_default="c17"
 stdcxx_default="c++17"
-cxx_default="g++"
 host_cc_default="gcc"
 doxygen_default="doxygen"
 makeinfo_default="makeinfo"
@@ -4929,11 +4928,9 @@ case "$toolchain" in
     clang-*)
         requested_sanitizers="${toolchain#clang-}"
         cc_default="clang"
-        cxx_default="clang++"
     ;;
     llvm|llvm-*)
         cc_default="clang"
-        cxx_default="clang++"
         ar_default="llvm-ar"
         nm_default="llvm-nm -g"
         ranlib_default="llvm-ranlib"
@@ -4944,7 +4941,6 @@ case "$toolchain" in
     gcc-*)
         requested_sanitizers="${toolchain#gcc-}"
         cc_default="gcc"
-        cxx_default="g++"
         # In case of tsan with gcc, PIC has to be enabled
         if [ "${toolchain#gcc-}" = "tsan" ]; then
             add_allcflags -fPIC
@@ -4964,7 +4960,6 @@ case "$toolchain" in
     ;;
     msvc|msvc-*)
         cc_default="cl.exe"
-        cxx_default="cl.exe"
         ld_default="$source_path/compat/windows/mslink"
         windres_default="$source_path/compat/windows/mswindres"
         nm_default="dumpbin.exe -symbols"
@@ -5026,7 +5021,6 @@ fi
 
 ar_default="${cross_prefix}${ar_default}"
 cc_default="${cross_prefix}${cc_default}"
-cxx_default="${cross_prefix}${cxx_default}"
 nm_default="${cross_prefix}${nm_default}"
 pkg_config_default="${cross_prefix}${pkg_config_default}"
 ranlib_default="${cross_prefix}${ranlib_default}"
@@ -5060,7 +5054,7 @@ if enabled cuda_nvcc; then
     fi
 fi
 
-set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
+set_default arch cc doxygen pkg_config ranlib strip sysinclude \
     target_exec x86asmexe glslc metalcc metallib stdc stdcxx makeinfo
 enabled cross_compile || host_cc_default=$cc
 set_default host_cc
@@ -5459,7 +5453,15 @@ test -n "$cc_type" && enable $cc_type ||
 : ${dep_cc_default:=$cc}
 : ${ld_default:=$cc}
 : ${host_ld_default:=$host_cc}
-set_default ar as objcc dep_cc ld ln_s host_ld windres response_files
+
+case $cc_type,$cc in
+    gcc,*gcc*)           cxx_default="${cc%gcc*}g++${cc##*gcc}" ;;
+    clang,*clang*)       cxx_default="${cc%clang*}clang++${cc##*clang}" ;;
+    gcc,*cc*|clang,*cc*) cxx_default="${cc%cc*}c++${cc##*cc}" ;;
+    icc,*icc*)           cxx_default="${cc%icc*}icpc${cc##*icc}" ;;
+    *)                   cxx_default=$cc ;;
+esac
+set_default ar as cxx objcc dep_cc ld ln_s host_ld windres response_files
 
 probe_cc as "$as"
 asflags_filter=$_flags_filter
-- 
2.52.0

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

Reply via email to