This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Volker Diels-Grabsch <v@njh.eu>
Date: Thu, 01 Jul 2021 00:52:06 +0200
Subject: [PATCH 1/1] Fix .pc file and confiure.ac for dependencies

This patch is related to:
https://sourceforge.net/p/graphicsmagick/bugs/154/

diff --git a/magick/GraphicsMagick.pc.in b/magick/GraphicsMagick.pc.in
index 1111111..2222222 100644
--- a/magick/GraphicsMagick.pc.in
+++ b/magick/GraphicsMagick.pc.in
@@ -7,6 +7,8 @@ includedir=@includedir@/GraphicsMagick
 Name: GraphicsMagick
 Version: @PACKAGE_VERSION@
 Description: GraphicsMagick image processing library
+Requires.private: freetype2 libxml-2.0 libtiff-4
 Libs: -L${libdir} -lGraphicsMagick
+Libs.private: @MAGICK_API_LDFLAGS@ @MAGICK_API_LIBS@
 Cflags: -I${includedir} @MAGICK_API_PC_CPPFLAGS@
 
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2554,13 +2554,13 @@ then
        then
           # Sample output from xml2-config --cflags:
           # -I/usr/include/libxml2
-          # -I/usr/local/include/libxml2 -I/usr/local/include
+          # -I/usr/local/include/libxml2 -I/usr/local/include -DLIBXML_STATIC
           xml2_cflags=`"$xml2_config" --cflags`
           # Sample output from xml2-config --libs:
           # -lxml2
           # -L/usr/lib -R/usr/lib -lxml2 -lz -lpthread -lm -lsocket -lnsl
-          #-L/usr/local/lib -lxml2 -lz -L/usr/local/lib -liconv -lm
-          xml2_libs=`$xml2_config  --libs`
+          # -L/usr/local/lib -lxml2 -lz -L/usr/local/lib -liconv -lm
+          xml2_libs=`"$xml2_config" --libs`
        fi
       ])
       for flag in $xml2_cflags
@@ -2587,6 +2587,29 @@ then
                     ;;
         esac
       done
+      for flag in $xml2_cflags
+      do
+        case $flag in
+             -D*)
+                # 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
+                    ;;
+                *)
+                    ;;
+        esac
+      done
       for flag in $xml2_libs
       do
             case $flag in
