diff options
author | jcid <devnull@localhost> | 2008-03-14 19:04:18 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-03-14 19:04:18 +0100 |
commit | 37daa9291e959f4bebffc3d534f2c0ac38819e58 (patch) | |
tree | 55f363967525c406ecc94d7011a07d1f4bfeb33b /configure.in | |
parent | f6fab73d9f4f53fa1326fac45a344db1d4390e6a (diff) |
- Added suport for old iconv() (const char** as 2nd arg).
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 4ca4549f..a27b20df 100644 --- a/configure.in +++ b/configure.in @@ -325,6 +325,64 @@ if test "x$iconv_ok" = "xno"; then fi dnl ---------------------- +dnl Check if we need to +dnl support the old +dnl iconv interface +dnl ---------------------- +if test "x$iconv_ok" = "xyes"; then + old_libs="$LIBS" + LIBS="$old_libs $LIBICONV_LIBS" + old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([#include <iconv.h>], +[ + const char *inPtr; + char *outPtr; + size_t inLeft = 0, outRoom = 0; + iconv_t encoder = iconv_open("ASCII", "UTF-8"); + iconv(encoder, &inPtr, &inLeft, &outPtr, &outRoom); +], +iconv_old=yes,iconv_old=no) + LIBS="$old_libs" + CLFAGS="$old_cflags" + + if test "x$iconv_old" = "xyes"; then + AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv]) + else + AC_DEFINE([inbuf_t], [char], [Use char pointers for newer libiconv]) + fi +fi + +dnl ---------------------- +dnl Check if we need to +dnl support the old +dnl iconv interface +dnl ---------------------- +if test "x$iconv_ok" = "xyes"; then + old_libs="$LIBS" + LIBS="$old_libs $LIBICONV_LIBS" + old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([#include <iconv.h>], +[ + const char *inPtr; + char *outPtr; + size_t inLeft = 0, outRoom = 0; + iconv_t encoder = iconv_open("ASCII", "UTF-8"); + iconv(encoder, &inPtr, &inLeft, &outPtr, &outRoom); +], +iconv_old=yes,iconv_old=no) + LIBS="$old_libs" + CLFAGS="$old_cflags" + + if test "x$iconv_old" = "xyes"; then + AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv]) + else + AC_DEFINE([inbuf_t], [char], [Use char pointers for newer libiconv]) + fi +fi + +dnl ---------------------- dnl Test for POSIX threads dnl ---------------------- dnl |