diff configure.in @ 142:d87c151837f4

- Added suport for old iconv() (const char** as 2nd arg).
author jcid
date Fri, 14 Mar 2008 19:04:18 +0100
parents 9ca877f93161
children b2c94699dd6c
line wrap: on
line diff
--- a/configure.in	Fri Mar 14 18:34:14 2008 +0100
+++ b/configure.in	Fri Mar 14 19:04:18 2008 +0100
@@ -325,6 +325,64 @@
 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