Debian Codegraph @

m4/iconv_open.m4

raw
1 # iconv_open.m4
2 # serial 17
3 dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 AC_DEFUN([gl_FUNC_ICONV_OPEN],
10 [
11 AC_REQUIRE([AM_ICONV])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13 AC_REQUIRE([gl_ICONV_H_DEFAULTS])
14 if test "$am_cv_func_iconv" = yes; then
15 dnl Provide the <iconv.h> override, for the sake of the C++ aliases.
16 gl_REPLACE_ICONV_H
17 dnl Test whether iconv_open accepts standardized encoding names.
18 dnl We know that GNU libiconv and GNU libc do.
19 AC_EGREP_CPP([gnu_iconv], [
20 #include <iconv.h>
21 #if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) \
22 || (defined __GLIBC__ && !defined __UCLIBC__)
23 gnu_iconv
24 #endif
25 ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no])
26 if test $gl_func_iconv_gnu = no; then
27 iconv_flavor=
28 case "$host_os" in
29 aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
30 irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
31 hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
32 osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
33 solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
34 openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;;
35 esac
36 if test -n "$iconv_flavor"; then
37 AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
38 [Define to a symbolic name denoting the flavor of iconv_open()
39 implementation.])
40 gl_REPLACE_ICONV_OPEN
41 fi
42 fi
43 m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [
44 gl_FUNC_ICONV_OPEN_UTF_SUPPORT
45 case "$gl_cv_func_iconv_supports_utf" in
46 *yes) ;;
47 *)
48 REPLACE_ICONV_UTF=1
49 AC_DEFINE([REPLACE_ICONV_UTF], [1],
50 [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
51 REPLACE_ICONV=1
52 gl_REPLACE_ICONV_OPEN
53 ;;
54 esac
55 ])
56 fi
57 ])
58
59 AC_DEFUN([gl_REPLACE_ICONV_OPEN],
60 [
61 gl_REPLACE_ICONV_H
62 REPLACE_ICONV_OPEN=1
63 ])