$OpenBSD: patch-configure_ac,v 1.3 2017/09/25 09:16:13 robert Exp $

REVERT:
From 0927eb3e278e998248f3022c096b4f93685c6a9d Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 1 Aug 2017 11:37:20 +0100
Subject: build: Check for libtiff using pkg-config
(see https://src.fedoraproject.org/rpms/gdk-pixbuf2/c/ce26fe7648baf28217b7aad9f84cefec9f978b21?branch=master)

Fix AC_TRY_LINK.
 
Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -453,14 +453,24 @@ AC_ARG_WITH(gdiplus,
 AM_CONDITIONAL(BUILD_GDIPLUS_LOADERS, [ test x$os_win32 = xyes && test x$with_gdiplus != xno ])
 
 dnl Test for libtiff
-libtiff_found=no
 if test x$os_win32 = xno || test x$with_gdiplus = xno; then
-  if test x$with_libtiff != xno; then
-    PKG_CHECK_MODULES(TIFF, libtiff-4)
-    libtiff_found=yes
+  if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
+    AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
+      [AC_CHECK_HEADER(tiffio.h,
+        TIFF='tiff'; LIBTIFF='-ltiff',
+        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
+        [AC_CHECK_HEADER(tiffio.h,
+          TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
+          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+        [AC_CHECK_LIB(tiff34, TIFFFlushData,
+          [AC_CHECK_HEADER(tiffio.h,
+            TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
+            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+        AC_MSG_WARN(*** TIFF loader will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
   fi
 
-  if test x$with_libtiff != xno && test x$libtiff_found = xno; then
+  if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
      AC_MSG_ERROR([
 *** Checks for TIFF loader failed. You can build without it by passing
 *** --without-libtiff to configure but some programs using GTK+ may
@@ -904,7 +914,7 @@ AC_ARG_ENABLE(Bsymbolic,
               [SAVED_LDFLAGS="${LDFLAGS}"
                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
                LDFLAGS=-Wl,-Bsymbolic-functions
-               AC_TRY_LINK([], [int main (void) { return 0; }],
+               AC_TRY_LINK([], [],
                            AC_MSG_RESULT(yes)
                            enable_Bsymbolic=yes,
                            AC_MSG_RESULT(no)
