--- /dev/null
+From 40427bd4ec62fe12e6dc3a8cc61b9d644be98c96 Mon Sep 17 00:00:00 2001
+From: Gilles Talis <gilles.talis@gmail.com>
+Date: Sun, 26 Mar 2017 10:18:22 +0200
+Subject: [PATCH] configure.ac: Use PKG_CHECK_MODULES to check libtiff
+ availability
+
+When built statically, leptonica is not able to find specified
+libtiff function that will determine whether library is available
+or not.
+Using PKG_CHECK_MODULES fixes the issue.
+
+Signed-off-by: Gilles Talis <gilles.talis@gmail.com>
+---
+ configure.ac | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index e64cde6..52a9e0e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -66,13 +66,12 @@ AS_IF([test "x$with_giflib" != xno],
+
+ AM_CONDITIONAL([HAVE_LIBGIF], [test "x$ac_cv_lib_gif_DGifOpenFileHandle" = xyes])
+
+-AS_IF([test "x$with_libtiff" != xno],
+- AC_CHECK_LIB([tiff], [TIFFOpen],
+- AC_DEFINE([HAVE_LIBTIFF], 1, [Define to 1 if you have libtiff.]) AC_SUBST([LIBTIFF_LIBS], [-ltiff]),
+- AS_IF([test "x$with_libtiff" = xyes], AC_MSG_ERROR([libtiff support requested but library not found])),
+- ${LIBM} ${ZLIB_LIBS} ${JPEG_LIBS}
++if test "x$with_libtiff" != xno; then
++ PKG_CHECK_MODULES([LIBTIFF], [libtiff-4],
++ AC_DEFINE([HAVE_LIBTIFF], 1, [Define to 1 if you have libtiff.]),
++ AS_IF([test "x$with_libtiff" = xyes], AC_MSG_ERROR([libtiff support requested but library not found]))
+ )
+-)
++fi
+
+ AS_IF([test "x$with_libwebp" != xno],
+ AC_CHECK_LIB([webp], [WebPGetInfo],
+--
+2.5.0
+
LEPTONICA_LICENSE_FILES = leptonica-license.txt
LEPTONICA_INSTALL_STAGING = YES
+# we patch configure.ac
+LEPTONICA_AUTORECONF = YES
+
+# PKG_CHECK_MODULES() is used in configure.ac patch
+LEPTONICA_DEPENDENCIES = host-pkgconf
+
LEPTONICA_CONF_OPTS += --disable-programs
ifeq ($(BR2_PACKAGE_GIFLIB),y)