|
|
2ff057 |
# iconv.m4 serial AM4 (gettext-0.11.3)
|
|
|
2ff057 |
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
|
|
|
2ff057 |
dnl This file is free software; the Free Software Foundation
|
|
|
2ff057 |
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
2ff057 |
dnl with or without modifications, as long as this notice is preserved.
|
|
|
2ff057 |
|
|
|
2ff057 |
dnl From Bruno Haible.
|
|
|
2ff057 |
|
|
|
2ff057 |
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
|
|
|
2ff057 |
[
|
|
|
2ff057 |
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
|
|
|
2ff057 |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
|
|
2ff057 |
AC_REQUIRE([AC_LIB_RPATH])
|
|
|
2ff057 |
|
|
|
2ff057 |
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
|
|
|
2ff057 |
dnl accordingly.
|
|
|
2ff057 |
AC_LIB_LINKFLAGS_BODY([iconv])
|
|
|
2ff057 |
])
|
|
|
2ff057 |
|
|
|
2ff057 |
AC_DEFUN([AM_ICONV_LINK],
|
|
|
2ff057 |
[
|
|
|
2ff057 |
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
|
|
2ff057 |
dnl those with the standalone portable GNU libiconv installed).
|
|
|
2ff057 |
|
|
|
2ff057 |
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
|
|
|
2ff057 |
dnl accordingly.
|
|
|
2ff057 |
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
|
|
|
2ff057 |
|
|
|
2ff057 |
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
|
|
|
2ff057 |
dnl because if the user has installed libiconv and not disabled its use
|
|
|
2ff057 |
dnl via --without-libiconv-prefix, he wants to use it. The first
|
|
|
2ff057 |
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
|
|
|
2ff057 |
am_save_CPPFLAGS="$CPPFLAGS"
|
|
|
2ff057 |
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
|
|
|
2ff057 |
|
|
|
2ff057 |
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
|
|
2ff057 |
am_cv_func_iconv="no, consider installing GNU libiconv"
|
|
|
2ff057 |
am_cv_lib_iconv=no
|
|
|
2ff057 |
AC_TRY_LINK([#include <stdlib.h>
|
|
|
2ff057 |
#include <iconv.h>],
|
|
|
2ff057 |
[iconv_t cd = iconv_open("","");
|
|
|
2ff057 |
iconv(cd,NULL,NULL,NULL,NULL);
|
|
|
2ff057 |
iconv_close(cd);],
|
|
|
2ff057 |
am_cv_func_iconv=yes)
|
|
|
2ff057 |
if test "$am_cv_func_iconv" != yes; then
|
|
|
2ff057 |
am_save_LIBS="$LIBS"
|
|
|
2ff057 |
LIBS="$LIBS $LIBICONV"
|
|
|
2ff057 |
AC_TRY_LINK([#include <stdlib.h>
|
|
|
2ff057 |
#include <iconv.h>],
|
|
|
2ff057 |
[iconv_t cd = iconv_open("","");
|
|
|
2ff057 |
iconv(cd,NULL,NULL,NULL,NULL);
|
|
|
2ff057 |
iconv_close(cd);],
|
|
|
2ff057 |
am_cv_lib_iconv=yes
|
|
|
2ff057 |
am_cv_func_iconv=yes)
|
|
|
2ff057 |
LIBS="$am_save_LIBS"
|
|
|
2ff057 |
fi
|
|
|
2ff057 |
])
|
|
|
2ff057 |
if test "$am_cv_func_iconv" = yes; then
|
|
|
2ff057 |
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
|
|
2ff057 |
fi
|
|
|
2ff057 |
if test "$am_cv_lib_iconv" = yes; then
|
|
|
2ff057 |
AC_MSG_CHECKING([how to link with libiconv])
|
|
|
2ff057 |
AC_MSG_RESULT([$LIBICONV])
|
|
|
2ff057 |
else
|
|
|
2ff057 |
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
|
|
|
2ff057 |
dnl either.
|
|
|
2ff057 |
CPPFLAGS="$am_save_CPPFLAGS"
|
|
|
2ff057 |
LIBICONV=
|
|
|
2ff057 |
LTLIBICONV=
|
|
|
2ff057 |
fi
|
|
|
2ff057 |
AC_SUBST(LIBICONV)
|
|
|
2ff057 |
AC_SUBST(LTLIBICONV)
|
|
|
2ff057 |
])
|
|
|
2ff057 |
|
|
|
2ff057 |
AC_DEFUN([AM_ICONV],
|
|
|
2ff057 |
[
|
|
|
2ff057 |
AM_ICONV_LINK
|
|
|
2ff057 |
if test "$am_cv_func_iconv" = yes; then
|
|
|
2ff057 |
AC_MSG_CHECKING([for iconv declaration])
|
|
|
2ff057 |
AC_CACHE_VAL(am_cv_proto_iconv, [
|
|
|
2ff057 |
AC_TRY_COMPILE([
|
|
|
2ff057 |
#include <stdlib.h>
|
|
|
2ff057 |
#include <iconv.h>
|
|
|
2ff057 |
extern
|
|
|
2ff057 |
#ifdef __cplusplus
|
|
|
2ff057 |
"C"
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
#if defined(__STDC__) || defined(__cplusplus)
|
|
|
2ff057 |
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
|
|
2ff057 |
#else
|
|
|
2ff057 |
size_t iconv();
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
|
|
2ff057 |
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);"])
|
|
|
2ff057 |
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
|
|
2ff057 |
AC_MSG_RESULT([$]{ac_t:-
|
|
|
2ff057 |
}[$]am_cv_proto_iconv)
|
|
|
2ff057 |
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
|
|
2ff057 |
[Define as const if the declaration of iconv() needs const.])
|
|
|
2ff057 |
fi
|
|
|
2ff057 |
])
|