Skip to content
Snippets Groups Projects
Commit aa5c7b96 authored by Alberto Massari's avatar Alberto Massari
Browse files

Enable selection of the GNU iconv transcoder

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@405840 13f79535-47bb-0310-9956-ffa450edef68
parent 6327e087
No related branches found
No related tags found
No related merge requests found
......@@ -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])
]
)
......
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment