From 1baceb95bd8e6f35c25bc7afdc6a88c8f6264f3f Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Mon, 20 Aug 2018 19:06:08 +0200
Subject: [PATCH] Fix static build with libidn2 and libunistring

When libidn2 is statically build with libunistring support, mutt needs
to add -lunistring to LIBS.
To do that, add a call to PKG_CHECK_MODULES to retrieve this information
from libidn2.pc

Fixes:
 - http://autobuild.buildroot.net/results/177da8f4798f69298db5385957184f1c53cca923

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 29252173..2e69ac19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1341,6 +1341,10 @@ AC_ARG_WITH(idn2, AS_HELP_STRING([--with-idn2=@<:@PFX@:>@],[Use GNU libidn2 for
             if test "$with_idn2" != "yes" ; then
               CPPFLAGS="$CPPFLAGS -I$with_idn2/include"
               LDFLAGS="$LDFLAGS -L$with_idn2/lib"
+            else
+              PKG_CHECK_MODULES([LIBIDN2], libidn2,
+                                 [CPPFLAGS="$CPPFLAGS $LIBIDN2_CFLAGS"
+                                 LIBS="$LIBIDN2_LIBS"])
             fi
           fi
         ],
-- 
2.14.1

