-
-dnl ---------------
-dnl CHECK FOR ICONV
-dnl ---------------
-
-dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
-if test "x$ac_cv_header_iconv_h" = "xyes"; then
- AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
- if test "x$ac_found_iconv" = "xno"; then
- AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
- if test "x$ac_found_iconv" = "xno"; then
- AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
- fi
- if test "x$ac_found_iconv" != "xno"; then
- ICONVLIB="-liconv"
- fi
- else
- dnl Handle case where there is a native iconv but iconv.h is from libiconv
- AC_CHECK_DECL(_libiconv_version,
- [ AC_CHECK_LIB(iconv, libiconv, LIBS="-liconv $LIBS") ],,
- [ #include <iconv.h> ])
- fi
-fi
-if test "x$ac_found_iconv" = xyes; then
- AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function.])
-fi
-AC_SUBST([ICONVLIB])
-
-dnl Check if iconv uses const in prototype declaration
-if test "x$ac_found_iconv" = "xyes"; then
- AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
- #include <iconv.h>]],
- [[#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]])],
- [ac_cv_iconv_const=],
- [ac_cv_iconv_const=const])])
- AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
- [Define as const if the declaration of iconv() needs const.])
-fi