1
# iconv.m4 serial AM4 (gettext-0.11.3)
2
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
9
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
11
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
12
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
13
AC_REQUIRE([AC_LIB_RPATH])
15
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
17
AC_LIB_LINKFLAGS_BODY([iconv])
20
AC_DEFUN([AM_ICONV_LINK],
22
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
23
dnl those with the standalone portable GNU libiconv installed).
25
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
27
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
29
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
30
dnl because if the user has installed libiconv and not disabled its use
31
dnl via --without-libiconv-prefix, he wants to use it. The first
32
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
33
am_save_CPPFLAGS="$CPPFLAGS"
34
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
36
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
37
am_cv_func_iconv="no, consider installing GNU libiconv"
39
AC_TRY_LINK([#include <stdlib.h>
41
[iconv_t cd = iconv_open("","");
42
iconv(cd,NULL,NULL,NULL,NULL);
45
if test "$am_cv_func_iconv" != yes; then
47
LIBS="$LIBS $LIBICONV"
48
AC_TRY_LINK([#include <stdlib.h>
50
[iconv_t cd = iconv_open("","");
51
iconv(cd,NULL,NULL,NULL,NULL);
58
if test "$am_cv_func_iconv" = yes; then
59
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
61
if test "$am_cv_lib_iconv" = yes; then
62
AC_MSG_CHECKING([how to link with libiconv])
63
AC_MSG_RESULT([$LIBICONV])
65
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
67
CPPFLAGS="$am_save_CPPFLAGS"
78
if test "$am_cv_func_iconv" = yes; then
79
AC_MSG_CHECKING([for iconv declaration])
80
AC_CACHE_VAL(am_cv_proto_iconv, [
88
#if defined(__STDC__) || defined(__cplusplus)
89
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
93
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
94
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);"])
95
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
96
AC_MSG_RESULT([$]{ac_t:-
97
}[$]am_cv_proto_iconv)
98
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
99
[Define as const if the declaration of iconv() needs const.])