Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marvin Scholz via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Marvin Scholz <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] Cleanup OpenColorIO detection (PR #21773)
Date: Tue, 17 Feb 2026 13:30:14 -0000
Message-ID: <177133501510.25.3241520465582664203@29965ddac10e> (raw)

PR #21773 opened by Marvin Scholz (ePirat)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21773
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21773.patch

Introduce a function (require_pkg_config_cxx) to properly check for C++ pkg-config dependencies with a class name and remove the confusingly named require_cpp and check_lib_cpp which were added for it before, as those have nothing to do with the C pre-processor so should be named _cxx but we already have functions for that purpose, so there is little value in keeping them.


>From f1cecb551298a373e58ee001fe2fa86c02070c16 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Wed, 18 Sep 2024 23:18:46 +0200
Subject: [PATCH 1/4] configure: add {test,check,require}_pkg_config_cxx

This is necessary to check for C++ only pkg-config dependencies
---
 configure | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/configure b/configure
index 8a397598cd..9e2dfe4050 100755
--- a/configure
+++ b/configure
@@ -1642,6 +1642,26 @@ test_pkg_config_cpp(){
         set_sanitized "${name}_incflags" $pkg_incflags
 }
 
+test_pkg_config_cxx(){
+    log test_pkg_config_cxx "$@"
+    name="$1"
+    pkg_version="$2"
+    pkg="${2%% *}"
+    headers="$3"
+    classes="$4"
+    shift 4
+    disable $name
+    test_cmd $pkg_config --exists --print-errors $pkg_version || return
+    pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
+    pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
+    pkg_incdir=$($pkg_config --variable=includedir $pkg_config_flags $pkg)
+    check_class_headers_cxx "$headers" "$classes" $pkg_cflags $pkg_libs "-lstdc++" "$@" &&
+        enable $name &&
+        set_sanitized "${name}_cflags"    $pkg_cflags &&
+        set_sanitized "${name}_incdir"    $pkg_incdir &&
+        set_sanitized "${name}_extralibs" $pkg_libs "-lstdc++"
+}
+
 check_pkg_config(){
     log check_pkg_config "$@"
     name="$1"
@@ -1656,6 +1676,13 @@ check_pkg_config_cpp(){
         eval add_cflags \$${name}_cflags
 }
 
+check_pkg_config_cxx(){
+    log check_pkg_config_cxx "$@"
+    name="$1"
+    test_pkg_config_cxx "$@" &&
+        eval add_cxxflags \$${name}_cflags
+}
+
 check_pkg_config_header_only(){
     log check_pkg_config_cpp "$@"
     name="$1"
@@ -1809,6 +1836,12 @@ require_pkg_config_cpp(){
     check_pkg_config_cpp "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
 }
 
+require_pkg_config_cxx(){
+    log require_pkg_config_cxx "$@"
+    pkg_version="$2"
+    check_pkg_config_cxx "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
+}
+
 test_host_cc(){
     log test_host_cc "$@"
     cat > $TMPC
-- 
2.52.0


>From 8017a0e92fbbfa8bae68a9b14f2a9707ec261fee Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Tue, 17 Feb 2026 14:17:16 +0100
Subject: [PATCH 2/4] configure: do not require default-constructible class

When checking for C++ classes in check_class_headers_cxx, the test code
required the class to be default-constructible, which is not always the
case. For the sake of the test, it is enough to check that referencing
the class succeeds.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 9e2dfe4050..063930bea8 100755
--- a/configure
+++ b/configure
@@ -1499,7 +1499,7 @@ check_class_headers_cxx(){
         echo "int main(void) { "
         i=1
         for class in $classes; do
-            echo "$class obj$i;"
+            echo "$class *obj$i;"
             i=$(expr $i + 1)
         done
         echo "return 0; }"
-- 
2.52.0


>From 5fde80eda180f37760164cf6af45f701de14b8c4 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Tue, 17 Feb 2026 14:25:16 +0100
Subject: [PATCH 3/4] configure: cleanup libopencolorio check

Do a proper pkg-config check instead of just blindly compiling a test
program even if pkg-config doesn't find anything.
---
 configure | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/configure b/configure
index 063930bea8..35fb6ae9ee 100755
--- a/configure
+++ b/configure
@@ -7338,10 +7338,7 @@ enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec
 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 enabled libopencv         && { check_pkg_config libopencv opencv4 opencv2/core/core_c.h cvCreateImageHeader ||
                                require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; }
-enabled libopencolorio    && add_cxxflags $(pkg-config --cflags OpenColorIO) &&
-                                OCIO_LIBS=$($pkg_config --libs OpenColorIO) &&
-                            require_cpp OpenColorIO OpenColorIO/OpenColorIO.h "namespace OCIO = OCIO_NAMESPACE; OCIO::ConfigRcPtr cfg = OCIO::Config::Create();" $OCIO_LIBS -lstdc++ &&
-                            append libopencolorio_extralibs "$OCIO_LIBS -lstdc++"
+enabled libopencolorio    && require_pkg_config_cxx libopencolorio "OpenColorIO" OpenColorIO/OpenColorIO.h OCIO_NAMESPACE::Config
 enabled libopenh264       && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion
 enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
                                { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
-- 
2.52.0


>From e0fdd396ecf35092d51be1dd65622b6144848941 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Tue, 17 Feb 2026 14:26:25 +0100
Subject: [PATCH 4/4] configure: remove require_cpp, check_lib_cpp

Remove the improperly named check functions that were added for the
opencolorio detection in 677cf95ea4be805fa326adb082eff666a2e790ea.
Those are not needed anymore and there are already require_cxx and
check_lib_cxx for this purpose.
---
 configure | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/configure b/configure
index 35fb6ae9ee..d226e1f5f3 100755
--- a/configure
+++ b/configure
@@ -1580,17 +1580,6 @@ check_lib(){
         enable $name && eval ${name}_extralibs="\$@"
 }
 
-check_lib_cpp(){
-    log check_lib_cpp "$@"
-    name="$1"
-    headers="$2"
-    code="$3"
-    shift 3
-    disable $name
-    test_code ld "$headers" "$code" cxx "$@" &&
-        enable $name && eval ${name}_extralibs="\$@"
-}
-
 check_lib_cxx(){
     log check_lib_cxx "$@"
     name="$1"
@@ -1804,14 +1793,6 @@ require_cxx(){
     check_lib_cxx "$name" "$@" || die "ERROR: $name_version not found"
 }
 
-require_cpp(){
-    log require_cpp "$@"
-    name_version="$1"
-    name="${1%% *}"
-    shift
-    check_lib_cpp "$name" "$@" || die "ERROR: $name_version not found"
-}
-
 require_headers(){
     log require_headers "$@"
     headers="$1"
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-02-17 13:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177133501510.25.3241520465582664203@29965ddac10e \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git