annotate config/iconv.m4 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # iconv.m4 serial AM4 (gettext-0.11.3)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 dnl This file is free software, distributed under the terms of the GNU
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 dnl General Public License. As a special exception to the GNU General
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 dnl Public License, this file may be distributed as part of a program
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 dnl that contains a configuration script generated by Autoconf, under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 dnl the same distribution terms as the rest of that program.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 dnl From Bruno Haible.
111
kono
parents: 0
diff changeset
10 dnl with modifications to support building with in-tree libiconv
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 AC_REQUIRE([AC_LIB_RPATH])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 dnl accordingly.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 AC_LIB_LINKFLAGS_BODY([iconv])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 ])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 AC_DEFUN([AM_ICONV_LINK],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 dnl those with the standalone portable GNU libiconv installed).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 dnl accordingly.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 am_cv_func_iconv="no, consider installing GNU libiconv"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 am_cv_lib_iconv=no
111
kono
parents: 0
diff changeset
35 dnl Add $INCICONV to CPPFLAGS before performing the first check,
kono
parents: 0
diff changeset
36 dnl because if the user has installed libiconv and not disabled its use
kono
parents: 0
diff changeset
37 dnl via --without-libiconv-prefix, he wants to use it. This first
kono
parents: 0
diff changeset
38 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
kono
parents: 0
diff changeset
39 am_save_CPPFLAGS="$CPPFLAGS"
kono
parents: 0
diff changeset
40 CPPFLAGS="$CPPFLAGS $INCICONV"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 AC_TRY_LINK([#include <stdlib.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 #include <iconv.h>],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 [iconv_t cd = iconv_open("","");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 iconv(cd,NULL,NULL,NULL,NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 iconv_close(cd);],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 am_cv_func_iconv=yes)
111
kono
parents: 0
diff changeset
47 CPPFLAGS="$am_save_CPPFLAGS"
kono
parents: 0
diff changeset
48
kono
parents: 0
diff changeset
49 if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then
kono
parents: 0
diff changeset
50 for _libs in .libs _libs; do
kono
parents: 0
diff changeset
51 am_save_CPPFLAGS="$CPPFLAGS"
kono
parents: 0
diff changeset
52 am_save_LIBS="$LIBS"
kono
parents: 0
diff changeset
53 CPPFLAGS="$CPPFLAGS -I../libiconv/include"
kono
parents: 0
diff changeset
54 LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a"
kono
parents: 0
diff changeset
55 AC_TRY_LINK([#include <stdlib.h>
kono
parents: 0
diff changeset
56 #include <iconv.h>],
kono
parents: 0
diff changeset
57 [iconv_t cd = iconv_open("","");
kono
parents: 0
diff changeset
58 iconv(cd,NULL,NULL,NULL,NULL);
kono
parents: 0
diff changeset
59 iconv_close(cd);],
kono
parents: 0
diff changeset
60 INCICONV="-I../libiconv/include"
kono
parents: 0
diff changeset
61 LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a
kono
parents: 0
diff changeset
62 LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la
kono
parents: 0
diff changeset
63 am_cv_lib_iconv=yes
kono
parents: 0
diff changeset
64 am_cv_func_iconv=yes)
kono
parents: 0
diff changeset
65 CPPFLAGS="$am_save_CPPFLAGS"
kono
parents: 0
diff changeset
66 LIBS="$am_save_LIBS"
kono
parents: 0
diff changeset
67 if test "$am_cv_func_iconv" = "yes"; then
kono
parents: 0
diff changeset
68 break
kono
parents: 0
diff changeset
69 fi
kono
parents: 0
diff changeset
70 done
kono
parents: 0
diff changeset
71 fi
kono
parents: 0
diff changeset
72
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 if test "$am_cv_func_iconv" != yes; then
111
kono
parents: 0
diff changeset
74 am_save_CPPFLAGS="$CPPFLAGS"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 am_save_LIBS="$LIBS"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
76 CPPFLAGS="$CPPFLAGS $INCICONV"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 LIBS="$LIBS $LIBICONV"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 AC_TRY_LINK([#include <stdlib.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 #include <iconv.h>],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 [iconv_t cd = iconv_open("","");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 iconv(cd,NULL,NULL,NULL,NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 iconv_close(cd);],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 am_cv_lib_iconv=yes
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 am_cv_func_iconv=yes)
111
kono
parents: 0
diff changeset
85 CPPFLAGS="$am_save_CPPFLAGS"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 LIBS="$am_save_LIBS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 ])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 if test "$am_cv_func_iconv" = yes; then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 if test "$am_cv_lib_iconv" = yes; then
111
kono
parents: 0
diff changeset
93 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 AC_MSG_CHECKING([how to link with libiconv])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 AC_MSG_RESULT([$LIBICONV])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 LIBICONV=
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 LTLIBICONV=
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 AC_SUBST(LIBICONV)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 AC_SUBST(LTLIBICONV)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 ])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 AC_DEFUN([AM_ICONV],
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 AM_ICONV_LINK
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 if test "$am_cv_func_iconv" = yes; then
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 AC_MSG_CHECKING([for iconv declaration])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 AC_CACHE_VAL(am_cv_proto_iconv, [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 AC_TRY_COMPILE([
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 #include <stdlib.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 #include <iconv.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 extern
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 #ifdef __cplusplus
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 "C"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 #if defined(__STDC__) || defined(__cplusplus)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 #else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 size_t iconv();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 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);"])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 AC_MSG_RESULT([$]{ac_t:-
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 }[$]am_cv_proto_iconv)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 [Define as const if the declaration of iconv() needs const.])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 fi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 ])