gcc/config/iconv.m4

294 lines
9.4 KiB
Plaintext
Raw Permalink Normal View History

*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
# iconv.m4 serial 26
dnl Copyright (C) 2000-2002, 2007-2014, 2016-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_PREREQ([2.64])
dnl Note: AM_ICONV is documented in the GNU gettext manual
dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>.
dnl Don't make changes that are incompatible with that documentation!
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
[
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([iconv])
])
AC_DEFUN([AM_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdlib.h>
#include <iconv.h>
]],
[[iconv_t cd = iconv_open("","");
Missing parts of fixes for in-tree libiconv (The previous iconv-related commit missed the config/iconv.m4 change.) Original description: This is the second in a series of patches to make a build with an in-tree GNU libiconv work as designed. Currently GDB is the only toolchain component which actually uses an in-tree libiconv. This patch modifies the common AM_ICONV to use an in-tree libiconv when present and not already provided by libc. (GDB's workaround uses an in-tree libiconv even when libc provides iconv(3); I'm not sure when or why that would be desirable.) config/ChangeLog: 2015-08-24 Yaakov Selkowitz <yselkowi@redhat.com> * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. --- config/ChangeLog | 4 +++ config/iconv.m4 | 47 +++++++++++++++++++++------ 4 files changed, 112 insertions(+), 36 deletions(-) diff --git a/config/iconv.m4 b/config/iconv.m4 index c5f3579..5f9304a 100644 --- a/config/iconv.m4 +++ b/config/iconv.m4 @@ -7,6 +7,7 @@ dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. +dnl with modifications to support building with in-tree libiconv AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ @@ -28,24 +29,51 @@ AC_DEFUN([AM_ICONV_LINK], dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no + dnl Add $INCICONV to CPPFLAGS before performing the first check, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. This first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCICONV" AC_TRY_LINK([#include <stdlib.h> #include <iconv.h>], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" + + if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then + for _libs in .libs _libs; do + am_save_CPPFLAGS="$CPPFLAGS" + am_save_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS -I../libiconv/include" + LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + INCICONV="-I../libiconv/include" + LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a + LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" + LIBS="$am_save_LIBS" + if test "$am_cv_func_iconv" = "yes"; then + break + fi + done + fi + if test "$am_cv_func_iconv" != yes; then + am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" + CPPFLAGS="$LIBS $INCICONV" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include <stdlib.h> #include <iconv.h>], @@ -54,6 +82,7 @@ AC_DEFUN([AM_ICONV_LINK], iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" LIBS="$am_save_LIBS" fi ]) @@ -61,12 +90,10 @@ AC_DEFUN([AM_ICONV_LINK], AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi -- 1.9.3 From-SVN: r227118
2015-08-24 10:24:52 +00:00
iconv(cd,NULL,NULL,NULL,NULL);
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
iconv_close(cd);]])],
[am_cv_func_iconv=yes])
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdlib.h>
#include <iconv.h>
]],
[[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);]])],
[am_cv_lib_iconv=yes]
[am_cv_func_iconv=yes])
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
dnl Solaris 10.
am_save_LIBS="$LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
am_cv_func_iconv_works=no
for ac_iconv_const in '' 'const'; do
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <iconv.h>
#include <string.h>
#ifndef ICONV_CONST
# define ICONV_CONST $ac_iconv_const
#endif
]],
[[int result = 0;
/* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from
successful returns. This is even documented in
<https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */
{
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
if (cd_utf8_to_88591 != (iconv_t)(-1))
{
static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
char buf[10];
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
result |= 1;
iconv_close (cd_utf8_to_88591);
}
}
/* Test against Solaris 10 bug: Failures are not distinguishable from
successful returns. */
{
iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
if (cd_ascii_to_88591 != (iconv_t)(-1))
{
static ICONV_CONST char input[] = "\263";
char buf[10];
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_ascii_to_88591,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
result |= 2;
iconv_close (cd_ascii_to_88591);
}
}
/* Test against AIX 6.1..7.1 bug: Buffer overrun. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static ICONV_CONST char input[] = "\304";
static char buf[2] = { (char)0xDE, (char)0xAD };
ICONV_CONST char *inptr = input;
size_t inbytesleft = 1;
char *outptr = buf;
size_t outbytesleft = 1;
size_t res = iconv (cd_88591_to_utf8,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
result |= 4;
iconv_close (cd_88591_to_utf8);
}
}
#if 0 /* This bug could be worked around by the caller. */
/* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
char buf[50];
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if ((int)res > 0)
result |= 8;
iconv_close (cd_88591_to_utf8);
}
}
#endif
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
provided. */
{
/* Try standardized names. */
iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
/* Try IRIX, OSF/1 names. */
iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
/* Try AIX names. */
iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
/* Try HP-UX names. */
iconv_t cd4 = iconv_open ("utf8", "eucJP");
if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
&& cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
result |= 16;
if (cd1 != (iconv_t)(-1))
iconv_close (cd1);
if (cd2 != (iconv_t)(-1))
iconv_close (cd2);
if (cd3 != (iconv_t)(-1))
iconv_close (cd3);
if (cd4 != (iconv_t)(-1))
iconv_close (cd4);
}
return result;
]])],
[am_cv_func_iconv_works=yes], ,
[case "$host_os" in
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac])
test "$am_cv_func_iconv_works" = no || break
done
LIBS="$am_save_LIBS"
])
case "$am_cv_func_iconv_works" in
*no) am_func_iconv=no am_cv_lib_iconv=no ;;
*) am_func_iconv=yes ;;
esac
else
am_func_iconv=no am_cv_lib_iconv=no
fi
if test "$am_func_iconv" = yes; then
AC_DEFINE([HAVE_ICONV], [1],
[Define if you have the iconv() function and it works.])
fi
if test "$am_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([$LIBICONV])
else
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
dnl either.
CPPFLAGS="$am_save_CPPFLAGS"
LIBICONV=
LTLIBICONV=
fi
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_SUBST([LIBICONV])
AC_SUBST([LTLIBICONV])
])
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like
dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
AC_DEFUN_ONCE([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature],
[gl_cv_iconv_nonconst],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
*: add modern gettext This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
2023-05-19 19:12:57 +00:00
]],
[[]])],
[gl_cv_iconv_nonconst=yes],
[gl_cv_iconv_nonconst=no])
])
else
dnl When compiling GNU libiconv on a system that does not have iconv yet,
dnl pick the POSIX compliant declaration without 'const'.
gl_cv_iconv_nonconst=yes
fi
if test $gl_cv_iconv_nonconst = yes; then
iconv_arg1=""
else
iconv_arg1="const"
fi
AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1],
[Define as const if the declaration of iconv() needs const.])
dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
m4_ifdef([gl_ICONV_H_DEFAULTS],
[AC_REQUIRE([gl_ICONV_H_DEFAULTS])
if test $gl_cv_iconv_nonconst != yes; then
ICONV_CONST="const"
fi
])
dnl A summary result, for those packages which want to print a summary at the
dnl end of the configuration.
if test "$am_func_iconv" = yes; then
if test -n "$LIBICONV"; then
am_cv_func_iconv_summary='yes, in libiconv'
else
am_cv_func_iconv_summary='yes, in libc'
fi
else
if test "$am_cv_func_iconv" = yes; then
am_cv_func_iconv_summary='not working, consider installing GNU libiconv'
else
am_cv_func_iconv_summary='no, consider installing GNU libiconv'
fi
fi
])