Mercurial > hg > octave-lojdl > gnulib-hg
annotate m4/iconv.m4 @ 5585:adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 18 Jan 2005 13:07:56 +0000 |
parents | 3358eb550c86 |
children | 5cba81876885 |
rev | line source |
---|---|
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 # iconv.m4 serial AM4 (gettext-0.11.3) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. |
5585
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 dnl From Bruno Haible. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 AC_REQUIRE([AC_LIB_RPATH]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 dnl accordingly. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 AC_LIB_LINKFLAGS_BODY([iconv]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 AC_DEFUN([AM_ICONV_LINK], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 dnl those with the standalone portable GNU libiconv installed). |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 dnl accordingly. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 dnl Add $INCICONV to CPPFLAGS before performing the following checks, |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 dnl because if the user has installed libiconv and not disabled its use |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 dnl via --without-libiconv-prefix, he wants to use it. The first |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 am_save_CPPFLAGS="$CPPFLAGS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 am_cv_func_iconv="no, consider installing GNU libiconv" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 am_cv_lib_iconv=no |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 AC_TRY_LINK([#include <stdlib.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 #include <iconv.h>], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 [iconv_t cd = iconv_open("",""); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 iconv(cd,NULL,NULL,NULL,NULL); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 iconv_close(cd);], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 am_cv_func_iconv=yes) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 if test "$am_cv_func_iconv" != yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 am_save_LIBS="$LIBS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 LIBS="$LIBS $LIBICONV" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 AC_TRY_LINK([#include <stdlib.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 #include <iconv.h>], |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
50 [iconv_t cd = iconv_open("",""); |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
51 iconv(cd,NULL,NULL,NULL,NULL); |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
52 iconv_close(cd);], |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
53 am_cv_lib_iconv=yes |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
54 am_cv_func_iconv=yes) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 LIBS="$am_save_LIBS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 if test "$am_cv_func_iconv" = yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 if test "$am_cv_lib_iconv" = yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 AC_MSG_CHECKING([how to link with libiconv]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 AC_MSG_RESULT([$LIBICONV]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 else |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 dnl either. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 CPPFLAGS="$am_save_CPPFLAGS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 LIBICONV= |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 LTLIBICONV= |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 AC_SUBST(LIBICONV) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 AC_SUBST(LTLIBICONV) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 AC_DEFUN([AM_ICONV], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 AM_ICONV_LINK |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 if test "$am_cv_func_iconv" = yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 AC_MSG_CHECKING([for iconv declaration]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 AC_CACHE_VAL(am_cv_proto_iconv, [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 AC_TRY_COMPILE([ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 #include <stdlib.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 #include <iconv.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 extern |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 #ifdef __cplusplus |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 "C" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 #endif |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 #if defined(__STDC__) || defined(__cplusplus) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 #else |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 size_t iconv(); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 #endif |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
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);"]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 AC_MSG_RESULT([$]{ac_t:- |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
97 }[$]am_cv_proto_iconv) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 [Define as const if the declaration of iconv() needs const.]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 ]) |