8 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
9 dnl those with the standalone portable GNU libiconv installed).
11 AC_ARG_WITH([libiconv-prefix],
12 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
13 for dir in `echo "$withval" | tr : ' '`; do
14 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
15 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
19 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
20 am_cv_func_iconv="no, consider installing GNU libiconv"
22 AC_TRY_LINK([#include <stdlib.h>
24 [iconv_t cd = iconv_open("","");
25 iconv(cd,NULL,NULL,NULL,NULL);
28 if test "$am_cv_func_iconv" != yes; then
31 AC_TRY_LINK([#include <stdlib.h>
33 [iconv_t cd = iconv_open("","");
34 iconv(cd,NULL,NULL,NULL,NULL);
41 if test "$am_cv_func_iconv" = yes; then
42 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
43 AC_MSG_CHECKING([for iconv declaration])
44 AC_CACHE_VAL(am_cv_proto_iconv, [
52 #if defined(__STDC__) || defined(__cplusplus)
53 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
57 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
58 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);"])
59 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
60 AC_MSG_RESULT([$]{ac_t:-
61 }[$]am_cv_proto_iconv)
62 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
63 [Define as const if the declaration of iconv() needs const.])
66 if test "$am_cv_lib_iconv" = yes; then
74 dnl Checks whether iconv is coming from glibc, defines USE_GLIBC_ICONV if so
75 dnl The variable $is_glibc_iconv contains yes or no
76 AC_DEFUN(AC_GLIBC_ICONV, [
77 AC_CACHE_CHECK(for the GNU C Library iconv implementation, is_glibc_iconv, [
84 ], is_glibc_iconv=yes, is_glibc_iconv=no)
86 if test "$is_glibc_iconv" = yes; then
87 AC_DEFINE(USE_GLIBC_ICONV,1,
88 [Define if the GNU implementation of iconv in glibc is used])
92 dnl AC_LIBICONV_HAS_ANSEL()
93 dnl Checks whether libiconv has ANSEL support
94 dnl The variable $is_ansel_supported contains yes or no
95 AC_DEFUN(AC_LIBICONV_HAS_ANSEL, [
96 AC_CACHE_CHECK(for ANSEL support in libiconv, is_ansel_supported, [
98 LIBS="$LIBS $LIBICONV"
102 iconv_t cd = iconv_open("UTF-8","ANSEL");
103 return (cd == (iconv_t)-1);
106 is_ansel_supported=yes,
107 is_ansel_supported=no,
108 is_ansel_supported=no)