From: Kevin McCarthy Date: Wed, 9 May 2018 02:32:12 +0000 (-0700) Subject: Add declaration checks for libidn2. X-Git-Tag: mutt-1-10-rel~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16a581cfe6480e65c2ff813710a8d6618017857b;p=mutt Add declaration checks for libidn2. The libidn compatibilty layer was only added in version 2.0.0 (2017-03-29). idn2.h defines macros, so use AC_CHECK_DECL instead of AC_CHECK_FUNC. $with_idn2 doesn't have an "auto" state, so remove a few unneeded copy/paste checks from idn. --- diff --git a/configure.ac b/configure.ac index 5c6de33c..41550180 100644 --- a/configure.ac +++ b/configure.ac @@ -1354,9 +1354,7 @@ fi dnl idna2 if test "x$with_idn2" != "xno"; then if test "$am_cv_func_iconv" != "yes"; then - if test "$with_idn2" != "auto"; then - AC_MSG_ERROR([IDN2 requested but iconv is disabled or unavailable]) - fi + AC_MSG_ERROR([IDN2 requested but iconv is disabled or unavailable]) else dnl Solaris 11 has /usr/include/idn have_idn2_h=no @@ -1371,18 +1369,46 @@ if test "x$with_idn2" != "xno"; then AC_DEFINE([HAVE_LIBIDN2], 1, [Define to 1 if you have the GNU idn2 library]) MUTTLIBS="$MUTTLIBS $LIBS" + dnl libidn2 >= 2.0.0 declares compatibility macros in idn2.h LIBS="$LIBS $LIBICONV" - AC_DEFINE([HAVE_IDNA_TO_UNICODE_8Z8Z]) - AC_DEFINE([HAVE_IDNA_TO_ASCII_8Z]) - AC_DEFINE([HAVE_IDNA_TO_ASCII_LZ]) + AC_CHECK_DECL([idna_to_unicode_8z8z], + [AC_DEFINE([HAVE_IDNA_TO_UNICODE_8Z8Z])], [], + [[ +#if defined(HAVE_IDN2_H) +#include +#elif defined(HAVE_IDN_IDN2_H) +#include +#endif + ]]) + AC_CHECK_DECL([idna_to_ascii_8z], + [AC_DEFINE([HAVE_IDNA_TO_ASCII_8Z])], [], + [[ +#if defined(HAVE_IDN2_H) +#include +#elif defined(HAVE_IDN_IDN2_H) +#include +#endif + ]]) + AC_CHECK_DECL([idna_to_ascii_lz], + [AC_DEFINE([HAVE_IDNA_TO_ASCII_LZ])], [], + [[ +#if defined(HAVE_IDN2_H) +#include +#elif defined(HAVE_IDN_IDN2_H) +#include +#endif + ]]) ]) LIBS="$mutt_save_LIBS" - if test "$with_idn2" != "no"; then - if test "$have_idn2_h" = "no" || test "$ac_cv_search_idn2_check_version" = "no"; then - AC_MSG_ERROR([IDN2 was requested, but libidn2 was not usable on this system]) - fi + if test "$have_idn2_h" = "no" || \ + test "$ac_cv_search_idn2_check_version" = "no" || \ + test "x$ac_cv_have_decl_idna_to_unicode_8z8z" != "xyes" || \ + test "x$ac_cv_have_decl_idna_to_ascii_8z" != "xyes" || \ + test "x$ac_cv_have_decl_idna_to_ascii_lz" != "xyes" + then + AC_MSG_ERROR([IDN2 was requested, but libidn2 was not usable on this system]) fi fi fi