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).
12 AC_ARG_WITH([libiconv],
13 [ --with-libiconv=DIR search for libiconv in DIR/include and DIR/lib], [
14 for dir in `echo "$withval" | tr : ' '`; do
15 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
16 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
20 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
21 am_cv_func_iconv="no, consider installing GNU libiconv"
23 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
24 #include <iconv.h>]], [[iconv_t cd = iconv_open("","");
25 iconv(cd,NULL,NULL,NULL,NULL);
26 iconv_close(cd);]])],[am_cv_func_iconv=yes],[])
27 if test "$am_cv_func_iconv" != yes; then
30 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
31 #include <iconv.h>]], [[iconv_t cd = iconv_open("","");
32 iconv(cd,NULL,NULL,NULL,NULL);
33 iconv_close(cd);]])],[am_cv_lib_iconv=yes
34 am_cv_func_iconv=yes],[])
38 if test "$am_cv_func_iconv" = yes; then
39 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
40 AC_MSG_CHECKING([for iconv declaration])
41 AC_CACHE_VAL(am_cv_proto_iconv, [
42 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
49 #if defined(__STDC__) || defined(__cplusplus)
50 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
54 ]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
55 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);"])
56 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
57 AC_MSG_RESULT([$]{ac_t:-
58 }[$]am_cv_proto_iconv)
59 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
60 [Define as const if the declaration of iconv() needs const.])
63 if test "$am_cv_lib_iconv" = yes; then