2005-09-15 09:58:31 -04:00
|
|
|
#serial AM2
|
|
|
|
|
|
|
|
dnl From Bruno Haible.
|
|
|
|
|
|
|
|
AC_DEFUN([AM_ICONV],
|
|
|
|
[
|
|
|
|
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
|
|
|
dnl those with the standalone portable GNU libiconv installed).
|
|
|
|
|
2006-02-08 14:08:33 -05:00
|
|
|
EL_SAVE_FLAGS
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
AC_ARG_WITH([libiconv],
|
|
|
|
[ --with-libiconv=DIR search for libiconv in DIR/include and DIR/lib], [
|
|
|
|
for dir in `echo "$withval" | tr : ' '`; do
|
2006-11-22 14:13:39 -05:00
|
|
|
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
2005-09-15 09:58:31 -04:00
|
|
|
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
|
|
|
am_cv_func_iconv="no, consider installing GNU libiconv"
|
|
|
|
am_cv_lib_iconv=no
|
2007-07-05 09:03:59 -04:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
|
|
|
|
#include <iconv.h>]], [[iconv_t cd = iconv_open("","");
|
2005-09-15 09:58:31 -04:00
|
|
|
iconv(cd,NULL,NULL,NULL,NULL);
|
2007-07-05 09:03:59 -04:00
|
|
|
iconv_close(cd);]])],[am_cv_func_iconv=yes],[])
|
2005-09-15 09:58:31 -04:00
|
|
|
if test "$am_cv_func_iconv" != yes; then
|
|
|
|
am_save_LIBS="$LIBS"
|
|
|
|
LIBS="$LIBS -liconv"
|
2007-07-05 09:03:59 -04:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
|
|
|
|
#include <iconv.h>]], [[iconv_t cd = iconv_open("","");
|
2005-09-15 09:58:31 -04:00
|
|
|
iconv(cd,NULL,NULL,NULL,NULL);
|
2007-07-05 09:03:59 -04:00
|
|
|
iconv_close(cd);]])],[am_cv_lib_iconv=yes
|
|
|
|
am_cv_func_iconv=yes],[])
|
2005-09-15 09:58:31 -04:00
|
|
|
LIBS="$am_save_LIBS"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
if test "$am_cv_func_iconv" = yes; then
|
|
|
|
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
|
|
|
AC_MSG_CHECKING([for iconv declaration])
|
|
|
|
AC_CACHE_VAL(am_cv_proto_iconv, [
|
2007-07-05 09:03:59 -04:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2005-09-15 09:58:31 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <iconv.h>
|
|
|
|
extern
|
|
|
|
#ifdef __cplusplus
|
|
|
|
"C"
|
|
|
|
#endif
|
|
|
|
#if defined(__STDC__) || defined(__cplusplus)
|
|
|
|
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
|
|
|
#else
|
|
|
|
size_t iconv();
|
|
|
|
#endif
|
2007-07-05 09:03:59 -04:00
|
|
|
]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
|
2005-09-15 09:58:31 -04:00
|
|
|
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);"])
|
|
|
|
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
|
|
|
AC_MSG_RESULT([$]{ac_t:-
|
|
|
|
}[$]am_cv_proto_iconv)
|
|
|
|
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
|
|
|
[Define as const if the declaration of iconv() needs const.])
|
|
|
|
fi
|
|
|
|
LIBICONV=
|
|
|
|
if test "$am_cv_lib_iconv" = yes; then
|
|
|
|
LIBICONV="-liconv"
|
2006-02-08 14:08:33 -05:00
|
|
|
else
|
|
|
|
EL_RESTORE_FLAGS
|
2005-09-15 09:58:31 -04:00
|
|
|
fi
|
|
|
|
])
|