Currently, -lidn is included while linking all the mutt binaries. Add
it to MUTTLIBS instead so it's only used for the mutt linking.
Also, add $LIBICONV to $LIBS before checking for some of the idna
functions. On some sytems, there are apparently issues when using
static linking. (Thanks to grarpamp for reporting).
have_idna_h=yes
break])
+ mutt_save_LIBS="$LIBS"
+ LIBS=
+
AC_SEARCH_LIBS([stringprep_check_version], [idn], [
AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the GNU idn library])
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
+ MUTTLIBS="$MUTTLIBS $LIBS"
+
+ LIBS="$LIBS $LIBICONV"
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)
])
+ LIBS="$mutt_save_LIBS"
+
if test "$with_idn" != auto; then
if test $have_stringprep_h = no || test $have_idna_h = no || test $ac_cv_search_stringprep_check_version = no; then
AC_MSG_ERROR([IDN was requested, but libidn was not usable on this system])