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 # Addition Peter Verthez
14 ICONV_PATH=`echo "$withval" | tr : '/dir'`
15 ICONV_PATH="$ICONV_PATH/dir"
19 for dir in `echo "$withval" | tr : ' '`; do
20 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
21 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
25 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
26 am_cv_func_iconv="no, consider installing GNU libiconv"
28 AC_TRY_LINK([#include <stdlib.h>
30 [iconv_t cd = iconv_open("","");
31 iconv(cd,NULL,NULL,NULL,NULL);
34 if test "$am_cv_func_iconv" != yes; then
37 AC_TRY_LINK([#include <stdlib.h>
39 [iconv_t cd = iconv_open("","");
40 iconv(cd,NULL,NULL,NULL,NULL);
47 if test "$am_cv_func_iconv" = yes; then
48 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
49 AC_MSG_CHECKING([for iconv declaration])
50 AC_CACHE_VAL(am_cv_proto_iconv, [
58 #if defined(__STDC__) || defined(__cplusplus)
59 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
63 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
64 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);"])
65 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
66 AC_MSG_RESULT([$]{ac_t:-
67 }[$]am_cv_proto_iconv)
68 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
69 [Define as const if the declaration of iconv() needs const.])
72 if test "$am_cv_lib_iconv" = yes; then
80 dnl Checks whether iconv is coming from glibc, defines USE_GLIBC_ICONV if so
81 dnl The variable $is_glibc_iconv contains yes or no
82 AC_DEFUN(AC_GLIBC_ICONV, [
83 AC_CACHE_CHECK(for the GNU C Library iconv implementation, is_glibc_iconv, [
90 ], is_glibc_iconv=yes, is_glibc_iconv=no)
92 if test "$is_glibc_iconv" = yes; then
93 AC_DEFINE(USE_GLIBC_ICONV,1,
94 [Define if the GNU implementation of iconv in glibc is used])
98 dnl AC_LIBICONV_HAS_ANSEL()
99 dnl Checks whether libiconv has ANSEL support
100 dnl The variable $is_ansel_supported contains yes or no
101 AC_DEFUN(AC_LIBICONV_HAS_ANSEL, [
102 AC_CACHE_CHECK(for ANSEL support in libiconv, is_ansel_supported, [
104 LIBS="$LIBS $LIBICONV"
108 iconv_t cd = iconv_open("UTF-8","ANSEL");
109 return (cd == (iconv_t)-1);
112 is_ansel_supported=yes,
113 is_ansel_supported=no,
114 is_ansel_supported=no)