--- /dev/null
+From 2fbae8298d7cc976d7c0f329fc26dafe57fb0fc4 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Mon, 1 Apr 2019 08:04:39 +0200
+Subject: [PATCH] Use pkg-config for libtiff detection
+
+Using pkg-config allows proper behavior in static-only contexts: the
+libtiff library might depend on libz and libjpeg.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[Patch retrieved (and slightly updated) from:
+https://git.buildroot.net/buildroot/tree/package/libgeotiff/0001-use-pkg-config.patch]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved (and slightly updated) from:
+https://github.com/OSGeo/libgeotiff/commit/2fbae8298d7cc976d7c0f329fc26dafe57fb0fc4]
+---
+ libgeotiff/configure.ac | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index aa38af4..c3395d5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -211,16 +211,18 @@ if test "$with_libtiff" != "" ; then
+ libgeotiff. Please upgrade or use an older version of libgeotiff.]),-lm)
+ LIBS="$LIBS_SAVED"
+ else
+- AC_CHECK_LIB(tiff,TIFFOpen,[TIFF_CONFIG=yes],
+- AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
++ PKG_CHECK_MODULES(LIBTIFF, libtiff-4,
++ [TIFF_INC="$LIBTIFF_CFLAGS" LIBS="$LIBS $LIBTIFF_LIBS" TIFF_CONFIG="yes"],
++ [AC_CHECK_LIB(tiff,TIFFOpen,[TIFF_CONFIG=yes],
++ AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
+ build libgeotiff without libtiff]),-lm)
+- LIBS_SAVED="$LIBS"
+- AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,[TIFF_CONFIG=yes],
+- AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
++ LIBS_SAVED="$LIBS"
++ AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,[TIFF_CONFIG=yes],
++ AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
+ libgeotiff. Please upgrade libtiff or use an older version of libgeotiff.]),-lm)
+- LIBS="$LIBS -ltiff"
+- TIFF_INC=
+- TIFF_CONFIG="yes"
++ LIBS="$LIBS -ltiff"
++ TIFF_INC=
++ TIFF_CONFIG="yes"])
+ fi
+
+