From 545a6e108c601fc817034ea75d96f776882d27ec Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Mon, 28 Jun 2021 07:51:22 +0200
Subject: [PATCH] BUILD: Check manually if the SDL2_image library is present

---
 configure    | 10 ++++++++++
 configure.ac |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/configure b/configure
index c817161c..764203d3 100755
--- a/configure
+++ b/configure
@@ -18954,6 +18954,16 @@ $as_echo "#define LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION /**/" >>confdefs.h
 fi
 
 
+pkg-config --exists SDL2_image 2>/dev/null 1>&2
+if test $? -ne 0 ; then
+    as_fn_error $? "unable to find the IMG_ReadXPMFromArray() function from the SDL2_image library" "$LINENO" 5
+else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: Lib SDL2_image is present" >&5
+$as_echo "Lib SDL2_image is present" >&6; }
+    CFLAGS="`pkg-config --cflags SDL2_image` ${CFLAGS}"
+    LDFLAGS="`pkg-config --libs SDL2_image`"
+fi
+
 ################
 # CONF RESULTS #
 ################
diff --git a/configure.ac b/configure.ac
index fb816a8c..27d05f29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -441,6 +441,15 @@ AC_CHECK_LIB([sqlite3], [sqlite3_hard_heap_limit64], [
     AC_DEFINE([LKT_NO_SQLITE3_HARD_HEAP_LIMIT64_FUNCTION], [], [No hard heap limit for sqlite3])
 ])
 
+pkg-config --exists SDL2_image 2>/dev/null 1>&2
+if test $? -ne 0 ; then
+    AC_MSG_ERROR([unable to find the IMG_ReadXPMFromArray() function from the SDL2_image library])
+else
+    AC_MSG_RESULT(Lib SDL2_image is present)
+    CFLAGS="`pkg-config --cflags SDL2_image` ${CFLAGS}"
+    LDFLAGS="`pkg-config --libs SDL2_image`"
+fi
+
 ################
 # CONF RESULTS #
 ################
-- 
GitLab