# # # rename "idna" # to "Attic/idna" # # add_file "m4/idna.m4" # content [2df4573453a2d99819151ab1592336d21e8d6336] # # patch "Makefile.am" # from [c5e30b4ffd7833c2d1dd64720e97ef272b993cce] # to [8984e93a65029bf29758817f6a3ea0a26275cceb] # # patch "charset.cc" # from [def75cc4314c266b06bc44652c52367b82a9ad3a] # to [a333e7df52c080e66a3abea0ed498bbcf1bdcc40] # # patch "configure.ac" # from [7de4a4102fa40ee4b292c54cceaf2bb3521b542b] # to [6c2029830e62327110f46fc619497a5df136e2d2] # ============================================================ --- m4/idna.m4 2df4573453a2d99819151ab1592336d21e8d6336 +++ m4/idna.m4 2df4573453a2d99819151ab1592336d21e8d6336 @@ -0,0 +1,53 @@ +AC_DEFUN([MTN_FIND_IDNA], +[ PKG_PROG_PKG_CONFIG + + # We manually test the variables here because we want them to work + # even if pkg-config isn't installed. The use of + instead of :+ is + # deliberate; the user should be able to tell us that the empty string + # is the correct set of flags. (PKG_CHECK_MODULES gets this wrong!) + if test -n "${LIBIDN_CFLAGS+set}" || test -n "${LIBIDN_LIBS+set}"; then + found_libidn=yes + else + PKG_CHECK_MODULES([LIBIDN], [libidn], + [found_libidn=yes], [found_libidn=no]) + fi + + if test $found_libidn = no; then + AC_MSG_RESULT([no; guessing]) + AC_CHECK_LIB([libidn], [idna_strerror], + [LIBIDN_LIBS=-lidn]) + LIBIDN_CFLAGS= + fi + + LIBIDN_CPPFLAGS="$LIBIDN_CFLAGS" + + # AC_MSG_NOTICE([using libidn compile flags: "$LIBIDN_CPPFLAGS"]) + # AC_MSG_NOTICE([using libidn link flags: "$LIBIDN_LIBS"]) + + AC_SUBST(LIBIDN_CPPFLAGS) + AC_SUBST(LIBIDN_LIBS) + + AC_CACHE_CHECK([whether the libidn library is usable], ac_cv_lib_libidn_works, + [save_LIBS="$LIBS" + save_CPPFLAGS="$CPPFLAGS" + LIBS="$LIBS $LIBIDN_LIBS" + CPPFLAGS="$CPPFLAGS $LIBIDN_CPPFLAGS" + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [ +extern "C" +{ + #include +} + ], + [ +const char * error = idna_strerror(IDNA_SUCCESS); + ])], + [ac_cv_lib_libidn_works=yes], [ac_cv_lib_libidn_works=no]) + LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS"]) + if test $ac_cv_lib_libidn_works = no; then + AC_MSG_ERROR([Your libidn library is not usable.]) + fi + +]) + ============================================================ --- Makefile.am c5e30b4ffd7833c2d1dd64720e97ef272b993cce +++ Makefile.am 8984e93a65029bf29758817f6a3ea0a26275cceb @@ -111,12 +111,6 @@ BOOST_SANDBOX_SOURCES = \ boost/circular_buffer_fwd.hpp \ boost/circular_buffer.hpp -IDNA_SOURCES = \ - idna/gunibreak.h idna/gunidecomp.h idna/idna.h idna/nfkc.c \ - idna/punycode.c idna/rfc3454.c idna/stringprep.h idna/version.c \ - idna/gunicomp.h idna/idna.c idna/idn-int.h idna/profiles.c \ - idna/punycode.h idna/stringprep.c idna/toutf8.c - UNIX_PLATFORM_SOURCES = \ unix/read_password.cc unix/get_system_flavour.cc \ unix/process.cc unix/terminal.cc unix/inodeprint.cc \ @@ -192,7 +186,6 @@ lib3rdparty_a_SOURCES = $(BOOST_SANDBOX_ noinst_LIBRARIES = libplatform.a lib3rdparty.a libplatform_a_SOURCES = platform.hh tester-plaf.hh lib3rdparty_a_SOURCES = $(BOOST_SANDBOX_SOURCES) \ - $(IDNA_SOURCES) \ $(NETXX_SOURCES) htmldir = $(datadir)/doc/monotone ============================================================ --- charset.cc def75cc4314c266b06bc44652c52367b82a9ad3a +++ charset.cc a333e7df52c080e66a3abea0ed498bbcf1bdcc40 @@ -11,10 +11,9 @@ #include "vector.hh" #include +#include +#include -#include "idna/idna.h" -#include "idna/stringprep.h" - #include "charset.hh" #include "numeric_vocab.hh" #include "sanity.hh" @@ -48,13 +47,19 @@ charset_convert(string const & src_chars dst = src; else { + string tmp_charset(dst_charset); + +#ifdef ICONV_TRANSLIT + if (best_effort) + tmp_charset += "//TRANSLIT"; +#endif + char * converted = stringprep_convert(src.c_str(), - dst_charset.c_str(), - src_charset.c_str(), - best_effort); + tmp_charset.c_str(), + src_charset.c_str()); E(converted != NULL, F("failed to convert string from %s to %s: '%s'") - % src_charset % dst_charset % src); + % src_charset % tmp_charset % src); dst = string(converted); free(converted); } ============================================================ --- configure.ac 7de4a4102fa40ee4b292c54cceaf2bb3521b542b +++ configure.ac 6c2029830e62327110f46fc619497a5df136e2d2 @@ -144,6 +144,7 @@ MTN_FIND_SQLITE MTN_FIND_PCRE MTN_FIND_BOTAN MTN_FIND_SQLITE +MTN_FIND_IDNA # check for all things boost-related BOOST_VERSION_CHECK