diff --git a/README b/README index be9382ac..cb42b0ba 100644 --- a/README +++ b/README @@ -44,15 +44,16 @@ Dependencies ============ The following features are enabled by default and may *) require external -libraries. They can be controlled through configure options. - -Feature Package Configure options -------------------------- ------- ---------------------------- -PNG image support zlib --without-zlib - --with-zlib=DIR -National language support gettext --disable-nls -Decoding Windows XP tags libiconv --without-libiconv-prefix - --with-libiconv-prefix[=DIR] +libraries. They can be controlled through configure options. See also +'./configure --help'. + +Feature Package Configure options +-------------------------- ------- ---------------------------- +PNG image support zlib --without-zlib + --with-zlib=DIR +National language support gettext --disable-nls +Converting Windows XP tags libiconv --disable-printucs2 + --with-libiconv-prefix[=DIR] zlib http://www.zlib.net/ gettext *) http://www.gnu.org/software/gettext/ diff --git a/config/config.h.in b/config/config.h.in index 16a12c61..43696210 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -28,6 +28,9 @@ /* Define to 1 if you have the `iconv' function. */ #undef HAVE_ICONV +/* Define to 1 to enable conversion of UCS2 encoded Windows tags to UTF-8. */ +#undef HAVE_PRINTUCS2 + #endif /* !EXV_COMMERCIAL_VERSION */ /* Define to `const' or to empty, depending on the second argument of `iconv'. */ diff --git a/config/configure.ac b/config/configure.ac index 98f95c83..3db69b60 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -107,6 +107,23 @@ if test "$USE_LENSDATA" = "yes"; then AC_DEFINE(HAVE_LENSDATA,1) fi +AC_MSG_CHECKING([whether to convert UCS2 encoded Windows tags with iconv ]) +AC_ARG_ENABLE(printucs2, + [ --disable-printucs2 do not convert UCS2 encoded Windows tag to UTF-8 ], + USE_PRINTUCS2=$enableval, USE_PRINTUCS2=yes) +AC_MSG_RESULT($USE_PRINTUCS2) +if test "$USE_PRINTUCS2" = "yes"; then + AC_DEFINE(HAVE_PRINTUCS2,1) +else +# if NLS is also disabled, don't link with iconv +# (since in some cases, AM_GNU_GETTEXT and/or AM_ICONV configure for this anyway) + if test "$USE_NLS" = "no"; then + unset LIBICONV + unset LTLIBICONV + fi +fi + +# Udi's hack to add libiconv to the Libs section in exiv2.pc if test "$enable_shared" = "no"; then EXV_LIB_STATIC=$LTLIBICONV else diff --git a/src/exv_msvc.h b/src/exv_msvc.h index cafe123d..f9983da9 100644 --- a/src/exv_msvc.h +++ b/src/exv_msvc.h @@ -46,6 +46,9 @@ /* Define to 1 if you have the `iconv' function. */ # undef EXV_HAVE_ICONV +/* Define to 1 to enable conversion of UCS2 encoded Windows tags to UTF-8. */ +# undef EXV_HAVE_PRINTUCS2 + #endif /* !EXV_COMMERCIAL_VERSION */ /* File path seperator */ diff --git a/src/tags.cpp b/src/tags.cpp index 5a0ba931..b69eed4e 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -1677,7 +1677,7 @@ namespace Exiv2 { std::ostream& printUcs2(std::ostream& os, const Value& value) { -#ifdef EXV_HAVE_ICONV +#if defined EXV_HAVE_ICONV && defined EXV_HAVE_PRINTUCS2 bool go = true; iconv_t cd = (iconv_t)(-1); if (value.typeId() != unsignedByte) { @@ -1726,9 +1726,9 @@ namespace Exiv2 { if (!go) { os << value; } -#else // !EXV_HAVE_ICONV +#else // !(EXV_HAVE_ICONV && EXV_HAVE_PRINTUCS2) os << value; -#endif // EXV_HAVE_ICONV +#endif // EXV_HAVE_ICONV && EXV_HAVE_PRINTUCS2 return os; } // printUcs2