AC_SEARCH_LIBS([idn2_check_version], [idn2], [
AC_DEFINE([HAVE_LIBIDN2], 1, [Define to 1 if you have the GNU idn2 library])
- dnl -lunistring is needed for static linking
- AC_SEARCH_LIBS([u8_strconv_from_locale], [unistring], [LIBS="$LIBS -lunistring"])
MUTTLIBS="$MUTTLIBS $LIBS"
+ dnl -lunistring is needed for static linking, and has to come
+ dnl after the -lidn2
+ AC_SEARCH_LIBS([u8_strconv_from_locale], [unistring], [
+ if test "$ac_cv_search_u8_strconv_from_locale" != "none required"; then
+ MUTTLIBS="$MUTTLIBS -lunistring"
+ fi
+ ])
+
dnl libidn2 >= 2.0.0 declares compatibility macros in idn2.h
LIBS="$LIBS $LIBICONV"
AC_CHECK_DECL([idna_to_unicode_8z8z],