PR #22672 opened by Kacper Michajłow (kasper93) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22672 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22672.patch
From 8ffde6d752d443b4590fcd7006cb7adec59735fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Tue, 31 Mar 2026 18:10:47 +0200 Subject: [PATCH 1/3] configure: add llvm toolchain option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kacper Michajłow <[email protected]> --- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index fb1baf2eac..dad4a7b819 100755 --- a/configure +++ b/configure @@ -390,7 +390,7 @@ Toolchain options: --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks --toolchain=NAME set tool defaults according to NAME (<tool>[-sanitizer[-...]], e.g. clang-asan-ubsan - tools: gcc, clang, msvc, icl, gcov, llvm-cov, + tools: gcc, clang, llvm, msvc, icl, gcov, llvm-cov, valgrind-memcheck, valgrind-massif, hardened sanitizers: asan, fuzz, lsan, msan, tsan, ubsan) --nm=NM use nm tool NM [$nm_default] @@ -4875,6 +4875,16 @@ case "$toolchain" in 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" + strip_default="llvm-strip" + windres_default="llvm-windres" + test "$toolchain" != "llvm" && add_sanitizers "${toolchain#llvm-}" + ;; gcc-*) add_sanitizers "${toolchain#gcc-}" cc_default="gcc" -- 2.52.0 From d1852a9af5a219f5b53406ed910a2c105ab27617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Tue, 31 Mar 2026 18:30:52 +0200 Subject: [PATCH 2/3] configure: test if -lm is available on host compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes host binaries compilation on platforms without math lib. Signed-off-by: Kacper Michajłow <[email protected]> --- configure | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/configure b/configure index dad4a7b819..195a2452f3 100755 --- a/configure +++ b/configure @@ -1081,6 +1081,10 @@ hostcc_o(){ eval printf '%s\\n' $HOSTCC_O } +hostld_o(){ + eval printf '%s\\n' $HOSTLD_O +} + glslc_o(){ eval printf '%s\\n' $GLSLC_O } @@ -1835,6 +1839,16 @@ test_host_cc(){ test_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC } +test_host_ld(){ + log test_host_ld "$@" + flags=$(filter_out '-l*|*.so' $@) + libs=$(filter '-l*|*.so' $@) + test_host_cc $($host_cflags_filter $flags) || return + flags=$($host_ldflags_filter $flags) + libs=$($host_ldflags_filter $libs) + test_cmd $host_ld $host_ldflags $flags $(hostld_o $TMPE) $TMPO $libs $host_extralibs +} + test_host_cpp(){ log test_host_cpp "$@" cat > $TMPC @@ -1899,6 +1913,27 @@ check_host_cpp_condition(){ test_host_cpp_condition "$@" && enable $name } +check_host_lib(){ + log check_host_lib "$@" + headers="$1" + funcs="$2" + shift 2 + { + for hdr in $headers; do + print_include $hdr + done + echo "#include <stdint.h>" + for func in $funcs; do + echo "long check_$func(void) { return (long) $func; }" + done + echo "int main(void) { int ret = 0;" + for func in $funcs; do + echo " ret |= ((intptr_t)check_$func) & 0xFFFF;" + done + echo "return ret; }" + } | test_host_ld "$@" && append host_extralibs "$@" +} + cp_if_changed(){ cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return mkdir -p "$(dirname $2)" @@ -4470,7 +4505,7 @@ GLSLC_O='-o $@' NVCC_C='-c' NVCC_O='-o $@' -host_extralibs='-lm' +host_extralibs= host_cflags_filter=echo host_ldflags_filter=echo @@ -7223,6 +7258,7 @@ enabled zlib_gzip && enabled gzip || disable resource_compression check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl check_lib libm math.h sin -lm +check_host_lib math.h sin -lm atan2f_args=2 copysign_args=2 -- 2.52.0 From b57e10a3dc46b1f15abffd5078c035f4bae9db76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]> Date: Tue, 31 Mar 2026 19:17:48 +0200 Subject: [PATCH 3/3] configure: treat unrecognized option warnings as errors in test_ld MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes dummy warnings when link/lld-link is called by the clang: lld-link: warning: ignoring unknown argument '--as-needed' lld-link: warning: ignoring unknown argument '-rpath-link=:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil' Signed-off-by: Kacper Michajłow <[email protected]> --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 195a2452f3..98720807e9 100755 --- a/configure +++ b/configure @@ -1300,7 +1300,14 @@ test_ld(){ test_$type $($cflags_filter $flags) || return flags=$($ldflags_filter $flags) libs=$($ldflags_filter $libs) - test_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs + log $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs + output=$($ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs 2>&1) + ret=$? + echo "$output" >> $logfile + # link.exe and lld-link exit 0 even for unrecognized options, emitting + # only a warning (LNK4044 / "ignoring unknown argument"). Treat such + # output as failure so check_ldflags rejects those flags correctly. + test $ret -eq 0 && ! echo "$output" | grep -qE 'LNK4044|lld-link: warning: ignoring unknown argument' } check_ld(){ -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
