10 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
11 dnl those with the standalone portable GNU libiconv installed).
13 AC_ARG_WITH([libiconv-prefix],
14 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
15 # Addition Peter Verthez
16 ICONV_PATH=`echo "$withval" | tr : '/bin'`
17 ICONV_PATH="$ICONV_PATH/bin"
21 for dir in `echo "$withval" | tr : ' '`; do
22 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
23 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
27 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
28 am_cv_func_iconv="no, consider installing GNU libiconv"
30 AC_TRY_LINK([#include <stdlib.h>
32 [iconv_t cd = iconv_open("","");
33 iconv(cd,NULL,NULL,NULL,NULL);
36 if test "$am_cv_func_iconv" != yes; then
39 AC_TRY_LINK([#include <stdlib.h>
41 [iconv_t cd = iconv_open("","");
42 iconv(cd,NULL,NULL,NULL,NULL);
49 if test "$am_cv_func_iconv" = yes; then
50 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
51 AC_MSG_CHECKING([for iconv declaration])
52 AC_CACHE_VAL(am_cv_proto_iconv, [
60 #if defined(__STDC__) || defined(__cplusplus)
61 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
65 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
66 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
67 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
68 AC_MSG_RESULT([$]{ac_t:-
69 }[$]am_cv_proto_iconv)
70 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
71 [Define as const if the declaration of iconv() needs const.])
74 if test "$am_cv_lib_iconv" = yes; then
82 dnl Checks whether iconv is coming from glibc, defines USE_GLIBC_ICONV if so
83 dnl The variable $is_glibc_iconv contains yes or no
84 AC_DEFUN(AC_GLIBC_ICONV, [
85 AC_CACHE_CHECK(for the GNU C Library iconv implementation, is_glibc_iconv, [
92 ], is_glibc_iconv=yes, is_glibc_iconv=no)
94 if test "$is_glibc_iconv" = yes; then
95 AC_DEFINE(USE_GLIBC_ICONV,1,
96 [Define if the GNU implementation of iconv in glibc is used])
100 dnl AC_LIBICONV_HAS_ANSEL()
101 dnl Checks whether libiconv has ANSEL support
102 dnl The variable $is_ansel_supported contains yes or no
103 AC_DEFUN(AC_LIBICONV_HAS_ANSEL, [
104 AC_CACHE_CHECK(for ANSEL support in libiconv, is_ansel_supported, [
106 LIBS="$LIBS $LIBICONV"
110 iconv_t cd = iconv_open("UTF-8","ANSEL");
111 return (cd == (iconv_t)-1);
114 is_ansel_supported=yes,
115 is_ansel_supported=no,
116 is_ansel_supported=no)