# HG changeset patch
# User Fabian Groffen <grob...@gentoo.org>
# Date 1356106486 -3600
# Branch HEAD
# Node ID 7c1baf76330f4954a4c26b62e7e95c154e7bafb5
# Parent  5554d811eb999595b74b890d5e7ca7484bca9c7a
configure: refine libidn test not to report false positive

Do not assume idna headers exist on the system if libidn was found.
(see the code, e.g. main.c, mutt_idna.h).

In addition, try and use Solaris/OpenIndiana included libidn.  Solaris
has the idn headers in /usr/include/idn.  However, to use them, one has
to have /usr/include/idn in the search path.  So, append this to the
search path, as it shouldn't hurt anyone.

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1149,7 +1149,7 @@ fi # libiconv
 
 dnl -- IDN depends on iconv
 
-AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for 
domain names]),
+AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use libidn for 
domain names]),
                 [
                  if test "$with_idn" != "no" ; then
                        if test "$with_idn" != "yes" ; then
@@ -1168,13 +1168,21 @@ if test "x$with_idn" != "xno"; then
       AC_MSG_ERROR([IDN requested but iconv is disabled or unavailable])
     fi
   else
-    AC_SEARCH_LIBS([stringprep_check_version], [idn], [
-      AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the `idn' library])
-      MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
-    ])
-    AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
-    AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
-    AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
+    # Solaris has idn headers in /usr/include/idn, but in order to
+    # include them, one needs /usr/include/idn in the search path, so
+    # add that here at the end, where it won't hurt for anyone else
+       CPPFLAGS="$CPPFLAGS -I/usr/include/idn"
+    idnhdrs=yes
+    AC_CHECK_HEADERS([idna.h stringprep.h], , [idnhdrs=no])
+       if test "x$idnhdrs" != "xno"; then
+      AC_SEARCH_LIBS([stringprep_check_version], [idn], [
+        AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the `idn' 
library])
+        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
+      ])
+      AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
+      AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
+      AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
+    fi
   fi
 fi
 

Reply via email to