7 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
8 dnl those with the standalone portable GNU libiconv installed).
10 AC_ARG_WITH([libiconv-prefix],
11 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
12 for dir in `echo "$withval" | tr : ' '`; do
13 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
14 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
18 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
19 am_cv_func_iconv="no, consider installing GNU libiconv"
21 AC_TRY_LINK([#include <stdlib.h>
23 [iconv_t cd = iconv_open("","");
24 iconv(cd,NULL,NULL,NULL,NULL);
27 if test "$am_cv_func_iconv" != yes; then
30 AC_TRY_LINK([#include <stdlib.h>
32 [iconv_t cd = iconv_open("","");
33 iconv(cd,NULL,NULL,NULL,NULL);
40 if test "$am_cv_func_iconv" = yes; then
41 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
42 AC_MSG_CHECKING([for iconv declaration])
43 AC_CACHE_VAL(am_cv_proto_iconv, [
51 #if defined(__STDC__) || defined(__cplusplus)
52 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
56 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
57 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);"])
58 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
59 AC_MSG_RESULT([$]{ac_t:-
60 }[$]am_cv_proto_iconv)
61 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
62 [Define as const if the declaration of iconv() needs const.])
65 if test "$am_cv_lib_iconv" = yes; then