diff --git a/configure b/configure
index c817161c9d38041ca03e8aff626897852e181420..764203d368eac15f4e39cf70173c32c38c0618f0 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 fb816a8caf1cd32aa67af099f3ce3e5370b29e3a..27d05f29050054391910ac60aa7fa7dd40926748 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 #
 ################