GraphicsMagick: configure.ac: Use CPPFLAGS delivered by pkg-conf...

GraphicsMagick Commits <[email protected]> Tue, 14 Nov 2023 08:20:25 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.2311.1699971632.1408.graphicsmagick-commit@lists.sourceforge.net>
changeset cda86fcb8814 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=cda86fcb8814
summary: configure.ac: Use CPPFLAGS delivered by pkg-config for libheif

diffstat:

 ChangeLog          |   5 +++++
 configure          |  27 ++++++++++++++++++++++++++-
 configure.ac       |  27 ++++++++++++++++++++++++++-
 www/Changelog.html |   4 ++++
 4 files changed, 61 insertions(+), 2 deletions(-)

diffs (126 lines):

diff -r 3d1ba3ed2aca -r cda86fcb8814 ChangeLog
--- a/ChangeLog	Tue Nov 14 08:11:47 2023 -0600
+++ b/ChangeLog	Tue Nov 14 08:20:16 2023 -0600
@@ -1,5 +1,10 @@
 2023-11-14  Bob Friesenhahn  <[email protected]>
 
+	* configure.ac: Use CPPFLAGS delivered by pkg-config for
+	libheif. Applied patch
+	configure-libheif-cppflags-deduplicated2.patch from SourceForge
+	patch #79 "Use CPPFLAGS delivered by pkg-config".
+
 	* coders/tiff.c (WriteTIFFImage): Call TIFFFlush() to detect any
 	errors which might otherwise be lost by TIFFClose().  Restore
 	broken file deletion code.
diff -r 3d1ba3ed2aca -r cda86fcb8814 configure
--- a/configure	Tue Nov 14 08:11:47 2023 -0600
+++ b/configure	Tue Nov 14 08:20:16 2023 -0600
@@ -27623,6 +27623,7 @@
     failed=0
     passed=0
     heif_libs=''
+    heif_cflags=''
     # Use pkg-config to handle different optional codec libs
     # and if pkg-config is not available fallback to manual search.
 
@@ -27714,7 +27715,7 @@
 	HEIF_LIBS=$pkg_cv_HEIF_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	heif_libs=$HEIF_LIBS; passed=1;
+	heif_libs=$HEIF_LIBS; heif_cflags=$HEIF_CFLAGS; passed=1;
 fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for heif_context_alloc in -lheif" >&5
 $as_echo_n "checking for heif_context_alloc in -lheif... " >&6; }
@@ -27782,6 +27783,30 @@
     else
         LIB_HEIF="$heif_libs"
         LIBS="$LIB_HEIF $LIBS"
+        for flag in $heif_cflags
+        do
+          case $flag in
+            -I*)
+              # Add flag to CPPFLAGS if not already present
+              add=yes
+              for test_flag in $CPPFLAGS
+              do
+                if test $flag = $test_flag
+                then
+                  add=no
+                  break
+                fi
+              done
+              if test $add = yes
+              then
+                CPPFLAGS="$CPPFLAGS $flag"
+              fi
+              break
+              ;;
+            *)
+              ;;
+          esac
+        done
 
 $as_echo "#define HasHEIF 1" >>confdefs.h
 
diff -r 3d1ba3ed2aca -r cda86fcb8814 configure.ac
--- a/configure.ac	Tue Nov 14 08:11:47 2023 -0600
+++ b/configure.ac	Tue Nov 14 08:20:16 2023 -0600
@@ -2650,10 +2650,11 @@
     failed=0
     passed=0
     heif_libs=''
+    heif_cflags=''
     # Use pkg-config to handle different optional codec libs
     # and if pkg-config is not available fallback to manual search.
     PKG_CHECK_MODULES([HEIF], [libheif],
-        [heif_libs=$HEIF_LIBS; passed=1;],
+        [heif_libs=$HEIF_LIBS; heif_cflags=$HEIF_CFLAGS; passed=1;],
         [AC_CHECK_HEADER([libheif/heif.h],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`])
         # Assume sensible default for codec; This will fail with a static
         # libheif that contains a avif codec.
@@ -2670,6 +2671,30 @@
     else
         LIB_HEIF="$heif_libs"
         LIBS="$LIB_HEIF $LIBS"
+        for flag in $heif_cflags
+        do
+          case $flag in
+            -I*)
+              # Add flag to CPPFLAGS if not already present
+              add=yes
+              for test_flag in $CPPFLAGS
+              do
+                if test $flag = $test_flag
+                then
+                  add=no
+                  break
+                fi
+              done
+              if test $add = yes
+              then
+                CPPFLAGS="$CPPFLAGS $flag"
+              fi
+              break
+              ;;
+            *)
+              ;;
+          esac
+        done
         AC_DEFINE([HasHEIF],[1],[Define if you have HEIF library])
         AC_MSG_RESULT([yes])
         have_heif='yes'
diff -r 3d1ba3ed2aca -r cda86fcb8814 www/Changelog.html
--- a/www/Changelog.html	Tue Nov 14 08:11:47 2023 -0600
+++ b/www/Changelog.html	Tue Nov 14 08:20:16 2023 -0600
@@ -40,6 +40,10 @@
 <p>2023-11-14  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>configure.ac: Use CPPFLAGS delivered by pkg-config for
+libheif. Applied patch
+configure-libheif-cppflags-deduplicated2.patch from SourceForge
+patch #79 &quot;Use CPPFLAGS delivered by pkg-config&quot;.</p></li>
 <li><p>coders/tiff.c (WriteTIFFImage): Call TIFFFlush() to detect any
 errors which might otherwise be lost by TIFFClose().  Restore
 broken file deletion code.</p></li>