diff --git a/m4/xerces_transcoder_selection.m4 b/m4/xerces_transcoder_selection.m4 index c7ae6830d3b7e95acdc5cd7683584482ea71a51f..c17c5d84a2b17760e712d8f178b8065a2b81f2bd 100644 --- a/m4/xerces_transcoder_selection.m4 +++ b/m4/xerces_transcoder_selection.m4 @@ -21,6 +21,25 @@ AC_DEFUN([XERCES_TRANSCODER_SELECTION], tc_list= + # Check for GNU iconv support + no_GNUiconv=false + AC_CHECK_HEADERS([iconv.h wchar.h string.h stdlib.h stdio.h ctype.h locale.h errno.h endian.h], [], [no_GNUiconv=true]) + AC_CHECK_FUNCS([iconv_open iconv_close iconv], [], [no_GNUiconv=true]) + AC_MSG_CHECKING([whether we can support the GNU iconv Transcoder]) + list_add= + AS_IF([! $no_GNUiconv], [ + AC_ARG_ENABLE([transcoder-gnuiconv], + AS_HELP_STRING([--enable-transcoder-gnuiconv], + [Enable GNU iconv-based transcoder support]), + [AS_IF([test x"$enableval" = xyes], + [list_add=GNUICONV])], + [list_add=gnuiconv]) + ]) + AS_IF([test x"$list_add" != x], + [tc_list="$tc_list -$list_add-"; AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)] + ) + # Check for iconv support no_iconv=false AC_CHECK_HEADERS([wchar.h], [], [no_iconv=true]) @@ -124,6 +143,12 @@ AC_DEFUN([XERCES_TRANSCODER_SELECTION], break ;; + *-gnuiconv-*) + transcoder=gnuiconv + AC_DEFINE([XERCES_USE_TRANSCODER_GNUICONV], 1, [Define to use the GNU iconv transcoder]) + break + ;; + *-iconv-*) transcoder=iconv AC_DEFINE([XERCES_USE_TRANSCODER_ICONV], 1, [Define to use the iconv transcoder]) @@ -151,10 +176,11 @@ AC_DEFUN([XERCES_TRANSCODER_SELECTION], # Define the auto-make conditionals which determine what actually gets compiled # Note that these macros can't be executed conditionally, which is why they're here, not above. - AM_CONDITIONAL([XERCES_USE_TRANSCODER_ICU], [test x"$transcoder" = xicu]) + AM_CONDITIONAL([XERCES_USE_TRANSCODER_ICU], [test x"$transcoder" = xicu]) AM_CONDITIONAL([XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER], [test x"$transcoder" = xmacosunicodeconverter]) - AM_CONDITIONAL([XERCES_USE_TRANSCODER_ICONV], [test x"$transcoder" = xiconv]) - AM_CONDITIONAL([XERCES_USE_TRANSCODER_WINDOWS], [test x"$transcoder" = xwindows]) + AM_CONDITIONAL([XERCES_USE_TRANSCODER_GNUICONV], [test x"$transcoder" = xgnuiconv]) + AM_CONDITIONAL([XERCES_USE_TRANSCODER_ICONV], [test x"$transcoder" = xiconv]) + AM_CONDITIONAL([XERCES_USE_TRANSCODER_WINDOWS], [test x"$transcoder" = xwindows]) ] ) diff --git a/src/Makefile.am b/src/Makefile.am index 2a6abf9576d9988e086cc86edc16f077f679fc05..c90e70ef3bf888a1bd8b175a5df4b87f098d4d77 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,6 +138,13 @@ libicutc_la_SOURCES = ${icu_sources} libicutc_la_CXXFLAGS = ${AM_CXXFLAGS} -I${ICU_PREFIX}/include endif +if XERCES_USE_TRANSCODER_GNUICONV +src_libraries += libgnuiconvtc.la +libgnuiconvtc_ladir = ${includedir} +nobase_libgnuiconvtc_la_HEADERS = ${gnuiconv_headers} +libgnuiconvtc_la_SOURCES = ${gnuiconv_sources} +endif + if XERCES_USE_TRANSCODER_ICONV src_libraries += libiconvtc.la libiconvtc_ladir = ${includedir} @@ -1072,6 +1079,12 @@ icu_headers = \ icu_sources = \ xercesc/util/Transcoders/ICU/ICUTransService.cpp +gnuiconv_headers = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp + +gnuiconv_sources = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp + iconv_headers = \ xercesc/util/Transcoders/Iconv/IconvTransService.hpp diff --git a/src/xercesc/util/PlatformUtils.cpp b/src/xercesc/util/PlatformUtils.cpp index 2e28d5d147f6ee4b31ff2680d064be53819de603..c34247c70120202cf1b7914fd64c5214722646bf 100644 --- a/src/xercesc/util/PlatformUtils.cpp +++ b/src/xercesc/util/PlatformUtils.cpp @@ -120,6 +120,9 @@ #if XERCES_USE_TRANSCODER_ICU # include <xercesc/util/Transcoders/ICU/ICUTransService.hpp> #endif +#if XERCES_USE_TRANSCODER_GNUICONV +# include <xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp> +#endif #if XERCES_USE_TRANSCODER_ICONV # include <xercesc/util/Transcoders/Iconv/IconvTransService.hpp> #endif @@ -473,6 +476,8 @@ XMLTransService* XMLPlatformUtils::makeTransService() #if defined (XERCES_USE_TRANSCODER_ICU) tc = new ICUTransService; + #elif defined (XERCES_USE_TRANSCODER_GNUICONV) + tc = new IconvGNUTransService; #elif defined (XERCES_USE_TRANSCODER_ICONV) tc = new IconvTransService; #elif defined (XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER)